Assembly: troubles with drawing a square | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок

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.

29th Aug 2018, 6:22 PM
Etabeta1🇮🇹 - avatar
1 ответ
+ 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
13th Aug 2019, 11:21 AM
Aruisehu - avatar