Saturday, March 15, 2014

moving screen box in 8086

.model small
.stack 64
.data
point1a dw 510h
point1b dw 1520h      ;coordinate of box
tik dw ?
.386
.code
main proc near

mov ax,@data
mov ds,ax



a10:
mov ax,0600h          ;set disply
mov bh,52h              ; 5 background color ,2 forehead color
mov cx,point1a          ; x1, y1
mov dx,point1b           ;x2, y2
int 10h

call delay                      ;delay of 1 sec

inc point1a                 ; move point forward for   next disply
inc point1b
mov dl,cl                
mov ax,0600h            ; erase starting row of box
mov bh,00h
int 10h

cmp cl,63          
jb a10


mov ax,4c00h
int 21h
main endp

delay proc near

pusha


mov ah,00h         ;give system time
int 1ah

mov tik,dx           ;in dx  
add tik,12h         ; store in tik  (1 sec= 12h value)  ,system time+1sec
b10:
mov ah,00h
int 1ah

cmp tik,dx            ;execute loop until 1sec over
jge b10

popa
ret
 delay endp
end main

No comments:

Post a Comment

Contributors

Translate