0
Assembly: troubles with drawing a square
wrote that code in asssembly: [bits 16] [org 0x7c00] mov ah, 0 ; mov al, 13h ; set graphic mode int 10h ; mov cx, sx mov dx, sy mov ah, 0ch colcount: inc cx int 10h cmp cx, hh jne colcount mov cx, sx inc dx cmp dx, ww jne colcount ;;; vars section sx dd 0 ;start x position sy dd 0 ;start y position hh dd 30 ;height ww dd 30 ;width times 510 - ($ - $) db 0x0 dw 0xaa55 i expected this code to draw a square at the top left corner of the screen but it draw only a rect in the middle. I don't know where is the problem. I use nasm as compiler, there aren't any error message. I took a part of that code from Stackoverflow, thanks YonBruchim.
1 Réponse
+ 1
Try moving the cursor to the right coordinate using the 10h interruption function 2h before drawing
It should look like this
mov ah, 02h
mov dh, 0h
mov dl, 0h
int 10h
Add this code after you set the graphic mode