-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.a86
289 lines (278 loc) · 8.11 KB
/
init.a86
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
;
; Licensed under the MIT license. See LICENSE file in the project root for details.
;
title 'ATINIT - Start CP/M'
cseg
mov cx,ds
mov es,cx
mov cx, 20h
xor dx,dx
mov dl, 0FFh
int 0E0h
mov byte ptr bkp_user, al
call cls
call print_cpm_ver
mov cx,0Ch
int 0E0h
cmp ax,1430h
jz wrg_os
cmp ax,1431h
jz wrg_os
sub ax,1462h
ja hw_end
call print_hw
jmp hw_end
wrg_os:
lea si, msg_wrg_os
call print_str
call quit
hw_end:
lea si, msg_rtc
call print_str
mov cx, 20h
xor dx,dx
mov dl, byte ptr bkp_user
int 0E0h
include clock.a86
cls:
push ax
push bx
push cx
mov dx,27
mov cl,02h
int 0E0h
mov dx,'E'
mov cl,02h
int 0E0h
pop cx
pop bx
pop ax
ret
print_hw:
push ax
push bx
push cx
push dx
push es
push si
lea si, msg_hw_hdr
call print_str
lea si, msg_hw_mem
call print_str
int 12h
mov bx,10
call print_uint16
lea si, msg_hw_kb
call print_str
lea si, msg_hw_amem
call print_str
mov dx,offset mcb
mov cl,35h
int 0E0h
mov ax, word ptr mlen
mov cl,6
shr ax, cl
inc ax
inc ax
mov bx,10
call print_uint16
lea si, msg_hw_kb
call print_str
lea si, msg_hw_87
call print_str
int 11h
add ax,0040h
and ax,0fff3h
push ax
and al,2
jz no_87
lea si, msg_hw_yes
jmp done_87
no_87:
lea si, msg_hw_no
done_87:
call print_str
lea si, msg_hw_flp
call print_str
pop ax
push ax
xor ah,ah
mov cl,06h
shr al,cl
and al,07h
mov bx,10
call print_uint16
lea si, msg_nl
call print_str
lea si, msg_hw_dsk
call print_str
call disk_count
mov bx,10
call print_uint16
lea si, msg_nl
call print_str
lea si, msg_hw_par
call print_str
pop ax
push ax
mov cl,0Eh
shr ax,cl
and al,03h
mov bx,10
call print_uint16
lea si, msg_nl
call print_str
lea si, msg_hw_ser
call print_str
pop ax
mov cl,09h
shr ax,cl
and al,07h
mov bx,10
call print_uint16
lea si, msg_nl
call print_str
pop si
pop es
pop dx
pop cx
pop bx
pop ax
ret
print_cpm_ver:
push si
push ax
push bx
push cx
push dx
mov cx,0Ch
int 0E0h
push ax
cmp ah,15h
jz print_ver_mpm
cmp ax,1430h
jz print_ver_ccpm
cmp ax,1431h
jz print_ver_ccpm
cmp ax,1466h
jae print_ver_mdos
cmp ah,14h
jz print_ver_cdos
cmp ax,1041h
jz print_ver_dosp
cmp ax,22h
jz print_ver_cpm
lea si, msg_cpm86
call print_str
jmp print_ver_base
print_ver_cpm:
lea si, msg_pccpm86
call print_str
jmp print_ver_base
print_ver_dosp:
lea si, msg_dosp
call print_str
jmp print_os_ver
print_ver_mpm:
lea si, msg_mpm86
call print_str
jmp print_os_ver
print_ver_cdos:
lea si, msg_cdos
call print_str
jmp print_os_ver
print_ver_mdos:
lea si, msg_mdos
call print_str
jmp print_os_ver
print_ver_ccpm:
lea si, msg_ccpm86
call print_str
jmp print_os_ver
print_os_ver:
mov cx,0A3h
int 0E0h
mov ax,bx
xor ah,ah
mov bx,10
mov dl,al
mov cl,4
shr al, cl
and al,0Fh
call print_uint16
mov al,'.'
call print_char
mov al,dl
xor ah,ah
and al,0Fh
call print_uint16
lea si, msg_ver_sep
call print_str
jmp print_ver_base
print_ver_base:
pop ax
lea si, msg_ver_hdr
call print_str
xor ah,ah
mov bx,10
mov dl,al
mov cl,4
shr al, cl
and al,0Fh
call print_uint16
mov al,'.'
call print_char
mov al,dl
xor ah,ah
and al,0Fh
call print_uint16
lea si, msg_nl
call print_str
print_ver_end:
pop dx
pop cx
pop bx
pop ax
pop si
ret
include tinylib.a86
include baselib.a86
dseg
mcb dw 0
mlen dw 65534
mext db 0
month_siz db 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
month_day dw 000,031,059,090,120,151,181,212,243,273,304,334
msg_wrg_os db 'Not supported by this operating system.',13,10,0
msg_interr db 'AT BIOS interrupt error ...',13,10,0
msg_86err db 'Not an AT class system ...',13,10,0
msg_rtc db 'Date now: ',0
msg_cpm86 db 'CP/M-86, ',0
msg_pccpm86 db 'CP/M-86 1.1, ',0
msg_ccpm86 db 'Concurrent CP/M-86 ',0
msg_mpm86 db 'MP/M-86 ',0
msg_cdos db 'Concurrent DOS ',0
msg_mdos db 'Multiuser DOS ',0
msg_dosp db 'DOSPLUS ',0
msg_ver_hdr db 'BDOS ',0
msg_ver_sep db ', ',0
msg_hw_hdr db 'Hardware Configuration: ',13,10,0
msg_hw_mem db ' - System Memory: ',0
msg_hw_amem db ' - Available Memory: ',0
msg_hw_87 db ' - Math Coprocessor: ',0
msg_hw_flp db ' - Floppy Drive(s): ',0
msg_hw_dsk db ' - Hard Disk(s): ',0
msg_hw_par db ' - Parallel Port(s): ',0
msg_hw_ser db ' - Serial Port(s): ',0
msg_hw_yes db 'Yes',13,10,0
msg_hw_no db 'No',13,10,0
msg_hw_kb db 'Kb',13,10,0
msg_nl db 13,10,0
tm_buffer rs 256
stamp_year rw 1
stamp_hours rb 1
stamp_mins rb 1
stamp_secs rb 1
bkp_user rw 0
db 0
end