Here it is.
;---------------------------------
---------
PROTLCK equ $02
BPROT1 equ $02
EELAT equ $02
EEPGM equ $01
ms100 equ $9C6
ms10 equ $10E
ms1 equ $1B
ms8 equ $CC
us100 equ 176
us30 equ 58
us22 equ 39
us11 equ 19
us10 equ 18
us5 equ 9
us1 equ 2
TEN equ $80
eeprom equ $f80
go_SaveData
bclr EEMCR,PROTLCK
bclr EEPROT,BPROT1 ;unprotect block 1
jsr EraseEEPROM
ldx #DropStatus ;Beginning of RAM to write to
EEPROM
ldy #eeprom ;Beginning of EEPROM to write
to
movb #4,byte_count
jsr PgmEEPROM
bset EEMCR,PROTLCK
bset EEPROT,BPROT1 ;unprotect block 1
rts
;---------------------------------
---------
EraseDATA
bclr EEMCR,PROTLCK
bclr EEPROT,BPROT1 ;unprotect block 1
bsr EraseEEPROM
bset EEMCR,PROTLCK
bset EEPROT,BPROT1 ;unprotect block 1
rts
EraseEEPROM
movb #%00001110,EEPROG
movb #$FF,eeprom ;write any data to erase
nop
bset EEPROG,EEPGM
movw #1,wait_timer
movw #1,wait_timer
movw #1,wait_timer
movw #1,wait_timer
loop1
ldx wait_timer
bne loop1
movb #$80,EEPROG
; bclr EEPROG,EEPGM
; bclr EEPROG,EELAT
rts
;---------------------------------
---------
PgmEEPROM
movb #%10000010,EEPROG
PgmEEPROM10
movw 2,x+,2,y+
bset EEPROG,EEPGM
movw #1,wait_timer
movw #1,wait_timer
movw #1,wait_timer
movw #1,wait_timer
pshx
loop2
ldx wait_timer
bne loop2
pulx
bclr EEPROG,EEPGM
dec byte_count
bne PgmEEPROM10
bclr EEPROG,EELAT
movb #$80,EEPROG
rts
|