4 ms·
A long time ago (1991 maybe?) one of my first freelance projects during my first job out of college was to design an RS232 serial multiplexer -- take an incomin
by HeyLaughingBoy 3y ago
A long time ago (1991 maybe?) one of my first freelance projects during my first job out of college was to design an RS232 serial multiplexer -- take an incoming serial datastream, parse it, and redirect it to one of n outputs based on its header.
I remember doing something similar to what he describes. My hardware design was basically a Z80, a 2716 EPROM (I may have also had a Parallax EPROM emulator to speed debugging) and a couple of Z80-SIO serial devices. Notice that there is no SRAM chip :-)
The Z80 has enough registers that I could hold all the data I needed internally so I decided against the extra cost of RAM. This was the early 90's, remember. The one thing I was missing was a stack to make function calls. This was done (memory is fuzzy here) by preloading the return address onto a register pair and then calling the function. When the function was done, it would do an indirect jump to the location held in that register pair, which would return to the next instruction after the call.
I don't remember how I passed and returned values, but I probably dedicated a register to that. I have a couple of old hard drives around here somewhere. I should see if I saved the code anywhere; I was quite proud of it.
- Sponge5 3y agoYou should be proud of it, I can't even begin to think about programming with these constraints, and I work in embedded.
- billforsternz 3y agoThat is very cool and I say that as someone whose first project in my first job (1982) was to write the code for a serial multiplexer with a Z80, a 2716 EPROM, Zilog SIOs (or maybe DUARTs actually).... and 2K of static RAM. I basically learned my craft on the job and there's no way I could have done it without the RAM. A few years later I would have relished the challenge. Although you are really limiting the complexity of the protocol you can deal with ... (perhaps not such a terrible thing:).
- ChrisMarshallNY 3y agoWriting code for the old Mac serial chip was an adventure. I wrote a MIDI driver once, and that required dividing a 1MHz external clock, to get the 62.5KHz (I think) serial clock (you couldn’t divide the internal clock). Their chip had 8 control lines, with each line controlling some aspect of the chip operation. They set it up as the lower 8 bits of the 16-bit address bus, with the upper 8 bits fixed (so you were working with 256 addresses, to control the chip). So just referencing an address would change the state of the chip. A lot of hardware limitations influenced software structure, and I’ll bet that a lot of software proclivities have their genesis in weird hardware compromises (like bytes).
- smcin 3y ago'2716 EPROM' was a 16K (2kb x 8) EPROM. Which customer/sector was your project intended for?
- mytailorisrich 3y agoYes, the xx(x) number in the 27xx(x) EPROM series indicates the kilo (1024) bits. So indeed this is 2 KiB. This sounds OK for the application described, especially as it was no doubt written in assembly and obviously bare metal. When it does not fit but not far off it's when the fun of code optimisation kicks in ;) Edit: Very interesting how easily available they still seem to be according to Google.
- smcin 3y agoOk I was trying to help you communicate "8-bit CPU which had 14 registers, no RAM, tiny EPROM, no persistent storage/disk/SSD". And you were doing function calls.
- mark-r 3y agoMy first personal computer was a Z80 with a 2716. Into that 2K I fit basic monitor commands (dump/store memory), a terminal emulator with VT52 escape sequences, and a floppy boot loader. Got very good at squeezing out every last byte.
- HeyLaughingBoy 3y agoDon't remember. I do remember that I didn't get paid. I was so excited to have a freelance job (don't remember how I got the customer either) that I jumped right into it and worked heads down for a couple weeks. Then when I went to tell the customer that I was done and ready to ship, I couldn't reach him. Finally heard back from him about 6-12 months later and he was surprised that I had been working on it without hearing back from him and that he no longer needed the product. And that, kids, is how I learned to get at least partial payment upfront.
- deleted 3y ago[deleted]
- RiverCrochet 3y ago> This was done (memory is fuzzy here) by preloading the return address onto a register pair and then calling the function. When the function was done, it would do an indirect jump to the location held in that register pair, which would return to the next instruction after the call. This is pretty much what the MIPS `jal` and ARM `BL` do. TMS9900 also did something similar (edit: it had a `BL` instruction too.) I was fascinated by the fact the Signetics 2650 that had an 8-byte internal stack.
- HeyLaughingBoy 3y agoMC68xx series also had a 16-bit indexed jump. It's a very useful instruction.