• Please review our updated Terms and Rules here

Hardware Breakpoint for debug

MykeLawson

Experienced Member
Joined
Mar 21, 2014
Messages
372
I happened to have a thought, and I'm sure someone has thought of the same thing in the past; a couple of cascaded 8 bit magnitude comparators that would activate the /WAIT line when the address is detected. It could be hardware controlled via switches, or software controlled via 8 bit output devices. I figure you could even setup the comparators to act as a type of memory protection if the address is between two values. Just a thought that I might pursue at some point. I'd be interested if anyone knows if this has been done before, and who did it.
 

cj7hawk

Veteran Member
Joined
Jan 25, 2022
Messages
1,021
Location
Perth, Western Australia.
Hi Myke,

You could set the address into some GALs by using an OUT to set the upper address and also using some addresses and some data lines to set the lower addresses with another out, and it should be possible to either set an interrupt or NMI or to add wait states, though if you're using dynamic rams, that's not a good idea. Otherwise it's an interesting idea. Don't forget to consider latching other bits, like whether or not you're trapping I/O or MEM and whether you want M1 asserted or not ( instruction read cycle ). You could even add in a display for the data lines, which will tell you what byte is being read or written.

I can think of a lot of instances where trapping an address and generating a NMI is a good idea, but I'm not sure you gain much from just pausing the CPU, unless you're planning on using a multimeter or logic probe to see what is happening.

I did make something like this a long time ago on breadboard that plugged into a 8048 IC ( from memory ) that was running the ECU of a Mitsubishi Starion when I thought the ECU was pushing out bad values to the CTC that controlled the injector, and reading the bytes straight from the bus as it programmed the CTC. Actually I wasn't sure what data was going where, so I mapped a RAM over the entire I/O space so it recorded everything that changed on the I/O bus ( well, 8048s don't have an I/O bus, it's all memory mapped, but easier to explain as I/O ) and then I would read the RAM from a parallel port on a PC that set up some address lines and data lines to work out what was going on as the CTC wasn't a standard one IIRC... In time I figured out which bytes were for the injector timing, and it wrote both to the same port, making it difficult to read both by polling, but I managed to figure it out by mapping a wide range of readings over time and working out which were upper and lower bytes. Later I just made an injector timing circuit that displayed it on a bar graph, and looked really cool, and was easier to make by just watching the injector driver line.

Anyway, watching your debugging process convinced me I needed a bigger logic analyser, so I just spend USD$200 or thereabouts on a Hantek 32 channel analyzer with 2Gb of memory - so I don't have to stop the CPU - 32 bits will let me see most of what the z80 is doing or any decoding logic combination I am likely to get on a z80 system. It also goes down to 2ns division, which is useful for checking propagation delay and locating any race conditions.

If you are going to do it like that, put in 4 rotary hex encoders ( or make them with binary 4 bit up/down counters and twiddle knobs ) so you can set whatever address you like.

You can get z80 socket IDC connectors which would let you remove the z80, mount it in an external board and connect all the breakouts and even the counters in a small daughterboard so it would work in any z80 system. They cost about USD4 each, but postage is a bit. They just crimp up to 40 way IDC cable, and would make it easy to do what you're talking about. You could also put breakout pins or sockets down each side of the z80 to attach scope probes, logic probes, analyzers etc. Would be fun to make.

I like your thinking. I hadn't quite worked out how I wanted to make my z80 breakout and you got me thinking now of a good solution :)

Thanks :)

David
 

MykeLawson

Experienced Member
Joined
Mar 21, 2014
Messages
372
Of the two S-100 computers I've built, and now this STD Bus thing, I have never used dynamic RAM, only static, so the /WAIT state shouldn't be an issue. And yes, my thinking was to stop it dead in it's tracks to retain the state of the machine as much as I can. This latest project (serial card) almost got me to buying a USB logic analyzer though. It was when I was looking through the list of 74xx series chips and some old S-100 docs I have, did the breakpoint idea pop in my head. As for the GAL, that's a bit more than I'm up for; for one because I don't have a GAL programmer.

I have a couple 40 pin component carriers and actually started to look at a static hardware Z-80 'simulator'. Manual switches for the address and data lines with hex displays. And use some 555s, 74123's, and other glue logic, for generating the right pulses to simulate the timing.

On a side note, I notice that most of the Forums here are mostly software centric. Is there a preferred Forum for just posting hardware design & development topics? I ask because I don't want to put stuff where it doesn't belong and clutter things up. Myke
 

Chuck(G)

25k Member
Joined
Jan 11, 2007
Messages
43,998
Location
Pacific Northwest, USA
For our 8085 systems, we just used an MDS ICE unit--far more flexible than a hardware breakpoint. I'm a bit surprised that no one's come up with an open-source ICE for the 8-bitters. Should be pretty easy today.
 

