Hi Ladislav,
I've been working away at this and it looks like my problem is that I just don't know how to use indexed addressing with the global address in Buffer Ram. Here is a snippet of my latest test code attempt:
;**************************************************************************************
; - This code reads the 4 words in unpaged Flash starting at address $4000, and writes
; to Buffer Ram for EE emulation starting at global address 13_F000
; BUT IT DOESN'T WORK !!!
;**************************************************************************************
;**************************************************************************************
;--------------------------------------------------------------------------------------
; - DefaultBufRam: is the beginning of the array of default buffer Ram values
; stored in P Flash starting at address $4000
; ORG $4000 ; Unpaged Flash Sector 1, $4000 to $43FF (1024 bytes)
;DefaultBufRam:
; dc.w $0123,$4567,$89AB,$CDEF
;--------------------------------------------------------------------------------------
; - These are the variables used in this test code
; ORG RAMStart ; Address $2000 (Start of RAM)
; EEEOffset: ds 2 ; Offset value for EEE Buffer Ram
; EEECnt: ds 2 ; Counter for EEEOffset
; EEEAddress: ds 2 ; 16 byte EEE address
;--------------------------------------------------------------------------------------
;**************************************************************************************
; lbra EEELoopDone ; SKIP OVER THIS CODE IF UN-COMMENTED
movw #$0004,EEECnt ; initialize EEECnt to 4
movw #$0000,EEEOffset ; Initialize offset to zero
movw #$F000,EEEAddress ; Initialize EEEAddress to $F000
ldaa #$13 ; $13 -> Accu A
staa GPAGE ; Copy to GPAGE
EEELoop:
ldd #DefaultBufRam ; Address of start of DefaultBufRam values in P-Flash -> Accu D
ldx EEEOffset ; Offset -> X
ldy D,X ; Value in DefaultBufRam values in P-Flash, offset in EEEOffset -> Y
gsty EEEAddress ; Copy to Global address ;( THIS COMMAND DOESN'T CHANGE ; ;ANYTHING IN BUFFER RAM !!! )
ldx EEECnt ; EEECnt -> X
subx #1 ; Subtract 1
stx EEECnt ; Update EEECnt
beq EEELoopDone ; If EEECnt = zero branch to EEELoopDone: (Finished)
ldx EEEOffset ; EEEOffset -> X
addx #2 ; Add decimal 2 (increment by two for next word to write to Buffer Ram)
stx EEEOffset ; Update EEEOffset
ldx EEEAddress ; EEEAddress -> X
addx #2 ; Add decimal 2 (increment by two for next addrress to write to Buffer ;Ram)
stx EEEAddress ; Update EEEAddress
bra EEELoop ; Loop back for next word value
EEELoopDone:
;**************************************************************************************
When I step through it the registers and variables update as expected, but the global store command won't do anything.
I'll keep working on it.
Regards,
Robert