Im trying to make a ball with Assembly 8086 NASM using the INT 10H and DOSBOX, in UBUNTU
like this :
MOV AH, 0Ch ; function to write the pixel
MOV AL, 0Fh ; color of the pixel (set to white)
MOV BH, 00h ; the page number (0 because its the only page im working on)
MOV CX, 160 ; X Position on the screen
MOV DX, 100 ; Y Position on the screen
INT 10h
Im working on a 360x200 video mode, so the pixel shows up at the middle here is how its working : https://imgur.com/BS62ohp
When i assign the values directly to CX and DX (x and y positions), the pixel shows up pretty fine once i turn it into an initialized variable, it disappear and the screen is completely black. No bugs no warnings whatsoever here is it turned into variables :
segment .data
BALL_X DW 160
BALL_Y DW 100
segment .text
global main
main:
MOV AH, 0Ch
MOV AL, 0Fh
MOV BH, 00h
**MOV CX, [BALL_X]**
**MOV DX, [BALL_Y]**
INT 10h
i have tried "[BALL_X]", "word [BALL_X]", "BALL_X". here is when i turn it into variables : https://imgur.com/6jXqoaq
Here is the full code :
segment .data
BALL_X DW 300
BALL_Y DW 170
segment .text
global main
main:
; setting the video mode to 360x200
MOV AH, 00h
MOV Al, 13h
INT 10h
; setting the background color to Black
MOV AH, 0Bh
MOV BH, 00h
MOV BL, 0h
INT 10h
; the pixel code
MOV AH, 0Ch
MOV AL, 0Fh
MOV BH, 00h
MOV CX, word [BALL_X]
MOV DX, word [BALL_Y]
INT 10h