ZXpand ROM character set corruption

Discussions about Sinclair ZX80 and ZX81 Hardware
Post Reply
User avatar
bobs
Posts: 325
Joined: Thu Aug 27, 2009 10:49 pm
Location: UK
Contact:

ZXpand ROM character set corruption

Post by bobs »

I've just released 'CroZXy Road' for the 16K ZX81, and somebody has mentioned that there is graphical corruption when a ZXpand interface is present. This has been seen when using the EightyOne emulator, and I've narrowed it down to my game reading the font bytes from the ROM address 0x1E00 forward to display them enlarged on-screen when the game comes to the high-score entry screen.

Can anybody (SirMorris?) explain why this might be the case, and how to fix it? Is it that a shadow ROM is paged in?

(The same issue could probably be seen in the last few of my games, such as Rebound & U-Bend, as they both use a similar system for showing 'super-sized' font characters)

Bob.
User avatar
siggi
Posts: 990
Joined: Thu May 08, 2008 9:30 am
Location: Wetterau, Germany
Contact:

Re: ZXpand ROM character set corruption

Post by siggi »

AFAIK the rom character set is only available during REFRESH cycles, when the display is generated. It cannot be read by READ cycles, because then the ZXPAND rom is active, where that space is used for additional code. So a printer-routine would load the machine code bytes and print it out instead of the character set.

HTH Siggi
My ZX81 web-server: online since 2007, running since dec. 2020 using ZeddyNet hardware
http://zx81.ddns.net/ZxTeaM
User avatar
bobs
Posts: 325
Joined: Thu Aug 27, 2009 10:49 pm
Location: UK
Contact:

Re: ZXpand ROM character set corruption

Post by bobs »

Thanks Siggi, that makes sense. Hopefully I can find enough memory to duplicate the font into RAM for the affected games.
User avatar
1024MAK
Posts: 5116
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: ZXpand ROM character set corruption

Post by 1024MAK »

There is a ZXpand command to disable it's internal EPROM once the file is loaded, which then allows the CPU to read the Zeddy ROM.

Of course, once the ZXpand EPROM is disabled, BASIC can no longer use the ZXpand commands.

Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp

:!: Standby alert :!:
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :!:
Looking forward to summer later in the year.
User avatar
bobs
Posts: 325
Joined: Thu Aug 27, 2009 10:49 pm
Location: UK
Contact:

Re: ZXpand ROM character set corruption

Post by bobs »

That sounds like a simpler solution to my problem Mark, but would the joystick interface still be available to me? That's the only functionality of the interface which is used.
User avatar
1024MAK
Posts: 5116
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: ZXpand ROM character set corruption

Post by 1024MAK »

I think the joystick can still be read, as that is accessed by your machine code talking to the PIC micro-controller. This was posted on the forum a while back, so a search may find it.

As to the instruction to load a program and disable the ZXpand EPROM, read this extract from the manual:
ZXpand manual wrote:LOAD "filename;X"
Once the program is loaded the overlay ROM is disabled and full access to the internal system ROM
is given. The overlay ROM remains disabled until the current session is ended with a hard reset (press
and hold) or power cycle.
The manual also says this:
ZXpand manual wrote:Programmatically disable the interface’s overlay ROM until the next reset:

Code: Select all

ld bc, %1110000000000111
ld a,$b0
out (c),a
Read the joystick port:

Code: Select all

ld bc, %1110000000000111
ld a,$a0
out (c),a
[some small delay, 10 clocks or so]
in a,(c)
Manual here

Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp

:!: Standby alert :!:
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :!:
Looking forward to summer later in the year.
User avatar
bobs
Posts: 325
Joined: Thu Aug 27, 2009 10:49 pm
Location: UK
Contact:

Re: ZXpand ROM character set corruption

Post by bobs »

Thanks Mark, will give disabling the EPROM a go.
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: ZXpand ROM character set corruption

Post by sirmorris »

^^ What Mark said. 100% correct. :ugeek:

What is not correct is the manual - the 'some small delay' needs to be longer than the suggested 10 clocks.

The OUT sets the interface reading the j/s input port and arranging the bits, whereupon the assembled joystick value is placed in the output latch for reading. The IN then reads the latch.

What I've suggested to people in the past is that they prime the port after reading. In other words read the port to get the value that was collected on the previous game frame, then start the collection to complete whilst going about the business of the current frame.

The only issue with this is that it will add a frame's worth of latency into the input. For some things this won't matter but i suppose that depends on the frame rate and acuity of the user's temporal perception ;)

Otherwise just do the OUT at the start of the frame then do some other things before doing the IN. Processing always takes the same time so if it works once it will always work.

C
Post Reply