; ID_VL.ASM
IDEAL
MODEL MEDIUM,C
INCLUDE 'ID_VL.EQU'
SCREENSEG = 0a000h
UPDATEWIDE = 20
UPDATEHIGH = 13
DATASEG
EXTRN bufferofs :WORD
EXTRN displayofs :WORD
EXTRN ylookup :WORD
EXTRN linewidth :WORD
EXTRN blockstarts :WORD ;offsets from drawofs for each UPDATE block
EXTRN UPDATE :BYTE
CODESEG
;=================
;
; VH_UPDATEScreen
;
;=================
PROC VH_UPDATEScreen
PUBLIC VH_UPDATEScreen
USES si,di
mov dx,SC_INDEX
mov ax,SC_MAPMASK+15*256
out dx,ax
mov dx,GC_INDEX
mov tile,GC_MODE
out dx,tile
inc dx
in tile,dx
and tile,252
or tile,1
out dx,tile
mov bx,UPDATEWIDE*UPDATEHIGH-1 ; bx is the tile number
mov dx,[linewidth]
;
; see if the tile needs to be copied
;
@@checktile:
test [UPDATE+bx],1
jnz @@copytile
@@next:
dec bx
jns @@checktile
;
; done
;
mov dx,GC_INDEX+1
in tile,dx
and tile,NOT 3
or tile,0
out dx,tile
ret
;
; copy a tile
;
@@copytile:
mov [UPDATE+bx],0
shl bx,1
mov si,[blockstarts+bx]
shr bx,1
mov di,si
add si,[bufferofs]
add di,[displayofs]
mov ax,SCREENSEG
mov ds,ax
REPT 16
mov tile,[si]
mov [di],tile
mov tile,[si+1]
mov [di+1],tile
mov tile,[si+2]
mov [di+2],tile
mov tile,[si+3]
mov [di+3],tile
add si,dx
add di,dx
ENDM
mov ax,ss
mov ds,ax
jmp @@next
ENDP
END