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

Subversion Repositories System09

[/] [System09/] [trunk/] [src/] [boot/] [bootcf8.asm] - Blame information for rev 130

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

Line No. Rev Author Line
1 59 davidgb
*******************************************************
2
*
3
* Bootstrap FLEX Loader
4
*
5
* SBUG1.8 loads the bootstap loader at $C000
6
* however the Flex adaption manual has the
7
* bootstrap loader residing at $C100
8
*
9
******************************************************
10
*
11
* Equates
12
*
13
STACK   EQU $C0FF
14
SCTBUF  EQU $C300
15
*
16
* Start of Utility
17
*
18
        ORG $C000
19
BOOT    BRA LOAD0
20
        FCB 0,0,0
21
TRK     FCB 0        File start track
22
SCT     FCB 0        File start sector
23
DNS     FCB 0        Density Flag (not used)
24
TADR    FDB $C000    Transfer address
25
LADR    FDB 0        Load Address
26
DRVNUM  FCB 0        Drive number 0
27
*
28
LOAD0   LDS  #STACK   Set up stack
29
        LDD  TRK      Set up start track and sector
30
        STD  SCTBUF
31
        LDY  #SCTBUF+256
32
*
33
* Perform actual file load
34
*
35
LOAD1   BSR GETCH    Get acharcater
36
        CMPA #$02    Data record hearder ?
37
        BEQ  LOAD2   Skip, is so
38
        CMPA #$16    Xfr address hearder ?
39
        BNE LOAD1    Loop if neither
40
*
41
* Get transfer address
42
*
43
        BSR  GETCH
44
        STA  TADR
45
        BSR  GETCH
46
        STA  TADR+1
47
        BRA  LOAD1
48
*
49
* Load data record
50
*
51
LOAD2  BSR  GETCH  Get load address
52
       STA  LADR
53
       BSR  GETCH
54
       STA  LADR+1
55
       BSR  GETCH  Get Bytes count
56
       TFR  A,B
57
       TSTB
58
       BEQ  LOAD1 Loop if count = 0
59
       LDX  LADR  Get load address
60
LOAD3  PSHS B,X
61
       BSR  GETCH  Get data character
62
       PULS B,X
63
       STA  ,X+    Store at load address
64
       DECB
65
       BNE  LOAD3  Loop until count = 0
66
       BRA  LOAD1
67
*
68
* Get Character routine
69
* Reads a sector if needed
70
*
71
GETCH  CMPY #SCTBUF+256 out of data ?
72
       BNE  GETCH4      Go read Character if not
73
GETCH2 LDX  #SCTBUF     Point to buffer
74
       LDD  0,X         Get forward Link
75
       BEQ  GO          if zero, file is loaded
76
       BSR  READ        Read next sector
77
       BNE  BOOT        start over if error
78
       LDY  #SCTBUF+4   Point past link
79
GETCH4 LDA  ,Y+         Else, get a character
80
       RTS
81
*
82
* File is loaded, Jump to it
83
*
84
GO     JMP  [TADR]      Jump to transfer address
85
 
86
*
87
** FLEX 9 COMPACT FLASH DISK DRIVERS
88
*
89
* FOR SYS09BUG 1.2 ON THE BURCHED B5-X300
90
* WITH I/O MAPPED AT $XE000
91
* AND ROM MAPPED AT $XF000
92
* THE BURCHED B5-X300 HAS 256KBYTES OF SRAM
93
* THE FIRST 64K IS USED BY FLEX,
94
* THE SECOND 192K MAY BE USED AS A RAM DISK
95
*
96
*
97
IMASK  EQU $10     IRQ MASK CC
98
FMASK  EQU $40     FIRQ MASK CC
99
DATREG EQU $FFF0   DAT REGISTERS
100
*
101
CF_BASE    EQU $E040
102
CF_DATA    EQU CF_BASE+0
103
CF_ERROR   EQU CF_BASE+1 ; read error
104
CF_FEATURE EQU CF_BASE+1 ; write feature
105
CF_SECCNT  EQU CF_BASE+2
106
CF_SECNUM  EQU CF_BASE+3
107
CF_CYLLO   EQU CF_BASE+4
108
CF_CYLHI   EQU CF_BASE+5
109
CF_HEAD    EQU CF_BASE+6
110
CF_STATUS  EQU CF_BASE+7 ; read status
111
CF_COMAND  EQU CF_BASE+7 ; write command
112
*
113
* Command Equates
114
*
115
CMDREAD    EQU $20 ; Read Single sector
116
CMDWRITE   EQU $30 ; Write Single sector
117
CMDFEATURE EQU $EF
118
FEAT8BIT   EQU $01 ; enable 8 bit transfers
119
HEADLBA    EQU $E0
120
*
121
* Status bit equates
122
*
123
BSY        EQU $80
124
DRDY       EQU $40
125
DRQ        EQU $08
126
ERR        EQU $01
127
*
128
* RESTORE DISK DRIVER (SEEK TRACK 00)
129
*
130
RESTR1 CLR  DRVNUM
131
       CLRA           ; Track 0
132
       LDB  #$01     ; Sector 1
133
*
134
* Seek track and sector
135
* A holds track number (0 - ??)
136
* B holds sector number (1 - ??)
137
* Sector numbers starts from 1
138
* subtract 1 to start from sector 0 on CF
139
*
140
SEEKTS DECB
141
       STB  CF_SECNUM
142
       STA  CF_CYLLO
143
       LDB  DRVNUM
144
       STB  CF_CYLHI
145
       LDB  #$01
146
       STB  CF_SECCNT
147
       CLRB
148
WARMD1 RTS
149
*
150
* READ SECTORS FROM CF
151
*
152
*
153
READ   BSR  SEEKTS
154
       LDA  #CMDREAD ; IDE READ MULTIPLE
155
       STA  CF_COMAND
156
       BSR  WAITRDY
157
*
158
* READ LOOP
159
*
160
       CLRB
161
RDLP1  BSR  WAITDRQ
162
       LDA  CF_DATA
163
       STA  ,X+
164
       DECB
165
       BNE  RDLP1
166
*
167
       CLRB
168
RDLP2  BSR  WAITDRQ
169
       LDA  CF_DATA
170
       DECB
171
       BNE  RDLP2
172
*
173
       BSR  WAITRDY
174
       CLRB
175
       RTS
176
*
177
* WAIT UNTIL READY
178
*
179
WAITRDY LDA  CF_STATUS
180
        BITA #BSY
181
        BNE  WAITRDY
182
        LDA  CF_STATUS
183
        BITA #DRDY
184
        BEQ  WAITRDY
185
        RTS
186
*
187
* WAIT FOR DATA REQUEST
188
*
189
WAITDRQ LDA  CF_STATUS
190
        BITA #DRQ
191
        BEQ  WAITDRQ
192
        RTS
193
*
194
        END

powered by: WebSVN 2.1.0

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