-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathOLDORNEW.ASM
More file actions
181 lines (149 loc) · 3.96 KB
/
OLDORNEW.ASM
File metadata and controls
181 lines (149 loc) · 3.96 KB
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
180
181
IDEAL
P8086
include "cgamacro.inc"
SEGMENT DATA word public
ENDS DATA
SEGMENT CODE byte public
ASSUME cs:CODE, ds:DATA
PUBLIC show_oldornew
PROC show_oldornew NEAR
mstart:
; Mode 08
; 1 +HRES 0
; 2 +GRPH 0
; 4 +BW 0
; 8 +VIDEO ENABLE 8
; 0x10 +1BPP 0
; 0x20 +ENABLE BLINK 0
mov dx,03d8h
mov al,008h
out dx,al
; Palette 00
; 1 +OVERSCAN B 0
; 2 +OVERSCAN G 0
; 4 +OVERSCAN R 0
; 8 +OVERSCAN I 0
; 0x10 +BACKGROUND I 0
; 0x20 +COLOR SEL 0
mov dx,03d9h
mov al,0
out dx,al
mov dx,03d4h
; 0xff Horizontal Total 38
mov ax,03800h
out dx,ax
; 0xff Horizontal Displayed 28
mov ax,02801h
out dx,ax
; 0xff Horizontal Sync Position 2d
mov ax,02d02h
out dx,ax
; 0x0f Horizontal Sync Width 0a
mov ax,00a03h
out dx,ax
; 0x7f Vertical Total 3e
mov ax,03e04h
out dx,ax
; 0x1f Vertical Total Adjust 00
mov ax,00005h
out dx,ax
; 0x7f Vertical Displayed 02
mov ax,00206h
out dx,ax
; 0x7f Vertical Sync Position 19
mov ax,01a07h
out dx,ax
; 0x03 Interlace Mode 02
mov ax,00208h
out dx,ax
; 0x1f Max Scan Line Address 00
mov ax,00009h
out dx,ax
; Cursor Start 06
; 0x1f Cursor Start 6
; 0x60 Cursor Mode 0
mov ax,0060ah
out dx,ax
; 0x1f Cursor End 07
mov ax,0070bh
out dx,ax
; 0x3f Start Address (H) 00
mov ax,0000ch
out dx,ax
; 0xff Start Address (L) 00
mov ax,0000dh
out dx,ax
; 0x3f Cursor (H) 03
mov ax,0030eh
out dx,ax
; 0xff Cursor (L) c0
mov ax,0c00fh
out dx,ax
mov dl,0dah
mov cx,20*60 ;wait 20 seconds
cli
whichFrameLoop:
waitForVerticalSync
waitForNoVerticalSync
; During line 0-1 we set up the start address for line 2 and change the vertical total to 0x01
waitForDisplayEnable
mov dl,0d4h
mov ax,00104h ; 4: Vertical total: 2 rows/frame
out dx,ax
mov dl,0dah ; 2 0 2
waitForDisplayDisable
waitForDisplayEnable
mov dl,0d4h
mov ax,0000ch
out dx,ax
mov ax,0500dh
out dx,ax
mov dl,0dah ; 2 0 2
waitForDisplayDisable
; During lines 2..197 we set up the start address for the next line
push cx
mov cx,98
mov bx,000a0h
whichRowLoop:
waitForDisplayEnable
waitForDisplayDisable
waitForDisplayEnable
mov dl,0d4h
mov ah,bh
mov al,00ch
out dx,ax
mov ah,bl
inc ax
out dx,ax
mov dl,0dah ; 2 0 2
waitForDisplayDisable
add bx,050h
loop whichRowLoop
pop cx
; During line 198 we set up the start address for line 0 and change the vertical total to 0x3e
waitForDisplayEnable
mov dl,0d4h
mov ax,03e04h ; 4: Vertical total: 63 rows/frame
out dx,ax
mov dl,0dah
waitForDisplayDisable
waitForDisplayEnable
mov dl,0d4h
mov ax,0000ch
out dx,ax
inc ax
out dx,ax
mov dl,0dah
waitForDisplayDisable
loop whichFrameLoop1
jmp whichDone
whichFrameLoop1:
jmp whichFrameLoop
whichDone:
sti
mov ax,3
int 010h
ret
ENDP
ENDS
END