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_29F equ $10
TRIGGER_CHIPFORMAT_29F equ $10
TRIGGER_SECTORFORMAT_29F equ $30
C_FORMAT_29F equ $80
C_BYTE_PROG_29F equ $a0
M_SSIZE_29F equ $10000 ; sector size; MAXFlash
command_ZP_29F = $f0
M_SSIZE_29F equ <$100 ; sector size; MAXFlash
M_VECTORS_29F
jmp softid_entry_29F
jmp softid_exit_29F
jmp flashoppreamble_29F
jmp flash_formatchip_29F
jmp flash_formatsector_29F
jmp flash_writebytepreamble_29F
jmp flash_lockchip_29F
jmp flash_unlockchip_29F
jmp flash_wait_unit_29F
dta M_SSIZE_29F
dta c'29F0x0',0
flashoppreamble_29F
pha
flash_writebytepreamble_29F
lda #C_BYTE_PROG_29F
scc
lda #C_FORMAT_29F ; only if c set
sta command_ZP_29F
pla
.byte {bit.w}
bne flashoppreamble_acc_29F
flash_formatsector_29F
lda #TRIGGER_SECTORFORMAT_29F
dta {bit.w} ; skip next 2 bytes
; main entry
; c set ->format (either chip or sector)
; c cleared ->byte write
flash_formatchip_29F
lda #TRIGGER_CHIPFORMAT_29F
sta flash_fmcommand_29F
lda #C_FORMAT_29F
; entry for command in A, mainly for sector format
flashoppreamble_acc_29F ; 29F040
sta command_ZP_29F
sta command_29F
stx flash_format_storex_29F
txa
pha
; when write byte x must be set to either 0 or 40 temporarily
and #$40
tax
@@ -32,15 +43,19 @@ flashoppreamble_acc_29F ; 29F040
mva #$aa $a555 ; $555<$aa
mva #$55 $a2aa ; $2aa<$55
; $555<$80 or $A0
mva command_ZP_29F $a555; will become command: FORMAT/ID_MODE/BYTE_PROG
mva command_29F:#0 $a555; will become command: FORMAT/ID_MODE/BYTE_PROG
cmp #C_FORMAT_29F
bne @+ ; if not FORMAT, procedure finishes
bne flash_format_exit_29F ; if not FORMAT, procedure finishes
; FORMAT part, more to write
mva #$aa $a555 ; $555<$aa
mva #$55 $a2aa ; $2aa<$55
mva #TRIGGER_FORMAT_29F $a555 ; $555<$10
@ pla
tax
lda flash_fmcommand_29F:#TRIGGER_CHIPFORMAT_29F
cmp #TRIGGER_CHIPFORMAT_29F
sne
sta $a555 ; $555<$10
flash_format_exit_29F
ldx flash_format_storex_29F:#0
sta $d500,x
flash_lockchip_29F
flash_unlockchip_29F
rts
@@ -66,7 +81,6 @@ flash_wait_unit_29F
; lda $a001
; rts
softid_exit_29F
sta $D500,x ; x=0 or $40 else will read wrong
lda #$f0