|
;---------------------------------------------------------------------
; WriteObject : Wrote for a game
; I/P :
; 1, Address of Object to Be drawn
; 2, X Coordinate of Where the Object Should Appear
; 3, Y Coordinate of Where the Object Should Appear
; 4, Width of object
; 5, ObjXLeft
; 6, ObjYTop
; 7 ObjXRight
; 8 ObjYBottom
; 9, Color That Has to be Displayed
;---------------------------------------------------------------------
WriteObject Macro ObjectOffset,ObjX,ObjY,ObjWidth,ObjXLeft,ObjYTop,ObjXRight,ObjYBottom,EtchColor
mov ax,ObjXLeft
mov ObjectXLeft,ax
mov ax,ObjXRight
mov ObjectXRight,ax
mov ax,ObjYTop
mov ObjectYTop,ax
mov ax,ObjYBottom
mov ObjectYBottom,ax
mov si,offset ObjectOffset
mov al,EtchColor
mov ObjectEtchColor,EtchColor
mov ax,ObjX
mov ObjectX,ax
mov ax,ObjY
mov ObjectY,ax
mov ax,ObjWidth
mov ObjectWidth,ax
call WriteObjectProc
endm
;---------------------------------------------------------------------
; WriteObject:
; Description : Writes a Matrix or Memory
;---------------------------------------------------------------------
WriteObjectProc proc near
mov ax,ObjectWidth
mul ObjectYTop
add si,ax
mov ax,ObjectYBottom
sub ax,ObjectYTop
mov ObjectHeight,ax
mov es,VideoMemoryAddress
mov cx,ObjectHeight
loop_WriteObject_NextLine:
push cx
mov ax,HorizontalResolution
mov bx,ObjectY
mul bx
add ax,ObjectX
mov di,ax
mov cx,ObjectWidth
mov bx,0
loop_WriteObject_SingleLine:
push cx
mov al,cs:[si]
cmp bx,ObjectXLeft
jl WriteObject_SkipPixel
cmp bx,ObjectXRight
jg WriteObject_SkipPixel
cmp al,ObjectEtchColor
je WriteObject_SkipPixel
mov es:[di],al
WriteObject_SkipPixel:
inc di
inc si
inc bx
pop cx
loop loop_WriteObject_SingleLine
inc ObjectY
pop cx
loop loop_WriteObject_NextLine
ret
endp
compile: tasm filename.asm
link: tlink /t filename
|