Test routine added

This commit is contained in:
Florian Reitz 2017-10-15 16:48:13 +02:00
parent 723406657e
commit f20a1d529d
4 changed files with 989 additions and 796 deletions

Binary file not shown.

View File

@ -1,19 +1,19 @@
:10000000A220A000A203A0FF2058FFBABD00018DCE :10000000A220A000A203A0FF2058FFBABD00018DCE
:10001000F807290F853D0A0A0A0A852BAA2CFFCF6B :10001000F807290F853D0A0A0A0A852BAA2CFFCF6B
:1000200020AECA9003A927002000C9C900F0010032 :1000200020AECA9003A927002000C9C900F0010032
:10003000A9018542A52BAA85436444A90885456486 :10003000A9018542A62B85436444A90885456446E9
:100040004664472CFFCF20DDCA4C0108D82058FF5A :1000400064472CFFCF20DDCA4C0108D82058FFBAE6
:10005000BABD00018DF807290F853D0A0A0A0A85F5 :10005000BD00018DF807290F853D0A0A0A0A852B84
:100060002BAA2CFFCF20AECA9004A927801BA98001 :10006000AA2CFFCF20AECA9004A927801BA9803CF0
:100070003C83C0F022A542C900F010C901F00FC9AD :1000700083C0F022A542C900F010C901F00FC902E7
:1000800002F00EC903F00DA90138604CC6CA4CDD60 :10008000F00EC903F00DA90138604CC6CA4CDDCA98
:10009000CA4C4BCB4CC1CB2000C9B0ED80D700007F :100090004C4BCB4CC1CB2000C9B0ED80D700000049
:1000A0000000000000000000000000000000000050 :1000A0000000000000000000000000000000000050
:1000B0000000000000000000000000000000000040 :1000B0000000000000000000000000000000000040
:1000C0000000000000000000000000000000000030 :1000C0000000000000000000000000000000000030
:1000D0000000000000000000000000000000000020 :1000D0000000000000000000000000000000000020
:1000E0000000000000000000000000000000000010 :1000E0000000000000000000000000000000000010
:1000F000000000000000000000000000FFFF174C9F :1000F000000000000000000000000000FFFF174BA0
:10010000D8A9039D81C0BD83C009019D83C0A907F3 :10010000D8A9039D81C0BD83C009019D83C0A907F3
:100110009D82C0A00AA9FF9D80C03C81C010FB88C1 :100110009D82C0A00AA9FF9D80C03C81C010FB88C1
:10012000D0F5BD83C029FE9D83C0A9C58540A9CB5C :10012000D0F5BD83C029FE9D83C0A9C58540A9CB5C

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
******************************** ********************************
* *
* Apple][Sd Firmware * Apple][Sd Firmware
* Version 0.6 * Version 0.7
* *
* (c) Florian Reitz, 2017 * (c) Florian Reitz, 2017
* *
@ -28,6 +28,10 @@ SLOT = $3D ; $0s
CMDLO = $40 CMDLO = $40
CMDHI = $41 CMDHI = $41
DCMD = $42 ; Command code
BUFFER = $44 ; Buffer address
BLOCK = $46 ; Block number
CURSLOT = $07F8 ; $Cs CURSLOT = $07F8 ; $Cs
DATA = $C080 DATA = $C080
CTRL = DATA+1 CTRL = DATA+1
@ -64,7 +68,6 @@ INITED = $80
LDA #$C4 LDA #$C4
STA CURSLOT STA CURSLOT
LDA #$40 LDA #$40
STA SLOT16
ELSE ELSE
JSR $FF58 JSR $FF58
@ -77,9 +80,9 @@ INITED = $80
ASL A ASL A
ASL A ASL A
ASL A ASL A
STA SLOT16 ; $s0
FIN FIN
STA SLOT16 ; $s0
TAX ; X holds now SLOT16 TAX ; X holds now SLOT16
BIT $CFFF BIT $CFFF
JSR CARDDET JSR CARDDET
@ -151,15 +154,14 @@ BOOT CMP #0 ; check for error
BRK BRK
:BOOT1 LDA #$01 :BOOT1 LDA #$01
STA $42 ; load command STA DCMD ; load command
LDA SLOT16 LDX SLOT16
TAX
STA $43 ; slot number STA $43 ; slot number
STZ $44 ; buffer lo STZ BUFFER ; buffer lo
LDA #$08 LDA #$08
STA $45 ; buffer hi STA BUFFER+1 ; buffer hi
STZ $46 ; block lo STZ BLOCK ; block lo
STZ $47 ; block hi STZ BLOCK+1 ; block hi
BIT $CFFF BIT $CFFF
JSR READ ; call driver JSR READ ; call driver
JMP $801 ; goto bootloader JMP $801 ; goto bootloader
@ -181,7 +183,6 @@ DRIVER CLD
LDA #$C4 LDA #$C4
STA CURSLOT STA CURSLOT
LDA #$40 LDA #$40
STA SLOT16
ELSE ELSE
JSR $FF58 ; find slot nr JSR $FF58 ; find slot nr
@ -194,9 +195,9 @@ DRIVER CLD
ASL A ASL A
ASL A ASL A
ASL A ASL A
STA SLOT16 ; $s0
FIN FIN
STA SLOT16 ; $s0
TAX ; X holds now SLOT16 TAX ; X holds now SLOT16
BIT $CFFF BIT $CFFF
JSR CARDDET JSR CARDDET
@ -208,7 +209,7 @@ DRIVER CLD
BIT SS,X BIT SS,X
BEQ :INIT BEQ :INIT
:CMD LDA $42 ; get command :CMD LDA DCMD ; get command
CMP #0 CMP #0
BEQ :STATUS BEQ :STATUS
CMP #1 CMP #1
@ -217,6 +218,10 @@ DRIVER CLD
BEQ :WRITE BEQ :WRITE
CMP #3 CMP #3
BEQ :FORMAT BEQ :FORMAT
DO DEBUG
CMP #$FF
BEQ :TEST
FIN
LDA #1 ; unknown command LDA #1 ; unknown command
:DONE SEC :DONE SEC
@ -230,6 +235,10 @@ DRIVER CLD
BCS :DONE ; init failure BCS :DONE ; init failure
BRA :CMD BRA :CMD
DO DEBUG
:TEST JMP TEST ; do device test
FIN
* Signature bytes * Signature bytes
@ -461,12 +470,12 @@ GETR3 JSR GETR1 ; get R1 first
* *
******************************** ********************************
BLOCK PHX ; save X GETBLOCK PHX ; save X
PHY ; save Y PHY ; save Y
LDX SLOT LDX SLOT
LDA $46 ; store block num LDA BLOCK ; store block num
STA R33,X ; in R30-R33 STA R33,X ; in R30-R33
LDA $47 LDA BLOCK+1
STA R32,X STA R32,X
LDA #0 LDA #0
STA R31,X STA R31,X
@ -604,7 +613,7 @@ STATUS LDA #0 ; no error
READ JSR CARDDET READ JSR CARDDET
BCS :ERROR ; no card inserted BCS :ERROR ; no card inserted
JSR BLOCK ; calc block address JSR GETBLOCK ; calc block address
LDA SS,X ; enable /CS LDA SS,X ; enable /CS
AND #$FF!SS0 AND #$FF!SS0
@ -629,10 +638,10 @@ READ JSR CARDDET
STA DATA,X STA DATA,X
:LOOPY STZ WORK :LOOPY STZ WORK
:LOOPW LDA DATA,X :LOOPW LDA DATA,X
STA ($44) STA (BUFFER)
INC $44 INC BUFFER
BNE :INW BNE :INW
INC $45 ; inc msb on page boundary INC BUFFER+1 ; inc msb on page boundary
:INW INC WORK :INW INC WORK
BNE :LOOPW BNE :LOOPW
DEY DEY
@ -683,7 +692,7 @@ WRITE JSR CARDDET
JSR WRPROT JSR WRPROT
BCS :WPERROR ; card write protected BCS :WPERROR ; card write protected
JSR BLOCK ; calc block address JSR GETBLOCK ; calc block address
LDA SS,X ; enable /CS LDA SS,X ; enable /CS
AND #$FF!SS0 AND #$FF!SS0
@ -701,11 +710,11 @@ WRITE JSR CARDDET
LDY #2 ; send data to card LDY #2 ; send data to card
:LOOPY STZ WORK :LOOPY STZ WORK
:LOOPW LDA ($44) :LOOPW LDA (BUFFER)
STA DATA,X STA DATA,X
INC $44 INC BUFFER
BNE :INW BNE :INW
INC $45 ; inc msb on page boundary INC BUFFER+1 ; inc msb on page boundary
:INW INC WORK :INW INC WORK
BNE :LOOPW BNE :LOOPW
DEY DEY
@ -759,6 +768,93 @@ FORMAT SEC
RTS RTS
********************************
*
* Test routine
*
********************************
DO DEBUG
TEST
* get buffer
LDA #2 ; get 512 byte buffer
JSR $BEF5 ; call GETBUFR
BCS :ERROR
STA BUFADD+1
STA BUFFER+1
STZ BUFADD
STZ BUFFER
* fill buffer
LDY #0
:LOOP TYA
STA (BUFFER),Y
INY
BNE :LOOP
INC BUFFER+1
:LOOP1 TYA
STA (BUFFER),Y
INY
BNE :LOOP1
* write to card
LDA #2 ; write cmd
STA DCMD
LDA BUFADD ; buffer address
STA BUFFER
LDA BUFADD+1
STA BUFFER+1
STZ BLOCK ; block number
STZ BLOCK+1
LDX SLOT16
JSR DRIVER
BCS :ERROR
* read from card
LDA #1 ; read cmd
STA DCMD
LDA BUFADD ; buffer address
STA BUFFER
LDA BUFADD+1
STA BUFFER+1
STZ BLOCK ; block number
STZ BLOCK+1
LDX SLOT16
JSR DRIVER
BCS :ERROR
* check for errors
LDA BUFADD ; buffer address
STA BUFFER
LDA BUFADD+1
STA BUFFER+1
LDY #0
:LOOP2 TYA
CMP (BUFFER),Y
BNE :ERRCMP ; error in buffer
INY
BNE :LOOP2
INC BUFFER+1
:LOOP3 TYA
CMP (BUFFER),Y
BNE :ERRCMP
INY
BNE :LOOP3
* free buffer
JSR $BEF8 ; call FREEBUFR
CLC
LDA #0
RTS
:ERROR BRK
:ERRCMP BRK
BUFADD DW 0
FIN
CMD0 HEX 400000 CMD0 HEX 400000
HEX 000095 HEX 000095
CMD1 HEX 410000 CMD1 HEX 410000