Next MMU paging

Do you live and breathe hexadecimal? Do you like speaking to hardware directly?

Moderator: Programming Moderators

User avatar
SevenFFF
Posts: 211
Joined: Mon Jun 05, 2017 5:30 pm
Location: USA

Next MMU paging

Post by SevenFFF » Sun Feb 25, 2018 2:41 am

I can't get horizontal MMU paging to work, even with a simple example. I tried to page 8k-bank 10 (ULA screen) into slot 0 ($0000-$1FFF).

At the point I run this code, the memory map has ROM/5/2/7 paged in. Bank 7 was set using port $7FFD, and special paging mode is off.

Code: Select all

                        ld bc, $243B
                        ld a, $50
                        out (c), a
                        inc b
                        ld a, 10
                        out (c), a
I can tell it hasn't worked, as I can still see the BASIC tokens in the ROM appearing in the bytes after $0000.

Running this on the Next board, not an emulator. On the ZX Spectrum Next/GW 1.32 personality, 0.8a.

What am I doing wrong? Do I need to so something else to enable it first?
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel Spectron 2084blog

User avatar
varmfskii
Posts: 183
Joined: Fri Jun 23, 2017 1:13 pm
Location: Albuquerque, NM USA

Re: Next MMU paging

Post by varmfskii » Sun Feb 25, 2018 4:33 am

The only thing I can think of is that setting the 16k page using $7ffd is causing problems as, when I test a variation of your code withgout setting that, I get the expected results.
Backer #2741 - TS2068, Byte, ZX Evolution

User avatar
SevenFFF
Posts: 211
Joined: Mon Jun 05, 2017 5:30 pm
Location: USA

Re: Next MMU paging

Post by SevenFFF » Sun Feb 25, 2018 5:58 pm

varmfskii wrote:
Sun Feb 25, 2018 4:33 am
The only thing I can think of is that setting the 16k page using $7ffd is causing problems
Thanks! I think you're right. It looks like writing to port $7ffd resets all of the MMU paging that has been already done. Which kinda sucks, but it's not a huge problem. I can page the top 16K by writing to the Next MMU ports instead. My $7ffd paging is in a macro, so that's dead easy to change globally.
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel Spectron 2084blog

User avatar
SevenFFF
Posts: 211
Joined: Mon Jun 05, 2017 5:30 pm
Location: USA

Re: Next MMU paging

Post by SevenFFF » Sun Feb 25, 2018 8:06 pm

I think using the exsDOS API might be messing with MMU paging too. Haven't fully got to the bottom of it yet...
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel Spectron 2084blog

philipstephens
Posts: 33
Joined: Mon May 29, 2017 8:38 pm

Re: Next MMU paging

Post by philipstephens » Mon Feb 26, 2018 2:02 am

SevenFFF wrote:
Sun Feb 25, 2018 5:58 pm
Thanks! I think you're right. It looks like writing to port $7ffd resets all of the MMU paging that has been already done. Which kinda sucks, but it's not a huge problem. I can page the top 16K by writing to the Next MMU ports instead. My $7ffd paging is in a macro, so that's dead easy to change globally.
Yes, I believe the MMU is the underlying mechanism for paging now, and existing ports like $7FFD are implemented by updating the MMU.

User avatar
SevenFFF
Posts: 211
Joined: Mon Jun 05, 2017 5:30 pm
Location: USA

Re: Next MMU paging

Post by SevenFFF » Mon Feb 26, 2018 2:58 am

philipstephens wrote:
Mon Feb 26, 2018 2:02 am
Yes, I believe the MMU is the underlying mechanism for paging now, and existing ports like $7FFD are implemented by updating the MMU.
Agreed. Makes sense when you consider that $7FFD is always going page in one of the two/four 128K ROMs, there's never an option to mask out that part of the operation. Other than that, the two mechanisms seem to happily coexist, when I did a standalone test.

I started rewriting my esxDOS Resource resource loading code to not use slots 0 and 1 at all, to see if esxDOS was messing with it too. But thoroughly broke it in the process, so watch this space...
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel Spectron 2084blog

Stefan123
Posts: 99
Joined: Mon Jun 05, 2017 9:38 pm

Re: Next MMU paging

Post by Stefan123 » Mon Feb 26, 2018 10:16 am

SevenFFF, I have also been bitten by the ESXDOS / layer 2 incompatibility when loading layer 2 data via ESXDOS and writing it to the layer 2 memory paged-in as write-only at the bottom 16 KB. This works fine in CSpect and ZEsarUX (with esxdos handler) but not on the real hardware. When loading layer 2 data via ESXDOS, you must use one of the MMU slots 2-7. However, once the layer 2 data is loaded you can manipulate it by paging it in to the bottom 16 KB.

User avatar
SevenFFF
Posts: 211
Joined: Mon Jun 05, 2017 5:30 pm
Location: USA

Re: Next MMU paging

Post by SevenFFF » Mon Feb 26, 2018 2:30 pm

Cheers Stefan. Funnily enough I was just getting round to asking you how you did it.

I started refactoring along these line last night, but it went tits-up so I’ll have to redo it.
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel Spectron 2084blog

User avatar
SevenFFF
Posts: 211
Joined: Mon Jun 05, 2017 5:30 pm
Location: USA

Re: Next MMU paging

Post by SevenFFF » Mon Feb 26, 2018 2:53 pm

I think I’ll put my esxDOS code in slot 7, and load resources into slot 6 in 8K chunks. It’ll be a little bit slower than loading in 16K chunks, but unlike you I’m only loading resources once at the start, so that won’t matter so much.

And I can completely lose the esxDOS code in slot 7 afterwards, or just page it back in later if I want to save high scores etc.
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel Spectron 2084blog

Stefan123
Posts: 99
Joined: Mon Jun 05, 2017 9:38 pm

Re: Next MMU paging

Post by Stefan123 » Tue Feb 27, 2018 9:12 am

SevenFFF, out of curiosity, what type of game are you working on?

Post Reply