
Instruction Set
4-221
SCAS
SCAS
Examples
This example scans a list of words in memory until it finds a value that is different or all
words are compared. The microcontroller scans the words, one by one, from first to last.
; defined in SEG_L
LIST
DW
32 DUP (?)
FILL
EQU
FFFFh
; notify assembler: DS and ES specify the
; same segment of memory
ASSUME DS:SEG_L, ES:SEG_L
; set up segment registers with same segment
MOV
AX,SEG_L
; load segment into DS and ES
MOV
DS,AX
; DS points to SEG_L
MOV
ES,AX
; ES points to SEG_L
; initialize and use list
...
; set up registers and flags
MOV
AX,FILL
; copy value to AL
LEA
DI,LIST
; load offset (segment = ES)
MOV
CX,LENGTH LIST
; set up counter
CLD
; process list low to high
; scan list for different value
REPZ
SCASW
; if list contains different value
JNZ
ERROR
; else
JMP
OKAY
ERROR:
...
JMP
CONTINUE
OKAY:
...
CONTINUE:
...
Содержание Am186 Series
Страница 1: ...Am186 and Am188 Family Instruction Set Manual February 1997...
Страница 10: ...Table of Contents x...
Страница 18: ...Programming 1 8...
Страница 40: ...Instruction Set Listing 3 14...