问题
so for a project i need to program a game in 80386 (32-bit processor).
To draw a pixel we got this example code from the teacher:
-first set the video mode: MOV ah, 00h MOV al, 13h INT 10h
-drawing the pixel:
MOV ESI, 0A0000H ; frame buffer address
MOV EDI, 320 * 2 + 10; add the appropriate offset
MOV AL, 10 ; index in the colour palette
MOV [EDI], AL ; change pixel at column 10 of row 2
This code works perfectly, but in my game code i want to add in the data the x and y positions of the 'player'
xpos dw 10 ypos dw 2
when i try to acces those variables i get the error "Can't add relative quantities"
i've tried:
MOV ESI, 0A0000H ; frame buffer address
MOV EDI, 320 * offset yPosChar + offset xPosChar; add the appropriate offset
MOV AL, 10 ; index in the colour palette
MOV [EDI], AL ; change pixel at column 10 of row 2
and also: (this gets an other error: "illegal memory acces")
MOV ESI, 0A0000H ; frame buffer address
MOV EDI, 320 * [yPosChar] + [xPosChar] ; add the appropriate offset
MOV AL, 10 ; index in the colour palette
MOV [EDI], AL ; change pixel at column 10 of row 2
PLEASE HELP? IDK WHAT IM DOING WRONG AND IT DRIVES ME CRAZY
来源:https://stackoverflow.com/questions/64830004/cant-add-relative-quantities-assembly-error