-
Notifications
You must be signed in to change notification settings - Fork 2
/
picobootinit.src
223 lines (186 loc) · 3.34 KB
/
picobootinit.src
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
; PicoBoot - initializer program
;
; Copyright (C) 2008-2010 Matthias Reichl <hias@horus.com>
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
START = $2800
; run address
* = $02E0
.WORD START
* = START
DBUF = $304
DSEC = $30A
SIOVEC = $E459
.include "cio.inc"
.include "version.inc"
.MACRO WSEC128 ;DRIVENO,SECTOR,ADR
LDA #$31
STA $300
LDA %1
STA $301
LDA #$50
STA $302
LDA #$80
STA $303
LDA #<(%3)
STA $304
LDA #>(%3)
STA $305
LDA #7
STA $306
LDA #128
STA $308
LDA #0
STA $309
LDA #<(%2)
STA $30A
LDA #>(%2)
STA $30B
JSR $E459
.ENDM
LDA 82
STA MERK82
LDA #0
STA 82
MAINLOOP BPUT 0,TITLEN,TITEL
INPDRV JMP IDKEY
INVDSK JSR BEEP
IDKEY JSR GETKEY
TAX
TYA
BPL IDKEY1
CPY #128
BNE IDKEY
IDABRT2 LDA #155
JSR PUTCHAR
ABORT BPUT 0, ABORTLN, ABORTED
JSR GETKEY
JMP MAINLOOP
IDKEY1 TXA
CMP #27
BEQ EXIT
CMP #$30
BNE NOEXIT
EXIT LDA MERK82
STA 82
JMP (10)
NOEXIT CMP #$31
BCC INVDSK
CMP #$39
BCS INVDSK
STA INSERT1
STA PDRIVNO
SEC
SBC #$30
STA DRIVENO
BPUT 0, INS1LEN, INSERT1
IDKEY2 JSR GETKEY
TAX
TYA
BPL IDKEY3
CPY #128
BEQ IDABRT2
BNE IDKEY2
IDKEY3 CPX #27
BEQ IDABRT2
LDA #$31
STA $0300
LDA DRIVENO
STA $0301
JSR GETDENS
LDA $308
STA MYBOOT
WSEC128 DRIVENO,1,MYBOOT
BPL S1OK
JMP WBERR
S1OK WSEC128 DRIVENO,2,MYBOOT+128
BPL S2OK
JMP WBERR
S2OK WSEC128 DRIVENO,3,MYBOOT+256
BPL S3OK
JMP WBERR
S3OK
SUCCESS BPUT 0, SUCCLEN, SUCCTXT
JSR GETKEY
JMP MAINLOOP
WBERR CLC
LDA $30A
ADC #'0
STA ERRSEC
LDA 771
LSR
LSR
LSR
LSR
TAX
LDA HEXTAB,X
STA ERRSTAT
LDA 771
AND #$0F
TAX
LDA HEXTAB,X
STA ERRSTAT+1
PRINT 0, ERRWB
JSR GETKEY
JMP MAINLOOP
GETKEY LDA $E425
PHA
LDA $E424
PHA
RTS
BEEP LDA #253
PUTCHAR TAY
LDA $E407
PHA
LDA $E406
PHA
TYA
RTS
.INCLUDE "getdens.src"
DRIVENO .BYTE 1
; 1234567890123456789012345678901234567890
; 0987654321098765432112345678901234567890
TITEL .BYTE 125
.BYTE " PicoBoot Init V"
VERSION
.BYTE 155
.BYTE " (c) HiassofT 1992-"
COPYYEAR
.BYTE 155,155
.BYTE " single COM file loader",155
.BYTE " for SD & DD disks, 720-65535 sectors",155
.BYTE " in Dos 2.x / MyDos / BiboDos format", 155
.BYTE 155
.BYTE "Enter drive number (0 to exit) -> "
TITLEN = * - TITEL
INSERT1 .BYTE "1",155
.BYTE "insert disk in D"
PDRIVNO .BYTE "1: and press any key"
.BYTE 155
INS1LEN = * - INSERT1
ERRWB .BYTE "error writing sector "
ERRSEC .BYTE "1 (stat=$"
ERRSTAT .BYTE "00)",253,155
SUCCTXT .BYTE 155,"operation successfully completed!", 155
SUCCLEN = * - SUCCTXT
ABORTED .BYTE 155, "operation aborted", 253, 155
ABORTLN = * - ABORTED
HEXTAB .BYTE "0123456789ABCDEF"
MERK82 * = * + 1
SECMASK * = * + 1
SECBYTE * = * + 1
MYBOOT = *
.incbin "picobootcode.bin"
SECBUF = *