Hullo All , hope you are having a nice day!!
/* (PUTSPRIT.ASM)
putsprite proc public
;**************************************
; On entry:
; cx= y coordinate
; dx= x coordinate
; bl= columns
; bh= rows
; ds:si= pointer to sprite
; *************************************
MODECOLUMNS equ 320
; Preserve the contents of the registers.
push ax
push bx
push cx
push dx
push bp
; es= video memory segment
mov ax, 0a000h
mov es, ax
; Here I calculate a number that'll be added to di, so that the beginning
; of the next row will be pointed
mov bp, MODECOLUMNS
mov ax, bx
and ax, 11111111b
sub bp, ax
; Now I calculate the value di will hold. (Its the address of first
; pixel where the sprite will be put)
push dx
mov ax, MODECOLUMNS
mul cx
pop dx
add ax, dx
mov di, ax
; cld, so that the index registers will be incremented.
cld
xor cx, cx
mov cl, bh
; Wait for vertical retrace.
mov dx, 3dah
waitfor1:
in al, dx
and al, 8
jz waitfor1
waitfor0:
in al, dx
and al, 8
jnz waitfor0
; These nestled loops puts the sprite on the screen.
; the inner loop is based on the number of columns of the sprite.
; The outter is based on the number of rows.
loophere:
push cx
mov cl, bl
putrow:
push cx
lodsb
inc di
cmp al, 00h
jz nextrow
dec di
stosb
nextrow:
pop cx
loop putrow
add di, bp
pop cx
loop loophere
; Restore the contents of the registers.
pop bp
pop dx
pop cx
pop bx
pop ax
ret
putsprite endp
*/
-=> Yours sincerely, Fernando Ariel Gont <=-
e-mail: FGont@siscor.bibnal.edu.ar
e-mail "Good Stuff!" _*Magazine*_ : gstuff@siscor.bibnal.edu.ar
FidoNet: 4:900/470.10
Sk-Network (Argentina): Murdock's Point (200:201/300.27)
--- Terminate 5.00 UnReg(142)
---------------
* Origin: In memoriam Kurdt Cobain (1967-1994) (4:900/470.10)
|