Page 1 of 1

Missing nice-to-have MMU functions

Posted: Mon Feb 05, 2018 7:19 pm
by Stefan123
In addition to the ZXN_READ_MMU<NUM>() and ZXN_WRITE_MMU<NUM>() macros/functions, it would be quite convenient to have the following functions:

unsigned char zxn_read_mmu(unsigned char mmu);

void zxn_write_mmu(unsigned char mmu, unsigned char page);

They are easy to roll on your own but I think they are handy to have in the library ;)

Posted: Mon Feb 05, 2018 8:58 pm
by Stefan123
I just realized that the following does what I suggested:

ZXN_READ_REG(REG_MMU0 + mmu)
ZXN_WRITE_REG(REG_MMU0 + mmu, page)

Posted: Tue Feb 06, 2018 3:09 am
by alvin
Yes that's right. There's also zxn_read_mmu_state() and zxn_write_mmu_state() that reads / writes the entire mmu state into an array of 8 unsigned char. I found that useful recently.