annotate level1/modules/rb1773.asm @ 3143:c860ff48e09c

Add coco3fpga banner to init.asm
author Bill Pierce <merlinious999@gmail.com>
date Sat, 04 Feb 2017 18:33:07 +0100
parents 4446149f7ea9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1 ********************************************************************
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
2 * rb1773 - Western Digital 1773 Disk Controller Driver
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
3 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
4 * $Id$
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
5 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
6 * This driver has been tested with the following controllers:
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
7 * - Tandy FD-502 "shortie" disk controller
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
8 * - Disto Super Controller I
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
9 * - Disto Super Controller II
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
10 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
11 * This driver can also be assembled to support the no-halt feature of
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
12 * the Disto Super Controller II.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
13 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
14 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
15 * A lot of references to **.CYL or <u00B6 using 16 bit registers can be
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
16 * changed to 8 bit registers with a +1 offset, since track #'s >255 are
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
17 * ignored
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
18 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
19 * NOTE: 512 bytes is reserved as a physical sector buffer. Any reads/
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
20 * writes are done from this buffer to the controller. Copies of the 256
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
21 * byte chunk needed are done by a block memory move
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
22 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
23 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
24 ********** DISTO SUPER CONTROLLER II NOTES **********
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
25 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
26 * SCII 0=standard controller 1=Disto Super Controller II
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
27 * SCIIALT 0=Normal I/O register 1=Alternative registers; See below
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
28 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
29 * Disto Super Controller II Registers:
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
30 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
31 * $FF74 RW.Dat --- R/W Buffer data #1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
32 * $FF75 mirror of $FF74
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
33 * $FF76 RW.Ctrl --- Write D0 = 0 FDC Write Op #2
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
34 * = 1 FDC Read Op #2
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
35 * D1 = 0 Normal Mode
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
36 * = 1 Buffered I/O Mode
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
37 * D2 = 0 Normal NMI
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
38 * = 1 Masked NMI
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
39 * D3 = 0 No FIRQ (Masked)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
40 * = 1 Enabled FIRQ
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
41 * Read D7 = FDC INT Status (Inverted)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
42 * $FF77 mirror of $FF76
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
43 * #1: any write to $FF76-$FF77 clears Buffer counter
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
44 * #2: in buffered mode only
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
45 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
46 * Alternate port is at $FF58-$FF5B in case of hardware conflicts.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
47 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
48 * Edt/Rev YYYY/MM/DD Modified by
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
49 * Comment
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
50 * ------------------------------------------------------------------
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
51 * 11 1993/05/12 ???
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
52 * Special opts for TC9 to slow controller reads and writes TFM's
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
53 * between sector buffers & in drive table init/copies.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
54 * Changed software timing loop (drive spin-up) to F$Sleep for 32 ticks
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
55 * Shrunk (slowed slightly) error returns
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
56 * Added blobstop code
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
57 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
58 * 11r1 2003/09/03 Boisy G. Pitre
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
59 * Added code to sense if HW is present or not and return error if not.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
60 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
61 * 1r0 2004/05/20 Boisy G. Pitre
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
62 * Restarted edition due to name change; backported to Level 1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
63 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
64 * 2004/06/01 Robert Gault
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
65 * Added code to obtain an SCII driver, at least for the Sleep mode. It
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
66 * would be quite difficult and probably not worth the effort to permit
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
67 * selection of both Sleep and IRQ SCII drivers. However, both normal
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
68 * and Alt SCII I/O registers are supported.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
69 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
70 * Cleaned up some errors in the last version of rb1773.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
71 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
72 * 2004/07/11 Robert Gault
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
73 * Corrected the error handling code for read & write to separate SCII errors
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
74 * from OS-9 errors. Changed drive test from compare #4 to compare #N.Drives to
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
75 * permit up to 6 drives using alternate table.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
76 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
77 * 2005/01/27 Robert Gault
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
78 * Separated the sector write and format write loops so that the CPU clock
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
79 * can be slowed down during formats. This "corrects" problems some hardware
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
80 * have with the current NitrOS-9 during formats.
1785
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
81 *
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
82 * 1r1 2005/04/07 Boisy G. Pitre
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
83 * We now save the contents of D.NMI (Level 2) or D.XNMI (Level 1) before
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
84 * overwriting them, and then restore the original values at term time.
2226
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
85 *
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
86 * 2009/03/19 Robert Gault
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
87 * Removed slow down hack from format and write sector but left code just in case.
2940
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
88 *
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
89 * 2013/12/16 Robert Gault and Gene Heskett
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
90 * Added two new flags, flagWP flagFMT, to prevent disk damage by Writes where
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
91 * the drive head width does not match the disk track density.
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
92 * flagWP <>0 write protects; flagFMT <>0 overrules flagWP so that a Format can
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
93 * write to a disk.
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
94 * A descriptor that does not match your drive can still cause Writes to disks that
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
95 * could possibly cause disk corruption. This cannot be prevented.
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
96 *
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
97 * When LSN0 is read using a 3.5" drive, most of the checks of density, sides, etc.
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
98 * are bypassed as not needed.
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
99
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
100 nam rb1773
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
101 ttl Western Digital 1773 Disk Controller Driver
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
102
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
103 * These lines needed if assembling with on a Color computer.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
104 *SCII set 1 * 0=not present 1=present
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
105 *SCIIALT set 1 * 0=normal address 1=alternate
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
106 SCIIHACK set 0 * 0=stock model 1=512 byte buffer
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
107 *H6309 set 1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
108 *LEVEL set 2
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
109 * These lines needed if not using latest os9def files.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
110 *TkPerSec set 60
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
111 *DPort set $FF40
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
112
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
113 * This should be changed for NitrOS9 project to "use defsfile"
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
114 IFP1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
115 use defsfile
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
116 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
117
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
118 tylg set Drivr+Objct
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
119 atrv set ReEnt+rev
1785
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
120 rev set $01
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
121 edition set 1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
122
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
123 * Configuration Settings
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
124 N.Drives equ 4 number of drives to support
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
125 TC9 equ 0 Set to 1 for TC9 special slowdowns
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
126 PRECOMP equ 0 Set to 1 to turn on write precompensation
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
127
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
128 * Disto Super Controller defs
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
129 IFEQ SCIIALT
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
130 RW.Dat equ $FF74
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
131 RW.Ctrl equ $FF76
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
132 ELSE
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
133 RW.Dat equ $FF58
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
134 RW.Ctrl equ $FF5A
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
135 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
136
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
137
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
138 * WD-17X3 Definitions
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
139 CtrlReg equ $00 Control register for Tandy controllers; not part of WD
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
140 WD_Cmd equ $08
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
141 WD_Stat equ WD_Cmd
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
142 WD_Trak equ $09
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
143 WD_Sect equ $0A
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
144 WD_Data equ $0B
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
145
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
146 * WD-17X3 Commands
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
147 S$Read equ $80 Read sector
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
148 S$Format equ $A0 Format track
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
149 S$FrcInt equ $D0 Force interrupt
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
150
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
151 * Control Register Definitions
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
152 C_HALT equ %10000000 Halt line to CPU is active when set
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
153 C_SIDSEL equ %01000000 Side select (0 = front side, 1 = back side)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
154 C_DBLDNS equ %00100000 Density (0 = single, 1 = double)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
155 C_WPRCMP equ %00010000 Write precompensation (0 = off, 1 = on)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
156 C_MOTOR equ %00001000 Drive motor (0 = off, 1 = on)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
157 C_DRV2 equ %00000100 Drive 2 selected when set
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
158 C_DRV1 equ %00000010 Drive 1 selected when set
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
159 C_DRV0 equ %00000001 Drive 0 selected when set
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
160
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
161 mod eom,name,tylg,atrv,start,size
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
162
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
163 u0000 rmb DRVBEG+(DRVMEM*N.Drives)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
164 lastdrv rmb 2 Last drive table accessed (ptr)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
165 ctlimg rmb 1 Bit mask for control reg (drive #, side,etc)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
166 u00AA rmb 1 drive change flag
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
167 sectbuf rmb 2 Ptr to 512 byte sector buffer
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
168 currside rmb 1 head flag; 0=front 1 = back
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
169 u00AE rmb 1 LSB of LSN
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
170 IFGT Level-1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
171 FBlock rmb 2 block number for format
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
172 FTask rmb 1 task number for format
1785
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
173 NMISave rmb 2
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
174 ELSE
1807
321957ee26e8 Changed NMISave to be rmb 3 for Level 1 -- Thanks Phill for pointing out the error.
boisy
parents: 1793
diff changeset
175 NMISave rmb 3
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
176 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
177 VIRQPak rmb 2 Vi.Cnt word for VIRQ
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
178 u00B3 rmb 2 Vi.Rst word for VIRQ
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
179 u00B5 rmb 1 Vi.Stat byte for VIRQ (drive motor timeout)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
180 loglsn rmb 2 OS9's logical sector #
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
181 * Removed next line and added two new ones. RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
182 * PCDOS does not ask driver for any info.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
183 * physlsn rmb 2 PCDOS (512 byte sector) #
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
184 flag512 rmb 1 PCDOS (512 byte sector) 0=no, 1=yes
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
185 flagform rmb 1 SCII format flag
2940
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
186 flagWP rmb 1 write protection <>0
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
187 flagFMT rmb 1 format flag
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
188 size equ .
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
189
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
190 fcb DIR.+SHARE.+PEXEC.+PWRIT.+PREAD.+EXEC.+UPDAT.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
191
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
192 name fcs /rb1773/
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
193 fcb edition
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
194
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
195 VIRQCnt fdb TkPerSec*4 Initial count for VIRQ (4 seconds)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
196
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
197 IRQPkt fcb $00 Normal bits (flip byte)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
198 fcb $01 Bit 1 is interrupt request flag (Mask byte)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
199 fcb 10 Priority byte
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
200
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
201 * Init
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
202 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
203 * Entry:
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
204 * Y = address of device descriptor
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
205 * U = address of device memory area
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
206 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
207 * Exit:
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
208 * CC = carry set on error
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
209 * B = error code
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
210 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
211 * New code added 09/03/2003 by Boisy G. Pitre
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
212 * Write a pattern to $FF4B and read it back to verify that the hardware
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
213 * does exist.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
214 Init equ *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
215 * Two new lines for SCII. RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
216 IFNE SCII
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
217 clr RW.Ctrl clear SCII control register
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
218 clr flagform,u clear SCII format flag
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
219 ENDC
2940
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
220 clr flagWP,u
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
221 clr flagFMT,u
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
222 ldx V.PORT,u get Base port address
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
223 lda WD_Data,x get byte at FDC Data register
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
224 coma complement it to modify it
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
225 sta WD_Data,x write it
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
226 clrb
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
227 Init2 decb delay a bit...
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
228 bmi Init2
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
229 suba WD_Data,x read it back
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
230 lbne NoHW if not zero, we didn't read what we wrote
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
231 **
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
232 IFEQ Level-1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
233 clr >D.DskTmr flag drive motor as not running
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
234 ELSE
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
235 clr <D.MotOn flag drive motor as not running
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
236 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
237 leax WD_Stat,x point to Status/Command register
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
238 lda #S$FrcInt "Force Interrupt" command
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
239 sta ,x send to FDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
240 lbsr FDCDelay time delay for ~ 108 cycles
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
241 lda ,x eat status register
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
242 ldd #$FF*256+N.Drives 'invalid' value & # of drives
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
243 leax DRVBEG,u point to start of drive tables
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
244 l1 sta ,x DD.TOT MSB to bogus value
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
245 sta <V.TRAK,x init current track # to bogus value
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
246 leax <DRVMEM,x point to next drive table
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
247 decb done all drives yet?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
248 bne l1 no, init them all
1785
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
249 *** Fix on 04/06/2005: we now save the contents of D.NMI (Level 2)
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
250 *** or D.XNMI (Level 1) before overwriting them.
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
251 IFGT Level-1
1785
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
252 ldx >D.NMI
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
253 stx NMISave,u
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
254 leax >NMISvc,pc point to NMI service routine
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
255 stx >D.NMI install as system NMI
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
256 ELSE
1785
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
257 ldx >D.XNMI
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
258 stx NMISave,u
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
259 lda >D.XNMI+2
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
260 sta NMISave+2,u
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
261 leax >NMISvc,pc point to NMI service routine
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
262 stx >D.XNMI+1 NMI jump vector operand
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
263 lda #$7E JMP code
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
264 sta >D.XNMI NMI jump vector opcode
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
265 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
266 pshs y save device dsc. ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
267 leay >u00B5,u point to Vi.Stat in VIRQ packet
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
268 tfr y,d make it the status register ptr for IRQ
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
269 leay >IRQSvc,pc point to IRQ service routine
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
270 leax >IRQPkt,pc point to IRQ packet
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
271 os9 F$IRQ install IRQ
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
272 puls y Get back device dsc. ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
273 bcs Return If we can't install IRQ, exit
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
274 ldd #512 Request 512 byte sector buffer
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
275 pshs u Preserve device mem ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
276 os9 F$SRqMem Request sector buffer
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
277 tfr u,x Move ptr to sector buffer to x
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
278 puls u Restore device mem ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
279 bcs Return If error, exit with it
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
280 stx >sectbuf,u Save ptr to sector buffer
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
281
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
282 * GetStat
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
283 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
284 * Entry:
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
285 * A = function code
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
286 * Y = address of path descriptor
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
287 * U = address of device memory area
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
288 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
289 * Exit:
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
290 * CC = carry set on error
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
291 * B = error code
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
292 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
293 GetStat clrb no GetStt calls - return, no error, ignore
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
294 Return rts
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
295
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
296 * Term
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
297 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
298 * Entry:
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
299 * U = address of device memory area
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
300 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
301 * Exit:
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
302 * CC = carry set on error
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
303 * B = error code
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
304 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
305 Term leay >VIRQPak,u Point to VIRQ packet
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
306 IFNE H6309
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
307 tfr 0,x "remove"
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
308 ELSE
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
309 ldx #$0000
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
310 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
311 os9 F$VIRQ Remove VIRQ
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
312 IFNE H6309
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
313 tfr 0,x "remove"
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
314 ELSE
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
315 ldx #$0000
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
316 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
317 leay >IRQSvc,pc point to IRQ service routine
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
318 os9 F$IRQ Remove IRQ
1785
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
319 *** Fix: we now restore original D.NMI (Level 2) or D.XNMI (Level 1)
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
320 *** before overwriting them.
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
321 IFGT Level-1
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
322 ldx NMISave,u
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
323 stx >D.NMI
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
324 ELSE
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
325 ldx NMISave,u
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
326 stx >D.XNMI
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
327 lda NMISave+2,u
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
328 sta >D.XNMI+2
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
329 ENDC
9d95e3246a61 rb1773.asm: now saves/restores original NMI vector
boisy
parents: 1746
diff changeset
330 ***
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
331 pshs u Save device mem ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
332 ldu >sectbuf,u Get pointer to sector buffer
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
333 ldd #512 Return sector buffer memory
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
334 os9 F$SRtMem
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
335 puls u Restore device mem ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
336 clr >DPort+CtrlReg shut off drive motors
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
337 IFEQ Level-1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
338 clr >D.DskTmr Clear out drive motor timeout flag
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
339 ELSE
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
340 clr <D.MotOn Clear out drive motor timeout flag
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
341 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
342 ex rts return
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
343
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
344 * Check if 512 byte sector conversion needed
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
345 * Entry: B:X=LSN
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
346 * U=Static mem ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
347 * Y=Path dsc. ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
348 * Exit: X=New LSN (same as original for 256 byte sectors, 1/2 of original
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
349 * for 512 byte sectors
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
350 * regD changed
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
351 Chk512 equ *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
352 clr flag512,u set to 256 byte sector
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
353 stx >loglsn,u save OS9 LSN
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
354 lda <PD.TYP,y get device type from path dsc.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
355 anda #%00000100 mask out all but 512 byte sector flag
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
356 bne Log2Phys 512 byte sectors, go process
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
357 rts RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
358
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
359 * 512 byte sector processing goes here
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
360 * regB should be saved and not just cleared at end because there is
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
361 * a subsequent tst for the msb of lsn. The test is pointless if B
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
362 * is changed.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
363 Log2Phys pshs b save MSB of LSN; new RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
364 * Minor inefficiencies here that I have changed, RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
365 tfr x,d
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
366 IFNE H6309
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
367 lsrd
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
368 ELSE
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
369 lsra
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
370 rorb
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
371 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
372 tfr d,x move new LSN back to regX
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
373 * New line for stock SCII controller with 256 max no-halt.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
374 inc flag512,u set to 512 byte sector
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
375 puls b,pc regB will be tested later for >0
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
376
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
377 start lbra Init
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
378 bra Read
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
379 nop
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
380 lbra Write
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
381 bra GetStat
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
382 nop
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
383 lbra SetStat
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
384 bra Term
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
385 nop
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
386
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
387 * Read
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
388 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
389 * Entry:
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
390 * B = MSB of LSN
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
391 * X = LSB of LSN
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
392 * Y = address of path descriptor
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
393 * U = address of device memory area
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
394 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
395 * Exit:
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
396 * CC = carry set on error
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
397 * B = error code
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
398 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
399 Read bsr Chk512 go check for 512 byte sector/adjust if needed
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
400 lda #%10010001 error flags (see Disto SCII source)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
401 pshs x preserve sector #
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
402 lbsr ReadWithRetry go read the sector
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
403 puls x restore sector #
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
404 bcs ex if error, exit
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
405 pshs y,x save path dsc ptr & LSN
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
406 leax ,x LSN0?, ie. tstx
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
407 bne L012D no, go calculate normally
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
408 puls y,x yes, restore path dsc ptr & LSN
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
409 lda <PD.TYP,y get type from path dsc.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
410 bita #TYP.NSF standard OS-9 format?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
411 beq L00F0 yes, skip ahead
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
412 lbsr MakeDTEntry else make a drive table entry
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
413 pshs y,x save path dsc ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
414 bra L012D
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
415
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
416 * LSN0, standard OS-9 format - copy part of LSN0 into drive table
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
417 L00F0 ldx >sectbuf,u Get ptr to sector buffer
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
418 pshs y,x Preserve path dsc. ptr & sector buffer ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
419 ldy >lastdrv,u Get last drive table accessed ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
420 IFNE H6309
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
421 ldw #DD.SIZ # bytes to copy from new LSN0 to drive table
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
422 tfm x+,y+ Copy them
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
423 ELSE
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
424 ldb #DD.SIZ
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
425 L00F0Lp lda ,x+
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
426 sta ,y+
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
427 decb
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
428 bne L00F0Lp
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
429 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
430 ldy >lastdrv,u Get drive table ptr back
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
431 lda <DD.FMT,y Get format for disk in drive
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
432 ldy 2,s restore path descriptor pointer
2940
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
433 * !!!!!!! Most of these tests are pointless with a 3.5" drive RG
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
434 ldb <PD.TYP,y Get path's type settings RG
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
435 bitb #1 test for 3.5" drive
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
436 bne L0128 skip rest of tests if 3.5" drive
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
437 ldb <PD.DNS,y Get path's density settings
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
438 bita #FMT.DNS Disk in drive double density?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
439 beq L0115 No, all drives can read single, skip ahead
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
440 bitb #DNS.MFM Can our path dsc. handle double density?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
441 beq erbtyp No, illegal
2939
011a5f26e9da rb1773: Fix comments about 135 TPI versus 48 or 96
Robert Gault <robert.gault@att.net>
parents: 2938
diff changeset
442 L0115 bita #FMT.TDNS Is new disk 96tpi?
011a5f26e9da rb1773: Fix comments about 135 TPI versus 48 or 96
Robert Gault <robert.gault@att.net>
parents: 2938
diff changeset
443 beq L011D No, all drives handle 48/135 tpi, so skip ahead
2940
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
444 sta flagWP,u set write protection
2939
011a5f26e9da rb1773: Fix comments about 135 TPI versus 48 or 96
Robert Gault <robert.gault@att.net>
parents: 2938
diff changeset
445 bitb #DNS.DTD Can path dsc. handle 96 tpi?
011a5f26e9da rb1773: Fix comments about 135 TPI versus 48 or 96
Robert Gault <robert.gault@att.net>
parents: 2938
diff changeset
446 beq erbtyp No, illegal format
2940
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
447 clr flagWP,u clear write protection since disk and descriptor match
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
448 L011D bita #FMT.SIDE Is new disk double sided?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
449 beq L0128 No, all drives handle single sided, we're done
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
450 lda <PD.SID,y Get # sides path dsc. can handle
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
451 suba #2 sides higher or equal to 2?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
452 blo erbtyp Yes, exit with illegal type error
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
453 L0128 clrb No error
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
454 * LSN's other than 0 come straight here
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
455 L012D ldy 2,s Get path dsc. ptr back??
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
456 ldx PD.BUF,y Get path dsc. buffer ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
457 * lda <PD.TYP,y Get path dsc. disk type, RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
458 ldy >sectbuf,u Get ptr to sector buffer
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
459 IFNE H6309
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
460 ldw #256 OS9 sector size (even if physical was 512)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
461 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
462 * anda #%00000100 Mask out all but 512 byte sector flag, RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
463 * Next replaces the two lines removed, RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
464 tst flag512,u Is it a 512 byte sector?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
465 beq L014B If normal sector, just copy it
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
466 ldd >loglsn,u Get OS9's LSN (twice of the 'real' 512 sector)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
467 andb #$01 Mask out all but odd/even sector indicator
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
468 beq L014B Even, use 1st half of 512 byte sector
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
469 IFNE H6309
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
470 addr w,y Odd, bump sector buffer ptr to 2nd half
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
471 ELSE
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
472 leay 256,y
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
473 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
474 L014B equ *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
475 IFNE H6309
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
476 tfm y+,x+ Copy from physical sector buffer to PD buffer
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
477 puls pc,y,x restore path dsc & sector buffer ptrs & return
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
478 ELSE
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
479 pshs d
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
480 clrb
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
481 L014BLp lda ,y+
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
482 sta ,x+
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
483 decb
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
484 bne L014BLp
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
485 puls pc,y,x,d restore path dsc & sector buffer ptrs & return
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
486 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
487
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
488 erbtyp comb
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
489 ldb #E$BTyp Error - wrong type error
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
490 puls pc,y,x
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
491
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
492 **********************
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
493 * Read error - retry handler
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
494 Retry
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
495 bcc ReadWithRetry Normal retry, try reading again
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
496 pshs x,d Preserve regs
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
497 lbsr sktrk0 Seek to track 0 (attempt to recalibrate)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
498 puls x,d Restore regs & try reading again
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
499
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
500
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
501 * Read With Retry: Do read with retries
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
502 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
503 * ENTER reg B,X=working lsn on disk
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
504 * Y=path descriptor
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
505 * U=driver data
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
506 * A=retry sequence mix of read & seek track 0
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
507 * EXIT X,Y,U preserved; D,CC changed
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
508 * B=error if any
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
509 * CC=error flag
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
510 ReadWithRetry
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
511 pshs x,d Preserve regs
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
512 bsr ReadSector Go read sector
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
513 puls x,d Restore regs (A=retry flags)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
514 lbcc L01D7 No error, return
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
515 lsra Shift retry flags
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
516 bne Retry Still more retries allowed, go do them
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
517 * otherwise, final try before we give up
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
518 ReadSector
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
519 lbsr L02AC Do double-step/precomp etc. if needed, seek
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
520 lbcs L01D7 Error somewhere, exit with it
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
521 L0176 ldx >sectbuf,u Get physical sector buffer ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
522 ldb #S$Read Read sector command
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
523 IFNE SCII
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
524 * If SCII not hacked for 512 byte no-halt, must use halt for 512b sectors RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
525 IFEQ SCIIHACK
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
526 clra SCII normal mode, normal NMI
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
527 tst flag512,u SCII must use halt mode for 512 byte sectors
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
528 bne L0176B
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
529 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
530 lda #7 SCII read, buffered mode, masked NMI
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
531 bsr L01A1B send commands and wait
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
532 * New lines needed because the SCII has error other than OS-9 errors. RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
533 bcs ngood
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
534 * This now becomes a subroutine call. RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
535 * lbcs L03AF get the errors
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
536 lbsr L03AF get the errors
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
537 bcc good
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
538 ngood rts
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
539
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
540 good pshs y
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
541 IFNE H6309
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
542 ldw #256 set counter
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
543 ldy #RW.DAT source of data
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
544 IFNE SCIIHACK
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
545 tst flag512,u
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
546 beq sc2rlp
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
547 ldw #512 bump up counter to 512 byte sector
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
548 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
549 * Don't use tfm if no halt important else need orcc #$50 for tfm
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
550 * If an interrupt occurs during a tfm transfer, the SCII counter
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
551 * will update but the tfm will repeat a byte and lose track.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
552 * If orcc #$50 used, then key presses may be lost even with no-halt
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
553 * mode.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
554 sc2rlp lda ,y read byte from SCII
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
555 sta ,x+ transfer byte to system buffer
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
556 decw update counter
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
557 bne sc2rlp
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
558 ELSE
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
559 ldy #256
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
560 IFNE SCIIHACK
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
561 tst flag512,u
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
562 beq sc2rlp
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
563 ldy #512
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
564 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
565 sc2rlp lda >RW.DAT
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
566 sta ,x+
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
567 leay -1,y
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
568 bne sc2rlp
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
569 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
570 clrb no errors
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
571 puls y,pc
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
572 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
573
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
574 L0176B bsr L01A1 Send to controller & time delay to let it settle
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
575 *** Next few lines are commented out for blobstop patches
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
576 *L0180 bita >DPort+WD_Stat check status register
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
577 * bne L0197 eat it & start reading sector
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
578 * leay -1,y bump timeout timer down
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
579 * bne L0180 keep trying until it reaches 0 or sector read
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
580 * lda >ctlimg,u get current drive settings
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
581 * ora #C_MOTOR turn drive motor on
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
582 * sta >DPort+CtrlReg send to controller
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
583 * puls y,cc restore regs
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
584 * lbra L03E0 exit with Read Error
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
585 *** Blobstop fixes
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
586 stb >DPort+CtrlReg send B to control register
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
587 nop allow HALT to take effect
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
588 nop
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
589 bra L0197 and a bit more time
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
590 * Read loop - exited with NMI
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
591 * Entry: X=ptr to sector buffer
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
592 * B=Control register settings
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
593 L0197 lda >DPort+WD_Data get byte from controller
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
594 sta ,x+ store into sector buffer
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
595 * stb >DPort+CtrlReg drive info
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
596 nop -- blobstop fix
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
597 bra L0197 Keep reading until sector done
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
598
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
599 L01A1 orcc #IntMasks Shut off IRQ & FIRQ
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
600 * No-halt mode must enter here, skipping IRQ shutoff.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
601 L01A1B stb >DPort+WD_Cmd Send command
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
602 IFNE SCII
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
603 sta >RW.Ctrl tell SCII what to do
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
604 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
605 L01A1C ldb #C_DBLDNS+C_MOTOR Double density & motor on
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
606 orb >ctlimg,u Merge with current drive settings
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
607 stb >DPort+CtrlReg Send to control register
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
608 IFNE SCII
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
609 tst flagform,u Format uses halt mode
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
610 bne s512
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
611 IFEQ SCIIHACK
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
612 tst flag512,u SCII uses halt with 512 byte sectors
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
613 beq s256
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
614 ELSE
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
615 bra s256
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
616 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
617 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
618 s512 ldb #C_HALT+C_DBLDNS+C_MOTOR Enable halt, double density & motor on
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
619 orb >ctlimg,u Merge that with current drive settings
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
620 lbra FDCDelay Time delay to wait for command to settle
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
621 IFNE SCII
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
622 s256 ldb #4 normal mode, NMI masked
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
623 lda #255 time out slices
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
624 pshs a,x
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
625 SC2tmr1 ldx #1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
626 lbsr Delay sleep or timer
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
627 dec ,s count
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
628 beq tmout
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
629 tst >RW.Ctrl check status
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
630 bmi SC2tmr1 loop on not ready
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
631 stb RW.Ctrl clear SCII but don't generate NMI
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
632 clrb
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
633 puls a,x,pc
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
634 tmout stb RW.Ctrl clear SCII buffer counter
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
635 lda #$D0 force interrupt
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
636 sta DPort+WD_Cmd
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
637 comb set carry
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
638 puls a,x,pc
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
639 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
640
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
641 * Delay for some number of ticks (1 tick = 1/60 second).
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
642 * For a hard delay, we need to delay for 14833 cycles at .89MHz or
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
643 * 29666 cycles at 1.78MHz
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
644 * Entry: X = number of ticks to delay
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
645 Delay
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
646 pshs d [5+] [4+]
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
647 IFGT Level-1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
648 ldd <D.Proc [6] [5] process pointer
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
649 cmpd <D.SysPrc [is it the system?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
650 beq hardloop [3] [3]
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
651 os9 F$Sleep if not system then sleep
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
652 puls d,pc [5+] [4+]
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
653 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
654 hardloop tfr x,d we want X in A,B
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
655 l1@ equ *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
656 IFEQ Level-1
2941
4446149f7ea9 rb1773: Support 6309 on level 1 as well
Robert Gault <robert.gault@att.net>
parents: 2940
diff changeset
657 IFNE H6309
4446149f7ea9 rb1773: Support 6309 on level 1 as well
Robert Gault <robert.gault@att.net>
parents: 2940
diff changeset
658 ldx #1854/2
4446149f7ea9 rb1773: Support 6309 on level 1 as well
Robert Gault <robert.gault@att.net>
parents: 2940
diff changeset
659 ELSE
4446149f7ea9 rb1773: Support 6309 on level 1 as well
Robert Gault <robert.gault@att.net>
parents: 2940
diff changeset
660 ldx #1482/2 [3] [3]
4446149f7ea9 rb1773: Support 6309 on level 1 as well
Robert Gault <robert.gault@att.net>
parents: 2940
diff changeset
661 ENDC
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
662 ELSE
2941
4446149f7ea9 rb1773: Support 6309 on level 1 as well
Robert Gault <robert.gault@att.net>
parents: 2940
diff changeset
663 IFNE H6309
4446149f7ea9 rb1773: Support 6309 on level 1 as well
Robert Gault <robert.gault@att.net>
parents: 2940
diff changeset
664 ldx #1854 [3] [3]
4446149f7ea9 rb1773: Support 6309 on level 1 as well
Robert Gault <robert.gault@att.net>
parents: 2940
diff changeset
665 ELSE
4446149f7ea9 rb1773: Support 6309 on level 1 as well
Robert Gault <robert.gault@att.net>
parents: 2940
diff changeset
666 ldx #1482 [3] [3]
4446149f7ea9 rb1773: Support 6309 on level 1 as well
Robert Gault <robert.gault@att.net>
parents: 2940
diff changeset
667 ENDC
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
668 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
669 l2@ nop [2] [1]
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
670 nop [2] [1]
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
671 nop [2] [1]
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
672 leax -1,x [4+] [4+]
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
673 bne l2@ [3] [3]
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
674 subd #$0001 [4] [3]
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
675 bne l1@ [3] [3]
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
676 puls d,pc [5+] [4+]
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
677
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
678 * Write
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
679 * Entry:
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
680 * B = MSB of LSN
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
681 * X = LSB of LSN
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
682 * Y = address of path descriptor
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
683 * U = address of device memory area
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
684 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
685 * Exit:
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
686 * CC = carry set on error
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
687 * B = error code
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
688 *
2940
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
689 Write tst flagFMT,u
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
690 bne w3 if a format write normally and clear flags
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
691 tst flagWP,u
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
692 beq w2 continue if not a mismatch
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
693 ldb #E$BTyp
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
694 lbra L03E0 report bad type if forced WP
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
695 w3 clr flagFMT,u
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
696 clr flagWP,u
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
697 w2 lbsr Chk512 go adjust LSN for 512 byte sector if needed
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
698 * Next line was lda #%1001001 which was an error RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
699 lda #%10010001 retry flags for I/O errors (see Disto SCII source)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
700 L01C4 pshs x,d preserve LSN, retries
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
701 bsr L01E8 go write the sector
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
702 puls x,d restore LSN, retries
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
703 bcs L01D8 error writing, go to write retry handler
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
704 tst <PD.VFY,y no error, do we want physical verify?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
705 bne L01D6 no, exit without error
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
706 lbsr verify go re-read & verify 64 out of 256 bytes
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
707 bcs L01D8 error on verify, go to write retry handler
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
708 L01D6 clrb no error & return
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
709 L01D7 rts
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
710
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
711 * Write error retry handler
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
712 L01D8 lsra Shift retry flags
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
713 lbeq L03AF Too many retries, exit with error
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
714 bcc L01C4 Normal retry, attemp to re-write sector
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
715 pshs x,d Preserve flags & sector #
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
716 lbsr sktrk0 Seek to track 0 (attempt to recalibrate)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
717 puls x,d Restore flags & sector #
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
718 bra L01C4 Try re-writing now
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
719
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
720 * 512 byte sector write here
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
721 L01E8 lbsr L02AC Go do double-step/write precomp if needed
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
722 bcs L01D7 Error, exit with it
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
723 pshs y,d Preserve path dsc. ptr & LSN
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
724 * Since I have modified chk512 the next two lines are replaced. RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
725 * lda <PD.TYP,y Get device type
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
726 * anda #%00000100 512 byte sector?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
727 tst flag512,u go if 256 byte sectors
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
728 beq L020D Not 512 then skip ahead
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
729 lbsr L0176 Go read the sector in
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
730 ldd >loglsn,u Get OS9 LSN
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
731 andb #$01 Even or odd?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
732 beq L020D Even, skip ahead
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
733 ldx >sectbuf,u Get physical sector buffer ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
734 leax >$0100,x Point to 2nd half
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
735 bra L0211 Copy caller's buffer to 2nd half of sector
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
736
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
737 L020D ldx >sectbuf,u Get physical sector buffer ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
738
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
739 L0211 ldy PD.BUF,y Get path dsc. buffer ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
740 IFNE H6309
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
741 ldw #256 Copy write buffer to sector buffer
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
742 tfm y+,x+
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
743 ELSE
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
744 clrb
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
745 L0211Lp lda ,y+
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
746 sta ,x+
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
747 decb
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
748 bne L0211Lp
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
749 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
750 puls y,d Get path dsc. ptr & LSN back
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
751 ldx >sectbuf,u Get physical sector buffer ptr again
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
752 * See read routine for explanation of SCII code. RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
753 IFNE SCII
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
754 IFEQ SCIIHACK
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
755 clra SCII write, normal mode & NMI
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
756 tst flag512,u
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
757 bne wr512
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
758 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
759 lda #4 SCII normal mode, masked NMI
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
760 sta RW.Ctrl tell SCII
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
761 pshs y
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
762 ldy #RW.Dat Send data to SCII RAM buffer
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
763 IFNE H6309
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
764 ldw #256
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
765 tst flag512,u
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
766 beq wrbuf
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
767 ldw #512
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
768 wrbuf lda ,x+
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
769 sta ,y
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
770 decw
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
771 bne wrbuf
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
772 ELSE
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
773 ldy #256
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
774 tst flag512,u
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
775 beq wrbuf
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
776 ldy #512
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
777 wrbuf lda ,x+
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
778 sta >RW.DAT
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
779 leay -1,y
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
780 bne wrbuf
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
781 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
782 puls y
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
783 ldb #$A0 Write sector command
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
784 lda #6 SCII masked NMI, buffered mode, write
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
785 * See Read section for explanation of error changes below. RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
786 * lbra L01A1B send command to controller
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
787 lbsr L01A1B send command to controller
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
788 bcs wngood SCII error, then go
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
789 lbra L03AF check for OS-9 errors
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
790 wngood rts
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
791 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
792 wr512 ldb #S$Format
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
793
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
794 * Format track comes here with B=$F0 (write track)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
795 * as does write sector with B=$A0
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
796 *WrTrk pshs y,cc Preserve path dsc. ptr & CC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
797 WrTrk lbsr L01A1 Send command to controller (including delay)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
798 *** Commented out for blobstop fixes
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
799 *L0229 bita >DPort+WD_Stat Controller done yet?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
800 * bne L0240 Yes, go write sector out
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
801 * leay -$01,y No, bump wait counter
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
802 * bne L0229 Still more tries, continue
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
803 * lda >ctlimg,u Get current drive control register settings
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
804 * ora #C_MOTOR Drive motor on (but drive select off)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
805 * sta >DPort+CtrlReg Send to controller
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
806 * puls y,cc Restore regs
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
807 * lbra L03AF Check for errors from status register
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
808
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
809 *** added blobstop
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
810 IFGT Level-1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
811 lda FBlock+1,u get the block number for format
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
812 beq L0230 if not format, don't do anything
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
813 sta >$FFA1 otherwise map the block in
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
814 * added delay for for MMU line settling. RG 2005/1/23
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
815 nop
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
816 nop
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
817 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
818 L0230 stb >DPort+CtrlReg send data to control register
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
819 * These lines converted to separate sector writes from format. RG
2226
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
820 * Removed slow down but left code just in case. RG
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
821 nop
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
822 nop
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
823 * cmpb #$F0 if format, then
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
824 * beq L0240b go to special loop
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
825 bra L0240 wait a bit for HALT to enable
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
826
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
827 * Write sector routine (Entry: B= drive/side select) (NMI will break out)
2226
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
828 * Was part of timing change mentioned above. Removed RG
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
829 L0240 nop --- wait a bit more
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
830 lda ,x+ Get byte from write buffer
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
831 *L0240 lda ,x+ Get byte from write buffer
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
832 sta >DPort+WD_Data Save to FDC's data register
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
833 * EAT 2 CYCLES: TC9 ONLY (TRY 1 CYCLE AND SEE HOW IT WORKS)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
834 IFEQ TC9-1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
835 nop
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
836 nop
2226
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
837 * ELSE
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
838 * See above. RG Now removed.
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
839 * nop
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
840 ENDC
2226
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
841 * No blob change.
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
842 * stb >DPort+CtrlReg Set up to read next byte
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
843 bra L0240 Go read it
2226
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
844 * Special loop for format slows CPU clock. RG Now removed.
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
845 *L0240b
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
846 * IFGT Level-1
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
847 * sta >$FFD8
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
848 * ENDC
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
849 *L0240c lda ,x+
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
850 * sta >DPort+WD_Data
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
851 * bra L0240c
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
852 * NMI routine
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
853 NMISvc leas R$Size,s Eat register stack
2226
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
854 * Added to compensate above change in format loop. RG Now removed.
1790
2330195b098c bootlists updated for disto scii drivers.
boisy
parents: 1785
diff changeset
855 IFGT Level-1
2226
3af8e9655158 The clock slow down routine for rb1773 write track has been deactivated. The code is still present in case it needs to be reinstated. RG
robertgault
parents: 2194
diff changeset
856 * sta >$FFD9
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
857 ldx <D.SysDAT get pointer to system DAT image
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
858 lda 3,x get block number 1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
859 sta >$FFA1 map it back into memory
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
860 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
861 andcc #^IntMasks turn IRQ's on again
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
862 ldb >DPort+WD_Stat Get status register
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
863 IFNE SCII
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
864 clr RW.Ctrl Clear SCII command register
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
865 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
866 bitb #%00000100 Did we lose data in the transfer?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
867 lbeq L03B2 Otherwise, check for drive errors
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
868 comb -- blobstop error code
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
869 ldb #E$DevBsy -- device busy
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
870 rts -- and exit
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
871
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
872 verify pshs x,d
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
873 * Removed unneeded code. Data never sent to PD.BUF anyway so there is
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
874 * no need to redirect the PD.BUF pointer. RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
875 * ldx PD.BUF,y Get write buffer ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
876 * pshs x Preserve it
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
877 * ldx >sectbuf,u Get sector buffer ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
878 * stx PD.BUF,y Save as write buffer ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
879 * ldx 4,s
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
880 lbsr ReadSector Go read sector we just wrote
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
881 * puls x Get original write buffer ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
882 * stx PD.BUF,y Restore path dsc. version
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
883 bcs L02A3 If error reading, exit with it
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
884 ldx PD.BUF,y Get system buffer ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
885 pshs u,y Preserve device mem, path dsc. ptrs
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
886 * See change in chk512 routine. RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
887 * ldb <PD.TYP,y Get type from path dsc.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
888 ldy >sectbuf,u Get sector buffer ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
889 * andb #%00000100 512 byte sector?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
890 tst flag512,u 512 byte sector?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
891 beq L028D No, skip ahead
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
892 ldd >loglsn,u Get OS9's sector #
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
893 andb #$01 Odd/even sector?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
894 beq L028D Even; compare first half
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
895 leay >$0100,y Odd, compare second half
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
896 L028D tfr x,u Move PD.BUF ptr to U (since cmpx is faster)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
897 clra check all 256 bytes
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
898 L028F ldx ,u++ Get 2 bytes from original write buffer
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
899 cmpx ,y++ Same as corresponding bytes in re-read sector?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
900 bne vfybad No, error & return
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
901 inca
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
902 bpl L028F No, continue
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
903 bra L02A1 carry is clear by virtue of last cmpx
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
904 vfybad comb set carry
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
905 L02A1 puls u,y
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
906 L02A3 puls pc,x,d
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
907
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
908 L02A5 pshs a Save Caller's track #
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
909 ldb <V.TRAK,x Get track # drive is currently on
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
910 bra L02E9 Go save it to controller & continue
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
911
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
912 L02AC lbsr L0376 Go set up controller for drive, spin motor up
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
913 bsr L032B Get track/sector # (A=Trk, B=Sector)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
914 pshs a Save track #
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
915 lda >currside,u Get side 1/2 flag
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
916 beq L02C4 Side 1, skip ahead
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
917 lda >ctlimg,u Get control register settings
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
918 ora #C_SIDSEL Set side 2 (drive 3) select
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
919 sta >ctlimg,u Save it back
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
920 L02C4 lda <PD.TYP,y Get drive type settings
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
921 bita #%00000010 ??? (Base 0/1 for sector #?)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
922 bne L02CC Skip ahead
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
923 incb Bump sector # up by 1
2940
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
924 *!!!!!!!!!!!!!!!!!!!!!critical section on double-stepping
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
925 L02CC stb >DPort+WD_Sect Save into Sector register
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
926 ldx >lastdrv,u Get last drive table accessed
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
927 ldb <V.TRAK,x Get current track # on device
2940
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
928 lda <PD.TYP,y Get drive type
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
929 bita #1 3.5" drive
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
930 beq L02CCb go if not 3.5" RG
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
931 lda ,s recover track #
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
932 clr flagWP,u
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
933 bra L02E9
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
934 L02CCb lda <DD.FMT,x Get drive format specs; actually disk format specs RG
2939
011a5f26e9da rb1773: Fix comments about 135 TPI versus 48 or 96
Robert Gault <robert.gault@att.net>
parents: 2938
diff changeset
935 lsra Shift track & bit densities to match PD; bit0 is MF or MFM
011a5f26e9da rb1773: Fix comments about 135 TPI versus 48 or 96
Robert Gault <robert.gault@att.net>
parents: 2938
diff changeset
936 eora <PD.DNS,y Check for differences with path densities; bit0 is MF MFM, bit1 is 96tpi
011a5f26e9da rb1773: Fix comments about 135 TPI versus 48 or 96
Robert Gault <robert.gault@att.net>
parents: 2938
diff changeset
937 anda #%00000010 Keep only 96 tpi
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
938 pshs a Save differences
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
939 lda 1,s Get track # back
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
940 tst ,s+ Are tpi's different?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
941 beq L02E9 No, continue normally
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
942 lsla Yes, multiply track # by 2 ('double-step')
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
943 lslb Multiply current track # by 2 ('double-step')
2940
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
944 clr flagWP,u
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
945 inc flagWP,u if double-step then prevent future writes
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
946 L02E9 stb >DPort+WD_Trak Save current track # onto controller
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
947
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
948 * From here to the line before L0307 is for write precomp, but is not used.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
949 * Unless write precomp is needed, all of this is useless
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
950 * I think most (if not all) drives do NOT need precomp
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
951 IFEQ PRECOMP-1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
952 ldb #21 Pre-comp track #
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
953 pshs b Save it
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
954 ldb <PD.DNS,y Get current density settings
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
955 andb #%00000010 Just want to check track density
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
956 beq L02F9 48 tpi, skip ahead
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
957 lsl ,s Multiply pre-comp value by 2 ('double-step')
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
958 L02F9 cmpa ,s+ Is track # high enough to warrant precomp?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
959 bls L0307 No, continue normally
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
960 ldb >ctlimg,u
2938
c91cd2a9b22a rb1773: Fix typo in write precompensation code
Robert Gault <robert.gault@att.net>
parents: 2226
diff changeset
961 orb #C_WPRCMP Turn on Write precomp
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
962 stb >ctlimg,u
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
963 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
964
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
965 L0307 tst >u00AA,u ??? Get flag (same drive flag?)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
966 bne L0314 no, skip ahead
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
967 ldb ,s get track #
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
968 cmpb <V.TRAK,x same as current track on this drive?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
969 beq L0321 yes, skip ahead
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
970 L0314 sta >DPort+WD_Data save track # to data register
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
971 ldb <PD.STP,y get stepping rate
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
972 andb #%00000011 just keep usable settings (6-30 ms)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
973 eorb #%00011011 set proper bits for controller
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
974 lbsr L03E4 send command to controller & time delay
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
975 L0321 puls a get track # back
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
976 sta <V.TRAK,x save as current track #
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
977 sta >DPort+WD_Trak save to controller
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
978 clrb no error & return
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
979 rts
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
980
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
981 * Entry: B:X LSN
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
982 * Exit: A=Track #
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
983 * B=Sector #
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
984 * <currside=00 = Head 1 , $FF = Head 2
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
985 L032B tstb Sector # > 65535?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
986 bne L033F Yes, illegal for floppy
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
987 tfr x,d Move sector # to D
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
988 leax ,x LSN 0? ie. "tstx"
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
989 beq L0371 Yes, exit this routine
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
990 ldx >lastdrv,u Get previous drive table ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
991 cmpd DD.TOT+1,x Within range of drive spec?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
992 blo L0343 Yes, go calculate track/sector #'s
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
993 L033F comb Exit with Bad sector # error
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
994 ldb #E$Sect
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
995 rts
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
996
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
997 * Calculate track/sector #'s?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
998 * These two sections could be combined into one with a final
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
999 * test of DD.FMT. Then currside can be set and regA can be lsra
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1000 * as needed. RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1001 L0343 stb >u00AE,u Save LSB of LSN
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1002 clr ,-s Clear track # on stack
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1003 ldb <DD.FMT,x Get drive format
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1004 lsrb Shift out # sides into carry
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1005 ldb >u00AE,u Get LSB of LSN again
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1006 bcc L0367 Single sided drive, skip ahead
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1007 bra L035D Double sided drive, skip ahead
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1008 * Double sided drive handling here
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1009 L0355 com >currside,u Odd/even sector track flag
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1010 bne L035D Odd, so don't bump track # up
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1011 inc ,s Bump up track #
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1012
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1013 * Changed this to more effient code. RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1014 *L035D subb DD.TKS,x Subtract # sectors/track
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1015 * sbca #$00
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1016 L035D subd DD.SPT,x
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1017 bcc L0355 Still more sectors left, continue
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1018 bra L036D Wrapped, skip ahead
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1019 * Single sided drive handling here
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1020 L0365 inc ,s Bump track # up
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1021
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1022 * See above. RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1023 *L0367 subb DD.TKS,x Subtract # sectors/track
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1024 * sbca #$00
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1025 L0367 subd DD.SPT,x
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1026 bcc L0365 Still more, go bump the track up
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1027 * Next possible because upper limit is 256 sectors/track. RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1028 L036D addb DD.TKS,x Bump sector # back up from negative value
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1029 puls a Get the track #
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1030 L0371 rts A=track #, B=Sector #, <currside=Odd
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1031
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1032 * Drive control register bit mask table
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1033 * May want an option here for double sided SDDD disks ex. RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1034 * fcb $1 drive0
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1035 * fcb $2 drive1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1036 * fcb $41 drive2
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1037 * fcb $42 drive3
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1038 * fcb $4 drive4
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1039 * fcb $44 drive5
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1040
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1041 L0372 fcb $01 Drive 0
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1042 fcb $02 Drive 1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1043 fcb $04 Drive 2
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1044 fcb $40 Drive 3 / Side select
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1045
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1046 * Changes regD; X,Y,U preserved
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1047 L0376 clr >u00AA,u clear drive change flag
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1048 chkdrv lda <PD.DRV,y Get drive # requested
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1049 * It is possible to have more than 4 drive # so the change below. RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1050 * cmpa #4 Drive 0-3?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1051 cmpa #N.Drives Drive 0-6 if alternate table used?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1052 blo L0385 Yes, continue normally
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1053 NoHW comb Illegal drive # error
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1054 ldb #E$Unit
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1055 rts
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1056
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1057 * Entry: A=drive #, X=LSN (Physical, not OS9 logical if PCDOS disk)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1058 L0385 pshs x,d Save sector #, drive # & B???
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1059 leax >L0372,pc Point to drive bit mask table
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1060 ldb a,x Get bit mask for drive # we want
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1061 stb >ctlimg,u Save mask
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1062 leax DRVBEG,u Point to beginning of drive tables
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1063 ldb #DRVMEM Get size of each drive table
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1064 mul Calculate offset to drive table we want
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1065 leax d,x Point to it
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1066 cmpx >lastdrv,u Same as Last drive table accessed?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1067 beq L03A6 Yes, skip ahead
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1068 stx >lastdrv,u Save new drive table ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1069 com >u00AA,u Set drive change flag
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1070 L03A6 clr >currside,u Set side (head) flag to side 1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1071 lbsr L04B3 Go set up VIRQ to wait for drive motor
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1072 puls pc,x,d Restore sector #,drive #,B & return
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1073
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1074 L03AF ldb >DPort+WD_Stat Get status register from FDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1075 * This line needed when returning to Disk Basic but probably
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1076 * not needed for OS-9. RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1077 IFNE SCII
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1078 clr RW.Ctrl return SCII to halt mode
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1079 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1080 L03B2 bitb #%11111000 any of the error bits set?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1081 beq L03CA No, exit without error
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1082 aslb Drive not ready?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1083 bcs L03CC Yes, use that error code
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1084 aslb Write protect error?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1085 bcs L03D0 Yes, use that error code
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1086 aslb Write fault error?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1087 bcs L03D4 Yes, use that error code
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1088 aslb Sector not found?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1089 bcs L03D8 Yes, use Seek error code
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1090 aslb CRC error?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1091 bcs L03DC Yes, use that error code
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1092 L03CA clrb No error & return
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1093 rts
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1094
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1095 L03CC ldb #E$NotRdy not ready
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1096 fcb $8C skip 2 bytes
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1097
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1098 L03D0 ldb #E$WP write protect
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1099 fcb $8C skip 2 bytes
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1100
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1101 L03D4 ldb #E$Write write error
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1102 fcb $8C
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1103
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1104 L03D8 ldb #E$Seek seek error
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1105 fcb $8C
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1106
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1107 L03DC ldb #E$CRC CRC error
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1108 * fcb $8C
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1109
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1110 *L03E0 ldb #E$Read Read error
2940
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
1111 L03E0 orcc #Carry set carry
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1112 rts
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1113
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1114 L03E4 bsr L0404 Send command to controller & waste some time
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1115 L03E6 ldb >DPort+WD_Stat Check FDC status register
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1116 bitb #$01 Is controller still busy?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1117 beq L0403 No, exit
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1118 ldd >VIRQCnt,pc Get initial count value for drive motor speed
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1119 std >VIRQPak,u Save it
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1120 * Again, I'm trying to match Kevin Darling code. It may not be needed. RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1121 pshs x
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1122 ldx #1 Sleep remainder of slice
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1123 lbsr Delay
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1124 puls x
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1125 bra L03E6 Wait for controller to finish previous command
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1126
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1127 * Send command to FDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1128 L03F7 lda #C_MOTOR
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1129 * lda #%00001000 Mask in Drive motor on bit
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1130 ora >ctlimg,u Merge in drive/side selects
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1131 sta >DPort+CtrlReg Turn the drive motor on & select drive
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1132 stb >DPort+WD_Cmd Save command & return
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1133 L0403 rts
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1134
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1135 L0404 bsr L03F7 Go send command to controller
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1136
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1137 * This loop has been changed from nested LBSRs to timing loop.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1138 * People with crystal upgrades should modify the loop counter
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1139 * to get a 58+ us delay time. MINIMUM 58us.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1140 FDCDelay
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1141 pshs a 14 cycles, plus 3*loop counter
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1142 IFEQ Level-1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1143 lda #18 (only do about a 100 cycle delay for now)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1144 ELSE
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1145 lda #29 (only do about a 100 cycle delay for now)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1146 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1147 L0409 deca for total ~63 us delay (123 cycles max.)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1148 bne L0409
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1149 puls a,pc restore register and exit
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1150
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1151 * SetStat
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1152 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1153 * Entry:
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1154 * A = function code
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1155 * Y = address of path descriptor
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1156 * U = address of device memory area
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1157 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1158 * Exit:
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1159 * CC = carry set on error
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1160 * B = error code
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1161 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1162 SetStat ldx PD.RGS,y Get caller's register stack ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1163 ldb R$B,x Get function code
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1164 cmpb #SS.WTrk Write track?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1165 beq SSWTrk Yes, go do it
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1166 cmpb #SS.Reset Restore head to track 0?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1167 lbeq sktrk0 Yes, go do it --- beq
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1168 comb set carry for error
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1169 ldb #E$UnkSvc return illegal service request error
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1170 rts
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1171
2940
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
1172 SSWTrk stb flagFMT,u permit unconditional write on format
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
1173 clr flagWP,u don't protect on a format
824019cd8744 rb1773: Make 48 TPI floppy disks readonly in 96 TPI drives
Robert Gault <robert.gault@att.net>
parents: 2939
diff changeset
1174 pshs u,y preserve register stack & descriptor
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1175
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1176 * Level 2 Code
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1177 IFGT Level-1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1178
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1179 *--- new code
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1180 ldb #1 1 block to allocate
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1181 os9 F$AllRAM allocate some RAM
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1182 lbcs L0489 error out if at all
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1183 leax >FBlock,u point to 'my' DAT image
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1184 std ,x save a copy of the block
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1185 os9 F$ResTsk reserve a task number for the copy
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1186 bcs FError error out
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1187 stb 2,x save temporary task number in FTask,u
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1188 lslb 2 bytes per entry
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1189 ldu <D.TskIPt get task image table pointer
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1190 stx b,u save pointer to the task's DAT image
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1191 lsrb get the right number again
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1192 IFNE H6309
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1193 tfr 0,u destination is address 0
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1194 ELSE
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1195 ldu #$0000
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1196 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1197 *--- end new code
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1198
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1199 ldx 2,s get pointer to descriptor
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1200 * stu >FBlock,x
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1201 ldx <D.Proc Get current process ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1202 lda P$Task,x Get task # for current process
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1203 * ldb <D.SysTsk Get system task #
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1204 ldy ,s
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1205 ldx PD.RGS,y Get register stack ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1206 ldx R$X,x Get ptr to caller's track buffer
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1207 ldy #$1A00 Size of track buffer
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1208 os9 F$Move Copy from caller to temporary task
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1209 bcs L0479 Error copying, exit
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1210 puls u,y
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1211 pshs u,y
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1212
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1213 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1214 * End of Level 2 Code
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1215
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1216 lbsr L0376 Go check drive #/wait for it to spin up
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1217 ldx PD.RGS,y Get caller's register stack ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1218 ldb R$Y+1,x Get caller's side/density
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1219 bitb #$01 Check side
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1220 beq L0465 Side 1, skip ahead
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1221 * I think this next line is not needed. RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1222 com >currside,u * Why? This is normally used with
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1223 * calculate track. RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1224 ldb >ctlimg,u Get current control register settings
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1225 * orb #%01000000 Mask in side 2
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1226 orb #C_SIDSEL Mask in side 2
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1227 stb >ctlimg,u Save updated control register
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1228 L0465 lda R$U+1,x Get caller's track #
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1229 ldx >lastdrv,u Get current drive table ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1230 lbsr L02A5
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1231 bcs L0489
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1232 ldb #$F0 Write track command
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1233 *---
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1234 IFEQ Level-1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1235 ldx PD.RGS,y
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1236 ldx R$X,x
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1237 ELSE
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1238 ldx #$2000 start writing from block 1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1239 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1240
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1241 IFNE SCII
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1242 lda #1 normal unbuffered write
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1243 * Next line prevents WrTrk from switching to SCII buffered mode. RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1244 sta flagform,u
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1245 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1246 lbsr WrTrk Go write the track
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1247 IFNE SCII
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1248 clr flagform,u permit no-halt mode RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1249 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1250
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1251 IFGT Level-1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1252 L0479 ldu 2,s
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1253 pshs b,cc Preserve error
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1254 ldb >FTask,u point to task
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1255 os9 F$RelTsk release the task
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1256 fcb $8C skip 2 bytes
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1257
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1258 * format comes here when block allocation passes, but task allocation
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1259 * gives error. So er de-allocate the block.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1260 FError
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1261 pshs b,cc save error code, cc
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1262 ldx >FBlock,u point to block
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1263 ldb #1 1 block to return
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1264 os9 F$DelRAM de-allocate image RAM blocks
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1265 clr FBlock+1,u ensure that the block # in FBlock is zero.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1266 puls b,cc Restore error
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1267 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1268
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1269 L0489 puls pc,u,y Restore regs & return
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1270
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1271 * seek the head to track 0
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1272 sktrk0 lbsr chkdrv
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1273 ldx >lastdrv,u
2194
8a96f5241556 *** empty log message ***
boisy
parents: 1807
diff changeset
1274 clr <V.TRAK,x
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1275 lda #1 was 5 but that causes head banging
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1276 L0497 ldb <PD.STP,y
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1277 andb #%00000011 Just keep usable settings (6-30 ms)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1278 eorb #%01001011 Set proper bits for controller
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1279 pshs a
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1280 lbsr L03E4
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1281 puls a
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1282 deca
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1283 bne L0497
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1284 ldb <PD.STP,y
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1285 andb #%00000011 Just keep usable settings (6-30 ms)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1286 eorb #%00001011 Set proper bits for controller
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1287 lbra L03E4
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1288
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1289 L04B3 pshs y,x,d Preserve regs
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1290 ldd >VIRQCnt,pc Get VIRQ initial count value
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1291 std >VIRQPak,u Save it
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1292 lda >ctlimg,u ?Get drive?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1293 ora #C_MOTOR Turn drive motor on for that drive
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1294 * ora #%00001000 Turn drive motor on for that drive
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1295 sta >DPort+CtrlReg Send drive motor on command to FDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1296 IFEQ Level-1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1297 lda >D.DskTmr Get VIRQ flag
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1298 ELSE
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1299 lda <D.MotOn Get VIRQ flag
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1300 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1301 bmi L04DE Not installed yet, try installing it
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1302 bne L04E0 Drive already up to speed, exit without error
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1303
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1304 * Drive motor speed timing loop (could be F$Sleep call now) (was over .5 sec)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1305 * 32 was not sufficient for one of my drives. RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1306 ldx #50 wait for 32 ticks; increased it RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1307 lbsr Delay
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1308
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1309 L04DE bsr InsVIRQ Install VIRQ to wait for drive motors
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1310 L04E0 clrb No error & return
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1311 puls pc,y,x,d
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1312
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1313 InsVIRQ lda #$01 Flag drive motor is up to speed
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1314 IFEQ Level-1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1315 sta >D.DskTmr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1316 ELSE
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1317 sta <D.MotOn
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1318 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1319 ldx #$0001 Install VIRQ entry
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1320 leay >VIRQPak,u Point to packet
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1321 clr Vi.Stat,y Reset Status byte
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1322 ldd >VIRQCnt,pc Get initial VIRQ count value
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1323 os9 F$VIRQ Install VIRQ
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1324 bcc VIRQOut No error, exit
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1325 lda #$80 Flag that VIRQ wasn't installed
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1326 IFEQ Level-1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1327 sta >D.DskTmr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1328 ELSE
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1329 sta <D.MotOn
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1330 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1331 VIRQOut clra
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1332 rts
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1333
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1334 * IRQ service routine for VIRQ (drive motor time)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1335 * Entry: U=Ptr to VIRQ memory area
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1336 IRQSvc pshs a
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1337 lda <D.DMAReq
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1338 beq L0509
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1339 bsr InsVIRQ
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1340 bra IRQOut
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1341 L0509 sta >DPort+CtrlReg
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1342 * I changed this to a clear. Don't see the point of an AND. RG
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1343 * IFNE H6309
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1344 * aim #$FE,>u00B5,u
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1345 * ELSE
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1346 * lda u00B5,u
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1347 * anda #$FE
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1348 * sta u00B5,u
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1349 * ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1350 * fdb u00B5 --- so changes in data size won't affect anything
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1351 clr u00B5,u
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1352 IFEQ Level-1
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1353 clr >D.DskTmr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1354 ELSE
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1355 clr <D.MotOn
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1356 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1357 IRQOut puls pc,a
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1358
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1359 * Non-OS9 formatted floppies need a drive table entry constructed
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1360 * by hand since there is no RBF LSN0.
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1361 *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1362 * Entry: X=LSN
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1363 * Y=Path dsc. ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1364 * U=Device mem ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1365 MakeDTEntry
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1366 pshs x Preserve Logical sector #
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1367 ldx >lastdrv,u Get last drive table accessed ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1368 clra
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1369 pshs x,a Save ptr & NUL byte
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1370 IFNE H6309
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1371 ldw #20 Clear 20 bytes
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1372 tfm s,x+
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1373 ELSE
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1374 ldb #20
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1375 L051ALp clr ,x+
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1376 decb
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1377 bne L051ALp
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1378 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1379 puls x,a Eat NUL & get back drive table ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1380 ldb <PD.CYL+1,y Get # cylinders on drive (ignores high byte)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1381 lda <PD.SID,y Get # sides
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1382 mul Calculate # tracks on drive (1 per head)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1383 IFNE H6309
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1384 decd Adjust to ignore track 0
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1385 ELSE
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1386 subd #$0001
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1387 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1388 lda <PD.SCT+1,y Get # sectors/track
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1389 sta DD.TKS,x Save in drive table
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1390 sta <DD.SPT+1,x Save in other copy in drive table
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1391 mul Calculate # sectors on drive (minus track 0)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1392 pshs x Preserve drive table ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1393 tfr d,x Move # sectors on drive to X
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1394 lda <PD.T0S+1,y Get # sectors on track 0
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1395 leax a,x Add that many sectors to total
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1396 lda <PD.TYP,y Get device type settings
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1397 anda #%00000100 Mask out all but 512 byte sector flag
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1398 beq L0550 Not 512 byte sector, skip ahead
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1399 IFNE H6309
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1400 addr x,x Multiply by 2 (convert to 256 byte OS9 sectors)
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1401 ELSE
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1402 tfr x,d
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1403 leax d,x
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1404 ENDC
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1405 L0550 tfr x,d Move # sectors to D
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1406 puls x Get back drive table ptr
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1407 std DD.TOT+1,x Save # sectors allowed on drive
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1408 lda #UPDAT.+EXEC. Owner's read/write/exec attributes
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1409 sta DD.ATT,x Set attributes for disk
2939
011a5f26e9da rb1773: Fix comments about 135 TPI versus 48 or 96
Robert Gault <robert.gault@att.net>
parents: 2938
diff changeset
1410 lda <PD.DNS,y Get density settings this should be bit1 96tpi bit0 MF MFM normally is 1
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1411 lsla Shift for DD.FMT
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1412 pshs a Preserve it a sec
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1413 lda <PD.SID,y Get # sides
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1414 deca Adjust to base 0
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1415 ora ,s+ Merge with density settings
2939
011a5f26e9da rb1773: Fix comments about 135 TPI versus 48 or 96
Robert Gault <robert.gault@att.net>
parents: 2938
diff changeset
1416 sta <DD.FMT,x Save in device table; normally becomes %11 or 3
1746
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1417 clrb No error?
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1418 puls pc,x Restore original LSN & return
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1419
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1420 emod
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1421 eom equ *
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1422 end
5469aad825d7 *** empty log message ***
robert
parents: 1737
diff changeset
1423