Last active
March 6, 2019 14:08
-
-
Save neuro-sys/19e2c9e7d6d0e7a4da798c60e9b3f1e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start: call mode13 ; Set mode 13 | |
repeat_row: mov ax, [posx] | |
cmp ax, 320 ; Check if posx >= 320 | |
jz end_xloop ; Stop | |
mov al, [color] | |
mov cx, [posx] | |
mov dx, [posy] | |
call setpixel ; Set pixel at posx, posy with color | |
inc byte [color] ; color += 1 | |
inc word [posx] ; posx += 1 | |
jmp repeat_row ; Repeat | |
end_xloop: mov word [posx], 0 ; Reset posx | |
inc word [posy] ; posy += 1 | |
mov ax, [posy] | |
cmp ax, 200 ; Check if posy >= 200 | |
jne repeat_row ; Repeat | |
call waitkey | |
call exit | |
mode13: mov ax, 13h | |
int 10h ; Switch to gfx mode | |
ret | |
; cx = X, dx = Y, bh = color | |
setpixel: mov ah, 0ch | |
mov bh, 0 | |
int 10h ; Set pixel top-left | |
ret | |
waitkey: mov ax, 0 | |
int 16h ; Wait for keyboard | |
ret | |
exit: mov ax, 3h | |
int 10h ; Switch to text mode | |
int 20h ; Terminate | |
ret | |
color: db 1 | |
posx: dw 2 | |
posy: dw 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment