Missing nice-to-have MMU functions

ZX80, ZX 81, ZX Spectrum, TS2068 and other clones
Post Reply
Stefan123
Member
Posts: 85
Joined: Fri Oct 21, 2016 7:57 am

Missing nice-to-have MMU functions

Post 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 ;)
Stefan123
Member
Posts: 85
Joined: Fri Oct 21, 2016 7:57 am

Post 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)
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post 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.
Post Reply