Home Page

Fairlight Spectrum 128K and '0xFD' memory paging

Posted By: geecab

Fairlight Spectrum 128K and '0xFD' memory paging - 05/09/15 04:57 PM

As Fairlight (Spectrum 128K version) is one of my favorite games, I decided to try and figure out why it fails to run on Mess with the spec128 bios.

I have a z80 game image that loads in & runs fine using Emuzwin. If I load the same image with mess, the game immediately crashes.

I traced the address & opcodes for both Emuzwin and mess, capturing from when the image first loads to when the crash occurs.

Comparing the Emuzwin & mess traces, everything matched to begin with, but then the opcodes started to deviate (after the code calls/jumps to location 0xC000, mess shows opcode 0x49 when it should be 0xE5):

Emuzwin Trace
B70B:D3FD OUT A,13H
B70D:CD000C0 CALL C000H
C000:E5 PUSH HL

Mess Trace
B70B:D3FD OUT A,13H
B70D:CD000C0 CALL C000H
C000:49 LD

After a bit of reading, I made the assumption the crash was due to mess not paging the correct memory bank to address 0xC000. Google-ing things like "Port 0xFD" and "memory paging" I found this (copied from http://www.worldofspectrum.org/rusfaq/):

Quote:

JmK> OUT(#FD),A? On a normal Spectrum this would end up paging memory (like
JmK> in Fairlight 128), on a +3 this would access the FDC. So, a Pentagon is
JmK> different?
JmK> (Since the value of A becomes the high byte of the OUT address).

thatz exactly right - Pentagon doesnt need full address access sometimes ( please, dont ask me why and how - i have no idea. something

to do with lame a$$ engineer who designed it frown i'll try to find some more info on this one though. as another hint - this lame addressation was stuffing up Scorpion ( halted the system/didnt do jack ) until i had cut one of MC's on motherboard )


So it seems the "B70B: D3FD OUT A,13H" (writing 0x13 to the 0xFD port) is a sort of undocumented/shorthand way of paging memory banks that Mess doesn't currently support?

I then had idea of just seeing what happened if I tried to load the z80 image with the 'pentagon' bios (a system I've never heard of until I read the above conversation), and bingo, it worked smile

I just thought it would be a good idea to mention my findings here, incase Mess-developers aren't aware of this spectrum 128K 0xFD memory paging quirk.

Hope it helps!
Posted By: R. Belmont

Re: Fairlight Spectrum 128K and '0xFD' memory paging - 05/09/15 05:07 PM

I'm not a Speecy guy, but I just wanted to say that's the best bug report I've ever read. Great work smile
Posted By: geecab

Re: Fairlight Spectrum 128K and '0xFD' memory paging - 05/10/15 06:29 AM

Cheers thanks! smile

Also just thought I'd mention the same quirk exists for FairlightII 128K version (which also runs fine using the pentagon bios).
Posted By: MetalliC

Re: Fairlight Spectrum 128K and '0xFD' memory paging - 05/15/15 12:44 PM

thnks for great report. fixed.

pentagon is not just "bios", its separate driver, and already have port decoding for such weird addressing, because a lot of ex-USSR software uses it that way.

didn't know original 128k and +2 have such simplified 7ffd port decoding too. and even worst in the case of reading this port )
Posted By: geecab

Re: Fairlight Spectrum 128K and '0xFD' memory paging - 05/15/15 08:25 PM

That's excellent news! Great to know its resulted in a fix!

By the way just wanted to say, thank you and everyone else for all your hard work on MESS, I really appreciate it smile
Posted By: ICEknight

Re: Fairlight Spectrum 128K and '0xFD' memory paging - 05/16/15 10:54 PM

Would this be the appropiate time for a general ZX Spectrum thread, or is it still a low priority compared to other systems?
Posted By: R. Belmont

Re: Fairlight Spectrum 128K and '0xFD' memory paging - 05/17/15 01:37 AM

Spectrum won't be a general thing until we get a cycle-by-cycle Z80.
Posted By: MetalliC

Re: Fairlight Spectrum 128K and '0xFD' memory paging - 05/17/15 04:39 PM

ICEknight, TBH can't say its "low priority", its more like "no one interested to bother with it" wink

in my personal TODO list is only task to figure out what kind of dark magic don't let BetaDiskInterface work 100% OK.
already spent quite many time debugging this, and more and more thinking its something wrong in FD17xx emulation code (both legacy and modern implementations)

but, feel free to post issues or wishes )
Posted By: abelenki

Re: Fairlight Spectrum 128K and '0xFD' memory paging - 05/18/15 01:05 AM

any plans to add support for .SCL TR-DOS disk images for Russian ZX Spectrum clones in MESS?

last time i checked, they didn't work...
Posted By: R. Belmont

Re: Fairlight Spectrum 128K and '0xFD' memory paging - 05/18/15 01:32 AM

abelenki: nope, but you know where the git repo is ;-)
© 2020 Forums