mirror of
https://github.com/freitz85/AppleIISd.git
synced 2024-11-25 17:40:35 +00:00
inited flag in fpga
This commit is contained in:
parent
19632c05dc
commit
30f6b89f2b
BIN
AppleIISd.bin
BIN
AppleIISd.bin
Binary file not shown.
1420
AppleIISd.lst
1420
AppleIISd.lst
File diff suppressed because it is too large
Load Diff
62
AppleIISd.s
62
AppleIISd.s
@ -37,15 +37,16 @@ R30 = $0478
|
|||||||
R31 = $04F8
|
R31 = $04F8
|
||||||
R32 = $0578
|
R32 = $0578
|
||||||
R33 = $05F8
|
R33 = $05F8
|
||||||
INITED = $0678
|
|
||||||
|
|
||||||
* Constants
|
* Constants
|
||||||
|
|
||||||
SSNONE = $0F
|
|
||||||
SS0 = $0E
|
|
||||||
DUMMY = $FF
|
DUMMY = $FF
|
||||||
FRXEN = $17
|
FRX = $10 ; CTRL register
|
||||||
FRXDIS = $07
|
ECE = $04
|
||||||
|
SS0 = $01 ; SS register
|
||||||
|
WP = $20
|
||||||
|
CARDDET = $40
|
||||||
|
INITED = $80
|
||||||
|
|
||||||
|
|
||||||
* signature bytes
|
* signature bytes
|
||||||
@ -191,10 +192,10 @@ DRIVER CLD
|
|||||||
TAX ; X holds now SLOT16
|
TAX ; X holds now SLOT16
|
||||||
|
|
||||||
BIT $CFFF
|
BIT $CFFF
|
||||||
LDY SLOT
|
LDA #INITED ; check for init
|
||||||
LDA INITED,Y ; check for init
|
BIT SS,X
|
||||||
CMP #$01
|
BEQ :INIT
|
||||||
BCC :INIT
|
|
||||||
:CMD LDA $42 ; get command
|
:CMD LDA $42 ; get command
|
||||||
CMP #$00
|
CMP #$00
|
||||||
BEQ :STATUS
|
BEQ :STATUS
|
||||||
@ -240,7 +241,8 @@ DRIVER CLD
|
|||||||
INIT CLD
|
INIT CLD
|
||||||
LDA #$03 ; set SPI mode 3
|
LDA #$03 ; set SPI mode 3
|
||||||
STA CTRL,X
|
STA CTRL,X
|
||||||
LDA #SSNONE
|
LDA SS,X
|
||||||
|
ORA #SS0 ; set CS high
|
||||||
STA SS,X
|
STA SS,X
|
||||||
LDA #7
|
LDA #7
|
||||||
STA DIV,X
|
STA DIV,X
|
||||||
@ -252,7 +254,8 @@ INIT CLD
|
|||||||
BPL :WAIT
|
BPL :WAIT
|
||||||
DEY
|
DEY
|
||||||
BNE :LOOP ; do 10 times
|
BNE :LOOP ; do 10 times
|
||||||
LDA #SS0 ; set CS low
|
LDA SS,X
|
||||||
|
AND #$FF!SS0 ; set CS low
|
||||||
STA SS,X
|
STA SS,X
|
||||||
|
|
||||||
LDA #<CMD0 ; send CMD0
|
LDA #<CMD0 ; send CMD0
|
||||||
@ -336,8 +339,12 @@ INIT CLD
|
|||||||
BNE :IOERROR ; error!
|
BNE :IOERROR ; error!
|
||||||
|
|
||||||
:END LDY SLOT
|
:END LDY SLOT
|
||||||
LDA #$01
|
LDA SS,X
|
||||||
STA INITED,Y ; initialized
|
ORA #INITED ; initialized
|
||||||
|
STA SS,X
|
||||||
|
LDA CTRL,X
|
||||||
|
ORA #ECE ; enable 7MHz
|
||||||
|
STA CTRL,X
|
||||||
CLC ; all ok
|
CLC ; all ok
|
||||||
LDY #0
|
LDY #0
|
||||||
BCC :END1
|
BCC :END1
|
||||||
@ -346,10 +353,9 @@ INIT CLD
|
|||||||
BCS :END1
|
BCS :END1
|
||||||
:IOERROR SEC
|
:IOERROR SEC
|
||||||
LDY #$27 ; init error
|
LDY #$27 ; init error
|
||||||
:END1 LDA #SSNONE ; deselect card
|
:END1 LDA SS,X ; set CS high
|
||||||
|
ORA #SS0
|
||||||
STA SS,X
|
STA SS,X
|
||||||
LDA #7 ; enable 7MHz
|
|
||||||
STA CTRL,X
|
|
||||||
LDA #0 ; set div to 2
|
LDA #0 ; set div to 2
|
||||||
STA DIV,X
|
STA DIV,X
|
||||||
TYA ; retval in A
|
TYA ; retval in A
|
||||||
@ -535,7 +541,8 @@ STATUS CLC ; no error
|
|||||||
|
|
||||||
READ JSR BLOCK ; calc block address
|
READ JSR BLOCK ; calc block address
|
||||||
|
|
||||||
LDA #SS0 ; enable /CS
|
LDA SS,X ; enable /CS
|
||||||
|
AND #$FF!SS0
|
||||||
STA SS,X
|
STA SS,X
|
||||||
LDA #$51 ; send CMD17
|
LDA #$51 ; send CMD17
|
||||||
JSR COMMAND ; send command
|
JSR COMMAND ; send command
|
||||||
@ -550,7 +557,8 @@ READ JSR BLOCK ; calc block address
|
|||||||
BNE :GETTOK ; wait for $FE
|
BNE :GETTOK ; wait for $FE
|
||||||
|
|
||||||
LDY #2 ; read data from card
|
LDY #2 ; read data from card
|
||||||
LDA #FRXEN ; enable FRX
|
LDA CTRL,X ; enable FRX
|
||||||
|
ORA #FRX
|
||||||
STA CTRL,X
|
STA CTRL,X
|
||||||
LDA #DUMMY
|
LDA #DUMMY
|
||||||
STA DATA,X
|
STA DATA,X
|
||||||
@ -565,19 +573,22 @@ READ JSR BLOCK ; calc block address
|
|||||||
DEY
|
DEY
|
||||||
BNE :LOOPY
|
BNE :LOOPY
|
||||||
|
|
||||||
LDA #FRXDIS ; disable FRX
|
LDA CTRL,X ; disable FRX
|
||||||
|
AND #$FF!FRX
|
||||||
STA CTRL,X
|
STA CTRL,X
|
||||||
|
|
||||||
:CRC LDA #DUMMY ; first crc byte has
|
:CRC LDA #DUMMY ; first crc byte has
|
||||||
STA DATA,X ; already been read
|
STA DATA,X ; already been read
|
||||||
|
|
||||||
LDA #SSNONE
|
LDA SS,X
|
||||||
|
ORA #SS0
|
||||||
STA SS,X ; disable /CS
|
STA SS,X ; disable /CS
|
||||||
CLC ; no error
|
CLC ; no error
|
||||||
LDA #$00
|
LDA #$00
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
:ERROR LDA #SSNONE
|
:ERROR LDA SS,X
|
||||||
|
ORA #SS0
|
||||||
STA SS,X ; disable /CS
|
STA SS,X ; disable /CS
|
||||||
SEC ; an error occured
|
SEC ; an error occured
|
||||||
LDA #$27
|
LDA #$27
|
||||||
@ -604,7 +615,8 @@ READ JSR BLOCK ; calc block address
|
|||||||
|
|
||||||
WRITE JSR BLOCK ; calc block address
|
WRITE JSR BLOCK ; calc block address
|
||||||
|
|
||||||
LDA #SS0 ; enable /CS
|
LDA SS,X ; enable /CS
|
||||||
|
AND #$FF!SS0
|
||||||
STA SS,X
|
STA SS,X
|
||||||
LDA #$58 ; send CMD24
|
LDA #$58 ; send CMD24
|
||||||
JSR COMMAND ; send command
|
JSR COMMAND ; send command
|
||||||
@ -644,7 +656,8 @@ WRITE JSR BLOCK ; calc block address
|
|||||||
CMP #$00
|
CMP #$00
|
||||||
BEQ :WAIT6
|
BEQ :WAIT6
|
||||||
|
|
||||||
LDA #SSNONE ; disable /CS
|
LDA SS,X ; disable /CS
|
||||||
|
ORA #SS0
|
||||||
STA SS,X
|
STA SS,X
|
||||||
CLC ; no error
|
CLC ; no error
|
||||||
LDA #0
|
LDA #0
|
||||||
@ -656,7 +669,8 @@ WRITE JSR BLOCK ; calc block address
|
|||||||
CMP #$00
|
CMP #$00
|
||||||
BEQ :ERROR
|
BEQ :ERROR
|
||||||
|
|
||||||
LDA #SSNONE
|
LDA SS,X
|
||||||
|
ORA #SS0
|
||||||
STA SS,X ; disable /CS
|
STA SS,X ; disable /CS
|
||||||
SEC ; an error occured
|
SEC ; an error occured
|
||||||
LDA #$27
|
LDA #$27
|
||||||
|
Loading…
Reference in New Issue
Block a user