I'm working in 16 bit NASM assembly having an issue where my code won't build. The error happens on all the MOV lines here:
section .bss
x_coord RESB 8 ; [x_coord] is the head, [x_coord+2] is the next cell, etc.
y_coord RESB 8 ; Same here
pixel_x RESB 2 ; Storage for calculations
pixel_y RESB 2 ; Storage for calculations
...
MOV [pixel_x], [x_coord]
MOV [pixel_y], [y_coord]
CALL DrawPixel
MOV [pixel_x], [x_coord+2]
MOV [pixel_y], [y_coord+2]
CALL DrawPixel
MOV [pixel_x], [x_coord+4]
MOV [pixel_y], [y_coord+4]
CALL DrawPixel
MOV [pixel_x], [x_coord+6]
MOV [pixel_y], [y_coord+6]
CALL DrawPixel
I've read that this happens because the assembler doesn't know what size the variables are. I tried MOV [pixel_x], byte [x_coord]
suggested by some online post but that gives the same error. I just want to copy the first two bytes of x_coord
and y_coord
into pixel_x
/pixel_y
, then the next two, then the next two, then the next two. How can I make this work?