annotate 3rdparty/booters/boot_wd1002.asm @ 621:f5faeb8929ff

Added exmode utility
author boisy
date Tue, 03 Dec 2002 16:07:00 +0000
parents 3e3f1f79ba00
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
45
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
1 ********************************************************************
392
df43967d6a46 Minor source changes, added boot_burke
boisy
parents: 45
diff changeset
2 * Boot - Eliminator WD1002-05 Boot Module
45
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
3 *
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
4 * $Id$
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
5 *
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
6 * WD 1002-05 OS-9 Boot Subroutine (called by OS9p1)
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
7 * Copyright 1988, 1989 Bruce Isted
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
8 * All Rights Reserved
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
9 *
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
10 * Ed. Comments Who YY/MM/DD
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
11 * ------------------------------------------------------------------
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
12 * 2 Created by Bruce Isted BRI ??/??/??
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
13
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
14 nam Boot
392
df43967d6a46 Minor source changes, added boot_burke
boisy
parents: 45
diff changeset
15 ttl Eliminator WD1002-05 Boot Module
45
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
16
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
17 * These equates should be set before assembly:
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
18 FDStep equ $09 see Step Rate Table
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
19 HDStep equ $0F see step rate table
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
20
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
21 *Step Rate Table:
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
22 *+------------------+------------------+------------------+------------------+
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
23 *! Value=FD/HD Rate ! Value=FD/HD Rate ! Value=FD/HD Rate ! Value=FD/HD Rate !
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
24 *+------------------+------------------+------------------+------------------+
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
25 *! $00=40mS/7.5mS ! $04=16mS/5.5mS ! $08=08mS/3.5mS ! $0C=03mS/1.5mS !
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
26 *! $01=25mS/7.0mS ! $05=14mS/5.0mS ! $09=06mS/3.0mS ! $0D=02mS/1.0mS !
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
27 *! $02=20mS/6.5mS ! $06=12mS/4.5mS ! $0A=05mS/2.5mS ! $0E=01mS/0.5mS !
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
28 *! $03=18mS/6.0mS ! $07=10mS/4.0mS ! $0B=04mS/2.0mS ! $0F=15uS/ 35uS !
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
29 *+------------------+------------------+------------------+------------------+
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
30
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
31 ifp1
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
32 use defsfile
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
33 endc
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
34
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
35 * These equates should not have to be changed:
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
36 BEdtn equ 2
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
37 BVrsn equ 1
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
38 MaxCyls equ 1024 maximum cylinders supported
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
39 MaxHeads equ 16 maximum heads supported
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
40 MaxSctrs equ 64 maximum sectors per track supported
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
41 PhysDrv0 equ %10000000 SDH register mask for HD0
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
42 PhysDrv1 equ %10001000 SDH register mask for HD1
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
43 PhysDrv2 equ %10010000 SDH register mask for HD2
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
44 PhysDrv3 equ %00011000 SDH register mask for FD0
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
45 PhysDrv4 equ %00011010 SDH register mask for FD1
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
46 PhysDrv5 equ %00011100 SDH register mask for FD2
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
47 PhysDrv6 equ %00011110 SDH register mask for FD3
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
48 ReadSctr equ %00100000 read sector command
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
49 Restore equ %00010000 base restore command
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
50 SelfTest equ %10010000 WD 1002-05 diagnostic test command
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
51
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
52 * HCA memory map:
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
53 org 0
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
54 WDData rmb 2 WD 1002-05 sector buffer/task files
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
55 rmb 2 reserved - do not use
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
56 PA equ . PIA PA offset
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
57 DDRA rmb 1 PIA DDRA offset
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
58 CRA rmb 1 PIA CRA offset
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
59 PB equ . PIA PB offset
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
60 DDRB rmb 1 PIA DDRB offset
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
61 CRB rmb 1 PIA CRB offset
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
62
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
63 * WD 1002-05 register definitions:
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
64 org 0
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
65 WDBuff rmb 1 WD 1002-05 sector buffer address
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
66 ErrReg equ . error register address (read)
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
67 WPCReg rmb 1 write precomp register address (write)
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
68 SctrCnt rmb 1 sector count register address
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
69 SctrReg rmb 1 sector number register address
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
70 CylLow rmb 1 cylinder LSB register address
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
71 CylHigh rmb 1 cylinder MSB register address
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
72 SDHReg rmb 1 Size/Drive/Head register address
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
73 StatReg equ . status register address (read)
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
74 CmdReg rmb 1 command register address (write)
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
75
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
76 org 0
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
77 U.BSZ rmb 2 boot file size
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
78 U.BSct rmb 1 number of sectors in boot file
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
79 U.BT rmb 3 boot file start LSN
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
80 U.BtStrt rmb 2 boot file start address
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
81 U.CrtCyl rmb 2 current cylinder number
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
82 U.CrtSct rmb 1 current sector number
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
83 U.CrtSid rmb 1 current side (head) number
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
84 U.Restor rmb 1 restore command incl. step rate code
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
85 U.SDH rmb 1 base WD Size/Drive/Head register copy
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
86 U.Sides rmb 1 number of disk sides (heads)
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
87 U.SPC rmb 2 sectors per cylinder
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
88 U.SPT rmb 2 sectors per track
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
89 U.StSctr rmb 1 start sector number (HD=0, FD=1)
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
90 BootMem equ .
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
91
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
92 mod BEnd,BNam,Systm+Objct,ReEnt+BVrsn,BExec,$00
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
93 BNam fcs "Boot"
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
94 fcb BEdtn edition number
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
95
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
96 * base SDH register table
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
97 SDHTable equ *
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
98 fcb PhysDrv0,PhysDrv1,PhysDrv2 base SDH for hard drives
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
99 fcb PhysDrv3,PhysDrv4,PhysDrv5,PhysDrv6 base SDH for floppys
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
100 ***
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
101 * Boot subroutine module
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
102 *
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
103 * INPUT: none
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
104 *
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
105 * OUTPUT: [D]=size of bootstrap file
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
106 * [X]=start address of bootstrap file in memory
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
107 * y,u registers altered
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
108 *
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
109 * ERROR OUTPUT: [CC]=carry set
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
110 * [B]=error code
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
111 BExec ldy <D.WDAddr get HCA base address (set by auto-boot EPROM)
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
112 cmpy #$FF40 base address too low?
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
113 blo UnitErr yes, go report error...
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
114 cmpy #$FF7F base address too high?
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
115 bhi UnitErr yes, go report error...
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
116 lda <D.WDBtDr get boot drive number (set by auto-boot EPROM
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
117 cmpa #$07 legal drive number?
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
118 blo InitPIA yes, go initialize PIA...
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
119 UnitErr ldb #E$Unit
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
120 coma
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
121 rts
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
122
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
123 DumpRead clr PB,y set WD address to sector buffer
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
124 DumpR0 lda WDData,y get a byte from WD sector buffer
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
125 decb done yet?
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
126 bne DumpR0 no, go dump another byte
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
127 rts
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
128 LSN0Info ldb #DD.FMT load number of bytes to dump
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
129 bsr DumpRead go dump LSN0 up to DD.FMT
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
130 lda WDData,y get DD.FMT (disk density, sides)
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
131 anda #$01 mask out all but disk sides bit
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
132 inca correction to bit coding
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
133 sta U.Sides,u save disk sides (not valid if HD > 2 heads)
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
134 ldd WDData,y get DD.SPT (sectors per track)
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
135 std U.SPT,u
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
136 ldb #DD.BT-DD.RES load number of bytes to dump
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
137 bsr DumpRead go dump LSN0 from DD.RES to DD.BT
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
138 lda WDData,y get DD.BT (boot file start LSN) MSB
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
139 sta U.BT,u
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
140 ldd WDData,y get DD.BT (boot file start LSN) LSBs
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
141 std U.BT+1,u
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
142 ldd WDData,y get DD.BSZ (boot file size)
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
143 std U.BSZ,u
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
144 ldb U.StSctr,u floppy drive? (start sector = 1)
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
145 bne GotInfo yes, sides info OK, go return
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
146 ldb #DD.OPT+(PD.SID-PD.OPT)-DD.DAT load number of bytes to dump
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
147 bsr DumpRead go dump LSN0 from DD.DAT to number of sides in option table
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
148 lda WDData,y get number of sides from DD.OPT section
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
149 sta U.Sides,u
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
150 GotInfo rts
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
151
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
152 InitPIA clr CRA,y enable PIA DDRA
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
153 ldd #$033E [A]=DDRA: PA bits 7-2 = inputs, bits 1-0 = outputs
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
154 std DDRA,y [B]=CRA: PIA CA2 out high, PA slct, CA1 low to high, no IRQs
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
155 clr CRB,y enable PIA DDRB
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
156 lda #$FF [A]=DDRB: PB bits 7-0 all outputs
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
157 std DDRB,y [B]=CRB: PIA CB2 out high, PB slct, CB1 low to high, no IRQs
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
158 leas -BootMem,s open up some space for variables
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
159 leau ,s point [U] to start of variables
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
160 ldb #BootMem number of bytes to clear
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
161 leax ,u point [X] to start of variables
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
162 ClrLoop clr ,x+ initialize a byte to 0
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
163 decb done yet?
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
164 bne ClrLoop no, go clear another byte
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
165 lda #SelfTest WD 1002-05 internal diagnostic command
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
166 lbsr CmdUpdat go issue WD command, ensure everything is ready...
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
167 bcs ReadErr error, go report it...
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
168 lda #Restore!($0F&^HDStep) default to Restore with HD step rate
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
169 ldb <D.WDBtDr get boot drive number
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
170 cmpb #$03 hard drive?
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
171 blo SaveRstr yes, go save HD Restore command...
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
172 inc U.StSctr,u set start sector to 1 for floppy disks
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
173 lda #Restore!($0F&^FDStep) get Restore with FD step rate
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
174 SaveRstr sta U.Restor,u
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
175 leax SDHTable,pc
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
176 lda b,x get base SDH register
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
177 sta U.SDH,u save it...
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
178 * restore head to track 0
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
179 lbsr SetupTF go update WD task files (except command)
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
180 lda U.Restor,u load WD restore command code
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
181 lbsr CmdUpdat go issue WD command
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
182 bcs ReadErr error, go report it...
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
183 * read cylinder 0, head 0, first sector
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
184 lbsr GetSctr go set up, issue read command
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
185 bcs ReadErr error, go report it...
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
186 bsr LSN0Info go get disk info from LSN0
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
187 ldd U.BSZ,u get boot file size/cylinder offset number
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
188 bne ChkInfo must be boot file size, go check other LSN0 info...
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
189 ldd U.BT+1,u get offset cylinder number
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
190 beq ReadErr must not be boot disk, go report error...
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
191 cmpd #MaxCyls offset cylinder number OK?
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
192 bhs ReadErr no, go return error...
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
193 std U.CrtCyl,u save offset cylinder
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
194 * read offset cylinder, head 0, first sector
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
195 lbsr GetSctr go set up, issue read command
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
196 bcs ReadErr error, go exit...
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
197 lbsr LSN0Info go get disk info from offset LSN0
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
198 ldd U.BSZ,u get boot file size
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
199 beq ReadErr must not be boot disk, go report error...
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
200 * check LSN0 info
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
201 ChkInfo ldd U.SPT,u get sectors per track
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
202 beq ReadErr 0 sectors per track, go return error
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
203 cmpd #MaxSctrs sectors per track OK?
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
204 bhi ReadErr no, go return error
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
205 lda U.Sides,u get disk sides (heads)
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
206 beq ReadErr 0 sides, go return error
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
207 cmpa #MaxHeads number of heads OK?
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
208 bhi ReadErr no, go return error
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
209 mul calculate sectors per cylinder
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
210 std U.SPC,u save sectors per cylinder
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
211 ldd U.BSZ,u get boot file size
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
212 addd #$00FF round up to even sector...
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
213 sta U.BSct,u save number of sectors in boot file
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
214 * calculate boot file start cylinder, head, & sector
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
215 ldd U.BT+1,u get boot file LSN LSBs
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
216 ldx U.CrtCyl,u get current (offset) cylinder number
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
217 CylLoop subd U.SPC,u subtract sectors/cylinder
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
218 blo ChkBtMSB [D] underflow, go check boot file LSN MSB
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
219 CylLoop0 leax 1,x increment current cylinder number
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
220 bne CylLoop no overflow, go do another subtraction
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
221 ReadErr ldb #E$Read
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
222 coma set Carry for error
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
223 leas BootMem,s restore stack pointer
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
224 rts
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
225 ChkBtMSB tst U.BT,u boot file LSN MSB = 0?
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
226 beq GotCyl yes, go determine head number
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
227 dec U.BT,u decrement boot file LSN MSB
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
228 bra CylLoop0 go on...
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
229 GotCyl addd U.SPC,u restore sector number
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
230 stx U.CrtCyl,u save current cylinder number
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
231 TrkLoop subd U.SPT,u subtract sectors/track
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
232 blo GotSide [D] underflow, go save current sector number
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
233 inc U.CrtSid,u increment current side number
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
234 bra TrkLoop go do another subtraction
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
235 GotSide addd U.SPT,u restore sector number
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
236 stb U.CrtSct,u save it
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
237 * request boot file memory
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
238 pshs u save data pointer
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
239 ldd U.BSZ,u get boot file size
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
240 os9 F$SRqMem
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
241 tfr u,x move start address into [X]
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
242 puls u recover data pointer
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
243 bcs BtExit0 go return F$SRqMem error
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
244 stx U.BtStrt,u save boot file start address
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
245 ldd U.CrtCyl,u get cylinder number
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
246 bra ChkCyl go check cylinder & get first sector
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
247
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
248 * load boot file into memory
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
249 BootLoad inc U.CrtSct,u move on to next sector
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
250 lda U.SPT+1,u get sectors per track LSB (MSB is always 0)
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
251 cmpa U.CrtSct,u done track?
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
252 bhi LoadSctr no, go get sector
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
253 clr U.CrtSct,u reset current sector number to 0
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
254 inc U.CrtSid,u move on to next side
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
255 lda U.CrtSid,u get side number
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
256 cmpa U.Sides,u done cylinder?
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
257 blo LoadSctr no, go get sector
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
258 clr U.CrtSid,u reset side number to 0
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
259 ldd U.CrtCyl,u get cylinder number
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
260 addd #1 move on to next cylinder
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
261 std U.CrtCyl,u save cylinder number
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
262 ChkCyl cmpd #MaxCyls cylinder number OK?
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
263 bhs ReadErr no, go return error
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
264 LoadSctr bsr GetSctr go get current sector from WD 1002-05
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
265 bcs ReadErr error, go exit
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
266 clrb transfer 256 bytes
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
267 stb PB,y set WD sector buffer address
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
268 ReadLoop lda WDData,y get byte from WD 1002-05
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
269 sta ,x+ save byte to buffer
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
270 decb done yet?
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
271 bne ReadLoop no, go get another byte
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
272 dec U.BSct,u count down boot file sectors remaining
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
273 bne BootLoad
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
274 clrb clear carry
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
275 ldd U.BSZ,u get boot file size
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
276 ldx U.BtStrt,u get boot file start address
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
277 BtExit0 leas BootMem,s restore stack pointer
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
278 rts
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
279
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
280 GetSctr bsr SetupTF go set up WD task files (except command)
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
281 lda #ReadSctr load WD read sector command code
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
282 CmdUpdat ldb #CmdReg load WD command register address
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
283 bsr TFUpdat go issue command...
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
284 BusyWait ldb #StatReg
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
285 stb PB,y set WD status register address
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
286 BusyW0 ldb WDData,y get WD 1002-05 status
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
287 bitb #%00000010 valid data? (WD 1002-05 powered & connected?)
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
288 bne BWErr no, go report error...
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
289 tstb ensure [CC] sign flag is current
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
290 bmi BusyW0 yes, go check again
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
291 ldb WDData,y get valid controller status
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
292 rorb rotate error bit into carry
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
293 bcc NoError
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
294 ldb #ErrReg
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
295 stb PB,y set WD error register address
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
296 ldb WDData,y get error register contents
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
297 bne BWErr
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
298 NoError clrb
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
299 rts
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
300 BWErr comb error, set [CC] Carry...
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
301 rts
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
302
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
303 SetupTF ldd #$01*256+SctrCnt single sector commands only
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
304 bsr TFUpdat
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
305 lda U.CrtCyl,u get current cylinder number MSB
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
306 ldb #CylHigh
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
307 bsr TFUpdat
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
308 lda U.CrtCyl+1,u get current cylinder number LSB
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
309 ldb #CylLow
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
310 bsr TFUpdat
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
311 lda U.CrtSct,u get current sector number
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
312 adda U.StSctr,u add offset...
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
313 ldb #SctrReg
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
314 bsr TFUpdat
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
315 clrb default extended head disabled
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
316 lda U.CrtSid,u get current side (head) number
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
317 cmpa #$08 extended head?
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
318 blo StdHead no, go on...
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
319 incb set enable code
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
320 anda #$07 mask out all but standard head number
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
321 StdHead stb PA,y set extended head enable/disable
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
322 ora U.SDH,u mask in base SDH copy
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
323 ldb #SDHReg
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
324 TfUpdat stb PB,y set WD register address
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
325 sta WDData,y write data to WD 1002-05
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
326 rts
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
327
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
328 * pad Boot module out to $01D0 exactly
459
3e3f1f79ba00 Sources now use 'fill' pseudo-op to fill out for L2 modules
boisy
parents: 392
diff changeset
329 Pad fill $39,$1D0-3-*
45
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
330
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
331 emod
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
332 BEnd equ *
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
333 end
2ce754e62499 Moved booters to 3rdparty directory
boisy
parents:
diff changeset
334