forked from Apple-2-HW/AppleIISd
Merge branch 'fixes'
This commit is contained in:
commit
996f8555de
Binary file not shown.
Binary file not shown.
@ -1,10 +1,10 @@
|
|||||||
;*******************************
|
;*******************************
|
||||||
;
|
;
|
||||||
; Apple][Sd Firmware
|
; Apple][Sd Firmware
|
||||||
; Version 1.2
|
; Version 1.2.2
|
||||||
; Defines
|
; Defines
|
||||||
;
|
;
|
||||||
; (c) Florian Reitz, 2017 - 2018
|
; (c) Florian Reitz, 2017 - 2020
|
||||||
;
|
;
|
||||||
; X register usually contains SLOT16
|
; X register usually contains SLOT16
|
||||||
; Y register is used for counting or SLOT
|
; Y register is used for counting or SLOT
|
||||||
@ -44,7 +44,6 @@ DRVNUM := $0678
|
|||||||
CURSLOT := $07F8 ; $Cs
|
CURSLOT := $07F8 ; $Cs
|
||||||
|
|
||||||
; Rom equates
|
; Rom equates
|
||||||
KNOWNRTS := $FF58
|
|
||||||
OAPPLE := $C061 ; open apple key
|
OAPPLE := $C061 ; open apple key
|
||||||
DATA := $C080
|
DATA := $C080
|
||||||
CTRL := DATA+1
|
CTRL := DATA+1
|
||||||
@ -58,7 +57,7 @@ SS0 = $01 ; SS register
|
|||||||
SDHC = $10
|
SDHC = $10
|
||||||
WP = $20
|
WP = $20
|
||||||
CD = $40
|
CD = $40
|
||||||
INITED = $80
|
CARD_INIT = $80
|
||||||
|
|
||||||
SMDRIVERVER = $120B ; Version 1.2 Beta
|
SMDRIVERVER = $120B ; Version 1.2 Beta
|
||||||
|
|
||||||
|
@ -11,12 +11,15 @@
|
|||||||
;
|
;
|
||||||
;*******************************
|
;*******************************
|
||||||
|
|
||||||
|
.export INIT
|
||||||
|
|
||||||
.import PRODOS
|
.import PRODOS
|
||||||
.import SMARTPORT
|
.import SMARTPORT
|
||||||
.import GETR1
|
.import GETR1
|
||||||
.import GETR3
|
.import GETR3
|
||||||
.import SDCMD
|
.import SDCMD
|
||||||
.import CARDDET
|
.import CARDDET
|
||||||
|
.import INITED
|
||||||
.import READ
|
.import READ
|
||||||
|
|
||||||
.include "AppleIISd.inc"
|
.include "AppleIISd.inc"
|
||||||
@ -54,25 +57,23 @@
|
|||||||
LDX #$00
|
LDX #$00
|
||||||
LDX #$03
|
LDX #$03
|
||||||
LDX #$00 ; is Smartport controller
|
LDX #$00 ; is Smartport controller
|
||||||
|
;LDX #$3C ; is a disk controller
|
||||||
|
|
||||||
SEI ; find slot
|
SEI ; find slot
|
||||||
LDA #$60 ; opcode for RTS
|
BIT $CFFF
|
||||||
STA SLOT
|
JSR KNOWNRTS
|
||||||
JSR SLOT
|
|
||||||
TSX
|
TSX
|
||||||
LDA $0100,X
|
LDA $0100,X
|
||||||
CLI
|
CLI
|
||||||
STA CURSLOT ; $Cs
|
STA CURSLOT ; $Cs
|
||||||
AND #$0F
|
AND #$0F
|
||||||
STA SLOT ; $0s
|
STA SLOT ; $0s
|
||||||
TAY ; Y holds now SLOT
|
|
||||||
ASL A
|
ASL A
|
||||||
ASL A
|
ASL A
|
||||||
ASL A
|
ASL A
|
||||||
ASL A
|
ASL A
|
||||||
STA SLOT16 ; $s0
|
STA SLOT16 ; $s0
|
||||||
TAX ; X holds now SLOT16
|
TAX ; X holds now SLOT16
|
||||||
BIT $CFFF
|
|
||||||
|
|
||||||
LDY #0 ; display copyright message
|
LDY #0 ; display copyright message
|
||||||
@DRAW: LDA TEXT,Y
|
@DRAW: LDA TEXT,Y
|
||||||
@ -95,7 +96,6 @@
|
|||||||
JMP (CMDLO)
|
JMP (CMDLO)
|
||||||
|
|
||||||
@INIT: JSR INIT
|
@INIT: JSR INIT
|
||||||
CMP #NO_ERR
|
|
||||||
BNE @NEXTSLOT ; init not successful
|
BNE @NEXTSLOT ; init not successful
|
||||||
|
|
||||||
;*******************************
|
;*******************************
|
||||||
@ -145,9 +145,8 @@ DRIVER: CLC ; ProDOS entry
|
|||||||
|
|
||||||
; Has this to be done every time this gets called or only on boot???
|
; Has this to be done every time this gets called or only on boot???
|
||||||
SEI
|
SEI
|
||||||
LDA #$60 ; opcode for RTS
|
BIT $CFFF
|
||||||
STA SLOT
|
JSR KNOWNRTS
|
||||||
JSR SLOT
|
|
||||||
TSX
|
TSX
|
||||||
LDA $0100,X
|
LDA $0100,X
|
||||||
CLI
|
CLI
|
||||||
@ -161,16 +160,9 @@ DRIVER: CLC ; ProDOS entry
|
|||||||
ASL A
|
ASL A
|
||||||
STA SLOT16 ; $s0
|
STA SLOT16 ; $s0
|
||||||
TAX ; X holds now SLOT16
|
TAX ; X holds now SLOT16
|
||||||
BIT $CFFF
|
|
||||||
|
|
||||||
JSR CARDDET
|
JSR INITED ; check for init
|
||||||
BCC @INITED
|
BCC @DISP
|
||||||
LDA #ERR_OFFLINE; no card inserted
|
|
||||||
BRA @END
|
|
||||||
|
|
||||||
@INITED: LDA #INITED ; check for init
|
|
||||||
BIT SS,X
|
|
||||||
BNE @DISP
|
|
||||||
JSR INIT
|
JSR INIT
|
||||||
BCS @END ; Init failed
|
BCS @END ; Init failed
|
||||||
|
|
||||||
@ -344,7 +336,7 @@ INIT: STZ CTRL,X ; reset SPI controller
|
|||||||
BNE @IOERROR ; error!
|
BNE @IOERROR ; error!
|
||||||
|
|
||||||
@END: LDA SS,X
|
@END: LDA SS,X
|
||||||
ORA #INITED ; initialized
|
ORA #CARD_INIT ; initialized
|
||||||
STA SS,X
|
STA SS,X
|
||||||
LDA CTRL,X
|
LDA CTRL,X
|
||||||
ORA #ECE ; enable 7MHz
|
ORA #ECE ; enable 7MHz
|
||||||
@ -359,7 +351,7 @@ INIT: STZ CTRL,X ; reset SPI controller
|
|||||||
ORA #SS0
|
ORA #SS0
|
||||||
STA SS,X
|
STA SS,X
|
||||||
TYA ; retval in A
|
TYA ; retval in A
|
||||||
RTS
|
KNOWNRTS: RTS
|
||||||
|
|
||||||
|
|
||||||
TEXT: .asciiz " Apple][Sd v1.2.2 (c)2020 Florian Reitz"
|
TEXT: .asciiz " Apple][Sd v1.2.2 (c)2020 Florian Reitz"
|
||||||
|
@ -1,23 +1,25 @@
|
|||||||
;*******************************
|
;*******************************
|
||||||
;
|
;
|
||||||
; Apple][Sd Firmware
|
; Apple][Sd Firmware
|
||||||
; Version 1.2
|
; Version 1.2.2
|
||||||
; Helper functions
|
; Helper functions
|
||||||
;
|
;
|
||||||
; (c) Florian Reitz, 2017 - 2018
|
; (c) Florian Reitz, 2017 - 2020
|
||||||
;
|
;
|
||||||
; X register usually contains SLOT16
|
; X register usually contains SLOT16
|
||||||
; Y register is used for counting or SLOT
|
; Y register is used for counting or SLOT
|
||||||
;
|
;
|
||||||
;*******************************
|
;*******************************
|
||||||
|
|
||||||
.export COMMAND
|
|
||||||
.export SDCMD
|
.export SDCMD
|
||||||
.export GETBLOCK
|
|
||||||
.export CARDDET
|
|
||||||
.export WRPROT
|
|
||||||
.export GETR1
|
.export GETR1
|
||||||
.export GETR3
|
.export GETR3
|
||||||
|
.export GETBLOCK
|
||||||
|
.export COMMAND
|
||||||
|
.export CARDDET
|
||||||
|
.export WRPROT
|
||||||
|
.export INITED
|
||||||
|
|
||||||
|
|
||||||
.include "AppleIISd.inc"
|
.include "AppleIISd.inc"
|
||||||
.segment "EXTROM"
|
.segment "EXTROM"
|
||||||
@ -212,3 +214,23 @@ WRPROT: PHA
|
|||||||
SEC
|
SEC
|
||||||
@DONE: PLA
|
@DONE: PLA
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
|
|
||||||
|
;*******************************
|
||||||
|
;
|
||||||
|
; Check if card is initialized
|
||||||
|
; X must contain SLOT16
|
||||||
|
;
|
||||||
|
; C Clear - card initialized
|
||||||
|
; Set - card not initialized
|
||||||
|
;
|
||||||
|
;*******************************
|
||||||
|
|
||||||
|
INITED: PHA
|
||||||
|
LDA #CARD_INIT ; 0: card not initialized
|
||||||
|
BIT SS,X ; 1: card initialized
|
||||||
|
CLC
|
||||||
|
BNE @DONE
|
||||||
|
SEC
|
||||||
|
@DONE: PLA
|
||||||
|
RTS
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
;*******************************
|
;*******************************
|
||||||
;
|
;
|
||||||
; Apple][Sd Firmware
|
; Apple][Sd Firmware
|
||||||
; Version 1.2
|
; Version 1.2.2
|
||||||
; ProDOS functions
|
; ProDOS functions
|
||||||
;
|
;
|
||||||
; (c) Florian Reitz, 2017 - 2018
|
; (c) Florian Reitz, 2017 - 2020
|
||||||
;
|
;
|
||||||
; X register usually contains SLOT16
|
; X register usually contains SLOT16
|
||||||
; Y register is used for counting or SLOT
|
; Y register is used for counting or SLOT
|
||||||
@ -19,6 +19,9 @@
|
|||||||
.import COMMAND
|
.import COMMAND
|
||||||
.import SDCMD
|
.import SDCMD
|
||||||
.import GETBLOCK
|
.import GETBLOCK
|
||||||
|
.import CARDDET
|
||||||
|
.import INITED
|
||||||
|
.import INIT
|
||||||
.import WRPROT
|
.import WRPROT
|
||||||
.import GETR1
|
.import GETR1
|
||||||
.import GETR3
|
.import GETR3
|
||||||
@ -67,6 +70,7 @@ PRODOS: LDA DCMD ; get command
|
|||||||
; C Clear - No error
|
; C Clear - No error
|
||||||
; Set - Error
|
; Set - Error
|
||||||
; A $00 - No error
|
; A $00 - No error
|
||||||
|
; $28 - No card inserted
|
||||||
; $2B - Card write protected
|
; $2B - Card write protected
|
||||||
; X - Blocks avail (low byte)
|
; X - Blocks avail (low byte)
|
||||||
; Y - Blocks avail (high byte)
|
; Y - Blocks avail (high byte)
|
||||||
@ -74,7 +78,12 @@ PRODOS: LDA DCMD ; get command
|
|||||||
;*******************************
|
;*******************************
|
||||||
|
|
||||||
STATUS: LDA #NO_ERR ; Thanks for this one, Antoine!
|
STATUS: LDA #NO_ERR ; Thanks for this one, Antoine!
|
||||||
JSR WRPROT
|
JSR CARDDET
|
||||||
|
BCC @WRPROT
|
||||||
|
LDA #ERR_NODRIVE; no card inserted
|
||||||
|
BNE @DONE
|
||||||
|
|
||||||
|
@WRPROT: JSR WRPROT
|
||||||
BCC @DONE
|
BCC @DONE
|
||||||
LDA #ERR_NOWRITE; card write protected
|
LDA #ERR_NOWRITE; card write protected
|
||||||
|
|
||||||
@ -94,10 +103,20 @@ STATUS: LDA #NO_ERR ; Thanks for this one, Antoine!
|
|||||||
; Set - Error
|
; Set - Error
|
||||||
; A $00 - No error
|
; A $00 - No error
|
||||||
; $27 - Bad block number
|
; $27 - Bad block number
|
||||||
|
; $28 - No card inserted
|
||||||
;
|
;
|
||||||
;*******************************
|
;*******************************
|
||||||
|
|
||||||
READ: JSR GETBLOCK ; calc block address
|
READ: JSR CARDDET ; check for card
|
||||||
|
BCS @NDERROR ; no card
|
||||||
|
|
||||||
|
JSR INITED ; check for initialization
|
||||||
|
BCC @GETBLOCK
|
||||||
|
|
||||||
|
JSR INIT ; initialize card
|
||||||
|
BCS @NDERROR ; init failed
|
||||||
|
|
||||||
|
@GETBLOCK: JSR GETBLOCK ; calc block address
|
||||||
|
|
||||||
LDA SS,X ; enable /CS
|
LDA SS,X ; enable /CS
|
||||||
AND #<~SS0
|
AND #<~SS0
|
||||||
@ -105,7 +124,7 @@ READ: JSR GETBLOCK ; calc block address
|
|||||||
LDA #$51 ; send CMD17
|
LDA #$51 ; send CMD17
|
||||||
JSR COMMAND ; send command
|
JSR COMMAND ; send command
|
||||||
CMP #0
|
CMP #0
|
||||||
BNE @ERROR ; check for error
|
BNE @IOERROR ; check for error
|
||||||
|
|
||||||
@GETTOK: LDA #DUMMY ; get data token
|
@GETTOK: LDA #DUMMY ; get data token
|
||||||
STA DATA,X
|
STA DATA,X
|
||||||
@ -150,10 +169,14 @@ READ: JSR GETBLOCK ; calc block address
|
|||||||
PLP
|
PLP
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
@ERROR: SEC ; an error occured
|
@IOERROR: SEC ; an error occured
|
||||||
LDA #ERR_IOERR
|
LDA #ERR_IOERR
|
||||||
BRA @DONE
|
BRA @DONE
|
||||||
|
|
||||||
|
@NDERROR: SEC ; an error occured
|
||||||
|
LDA #ERR_NODRIVE
|
||||||
|
BRA @DONE
|
||||||
|
|
||||||
|
|
||||||
;*******************************
|
;*******************************
|
||||||
;
|
;
|
||||||
|
@ -95,8 +95,10 @@ SMARTPORT: LDY #SMZPSIZE-1 ; save zeropage area for Smarport
|
|||||||
BCC @RESTZP
|
BCC @RESTZP
|
||||||
|
|
||||||
TXA
|
TXA
|
||||||
|
;warum feste anzahl an bytes für return wert?
|
||||||
LDY #2 ; highbyte of # bytes transferred
|
LDY #2 ; highbyte of # bytes transferred
|
||||||
LDX #0 ; low byte of # bytes transferred
|
LDX #0 ; low byte of # bytes transferred
|
||||||
|
;warum wird mit #1 verglichen?
|
||||||
CMP #1 ; C=1 if A != NO_ERR
|
CMP #1 ; C=1 if A != NO_ERR
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user