This repository has been archived by the owner on Mar 15, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
vga256.asm
179 lines (150 loc) · 5.06 KB
/
vga256.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
IDEAL
IFDEF BGI30
$$Small EQU
ELSE
$$Tiny EQU
ENDIF
INCLUDE "macros.inc"
INCLUDE "device.inc"
PUBLIC PASCAL DGROUP@
PUBLIC PASCAL N_SCOPY@
PUBLIC _CType _chain_intr
PUBLIC _CType VideoSeg
PUBLIC _CType SelA000
PUBLIC _CType Sel0040
IFDEF BGI30
PUBLIC _CType CpuMode
PUBLIC _CType FillMem
ELSE
PUBLIC _CType SaveDataSeg
ENDIF
EXTRN _CType pINSTALL : PROC
EXTRN _CType pINIT : PROC
EXTRN _CType pCLEAR : PROC
EXTRN _CType pPOST : PROC
EXTRN _CType pMOVE : PROC
EXTRN _CType pDRAW : PROC
EXTRN _CType pVECT : PROC
EXTRN _CType pPATBAR : PROC
EXTRN _CType pPALETTE : PROC
EXTRN _CType pALLPALETTE : PROC
EXTRN _CType pCOLOR : PROC
EXTRN _CType pFILLSTYLE : PROC
EXTRN _CType pLINESTYLE : PROC
EXTRN _CType pTEXTSTYLE : PROC
EXTRN _CType pTEXT : PROC
EXTRN _CType pTEXTSIZ : PROC
EXTRN _CType pFLOODFILL : PROC
EXTRN _CType pGETPIX : PROC
EXTRN _CType pPUTPIX : PROC
EXTRN _CType pBITMAPUTIL : PROC
EXTRN _CType pSAVEBITMAP : PROC
EXTRN _CType pRESTOREBITMAP : PROC
EXTRN _CType pSETCLIP : PROC
EXTRN _CType pCOLOR_QUERY : PROC
CODESEG
BGI VGA256
DATASEG
IFDEF BGI30
db 2 ; number of selectors to be converted
dw offset SelA000 ; offset to selector table
db 0 ; number of interrupt addresses to be converted
dw 0 ; offset to table of doublewords with interrupt number in lowest byte
db 0 ; number of buffers to allocate
dw 0 ; address of triplewords table
; the first word -> number of paragraphs to allocate
; the second word -> gets real mode buffer address
; the third word -> gets protected mode buffer address
ORG 0Ah
dw 0 ; data segment selector
CpuMode db 0 ; 0 -> real mode, 1 -> protected mode
ENDIF
LABEL VideoSeg WORD
SelA000 dw 0A000h
Sel0040 dw 00040h
DDOVEC dw pINSTALL
dw pINIT
dw pCLEAR
dw pPOST
dw pMOVE
dw pDRAW
dw pVECT
dw EMULATE
dw EMULATE
dw pPATBAR
dw EMULATE
dw EMULATE
dw EMULATE
dw pPALETTE
dw pALLPALETTE
dw pCOLOR
dw pFILLSTYLE
dw pLINESTYLE
dw pTEXTSTYLE
dw pTEXT
dw pTEXTSIZ
dw RESERVED
dw pFLOODFILL
dw pGETPIX
dw pPUTPIX
dw pBITMAPUTIL
dw pSAVEBITMAP
dw pRESTOREBITMAP
dw pSETCLIP
dw pCOLOR_QUERY
dw 35 DUP (RESERVED)
CODESEG
PROC _CType _chain_intr
IF @CodeSize
add sp,4
ELSE
add sp,2
ENDIF
mov bx,[bp+14]
mov ax,[bp+16]
pop [word bp+14]
pop [word bp+16]
mov sp,bp
pop bp
pop di
pop si
pop ds
pop es
pop dx
pop cx
cli
retf
ENDP
PROC PASCAL N_SCOPY@ NEAR
ARG @@dst : DWORD, @@src : DWORD
USES ds, si, di
cld
les di,[@@dst]
lds si,[@@src]
shr cx,1
rep movsw
adc cx,cx
rep movsb
ret
ENDP
IFDEF BGI30
PROC _CType FillMem
ARG @@ptr : DWORD, @@c : BYTE, @@n : WORD
USES di
les di,[@@ptr]
mov cx,[@@n]
mov al,[@@c]
mov ah,al
shr cx,1
rep stosw
adc cx,cx
rep stosb
ret
ENDP
ELSE
PROC _CType SaveDataSeg
mov [DGROUP@],ds
ret
ENDP
ENDIF
END