annotate level1/modules/boot_burke.asm @ 2152:74fb212cb659

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