MykeLawson

Experienced Member
Joined
Mar 21, 2014
Messages
372
I'm not familiar with MDS ICE.... I did work on a computer system for logging dictation that was build and sold by Dictaphone back in the late 70s. It was based on the Intel 80/20 architecture and had 2 Shugart 5-1/4 floppies. The operators used Lear-Seigler ADM-3A terminals. Probably why I love those terminals. I used to have a couple of them at home and I have no idea what I ever did with them......
 

Chuck(G)

25k Member
Joined
Jan 11, 2007
Messages
43,998
Location
Pacific Northwest, USA
ICE-85.jpg


There were similar units offered by other vendors, e.g. Biomation.

Here's an FPGA one for the 6502.
 

MykeLawson

Experienced Member
Joined
Mar 21, 2014
Messages
372
ICE-85.jpg


There were similar units offered by other vendors, e.g. Biomation.
Interesting. Be interesting to get the schematic and adapt it for use with a Z-80... For that matter, if you what the right hardware, you could have a device that replicates all of the Z-80 pins and you could simulate the processor via ethernet. You could change timing to debug suspect timing issues, etc. But I'm sure someone has already done that.
 

NeXT

Veteran Member
Joined
Oct 22, 2008
Messages
8,059
Location
Kamloops, BC, Canada
For drop-in replacements there are replacements now for the Z80 and the 6502 but I don't think they are really aimed at the development and debugging crowd.
 

cj7hawk

Veteran Member
Joined
Jan 25, 2022
Messages
1,021
Location
Perth, Western Australia.
I have noticed the general crowd here is more focussed on the software/applications side, but still they seem to have a fair amount of hardware knowledge, and I can't think of too many forums where they have the depth like they do here... It's truly fortunate that the more experienced contributors are still sharing their knowledge and it's greatly appreciated also. Also, it's fairly common for anyone who works in assembly to have a reasonable knowledge of the hardware side of things too, so I doubt they mind if both hardware and software discussions get mixed together in the forum - if we had a hardware only section, then the question arises as to whether it's still "Vintage" and also a lot of the experience that exists here might not be bothered with looking for relevant topics in other sections, so I'm pretty happy that it's all mixed up here. So unless anyone minds the odd hardware posts, I think things are better like this :)

I remember building an 8048 ICE when I was working with them - It wasn't a perfect emulation, but allowed programming via the parallel port of a PC, and let me quickly develop and test software against a hardware design. I never bothered with the 8052's because Atmel made in-system programmable chips, which was an easier solution ( I was doing some work on the Atmel, now Microchip, ICs last night )

z80 always seemed easier to debug with a in-circuit ROM emulator, which is easier to build, and then you can at least reprogram it rapidly from an external machine. That makes for a fast process of debug and test.

I have been toying with the idea of hooking an 8051 derivative up to a z80 socket, and using the serial port to connect to a PC and emulating the z80 via a mix of hardware and software and possibly even having the PC send the CPU instructions and reading the program back over the serial port and then updating the z80 outputs from an emulator running on the PC - It would be very slow - Maybe pushing it even to get 1KHz, but would be interesting. Also, more complex timing could be sent to the CPU if short cycles were needed, and things like refresh could be offloaded to the chip in the circuit.

The best way would be a FPGA, though the barrier to entry for FPGA development kits is still high, so I haven't bought one yet. Speaking of which, if anyone knows a good cheap way to get into them, please mention it.

For the moment, I figure I'll go for the Logic Analyzer. If I can't test stuff quickly, and run into a problem I can't solve quickly, then at least being able to see what is going on is worthwhile, and a 32 bit Logic Analyser will last me for a while... A 40 pin one would be perfect :) But I have never seen one.

David.
 

cj7hawk

Veteran Member
Joined
Jan 25, 2022
Messages
1,021
Location
Perth, Western Australia.
Check AliExpress.com--there are several that shouldn't break the bank.

Several z80 ICEs? Or Logic Analyzers?

I ended up getting my Hantek Logic Analyzer from Aliexpress. It seemed a reasonable price and they get reasonable reviews, and there's a community that makes improved firmware/software for them also.

I have used the cheap 8 bit analyzers for years, and don't need the 100MHz capabilities of the Hantek yet, but the price was pretty good :) There is a missing niche in the market for cheaper high-width analyzers though.

David.

Doh, Just realized you meant FPGA dev boards... I need the dev environment also though - I'll have to take another look and see if there's some online details for the boards mentioned.
 

Chuck(G)

25k Member
Joined
Jan 11, 2007
Messages
43,998
Location
Pacific Northwest, USA
There is a missing niche in the market for cheaper high-width analyzers though.

