I know the datasheet from ZILOG and all timing diagrams. Of course is /RFSH not really inverted /M1 just as simple to describe regarding your picture and of course I know that /RFSH is used only during second half of /M1 cycle.RetroTechie wrote:Also /RFSH is not /M1 inverted even though it may look that way in the small time window above.
/RFSH go down about 130ns when T3 start - in datasheet given as signal (21) "clock up to refresh down delay"RetroTechie wrote:IIRC, the /RFSH signal isn't very suitable for extending /CS signals, simply because it's too long (roughly 2 clockcycles). Too much opportunities to interfere with other events, like the point where the Z80 samples the opcode (white arrow below "NOP") or address lines changing from Program Counter to bits from I register. That's why I used signal "forced_NOP_T4" for this purpose, which is only 1 clockcycle long, and doesn't go active before /MREQ does.
address data is valid about 110ns when T3 starts - in datasheet given as signal (6) "clock up to address valid delay"
The nop code for the CPU is read exactly when T3 starts (clock going up and data has to be valid 35ns prior and about 85ns after) - signals (14) (15) (16)
So there is no overlap of these signals. From the timing diagrams it is assured that refresh address is valid when /RFSH goes down and this happens after data (NOP) is read. Anyway this NOP is overridden from the ULA and the normal ROM is active during this time. The datasheet describes in section refresh that the refresh address is valid when /RFSH and /MREQ are down together but this seems to be a little bit imprecise. The timing diagrams go more in detail.
Anyway I could try to just extend the /MREQ during /RFSH and not activate the ROM the full refresh time but I think this is not really sufficient for the ROM to present the data read from ULA (character table). /MREQ is only short period low, timing diagram says about 220 ns - signal (11). I have not much information about the ROM (ZCM38818P from Motorola for example) about access time. I think it maybe has an access time of 300ns but not really sure about it. So maybe it is not long enough. Okay when I extend the signal about 100ns more it could get into that time range.
So the point is that I don't know how /ROMCS is generated internally during normal opcode fetch and thought it maybe is activated when /M1 go down. Address is valid same way as for refresh (same timing delays of 110ns for address and 130ns for /M1). Because the ULA want to read data from ROM when clock go down in the middle of T2. So data has to be valid after 308ns - 85ns delay of /MREQ so this is only about 220ns.
So maybe the problem is more about that point when creating /ROMCS only with /MREQ.
I know that ROM is mirrored in address area $8000-$BFFF or at least for $8000-$9FFF. Anyway, due to ROM activated from $8000 upwards memory can not work there. That's the reason for my post, you remember I asked for a way to disable ROM in this area ?RetroTechie wrote: Note that original ZX81 doesn't decode A15 for /ROMCS and /RAMCS, only A14. So memory behaviour for 8000-FFFFh is an exact mirror of behavior for 0000-7FFFh range. A15 only affects how the ULA interprets what's going on, and if/what data it grabs from the bus.![]()
What I learned from getting true Hi-Res to work properly on my ULA clone, is this:
Don't regard /ROMCS and /RAMCS as 2 signals that should be independently built from address and control signals. Instead, try to create one "/ROMRAMCS" signal (like output of the OR gate in picture below), and use upper address lines A15, A14, and perhaps A13 (and ONLY those address lines!), to decide which of /ROMCS or /RAMCS gets activated. That way it's easier to change the memory layout, and you avoid /ROMCS and /RAMCS overlapping due to mistakes. See memory decoding in my ULA clone:

I don't think it's suitable to just have one "select signal" for ROM and RAM and just decide which you want with the address value. As I know from the traces from zx80nut, the ROMCS is extended during video display in refresh phase but NOT during normal opcode fetch. I think there is a reason for that because it would be easier to always extend this signal. On the other hand, just deriving /ROMCS from /RAMCS did not work either. And I don't want to make a complex address decoder logic for the ROM in my RAM extension, I just want to avoid to be present when A15 high with minimum effort. Maybe a R/C combination could work. I will try out.
I am using a 128k static RAM but only wired as 32k RAM. Adresses from A0-A14 are connected only. So the upper 16k RAM is selected first (with A14 high) from $4000-$7FFF and the lower 16k RAM is selected after (with A14 low) from $8000-$BFFF. Anyway it worked before when /ROMCS created without extending it with /RFSH - but it was not very stable.RetroTechie wrote: What RAM chip(s?) are you using, and how do you have highest address lines on those wired?
So my last question again, what is typicall access time of ROM used by Sinclair and is it possible that ROM is activated when /M1 go down ?
Because the time for reading from /MREQ down to clock down during T2 (when ULA samples ROM data) is only about 220ns ???