I have written this program in 8086 assembly and I can getting some errors that I do not understand. Namely on line 26 and 27 I am getting the error "Illegal Immediate" and on lines 31,37,38,43,44 I am getting the error "Cannot convert to pointer". I am new to this programming language, but I thought these lines were valid. Can anyone shed some light on what I may be doing incorrectly? Thanks a lot.
title files in title ;program name
;-------------------------------------------------------------------------------------
stacksg segment para stack 'Stack' ;define the stack
db 32 dup (0) ;32 bytes, might want to set larger
stacksg endS
;-------------------------------------------------------------------------------------
datasg segment para 'Data' ;data segment
first db 0
second db 1
loopit dw 12
datasg ends
;-------------------------------------------------------------------------------------
codesg segment para 'Code' ;code segment
main proc far ;main procedure
assume ss:stacksg, ds:datasg, cs:codesg ;define segment registers
MOV AL, first ;moves 0 into AL
MOV AH, second ;moves 1 into AH
MOV CX, loopit ; sets limit to 12 (parity flag)
MOV [200],AL ;moves 0 into memory location 200
MOV [201],AH ;moves 1 into memory location 201
MOV BL,202 ;moves 200 into BL
ADD AH, AL ;adds 0 and 1, AH is still 1
MOV [BL],AH ;moves 1 into memory location 202
INC BL ;increments BL, BL is now 203
MOV CL,201 ;moves 201 into CL
MOV CH, 202 ;moves 202 into CH
ADD AH,[CL] ;adds 1 and 1, AH is now 2
MOV [BL], AH ;moves 2 into memory location 203 (indirectly via BL)
INC BL ;increments BL, BL is now 204
loopSection:
INC CL ;increments CL
ADD AH,[CL] ;adds what is in memory location CL to AH
MOV [BL], AH ;moves what is in BH into memory location (indirectly via BL)
INC BL ;increments BL
DEC CX ; decrements cx by 1
jnz loopSection
main endp ;end of procedure
codesg ends
end main
bx,si,diandbp(defaulting toss:bp). Notcx(or others). - Frank Kotleral = [bx + al]withXLAT:) - Aki SuihkonenMOV BL,202 ;moves 200 into BLis incorrect andINC BL ;increments BLis stating the bleeding obvious. Comments should explain the code, not replicate it! - Skizz