Author Topic: Found a weird old computer dumpster diving. (z80?)  (Read 5112 times)

0 Members and 1 Guest are viewing this topic.

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15800
  • Country: fr
Re: Found a weird old computer dumpster diving. (z80?)
« Reply #25 on: March 28, 2020, 10:58:02 pm »
I couldn't see much of anything under the speaker. You should put it away. Knowing how much RAM there really is will give an idea of what could be done with this board. I wouldn't bother with CP/M with less than 32KB.

Next step would be to reverse-engineer the address decoding. I think that's all you'd really need to do. And then write your own programs. I'd probably replace the EPROM with some 5V flash chip so you can reprogram it faster/make your life a bit easier.
 

Offline grumpydoc

  • Super Contributor
  • ***
  • Posts: 2932
  • Country: gb
Re: Found a weird old computer dumpster diving. (z80?)
« Reply #26 on: March 28, 2020, 11:15:44 pm »

Disassembly from a ROM dump is a fool's exercise.  All the author needs to do is put in some bogus 0x21 (LXI  H) bytes to throw off disassembly.  The next two bytes would be an operand for the LXI H but are actually the start of some other instruction because the LXI H is never executed.  The BDOS component of CP/M has this feature.  Or at least that's what I came up with when I tried to disassemble it.  The first byte of any other multi-byte instruction will do the same thing.

Just scatter so DB 0x21 instructions in the code.

IIRC this "feature" was not intended as an obfuscater but as a code-dense way of implementing a decision chain which would be expressed in C as
Code: [Select]
if (a) {
    z=const1;
} else if (b) {
    z=const2;
} else if (c) {
    z=const3;
{ else.....

Assuming that z can be held in an 8 bit register the 8-bit direct load is 2 bytes - if you don't mind sacrificing a 16-bit pair you construct a block of 16-bit immediate loads where the 16-bit "operand" is actually an 8-bit load.

You then jump in at an 8-bit load and "fall-through" all the 16-bit loads to the next bit of code. Saves a byte per element over a stack of
Code: [Select]
    ld reg, const
    jr next_bit

IIRC the Microsoft Z80 BASIC interpreter used the same trick.

As for the board - obviously a controller for the device that you mention - too little RAM (looks like the 2k "non volatile" chip is all that it has) to be much use as a general purpose computer.
« Last Edit: March 28, 2020, 11:22:01 pm by grumpydoc »
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Found a weird old computer dumpster diving. (z80?)
« Reply #27 on: March 28, 2020, 11:37:31 pm »
I couldn't see much of anything under the speaker. You should put it away. Knowing how much RAM there really is will give an idea of what could be done with this board. I wouldn't bother with CP/M with less than 32KB.

Next step would be to reverse-engineer the address decoding. I think that's all you'd really need to do. And then write your own programs. I'd probably replace the EPROM with some 5V flash chip so you can reprogram it faster/make your life a bit easier.

Depending on how the address map is arranged, adding RAM could be fairly trivial. All you need is a single SRAM chip and some address decoding which can either be done the old fashioned way or with a small CPLD.

I'd get the map worked out first though and then write a "hello world" program to blink an LED assuming there is one.
 

Offline obiwanjacobi

  • Super Contributor
  • ***
  • Posts: 1013
  • Country: nl
  • What's this yippee-yayoh pin you talk about!?
    • Marctronix Blog
Re: Found a weird old computer dumpster diving. (z80?)
« Reply #28 on: March 29, 2020, 06:23:19 am »
Confused:

Code: [Select]
0x21 (LXI  H)

does not sound like a Z80 instruction.

21-hex translates into 'LD HL, nn' ...?
And I have never heard of mnemonic 'LXI'...

Please explain.
Arduino Template Library | Zalt Z80 Computer
Wrong code should not compile!
 

Offline greenpossum

  • Frequent Contributor
  • **
  • Posts: 408
  • Country: au
Re: Found a weird old computer dumpster diving. (z80?)
« Reply #29 on: March 29, 2020, 07:26:04 am »
And I have never heard of mnemonic 'LXI'...

Oh dear. The Z80 instruction set is a superset of the 8080 instruction set but the designers chose to use different (and IMO better) mnemonics. LXI H is simply load immediate extended, i.e. HL, to old timers. So really the same instruction.
« Last Edit: March 29, 2020, 07:31:04 am by greenpossum »
 

Offline obiwanjacobi

  • Super Contributor
  • ***
  • Posts: 1013
  • Country: nl
  • What's this yippee-yayoh pin you talk about!?
    • Marctronix Blog
Re: Found a weird old computer dumpster diving. (z80?)
« Reply #30 on: March 29, 2020, 07:59:14 am »
Oh dear.

Yeah - well you can't know everything ...

Even then - sprinkling LD HL, nn's around requires 3 bytes not 1 and can really mess up the logic if you start loading HL with random stuff.
I still don't understand how this could work.

But I don't want to take the discussion too far off topic so lets drop it.

---

What I find puzzling is that these opto-couplers go to beefy connectors.
I would expect smaller connectors or some sort of switching transistors.
How much current (or voltage?) would this be good for?
Arduino Template Library | Zalt Z80 Computer
Wrong code should not compile!
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22436
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Found a weird old computer dumpster diving. (z80?)
« Reply #31 on: March 29, 2020, 11:50:21 am »
Probably they're just using the connectors for convenience, or consistency.  Those are, the uh... Molex something ancient, can't remember the series offhand unfortunately.  They'd be rated for some amperes, 8A I think, give or take the usual disclaimers of course.  Not that you need to use them at that level or anything.

The optos are good for a few to 10s of mA.  They all seem to be pointed inboard, actually, and the current-limiting resistor (on the connector side) seems to be present as well.

They're also rated for some kV of isolation, but the board does not appear to be designed for any significant voltage.  It's probably a belt-and-suspenders solution for galvanic isolation (say <100V).

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15800
  • Country: fr
Re: Found a weird old computer dumpster diving. (z80?)
« Reply #32 on: March 29, 2020, 02:44:03 pm »
I couldn't see much of anything under the speaker. You should put it away. Knowing how much RAM there really is will give an idea of what could be done with this board. I wouldn't bother with CP/M with less than 32KB.

Next step would be to reverse-engineer the address decoding. I think that's all you'd really need to do. And then write your own programs. I'd probably replace the EPROM with some 5V flash chip so you can reprogram it faster/make your life a bit easier.

Depending on how the address map is arranged, adding RAM could be fairly trivial. All you need is a single SRAM chip and some address decoding which can either be done the old fashioned way or with a small CPLD.

Certainly, but at some point, you'd waste less time redesigning a full Z80-based board rather than trying to reverse-engineer and reuse this one, if you have something like this to add - and it may not even be possible to effectively modify the address decoding scheme if the original design had no free zone.

In any case, as I pointed out and you also mentioned, figuring out the address decoding on the board would be the first thing to do before deciding.
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Found a weird old computer dumpster diving. (z80?)
« Reply #33 on: March 29, 2020, 05:52:55 pm »
Sometimes it's just fun to hack something, even if there's no really logical reason to do so. One advantage of using the existing board is that you know it's wired up correctly and works.
 

Online rstofer

  • Super Contributor
  • ***
  • Posts: 9964
  • Country: us
Re: Found a weird old computer dumpster diving. (z80?)
« Reply #34 on: March 29, 2020, 07:26:36 pm »
Confused:

Code: [Select]
0x21 (LXI  H)

does not sound like a Z80 instruction.

21-hex translates into 'LD HL, nn' ...?
And I have never heard of mnemonic 'LXI'...

Please explain.

Yes, I used the 8080 mnemonics, oops.
Either way, it is a load immediate of the HL pair with the constant bytes following the command.
 

Offline tsvisimchaTopic starter

  • Contributor
  • Posts: 13
  • Country: us
Re: Found a weird old computer dumpster diving. (z80?)
« Reply #35 on: March 29, 2020, 09:41:26 pm »
Hey all I'm having some trouble figuring out how to dump the eeprom. Any ideas? I have a bus pirate and a raspberry pi. I also have an Nvidia Jetson nano which has gpio.
 

Offline greenpossum

  • Frequent Contributor
  • **
  • Posts: 408
  • Country: au
Re: Found a weird old computer dumpster diving. (z80?)
« Reply #36 on: March 29, 2020, 10:09:49 pm »
Hey all I'm having some trouble figuring out how to dump the eeprom. Any ideas? I have a bus pirate and a raspberry pi. I also have an Nvidia Jetson nano which has gpio.

It's just a UV erasable parallel EPROM, not electrically erasable serial EEPROM. You'll need to peel off the sticker to find out if it's a 2764, -128, -256 or even -512. You could build an EPROM reader from an Arduino but you proabably need a port expander. You'll need an (E)EPROM burner if you intend to make your own.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 13217
Re: Found a weird old computer dumpster diving. (z80?)
« Reply #37 on: March 29, 2020, 11:27:59 pm »
An Arduino Mega 2560 has enough I/Os (and even enough complete 8 bit ports) to read even large parallel EPROMs directly.  A UNO, NANO or similar doesn't have enough I/Os.  You've got 11 available digital pins (excluding D0/RXD and D1/TXD for host comms) and six analog pins that can be used as digital, for a total of 17 I/Os.  Add an eight bit counter for EPROM A7:A0, with clock and clear from the Arduino I/Os, and you can read anything up to a 27C256 (32Kx8).

Your bus pirate doesn't have enough I/Os broken out so will need I/O expanders.  Probably the best bet is 2x 8 bit SIPO shift registers (e.g 74HC595) to drive the address bus and an 8 bit PISO shift register (e.g. 74HC165) to read the data bus, driven as a SPI device.  N.B. the data will lag one SPI frame behind the address.

A Pi has enough I/Os, but the 3.3V levels will be a royal PITA interfacing to a 5V EPROM.  Probably the best option would be to use 74HCT (HCT to get 3.3V input level compatibility) shift registers in the same way as you would with a bus pirate, with a 1K8-3K3 resistor divider to drop MISO to 3.3V levels.
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Found a weird old computer dumpster diving. (z80?)
« Reply #38 on: March 29, 2020, 11:53:00 pm »
If you want to dump the ROM, pick up a TL866, unless you have a lot of free time and want to hook up something like an Arduino Mega.
 

Online rstofer

  • Super Contributor
  • ***
  • Posts: 9964
  • Country: us
Re: Found a weird old computer dumpster diving. (z80?)
« Reply #39 on: March 30, 2020, 12:32:14 am »

Yeah - well you can't know everything ...

Even then - sprinkling LD HL, nn's around requires 3 bytes not 1 and can really mess up the logic if you start loading HL with random stuff.
I still don't understand how this could work.

You just sprinkle the 0x21s without the following two bytes.  The disassembler hits the LXI H instruction and considers the following two bytes to be the operand.  Unfortunately, those bytes are some other instruction entirely.


Code: [Select]

sub01: <do something>
       <do some more>
       RET

       db 0x21  ; the fake instruction to trip up the disassembler

sub02: LDA <addr>  ; the disassembler takes the first two bytes of this LDA instruction as operand bytes for the LXI H
       <do some more>
       RET

<lots more code>

       call sub01

<and more code>

       call sub02

<and so on>
[/font]

The point is, the LXI H, is never executed it is there simply to trip up the disassembler.  It looks like the start of a code block because it follows a RET but it is not really an entry point.
« Last Edit: March 30, 2020, 01:39:14 am by rstofer »
 
The following users thanked this post: obiwanjacobi

Offline grumpydoc

  • Super Contributor
  • ***
  • Posts: 2932
  • Country: gb
Re: Found a weird old computer dumpster diving. (z80?)
« Reply #40 on: March 30, 2020, 06:41:58 am »
The point is, the LXI H, is never executed it is there simply to trip up the disassembler.  It looks like the start of a code block because it follows a RET but it is not really an entry point.
Of course if you wish to deliberately get a disassembler out of sync any instruction which takes an operand placed before a block of code will do it.

However it will only consistently confuse simple disassemblers - more sophisticated ones which aim to build a list of entry points by scanning for jumps and calls will be harder to trick with this technique.

As I said the BDOS code and a similar block is not intended to confuse disassemblers (though it might do so) - it is there to turn a block of
Code: [Select]
ep1:    ld r, const1
        jr next_step
ep2:    ld r, const2
        jr next_step
ep3:    ld r, const3
        jr next_step
           ...
next_step:

into

Code: [Select]
ep1:    ld r, const1
db      0x21 ; fall through eating the 8 bit load immediately following - r should not be H or L, obviously           
ep2:    ld r, const2
db      0x21 ; fall through
ep3:    ld r, const3
db      0x21 ; fall through
           ...
next_step:

It saves a byte per entry point and is primarily about code density over execution speed (and clarity, until you recognise the trick).
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22436
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Found a weird old computer dumpster diving. (z80?)
« Reply #41 on: March 30, 2020, 06:55:25 am »
Also easy to find if it's only ever done with the 0x21 byte.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline greenpossum

  • Frequent Contributor
  • **
  • Posts: 408
  • Country: au
Re: Found a weird old computer dumpster diving. (z80?)
« Reply #42 on: March 30, 2020, 07:00:32 am »
If you want to dump the ROM, pick up a TL866, unless you have a lot of free time and want to hook up something like an Arduino Mega.

Plus OP will need the burner if intending to make his own *EPROM.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15800
  • Country: fr
Re: Found a weird old computer dumpster diving. (z80?)
« Reply #43 on: March 30, 2020, 03:49:14 pm »
If you want to dump the ROM, pick up a TL866, unless you have a lot of free time and want to hook up something like an Arduino Mega.

Plus OP will need the burner if intending to make his own *EPROM.

That's why I suggested the OP to replace it with a Flash chip. All you'd need is a TL866 which can handle these fine (check the one you select is supported) No need to mess with UV erasers and such.
I've done that to restore a Sinclair QL.

As I said before, I think reverse-engineering the address decoding on the board would be much faster than trying to figure it out from the disassembled code (I haven't seen any PAL/GAL, only discrete logic?), but in any case, a programmer such as a TL866 will come handy.

 


Offline greenpossum

  • Frequent Contributor
  • **
  • Posts: 408
  • Country: au
Re: Found a weird old computer dumpster diving. (z80?)
« Reply #45 on: March 30, 2020, 04:05:44 pm »
Will this work? https://m.aliexpress.com/item/32951386262.html?pid=808_0000_0101&spm=a2g0n.search-amp.list.32951386262&aff_trace_key=&aff_platform=msite&m_page_id=7316amp-6U1iuuFAU6RA7PUPX_omKQ1585583972595&browser_id=e9767940aded429aa2f1e4fb52beaf99&is_c=Y

It's a clone of this: https://www.microchip.com/Developmenttools/ProductDetails/PG164130 for programming PIC chips, not EEPROMs. TL866s start at around $50. If you don't want to spend that money, EEPROMs can be programmed with simpler circuitry with a Arduino. Something like this:  https://github.com/beneater/eeprom-programmer or many others that a search will get you. Those designs will also allow you to read an *EPROM. But a TL866 is handy for later too.
« Last Edit: March 30, 2020, 04:17:20 pm by greenpossum »
 

Online rstofer

  • Super Contributor
  • ***
  • Posts: 9964
  • Country: us
Re: Found a weird old computer dumpster diving. (z80?)
« Reply #46 on: March 30, 2020, 05:42:36 pm »
Also easy to find if it's only ever done with the 0x21 byte.

Tim

I know that any 3 byte instruction (LXI H, LXI B, LXI D, LDA, STA and others that don't come quickly to mind) will work.  I don't see why 2 byte instructions wouldn't do the same.

In any event, it's something to look for if the disassembly seems to go off the rails.
 

Offline TomS_

  • Frequent Contributor
  • **
  • Posts: 854
  • Country: gb
Re: Found a weird old computer dumpster diving. (z80?)
« Reply #47 on: April 01, 2020, 07:16:31 am »
What kind of chips am I going to need to get if I want to build a CP/M machine?
You might not be able to do it without significant modification. CP/M wants RAM to start from address 0, but the Z80 starts executing from address 0, so you have to do tricks to swap ROM and RAM after boot. Might not to worth it on a board like this if it was purpose built for some other application.

Otherwise there have been several Z80 machines built to run CP/M in recent times. Things like RC2014 can do it, there was a system by Sergey Kiselev and/or Grant Searle that could also do it. You might get some ideas of what you need from those systems.
« Last Edit: April 01, 2020, 07:19:09 am by TomS_ »
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 13217
Re: Found a weird old computer dumpster diving. (z80?)
« Reply #48 on: April 01, 2020, 02:08:35 pm »
Its reasonably easy* to make a daughterboard to fit in the Z80 socket, carrying the Z80, extra RAM and logic to remap the memory map to something CP/M compatible, but unless the I/O facilities on the DYONICS PS3500EP board are particularly spectacular and useful, it just isn't worth it - you might as well just rob it for chips to build your own no compromises Z80 SBC.

* assuming you are familiar with PCB design and comfortable ordering PCBs online, or alternatively are a demon at complex protoboard construction.


 
The following users thanked this post: TomS_


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf