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 »

browny points for Mrtinb :-)

suprised that the link stayed up for as long as it did, i haven't had access to that site for 2 years mwhahaha

Andy
what's that Smell.... smells like fresh flux and solder fumes...
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: ZX81 Enhanced ULA replacement module.

Post by sirmorris »

I've listed a ULA on SellMyRetro.
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: ZX81 Enhanced ULA replacement module.

Post by PokeMon »

Just one question to the owners as I tested the ZX81 Enhanced ULA with ZXblast (which runs fine). I found that the reset line has a much lower pullup than the original (1.2k vs. 220k) - that gave a problem with the reset switch as it has a 1k series resistor in the switch to protect both, capacitor and switch. This can be lowered to 100R and the reset would be fine.

Not sure if this is something that belongs to the new ULA or just some special ZX81 enhancement by the owner of this Zeddy.

And I tried the turbo mode and I am unsure if I understand the documentation correct. Is it true, that turbo is active in FAST mode only ? I expected to be faster in NMI period in general - even in SLOW mode ?
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 »

Hi Karl,

yes the enhanced ula has a very low pullup to the 5V rail on the reset ( but you don't have to connect it to the zeddy reset ) the problem was with the relattvely slow rise time of the reset signal the ula wouls sometimes not reset properly ( i guess something to do with metastability )

Turbo mode is tricky, in normal slow mode ( with the NMI gen running , top margin ) then turbo is active, when nmi stops ( just before generating the live video ) turbo stops, it is again restarted when NMI starts again ( bottom margin ) and then nmi stops again ( for Vsync ) and so does turbo...

in fast mode nmi stops and so does turbo, to get around this an extra poke is required, first make sure bit 1 and 7 of the control are set, POKE 101,130 then in your program enter fast mode, once in fast mode pokw 1001,x the act of trying to write to address 1001 triggers the turbo mode. everytime you drop back to slow e.g waiting for an input, pause ect you have to poke 1001,x again to retrigger the turbo.

hope that helps

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 »

I have to say, this Zeddy was borrowed from Paul and not sure if there have been different versions of your ULA. I just tried POKE 101,144 as you stated as example in the documentation but I couldn't find any higher speed. Running CLKFREQ.P showed normal speed of Zeddy. Just 97.7% as the ZXblast take a very few NMI periods in the background but the same as original hardware. When trying further a PEEK 101 to read it always shows 255 regardless what I poke. The jumper setting was ZX81 extended, I am quite sure. ;)

Any ideas ?
I just overflowed the documentation and find some special section about FAST handling with POKE 1001 and thought it's maybe running with program modifications in faster speed.

About the reset, it must be connected here as I could measure. I also find some startup problems with connected ZXblast as the reset period seems to be too short. An extra press on the reset switch let it come up properly. But as stated, this is not my hardware. And it doesn't seem to be faster without ZXblast nor does PEEK 101 work properly (gives always 255 even without ZXblast).
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 »

poke 101,144 is not setting bit 2 so turbo in fast will never work
interesting that peek 101 does not work it should, Paul did have a copy of my verilog so maybe he has tweaked it somehow....

2 versions exist

version 1 early had no wait output, only the faster type roms work in turbo
version 2 later had a wait output that would allow the slower roms to work in turbo

other than wait output the rest is the same.

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 »

As CLKFREQ.P is not running in FAST mode it shouldn't care about bit 2, right ?
Should be faster in SLOW mode with POKE 101,144 ?
Couldn't see a difference in listing a BASIC program when poking 144 and 0 as well.

Am I right, that the first version/release did support double clock / turbo in FAST mode only ?
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 you should see a speed difference with poke 101,144, bit 7 is turbo on/off.

yes both have turbo mode, only difference was later ones had 1 wait states added when reading from rom during an M1 fetch witch is shorter than a standard memory read.

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 »

your ZX Blast is turning the NMI's off is it not ?
the ula is seeing this as the end of the top / bottom margin and is automatically turning off the turbo.

it is based very much on Wilfs fien work here http://www.user.dccnet.com/wrigter/inde ... /turbo.htm

with a few extra bits...

here is the code for the turbo part.

Code: Select all

/*

Sinclair ZX81 ULA implementation in Verilog.

Destination device ALTERA EPM7128sqc100-15

Andy Rea, 2011


This is turbo module.

in ZX81 you can double the CPU speed while it is not activly generating the display.

mostly while NMI is active.

So by watching various events on the Z80 bus we can toggle between 3.25Mhz and 6.5Mhz.

the switching is always done at a posedge of the slower clock, this ensures that the faster clock
has already switched to a high level.

the output 'clock_select' is used by the clocks module to select which clock to send to the cpu.

ZX80 turbo mode is supported also, but in a different way to ZX81, it is activated when the display loop in rom
is ended, but is disabled in all the same ways as ZX81 (so flicker free games still run if you forgot to turn off
Turbo) and additionally disbaled on entry to the display loop.


*/
module turbo (
//inputs
Global_reset,
slow_clock,

address,
m1,
iorq,
mreq,
wr,
halt,

turbo_enable,		// controlled from poke
zx_mode,
turbo_overide,
turbo_in_fast,		// controlled from poke

//outputs
//cpu_clock
clock_select

);

input Global_reset, slow_clock ;
input [15:0]address	;		//lower 8 bits of address bus only
input m1 ;
input iorq, mreq, wr, halt ;
input turbo_enable	;		// controlled from poke.
input zx_mode ;

// OVERRIDE DOES NOTHING ALWAYS LOGIC 1

input turbo_overide ;		// external pin, user override of turbo mode
							// so for example user powers on machine
							// selects turbo active, but overides it
							// loads program, then once program is running
							// removes the overide and turbo kicks in ;-)
							//
							// '0' = overide
							// '1' = normal
input turbo_in_fast ;
							
//output cpu_clock	;       // output to cpu, switched on the rising edge of slow clock
							// since as slow clock is clocked on the rising edge of fast clock
							// fast clock will have already gone high, the same applies when 
							// switching from fast to slow
							
output clock_select;

wire turbo_on	;
wire turbo_off	;
wire cpu_clock ;

reg turbo_active ;
reg clock_select ;

wire poke_trigger ;
// in fast mode allows the user to trigger turbo by poking location 1001

assign poke_trigger = turbo_in_fast & !wr & !mreq & (address == 16'd1001) ;


assign turbo_on =(zx_mode & turbo_enable & (poke_trigger | (!iorq & !wr & address[7:0] == 8'b11111110 ))) | (!zx_mode & turbo_enable & !m1 & (address == 16'd803)) ;

//                 ^^^         ^^^^              ^^^^                   ^^^^^                      OR---->     ^^^^                       execute $0323
//                 zx81     external Vcc,     poke_trig               OUT ($fe),                               ZX80

assign turbo_off = (((!turbo_enable | (!iorq & !wr & (address[7:0] == 8'b11111101 | address[7:0] == 8'b11111111 | address[7:0] == 8'b00000111)) | !halt | !Global_reset ))) | (!zx_mode & (!turbo_enable | (!m1 & (address == 16'd319)))) ;
//the old version of the line above
//assign turbo_off = ((zx_mode & (!turbo_enable | (!iorq & !wr & (address[7:0] == 8'b11111101 | address[7:0] == 8'b11111111 | address[7:0] == 8'b00000111)) | !halt | !Global_reset ))) | (!zx_mode & (!turbo_enable | (!m1 & (address == 16'd319)))) ;
//                   zx81       external Gnd           out ($fd), or out ($ff),                                  halt (low)   reset (low)

always @ (posedge slow_clock or negedge Global_reset) begin
	if (!Global_reset) begin
		turbo_active <= 1'b0 ;
	end else if (turbo_off) begin
		turbo_active <= 1'b0 ;
	end else if (turbo_on) begin
		turbo_active <= 1'b1 ;
	end
end

always @ (posedge slow_clock or negedge Global_reset) begin
	if (!Global_reset) begin
		clock_select <= 1'b0 ;
	end else if (turbo_active & turbo_overide) begin
		clock_select <= 1'b1 ;
	end else begin
		clock_select <= 1'b0 ;
	end
end

endmodule
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 »

Well - it has nothing to do with ZXblast as it appears in the way described even with 1k RAM / nothing connected to the edge connector. ;)

The ZXblast does not turn off NMI's - this way the ZXblast would kick itself off. It does catch the very first NMI while switching the ROM (with ROMCS driving high) to see if anything to do like keystrokes to be interpreted or reacting on it but that's all. After this switching back to ZX81. I think there is no way for your ULA to detect this (by now).

In fact it does not touch video generation (unless in startup/configuration mode), it just catches some calculation time from the ZX81 during NMI period and ZX81 is using it's own video drivers. Can be the ROM mechanism or any other custom driver as long as NMI's are used.
Post Reply