mirror of
https://github.com/Pecusx/jataricart.git
synced 2026-05-20 22:33:22 +02:00
added verify empty flash before formatting
This commit is contained in:
+13
-8
@@ -175,7 +175,7 @@ FORMAT
|
|||||||
ldx #0
|
ldx #0
|
||||||
jsr flashformatchip
|
jsr flashformatchip
|
||||||
bcs formatfailed
|
bcs formatfailed
|
||||||
jsr flashend ; restores display etc.
|
jsr flashend ; restores display etc. preserves all
|
||||||
.if .def TWOCHIPS
|
.if .def TWOCHIPS
|
||||||
jsr printdone
|
jsr printdone
|
||||||
jsr printformatting
|
jsr printformatting
|
||||||
@@ -184,7 +184,7 @@ FORMAT
|
|||||||
ldx #$40
|
ldx #$40
|
||||||
jsr flashformatchip
|
jsr flashformatchip
|
||||||
bcs formatfailed
|
bcs formatfailed
|
||||||
jsr flashend ; restores display etc.
|
jsr flashend ; restores display etc. preserves all
|
||||||
.endif
|
.endif
|
||||||
printdone jsr print
|
printdone jsr print
|
||||||
dta c'done:)',$9b,0
|
dta c'done:)',$9b,0
|
||||||
@@ -196,6 +196,7 @@ printformatting
|
|||||||
rts
|
rts
|
||||||
|
|
||||||
formatfailed
|
formatfailed
|
||||||
|
jsr flashend
|
||||||
jsr print
|
jsr print
|
||||||
dta c'failed:(',$9b,'Waiting for reboot...',$9b,0
|
dta c'failed:(',$9b,'Waiting for reboot...',$9b,0
|
||||||
jmp *
|
jmp *
|
||||||
@@ -231,7 +232,6 @@ CHECKINIT
|
|||||||
mwa #_DEST _cdst
|
mwa #_DEST _cdst
|
||||||
sei
|
sei
|
||||||
CHECK
|
CHECK
|
||||||
|
|
||||||
mva #0 badcompare_counter
|
mva #0 badcompare_counter
|
||||||
sta badcompare_counter+1
|
sta badcompare_counter+1
|
||||||
ldx BankNum
|
ldx BankNum
|
||||||
@@ -241,21 +241,25 @@ _csrc equ * + 1
|
|||||||
lda $6000 ; src
|
lda $6000 ; src
|
||||||
_cdst equ * + 1
|
_cdst equ * + 1
|
||||||
cmp $A000 ; dst
|
cmp $A000 ; dst
|
||||||
beq @+
|
beq _byte_ok
|
||||||
lda _csrc
|
lda _csrc
|
||||||
ldx _csrc+1
|
ldx _csrc+1
|
||||||
jsr BADCOMPARE
|
jsr BADCOMPARE
|
||||||
@ inw _csrc
|
_byte_ok
|
||||||
|
inw _csrc
|
||||||
inw _cdst
|
inw _cdst
|
||||||
lda _csrc+1
|
lda _csrc+1
|
||||||
cmp #>_SOURCE+$20
|
cmp #>_SOURCE+$20
|
||||||
bne checkloop
|
bne checkloop
|
||||||
cpw #0 badcompare_counter
|
cpw #0 badcompare_counter
|
||||||
beq @+
|
beq _all_bytes_ok
|
||||||
|
; several differences found...
|
||||||
|
; cart off
|
||||||
sta $d580
|
sta $d580
|
||||||
lda $d013
|
lda $d013
|
||||||
sta $3fa
|
sta $3fa
|
||||||
cli
|
cli
|
||||||
|
; print status
|
||||||
jsr print
|
jsr print
|
||||||
dta 253,c'non-match byte#:',0
|
dta 253,c'non-match byte#:',0
|
||||||
lda badcompare_counter+1
|
lda badcompare_counter+1
|
||||||
@@ -266,13 +270,14 @@ _cdst equ * + 1
|
|||||||
dta c' (START-cont)',0
|
dta c' (START-cont)',0
|
||||||
|
|
||||||
lda #7
|
lda #7
|
||||||
cmp CONSOL
|
cmp CONSOL ; wait for consol
|
||||||
req
|
req
|
||||||
|
|
||||||
jsr printnl
|
jsr printnl
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
@ sta $d580
|
_all_bytes_ok
|
||||||
|
sta $d580
|
||||||
lda $d013
|
lda $d013
|
||||||
sta $3fa
|
sta $3fa
|
||||||
cli
|
cli
|
||||||
|
|||||||
+18
-13
@@ -145,22 +145,26 @@ flashformatchip1
|
|||||||
; PROCEDURE
|
; PROCEDURE
|
||||||
; x = 0 or 0x40 - flash chip address.
|
; x = 0 or 0x40 - flash chip address.
|
||||||
flashformatchip
|
flashformatchip
|
||||||
|
; first check if not formatted
|
||||||
sei
|
|
||||||
stx store_x
|
stx store_x
|
||||||
|
jsr flashcheckempty
|
||||||
|
bcc flashformatexit
|
||||||
|
sei
|
||||||
sec ; will format flash!
|
sec ; will format flash!
|
||||||
|
ldx store_x
|
||||||
lda #flashoppreamble
|
lda #flashoppreamble
|
||||||
jsr jsrtovectorproc ; preserves A
|
jsr jsrtovectorproc ; preserves A
|
||||||
; not needed to mva $ff flashcmp
|
; not needed to mva $ff flashcmp
|
||||||
jsr wait4flashcheckresult ; waits for format finished
|
jsr wait4flashcheckresult ; waits for format finished
|
||||||
; then check number of banks for FFs
|
; then check number of banks for FFs
|
||||||
|
flashcheckempty
|
||||||
lda #$3f ; this depends on flash size, $0f, $1f, $3f
|
lda #$3f ; this depends on flash size, $0f, $1f, $3f
|
||||||
sta flashformatcounter
|
sta flashformatcounter
|
||||||
flashbankloop sei
|
flashbankloop sei
|
||||||
ldx store_x
|
ldx store_x
|
||||||
flashformatcounter equ*+1
|
flashformatcounter equ*+1
|
||||||
sta $d5FF,x ; set chip (x) and bank
|
sta $d5FF,x ; set chip (x) and bank
|
||||||
; set pages count
|
; set pages count, 8kB
|
||||||
ldy #$20
|
ldy #$20
|
||||||
; reset address
|
; reset address
|
||||||
lda #$a0
|
lda #$a0
|
||||||
@@ -170,7 +174,17 @@ flashformatcounter equ*+1
|
|||||||
bcs flashformatexit ; format error if c set
|
bcs flashformatexit ; format error if c set
|
||||||
dec flashformatcounter
|
dec flashformatcounter
|
||||||
bpl flashbankloop
|
bpl flashbankloop
|
||||||
flashformatexit jmp flashcartoff ; preserves C
|
flashformatexit
|
||||||
|
flashcartoff ; preserves C
|
||||||
|
pha
|
||||||
|
sta $d580
|
||||||
|
lda $d013
|
||||||
|
sta $3fa
|
||||||
|
cli
|
||||||
|
pla
|
||||||
|
rts
|
||||||
|
|
||||||
|
; --------------------------
|
||||||
store_x dta 0
|
store_x dta 0
|
||||||
|
|
||||||
; --------------------------
|
; --------------------------
|
||||||
@@ -399,12 +413,3 @@ flashsetbank
|
|||||||
sta $3fa
|
sta $3fa
|
||||||
rts
|
rts
|
||||||
|
|
||||||
flashcartoff
|
|
||||||
pha
|
|
||||||
sta $d580
|
|
||||||
lda $d013
|
|
||||||
sta $3fa
|
|
||||||
cli
|
|
||||||
pla
|
|
||||||
rts
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ echo Copy $outfile to card?
|
|||||||
read
|
read
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
[ -d "$vol" ] && cp "$outfile" "$vol"/ATARI/ && { eject; exit; }
|
[ -d "$vol" ] && cp -v "$outfile" "$vol"/ATARI/ && { eject; exit; }
|
||||||
echo Waiting for card inserted...
|
echo Waiting for card inserted...
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user