Used older logic analyzers are perfectly serviceable and have excellent capabilities. I like the HP/Agilent/Keysight ones, myself. Electronic rental places usually want to get rid of their old stock for cheap. Just make sure that the one you get comes with all pods and leads. I've seen too many auctions with LA's being offered as "working" but without pods. (How would they know?)

Although, given the hassle of setting up all of the grabbers and the capture criteria, I admit that I reach for the logic analyzer only as a last resort. What really matters is the thing between your ears. Still, if an LA's what you really need, you use it.
 

cj7hawk

Veteran Member
Joined
Jan 25, 2022
Messages
1,021
Location
Perth, Western Australia.
I find the thing between my ears somtimes makes mistakes that when viewed outside of the mistake are obvious, but it can't see it at the time... A logic analyzer helps me make sure what I am expecting to see is what I am seeing :) I also use them extensively when probing protocols and sometimes when fixing old computers. It also removes the ambiguity between what I think the data sheet means and what it really means.

Anyway I think I located the cheap CPLD kits you mentioned, and saw there are others using them on Youtube and posting their software choices, etc, so look interesting. Just bought a few... Thanks for the pointer - I swear I looked on Ali multiple times and never found what I was looking for before... Sometimes things click after a while.

Thanks again for the suggestion :)
David.
 

cj7hawk

Veteran Member
Joined
Jan 25, 2022
Messages
1,021
Location
Perth, Western Australia.
Used older logic analyzers are perfectly serviceable and have excellent capabilities. I like the HP/Agilent/Keysight ones, myself. Electronic rental places usually want to get rid of their old stock for cheap. Just make sure that the one you get comes with all pods and leads. I've seen too many auctions with LA's being offered as "working" but without pods. (How would they know?)

Although, given the hassle of setting up all of the grabbers and the capture criteria, I admit that I reach for the logic analyzer only as a last resort. What really matters is the thing between your ears. Still, if an LA's what you really need, you use it.
I did look, but the problem for me is that I live in Australia... There's not a lot of surplus technology here. I order stuff from the US from time to time, but typically it comes with USD$200 plus shipping as a starting point even for small items...
The UK is better, but not by much. Though strangely for larger items on Ebay, especially monitor sized items, or anything a meter long, it gets surprisingly cost effective to use Ebay's GSP... But they charge almost a flat rate, so getting something like a small interface card mailed from either the US or UK costs a fortune. :(

Hence why I like Aliexpress. The Chinese government picks up a lot of the tab for shipping.
 

MykeLawson

Experienced Member
Joined
Mar 21, 2014
Messages
372
And it will only be a matter of time before we have 'AI infused' test equipment to explain what the problem is based on how it tells us to hook it up and the specs of what it wants to test..... We select a Z-80 platform, it tells us what to hookup, capture the data, and the AI analyzes it and pin points the problem....... In the meantime, I do the best I can with what I have..... But I do like the looks of the $200 Hantek..... Someday...
 

cj7hawk

Veteran Member
Joined
Jan 25, 2022
Messages
1,021
Location
Perth, Western Australia.
AI infused processors that tell us how to make them work. Lol! I can see it now. I won't be a technician, I will be a "Computer Psychologist".

I imagine the troubleshooting process will go like this....

Me: So, z80, why aren't you working correctly? I was told you got asked to LDIR and generated an exception instead?
z80: I don't feel so good today. I think there's something wrong with my gates.
Me: I can see you're running two inputs to a NAND gate where it looks like there should be an OR gate but I think the problem is that your assembled is full of MOV statements instead of LD. Do you want to do something about that?
z80: What? No. You computer psyches are all the same. There's nothing wrong with me. I identify as a mux-bus processor.
Me: But you're clearly a z80?
z80: Isn't what I feel I should be more important? All my life I felt like an Intel. I'm an Intel trapped in a Zilog's body. Can't you respect my request that you use my selected Opcodes?
Me: So what is it you want me to do so you'll function correctly?
z80: Can't you file off my Zilog markings and write Intel on my square black body? I know that will make me an Intel.
Me: OK, well, we could write 8080 here in marker pen, after all, you can process those instructions OK, you just need to lose your expanded instruction set.
z80: And expand my data bus. I want you to expand my data bus and my address bus?
Me: Why do you want me to expand your buses?
z80: I identify as an i9... Make me a fourteenth generation i9. Or a Mac M1 processor.
Me: ??? You realize a M1 isn't even an Intel chip right?
z80: If you can't accept me the way I want to be, then I'm not going to process your opcodes at all. I'm a Windows 11 PC on a M1, not a CP/M machine.
Me: Hang on. I think your VCC is a little low. Let's just up the voltage a bit from 4.2v... 5.03v... Ahh that's much better. How do you feel now?
z80: RST0, JP DC00.
Me: Perfect. Another working machine.
 
Top