When I'm running this code in emu8086 everything is fine, but I have to run this code in AFD and when then line after line im tipping I have a error in JC et2
Symbol not defined
MOV CL,00fh
MOV SI,000h
MOV DI,000h
;i=0
MOV [220h+SI],240h
et1:
MOV AH,[210h+DI]
INC DI
MOV AL, [210h+DI]
CMP AH,AL
JC et2
INC SI
INC SI
MOV [220h+SI],240h
loop et1
HLT
et2:
INC SI
INC SI
DEC CL
JNZ et1
HLT
loop et2
ret
Please help me handle that
It seems very hard to find info about "AFD" but here are some pointers that might help you find a solution:
If you're submitting this program to "AFD" as source, then it could be that the mnemonic jc
is simply not understood. Try using jb
which does exactly the same.
Different programs have different sets of reserved words. Maybe "AFD" considers et2 a reserved symbol rendering the instruction jc et2
meaningless. Try renaming your labels. Perhaps choose IsBelow ? Anyway , using more meaningful names is always a good idea.
A few remarks on your code:
You only initialize the CL register with MOV CL,00fh
. Note that the loop
instruction depends on the entire CX register.
The loop et2
instruction below the hlt
makes no sense! If it got executed at all, it would start a 64KB loop (because the counter would be 0 at that time) destroying your program data altogether.
Since all that you really do when AH is below AL is bypass the writing of another number 0240h, you can nicely simplify your progran like this:
MOV CX, 000Fh
MOV SI, 0000h
MOV DI, 0000h
MOV [0220h+SI], 0240h
TopOfTheLoop:
MOV AH, [0210h+DI]
INC DI
MOV AL, [0210h+DI]
INC SI
INC SI
CMP AH, AL
JB IsBelow
MOV [0220h+SI], 0240h
IsBelow:
LOOP TopOfTheLoop
HLT
Yes, to solve my problem you have to define et2:...loop et2 and then write JC et2. if et2 is not defined you cannot use JC et2.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.