annotate level1/modules/boot_burke.asm @ 1287:10957d54bf16

Made all modules rev 0
author boisy
date Sat, 30 Aug 2003 20:16:51 +0000
parents df263e490f85
children d669aab7d6d8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1187
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
1 ********************************************************************
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
2 * Boot - Burke & Burke Boot Module
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
3 *
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
4 * $Id$
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
5 *
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
6 * Burke & Burke boot module... needs to be patched for OS9Boots that are
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
7 * far into the device.
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
8 * Track is the literal cylinder #, Cylinder would be including all heads
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
9 * of that track
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
10 *
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1187
diff changeset
11 * Edt/Rev YYYY/MM/DD Modified by
10957d54bf16 Made all modules rev 0
boisy
parents: 1187
diff changeset
12 * Comment
1187
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
13 * ------------------------------------------------------------------
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1187
diff changeset
14 * 2 ????/??/??
10957d54bf16 Made all modules rev 0
boisy
parents: 1187
diff changeset
15 * Initial version.
1187
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
16
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
17 nam Boot
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
18 ttl Burke & Burke Boot Module
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
19
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
20 org 0
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
21 buffptr rmb 2 Pointer to sector buffer in memory
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
22 numcyl rmb 2 Number of tracks for drive geometry init
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
23 sechead rmb 2 # of logical sectors/physical sector
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
24 numhead rmb 1 # of heads (sides)
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
25 seccyl rmb 2 # of sectors/cylinder (# of heads*sectors per head)
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
26 track rmb 2 Cylinder number last calculated ($9 - $A)
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
27 head rmb 1 Drive/head number (drive always 0)
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
28 sector rmb 1 Sector number (0-63)
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
29 vars equ 13-buffptr Size of stack variables buffer
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
30
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
31
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1187
diff changeset
32 IFP1
1187
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
33 use defsfile
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
34 use rbfdefs
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1187
diff changeset
35 ENDC
1187
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
36
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
37 tylg set Systm+Objct
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
38 atrv set ReEnt+rev
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1187
diff changeset
39 rev set $00
1187
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
40 edition set 2
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
41
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
42 mod eom,name,tylg,atrv,start,size
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
43
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
44 u0000 rmb 0
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
45 size equ .
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
46
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
47 name fcs /Boot/
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
48 fcb edition
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
49
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
50 start ldb >MPI.Slct Set up Multipak properly for us
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
51 lda #$10
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
52 mul
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
53 ldb #$11
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
54 mul
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
55 stb >MPI.Slct
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
56 leas -vars,s Reserve work area on stack of 13 bytes
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
57 tfr s,u U points to beginning of 13 byte buffer
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
58 pshs u,y,x,b,a Preserve registers
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
59 ldd #$0200 512 bytes for each read from XT-GEN
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
60 std numcyl,u # of cyls on drive
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
61 sta sechead+1,u # of sectors/head
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
62 sta numhead,u # of heads on drive
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
63 os9 F$SRqMem Request 512 byte buffer from OS9P1
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
64 lbcs L00B6 Error
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
65 tfr u,d d=Starting address of 512 byte block
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
66 ldu $06,s Get back pointer to 13 byte buffer
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
67 std buffptr,u Preserve buffer pointer
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
68
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
69 clr >$FF51 Reset controller
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
70
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
71 clr >$FF53 Set controller mode to 0 (part of init)
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
72 lbsr drvtype Set drive geometry (type of drive)
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
73 clrb Set initial LSN to 0
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
74 ldx #$0000
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
75 lbsr GetSect Figure out track/head/sector for LSN0
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
76 bcs L00B6 Error occured in read
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
77 ldy buffptr,u Get buffer pointer
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
78 ldd DD.NAM+PD.CYL,y Get real # cylinders on drive
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
79 std numcyl,u Preserve
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
80 ldd DD.NAM+PD.SCT,y Get real # sectors/track
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
81 std sechead,u Preserve
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
82 lda DD.NAM+PD.SID,y Get real # heads
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
83 sta numhead,u Preserve
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
84 leay DD.BT,y Point to OS9Boot information
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
85 ldd DD.BSZ-DD.BT,y Get size of OS9Boot
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
86 std ,s Preserve on stack
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
87 ldb DD.BT-DD.BT,y Get MSB of starting LSN of OS9Boot
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
88 ldx DD.BT-DD.BT+1,y Get LSW of starting LSN of OS9Boot
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
89 pshs x,b Push on stack
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
90 lbsr drvtype Set up drive for real drive specs
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
91 ldd #$0200 Get size of our buffer
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
92 ldu buffptr,u Get pointer to our 512 byte buffer
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
93 os9 F$SRtMem Deallocate our old sector buffer
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
94 ldd $03,s Get back size of OS9Boot
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
95 inca Increase size by 1 block (256 bytes)
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
96 IFEQ Level-1
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
97 os9 F$SRqMem
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
98 ELSE
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
99 os9 F$BtMem Allocate memory for boot file
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
100 ENDC
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
101 bcs L00B0 Error
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
102 stu $05,s Preserve pointer to start of OS9boot memory
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
103 ldu $09,s Get back pointer to local variables
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
104 ldd $05,s Get pointer to start of OS9Boot memory
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
105 std buffptr,u Move disk buffer pointer to there
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
106 ldd $03,s Get size of bootfile
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
107 beq L00A9 If zero, do someting
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
108 pshs b,a Otherwise push on stack
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
109 ReadBt std ,s Store # bytes left in boot on stack
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
110 ldb $02,s Get MSB of start sector of boot
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
111 ldx $03,s Get LSW of start sector of boot
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
112 bsr GetSect Convert to track/head/sector
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
113 bcs L00B4 If an error in getting, do something
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
114 inc buffptr,u Bump up buffer pointer by a page
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
115 ldx $03,s Bump up LSW of sector number
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
116 leax $01,x
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
117 stx $03,s And put it back
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
118 bne L00A0 If no carry over needed, proceed
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
119 inc $02,s Bump up MSB of sector number
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
120 L00A0 ldd ,s Get current boot size left to do
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
121 subd #$0100 Subtract 256 from it
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
122 bhi ReadBt If not zero yet, keep reading
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
123 leas $02,s Eat our temporary size left
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
124 L00A9 leas $03,s Eat our current LSN to get
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
125 clrb Clear carry (No error)
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
126 puls b,a pull off multipak settings (?)
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
127 bra BtExit
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
128 L00B0 leas $03,s Purge stack
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
129 bra L00B6
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
130 L00B4 leas $05,s Purge stack
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
131
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
132 L00B6 leas $02,s Purge stack
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
133
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
134 BtExit pshs a
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
135 lda #$FF
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
136 sta >$FF51 Reset controller
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
137 sta >MPI.Slct Reset multipak
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
138 sta >$FFD9 Double speed on
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
139 puls u,y,x,a Get exit parameters for Boot
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
140 leas vars,s Reset stack
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
141 rts Exit from Boot
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
142
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
143 * Get 512 byte sector from controller
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
144 * Entry X:B = 24 bit Logical sector number to get
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
145
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
146 GetSect pshs x,b Preserve registers
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
147 ldx #$FFFF (Init X so it will be 0 in loop)
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
148
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
149 * 24 bit divide routine. Stack=LSN (3 bytes)
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
150 * Entry: u=pointer to our local variable list
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
151
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
152 cyldiv leax $01,x # of loops through subtract
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
153 ldd $01,s Get original x (0)
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
154 subd seccyl,u Subtract # sector/cylinder
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
155 std $01,s Preserve it back
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
156 ldb ,s Continue subtract with borrow for 24 bit
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
157 sbcb #$00
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
158 stb ,s
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
159 bcc cyldiv If not trying to borrow again, continue
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
160 stx track,u Got track #
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
161 ldd $01,s Reset value to last in loop
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
162 addd seccyl,u
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
163 clr head,u Set head # to 0?
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
164 hddiv inc head,u Increase head #?
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
165 subd sechead,u Subtract # sectors/head?
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
166 bcc hddiv Continue subtracting until it wraps
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
167 dec head,u Adjust head to not include wrap
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
168 addd sechead,u Adjust leftover to not include wrap
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
169 lsrb Divide b by 2 (256 byte sector to 512)
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
170 stb sector,u Preserve sector #
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
171 leas $03,s Clear stack of 24 bit number
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
172
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
173 pshs cc Preserve odd sector flag (carry bit)
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
174
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
175 bsr cmdstrt Set up controller for new command
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
176 lda #$08 Read sector command
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
177 ldb head,u Drive/head byte (Drive always 0)
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
178 bsr dblsend Send to controller
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
179 ldd track,u Get msb of track
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
180 lsra Move right 2 bits into left two for the
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
181 rora controller
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
182 rora
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
183 ora sector,u mask in the sector number into remaining 6 bits
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
184 * ldb track+1,u Get LSB of track
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
185 bsr dblsend Send to controller
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
186 ldd #$0100 1 sector to read/no error correction/3 ms step
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
187 bsr dblsend Send that to controller
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
188 ldx buffptr,u Get pointer to sector buffer
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
189 * new code is here
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
190 puls cc Get back odd sector 1/2 indicator
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
191 bcc normal Even sector, use 1st half
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
192 bsr Eat256 Odd sector, use 2nd half
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
193 bsr Read256 Read 256 bytes off of controller
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
194 lbra chkcmplt See if command is complete
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
195 normal bsr Read256 Read 1/2 of sector
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
196 bsr Eat256 Eat half of sector
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
197 lbra chkcmplt See if command is complete
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
198
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
199 Eat256 clrb Eat 256 bytes off of controller
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
200 Eatlp lbsr nxtready Get byte from controller
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
201 decb counter
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
202 bne Eatlp Keep eating until 256 bytes done
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
203 clrb
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
204 rts
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
205
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
206 * Read 256 bytes from controller
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
207 * Entry: X=Pointer to current position in 512 physical sector buffer
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
208
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
209 Read256 clrb Set counter for 256 byte read
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
210 ReadLp lbsr nxtready Go get a byte from controller
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
211 sta ,x+ Put in buffer
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
212 decb keep doing until all 256 are read
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
213 bne ReadLp
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
214
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
215 middle clrb Clear carry for no error & return
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
216 rts
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
217
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
218 * Send 2 bytes to the controller
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
219 * Entry: a=1st byte to send
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
220 * b=2nd byte to send
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
221
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
222 dblsend pshs b,a Preserve d for a moment
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
223 bsr sendbyte Go send what is in a to controller
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
224 tfr b,a Send what was in b to the controller
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
225 bsr sendbyte
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
226 puls pc,b,a Return with a and b intact
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
227
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
228 * Sends a byte to the controller when it is ready for it
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
229 * Entry: a=byte to send
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
230
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
231 sendbyte pshs a Preserve a for a moment
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
232 waitsend bsr stable Make sure status register is stable and get it
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
233 anda #%00001011 Mask out bits
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
234 cmpa #$09 Is it expecting next byte of data packet?
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
235 bne waitsend
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
236 puls a Yes, get the byte we are sending next
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
237 sta >$FF50 Store in data register
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
238 rts
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
239
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
240 * Sends out command packet (6 bytes). Hard coded for drive 0, head 0,
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
241 * track 0, sector 0, interleave 0, no error correction, 3 ms step rate
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
242
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
243 cmdpckt pshs a Preserve command for a moment
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
244 bsr cmdstrt Go initialize controller for command start
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
245 puls a Get back command byte
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
246 clrb 1st option byte to 0
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
247 bsr dblsend Send both to controller
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
248 clra
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
249 bsr dblsend Send 4 more 0's to controller
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
250 bsr dblsend (sent command byte and 5 zero bytes for command
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
251 rts packet)
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
252
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
253 cmdstrt bsr stable
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
254 anda #%00001001 Mask out all but bits 0 and 3
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
255 bne cmdstrt If controller command is not complete or expecting
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
256 clr >$FF52 data, keep reading status register until it is ready
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
257 rts Otherwise initialize command start
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
258
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
259 * Make sure controller's status register is stable
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
260
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
261 stable lda >$FF51 Get status from controller
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
262 cmpa >$FF51 Keep getting until it stabilizes
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
263 bne stable
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
264 rts
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
265
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
266 * Set the drive type (set to 512 track - may be the error)
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
267 * Using the initialize drive geometry command
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
268 * Exit: Carry set if non-recoverable error
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
269
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
270 drvtype lda #$0C Initialize drive geometry command
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
271 bsr cmdpckt Go init
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
272 ldd numcyl,u Get # of cylinders on media
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
273 bsr dblsend Send it out (indicates drive has 512 tracks)
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
274 ldb sechead+1,u Get # of sectors/head
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
275 lda numhead,u Get # of heads on media
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
276 lsrb Divide OS9 sectors by 2
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
277 bsr sendbyte Send out # of heads for drive geometry
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
278 lslb Multiply WD sectors by 2 to get OS9 sectors again.
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
279 mul
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
280 std seccyl,u # sectors per cylinder (all heads on a track)
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
281 ldd numcyl,u Get # of tracks back
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
282 subd #$0001 Reduce write track=last track-1
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
283 bsr dblsend Send out reduced write track #
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
284 bsr dblsend Also use as write precomp track #
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
285 lda #$04 Maximum ECC burst length correctable=4
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
286 bsr sendbyte Send it out
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
287
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
288 * Make sure command has completed
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
289 * Exit: Carry set if controller reported a non-recoverable error
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
290 * Carry clear if everything went fine
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
291
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
292 chkcmplt bsr stable When status register is stable get it
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
293 anda #%00000111 Keep checking until controller indicates that
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
294 cmpa #%00000111 command completion code is ready to be read
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
295 bne chkcmplt
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
296 lda >$FF50 Get command completion code
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
297 bita #%00000010 Was there in error in completing the command?
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
298 beq noerror Nope, everything fine setting drive geometry
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
299 lda #$03 Error, Request Sense Status from the drive
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
300 bsr cmdpckt send Request Sense Status code
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
301 bsr nxtready Go get response from controller
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
302 anda #%00111111 Mask out all but error type and error code
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
303 pshs a Preserve it for a second
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
304 bsr eat2 Go eat next 4 bytes from controller (remaining 3
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
305 bsr eat2 from Sense Status & command completion code)
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
306 puls a Get back original error byte
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
307 tsta No error occured?
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
308 beq noerror No error; exit without error
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
309 cmpa #%00011000 Type 1, error 8 (correctable data error)?
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
310 beq noerror Yes, return without error
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
311 comb Set carry to indicate error
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
312 rts return
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
313 noerror clrb
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
314 rts
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
315
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
316 * Reads two byte from controller without caring what they are
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
317
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
318 eat2 bsr nxtready
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
319
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
320 * Waits until next byte coming from controller is ready, then gets it
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
321 * Exit: a=byte from controller
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
322
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
323 nxtready bsr stable Make sure status register is stable and get it
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
324 anda #%00001011 Controller ready to send me next byte?
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
325 cmpa #%00001011
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
326 bne nxtready Nope, keep waiting
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
327 lda >$FF50 Yes, get byte and return
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
328 rts Padding to get $1D0 Size
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1187
diff changeset
329
10957d54bf16 Made all modules rev 0
boisy
parents: 1187
diff changeset
330 IFGT Level-1
10957d54bf16 Made all modules rev 0
boisy
parents: 1187
diff changeset
331 * Pad to $1D0 bytes exactly
1187
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
332 Pad fill $39,$1D0-3-*
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1187
diff changeset
333 ENDC
1187
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
334
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
335 emod
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
336 eom equ *
df263e490f85 New booters added (moved from 3rdparty/booters)
boisy
parents:
diff changeset
337 end