Skip to content

PEEK & POKE Access to C64/C128 Memory #11

Answered by zeldin
RetrofanC asked this question in Q&A
Discussion options

You must be logged in to vote

Because the C64 memory space is in the address range 0x0000-0xFFFF, it falls in the range covered by the RiscV core's data cache (any address with the MSB not set is cacheable in the simple setup used). Thus, once you read a value it will end up in the data cache, and stay there until that cache line gets evicted. The RVSYS command flushes both the data and instruction cache before starting the code, which is why re-issuing the RVSYS command fixes the problem for you.

You can use this macro to flush the data cache from inside your RiscV code:

#define CACHE_FLUSH() __asm__ __volatile__(".word 0x500F")

However, if you only want to pass some small message from the C64 side to the RiscV, a b…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@RetrofanC
Comment options

Answer selected by zeldin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants