Jump to content

Retro CP/M (with the CX16 and otherwise)


Recommended Posts

It should be obvious I am not a hardware hand ... where I say HA & LA "latches" above, if they are D latches, or bus transceivers with D latch functions, they will float with the new data on PA of the User Port when the mode moves from /HALE to /LALE to /W. They need to be flip-flops, to latch the data on the falling or rising edge of /HALE | /LALE, hold it until the next /HALE or /LALE,  and put it on the SRAM address lines whenever /BUSREQ is low.

OTOH whether the flip flops latch their data on the rising edge or falling edge latch might be down to price / availability of through hole parts for bread boarding. The only difference is write the address byte into PA THEN assert the mode with falling edge, assert the mode then write the address byte into PA with rising edge, so whichever one it is will determine the byte writing protocol. But either way, writing a sector will be a "DEC PB / INC PB" process for generating the mode.

Also, the Z80 /BUSACK obviously cannot be connected to /SELRAM, it has to go through a driver (74x373 are a good general purpose bus transceiver / latch), since when the /BUSREQ cycle is over it will be driven high by the Z80, and direct connect would contend with the /MREQ that normally provides /SELRAM. So make it 3 Main IC's, 2 flipflops, 1 LD & 1 dual 2-4 decoder (eg. 74x139), or a 7IC CP/M board.

An advantage of the Z80 multiple clock cycle memory access process is that it looks like 55ns should be fine for a 16MHz Z80. Unlike the 65xx memory cycle, both read and write states are asserted for MORE than one full clock cycle ... & +5v through hole 16MHz clock modules are inexpensive and still readily available. Though I would probably start breadboarding at 8MHz and then try faster clock modules at 2MHz intervals until I find out which one is too fast.

Edited by BruceMcF
Link to comment
Share on other sites

Of course, the ultimate goal includes direct C64 User Port access.
But the C64 User Port doesn't have as much GPIO. We've got Port B, PA2, /FLAG2, /PC2, and the two serial ports and their counters.

Given a CP/M card that plugs directly into the CX16 User Port block header, the cleanest is to create Port A on the User Port card using the serial ports and serial shift registers ... one Parallel In, Serial Out, one Serial In, parallel Out. That takes 16 clock cycles to transfer a byte, but:
1] For Z80->UP, the system can be set up to start a single shot byte load as soon as the /ALERT is generated, and we have two additional PortB lines, so if the server is doing something, when it polls the /ALERT line and then checks if the byte is loaded, quite often it would be, and if not it would only need one or two busy loops to retrieve it.
2] For UP->Z80 when /BUSREQ is asserted, in a loop:
- DEC PortB : INY : STY SerialOut : LDA (SRC),Y : NOP : NOP : NOP : INC PortB : STA SerialOut : NOP : NOP : NOP : CPY N : BNE -
... would be about enough spacing to handle it, which is still a lot faster than the fastest UART transfer a C64 can handle without a serial cart.

A CX16 expansion card version to avoid hogging the User Port GPIO might be two VIA's on a card, the first VIA driving a User Port compatible Parallel Port, the second VIA controlling the CP/M card as a block header daughterboard, and the two serial shift registers plus PB6&PB7 as four additional GPIO providing a UART or RS-232C serial port.

Mind, that expansion card would not be dedicated to hosting a CP/M card, it would be a second User Port for essentially any use of the first User Port.

Link to comment
Share on other sites

On 7/9/2020 at 12:15 PM, BruceMcF said:

So that's level 1 ... next post, level 3, the "CP/M card" like the Apple II card or the not always functional C64 CP/M cartridge.

Love the idea of making it possible to run CP/M on the X16!

Used to have a Microsoft Z80 SoftCard for my Apple computer to be able to run CP/M and software not native to 6502/DOS3x/ProDOS.

Classic:

332e0d606926d8b2fca0505fdf4220a8.jpg

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

I am also much more enthusiastic about having it than making it ... but I am enthusiastic ENOUGH about having it that I may make a trip to Shenzhen in the gap between the two week Chinese New Year holiday and the start of semester to see about getting it made if nobody else is game.

Link to comment
Share on other sites

  • 5 months later...
On 7/9/2020 at 8:18 AM, BruceMcF said:

They started out wanting to use the ACIA, that is, the WDC65c51. It has two serial ports, with FIFO buffers for each. But the transmit is buggy ... the status bit that says whether the byte has been sent doesn't work.

So then they shifted to a single serial port in Vera, with no FIFO transmit buffer but a FIFO receive buffer.

But when they expanded the Vera register addressing to allow more direct access to key Vera RAM locations effectively acting as control registers, they ran out of pins to use for the serial port.

So now they've shifted to bit banging the User port, similar to the way the C64 bit banged the User Port for its serial interface.

You could implement the whole 6551 (currently $7+) with a cheap ($1.50) ATMel Micro, and connect to the hardware UARTS. I can do the design and software if anyone is interested.

Link to comment
Share on other sites

7 hours ago, Terrel Shumway said:

You could implement the whole 6551 (currently $7+) with a cheap ($1.50) ATMel Micro, and connect to the hardware UARTS. I can do the design and software if anyone is interested.

Sure you can, but then in the eyes of many, then it's just another ATMel Micro project. The appeal of using the 6551 for the reference design is that it's an ASIC in production.

