ZX81 Enhanced ULA replacement module.

ZX80 / ZX81 hardware and software offered for sale or swapping
User avatar
Andy Rea
Posts: 1606
Joined: Fri May 09, 2008 2:48 pm
Location: Planet Earth
Contact:

Re: ZX81 Enhanced ULA replacement module.

Post by Andy Rea »

you could reprogram the cpld, with the version that has the extra wait states, requires soldering 1 more wire to the wait signal line top of r17 i think


andy
what's that Smell.... smells like fresh flux and solder fumes...
User avatar
Andy Rea
Posts: 1606
Joined: Fri May 09, 2008 2:48 pm
Location: Planet Earth
Contact:

Re: ZX81 Enhanced ULA replacement module.

Post by Andy Rea »

no you cut the trace to take the constant 3.25Mhz clock to the edge connector for sound cards
what's that Smell.... smells like fresh flux and solder fumes...
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81 Enhanced ULA replacement module.

Post by PokeMon »

Okay - as this was just a borrow to test if ZXblast is running.
It is running.

I wonder why the WAIT state could be the problem as the ZXblast replaces the internal ROM with a SST39SF040 - I can peek some values above 8192 correctly. This has 70ns access time - there shouldn't be a timing problem in general. But I use HALT instruction in my code for synchronization or timing issues. Not sure if that harms your ULA when expecting the HALT to be the end of NMI/beginning of video. But then it would be hard to use HALT instructions in machine code as well.
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81 Enhanced ULA replacement module.

Post by PokeMon »

I have problems when switching to turbo mode. This is hard to trace for me. There could be some problem with the CPU as well as the D780C-1 is rated with 4 MHz only. The 6 MHz version would be the D780C-2. I have to ask Paul wether I should investigate it further and change the CPU. Are you sure, the WAIT states are needed for the M1 object code fetch only ? Don't have a ROM to change I think with this pinout.
User avatar
Andy Rea
Posts: 1606
Joined: Fri May 09, 2008 2:48 pm
Location: Planet Earth
Contact:

Re: ZX81 Enhanced ULA replacement module.

Post by Andy Rea »

ah yes you will most likely need the faster CPU, almost none of the 4Mhz variants i tried ran for any length of time. if the ROM is been replaced by the one on the ZXBlast then it should work, but those slower 'sinclair' roms are problematic, the M1 fetch is only 1,5 cycles where as a standard read is 2 cycles.

Andy
what's that Smell.... smells like fresh flux and solder fumes...
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81 Enhanced ULA replacement module.

Post by PokeMon »

So it does work indeed when changing CPU to a 8 MHZ Zilog Z84C0008 (I have here a spare of these ...).
But it is only partly faster due to the HALT instructions used for synchronization. It shows 161% speed of a standard ZX81 only. The ZXblast is catching every first NMI of the top margin and executes a HALT statement which switches back to 3.25 MHz. The bottom margin is executed with 6.5 MHz. So turbo is giving here at least factor 1.5 ;)

There would be a chance to add a offline mode for switching off nmi control completely but comes with a price, users have press reset button to get back and instance would be lost and has to be restarted.

Calculating the length of the routine, switch NMI off and on afterwards and correcting AF' value would be possible but even harder when running in different speeds. The reason why I used the first and not the last NMI was that this way it is compatible to PAL and NTSC versions as well. So we will see. The ROM seems to work fine, didn't change it, just the CPU.

It even works without ZXblast and faster CPU only. But I found out, that it is hard to get the SLOW mode. After poking it is in FAST mode I think. Maybe that is the reason why it runs with the old ROM when switching back to 3.25 MHz in FAST mode. Didn't investigate this further. But it didn't crash what let me think that the access time of ROM should be sufficient. It would at least execute the POKE command and execute a few instructions faster.
User avatar
Andy Rea
Posts: 1606
Joined: Fri May 09, 2008 2:48 pm
Location: Planet Earth
Contact:

Re: ZX81 Enhanced ULA replacement module.

Post by Andy Rea »

Yes it is hard to switch back to slow, there is a timing loop in the ROM to check if an NMI generator is present ( zx81 ROM runs on zx80 hardware ) when cpu is running double speed it can miss the single NMI, ROM patch bit ( i forget which but it is not at home right now ) will correct this by making that single byte double in value from 17 to 34 thus ensuring the NMI is seen in the loop.

After halt instruction and ready to return to normal margin generation restart the NMI ( even if it wasn't actually stopped ) the out $FE,xx should be sufficient to retrigger the turbo mode. I think

Regards Andy
what's that Smell.... smells like fresh flux and solder fumes...
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81 Enhanced ULA replacement module.

Post by PokeMon »

Oh, yes good idea. I can try to retrigger the NMI.
I found out, that the SLOW mode sometimes work. I guess you have a 50% chance depending on when the last NMI occurred. And I know why the ZXblast has no problem as the counter in the NMI test routine was changed to double value in my ROMs (used for ZXmore in the same way).
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81 Enhanced ULA replacement module.

Post by PokeMon »

So now I changed the CPLD logic, using one macrocell more. Only 4 left, 60 of 64 are used. I have to switch NMI off and on after HALT instruction and this way I get now in turbo mode 222.8% speed or 1.78 MHz. I have to measure out if this is safe in all conditions. Maybe it is more productive to skip the HALT instruction, turn NMI off and after turn on again and INC AF'. So I could use a few more instructions and do not waste time in HALT. I will measure it out. ;)
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81 Enhanced ULA replacement module.

Post by PokeMon »

By the way - is your ULA replacement module still on sale or planned to do so ?
Post Reply