Mercurial > hg > Members > kono > nitros9-code
annotate 3rdparty/drivers/ide/ccide.asm @ 749:ec1909ff0764
Updated Makefile
author | boisy |
---|---|
date | Wed, 08 Jan 2003 05:09:53 +0000 |
parents | 16dc49e3a104 |
children | d26a93134e57 |
rev | line source |
---|---|
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1 * NOTE: Currently, will return RAW error #'s from drive (see ATA bit flags |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
2 * in error register). After driver finalized, switch back to OS9 error |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
3 * codes. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
4 * NOTE 2: drvrbusy checks are done even before hardware access, because |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
5 * some variables are shared in the driver memory, and if a 2nd request |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
6 * comes in in the middle of it, the vars might be changed at a dangerous |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
7 * time. Note if you have two IDE controllers: since they get separate driver |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
8 * memory from each other, that both controllers CAN be active at the same |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
9 * time. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
10 * BIG NOTE ON OLDER ATA-1 DRIVES!!! |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
11 * SOME DRIVES (MY MINISCRIBE 8051A INCLUDED) HAVE A TRANSLATION MODE THAT |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
12 * _IS_BUILT_INTO_THE_IDE_ROM_ITSELF! THE BAD PART IS, THE "IDENTIFY DRIVE" |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
13 * COMMAND _DOES_NOT_ TAKE THIS INTO CONSIDERATION, BUT RETURNS THE "NATIVE" |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
14 * DRIVE SPECS FOR CYLINDERS, HEADS & SECTORS PER TRACK. TO GET THE FULL |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
15 * CAPACITY OF THE DRIVE, WITHOUT ERRORS, YOU _MUST_ SET YOUR DEVICE |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
16 * DESCRIPTOR BASED ON THE HARDWARE _TRANSLATED_ SETTINGS, _NOT_ THE _NATIVE_ |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
17 * SETTINGS (DESCRIBED IN THE IDENTIFY DRIVE COMMAND)! AS A REAL WORLD |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
18 * EXAMPLE, ON MY MINISCRIBE 8051A: |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
19 * Drives "Native" mode (as well as the Identify Drive command) returns: |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
20 * 745 cylinders, 4 heads & 28 sectors/cylinder. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
21 * HOWEVER, the "Translation" mode (which is checked off on the sticker on |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
22 * the drive itself from the manufacturer), says: |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
23 * Translated: 5 heads, 17 sectors. At this point, you will have to figure |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
24 * out the # of cylinders, by computing the # of sectors TOTAL for the |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
25 * drive in it's native mode (745*4*28 in the above example, or 83,440 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
26 * sectors), and then dividing that value by (# of sectors/track * # of |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
27 * heads) in the translation mode, and rounding down. In the above case, |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
28 * 83,440/(5*17)=981.647, so use 981 (which in hex is $03d5). |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
29 * Therefore, the proper device descriptor for this drive is: |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
30 * cyl=3d5 sid=5 sct=22 t0s=22 (Actually, t0s is ignored by CCIDE) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
31 * The sct=22 is because the value is hexidecimal (it means 34 sectors/ |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
32 * track), and is double the 17 I mentioned above because OS9 sectors are |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
33 * half the size of IDE sectors (256 bytes vs. 512 bytes). If this drive |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
34 * had been shipped in "Native" mode, it would use the following: |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
35 * cyl=2E9 sid=4 sct=38 t0s=38, which is what the IDENTIFY DRIVE command |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
36 * reports. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
37 * You can verify the highest cylinder # by setting the OFS in the descriptor |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
38 * to what you think is the highest cylinder # (total # of cylinders-1 ... |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
39 * remember that CHS cylinder numbers start at 0!), and then try to read |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
40 * enough sectors to cover the whole track. If you go one past that value, |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
41 * you should start getting errors if you have the right cylinder count. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
42 * This is kind of a dumb system, but I assume it had something to do with |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
43 * IBM PC BIOS in the early days of IDE. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
44 *A LITTLE LATER, WHEN THE DRIVER IS STABLE, MAY WANT TO ADD ANOTHER BIT FLAG |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
45 * TO DRIVEFLG, SET UP BY A FIRST TIME READ: 8 BIT ACCEPTED. THEN, USE THE 8 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
46 * BIT TRANSFER MODE IF POSSIBLE (LIKE I DID WITH LBA). THIS SHOULD ALLOW |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
47 * MUCH FASTER SECTOR ACCESS ON A NITROS9 SYSTEM, AND IT WOULD BE INTERESTING |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
48 * TO SEE HOW MANY DRIVES ACCEPT THAT MODE (SUPPOSED TO RETURN AN 'ABORTED' |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
49 * FLAG IF IT DOES NOT). |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
50 * NOTE: RBF WILL ASSIGN NEW DEVICE MEM (,U PTR) TO _EACH_ CONTROLLER ON IT'S |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
51 * OWN, BASED ON THE BASE ADDRESS FROM THE DEVICE DESCRIPTOR. THEREFORE, |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
52 * CCIDE SHOULD BE SET UP FOR _2_ DRIVES MAX (PER CONTROLLER), AND LET RBF |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
53 * TAKE CARE OF MULTIPLE CONTROLLERS. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
54 * The exception to this is when using partitions; since they will have a |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
55 * separate descriptor for each partition, they will need a separate drive |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
56 * table entry. Each table entry is $26 (38) bytes each, so it is not a lot. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
57 * Should make the device table fill up the rest of a 256 byte page (with |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
58 * all other variables allocated), since OS9 will force System RAM pages to |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
59 * even multiples of 256 anyways. Once full 8k block caching is implemented, |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
60 * some of the two 256 byte sector buffers currently in system RAM could be |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
61 * reused for more drive table entries as well. With current system RAM |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
62 * requirements in driver, this would allow 5 device table entries without |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
63 * taking any more system RAM then it is already. These can be shared in |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
64 * whatever combination you need for your (up to) 2 physical drives. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
65 * ALSO, RBF CALLS THE INIT ROUTINE ONLY ONCE PER _DRIVER_, NOT DRIVE! |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
66 ******************************************************************** |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
67 * DO NOT FORGET TO SET H6309 FLAG IN DEFSFILE APPROPRIATELY FOR 6809 VS. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
68 * 6309 CODE WHEN ASSEMBLING!! |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
69 * CCIDE - IDE device driver for CoCo |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
70 * |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
71 * $Id$ |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
72 * |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
73 * Driver originally from Jim Hathaway, originally 8-bit only |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
74 * Converted to 16 bit by Alan DeKok |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
75 * Disassembled (OK, so I didn't have the source version at first!) |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
76 * by Eddie Kuns, ATA specs followed carefully and sector buffering |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
77 * on writes handled more carefully |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
78 * This driver uses 16-bit transfers *only* |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
79 * Check with Glenside - can we switch to 16 bit only, so there is less to |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
80 * maintain? With the cacheing stuff, the speed is fairly decent, although |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
81 * some 6309 optomizations are still possible (cache copies, drive table |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
82 * copies, hardware divide for CHS translation, etc.) |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
83 * |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
84 * Ed. Comments Who YY/MM/DD |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
85 * ------------------------------------------------------------------ |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
86 * 5 Source as distributed by Glenside 99/05/02 |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
87 * Added comments from 8 bit driver BGP 99/05/07 |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
88 * 6 Driver now gets address from descriptor, made BGP 99/05/10 |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
89 * minor optimizations, added symbols |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
90 * 7 Change to use real 16 bits LCB 99/09/06 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
91 * partitions (both LBA & CHS) to 99/10/31 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
92 * better error reporting |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
93 * slightly optomized read |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
94 * Half sector & LSN0 caches for current drive |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
95 * Auto-sense/run LBA & CHS modes |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
96 * Full CHS calculations (up to 4096 cylinders) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
97 * for ATA-1 old drive compatibility |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
98 * 8 Attempted to add support for removable media LCB 00/05/27 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
99 * commands (Door Lock/Unlock, Acknowledge Media to 00/??/?? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
100 * Change) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
101 * Attempt 'generic' ATA command system call |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
102 * Constants - change if needed |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
103 * NUMDRIVE is LOGICAL drives (partitions), NOT physical drives-use 5,11,etc |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
104 * 5=768 byte data area, 11=1024 byte data area |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
105 NUMDRIVE equ 11 Max. # of device descriptors per controller address |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
106 MAXWAIT equ 60*5 Max. # clock ticks to give up on read/write (5 sec) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
107 HDSclPwr equ 2048 Set to 2048 as start ^2 cylinder (CHS translate) |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
108 |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
109 * New definitions in Device Descriptor |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
110 PartOfs equ $26 2 byte partition offset |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
111 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
112 * Definitions for DD.DNS |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
113 PhysDriv equ %00000001 Physical drive # (0=Master, 1=Slave) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
114 ForceCHS equ %00000010 Force driver to use CHS mode |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
115 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
116 * New GetStat/SetStat calls: |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
117 * SS.DrInf call shares call # with SS.ScInf from NitrOS9 WindInt (info) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
118 SS.DrInf equ $8f Drive info call (see routine for parms) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
119 * Subcall #'s fro SS.DrInf (Y register on entry) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
120 ATAIdent equ 0 ATA (handles ATAPI & plain ATA) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
121 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
122 * IDE & ATAPI Commands (ATAPI stuff not implemented yet, and LBA is mandatory) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
123 ReadRtry equ $20 Read sector with retry |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
124 WritRtry equ $30 Write sector with retry |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
125 Diagnost equ $90 Execute drive diagnostic |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
126 Identify equ $EC Identify drive command |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
127 DoorLock equ $DE Lock drive |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
128 DoorUnLk equ $DF Unlock (eject) drive |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
129 AckMdChg equ $DB Acknowledge media change |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
130 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
131 PIIdent equ $A1 Identify ATAPI drive command |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
132 |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
133 * IDE Status Register |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
134 Busy equ %10000000 Drive busy (1=busy) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
135 DrvReady equ %01000000 Drive ready (1=ready to accept command) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
136 WriteFlt equ %00100000 Drive Write Fault (1=Write fault?) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
137 SeekDone equ %00010000 Seek Complete (1=Seek complete) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
138 DataReq equ %00001000 Data Request (1=drive ready for read/write data) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
139 CorrData equ %00000100 Corrected Data (1=correctable data error was done) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
140 Index equ %00000010 1=1 disk revolution completed |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
141 ErrorFnd equ %00000001 1=Error detected - see error register |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
142 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
143 * IDE hardware offsets |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
144 DataReg equ 0 Data (1st 8 bits, non-latched) |
613
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
145 IFNE SuperIDE |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
146 Latch equ 1 Latch (2nd 8 bits of 16 bit word) |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
147 Error equ 2 Error # when read |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
148 Features equ 2 Features when write |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
149 SectCnt equ 3 Sector count |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
150 SectNum equ 4 Sector # |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
151 CylLow equ 5 Low byte of cylinder |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
152 CylHigh equ 6 High byte of cylinder |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
153 DevHead equ 7 Device/Head |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
154 Status equ 8 Status when read |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
155 Command equ 8 Command when write |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
156 ELSE |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
157 Error equ 1 Error # when read |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
158 Features equ 1 Features when write |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
159 SectCnt equ 2 Sector count |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
160 SectNum equ 3 Sector # |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
161 CylLow equ 4 Low byte of cylinder |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
162 CylHigh equ 5 High byte of cylinder |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
163 DevHead equ 6 Device/Head |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
164 Status equ 7 Status when read |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
165 Command equ 7 Command when write |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
166 Latch equ 8 Latch (2nd 8 bits of 16 bit word) |
613
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
167 ENDC |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
168 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
169 * Special flags (Mini extra drive table - 1 byte per drive) - starts at |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
170 * DriveFlg,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
171 * These are set by inquiring the drive, NOT from the descriptor |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
172 * Should add a GETSTAT to allow user to access these for any drive |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
173 Unused equ %10000000 Entry is un-initialized |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
174 DrvMode equ %00000001 0=CHS mode, 1=LBA mode |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
175 ATAPI equ %00000010 0=Device is ATA,1=Device is ATAPI |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
176 Remove equ %00000100 0=Fixed Drive, 1=Removable media |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
177 ReadOnly equ %00001000 0=Read & write allowed, 1=Read only (CD-ROM) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
178 * Could also use to write-protect hard drive |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
179 nam CCIDE |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
180 ttl IDE device driver for CoCo |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
181 |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
182 ifp1 |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
183 use defsfile |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
184 endc |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
185 |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
186 tylg set Drivr+Objct |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
187 atrv set ReEnt+rev |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
188 rev set $01 |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
189 edition equ 8 |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
190 |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
191 mod eom,name,tylg,atrv,start,size |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
192 |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
193 * NOTE: OS9 WILL ALWAYS ASSIGN DRIVER MEM SPACE ON AN EVEN 256 BYTE PAGE, |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
194 * SO TAKE ADVANTAGE OF "EXTRA" SPACE! |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
195 |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
196 org 0 |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
197 rmb DRVBEG+(DRVMEM*NUMDRIVE) |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
198 * Start of driver-specific statics |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
199 SlpCntr rmb 2 # ticks left before we give up on a read/write |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
200 PhysDrv rmb 1 Physical drive # (for quick lookup) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
201 DriveFlg rmb NUMDRIVE 1 byte per drive (bit flags) |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
202 OS9LSN rmb 3 LSN of current OS-9 256-byte sector |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
203 * IDE spec can handle 28 bits (4 bits of 4th byte) for LBA mode. Since OS9 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
204 * can't get that high anyways, we only work with 3, and then use the offset |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
205 * partition value to bump it up beyond the 4 GB mark. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
206 OS9PSN rmb 3 PSN of current OS9 sector (512 byte) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
207 DrivMask rmb 1 Drive # (0 or 1) for IDE (in proper bit position) |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
208 idecmd rmb 1 1 byte IDE command code |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
209 identcmd rmb 1 1 byte IDE Identify drive code |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
210 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
211 * Following flag is because the IDE interface can NOT access a 2nd drive |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
212 * while the 1st drive is completing a read or write. Because of shared |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
213 * device memory variables, this flag is set even on cached entries. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
214 drvrbusy rmb 1 Driver busy flag (0=not busy) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
215 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
216 * Following for CHS mode drives only! |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
217 Head rmb 1 Head # (s/b base 0) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
218 Cylinder rmb 2 Cylinder # |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
219 CHSSect rmb 1 CHS mode sector # |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
220 CHSSPT rmb 2 CHS mode sectors/track |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
221 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
222 * Buffer/cache variables |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
223 LSN0Flag rmb 1 $FF=Not LSN0, $00=LSN0 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
224 Sect0Drv rmb 1 Drive # of LSN0 currently buffered ($FF=none) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
225 Sect0Ofs rmb 2 Offset value for current LSN0 buffered drive |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
226 TempHalf rmb 3 Temp spot to hold other half calculation |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
227 HalfDrv rmb 1 Drive # of HalfBuff buffered ($FF=none) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
228 HalfOfs rmb 2 Offset value for drive for current cached sector |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
229 HalfSct rmb 3 OS9 sector # of half sector not asked for |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
230 TempOfs rmb 2 Temporary copy of partition offset |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
231 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
232 * NOTE: When 8k block buffering is added, move both of these to that block. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
233 * Of course, if removable media, re-read LSN0 physically every time. At that |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
234 * time, we should make tables here instead (32 entries per drive up to the |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
235 * maximum # of drives) of LSN #'s buffered (3 bytes/entry). |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
236 Sect0 rmb 256 Buffer for LSN0 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
237 HalfBuff rmb 256 Buffer for other half of 512 byte phys. sector |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
238 size equ . |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
239 |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
240 fcb $FF mode byte |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
241 |
613
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
242 IFNE SuperIDE |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
243 name fcs /SuperIDE/ module name |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
244 ELSE |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
245 name fcs /CCIDE/ module name |
613
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
246 ENDC |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
247 fcb edition module edition |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
248 |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
249 * INIT - appears to only be called on 1ST try on ANY IDE device IF link counts |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
250 * are 0. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
251 * Y = address of path descriptor (but |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
252 * U = address of driver memory (ie, of V.PAGE) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
253 * Inits the drive table, and the DriveFlg table |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
254 Init ldd #$8000+NUMDRIVE Flag that special drive flags are all unused |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
255 leax DriveFlg,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
256 DrvFlgLp sta ,x+ |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
257 decb |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
258 bne DrvFlgLp |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
259 GoInit leax DRVBEG,u Point to start of drive tables |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
260 ldd #$FF00+NUMDRIVE |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
261 stb V.NDRV,u Max # of drives |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
262 sta Sect0Drv,u Flag that no LSN0 is buffered |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
263 sta HalfDrv,u Flag that we have no half sector buffered |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
264 NextDrv sta DD.TOT,x Set Total # of sectors to illegal value |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
265 sta V.TRAK,x Non 0, so 1st seek can read Track 0 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
266 leax DRVMEM,x Point to next drive |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
267 decb Dec # of drives left |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
268 bne NextDrv Still more, init them too |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
269 clrb No error & return |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
270 rts |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
271 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
272 * Do drive diagnostic (use CHS mode) - Do not worry about ATAPI at this point |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
273 * Entry: U=driver mem ptr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
274 * Y=path descriptor |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
275 * B=Identify command |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
276 * Exit: CC clear - drive ready to send info |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
277 * CC set - error from drive, B contains raw error register |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
278 * TRASHES X - does timeout (CHECK - WILL SOME DRIVES TAKE TOO LONG?) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
279 * This is called by INIT, and should also be called by a GETSTAT at some |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
280 * point. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
281 Ident pshs y Save path descriptor |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
282 stb identcmd,u Save which Ident we are doing |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
283 ldy V.PORT,u Get IDE controller address |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
284 DoIdent lda DrivMask,u Get drive # requested |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
285 ora #%10100000 Mask in head 0 & CHS mode |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
286 std DevHead,y Send drive/head to controller, and IDENTIFY |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
287 * Note, if person booting from ROM, drive may not have spun up yet. See if |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
288 * we can check some sort of status or error flag that indicates drive is |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
289 * still firing up, if this is a problem. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
290 ldx #$a000 Arbitrary amount of time to give up |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
291 WaitIdnt lda Status,y Get Status register |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
292 bmi NoErr Busy, drop counter |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
293 bita #ErrorFnd Error? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
294 beq NoErr No, continue |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
295 ldb Error,y Get error code |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
296 bra BadIdent |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
297 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
298 NoErr cmpa #DrvReady+SeekDone+DataReq Drive ready to send Identify data? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
299 beq GotIdent Yep, exit out |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
300 leax -1,x Drop timer |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
301 bne WaitIdnt Keep trying |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
302 ldb #E$NotRdy Timed out, device not ready error |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
303 BadIdent coma Flag error |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
304 puls y,pc Restore path descriptor & return |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
305 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
306 GotIdent clrb No error |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
307 puls y,pc Restore path descriptor & return |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
308 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
309 * Send Identify drive command (ATA or ATAPI - see identcmd,u), update DriveFlg |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
310 * table |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
311 * PLEASE NOTE: The 2 identify commands are mutually exclusive; it will fail |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
312 * with an 'Aborted' error if the wrong Identify is used. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
313 * UNLIKE A NORMAL READ OF A SECTOR, THE INFORMATION CONTAINED IN THE IDENTIFY |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
314 * DRIVE COMMAND IS ALL IN INTEL ORDER WORD (16 BITS) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
315 * Entry: Y=Ptr to path descriptor |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
316 * U=Ptr to driver memory |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
317 * X IS DESTROYED! |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
318 * Exit: CC=0 if DriveFlg properly updated |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
319 * & A=DriveFlg value from update entry in table |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
320 * CC=1, B=error if Identify Drive failed |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
321 * DriveFlg,u - the proper flags for the specified controller/drive are |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
322 * updated |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
323 * Sect0 contains 1st 256 bytes, HalfBuff contains 2nd half |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
324 IdentDrv lbsr WaitDrv Wait for IDE to be ready |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
325 ldb #Identify |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
326 bsr Ident Send identify drive command to controller |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
327 bcc DoInfo Worked, Do info |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
328 bitb #%00000100 Error, Aborted Flag set? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
329 beq ExitIdnt No, exit with other error |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
330 ldb #PIIdent Try ATAPI identify |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
331 bsr Ident |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
332 bcs ExitIdnt That didn't work either, abort |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
333 DoInfo leax Sect0,u Point to buffer |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
334 * NOTE: INIT routine only gets called when the DRIVER is Initing...not every |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
335 * device. Hence, READ/WRITE must check the DriveFlg settings and make sure |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
336 * the hi bit is clear for the drive it is using, to indicate that it HAS |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
337 * been set properly from an Identify Drive command. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
338 * Read in 1st 256 bytes of Identify Drive buffer, parse out info we need |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
339 * for our special flag table |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
340 lbsr Read256 Generic 256 byte copy from IDE routine |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
341 ldb #$FF Since we made it this far, flag that HalfBuff |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
342 stb HalfDrv,u & Sect0Drv are now bogus |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
343 stb Sect0Drv,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
344 clra Set current flags to all off |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
345 leax Sect0,u Point to start of buffer again |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
346 ldb ,x Get general config low byte |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
347 andb #%10000000 Removable cartridge bit set? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
348 beq CheckLBA No, check LBA mode |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
349 ora #Remove Set removable media flag |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
350 CheckLBA ldb 99,x Get LBA mode byte |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
351 andb #%00000010 LBA allowed on this drive? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
352 beq ChkATAPI No |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
353 ora #DrvMode Yes, set LBA flag |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
354 ChkATAPI ldb identcmd,u Get Identify drive command type |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
355 cmpb #PIIdent ATAPI? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
356 bne SetFlg No, set drive flags |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
357 ora #ATAPI Set ATAPI flag |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
358 SetFlg ldb PD.DNS,y Get special settings flags |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
359 bitb #ForceCHS Force CHS mode on? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
360 beq LeavAlon No |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
361 anda #^DrvMode Yes, force to CHS mode |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
362 LeavAlon ldb PD.DRV,y Get Logical drive # |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
363 leax DriveFlg,u Point to drive flags table |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
364 sta b,x Save flags |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
365 pshs a Save for exit |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
366 leax HalfBuff,u Point to 2nd buffer |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
367 lbsr Read256 Identify info part 2 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
368 lbsr WaitOK Make sure drive finished command |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
369 puls a Restore flags byte |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
370 ExitIdnt rts No error, return |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
371 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
372 * Entry: U=driver memory ptr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
373 * Y=path descriptor ptr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
374 GetStat ldx PD.RGS,y Get ptr to callers register stack |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
375 lda R$B,x Get function code |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
376 cmpa #SS.DrInf Drive info command? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
377 bne NextGet No, try next |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
378 ldd R$Y,x Get sub-function type |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
379 beq GoodFunc |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
380 comb Only sub-functions 0 allowed for IDE |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
381 ifeq Level-2 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
382 ldb #E$IllArg |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
383 else |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
384 ldb #167 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
385 endc |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
386 ExitGet rts |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
387 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
388 GoodFunc pshs x,y,u Preserve regs |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
389 bsr IdentDrv Get either ATA or ATAPI Identify info |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
390 bcc GotInfo Something wrong, return |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
391 puls x,y,u,pc Restore regs, return with error |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
392 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
393 GotInfo leay Sect0,u Point to start of 512 byte buffer |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
394 ldx #256 # of two byte entries in buffer |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
395 SwapLoop ldd ,y Swap all words to Motorola order |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
396 exg a,b |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
397 std ,y++ |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
398 leax -1,x |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
399 bne SwapLoop |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
400 leay Sect0,u Point to start of buffer again |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
401 ldx 114,y Get Current Capacity, swap to Motorola |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
402 ldd 116,y |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
403 stx 116,y |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
404 std 114,y |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
405 ldx 120,y Get LBA sector count, swap to Motorola |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
406 ldd 122,y |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
407 stx 122,y |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
408 std 120,y |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
409 ifeq Level-2 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
410 lda <D.SysTsk Get system task # |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
411 ldx <D.Proc Get user task ptr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
412 ldb P$Task,x Get user's task # |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
413 leax Sect0,u Point to source buffer |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
414 ldu ,s Get ptr to PD.RGS |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
415 ldu R$X,u Get Destination ptr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
416 ldy #512 Move 512 bytes to caller |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
417 os9 F$Move |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
418 else |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
419 endc |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
420 puls x,y,u Restore regs to normal |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
421 bcc SetUserR No error, set exit registers for caller |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
422 rts |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
423 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
424 SetUserR ldd #512 # of bytes returned=512 (Callers Y) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
425 std R$Y,x |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
426 clrb Device type=ATA |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
427 lda identcmd,u Get which Identify Drive command worked |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
428 cmpa #PIIdent ATAPI? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
429 bne SaveType No, save ATA as type |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
430 incb |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
431 SaveType lda PD.DRV,y Get logical drive # |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
432 leay DriveFlg,u Point to drive flag table |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
433 lda a,y Get drive flags |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
434 std R$D,x Save drive flags & device type |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
435 clrb |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
436 rts |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
437 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
438 NextGet comb |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
439 ldb #E$UnkSvc |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
440 rts |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
441 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
442 SetStat clrb |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
443 rts |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
444 |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
445 start lbra Init |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
446 lbra Read |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
447 lbra FWrite |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
448 lbra GetStat |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
449 lbra SetStat |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
450 clrb Term routine (does nothing) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
451 rts |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
452 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
453 NotBsy lda #$FF |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
454 sta drvrbusy,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
455 rts |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
456 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
457 * Checks if driver is busy, retries & possibly sleeps if it is. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
458 * Set's driver to busy again when done. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
459 * A reg is destroyed, all others are preserved |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
460 ChekBusy lda #64 # of fast retries for driver |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
461 BsyTst tst drvrbusy,u Is current driver/controller already in use? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
462 beq NotBsy No, continue |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
463 deca |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
464 bne BsyTst Try up to 64 times |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
465 pshs x Otherwise, sleep a tick & try again |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
466 ldx #1 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
467 os9 F$Sleep |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
468 puls x |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
469 bra ChekBusy |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
470 |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
471 * Save OS9 LSN & Physical PSN (not including any partition offset) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
472 * Also saves sector # of other half that is buffered |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
473 * Will have to add check later for ATAPI stuff, up to 2048 bytes/sector |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
474 * for CD ROM |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
475 * Entry: U=ptr to driver mem |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
476 * B:X=OS9 LSN |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
477 * Exit: B:X=OS9 LSN |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
478 * OS9PSN updated (512 byte Physical sector # that IDE needs) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
479 * TempHalf updated to cached LSN # (Use HalfDrv to figure out if legit |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
480 * or not) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
481 * TempOfs updated to current partition offset |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
482 * Zero flag set if LSN0 was requested (also saved at LSN0Flag,u) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
483 * PhysDrv set to physical drive # |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
484 SavLSN pshs b,x Save work copy of LSN |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
485 lda PD.DNS,y Make copy of physical drive # |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
486 anda #PhysDriv |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
487 sta PhysDrv,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
488 clra Flag: LSN0 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
489 stb OS9LSN,u Save OS-9 LSN |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
490 beq dox Could be LSN0 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
491 inca Not LSN0 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
492 dox stx OS9LSN+1,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
493 beq doPSN Is LSN0 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
494 inca Not LSN0 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
495 doPSN sta LSN0Flag,u Save LSN0 flag (0=Yes, anything else, no) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
496 stb OS9PSN,u Save OS-9 PSN |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
497 stx OS9PSN+1,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
498 lsr OS9PSN,u Divide LSN by 2 for PSN (512 bytes/sector) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
499 ror OS9PSN+1,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
500 ror OS9PSN+2,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
501 bcc Even Even sector requested, half will be odd (+1) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
502 * Subtract 1 from current LSN |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
503 ldd 1,s |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
504 subd #1 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
505 std 1,s |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
506 ldb ,s |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
507 sbcb #0 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
508 bra SaveExit |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
509 |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
510 * Add 1 to current LSN |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
511 Even ldd 1,s |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
512 addd #1 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
513 std 1,s |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
514 ldb ,s |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
515 adcb #0 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
516 SaveExit ldx 1,s |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
517 stb TempHalf,u Save buffered sector # |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
518 stx TempHalf+1,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
519 leas 3,s Eat temp stack |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
520 ldx PD.DEV,y Get ptr to device table entry |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
521 ldx V$DESC,x Get device descriptor ptr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
522 ldx PartOfs,x Get partition offset value |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
523 stx TempOfs,u Save copy of it |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
524 ldb OS9LSN,u Restore LSN |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
525 ldx OS9LSN+1,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
526 lda LSN0Flag,u Set CC bits for LSN0 compare |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
527 rts |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
528 |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
529 * READ |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
530 * Entry: Y = address of path descriptor |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
531 * U = address of device memory (ie, of V.PAGE) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
532 * B = MSB of OS-9 disk LSN |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
533 * X = LSB of OS-9 disk LSN |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
534 * Eventually change LSN stuff to use a bit from descriptor as to whether |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
535 * buffered LSN0 or not. (After that, add in for general 8k block buffering |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
536 * or not). |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
537 * Later, add check for DriveFlg that sees if device has removable media. If |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
538 * not, and caching for each logical drive is done, keep PERMANENT copy of |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
539 * LSN0 at all times, and just copy it when requested (WRITE will update copy |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
540 * if new LSN0 is written). |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
541 * MAKE SURE WRITE ROUTINE UPDATES CACHING STUFF CORRECTLY! |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
542 Read lbsr ChekBusy Wait for driver to be unbusy |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
543 bsr SavLSN Save LSN/PSN, PartOfs & HalfSect info |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
544 bne NotLSN0 Not LSN0, skip ahead |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
545 * Theoretically, following REM'ed out lines will handle removable media: |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
546 * lda DriveFlg,u Get drive flag settings |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
547 * bita #Remove Removable media? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
548 * bne NotLSN0 Yes, LSN0 may change from disk swap |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
549 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
550 * LSN0 - 1st see if buffered |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
551 lda PhysDrv,u Get requested physical drive # |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
552 cmpa Sect0Drv,u Same drive in LSN0 cache? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
553 bne PhysRead No, go physically read off of drive |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
554 ldx TempOfs,u Get copy of partition offset |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
555 cmpx Sect0Ofs,u Same as cached LSN0 offset? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
556 bne PhysRead No, physically read the sector |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
557 * LSN0 buffered goes here - later add check against DriveFlg with removable |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
558 * media bit - if non-removable, copy from cache, otherwise to physical read |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
559 leax Sect0,u Point to LSN0 cache |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
560 bra CopyBuff Copy to caller's PD.BUF, exit from there |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
561 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
562 * Not LSN0 - see if normal sector is currently cached. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
563 * Entry: B:X=LSN |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
564 NotLSN0 cmpb HalfSct,u Same as cached sector? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
565 bne PhysRead |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
566 cmpx HalfSct+1,u Same as cached sector? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
567 bne PhysRead |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
568 lda PhysDrv,u Same drive as cached? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
569 cmpa HalfDrv,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
570 bne PhysRead No, need physical read of sector |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
571 ldd TempOfs,u Get current request's Partition offset |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
572 cmpd HalfOfs,u Same as cached? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
573 bne PhysRead No, physical read of sector |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
574 * Non-LSN0 sector is cached - if removable drive, force physical read unless |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
575 * we somehow monitor disk swaps (some media require Eject commands) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
576 leax HalfBuff,u Point to cached sector |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
577 * Copy sector from cache buffer to caller's buffer |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
578 * Entry: X=Ptr to cache buffer (either Sect0, or HalfBuff) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
579 CopyBuff clrb 256 counter |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
580 ldy PD.BUF,y Point to caller's buffer |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
581 CpyLoop lda ,x+ Copy it |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
582 sta ,y+ |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
583 decb |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
584 bne CpyLoop |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
585 clr drvrbusy,u Flag driver not busy |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
586 rts |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
587 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
588 * Not buffered in any way - physical read required - update cache tags AFTER |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
589 * read, or flag with $FF if failed. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
590 * Entry: Y=Ptr to path descriptor |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
591 * U=Driver mem |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
592 PhysRead lbsr InitRead Tell IDE to read sector |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
593 bcc DoRead No error, do read |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
594 FlagBad lda #$FF If IDE can't even initiate read, flag both |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
595 sta Sect0Drv,u LSN0 and HalfBuff as bad |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
596 sta HalfDrv,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
597 lbra RprtErr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
598 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
599 * Entry: Y=path dsc. ptr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
600 * U=Driver mem ptr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
601 DoRead lda OS9LSN+2,u Get LSB of OS9 sector # |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
602 lsra Shift 1/2 512 sector flag out |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
603 bcs DoOdd Odd sector, buffer even one 1st |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
604 ldx PD.BUF,y Get pointer to caller's buffer |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
605 bsr Read256 Copy 1st half of HD sector there |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
606 leax HalfBuff,u Point to cache buffer |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
607 bsr Read256 Copy 2nd half of HD sector there |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
608 bra FinRead Finish the Read command on IDE |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
609 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
610 * Copy to cache 1st (Odd sector # request) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
611 DoOdd leax HalfBuff,u Point to cache buffer |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
612 bsr Read256 1st half goes there |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
613 ldx PD.BUF,y Get pointer to caller's buffer |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
614 bsr Read256 2nd half goes there |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
615 FinRead lbsr WaitOK Wait for drive to complete command |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
616 bcc DoneRead No error, exit |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
617 lbra RprtErr Exit with error |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
618 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
619 * Update HalfSct vars to whatever is in TempHalf |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
620 GoodCach ldd TempHalf,u Copy Buffered LSN to HalfSct |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
621 std HalfSct,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
622 lda TempHalf+2,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
623 sta HalfSct+2,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
624 ldd TempOfs,u Get partition offset |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
625 std HalfOfs,u Save it |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
626 lda PhysDrv,u Copy drive # to HalfDrv |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
627 sta HalfDrv,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
628 rts |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
629 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
630 * Entry: Read command complete on IDE. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
631 * Y=ptr to path descriptor |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
632 * U=ptr to driver mem |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
633 DoneRead bsr GoodCach Update HalfSct stuff with Temp stuff |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
634 ldb LSN0Flag,u Was this LSN0? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
635 bne GoodExit No, leave |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
636 * LSN0 just physically read - update drive table |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
637 * CHANGE EVENTUALLY TO CHECK IF NON-REMOVABLE MEDIA; IF IT IS, DON'T BOTHER |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
638 * WITH THESE CHECKS! |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
639 sta Sect0Drv,u Save which drive LSN0 is buffered |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
640 ldd TempOfs,u Restore partition offset again |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
641 std Sect0Ofs,u Save for LSN0 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
642 leax Sect0,u Point to LSN0 buffer |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
643 clrb 256 counter |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
644 pshs y Save path dsc. ptr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
645 ldy PD.BUF,y Point to caller's buffer |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
646 LSN0Loop lda ,y+ Copy LSN0 from callers buffer to LSN0 cache |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
647 sta ,x+ |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
648 decb |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
649 bne LSN0Loop |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
650 puls y Restore path dsc. ptr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
651 leax Sect0,u Point to LSN0 cache again |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
652 CopyTbl1 lbsr CpyDrvTb Copy LSN0 stuff to drive table |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
653 GoodExit clr drvrbusy,u No error & return |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
654 rts |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
655 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
656 * Initiate the 512 byte READ sequence |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
657 * Entry: U=Driver mem ptr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
658 * Y=Path dsc. ptr (?) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
659 * Exit: CC=0 if no error |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
660 * CC=1 if error |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
661 * B=Error code |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
662 InitRead ldb #ReadRtry Read sector (with retry) IDE command |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
663 lbra SetIDE Send to IDE, return from there (w or w/o err) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
664 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
665 * Copy 256 bytes of data from IDE controller (after READ, etc.) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
666 * Entry: X=ptr to 256 byte destination buffer |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
667 * U=ptr to driver memory |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
668 * Exit: 256 bytes copied |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
669 * B is destroyed, A=0 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
670 * Y is preserved |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
671 Read256 lda #$20 # of loops (of 8 bytes) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
672 pshs y,a Save y & counter |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
673 ldy V.PORT,u Get ptr to IDE controller for this drive |
613
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
674 IFNE SuperIDE |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
675 ReadLp ldd ,y Get 16 bits of data, and save in buffer, 8 times |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
676 std ,x |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
677 ldd ,y |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
678 std 2,x |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
679 ldd ,y |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
680 std 4,x |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
681 ldd ,y |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
682 std 6,x |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
683 ELSE |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
684 ReadLp lda ,y Get 16 bits of data, and save in buffer, 8 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
685 ldb Latch,y times |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
686 std ,x |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
687 lda ,y |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
688 ldb Latch,y |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
689 std 2,x |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
690 lda ,y |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
691 ldb Latch,y |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
692 std 4,x |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
693 lda ,y |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
694 ldb Latch,y |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
695 std 6,x |
613
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
696 ENDC |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
697 leax 8,x Bump ptr up |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
698 dec ,s Done all bytes? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
699 bne ReadLp No, keep going |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
700 puls a,y,pc Restore Y & return |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
701 |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
702 * WRITE - Can use cache data, or preread sector |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
703 * Y = address of path descriptor |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
704 * U = address of device memory (ie, of V.PAGE) |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
705 * B = MSB of OS-9 disk LSN |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
706 * X = LSB of OS-9 disk LSN |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
707 * 1st , see if other half is buffered in HalfBuff |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
708 FWrite lbsr ChekBusy Wait for driver to be unbusy |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
709 lbsr SavLSN Save LSN info, set LSN0Flag for later |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
710 ldb TempHalf,u Get OS9 LSN of 'other half' of 512 byte sector |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
711 cmpb HalfSct,u Same MSB of buffered sector #? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
712 bne ChkLSN1 No, check if LSN1 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
713 ldx TempHalf+1,u LSW of 'other half' |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
714 cmpx HalfSct+1,u Same as LSW of buffered sector #? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
715 bne ChkLsn1 No, check if LSN1 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
716 ldd HalfOfs,u Same partition as buffered sector's drive? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
717 cmpd TempOfs,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
718 bne ChkLsn1 No, check if LSN1 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
719 lda PhysDrv,u Same physical drive as buffered sector's drive? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
720 cmpa HalfDrv,u Same as buffered sector's drive? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
721 bne ChkLsn1 No, check is LSN1 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
722 * Buffered sector IS the other half of current write sector...no preread nec- |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
723 * essary. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
724 lbsr InitWrit Send Write command to IDE, setup mode, etc. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
725 bcc GoodWrit No problems, continue with Write |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
726 lbra FlagBad Flag caches as bad, exit with error |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
727 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
728 * See if request is for LSN1, in which case we may have LSN0 buffered |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
729 ChkLSN1 ldb OS9LSN,u Get MSB of sector to write |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
730 bne PreRead Not 0, need physical preread |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
731 ldx OS9LSN+1,u Get LSW of sector to write |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
732 cmpx #1 LSN=1? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
733 bne PreRead Not LSN1, need to preread sector |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
734 lda PhysDrv,u Get physical drive # |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
735 cmpa Sect0Drv,u Same as buffered LSN0? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
736 bne PreRead No, need physical preread |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
737 ldd TempOfs,u Get partition offset of requested sector |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
738 cmpd Sect0Ofs,u Same as buffered? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
739 bne PreRead |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
740 * We have LSN0 buffered for an LSN1 write |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
741 lbsr InitWrit Send Write to IDE |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
742 bcc ContWrt1 Successful, continue |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
743 lbra RprtErr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
744 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
745 ContWrt1 leax Sect0,u Point to buffered Sector 0 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
746 bsr Write256 Write to IDE |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
747 ldx PD.BUF,y Get ptr to caller's LSN1 buffer |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
748 bsr Write256 Write to IDE |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
749 bra FinWrite Complete the write command |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
750 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
751 * Nothing buffered, pre-read sector in so we have other half to write. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
752 * Note that OS9PSN is already set to the correct physical sector. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
753 PreRead lbsr InitRead Send Read command to IDE |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
754 bcc GotPreRd No problem, continue |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
755 lbra FlagBad Flag caches as bad; exit with error |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
756 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
757 GotPreRd lda OS9LSN+2,u Get least sig. byte of LSN to write |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
758 lsra Odd or even sector? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
759 bcc ReadOdd Even write sector requested |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
760 * Odd write requested |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
761 leax HalfBuff,u Point to 1/2 sector cache |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
762 lbsr Read256 Read it in |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
763 bsr Eat256 Bleed off other half (not needed) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
764 bra FinPre |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
765 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
766 * Even sector to write - buffer odd one |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
767 ReadOdd bsr Eat256 Bleed 1st half |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
768 leax HalfBuff,u Read in 2nd half |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
769 lbsr Read256 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
770 FinPre lbsr WaitOK Get OK from controller |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
771 bcc DonePre Good, continue |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
772 BadExit lbra RprtErr Error, exit with it |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
773 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
774 DonePre lbsr GoodCach Update HalfSct stuff only |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
775 lbsr InitWrit Initialize Write command |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
776 bcs BadExit |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
777 * Now, onto the write |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
778 GoodWrit ldb OS9LSN+2,u Get least sig. byte of LSN |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
779 lsrb Odd or even sector to write? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
780 bcs BuffWOdd Write fully buffered Odd |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
781 * We are writing even portion, odd is in cache |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
782 ldx PD.BUF,y Get ptr to caller's 256 byte buffer |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
783 bsr Write256 Write to IDE |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
784 leax HalfBuff,u Point to cached sector |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
785 bsr Write256 Write to IDE |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
786 bra FinWrite |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
787 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
788 BuffWOdd leax HalfBuff,u Point to cached sector |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
789 bsr Write256 Write to IDE |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
790 ldx PD.BUF,y Point to caller's 256 byte buffer |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
791 bsr Write256 Write to IDE |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
792 FinWrite lbsr WaitOK Wait for IDE to be done command |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
793 bcc DoneWrit No error, done writing |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
794 lbra RprtErr Error, exit with it |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
795 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
796 * Write 256 bytes from ,x to IDE |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
797 * Entry: X=ptr to 256 buffer to write |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
798 * U=driver mem ptr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
799 * Exit: 256 bytes written |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
800 * B is destroyed, A=0 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
801 * X=end of buffer+1 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
802 * Y is preserved |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
803 Write256 lda #$20 # of 8 byte loops |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
804 pshs y,a Save Y & loop counter |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
805 ldy V.PORT,u Get IDE base address |
613
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
806 IFNE SuperIDE |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
807 WritLp ldd ,x Copy 256 bytes from buffer to IDE |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
808 std ,y |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
809 ldd 2,x |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
810 std ,y |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
811 ldd 4,x |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
812 std ,y |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
813 ldd 6,x |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
814 std ,y |
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
815 ELSE |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
816 WritLp ldd ,x Copy 256 bytes from buffer to IDE |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
817 stb Latch,y |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
818 sta ,y |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
819 ldd 2,x |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
820 stb Latch,y |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
821 sta ,y |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
822 ldd 4,x |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
823 stb Latch,y |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
824 sta ,y |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
825 ldd 6,x |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
826 stb Latch,y |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
827 sta ,y |
613
16dc49e3a104
SuperIDE driver/descriptors added, removed dd_ide.asm and h0_ide.asm in favor of one file: idedesc.asm
boisy
parents:
89
diff
changeset
|
828 ENDC |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
829 leax 8,x |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
830 dec ,s |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
831 bne WritLp |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
832 puls a,y,pc Restore regs & return |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
833 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
834 * Eat 256 bytes from IDE (hopefully, triggering latch will skip having to |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
835 * read even bytes) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
836 * Entry: U=driver memory ptr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
837 * Y=Path descriptor ptr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
838 * Exit: 256 bytes bled off of sector buffer on IDE |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
839 * All regs preserved |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
840 Eat256 pshs d,x Save regs |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
841 ldb #$20 32 loops |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
842 ldx V.PORT,u Get pointer to IDE |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
843 EatLp lda ,x Read seems to be a pre-trigger |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
844 lda ,x Eat each 16 bit trigger byte |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
845 lda ,x |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
846 lda ,x |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
847 decb |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
848 bne EatLp |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
849 puls d,x,pc Restore regs & return |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
850 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
851 * Write command to IDE completed successfully |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
852 * Update cache (copy PD.BUF to Cache if even sector, so a sequential |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
853 * write will have the 1st half cached, or leave current cache alone if |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
854 * odd). Also, check if LSN0. If it is, copy to LSN0 cache, updating |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
855 * vars, and copy drive table info |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
856 DoneWrit ldb LSN0Flag,u Was it sector 0? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
857 beq WritLSN0 Yes, special processing for that |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
858 ldb OS9LSN+2,u Get LSB of sector # |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
859 lsrb Odd/Even? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
860 bcc CpyCache Even, copy to Cache |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
861 * Odd sector written, leave cache as is |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
862 clr drvrbusy,u Exit without error |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
863 rts |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
864 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
865 * Copy PD.BUF sector to HalfBuff cache, update cache tags |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
866 CpyCache lda PhysDrv,u Set cache vars for PD.BUF sector |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
867 sta HalfDrv,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
868 ldd TempOfs,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
869 std HalfOfs,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
870 ldd OS9LSN,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
871 std HalfSct,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
872 lda OS9LSN+2,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
873 sta HalfSct+2,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
874 leax HalfBuff,u Point to 1/2 sector cache |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
875 CachBuff clrb |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
876 ldy PD.BUF,y Get ptr to callers buffer |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
877 CachLp lda ,y+ Copy even sector to cache (in case of sequential |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
878 sta ,x+ writes) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
879 decb |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
880 bne CachLp |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
881 clr drvrbusy,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
882 rts |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
883 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
884 * We wrote LSN0 - 1st, update LSN0 cache tags, then copy PD.BUF to Sect0, |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
885 * then update drive table entry. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
886 * Entry: U=drive mem ptr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
887 * Y=path dsc. ptr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
888 WritLSN0 lda PhysDrv,u Copy cache tag stuff for Sect0 cache |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
889 sta Sect0Drv,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
890 ldd TempOfs,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
891 std Sect0Ofs,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
892 leax Sect0,u Point to LSN0 cache |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
893 bsr CachBuff Copy from PD.BUF to Sect0 buff |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
894 leax Sect0,u Point to LSN0 cache again |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
895 clr drvrbusy,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
896 lbra CpyDrvTb Copy info to drive table, exit from there |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
897 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
898 * Initialize Write sequence to IDE |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
899 * Entry: U=driver mem ptr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
900 * Y=Ptr to path descriptor |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
901 * Exits back to calling routine. CC=0 if command ready on controller |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
902 * CC=1, B=Raw IDE error code if command failed |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
903 InitWrit ldb #WritRtry IDE Write w/ Retry command |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
904 bra SetIDE Send to IDE, return from there w or w/o error |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
905 |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
906 * After read or write, check drive status |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
907 * Exit: CC=0, command ok, CC=1, Error from IDE (B=Raw error code) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
908 * X=Ptr to hardware address |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
909 WaitOK ldx V.PORT,u Get status register |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
910 WaitLp tst Status,x Still busy, wait till unbusy |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
911 bmi WaitLp |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
912 lda #ErrorFnd Check Error flag |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
913 bita Status,x Error from controller? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
914 bne RprtErr Yes, go get error |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
915 clrb No, exit without error |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
916 rts |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
917 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
918 * Entry: B=Error code from IDE |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
919 RprtErr lsrb |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
920 bcc ChkTk0 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
921 SctrExit ldb #E$Sect Bad sector # for Addres Mark Not Found |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
922 bra ExitErr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
923 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
924 ChkTk0 lsrb |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
925 bcc ChkMdChg |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
926 SeekExit ldb #E$Seek Seek error for Track 0 not found |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
927 bra ExitErr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
928 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
929 ChkMdChg lsrb |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
930 bcc ChkAbrt |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
931 MdChExit ldb #E$DIDC Media changed error |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
932 bra ExitErr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
933 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
934 ChkAbrt lsrb |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
935 bcc ChkIdnf |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
936 ldb #E$UnkSvc Unknown service error for aborted command |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
937 bra ExitErr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
938 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
939 ChkIdnf lsrb |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
940 bcs SctrExit Sector error for ID not found |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
941 lsrb |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
942 bcs MdChExit Media changed error for Media Change |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
943 lsrb |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
944 bcc ChkBBK |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
945 ldb #E$CRC CRC Error for Uncorrectable data |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
946 bra ExitErr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
947 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
948 ChkBBK lsrb |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
949 bcs ReadExit Read error for Bad Block Detected |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
950 * Error flag set, but no error condition |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
951 lbra ENotRdy Assume drive not ready |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
952 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
953 ReadExit ldb #E$Read |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
954 ExitErr clr drvrbusy,u Flag driver not busy |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
955 coma Set carry & exit |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
956 rts |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
957 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
958 BadUnit ldb #E$Unit |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
959 bra ExitErr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
960 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
961 CmdErr ldb Error,x Get Error register |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
962 bra RprtErr |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
963 |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
964 * Send IDE command (read or write) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
965 * Entry: B = IDE command code |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
966 * Y = address of path descriptor |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
967 * U = address of device memory (ie, of V.PAGE) |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
968 * trashes D and X |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
969 * Exit: CC=0 if command exited with data ready on controller |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
970 * CC=1, B=error if problem. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
971 SetIDE stb idecmd,u Save copy of IDE command |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
972 ldb PD.DRV,y Get logical drive # |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
973 cmpb #NUMDRIVE Within range? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
974 bhs BadUnit No, exit with error |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
975 leax DriveFlg,u Point to special drive flags table |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
976 lda b,x Get flags for our drive |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
977 bpl TblReady Properly initialized, figure out mode |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
978 lbsr IdentDrv NOT Initialized, get mode info |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
979 bcs CmdErr Error doing IDENTIFY DRIVE command, exit |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
980 TblReady anda #DrvMode Just need CHS/LBA mode for now |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
981 bne DoLBA LBA mode, go do |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
982 * Do CHS mode |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
983 ldd PD.SCT,y Get # of OS9 (256) sectors/track |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
984 lsra Convert to 512 byte sectors/track |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
985 rorb |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
986 std CHSSPT,u Save for Calc routine |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
987 ldx PD.DTB,y Get pointer to device table |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
988 lbsr CalcCHS Go calculate cyl/head/sector stuff |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
989 bcs CmdErr Error calculating, exit |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
990 lbsr WaitDrv Go wait for the drive (preserves y) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
991 bcs CmdErr Error waiting for drive, exit |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
992 * Do sector #, then Drive/Head, then Cyl, then sector count, then command |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
993 pshs y Save path descriptor ptr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
994 ldy V.PORT,u Get IDE hardware address |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
995 lda CHSSect,u Get IDE sector # |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
996 sta SectNum,y Save to controller |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
997 lda Head,u Get IDE head # |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
998 ora #%10100000 Set CHS mode |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
999 ora DrivMask,u Merge drive # |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1000 sta DevHead,y Save to controller |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1001 ldd Cylinder,u Get 16 bit cylinder # (4095 max) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1002 addd TempOfs,u Add partition offset cylinder |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1003 bcs SeekErr If it overflowed, SEEK error |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1004 sta CylHigh,y Save to controller |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1005 stb CylLow,y |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1006 bra SendCmd Send sector count & IDE command |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1007 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1008 * Do LBA mode IDE command here |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1009 DoLBA bsr WaitDrv Wait for controller to be ready |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1010 pshs y Save path descriptor ptr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1011 ldy V.PORT,u Get IDE hardware address |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1012 * Copy LBA sector # to controller, including device/head (LBA 24-27) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1013 ldd OS9PSN+1,u Get bits 0-15 of PSN |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1014 stb SectNum,y Save bits 0-7 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1015 sta CylLow,y Save bit 8-15 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1016 clra |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1017 ldb OS9PSN,u D=PSN bits 16-23 (24 & up set to 0 for OS9) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1018 addd TempOfs,u Add partition offset cylinder |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1019 cmpa #$0f Overflow past LBA bits? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1020 bhi SeekErr Yes, SEEK error |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1021 stb CylHigh,y Save bits 16-23 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1022 ora #%11100000 Set LBA mode |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1023 ora DrivMask,u Merge drive # |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1024 sta DevHead,y Save to controller |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1025 * Send sector count (1) & command to controller, get results |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1026 SendCmd ldx #MAXWAIT Get # 1/60th sec. ticks to wait on drive |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1027 stx SlpCntr,u Save it for sleep routine (if needed) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1028 ldd #$0140 Sector count to 1, fast retry to 64 tries |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1029 sta SectCnt,y Send to controller |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1030 lda idecmd,u Get command to send |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1031 sta Command,y Send to controller |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1032 CmdLp lda Status,y Get status of drive command |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1033 bmi CmdLp IDE still busy, no other bits are valid |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1034 bita #ErrorFnd Not busy anymore, is there an error? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1035 bne TransErr Yes, figure out what (don't forget to PULS Y!) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1036 bita #DataReq Is data ready for us yet? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1037 bne CmdDone Yes, exit |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1038 decb Dec counter |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1039 bne CmdLp Keep trying |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1040 ldx SlpCntr,u Get sleep tick counter |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1041 leax -1,x Drop it by one |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1042 beq NoWay Done count, give up with device not ready error |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1043 stx SlpCntr,u Save new sleep counter |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1044 ldx #1 Fast retry didn't work, sleep a tick |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1045 os9 F$Sleep |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1046 ldb #$40 64 fast retries again |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1047 bra CmdLp Try again |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1048 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1049 SeekErr lbsr SeekExit Seek error & exit |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1050 puls y,pc |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1051 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1052 NoWay puls y |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
1053 bra ENotRdy |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
1054 |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1055 TransErr lbsr CmdErr Get error code |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1056 puls y,pc Exit with it, restore path dsc. ptr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1057 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1058 CmdDone clrb Command complete, return with no error |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1059 puls y,pc Restore path dsc. ptr |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
1060 |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1061 * Wait for IDE controller to be ready |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1062 * Entry: Y=path dsc. ptr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1063 * U=driver mem ptr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1064 * Exit: CC=0 - controller ready for command |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1065 * CC=1 - Error message in B |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1066 * DrivMask,u - contains drive # bit ready for IDE masking |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1067 * PRESERVES X&Y |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1068 WaitDrv pshs x,y Preserve regs |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1069 ldx #$A000 (1/2 to 1/3 second busy check) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1070 lda PD.DNS,y Get physical drive # |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1071 anda #PhysDriv No bad drive # possible |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1072 lsla Move drive # into proper bit for Drive/head |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1073 lsla |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1074 lsla |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1075 lsla |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1076 sta DrivMask,u Save drive mask for IDE |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1077 ldy V.PORT,u Get controller address for drive selected |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1078 RdyIni1 tst Status,y IDE busy? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1079 bpl IDEReady No, return |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1080 leax -1,x Dec counter |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1081 bne RdyIni1 Try again |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1082 puls x,y Restore regs |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1083 ENotRdy clr drvrbusy,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1084 comb Tried too long; give up with error |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
1085 ldb #E$NotRdy |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
1086 rts |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1087 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1088 IDEReady puls x,y Restore regs |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1089 clrb IDE ready, return |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
1090 rts |
89
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1091 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1092 * Copy LSN0 stuff into drive table |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1093 * Entry: X=ptr to 256 byte buffer containing LSN0 Sector. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1094 * Exit: X,D is destroyed |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1095 CpyDrvTb pshs y Save path desc. ptr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1096 ldb PD.DRV,y Get LOGICAL drive # |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1097 lda #DRVMEM Copy useful information to our LSN 0 buffer |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1098 mul Point to proper entry in drive table |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1099 leay DRVBEG,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1100 leay d,y |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1101 lda #DD.SIZ |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1102 LSN0Cp ldb ,x+ |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1103 stb ,y+ |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1104 deca |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1105 bne LSN0Cp |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1106 puls y,pc Restore path desc. ptr & return |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1107 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1108 * Notes: PhysSN is the physical sector number to send to the controller, |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1109 * not the LSN...so it must be translated from the LSN (for IDE, divide by |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1110 * 2, unless using ATAPI CDROM, in which case divide by 8). |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1111 * Note that the head returned from this routine is base 0, so that the |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1112 * lowest head # returned would be 0 (for the first head). This matches |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1113 * the IDE spec (which can also only go up to 16 heads). |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1114 * The cylinder returned is also base 0, same as IDE. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1115 * The sector returned is base 0, but IDE needs base 1. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1116 * Vars used from elsewhere - OS9PSN,u - Physical (IDE 512) sector # |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1117 * - Head,u - IDE head # |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1118 * - Cylinder,u - IDE Cylinder # |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1119 * - CHSSect,u - IDE sector (512) # |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1120 * - CHSSPT,u - IDE (512 byte) sctrs/track) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1121 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1122 * LSN division routine variable definitions: all on temp stack |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1123 org 0 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1124 S.SclPwr rmb 2 scale power |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1125 S.SclAmt rmb 3 scale amount |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1126 S.Cyl rmb 2 cylinder number |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1127 S.PSN rmb 3 physical sector number (work copy) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1128 S.Head rmb 1 head number |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1129 S.Frame equ . size of stack frame |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1130 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1131 * Entry: U=ptr to driver data area |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1132 * Y=Ptr to path descriptor |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1133 * X=Ptr to current drives' entry in drive table (DD.TOT, etc.) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1134 * OS9PSN,u- Three byte Physical (512 byte) sector #) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1135 * Exit: U=ptr to driver data area |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1136 * Y=ptr to path descriptor |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1137 * X=Drive table ptr |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1138 * Head,u=Head # in CHS mode |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1139 * Cylinder,u=Cylinder # in CHS mode |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1140 * CHSSect,u=Sector # in CHS mode |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1141 * CC=0, no error, above 3 vars. are legit |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1142 * CC=1, error, error return in B |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1143 CalcCHS leas -S.Frame,s make room for LSN division variables |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1144 ldb OS9PSN,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1145 stb S.PSN,s initialize PSN MSB |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1146 ldd OS9PSN+1,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1147 std S.PSN+1,s initialize PSN LSBs |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1148 ldd #$0000 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1149 sta S.Head,s initialize head number |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1150 std S.Cyl,s initialize cylinder number |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1151 ldd S.PSN+1,s get PSN LSBs |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1152 subd CHSSPT,u less sectors/track |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1153 bhs NotTrk0 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1154 tst S.PSN,s PSN MSB = 0? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1155 beq DivDone yes, sector in track 0, go save info |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1156 dec S.PSN,s PSN MSB less 1 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1157 NotTrk0 std S.PSN+1,s save remaining PSN LSBs |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1158 inc S.Head,s set to next head (1) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1159 inc V.TRAK+1,x mark track as non-0 for SetUpWD |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1160 ldb CHSSPT+1,u get IDE sectors per track |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1161 lda PD.SID,y Get # of disk heads |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1162 deca less track 0 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1163 mul calculate sectors remaining in cylinder 0 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1164 std S.SclPwr,s save it temporarily |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1165 ldd S.PSN+1,s get remaining PSN LSBs |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1166 subd S.SclPwr,s less sectors remaining in cylinder 0 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1167 bhs NotCyl0 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1168 tst S.PSN,s remaining PSN MSB = 0? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1169 beq CalcHead sector in cylinder 0, go get head number |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1170 dec S.PSN,s remaining PSN MSB less 1 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1171 NotCyl0 std S.PSN+1,s save remaining PSN LSBs |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1172 inc S.Cyl+1,s set cylinder to 1 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1173 clr S.Head,s reset head number to 0 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1174 lda PD.SID,y get disk sides |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1175 ldb CHSSPT+1,u get sectors per track |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1176 NrmlDiv clr S.SclAmt+2,s initialize scale amount LSB |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1177 lsla HD prescale = heads x 8 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1178 lsla This is the max we can do with a 16 head |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1179 lsla drive, using 8 bit MUL. |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1180 mul calculate scale amount MSBs |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1181 std S.SclAmt,s save scale amount MSBs |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1182 ldd #HDSclPwr Set hard drive scale power |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1183 std S.SclPwr,s save scale power |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1184 DivLoop lda S.PSN,s get remaining PSN MSB |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1185 cmpa S.SclAmt,s remaining PSN > scale amount? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1186 blo DivLoop1 no, go set up next scale amount & power |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1187 bhi DivLoop2 yes, go do subtraction |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1188 ldd S.PSN+1,s get remaining PSN LSBs |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1189 subd S.SclAmt+1,s remaining PSN >= scale amount? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1190 blo DivLoop1 no, go set up next scale amount & power |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1191 std S.PSN+1,s save remaining PSN LSBs |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1192 bra DivLoop3 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1193 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1194 DivLoop2 ldd S.PSN+1,s get remaining PSN LSBs |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1195 subd S.SclAmt+1,s less scale amount LSBs |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1196 std S.PSN+1,s save remaining PSN LSBs |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1197 DivLoop3 lda S.PSN,s get remaining PSN MSB |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1198 sbca S.SclAmt,s less scale amount MSB and borrow (if any) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1199 sta S.PSN,s save remaining PSN MSB |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1200 ldd S.Cyl,s get cylinder number |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1201 addd S.SclPwr,s add scale power |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1202 std S.Cyl,s save cylinder number |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1203 DivLoop1 lsr S.SclAmt,s * divide scale amount by two |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1204 ror S.SclAmt+1,s |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1205 ror S.SclAmt+2,s |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1206 lsr S.SclPwr,s * divide scale power by two |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1207 ror S.SclPwr+1,s |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1208 bcc DivLoop |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1209 CalcHead ldd S.PSN+1,s get remaining PSN LSBs |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1210 NextHead subd CHSSPT,u less sectors per track (head) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1211 blo DivDone underflow, go save info |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1212 std S.PSN+1,s save remaining PSN LSBs |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1213 inc S.Head,s increment head number |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1214 bra NextHead |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1215 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1216 DivDone ldd S.Cyl,s get cylinder number |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1217 cmpd PD.CYL,y cylinder number OK? |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1218 bhs LSNErrSF no, go return error |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1219 std Cylinder,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1220 lda S.PSN+2,s get sector number (remaining PSN LSB) |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1221 inca IDE needs base 1 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1222 sta CHSSect,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1223 ldb S.Head,s get head number |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1224 stb Head,u |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1225 leas S.Frame,s restore stack pointer |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1226 clrb |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1227 rts |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1228 |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1229 LSNErrSF leas S.Frame,s restore stack pointer |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1230 LSNErr comb |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1231 ldb #E$Sect Exit with Bad sector # error |
2727056db0d3
Updated to Curtis Boyle's latest IDE driver, works with L1 and L2
boisy
parents:
36
diff
changeset
|
1232 rts |
36
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
1233 |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
1234 emod |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
1235 eom equ * |
8b423669e5d2
Removed Boyle's IDE drivers for the time being... they don't seem to work
boisy
parents:
0
diff
changeset
|
1236 end |