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

Subversion Repositories System09

[/] [System09/] [branches/] [mkfiles_rev1/] [src/] [Flex9/] [f9-dkram.asm] - Blame information for rev 150

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

Line No. Rev Author Line
1 42 davidgb
*
2
** FLEX 9 DISK DRIVERS
3
*
4
* FOR SYS09BUG ON THE DIGILENT SPARTAN 3 STARTER BOARD
5
* WITH I/O MAPPED AT $XE000
6
* AND ROM MAPPED AT $XF000
7
* THE DIGILENT SPARTAN 3 STARTER BOARD HAS 1MBYTE OF SRAM
8
* THE FIRST 64K IS USED BY FLEX,
9
* THE SECOND 192K IS USED AS A ROM DISK
10
* THE REMAINING RAM IS USED FOR A RAM DISK
11
*
12
* These drivers should also work on the B5-X300 board
13
* although there is only enough room for the ROM Disk.
14
*
15
IMASK  EQU $10     IRQ MASK CC
16
FMASK  EQU $40     FIRQ MASK CC
17
TRPAGE EQU $0E     PAGE $E000 DAT ADDRESS
18
DATREG EQU $FFF0   DAT REGISTERS
19
       ORG   $DE00
20
*
21
* DISK DRIVER JUMP TABLE LAST UPDATE: 22/12/2006
22
* Disk driver for RAM Disk.
23
*
24
* 14 SECTORS PER TRACK
25
* 16 * N TRACKS PER DISK
26
*
27
* ROM DISK OCCUPIES $10000 - $1E000, $20000 - $2E000, $30000 - $3E000
28
* RAM DISK OCCUPIES $40000 - $4E000 ... $F0000 - $FE000
29
* Track Buffer page mapped at $E000 - $EFFF
30
* TRPAGE = $0E = 14 x $1000 (4 K pages)
31
* LEAST SIGNIFICANT NYBBLE OF THE DAT IS INVERTED
32
* ON SWTPC ROM AT $XF000 AND IO AT $XE000
33
* APPEARS THROUGHOUT THE MEMORY SO MUST BE SKIPPED OVER
34
* WHEN USING RAM AS A RAMDISK.
35
* THE MSN OF THE TRACK MAPS INTO THE MSN OF THE DAT
36
* THE LSN OF THE TRACK NUMBER INDEXES INTO THE 4K RAM PAGE
37
* THE SECTOR MAPS INTO THE LSN OF THE DAT WHICH IS INVERTED
38
*
39
*
40
READ   JMP   READSC
41
WRITE  JMP   WRITSC
42
VERIFY JMP   BUSY
43
RESTOR JMP   RESTR1
44
DRIVE  JMP   DRVSEL
45
DRVRDY JMP   CHKDRV
46
QUICK  JMP   CHKDRV
47
COLDDR JMP   INITDR
48
WARMDR JMP   WARMD1
49
SEEK   JMP   SEEKTS
50
*
51
* RAM SPACE
52
*
53
WRKDR  FDB   0
54
WRKTR  FDB   0,0,0,0
55
SECPTR FDB   0
56
TRKCNT FCB   0
57
SECCNT FCB   0
58
VERERR FCB   0
59
CCSAVE FCB   0
60
*
61
DRVBAS FCB   $10  DRIVE 0
62
       FCB   $40  DRIVE 1
63
       FCB   $40  DRIVE 2
64
       FCB   $40  DRIVE 3
65
*
66
INITDR RTS
67
WARMD1 RTS
68
*
69
* Seek track and sector
70
* A holds track number (0-32)
71
* B holds sector number (1-14)
72
*
73
SEEKTS STA  TRKCNT
74
       STB  SECCNT
75
       ANDCC  #$FE   ; CLEAR CARRY
76
       ORCC   #$40   ; SET Z
77
       RTS
78
*
79
* MAP RAM DISK INTO I/O SPACE
80
*
81
MAPIN  TFR   CC,A     ; Save state of interrupt masks
82
       STA   CCSAVE
83
       ORCC  #FMASK+IMASK ; Mask interrupts while IO mapped out
84
       LDA   TRKCNT
85
       LDU   #DRVBAS  ; Point to Drive base offset
86
       LDB   WRKDR    ; Get working drive number
87
       ADDA  B,U      ; Add Base offset into RAM
