-
Notifications
You must be signed in to change notification settings - Fork 1
/
BOOT.ASM
156 lines (127 loc) · 2.5 KB
/
BOOT.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
;This is a disk boot routine for the 1771/1791 type disk
;controllers. It would normally reside on track 0,
;sector 1, to be loaded by the "B" command of the
;monitor at address 200H. By changing the equates
;below, it may be configured to load any size of
;program at any address. The program is assumed to
;occupy consecutive sectors starting at track 0, sector
;2, and will begin exection at its load address (which
;must be a 16-byte boundary) with the Instruction
;Pointer set to zero.
; Variations are available for the Cromemco 4FDC with
; large disks, the 4FDC with small disks, the Tarbell
; single-density controller, and the Tarbell double-
; density controller. Select one.
CROMEMCOSMALL: EQU 0
CROMEMCOLARGE: EQU 1
TARBELLSINGLE: EQU 0
TARBELLDOUBLE: EQU 0
LOAD: EQU 400H ;Address to load program
SEG: EQU 40H ;LOAD/10H
SECTOR: EQU 51 ;No. of 128-byte sectors to load
BOOTER: EQU 200H ;"B" command puts booter here
;**************************************************************
CROMEMCO: EQU CROMEMCOLARGE+CROMEMCOSMALL
TARBELL: EQU TARBELLSINGLE+TARBELLDOUBLE
WD1771: EQU CROMEMCO+TARBELLSINGLE
WD1791: EQU TARBELLDOUBLE
SMALL: EQU CROMEMCOSMALL
LARGE: EQU CROMEMCOLARGE+TARBELL
IF SMALL
MAXSECT:EQU 18
ENDIF
IF LARGE
MAXSECT:EQU 26
ENDIF
IF TARBELL
DISK: EQU 78H
ENDIF
IF CROMEMCO
DISK: EQU 30H
ENDIF
IF WD1771
READCOM:EQU 88H
ENDIF
IF WD1791
READCOM:EQU 80H
ENDIF
IF CROMEMCOLARGE
WAITBYTE:EQU 0B1H
ENDIF
IF CROMEMCOSMALL
WAITBYTE:EQU 0A1H
ENDIF
ORG BOOTER
PUT 100H
XOR AX,AX
MOV DS,AX
MOV ES,AX
MOV SS,AX
UP
MOV DI,LOAD
MOV DX,SECTOR
MOV BL,2
SECT:
MOV AL,BL
OUTB DISK+2
MOV CX,128
IF TARBELL
INB DISK ;Get head load status
ENDIF
IF CROMEMCO
INB DISK+4 ;Get head load status
ENDIF
TEST AL,20H
MOV AL,READCOM
JNZ OUTCOM
MOV AL,READCOM+4
OUTCOM:
OUTB DISK
IF CROMEMCO
MOV AL,WAITBYTE
OUT DISK+4 ;Turn on hardware wait
ENDIF
READ:
INB DISK+4
IF TARBELL
ROL AL
JNC DONE
ENDIF
IF CROMEMCO
ROR AL
JC DONE
ENDIF
INB DISK+3
STOB
LOOP READ
GETSTAT:
INB DISK+4
IF TARBELL
ROL AL
JC GETSTAT
ENDIF
IF CROMEMCO
ROR AL
JNC GETSTAT
ENDIF
DONE:
IN DISK
AND AL,9CH
JNZ SECT
DEC DX
JZ BOOT
INC BL
CMP BL,MAXSECT+1
JNZ SECT
XOR BL,BL
INC DX
MOV AL,58H ;Step in with update
OUTB DISK
JP GETSTAT
BOOT:
MOV AX,SEG
MOV SS,AX
MOV ES,AX
MOV DS,AX
JMP 0,SEG