Also, if you want to emulate a 6551, you need to run it at a fairly high clock speed to read and write the registers in a single 65C02 clock cycle at 8MHz without the use of the RDY line. That's one difference between this project and doing a similar chip emulation on a C64 system ... for any given microcontroller clock speed, you have 1/8th the clock cycles to present a register data that is being read in the current phi2 low phase (reads are normally the bottleneck if the microcontroller allows you to set up the data lines with an internal buffer).

Link to comment
Share on other sites

I do not care so much of having CP/M on the X16, I would get a dedicated machine for that and they are not too pricey.

What I do care about is having a proper serial port. Not having that is a huge turnoff for me. Would at least be possible to have it in the motherboard design even if it is not populated? I have one or two 6551 in my stash, there are new serial adapters using Rockwell 6551 sold on Ebay for the C64, not sure where they are sourced from.

Link to comment
Share on other sites

1 hour ago, hth313 said:

I do not care so much of having CP/M on the X16, I would get a dedicated machine for that and they are not too pricey.

What I do care about is having a proper serial port. Not having that is a huge turnoff for me. Would at least be possible to have it in the motherboard design even if it is not populated? I have one or two 6551 in my stash, there are new serial adapters using Rockwell 6551 sold on Ebay for the C64, not sure where they are sourced from.

That's what the expansion hoards are for. Seems like a 6551 expansion board would be pretty straightforward.

  • Like 1
Link to comment
Share on other sites

  • 3 months later...
Posted (edited)

It might be possible to write a CP/M 8080 emulator for X16, just like there exists one for C64, which I tested some years ago.

I tested the following 8080 emulator with CP/M on Raspberry Pi in 2014:
https://nanochess.org/emulator.html

This source code is rather difficult to understand, but one could write an Intel 8080 emulator from scratch that has the same instructions for peripheral operations and then the rest of the files should work. Not all CP/M software works on 8080 since Zilog Z80 was more common. I have PCs with V20 and V30 CPUs (80186 super set) that can emulate 8080 in hardware and there was also CP/M-80 for PCs that used that 8080 emulation. My Amstrad PC1512 had originally 8086 CPU, but I switched it to V30.

I found a tutorial on how to write an 8080 emulator: http://emulator101.com/

Edited by mobluse
  • Like 1
Link to comment
Share on other sites

6 hours ago, mobluse said:

It might be possible to write a CP/M 8080 emulator for X16, just like there exists one for C64, which I tested some years ago.

I tested the following 8080 emulator with CP/M on Raspberry Pi in 2014:
https://nanochess.org/emulator.html

This source code is rather difficult to understand, but one could write an Intel 8080 emulator from scratch that has the same instructions for peripheral operations and then the rest of the files should work. Not all CP/M software works on 8080 since Zilog Z80 was more common. I have PCs with V20 and V30 CPUs (80186 super set) that can emulate 8080 in hardware and there was also CP/M-80 for PCs that used that 8080 emulation. My Amstrad PC1512 had originally 8086 CPU, but I switched it to V30.

I found a tutorial on how to write an 8080 emulator: http://emulator101.com/

My PPC640 had a Vsomethingy ... I think V30 ... so maybe it was a later run.

But a Z80 emulator (or 8080) on an 8MHz 65C02 will be awfully slow. I want a Z80 system that is BETTER than the one I had in the early 90s ... though it certainly won't be more PORTABLE than the one I had in the mid-80's (even if that one was fairly slow).

Link to comment
Share on other sites

  • 1 month later...

There is a CP/M computer emulator for iPhone (and probably iPad): iAltair
https://apps.apple.com/se/app/ialtair/id291182085

More documentation: https://schorn.ch/ialtair.html

It's possible to use this with a Bluetooth keyboard (but it also works with the screen keyboard) and to paste in text from the iPhone's clipboard. One can also save to the built in diskette.

BTW The CP/M for V20 and V30, mentioned above, using the 8080 mode is called 22nice.

  • Like 1
Link to comment
Share on other sites

On 7/10/2021 at 1:50 AM, mobluse said:

BTW The CP/M for V20 and V30, mentioned above, using the 8080 mode is called 22nice.

I definitely recall using 22nice as an emulator on a 386 machine to test my Forth line editor on an emulated version of a Z80 Forth, but it may well have been one of the early versions of 22nice that supported the V20 that I used on the PPC640.

Link to comment
Share on other sites

On 7/9/2021 at 10:50 AM, mobluse said:

There is a CP/M computer emulator for iPhone (and probably iPad): iAltair
https://apps.apple.com/se/app/ialtair/id291182085

More documentation: https://schorn.ch/ialtair.html

It's possible to use this with a Bluetooth keyboard (but it also works with the screen keyboard) and to paste in text from the iPhone's clipboard. One can also save to the built in diskette.

BTW The CP/M for V20 and V30, mentioned above, using the 8080 mode is called 22nice.

I tried that once; it’s disappointing that you don’t actually get an Altair front panel. Also, IIRC, there’s no way to pull data off and get data on to the virtual Altair. So it’s kind of useless as a portable CP/M computer, except for playing with the included software. 

Link to comment
Share on other sites

You can paste in data in iAltair from e.g. an email. You might request that the developer includes extra software such as fig-Forth. It is difficult to export data, but you can take screenshots and run them through OCR. 

Edited by mobluse
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

Please review our Terms of Use