OpenCores
URL https://opencores.org/ocsvn/System09/System09/trunk

Subversion Repositories System09

[/] [System09/] [branches/] [before_delete/] [src/] [flex9/] [f9-dkcf8.txt] - Blame information for rev 159

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 22 dilbert57
*
2
** FLEX 9 COMPACT FLASH DISK DRIVERS
3
*
4
* FOR SYS09BUG 1.2 ON THE BURCHED B5-X300
5
* WITH I/O MAPPED AT $XE000
6
* AND ROM MAPPED AT $XF000
7
* THE BURCHED B5-X300 HAS 256KBYTES OF SRAM
8
* THE FIRST 64K IS USED BY FLEX,
9
* THE SECOND 192K MAY BE USED AS A RAM DISK
10
*
11
*
12
IMASK  EQU $10     IRQ MASK CC
13
FMASK  EQU $40     FIRQ MASK CC
14
DATREG EQU $FFF0   DAT REGISTERS
15
*
16
CF_BASE    EQU $E040
17
CF_DATA    EQU CF_BASE+0
18
CF_ERROR   EQU CF_BASE+1 ; read error
19
CF_FEATURE EQU CF_BASE+1 ; write feature
20
CF_SECCNT  EQU CF_BASE+2
21
CF_SECNUM  EQU CF_BASE+3
22
CF_CYLLO   EQU CF_BASE+4
23
CF_CYLHI   EQU CF_BASE+5
24
CF_HEAD    EQU CF_BASE+6
25
CF_STATUS  EQU CF_BASE+7 ; read status
26
CF_COMAND  EQU CF_BASE+7 ; write command
27
*
28
* Command Equates
29
*
30
CMDREAD    EQU $20 ; Read Single sector
31
CMDWRITE   EQU $30 ; Write Single sector
32
CMDFEATURE EQU $EF
33
FEAT8BIT   EQU $01 ; enable 8 bit transfers
34
HEADLBA    EQU $E0
35
*
36
* Status bit equates
37
*
38
BSY        EQU $80
39
DRDY       EQU $40
40
DRQ        EQU $08
41
ERR        EQU $01
42
       ORG   $DE00
43
*
44
* DISK DRIVER JUMP TABLE
45
*
46
READ   JMP   READSC
47
WRITE  JMP   WRITSC
48
VERIFY JMP   BUSY
49
RESTOR JMP   RESTR1
50
DRIVE  JMP   DRVSEL
51
DRVRDY JMP   CHKDRV
52
QUICK  JMP   CHKDRV
53
COLDDR JMP   INITDR
54
WARMDR JMP   WARMD1
55
SEEK   JMP   SEEKTS
56
*
57
* RAM SPACE
58
*
59
DRVNUM FCB   0
60
*
61
*
62
* INITIALIZE CF CARD FOR 8 BIT LBA MODE
63
*
64
INITDR BSR WAITRDY
65
       LDA  #HEADLBA
66
       STA  CF_HEAD
67
       LDA #FEAT8BIT
68
       STA CF_FEATURE
69
       LDA #CMDFEATURE
70
       STA CF_COMAND
71
       BRA WAITRDY
72
*
73
* RESTORE DISK DRIVER (SEEK TRACK 00)
74
*
75
RESTR1 BSR   DRVSEL
76
       CLRA           ; Track 0
77
       LDB   #$01     ; Sector 1
78
*
79
* Seek track and sector
80
* A holds track number (0 - ??)
81
* B holds sector number (1 - ??)
82
* Sector numbers starts from 1
83
* subtract 1 to start from sector 0 on CF
84
*
85
SEEKTS DECB
86
       STB  CF_SECNUM
87
       STA  CF_CYLLO
88
       LDB  DRVNUM
89
       STB  CF_CYLHI
90
       LDB  #$01
91
       STB  CF_SECCNT
92
       CLRB
93
WARMD1 RTS
94
*
95
* READ SECTORS FROM CF
96
*
97
*
98
READSC BSR  SEEKTS
99
       LDA  #CMDREAD ; IDE READ MULTIPLE
100
       STA  CF_COMAND
101
       BSR  WAITRDY
102
*
103
* READ LOOP
104
*
105
       CLRB
106
RDLP1  BSR  WAITDRQ
107
       LDA  CF_DATA
108
       STA  ,X+
109
       DECB
110
       BNE  RDLP1
111
*
112
       CLRB
113
RDLP2  BSR  WAITDRQ
114
       LDA  CF_DATA
115
       DECB
116
       BNE  RDLP2
117
*
118
       BSR  WAITRDY
119
       CLRB
120
       RTS
121
*
122
* WRITE SECTOR TO CF
123
*
124
WRITSC BSR  SEEKTS   ; SEEK TRACK & SECTOR
125
       LDA  #CMDWRITE; IDE WRITE MULTIPLE
126
       STA  CF_COMAND
127
       BSR  WAITRDY
128
*
129
* WRITE LOOP
130
*
131
       CLRB
132
WRTLP1 BSR  WAITDRQ
133
       LDA  ,X+
134
       STA  CF_DATA
135
       DECB
136
       BNE  WRTLP1
137
*
138
       CLRB
139
WRTLP2 BSR  WAITDRQ
140
       CLRA
141
       STA  CF_DATA
142
       DECB
143
       BNE WRTLP2
144
*
145
       BSR  WAITRDY
146
       CLRB
147
       RTS
148
*
149
* CHECK FOR BUSY
150
* Doubles as VERIFY
151
*
152
BUSY   CLRB            Never busy
153
       RTS
154
*
155
* DRIVE SELECT DISK DRIVER
156
*
157
DRVSEL LDA   3,X       GET DRIVE # FROM FCB
158
       CMPA  #3
159
       BLS   DRVS2     IF > 3, SET IT TO 0
160
       CLRA
161
DRVS2  STA   DRVNUM
162
       CLRB            ; SET Z, CLEAR C
163
       RTS
164
*
165
* CHECK DRIVE READY DISK DRIVER
166
*
167
CHKDRV LDA  3,X
168
       CLRB             ; CLEAR C, SET Z
169
       RTS
170
*
171
* WAIT UNTIL READY
172
*
173
WAITRDY LDA  CF_STATUS
174
        BITA #BSY
175
        BNE  WAITRDY
176
        LDA  CF_STATUS
177
        BITA #DRDY
178
        BEQ  WAITRDY
179
        RTS
180
*
181
* WAIT FOR DATA REQUEST
182
*
183
WAITDRQ LDA  CF_STATUS
184
        BITA #DRQ
185
        BEQ  WAITDRQ
186
        RTS
187
*
188
        END
189
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.