I'm working on an assembly practice problem and I need to draw y=2x^2 on the screen using INT 10h
. I have completed my code but it's giving me an error when assembling: A2155 cannot use 16-bit register with a 32-bit address
error on line 27 (it's marked with ** in the code below. This code also does not use int 10h. Do I have to call it or passing some data or registers to a register is enough? Sorry I'm very new to this concept and 2D graphics with Assembly.
My code is:
INCLUDE Irvine32.inc
.data
num dw 0
.code
main PROC
mov ax, 0A000h ;Set the segment address of the video buffer
mov es, ax ;to ES
L1:
mov bx, num
mov ax, 2 ;Set AX to the coefficient of x^2
mul bx ;Calculate 2x^2
mov bx, ax ;Move the result to BX
mov ax, 0C000h ;Set the segment address of the video buffer
mov ds, ax ;to DS
mov ax, 0 ;Set AX to the current y-value
mov cx, bx ;Move the result of 2x^2 to CX
mov al, 0111b ;Set AL to the color of the pixel
mov di, cx ;Set DI to the current x-value
** mov es:[di], ax ;Draw the pixel
inc num ;Increment the x-value
cmp num, 100 ;Compare the x-value to the ending x-value
jl L1 ;If x is less than the ending x-value, loop
ret ;Exit the program
main ENDP
END main