annotate level1/modules/boot_1773.asm @ 1893:1827bb446188

Modified booters to use new boot strategy with boot_common.asm
author boisy
date Sat, 15 Oct 2005 15:32:45 +0000
parents 5f8822fb42e0
children 6d5bd8549d28
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
230
3d2fa54fe8fb Source changes
boisy
parents: 210
diff changeset
1 ********************************************************************
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
2 * Boot - WD1773 Boot module
230
3d2fa54fe8fb Source changes
boisy
parents: 210
diff changeset
3 *
3d2fa54fe8fb Source changes
boisy
parents: 210
diff changeset
4 * $Id$
3d2fa54fe8fb Source changes
boisy
parents: 210
diff changeset
5 *
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
6 * Edt/Rev YYYY/MM/DD Modified by
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
7 * Comment
230
3d2fa54fe8fb Source changes
boisy
parents: 210
diff changeset
8 * ------------------------------------------------------------------
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
9 * 4 1985/??/??
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
10 * Original Tandy distribution version.
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
11 *
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
12 * 6 1998/10/12 Boisy G. Pitre
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
13 * Obtained from L2 Upgrade archive, has 6ms step rate and disk timeout
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
14 * changes.
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
15 *
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
16 * 6r2 2003/05/18 Boisy G. Pitre
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
17 * Added '.' output for each sector for OS-9 L2 and NitrOS9 for
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
18 * Mark Marlette (a special request :).
1291
92e9f7416fc9 Added BLOB-stop fix, changed one line as per Robert Gault's suggestion
boisy
parents: 1287
diff changeset
19 *
92e9f7416fc9 Added BLOB-stop fix, changed one line as per Robert Gault's suggestion
boisy
parents: 1287
diff changeset
20 * 6r3 2003/08/31 Robert Gault
92e9f7416fc9 Added BLOB-stop fix, changed one line as per Robert Gault's suggestion
boisy
parents: 1287
diff changeset
21 * Put BLOB-stop code in place, changed orb #$30 to orb #$28
1520
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
22 *
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
23 * 6r4 2004/02/17 Rodney Hamilton
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
24 * Minor optimizations, improvements in source comments
1882
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
25 *
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
26 * 7 2005/10/10 Boisy G. Pitre
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
27 * Added fragmented bootfile support
1891
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
28 * 7 2005/10/13 Robert Gault
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
29 * Changed timing loops for H6309L2 so that code shortened enough to
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
30 * fit within the $1D0 boundary.
230
3d2fa54fe8fb Source changes
boisy
parents: 210
diff changeset
31
210
6bf55704c623 Boot is adapted from OS-9 Level Two boot module, now boots from
boisy
parents: 201
diff changeset
32 nam Boot
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
33 ttl WD1773 Boot module
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
34
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
35 IFP1
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
36 use defsfile
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
37 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
38
1520
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
39 * FDC Control Register bits at $FF40
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
40 HALTENA equ %10000000
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
41 SIDESEL equ %01000000 DRVSEL3 if no DS drives
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
42 DDEN equ %00100000
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
43 READY equ %00010000 READY for Tandy WD1773-based controllers
1516
9a9734ef451c Added comments, symbolics, optimized code slightly
boisy
parents: 1515
diff changeset
44 MOTON equ %00001000
1520
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
45 DRVSEL2 equ %00000100
1516
9a9734ef451c Added comments, symbolics, optimized code slightly
boisy
parents: 1515
diff changeset
46 DRVSEL1 equ %00000010
9a9734ef451c Added comments, symbolics, optimized code slightly
boisy
parents: 1515
diff changeset
47 DRVSEL0 equ %00000001
9a9734ef451c Added comments, symbolics, optimized code slightly
boisy
parents: 1515
diff changeset
48
1709
1e026af2217c Rodney's source fixer uppers
boisy
parents: 1533
diff changeset
49 * Default Boot is from drive 0
1520
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
50 BootDr set DRVSEL0
1709
1e026af2217c Rodney's source fixer uppers
boisy
parents: 1533
diff changeset
51 IFEQ DNum-1
1e026af2217c Rodney's source fixer uppers
boisy
parents: 1533
diff changeset
52 BootDr set DRVSEL1 Alternate boot from drive 1
1e026af2217c Rodney's source fixer uppers
boisy
parents: 1533
diff changeset
53 ENDC
1e026af2217c Rodney's source fixer uppers
boisy
parents: 1533
diff changeset
54 IFEQ DNum-2
1e026af2217c Rodney's source fixer uppers
boisy
parents: 1533
diff changeset
55 BootDr set DRVSEL2 Alternate boot from drive 2
1e026af2217c Rodney's source fixer uppers
boisy
parents: 1533
diff changeset
56 ENDC
1e026af2217c Rodney's source fixer uppers
boisy
parents: 1533
diff changeset
57 IFEQ DNum-3
1e026af2217c Rodney's source fixer uppers
boisy
parents: 1533
diff changeset
58 BootDr set SIDESEL Alternate boot from drive 3
1e026af2217c Rodney's source fixer uppers
boisy
parents: 1533
diff changeset
59 ENDC
1520
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
60
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
61 * WD17x3 DPort offsets
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
62 CONTROL equ 0
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
63 CMDREG equ 8+0 write-only
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
64 STATREG equ CMDREG read-only
1516
9a9734ef451c Added comments, symbolics, optimized code slightly
boisy
parents: 1515
diff changeset
65 TRACKREG equ 8+1
9a9734ef451c Added comments, symbolics, optimized code slightly
boisy
parents: 1515
diff changeset
66 SECTREG equ 8+2
9a9734ef451c Added comments, symbolics, optimized code slightly
boisy
parents: 1515
diff changeset
67 DATAREG equ 8+3
9a9734ef451c Added comments, symbolics, optimized code slightly
boisy
parents: 1515
diff changeset
68
1515
30c1d42f3913 Added comments, slow optimization progress
boisy
parents: 1514
diff changeset
69 * Sector Size
30c1d42f3913 Added comments, slow optimization progress
boisy
parents: 1514
diff changeset
70 SECTSIZE equ 256
30c1d42f3913 Added comments, slow optimization progress
boisy
parents: 1514
diff changeset
71
1520
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
72 * Step Rates:
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
73 * $00 = 6ms
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
74 * $01 = 12ms
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
75 * $02 = 20ms
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
76 * $03 = 30ms
1213
4e235f213651 Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents: 1166
diff changeset
77 STEP set $00
210
6bf55704c623 Boot is adapted from OS-9 Level Two boot module, now boots from
boisy
parents: 201
diff changeset
78
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
79 tylg set Systm+Objct
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
80 atrv set ReEnt+rev
1882
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
81 rev set $00
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
82 edition set 7
230
3d2fa54fe8fb Source changes
boisy
parents: 210
diff changeset
83
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
84 mod eom,name,tylg,atrv,start,size
230
3d2fa54fe8fb Source changes
boisy
parents: 210
diff changeset
85
1520
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
86 * NOTE: these are U-stack offsets, not DP
1882
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
87 seglist rmb 2 pointer to segment list
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
88 blockloc rmb 2 pointer to memory requested
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
89 blockimg rmb 2 duplicate of the above
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
90 bootloc rmb 3 sector pointer; not byte pointer
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
91 bootsize rmb 2 size in bytes
1515
30c1d42f3913 Added comments, slow optimization progress
boisy
parents: 1514
diff changeset
92 drvsel rmb 1
1514
b7d6cb1df834 added comments
boisy
parents: 1463
diff changeset
93 currtrak rmb 1
b7d6cb1df834 added comments
boisy
parents: 1463
diff changeset
94 ddtks rmb 1 no. of sectors per track
1893
1827bb446188 Modified booters to use new boot strategy with boot_common.asm
boisy
parents: 1891
diff changeset
95 ddfmt rmb 1
1520
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
96 side rmb 1 side 2 flag
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
97 size equ .
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
98
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
99 name fcs /Boot/
230
3d2fa54fe8fb Source changes
boisy
parents: 210
diff changeset
100 fcb edition
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
101
1893
1827bb446188 Modified booters to use new boot strategy with boot_common.asm
boisy
parents: 1891
diff changeset
102 FLOPPY equ 1
1827bb446188 Modified booters to use new boot strategy with boot_common.asm
boisy
parents: 1891
diff changeset
103
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
104 ************ START OF DEVICE-SPECIFIC INIT ***********
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
105 * HWInit - Initialize the device
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
106 HWInit
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
107 ldy Address,pcr get hardware address
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
108 lda #%11010000 ($D0) Force Interrupt (stops any command in progress)
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
109 sta CMDREG,y write command to command register
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
110 lbsr Delay2 delay 54~
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
111 lda STATREG,y clear status register
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
112 lda #$FF
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
113 sta currtrak,u set current track to 255
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
114 leax >NMIRtn,pcr point to NMI routine
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
115 IFGT Level-1
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
116 stx <D.NMI save address
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
117 ELSE
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
118 stx >D.XNMI+1 save address
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
119 lda #$7E
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
120 sta >D.XNMI
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
121 ENDC
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
122 lda #MOTON turn on drive motor
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
123 ora WhichDrv,pcr
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
124 sta CONTROL,y
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
125 * MOTOR ON spin-up delay loop (~307 mSec)
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
126 IFGT Level-1
1891
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
127 IFNE H6309
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
128 ldd #$F000 3 cycles
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
129 ELSE
1891
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
130 ldd #50000
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
131 ENDC
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
132 ELSE
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
133 ldd #25000
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
134 ENDC
1891
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
135 * IFNE H6309
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
136 * nop
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
137 * ENDC
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
138 L003A nop 1 cycles
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
139 nop 1 cycles
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
140 * IFNE H6309
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
141 * nop
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
142 * nop
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
143 * nop
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
144 * ENDC
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
145 subd #$0001 4 cycles
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
146 bne L003A 3 cycles
1893
1827bb446188 Modified booters to use new boot strategy with boot_common.asm
boisy
parents: 1891
diff changeset
147 HWTerm rts
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
148 ************ END OF DEVICE-SPECIFIC INIT ***********
1893
1827bb446188 Modified booters to use new boot strategy with boot_common.asm
boisy
parents: 1891
diff changeset
149
1827bb446188 Modified booters to use new boot strategy with boot_common.asm
boisy
parents: 1891
diff changeset
150 use ../../6809l1/modules/boot_common.asm
1882
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
151
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
152 ************************************************************
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
153 ************************************************************
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
154 * Hardware-Specific Booter Area *
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
155 ************************************************************
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
156 ************************************************************
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
157
210
6bf55704c623 Boot is adapted from OS-9 Level Two boot module, now boots from
boisy
parents: 201
diff changeset
158
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
159 DoDDns lda #DDEN+MOTON double density enable and motor on
1893
1827bb446188 Modified booters to use new boot strategy with boot_common.asm
boisy
parents: 1891
diff changeset
160 ora WhichDrv,pcr OR in selected drive
1516
9a9734ef451c Added comments, symbolics, optimized code slightly
boisy
parents: 1515
diff changeset
161 sta drvsel,u save drive selection byte
9a9734ef451c Added comments, symbolics, optimized code slightly
boisy
parents: 1515
diff changeset
162 clr currtrak,u clear current track
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
163 lda #$05
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
164 lbsr SetTrak Set the track to the head we want
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
165 ldb #0+STEP RESTORE cmd
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
166 lbra Talk2FDC send command and wait for it to complete
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
167
1882
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
168 *
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
169 * HWRead - Read a 256 byte sector from the device
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
170 * Entry: Y = hardware address
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
171 * B = bits 23-16 of LSN
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
172 * X = bits 15-0 of LSN
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
173 * blockloc,u = ptr to 256 byte sector
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
174 * Exit: X = ptr to data (i.e. ptr in blockloc,u)
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
175 *
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
176 * Read a sector from the 1773
1882
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
177 * Entry: B,X = LSN to read
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
178 HWRead lda #$91
1515
30c1d42f3913 Added comments, slow optimization progress
boisy
parents: 1514
diff changeset
179 bsr L00DF else branch subroutine
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
180 bcs HWRRts branch if error
1882
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
181 ldx blockloc,u get buffer pointer in X for caller
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
182 clrb
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
183 HWRRts rts
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
184
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
185 L00D7 bcc L00DF
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
186 pshs x,b,a
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
187 bsr DoDDns
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
188 puls x,b,a
1515
30c1d42f3913 Added comments, slow optimization progress
boisy
parents: 1514
diff changeset
189 L00DF pshs x,b,a save LSN, command
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
190 bsr ReadSect
1520
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
191 puls x,b,a restore LSN, command
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
192 bcc HWRRts branch if OK
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
193 lsra
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
194 bne L00D7
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
195 ReadSect bsr Seek2Sect seek to the sector stored in X
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
196 bcs HWRRts if error, return to caller
1882
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
197 ldx blockloc,u get address of buffer to fill
1515
30c1d42f3913 Added comments, slow optimization progress
boisy
parents: 1514
diff changeset
198 orcc #IntMasks mask interrupts
1882
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
199 pshs x save X
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
200 ldx #$FFFF
1516
9a9734ef451c Added comments, symbolics, optimized code slightly
boisy
parents: 1515
diff changeset
201 ldb #%10000000 ($80) READ SECTOR command
1882
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
202 stb CMDREG,y write to command register
1520
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
203 ldb drvsel,u (DDEN+MOTORON+BootDr)
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
204 * NOTE: The 1773 FDC multiplexes the write precomp enable and ready
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
205 * signals on the ENP/RDY pin, so the READY bit must always be ON for
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
206 * read and seek commands. (from the FD502 FDC Service Manual)
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
207 orb #DDEN+READY set DDEN+READY bits ($30)
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
208 tst side,u are we on side 2?
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
209 beq L0107
1520
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
210 orb #SIDESEL set side 2 bit
1882
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
211 L0107 stb CONTROL,y
1520
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
212 lbsr Delay2 delay 54~
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
213 orb #HALTENA HALT enable ($80)
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
214 * lda #%00000010 RESTORE cmd ($02)
1516
9a9734ef451c Added comments, symbolics, optimized code slightly
boisy
parents: 1515
diff changeset
215 *L0111 bita >DPort+STATREG
1291
92e9f7416fc9 Added BLOB-stop fix, changed one line as per Robert Gault's suggestion
boisy
parents: 1287
diff changeset
216 * bne L0123
92e9f7416fc9 Added BLOB-stop fix, changed one line as per Robert Gault's suggestion
boisy
parents: 1287
diff changeset
217 * leay -$01,y
92e9f7416fc9 Added BLOB-stop fix, changed one line as per Robert Gault's suggestion
boisy
parents: 1287
diff changeset
218 * bne L0111
1515
30c1d42f3913 Added comments, slow optimization progress
boisy
parents: 1514
diff changeset
219 * lda drvsel,u
1520
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
220 * sta >DPort+CONTROL
1291
92e9f7416fc9 Added BLOB-stop fix, changed one line as per Robert Gault's suggestion
boisy
parents: 1287
diff changeset
221 * puls y
92e9f7416fc9 Added BLOB-stop fix, changed one line as per Robert Gault's suggestion
boisy
parents: 1287
diff changeset
222 * bra L0138
1882
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
223 stb CONTROL,y
1291
92e9f7416fc9 Added BLOB-stop fix, changed one line as per Robert Gault's suggestion
boisy
parents: 1287
diff changeset
224 nop
92e9f7416fc9 Added BLOB-stop fix, changed one line as per Robert Gault's suggestion
boisy
parents: 1287
diff changeset
225 nop
1882
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
226 * bra L0123
1516
9a9734ef451c Added comments, symbolics, optimized code slightly
boisy
parents: 1515
diff changeset
227
1882
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
228 ldx ,s get X saved earlier
1516
9a9734ef451c Added comments, symbolics, optimized code slightly
boisy
parents: 1515
diff changeset
229 * Sector READ Loop
1882
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
230 L0123 lda DATAREG,y read from WD DATA register
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
231 sta ,x+
1520
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
232 * stb >DPort+CONTROL
1291
92e9f7416fc9 Added BLOB-stop fix, changed one line as per Robert Gault's suggestion
boisy
parents: 1287
diff changeset
233 nop
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
234 bra L0123
1520
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
235 * RVH NOTE: This ONLY works for double density boot disks! The Tandy
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
236 * controllers internally gate HALT enable with the DDEN bit, which
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
237 * means that reading a single-density boot disk will not generate the
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
238 * NMI signal needed to exit the read loop! Single-density disks must
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
239 * use a polled I/O loop instead.
1515
30c1d42f3913 Added comments, slow optimization progress
boisy
parents: 1514
diff changeset
240 NMIRtn leas R$Size,s adjust stack
1882
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
241 puls x
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
242 ldb STATREG,y read WD STATUS register
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
243 bitb #$9C any errors?
1516
9a9734ef451c Added comments, symbolics, optimized code slightly
boisy
parents: 1515
diff changeset
244 * bitb #$04 LOST DATA bit set?
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
245 beq r@ branch if not
1516
9a9734ef451c Added comments, symbolics, optimized code slightly
boisy
parents: 1515
diff changeset
246 * beq ChkErr branch if not
1882
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
247 L0138 comb else we will return error
210
6bf55704c623 Boot is adapted from OS-9 Level Two boot module, now boots from
boisy
parents: 201
diff changeset
248 ldb #E$Read
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
249 r@ rts
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
250
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
251 Seek2Sect
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
252 lda #MOTON permit alternate drives
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
253 ora WhichDrv,pcr permit alternate drives
1516
9a9734ef451c Added comments, symbolics, optimized code slightly
boisy
parents: 1515
diff changeset
254 sta drvsel,u save byte to static mem
1520
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
255 clr side,u start on side 1
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
256 tfr x,d move LSN into D
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
257 cmpd #$0000 zero?
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
258 beq L016C branch if so
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
259 clr ,-s else clear space on stack
1893
1827bb446188 Modified booters to use new boot strategy with boot_common.asm
boisy
parents: 1891
diff changeset
260 tst ddfmt,u double sided disk?
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
261 beq SnglSid branch if not
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
262 bra DblSid
1515
30c1d42f3913 Added comments, slow optimization progress
boisy
parents: 1514
diff changeset
263 * Double-sided code
1520
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
264 L0152 com side,u flag side 2
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
265 bne DblSid
210
6bf55704c623 Boot is adapted from OS-9 Level Two boot module, now boots from
boisy
parents: 201
diff changeset
266 inc ,s
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
267 DblSid subb ddtks,u
210
6bf55704c623 Boot is adapted from OS-9 Level Two boot module, now boots from
boisy
parents: 201
diff changeset
268 sbca #$00
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
269 bcc L0152
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
270 bra L0168
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
271 L0160 inc ,s
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
272 SnglSid subb ddtks,u subtract sectors per track from B
210
6bf55704c623 Boot is adapted from OS-9 Level Two boot module, now boots from
boisy
parents: 201
diff changeset
273 sbca #$00
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
274 bcc L0160
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
275 L0168 addb #18 add sectors per track (should this be ddtks?)
1882
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
276 puls a get current track indicator off of stack
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
277 L016C incb
1882
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
278 stb SECTREG,y save in sector register
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
279 SetTrak ldb currtrak,u get current track in B
1882
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
280 stb TRACKREG,y save in track register
1520
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
281 cmpa currtrak,u same as A?
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
282 beq rtsok branch if so
1514
b7d6cb1df834 added comments
boisy
parents: 1463
diff changeset
283 sta currtrak,u
1882
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
284 sta DATAREG,y
1516
9a9734ef451c Added comments, symbolics, optimized code slightly
boisy
parents: 1515
diff changeset
285 ldb #$10+STEP SEEK command
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
286 bsr Talk2FDC send command to controller
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
287 pshs x
1520
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
288 * Seek Delay
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
289 ldx #$222E delay ~39 mSec (78mS L1)
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
290 SeekDly leax -$01,x
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
291 bne SeekDly
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
292 puls x
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
293 rtsok clrb
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
294 rts
1516
9a9734ef451c Added comments, symbolics, optimized code slightly
boisy
parents: 1515
diff changeset
295
9a9734ef451c Added comments, symbolics, optimized code slightly
boisy
parents: 1515
diff changeset
296 *ChkErr bitb #$98 evaluate WD status (READY, RNF, CRC err)
9a9734ef451c Added comments, symbolics, optimized code slightly
boisy
parents: 1515
diff changeset
297 * bne L0138
9a9734ef451c Added comments, symbolics, optimized code slightly
boisy
parents: 1515
diff changeset
298 * clrb
9a9734ef451c Added comments, symbolics, optimized code slightly
boisy
parents: 1515
diff changeset
299 * rts
9a9734ef451c Added comments, symbolics, optimized code slightly
boisy
parents: 1515
diff changeset
300
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
301 Talk2FDC bsr DoCMD issue FDC cmd, wait 54~
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
302 FDCLoop ldb STATREG,y get status
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
303 bitb #$01 still BUSY?
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
304 bne FDCLoop loop until command completes
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
305 rts
1516
9a9734ef451c Added comments, symbolics, optimized code slightly
boisy
parents: 1515
diff changeset
306
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
307 * Issue command and wait 54 clocks
1520
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
308 * Controller requires a min delay of 14uS (DD) or 28uS (SD)
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
309 * following a command write before status register is valid
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
310 DoCMD bsr SelNSend
1515
30c1d42f3913 Added comments, slow optimization progress
boisy
parents: 1514
diff changeset
311 * Delay branches
1520
5ff76789bec2 Updated boot_1773.asm from Rodney H.
boisy
parents: 1516
diff changeset
312 * 54 clock delay including bsr (=30uS/L2,60us/L1)
1891
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
313 * H6309 code changed to reduce code size, RG
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
314 IFEQ H6309
1515
30c1d42f3913 Added comments, slow optimization progress
boisy
parents: 1514
diff changeset
315 Delay2
30c1d42f3913 Added comments, slow optimization progress
boisy
parents: 1514
diff changeset
316 lbsr Delay3
30c1d42f3913 Added comments, slow optimization progress
boisy
parents: 1514
diff changeset
317 Delay3
30c1d42f3913 Added comments, slow optimization progress
boisy
parents: 1514
diff changeset
318 lbsr Delay4
30c1d42f3913 Added comments, slow optimization progress
boisy
parents: 1514
diff changeset
319 Delay4
1891
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
320 ELSE
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
321 Delay2 lda #5 3 cycles
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
322 Delay3 exg a,a 5 cycles | 10*5
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
323 deca 2 cycles |
5f8822fb42e0 shortened H6309L2 code to fit within $1D0 bytes
robert
parents: 1886
diff changeset
324 bne Delay3 3 cycles |
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
325 ENDC
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
326 rts
210
6bf55704c623 Boot is adapted from OS-9 Level Two boot module, now boots from
boisy
parents: 201
diff changeset
327
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
328 * Select And Send
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
329 * Entry: B = command byte
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
330 SelNSend lda drvsel,u
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
331 sta CONTROL,y
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
332 stb CMDREG,y
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
333 rts
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
334
1166
bb618bed0bdc Miscellaneous source improvements
boisy
parents: 249
diff changeset
335 IFGT Level-1
1287
10957d54bf16 Made all modules rev 0
boisy
parents: 1213
diff changeset
336 * Filler to get $1D0
1882
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
337 Filler fill $39,$1D0-3-2-1-*
1166
bb618bed0bdc Miscellaneous source improvements
boisy
parents: 249
diff changeset
338 ENDC
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
339
1882
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
340 Address fdb DPort
1886
b151cc54904e Added fragmented bootfile support. Added more labels and comments
boisy
parents: 1882
diff changeset
341 WhichDrv fcb BootDr
1882
c96f594fe098 Added fragmented boot support... needs additional testing.
boisy
parents: 1709
diff changeset
342
0
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
343 emod
6641a883d6b0 Initial revision
boisy
parents:
diff changeset
344 eom equ *
48
cdfe69117a2f Cleaned up source
boisy
parents: 0
diff changeset
345 end