-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathJM_VL.ASM
99 lines (70 loc) · 1.63 KB
/
JM_VL.ASM
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
;===========================================================================
;
; JM_VL.ASM
;
;===========================================================================
IDEAL
MODEL MEDIUM,C
SCREENSEG = 0a000h
DATASEG
EXTRN bufferofs:WORD
CODESEG
;===========================================================================
;--------------------------------------------------------------------------
; JM_VGALinearFill() - Clears a linear section of latched VGA memory
;--------------------------------------------------------------------------
PROC JM_VGALinearFill start:WORD, len:WORD, fill:BYTE
PUBLIC JM_VGALinearFill
USES SI,DI,DS
;
; ES = screen memory segment (dest)
mov ax,SCREENSEG
mov es,ax
;
; Store off the staring address for later reference
;
mov ds,[WORD PTR start]
; Init our direction flag once for our STOS
cld
;
; PRE INIT 'bx' for a VGA MAP MASK (BH will be shifted per plane loop)
;
mov bx,0102h
mov dx,03c4h ; Init our VGA register num..
mov si,4
;
; VGA 'PLANE' LOOP (4 times)
;
; Loop for 4 Planes of VGA Latch memory
;
@@loop:
;
; DI -> screen memory offset (dest)
;
mov di,ds
;
; Set the VGAMAPMASK
;
cli
mov ax,bx
out dx,ax
sti
shl bh,1
;
; INDIVIDUAL PLANE LOOP
;
; Get ready to move length/2 WORDS for this MAPMASK
;
mov cx,[WORD PTR len]
shr cx,1
mov al,[BYTE PTR fill]
mov ah,al
rep stosw
;
; Check to see if we have done all planes
;
dec si
jnz @@loop
ret
ENDP
END