I followed along with Matt Heffernan's "Hello VERA" tutorial ... https://www.youtube.com/watch?v=Wn8-unoaWSc ... (the slide at around 8:48)
I tried writing my own code to read 5 bytes of VRAM at address $1B000 (the tutorial is based on an old emulator, so it uses $00000)
Code: Select all
stz VERA_ctrl ; ADDRSEL=0
lda #($10 | ^VRAM_ADDR) ; Stride 0001xxxx
sta VERA_addr_bank
lda #>VRAM_ADDR
sta VERA_addr_high
lda #<VRAM_ADDR
sta VERA_addr_low
ldx #5
@read_loop:
lda VERA_data0 ; read from VRAM
jsr print_hex ; Matt's subroutine to print .A as a hex string
dex
bne @read_loop
By my understanding, the "stride" should auto-increment behind the scenes, such that my next LDA gets the next VRAM addr's value. It seems to work perfectly for writes (STA) but not for reads (LDA).
If I change my code to just make 5 distinct reads, incrementing the addr myself (and setting stride zero) then it works fine. But that's horribly inefficient. I can't for the life of me figure out what I'm doing wrong with the stride/loop approach. Any advice is appreciated.