88
       ANDA  #$F0     ; Mask MSN
89
       STA   ,-S      ; Save A on stack
90
*
91
       LDA   SECCNT
92
       SUBA  #1       ; Sectors 1 to 14 => 0 to 13
93
       EORA  #$0F     ; Complement LSNybble
94
       ANDA  #$0F
95
*
96
       ADDA  ,S+       ; Add sector to LSN of Track and pop
97
       STA   DATREG+TRPAGE
98
*
99
       LDA   TRKCNT   ; LSN of Track indexes into 4K page
100
       ANDA  #$0F
101
       ADDA  #TRPAGE*16
102
       STA   SECPTR
103
       CLR   SECPTR+1
104
       LDU   SECPTR
105
       RTS
106
*
107
* MAP RAM DISK OUT OF MEMORY
108
*
109
MAPOUT LDA   #TRPAGE  ; Point to the I/O page
110
       EORA  #$0F     ; Complement LSNybble
111
       STA   DATREG+TRPAGE ; map in I/O page
112
       LDA   CCSAVE   ; restore interrupt masks
113
       TFR   A,CC
114
       RTS
115
*
116
* READ DISK DRIVER
117
*
118
READSC LBSR  SEEKTS   ; SEEK TRACK & SECTOR
119
       PSHS  U,X
120
       BSR   MAPIN    ; MAP RAM DISK INTO I/O SPACE
121
*
122
       CLRB
123
READ3  LDA  ,U+
124
       STA  ,X+       ; Move Sector to FCB
125
       INCB
126
       BNE   READ3
127
*
128
       BSR  MAPOUT    ; MAP RAM DISK OUT OF I/O SPACE
129
       CLRB           ; Z SET C CLEAR
130
       PULS U,X,PC    ; Restore registers and return
131
*
132
* WRITE DISK DRIVER
133
*
134
WRITSC BSR   SEEKTS   ; SEEK TRACK & SECTOR
135
       PSHS  U,X
136
       BSR   MAPIN    ; MAP RAM DISK INTO I/O SPACE
137
*
138
       CLRB
139
WRIT3  LDA   ,X+      ; COPY FCB BLOCK TO RAM DISK
140
       STA   ,U+
141
       INCB
142
       BNE    WRIT3
143
*
144
       BSR    MAPOUT  ; MAP OUT RAM DISK
145
       CLRB           ; SET Z, CLEAR C
146
       PULS   U,X,PC  ; Restore registers and return
147
*
148
* RESTORE DISK DRIVER (SEEK TRACK 00)
149
*
150
RESTR1 PSHS A
151
       CLRA           ; Track 0
152
       LDAB  #$01     ; Sector 1
153
       LBSR  SEEKTS
154
       PULS  A,PC
155
*
156
* CHECK FOR BUSY
157
* Doubles as VERIFY
158
*
159
BUSY   CLRB            Never busy
160
       RTS
161
*
162
* DRIVE SELECT DISK DRIVER
163
*
164
DRVSEL PSHS  X
165
       LDA   3,X       GET DRIVE # FROM FCB
166
       CMPA  #3
167
       BLS   DRVS2     IF > 3, SET IT TO 0
168
       CLRA
169
DRVS2  BSR   MXWT      MOVE X TO WORKING TRK
170
       LDB   TRKCNT
171
       STB   0,X       SAVE TRACK
172
       STA   WRKDR     SAVE DESIRED DRV AS WORKING DRV
173
       BSR   MXWT      MOVE X TO WORKING TRK
174
       LDA   0,X       GET WORKING TRK ON DESIRED DRV
175
       STA   TRKCNT    UPDATE 1771 TRACK REG
176
       CLRB            ; SET Z, CLEAR C
177
       PULS   X,PC
178
*
179
* MOVE INDEX REG TO POINT TO
180
* WORKING TRACK STORAGE
181
*
182
MXWT   LDX   #WRKTR    POINT TO START OF STG
183
       LDB   WRKDR     GET WORKING DRIVE
184
       ABX
185
MXWT2  RTS
186
*
187
* CHECK DRIVE READY DISK DRIVER
188
*
189
CHKDRV LDA   3,X
190
       CLRB             ; CLEAR C, SET Z
191
       RTS
192
 END

powered by: WebSVN 2.1.0

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