Are there any graphics tutorials in pure assembly? Ive done a few that were for assembly in pscal or c, but i just cant get those to work because they were meant to be used in an hll. Any thing would be appriciated.
Ok, ive figured out how to do some simple graphics. Its just a pixel bouncing around the screen. My problem is that when the pixel gets to the bottom, it disapears. Heres the code...
Code:
.model tiny
.386
.code
org 100h
start:
mov ax, 0013h
int 10h
mov ax, 0a000h
mov es, ax
main_loop:
mov di, 0a000h ; Clear screen, es = address
mov ax, 0000h ; color
mov cx, 64000 ; size
rep stosw
mov dx, 03dah ; Wait for retrace
waitforretrace:
in al, dx
and al, 08h
jz waitforretrace
mov bx, [PointX]
mov dx, [PointY]
xchg dh, dl
mov al, [PointColor]
mov di, dx
shr di, 2
add di, dx
add di, bx
stosb
cmp PointX, 0000h ; Update directin bytes
je directionx0
cmp PointX, 320
je directionx1
afterdirectionx:
cmp PointY, 0000h
je directiony0
cmp PointY, 200
je directiony1
afterdirectiony:
cmp DirectionX, 00h ; Update points
je incpointx
dec PointX
afterpointx:
cmp DirectionY, 00h
je incpointy
dec PointY
afterpointy:
mov ah, 86h ; Wait
xor cx, cx
mov dx, 2240h
int 15h
mov ah, 01h ; Check for keypress
int 16h
jz main_loop
xor ah, ah ; Get the keypress
int 16h
cmp al, 1bh ; Check for escape
jne main_loop
mov ax, 0003h
int 10h
ret
directionx0:
mov DirectionX, 00h
jmp afterdirectionx
directionx1:
mov DirectionX, 01h
jmp afterdirectionx
directiony0:
mov DirectionY, 00h
jmp afterdirectiony
directiony1:
mov DirectionY, 01h
jmp afterdirectiony
incpointx:
inc PointX
jmp afterpointx
incpointy:
inc PointY
jmp afterpointy
;--------------------------------------------------------------------------------------------------------
PointX word 0
PointY word 0
PointColor byte 10
DirectionX byte 0 ; 0 = plus, 1 = minus
DirectionY byte 0
;--------------------------------------------------------------------------------------------------------
end start
Ive also attached the finished file. Any idea why its doing that?