forked from gnuplot/gnuplot-old
/
corgraph.asm
167 lines (144 loc) · 2.22 KB
/
corgraph.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
TITLE Corona graphics module
; Colin Kelley
; January 1987
include header.mac
if1
include lineproc.mac
endif
_text segment
public _GrInit,_GrReset,_GrOnly,_TxOnly,_GrandTx,_Cor_line,_Cor_mask
corpixel proc near
ror word ptr linemask,1
jc cont
ret
cont: push bp
mov bp,sp
push ax
push bx
push cx
mov es,ScSeg
shl bx,1 ; y
mov bx,word ptr LookUp[bx] ; bx has y mem address
mov cl,al ; x
and cl,7
shr ax,1
shr ax,1
shr ax,1 ; ax /= 8
add bx,ax
mov al,1
shl al,cl ; al contains bit mask
or byte ptr es:[bx],al
pop cx
pop bx
pop ax
pop bp
ret
lineproc _Cor_line, corpixel
beginproc _GrInit
push bp
mov bp,sp
push di
mov ax, [bp+X] ; screen number (0 - 7)
mov cl,11
shl ax,cl ; multiply by 2048 to get segment
mov ScSeg,ax ; save segment for later
push ax
mov es, ax
xor ax,ax
mov di,ax
mov cx, 4000h
cld
rep stosw
pop cx
call near ptr GrAddr
mov ax,es
pop di
pop bp
ret
_GrInit endp
beginproc _GrReset
mov cx, 0
call near ptr GrAddr
ret
_GrReset endp
GrAddr proc near
mov dx,3b4h ; address of 6845
mov al,0ch ; register 12
out dx,al
inc dx
mov al,ch ; Graphics Segment High
out dx,al
dec dx
mov al,0dh ; register 13
out dx,al
mov al,cl ; Graphics Segment Low
inc dx
out dx,al
ret
GrAddr endp
beginproc _GrOnly
mov dx,3b8h
mov al,0a0h
out dx,al
ret
_GrOnly endp
beginproc _TxOnly
mov dx,3b8h
mov al,28h
out dx,al
ret
_TxOnly endp
beginproc _GrandTx
mov dx,3b8h
mov al,0a8h
out dx,al
ret
_GrandTx endp
beginproc _Cor_mask
push bp
mov bp,sp
mov ax,[bp+x] ; mask
mov linemask,ax
pop bp
ret
_Cor_mask endp
corpixel endp
_text ends
_data segment
linemask dw -1
ScSeg dw 0
_data ends
const segment
K equ 1024
mem_mac MACRO x
dw x,2*K+x,4*K+x,6*K+x,8*K+x,10*K+x,12*K+x,14*K+x,16*K+x
dw 18*K+x,20*K+x,22*K+x,24*K+x
ENDM
LookUp equ $
mem_mac 0
mem_mac 80
mem_mac (80*2)
mem_mac (80*3)
mem_mac (80*4)
mem_mac (80*5)
mem_mac (80*6)
mem_mac (80*7)
mem_mac (80*8)
mem_mac (80*9)
mem_mac (80*10)
mem_mac (80*11)
mem_mac (80*12)
mem_mac (80*13)
mem_mac (80*14)
mem_mac (80*15)
mem_mac (80*16)
mem_mac (80*17)
mem_mac (80*18)
mem_mac (80*19)
mem_mac (80*20)
mem_mac (80*21)
mem_mac (80*22)
mem_mac (80*23)
mem_mac (80*24)
const ends
end