annotate dw3dos/dw3dos.asm @ 2559:df7a31c0f085

Updated
author boisy
date Thu, 09 Sep 2010 14:08:24 +0000
parents fbd3b317a0ea
children a9a5be5114b2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2236
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
1 ********************************************************************
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
2 * DW3DOS - DriveWire 3 DOS Command
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
3 *
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
4 * $Id$
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
5 *
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
6 * DW3DOS emulates the RS-DOS 'DOS' command, which obtains 18 256-byte
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
7 * sectors from track 34 of a disk and reads them into memory starting
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
8 * at $2600. Once all sectors have been read, control jumps to $2602.
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
9 *
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
10 * The flexibility that is inherent in the DriveWire design is that it
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
11 * allows a CoCo to boot into OS-9 or any other control program that might
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
12 * be desirable.
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
13 *
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
14 * Four ROMS can be made from this source:
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
15 *
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
16 * - CoCo 3 motherboard ROM (32K)
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
17 * - CoCo 1/2 motherboard ROM (16K)
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
18 * - CoCo 3 Disk Controller ROM (8K) (define DISKROM)
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
19 * - CoCo 1/2 Disk Controller ROM (8K) (define DISKROM)
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
20 *
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
21 * Two LOADM files can be made also:
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
22 *
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
23 * - CoCo 3 LOADMable BIN (define BIN)
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
24 * - CoCo 1/2 LOADMable BIN (define BIN)
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
25 *
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
26 * Also, two files can be made from this source:
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
27 *
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
28 * - CoCo 3 DOS track (4608 bytes) (define DOSTRACK)
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
29 * - CoCo 1/2 DOS track (4608 bytes) (define DOSTRACK)
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
30 *
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
31 * Edt/Rev YYYY/MM/DD Modified by
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
32 * Comment
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
33 * ------------------------------------------------------------------
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
34 * 2008/02/04 Boisy G. Pitre
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
35 * Adapted for DriveWire 3 protocol
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
36
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
37 nam DW3DOS
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
38 ttl DriveWire 3 DOS Command
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
39
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
40 ifp1
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
41 IFNE BIN
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
42 IntMasks equ $50
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
43 Carry equ 1
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
44 PIA0Base equ $FF00
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
45 PIA1Base equ $FF20
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
46 DAT.Regs equ $FFA0
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
47 E$NotRdy equ 246
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
48 ELSE
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
49 use defsfile
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
50 ENDC
2345
fbd3b317a0ea Didn't compile since dwdefs.d was moved...
chawks4
parents: 2241
diff changeset
51 use ../defs/dwdefs.d
2236
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
52 endc
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
53
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
54 * Set up Level definition for low level read/write routines
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
55 IFEQ CoCo-3
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
56 Level equ 2
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
57 ELSE
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
58 Level equ 1
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
59 ENDC
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
60
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
61 IFNE DOSTRACK
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
62 Top equ $2600
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
63 ELSE
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
64 IFNE BIN
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
65 Top equ $2400
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
66 ELSE
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
67 IFNE DISKROM
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
68 Top equ $C000
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
69 ELSE
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
70 Top equ $8000
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
71 ENDC
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
72 ENDC
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
73 ENDC
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
74
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
75 org Top
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
76 IFNE DISKROM
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
77 fcc "DK"
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
78 lbra Entry
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
79 fill $FF,9*256 spaced out to prevent CoCo 3 BASIC ROM patches
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
80 ELSE
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
81 fcc /OS/
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
82 bra PreEntry
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
83 fdb $1205
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
84 * For the DOS track, we have to copy the DW3DOS code to another
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
85 * address and execute from there, since the boot track we pull
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
86 * from DriveWire will need to reside at $2600 (and we are now!)
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
87 PreEntry
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
88 leax Entry,pcr
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
89 ldy #$2000
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
90 ldd #csize
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
91 PreCopy ldu ,x++
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
92 stu ,y++
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
93 subd #$0002
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
94 bpl PreCopy
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
95 jmp $2000
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
96 ENDC
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
97
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
98 * Entry point
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
99 Entry orcc #IntMasks disable FIRQ, IRQ
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
100 lds #$1FFF set up a stack pointer
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
101
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
102 IFEQ CoCo-3
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
103
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
104 * CoCo 3 Initialization Code
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
105 clr $FFD9 go into fast mode
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
106
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
107 * Setup MMU
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
108 ldx #DAT.Regs
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
109 leay MMUTbl,pcr
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
110 ldb #16
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
111 MMULoop lda ,y+
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
112 sta ,x+
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
113 decb
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
114 bne MMULoop
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
115
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
116 * Setup video
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
117 leau CC3Regs,pcr point to video setup data
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
118 ldx #$FF90
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
119 Loop1 ldd ,u++ get the bytes
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
120 std ,x++ save in the hardware
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
121 cmpx #$FFA0
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
122 bcs Loop1
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
123
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
124 * Set palettes up
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
125 leau PalTbl,pcr
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
126 ldy #$FFB0 palette register
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
127 ldb #16
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
128 lbsr CopyRtn
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
129
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
130 * Initialize PIAs
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
131 ldx #PIA1Base RG - Initialize the PIA 1
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
132 ldd #$FF34
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
133 clr 1,x cassette motor off, 0,x is DDR
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
134 clr 3,x 2,x is DDR
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
135 deca A = $FE
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
136 sta ,x cassette bit 0 input, all others output
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
137 lda #$F8 bits 7-3 output, bits 2-0 input
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
138 sta 2,x set DDR
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
139 stb 1,x 0,x not DDR
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
140 stb 3,x 2,x not DDR
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
141 clr 2,x
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
142 lda #$02 RS-232 bit hi
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
143 sta ,x set it
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
144
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
145 lda #$FF all outputs
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
146 ldx #PIA0Base
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
147 clr 1,x 0,x is DDR
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
148 clr 3,x 2,x is DDR
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
149 clr ,x all inputs
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
150 sta 2,x all outputs
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
151 stb 1,x 0,x is not DDR
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
152 stb 3,x 2,x is not DDR
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
153 clr 2,x
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
154
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
155 ELSE
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
156
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
157 * CoCo 1/2 Initialization Code
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
158 ldx #PIA1Base PIA1
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
159 clr -3,x clear PIA0 Control Register A
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
160 clr -1,x clear PIA0 Control Register B
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
161 clr -4,x set PIA0 side A to input
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
162 ldd #$FF34
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
163 sta -2,x set PIA0 side B to output
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
164 stb -3,x enable PIA0 peripheral reg, disable PIA0
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
165 stb -1,x MPU interrupts, set CA2, CA1 to outputs
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
166 clr 1,x $FF20 = DDR, motoroff
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
167 clr 3,x $FF22 = DDR, sound disabled
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
168 deca A = $FE after deca
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
169 sta ,x bits 1-7 are outputs, bit 0 is input on PIA1 side A
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
170 lda #$F8
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
171 sta 2,x bits 0-2 are inputs, bits 3-7 are outputs on B side
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
172 stb 1,x enable peripheral registers, disable PIA1 MPU
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
173 stb 3,x interrupts and set CA2, CB2 as outputs
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
174 clr 2,x set 6847 mode to alphanumeric
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
175 ldb #$02
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
176 stb ,x make RS-232 output marking
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
177 clrb
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
178 tfr b,dp B = 0
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
179 ldb #$04
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
180 clr -2,x
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
181 bitb 2,x
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
182
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
183 lda #$37
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
184 sta PIA1Base+3
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
185
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
186 lda PIA0Base+3
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
187 ora #$01
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
188 sta PIA0Base+3
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
189
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
190 lda PIA1Base+2
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
191 anda #$07
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
192 sta PIA1Base+2
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
193
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
194 * 64K DRAM (M0=0, M1=1)
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
195 sta $FFDA RESET M0
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
196 sta $FFDD SET M1
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
197
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
198 ENDC
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
199
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
200 * Show Boot Message
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
201 * VDG Mode
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
202 sta $FFC0
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
203 sta $FFC2
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
204 sta $FFC4
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
205
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
206 * Locate Boot Text Screen at $0000
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
207 ldx #$FFC6
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
208 ldb #$07
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
209 ScrLoop sta ,x++
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
210 decb
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
211 bne ScrLoop
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
212
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
213 * Clear VDG screen
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
214 ldx #$0000
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
215 ldy #256
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
216 ldd #$6060
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
217 VDGClr std ,x++
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
218 leay -1,y
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
219 bne VDGClr
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
220
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
221 * Copy Booot Message to screen area
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
222 ldy #$10A
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
223 leau BootMsg,pcr
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
224 ldb #BootMLen
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
225 bsr CopyRtn
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
226
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
227 * Spin for a while so that the RS-232 bit stays hi for a time
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
228 Reset
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
229 ldx #$A000
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
230 Spin leax -1,x
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
231 bne Spin
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
232
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
233 Counter equ $1FFF
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
234 lds #$1FFE reset stack pointer
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
235
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
236 * DriveWire bootstrap code
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
237 * Get sectors 612-629 to $2600
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
238 DWDOS2 ldx #612 starting sector number
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
239 ldy #$2600 memory address
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
240 DOSLoop bsr DoRead read sector (into Y)
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
241 bcs Failed start all over
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
242 cmpx #612 our first sector?
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
243 bne DWDOS3 branch if not
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
244 ldd $2600 else get two bytes at $2600
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
245 cmpd #$4F53 OS?
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
246 bne Failed if not, bad data... fail
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
247 DWDOS3 leax 1,x else increment X
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
248 leay 256,y
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
249 cmpx #630 are we at end of 18 sectors?
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
250 blt DOSLoop branch if not
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
251
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
252 jmp $2602
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
253
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
254 CopyRtn clra
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
255 tfr d,x
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
256 Copy1 ldb ,u+
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
257 stb ,y+
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
258 leax -1,x
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
259 bne Copy1
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
260 rts
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
261
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
262 * Copy "FAILED" to screen area
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
263 Failed ldy #$14D
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
264 leau FailMsg,pcr
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
265 ldb #FailMLen
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
266 bsr CopyRtn
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
267 Hang bra Hang
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
268
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
269
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
270
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
271 DoRead clra drive #
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
272 clrb LSN bits 23-16
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
273 pshs d,x,y
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
274 lda #OP_READEX
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
275 ReRead pshs a
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
276 leax ,s
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
277 ldy #$0005
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
278 lbsr DWWrite
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
279 puls a
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
280
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
281 ldx 4,s get read buffer pointer
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
282 ldy #256 read 256 bytes
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
283 ldd #133*1 1 second timeout
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
284 bsr DWRead
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
285 bcs ReadEx
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
286 * Send 2 byte checksum
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
287 pshs y
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
288 leax ,s
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
289 ldy #2
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
290 lbsr DWWrite
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
291 ldy #1
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
292 ldd #133*1
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
293 bsr DWRead
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
294 leas 2,s
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
295 bcs ReadEx
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
296 lda ,s
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
297 beq ReadEx
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
298 cmpa #E_CRC
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
299 bne ReadErr
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
300 lda #OP_REREADEX
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
301 clr ,s
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
302 bra ReRead
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
303 ReadErr comb
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
304 ReadEx puls d,x,y,pc
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
305
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
306 use ../level1/modules/dwread.asm
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
307 use ../level1/modules/dwwrite.asm
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
308
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
309 IFEQ CoCo-3
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
310 * MMU
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
311 MMUTbl
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
312 fcb $38,$39,$3A,$3B,$3C,$3D,$3E,$3F
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
313 fcb $38,$39,$3A,$3B,$3C,$3D,$3E,$3F
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
314
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
315 * GIME register default values
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
316
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
317 CC3Regs fcb $EC CC2, MMU, IRQ, Vector page, SCS
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
318 fcb $00 map type 0
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
319 fcb $00 no FIRQ
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
320 fcb $00 no IRQ
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
321 fdb $0900 timer
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
322 fcb $00 unused
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
323 fcb $00 unused
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
324 fcb $00
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
325 fcb $00
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
326 fcb $00
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
327 fcb $00
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
328 fdb $0FE0
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
329 fcb $00
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
330 fcb $00
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
331
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
332 * Palette register default colors
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
333 PalTbl
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
334 fcb $12 green
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
335 fcb $36
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
336 fcb $09 blue
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
337 fcb $24 red
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
338 fcb $3F white
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
339 fcb $1B cyan
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
340 fcb $2D magenta
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
341 fcb $26
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
342 fcb $00 black
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
343 fcb $12 green
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
344 fcb $00 black
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
345 fcb $3F white
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
346 fcb $00 black
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
347 fcb $12 green
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
348 fcb $00 black
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
349 fcb $26
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
350
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
351 ENDC
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
352
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
353 * Boot Message
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
354 BootMsg fcc /DWs/
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
355 fcb $60
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
356 fcc /CC/
2241
d8ecc7e796fb Rename and wrap-up
boisy
parents: 2236
diff changeset
357 fcb 112+CoCo
2236
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
358 fcb $60
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
359 fcc /BOOT/
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
360 BootMLen equ *-BootMsg
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
361
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
362 * Fail Message
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
363 FailMsg fcc /FAILED/
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
364 FailMLen equ *-FailMsg
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
365
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
366 csize equ *-Entry
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
367 eom equ *
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
368
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
369 * Fill pattern
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
370 IFEQ BIN
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
371 IFNE DOSTRACK
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
372 fill $FF,$1200-eom
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
373 ELSE
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
374 IFNE DISKROM
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
375 fill $FF,$1FF0-eom
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
376 ELSE
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
377 IFEQ CoCo-3
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
378 fill $FF,$7FF0-eom
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
379 ELSE
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
380 fill $FF,$3FF0-eom
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
381 ENDC
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
382 ENDC
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
383
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
384 IFEQ CoCo-3
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
385
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
386 * CoCo 3 ROM vectors
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
387 fdb $0000
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
388 fdb $FEEE
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
389 fdb $FEF1
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
390 fdb $FEF4
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
391 fdb $FEF7
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
392 fdb $FEFA
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
393 fdb $FEFD
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
394 fdb Entry+Top
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
395
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
396 ELSE
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
397
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
398 * CoCo 1/2 ROM vectors
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
399 fdb Entry+Top
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
400 fdb $0100
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
401 fdb $0103
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
402 fdb $010F
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
403 fdb $010C
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
404 fdb $0106
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
405 fdb $0109
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
406 fdb Entry+Top
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
407
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
408 ENDC
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
409 ENDC
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
410 ENDC
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
411
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
412 end PreEntry
2603aceace6d Added DW3DOS
boisy
parents:
diff changeset
413