polished and cleaned-up; updated all flashers.

This commit is contained in:
Jakub Husak
2023-07-18 10:08:26 +02:00
parent a21517838c
commit b767c0ce9e
19 changed files with 193 additions and 127 deletions
+33 -19
View File
@@ -1,30 +1,41 @@
TRIGGER_FORMAT_39SF equ $10
TRIGGER_CHIPFORMAT_39SF equ $10
TRIGGER_SECTORFORMAT_39SF equ $30
C_FORMAT_39SF equ $80
C_BYTE_PROG_39SF equ $a0
M_SSIZE_39SF equ $1000 ; sector size
command_ZP_39SF = $f0
M_SSIZE_39SF equ $10 ; sector size
M_VECTORS_39SF
jmp softid_entry_39SF
jmp softid_exit_39SF
jmp flashoppreamble_39SF
jmp flash_formatchip_39SF
jmp flash_formatsector_39SF
jmp flash_writebytepreamble_39SF
jmp flash_lockchip_39SF
jmp flash_unlockchip_39SF
jmp flash_wait_unit_29F
jmp flash_wait_unit_39SF
dta M_SSIZE_39SF
dta c'39SF0x0',0
flashoppreamble_39SF ; preserves X
pha
flash_writebytepreamble_39SF
lda #C_BYTE_PROG_39SF
scc
bne flashoppreamble_acc_39SF
flash_formatsector_39SF
lda #TRIGGER_SECTORFORMAT_39SF
dta {bit.w} ; skip next 2 bytes
; main entry
; c set ->format (either chip or sector)
; c cleared ->byte write
flash_formatchip_39SF ; preserves X
lda #TRIGGER_CHIPFORMAT_39SF
sta flash_fmcommand_39SF
lda #C_FORMAT_39SF ; only if c set
sta command_ZP_39SF
pla
.byte {bit.w}
; entry for command in A, mainly for sector format
flashoppreamble_acc_39SF ; 39sf0x0, 29F040
sta command_ZP_39SF
sta command_39SF
stx flash_format_storex_39SF
txa
pha
; when write byte x must be set to either 0 or 40 temporarily
and #$40
tax
@@ -34,18 +45,22 @@ flashoppreamble_acc_39SF ; 39sf0x0, 29F040
mva #$55 $aaaa ; $2aaa<$55
; $5555<$80
sta $d502,x
mva command_ZP_39SF $b555; will become command: FORMAT/ID_MODE/BYTE_PROG
mva command_39SF:#0 $b555; will become command: FORMAT/ID_MODE/BYTE_PROG
cmp #C_FORMAT_39SF
bne @+ ; if not FORMAT, procedure finishes
bne flash_format_39SF_exit ; if not FORMAT, procedure finishes
; FORMAT part, more to write
sta $d502,x
mva #$aa $b555 ; $5555<$aa
sta $d501,x
mva #$55 $aaaa ; $2aaa<$55
sta $d502,x
mva #$10 $b555 ; $5555<$10
@ pla
tax
lda flash_fmcommand_39SF:#TRIGGER_CHIPFORMAT_39SF
cmp #TRIGGER_CHIPFORMAT_39SF
sne
sta $b555 ; $5555<$10
flash_format_39SF_exit
ldx flash_format_storex_39SF:#0
sta $d500,x
flash_lockchip_39SF
flash_unlockchip_39SF
flash_wait_unit_39SF
@@ -67,7 +82,6 @@ softid_exit_39SF
sta $a000
rts
softid_entry_39SF
lda #$90
bne flashoppreamble_acc_39SF