annotate level1/modules/llcocosdc.asm @ 3036:42861a1dd59e

Low level driver update to CoCoSDC provided by Darren.
author David Ladd <drencor-xeen@users.sf.net>
date Fri, 09 Jan 2015 12:32:56 -0600
parents 3afecdae6f53
children c6eafb074443
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
1 ********************************************************************
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
2 * llcocosdc - CoCo SDC Low-level driver
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
3 *
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
4 * $Id$
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
5 *
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
6 * Edt/Rev YYYY/MM/DD Modified by
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
7 * Comment
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
8 * ------------------------------------------------------------------
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
9 * 2013/05/?? Boisy G. Pitre
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
10 * Created.
3017
545a59f51fee Changed llcocosdc read and write routines to enter and leave command mode.
tlindner
parents: 2818
diff changeset
11 * 2014/11/27 tim lindner
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
12 * Changed read and write routines to enter and leave command mode.
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
13 *
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
14 * 2014/12/22 Darren Atkinson
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
15 * Total re-write. Provides MPI slot selection to permit co-existence
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
16 * with a real floppy controller. Sends command to controller during
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
17 * Init which locks out the floppy emulation capability. Adds GetStat
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
18 * functions for extended commands. Uses TFM to retrieve data blocks
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
19 * when a 6309 CPU is present. Supports the SS.DSize GetStat function
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
20 * to query controller for the disk size.
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
21 *
3036
42861a1dd59e Low level driver update to CoCoSDC provided by Darren.
David Ladd <drencor-xeen@users.sf.net>
parents: 3032
diff changeset
22 * 2015/01/08 Darren Atkinson
42861a1dd59e Low level driver update to CoCoSDC provided by Darren.
David Ladd <drencor-xeen@users.sf.net>
parents: 3032
diff changeset
23 * Fixed bug in getSize which caused boot to fail when controller was
42861a1dd59e Low level driver update to CoCoSDC provided by Darren.
David Ladd <drencor-xeen@users.sf.net>
parents: 3032
diff changeset
24 * installed in slot 2, 3 or 4 of a Multi-Pak Interface.
42861a1dd59e Low level driver update to CoCoSDC provided by Darren.
David Ladd <drencor-xeen@users.sf.net>
parents: 3032
diff changeset
25 *
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
26 NAM llcocosdc
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
27 TTL CoCo SDC Low-level driver
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
28
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
29 USE defsfile
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
30 USE rbsuper.d
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
31 USE cocosdc.d
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
32
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
33 MPIREG equ $FF7F
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
34
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
35
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
36 tylg SET Sbrtn+Objct
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
37 atrv SET ReEnt+rev
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
38 rev SET 0
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
39
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
40
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
41 MOD eom,name,tylg,atrv,start,0
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
42
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
43 * Low-level driver static memory area inside that of rbsuper
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
44 ORG V.LLMem
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
45 V.SDCMPI rmb 1 MPI slot containing CoCo SDC
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
46 V.MaskIRQs rmb 1 contains $50 if IRQ/FIRQ should be masked
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
47
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
48 name FCS /llcocosdc/
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
49
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
50 start lbra ll_init
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
51 bra ll_read
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
52 nop
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
53 bra ll_write
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
54 nop
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
55 bra ll_getstat
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
56 nop
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
57 bra ll_setstat
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
58 nop
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
59 *** lbra ll_term ***
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
60 clrb
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
61 rts
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
62
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
63
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
64 *--------------------------------------------------------------------------
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
65 * ll_getstat
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
66 *
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
67 * Entry:
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
68 * Y = address of path descriptor
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
69 * U = address of device memory area
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
70 *
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
71 * Exit:
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
72 * CC = carry set on error
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
73 * B = error code
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
74 *
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
75 ll_getstat ldx PD.RGS,y point X at stacked registers
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
76 lda R$B,x get function code
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
77 cmpa #SS.DSize
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
78 beq getSize branch if "get disk size"
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
79 tfr a,b
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
80 andb #$F0 keep hi nibble
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
81 cmpb #CMDEXD
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
82 beq exCmd branch if extended command with data
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
83 anda #$FF-4 make sure "TFM" bit is cleared
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
84 cmpb #CMDEX
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
85 beq exCmd branch if ext command without data
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
86
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
87 *** Fall Thru ***
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
88
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
89 *--------------------------------------------------------------------------
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
90 * ll_setstat
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
91 *
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
92 * Entry:
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
93 * Y = address of path descriptor
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
94 * U = address of device memory area
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
95 *
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
96 * Exit:
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
97 * CC = carry set on error
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
98 * B = error code
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
99 *
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
100 ll_setstat comb set carry
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
101 ldb #E$UnkSvc return error
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
102 rts
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
103
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
104
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
105 *--------------------------------------------------------------------------
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
106 * SS.DSize - Return size information about a device
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
107 *
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
108 * Exit:
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
109 * Carry cleared for no error.
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
110 * A = Sector Size (1=256, 2=512, 4=1024, 8=2048)
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
111 *
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
112 * IF B = 0
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
113 * X = Number of Sectors (bits 31-16)
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
114 * Y = Number of Sectors (Bits 15-0)
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
115 *
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
116 * IF B != 0
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
117 * B = Number of Logical Sides
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
118 * X = Number of Logical Cylinders
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
119 * Y = Number of Logical Sectors/Track
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
120 *
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
121 getSize lda #CMDEX primary command code
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
122 ora PD.DRV,y combine drive num with command
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
123 ldb #'Q "Query Size" sub-command
3036
42861a1dd59e Low level driver update to CoCoSDC provided by Darren.
David Ladd <drencor-xeen@users.sf.net>
parents: 3032
diff changeset
124 leay ,u point Y at device mem
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
125 ldu #$FFFF I/O buffer = none
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
126 pshs x save frame ptr
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
127 bsr CommSDC send query to controller
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
128 puls x restore frame ptr
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
129 ldb #E$NotRdy error code
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
130 bcs sizeRet return if error
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
131 clra bits 31-24 of size always zero
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
132 ldb -1,y bits 23-16 of size
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
133 std R$X,x return bits 31-16 in X
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
134 ldd ,y bits 15-0 of size
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
135 std R$Y,x return in Y
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
136 inca A = 1: 256 byte sectors
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
137 clrb B = 0: LBA device
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
138 std R$D,x return in D
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
139 sizeRet rts
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
140
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
141
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
142 *--------------------------------------------------------------------------
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
143 * SDC Extended Device Commands
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
144 *
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
145 * Entered with SDC command code in A.
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
146 *
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
147 * Parameters are passed indirectly via the register frame:
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
148 * X = address of 256 byte I/O buffer or $FFFF if none
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
149 * U.L = optional param byte 1
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
150 * Y = optional param bytes 2 (hi) and 3 (low)
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
151 *
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
152 * Response values are returned indirectly via the register frame:
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
153 * A = controller status
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
154 * U.H = 0
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
155 * U.L = response byte 1
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
156 * Y = response bytes 2 (hi) and 3 (low)
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
157 *
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
158 exCmd pshs u,y,x preserve registers
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
159 leay ,u Y = device memory area
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
160 ldu R$X,x U = I/O buffer address
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
161 ldb R$U+1,x B = param byte 1
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
162 ldx R$Y,x X = param bytes 2 and 3
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
163 bsr CommSDC do command protocol
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
164 puls x restore register frame pointer
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
165 stb R$A,x [A] = controller status
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
166 lda #0 will clear top half of U
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
167 ldb -1,y get response byte 1 (FF49)
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
168 std R$U,x [U] = 1st response byte
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
169 ldd ,y get response bytes 2,3 (FF4A,B)
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
170 std R$Y,x [Y] = 2nd and 3rd response bytes
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
171 ldb #E$NotRdy error code
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
172 bcs exOut skip next if error
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
173 clrb no error
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
174 exOut puls y,u,pc return
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
175
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
176
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
177 *--------------------------------------------------------------------------
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
178 * ll_write
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
179 *
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
180 * Write one sector.
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
181 *
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
182 * Entry:
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
183 * Y = address of path descriptor
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
184 * U = address of device memory area
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
185 *
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
186 *
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
187 ll_write lda #CMDWRITE command code for Write
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
188 bsr sectorIO common sector I/O
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
189 bcc wrRet return if success
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
190 ldb #E$Write error code for write
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
191 wrRet rts
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
192
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
193
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
194 *--------------------------------------------------------------------------
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
195 * ll_read
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
196 *
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
197 * Read one sector.
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
198 *
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
199 * Entry:
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
200 * Y = address of path descriptor
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
201 * U = address of device memory area
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
202 *
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
203 ll_read lda #CMDREAD+4 command code for 6309 Read (TFM)
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
204 fcb $11 next instr is "LDE" on 6309
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
205 lda #CMDREAD command code for 6809 Read
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
206 bsr sectorIO common sector I/O
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
207 bcc rdRet return if success
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
208 ldb #E$Read error code for read
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
209 rdRet rts
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
210
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
211
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
212 *--------------------------------------------------------------------------
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
213 * Funnel code for sector read and write
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
214 *
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
215 * Entry:
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
216 * A = read/write command code
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
217 * Y = address of path descriptor
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
218 * U = address of device memory area
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
219 *
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
220 sectorIO ldb #1 highest drive number allowed
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
221 subb PD.DRV,y range check drive number
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
222 bcc drvOK branch if valid
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
223 ldb #E$Unit error code for bad drive number
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
224 puls x,pc pop top address then return
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
225
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
226 drvOK ora PD.DRV,y combine drive num with command
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
227 leay ,u point Y at device mem
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
228 ldb V.PhysSect,u B = hi byte of LSN
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
229 ldx V.PhysSect+1,u X = lo word of LSN
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
230 ldu V.CchPSpot,u U = buffer address
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
231
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
232 *** Fall Thru ***
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
233
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
234 *--------------------------------------------------------------------------
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
235 * CommSDC
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
236 *
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
237 * This is the core routine used for all
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
238 * transactions with the SDC controller.
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
239 *
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
240 * Entry:
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
241 * A = Command code
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
242 * B = LSN hi byte / First parameter byte
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
243 * X = LSN lo word / 2nd and third param bytes
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
244 * Y = Address of driver device memory area
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
245 * U = Address of I/O buffer ($FFFF = none)
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
246 *
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
247 * Exit:
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
248 * Carry set on error
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
249 * B = controller status code
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
250 * Y = address of SDC Data Register A (FF4A)
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
251 *
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
252 CommSDC
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
253
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
254 * Save current MPI setting and activate the SDC slot
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
255 pshs cc preserve CC (interrupt masks)
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
256 lsr ,s shift carry out of saved CC
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
257 pshs a,b save cmd code, alloc byte for saving MPI
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
258 tfr cc,a get copy of current CC
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
259 ora V.MaskIRQs,y set I and F masks if FDC present
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
260 tfr a,cc update I and F in CC
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
261 lda MPIREG get current MPI slot
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
262 sta 1,s save on stack where B was pushed
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
263 anda #$30 mask out current SCS nibble
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
264 ora V.SDCMPI,y insert SCS nibble for SDC slot
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
265 ldy #DATREGA setup Y for hardware addressing
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
266 tsta was an SDC controller found?
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
267 bmi sdcNone exit if no
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
268 sta MPIREG activate MPI slot
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
269
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
270 * Put controller in Command mode
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
271 lda #CMDMODE the magic number
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
272 sta -10,y send to control latch (FF40)
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
273 puls a pull saved command code back into A
2818
05426dd4e24e ll_init now puts CoCo SDC in enhanced mode.
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2817
diff changeset
274
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
275 * Put input parameters into the registers.
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
276 * It does no harm to put random data in the
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
277 * registers for commands which dont use them.
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
278 stb -1,y high byte to param reg 1
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
279 stx ,y low word to param regs 2 and 3
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
280
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
281 * Wait for Not Busy.
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
282 lbsr waitForIt run polling loop
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
283 bcs cmdExit exit if error or timed out
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
284
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
285 * Send command to controller
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
286 sta -2,y to command register (FF48)
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
287
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
288 * Determine if a data block should be sent.
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
289 * The code for any command which requires
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
290 * a data block will have bit 5 set.
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
291 bita #$20 test the "send block" command bit
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
292 beq rxBlock branch if no block to send
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
293
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
294 * Wait for Ready to send
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
295 bsr waitForIt run polling loop
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
296 bcs cmdExit exit if error or timed out
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
297 leax ,u move data address to X
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
298 IFGT Level-1
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
299 bita #$40 extended command or sector write?
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
300 lbne txCmd branch if extended command
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
301 ENDIF
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
302
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
303 * Send 256 bytes of data
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
304 ldd #32*256+8 32 chunks of 8 bytes
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
305 txChunk ldu ,x send one chunk...
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
306 stu ,y
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
307 ldu 2,x
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
308 stu ,y
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
309 ldu 4,x
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
310 stu ,y
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
311 ldu 6,x
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
312 stu ,y
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
313 abx point X at next chunk
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
314 deca decrement chunk counter
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
315 bne txChunk loop until all 256 bytes sent
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
316
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
317 * Wait for command to complete
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
318 txCompl lda #5 timeout retries
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
319 txWait bsr waitForIt run polling loop
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
320 bitb #BUSY test BUSY bit
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
321 beq cmdExit exit if completed
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
322 deca decrement retry counter
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
323 bne txWait repeat if until 0
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
324 coma set carry for timeout error
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
325 bra cmdExit exit
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
326
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
327 * Set error condition and exit when no SDC hardware found
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
328 sdcNone leas 1,s pop saved command code
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
329 comb set carry
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
330 ldb #E$Unit error number for missing hardware
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
331 bra cmdExit exit
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
332
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
333 * For commands which return a 256 byte response block the
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
334 * controller will set the READY bit in the Status register
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
335 * when it has the data ready for transfer. For commands
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
336 * which do not return a response block the BUSY bit will
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
337 * be cleared to indicate that the command has completed.
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
338 *
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
339 rxBlock bsr longWait run long status polling loop
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
340 bls cmdExit exit if error, time out or completed
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
341 leax 1,u test the provided buffer address
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
342 beq cmdExit exit if "no buffer" ($FFFF)
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
343 bita #$04 test the "TFM" command bit
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
344 bne rx6309 branch if set
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
345 leax ,u move data address to X
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
346 IFGT Level-1
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
347 bita #$40 extended command or sector read?
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
348 bne rxCmd branch if extended command
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
349 ENDIF
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
350
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
351 * 6809 read transfer loop into current task space
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
352 ldd #32*256+8 32 chunks of 8 bytes
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
353 rxChunk ldu ,y read one chunk...
2818
05426dd4e24e ll_init now puts CoCo SDC in enhanced mode.
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2817
diff changeset
354 stu ,x
05426dd4e24e ll_init now puts CoCo SDC in enhanced mode.
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2817
diff changeset
355 ldu ,y
05426dd4e24e ll_init now puts CoCo SDC in enhanced mode.
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2817
diff changeset
356 stu 2,x
05426dd4e24e ll_init now puts CoCo SDC in enhanced mode.
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2817
diff changeset
357 ldu ,y
05426dd4e24e ll_init now puts CoCo SDC in enhanced mode.
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2817
diff changeset
358 stu 4,x
05426dd4e24e ll_init now puts CoCo SDC in enhanced mode.
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2817
diff changeset
359 ldu ,y
05426dd4e24e ll_init now puts CoCo SDC in enhanced mode.
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2817
diff changeset
360 stu 6,x
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
361 abx update X for next chunk
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
362 deca decrement chunk counter
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
363 bne rxChunk loop until all 256 bytes transferred
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
364 bra cmdOK exit with SUCCESS
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
365
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
366 * 6309 read transfer using TFM into current task space
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
367 rx6309 fcb $10,$86,$01,$00 [ldw #256] block size = 256
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
368 orcc #$50 ensure interrupts are masked
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
369 leax 1,y point X at Data Register B (FF4B)
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
370 fcb $11,$3B,$13 [tfm x,u+] read block
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
371 cmdOK clrb status code for SUCCESS, clear carry
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
372
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
373 * Exit
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
374 cmdExit puls a pull saved MPI settings
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
375 rol ,s rotate carry into saved CC on stack
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
376 clr -10,y end command mode
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
377 sta MPIREG restore saved MPI settings
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
378 puls cc,pc restore irq masks, update carry and return
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
379
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
380
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
381 *--------------------------------------------------------------------------
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
382 * Wait for controller status to indicate either "Not Busy" or "Ready".
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
383 * Will time out if neither condition satisfied within a suitable period.
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
384 *
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
385 * Exit:
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
386 * CC.C set on error or time out.
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
387 * CC.Z set on "Not Busy" status (if carry cleared).
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
388 * B = status
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
389 * A, Y and U are preserved.
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
390 *
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
391 longWait bsr waitForIt enter here for doubled timeout
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
392 bcc waitRet return if cleared in 1st pass
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
393 waitForIt ldx #0 setup timeout counter
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
394 waitLp comb set carry for assumed FAIL
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
395 ldb -2,y read status
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
396 bmi waitRet return if FAILED
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
397 lsrb BUSY --> Carry
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
398 bcc waitDone branch if not busy
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
399 bitb #READY/2 test READY (shifted)
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
400 bne waitRdy branch if ready for transfer
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
401 bsr waitRet consume some time
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
402 ldb #$81 status = timeout
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
403 leax ,-x decrement timeout counter
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
404 beq waitRet return if timed out
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
405 bra waitLp try again
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
406
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
407 waitDone clrb Not Busy: status = 0, set Z
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
408 waitRdy rolb On Ready: clear C and Z
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
409 waitRet rts return
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
410
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
411
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
412 *--------------------------------------------------------------------------
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
413 * Transfers of command and response data require special handling
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
414 * in Level 2 due to separate address space for System/User tasks.
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
415 *
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
416 IFGT Level-1
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
417 * Send command data from User task space
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
418 txCmd bsr tskPrep B = task#, push word counter
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
419 txWord os9 F$LDABX get byte from user space buffer
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
420 sta ,y send 1st half of word
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
421 leax 1,x increment buffer address
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
422 os9 F$LDABX get byte from user space buffer
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
423 sta 1,y send 2nd half of word
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
424 leax 1,x increment buffer address
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
425 dec ,s decrement word counter
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
426 bne txWord loop if more to send
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
427 leas 1,s pop word counter
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
428 lbra txCompl go wait for command completion
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
429
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
430 tskPrep ldu D.Proc get current process ptr
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
431 ldb P$Task,u get task # for current process
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
432 lda #128 number of words to transfer (256 bytes)
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
433 ldu ,s+ half-pop return address into U
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
434 sta ,s leave word counter on the stack
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
435 tfr u,pc return
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
436
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
437 * Read response data into User task space
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
438 rxCmd bsr tskPrep B = task#, push word counter
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
439 rxWord lda ,y read 1st half of word
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
440 os9 F$STABX store in user space buffer
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
441 leax 1,x increment buffer address
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
442 lda 1,y read 2nd half of word
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
443 os9 F$STABX store in user space buffer
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
444 leax 1,x increment buffer address
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
445 dec ,s decrement word counter
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
446 bne rxWord loop if more to read
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
447 leas 1,s pop word counter
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
448 bra cmdOK exit with SUCCESS
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
449 ENDIF
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
450
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
451
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
452 *--------------------------------------------------------------------------
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
453 * ll_init
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
454 *
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
455 * Entry:
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
456 * Y = address of device descriptor
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
457 * U = address of device memory area
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
458 *
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
459 * Exit:
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
460 * CC = carry set on error
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
461 * B = error code
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
462 *
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
463 ll_init pshs cc save irq masks
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
464 orcc #$50 mask irqs
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
465 ldd #$8080 prepare "not found" values
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
466 pshs dp,b,a alloc variables on stack
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
467 ldx #CMDREG point X at FDC command reg
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
468 ldb MPIREG get current MPI slot
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
469 andb #$33 mask out the unused bits
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
470 stb 2,s save on stack (in DP position)
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
471 orb #$03 start SCS scan at slot 4
3017
545a59f51fee Changed llcocosdc read and write routines to enter and leave command mode.
tlindner
parents: 2818
diff changeset
472
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
473 chkSlot stb MPIREG activate slot being scanned
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
474 lda ,s have we already found CoCo SDC ?
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
475 bpl chkFDC branch if yes
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
476 lda #$64 test pattern
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
477 sta -6,x store at Flash Data Reg address
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
478 lda -5,x get value from Flash Ctrl Reg
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
479 clr -6,x clear Flash Data Reg
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
480 eora -5,x get changed bits from Ctrl Reg
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
481 suba #$60 did expected bits change?
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
482 bne chkFDC branch if not an SDC
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
483 stb ,s record the SDC slot
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
484 bra nxtSlot go scan next slot
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
485
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
486 chkFDC lda 1,s have we already found an FDC ?
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
487 bpl nxtSlot branch if yes
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
488 bsr fdcTest test if FDC present
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
489 bne nxtSlot branch if not present
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
490 stb 1,s record the FDC slot
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
491
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
492 nxtSlot decb decrement SCS slot number
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
493 bitb #$08 have we scanned all slots?
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
494 beq chkSlot loop if more to scan
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
495 lda ,s get slot with CoCo SDC
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
496 bmi saveSDC branch if none
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
497 cmpa 2,s same as original slot selection?
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
498 bne saveSDC branch if no
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
499 eora #$01 change original slot to..
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
500 sta 2,s ..be something else
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
501 eora #$01 back to the true SDC slot
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
502 saveSDC anda #$83 keep SDC slot number or "not found"
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
503 sta V.SDCMPI,u store SDC slot info in device mem
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
504 lda #$50 irq masks will be needed if FDC present
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
505 ldb 1,s was an FDC found?
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
506 bpl useSlot branch if yes
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
507 clra irq masks not needed
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
508 ldb 2,s get original MPI slot selection
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
509 useSlot stb MPIREG activate default MPI slot
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
510 sta V.MaskIRQs,u store irq masks in device mem
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
511 lda $FF22 reset any latched CART interrupt
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
512 leas 3,s pop variables off the stack
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
513 puls cc restore saved irq masks
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
514
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
515 * Disable Floppy Emulation capability in SDC controller
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
516 lda #$C0 primary command code
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
517 ldb #'g secondary command to "Set Global Flags"
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
518 ldx #$FF80 mask/flag bytes
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
519 leay ,u point Y at static variables
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
520 ldu #$FFFF "no buffer" address
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
521 lbsr CommSDC send command to controller
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
522 clrb no error
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
523 rts return
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
524
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
525 * Test for presence of FDC in active slot
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
526 fdcTest lda #$D0 FORCE INTERRUPT command
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
527 sta ,x send to FDC command register
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
528 bsr fdcDelay wait awhile
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
529 lda ,x read FDC status
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
530 lda 3,x read FDC data register
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
531 coma invert all bits
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
532 sta 3,x put inverted data back
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
533 bsr fdcDelay wait awhile
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
534 suba 3,x test if read matches write
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
535 fdcDelay pshs y,x,d,cc push regs
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
536 mul delay cycles
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
537 puls cc,d,x,y,pc restore regs and return
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
538
3032
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
539
3afecdae6f53 Low level CoCo SDC driver updtate from Darren Atkinson
tlindner
parents: 3017
diff changeset
540 *--------------------------------------------------------------------------
2817
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
541
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
542 EMOD
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
543 eom EQU *
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
544 END
5c6b71612ce4 Added low level CoCo SDC driver and made makefile changes for coco3 and coco3_6309 to build boot disks for this new driver.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
diff changeset
545