Memotech Bill
Posts: 23
Joined: Sun Nov 18, 2018 9:23 am

Re: My own Retro homecomputer called RhoCoCo

Sun Nov 18, 2018 10:18 am

A suggestion for very simple bank switching. A single 8 bit latch (on an I/O port), and an 8 to 4 multiplexer driven by Z80 A15. This provides 16x32K pages of memory which can can selected for low or high half of the Z80 address range by writing to the low or high nibble of the latch.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12025
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: My own Retro homecomputer called RhoCoCo

Sun Nov 18, 2018 4:12 pm

Memotech Bill wrote:
Sun Nov 18, 2018 9:54 am
@mahjongg you may be interested in http://primrosebank.net/computers/mtx/p ... b80col.htm, a Propeller video generator specifically designed to interface with a Z80. Capabilities:

"Native Mode":
Text: 80x24x64 colours
Graphics: 320x240x64 colours (restricted to 2 colours per 8x10 character cell)

Also emulates a Texas Instruments TMS 9929A video processor (including sprites).

For the firmware source see the CFX-II Firmware page on the same site. The site also has a USB keyboard to Matrix keyboard translator, also using a Propeller.
Thanks! This is very interesting, and looks very promising. up-to now I only found video drivers I liked that produced video modes resembling the C64 (without sprites), but this seems even better.
I'm sure to study it.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12025
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: My own Retro homecomputer called RhoCoCo

Sun Nov 18, 2018 4:29 pm

Memotech Bill wrote:
Sun Nov 18, 2018 10:18 am
A suggestion for very simple bank switching. A single 8 bit latch (on an I/O port), and an 8 to 4 multiplexer driven by Z80 A15. This provides 16x32K pages of memory which can can selected for low or high half of the Z80 address range by writing to the low or high nibble of the latch.
Yes, this closely resembles my own solution, although I went for a 4-bit latch, an AND port for A14 and A15, and a 4-bit 2-channel multiplexer. so that the upper 16K could be selected from 5 different banks.

Unfortunately it would take so much space on the board, and use so many chips, (I don't want to resort to using programmable logic, or SMT) that I don't see how I could implement it without losing the extreme simplicity, and smallness of the PCB I have now.

I know a way how to get byte access to the second 64K bank, and start code in it, using nothing but software, and the ability to toggle A17 under Z80 software control that I have now. This would still give me ways to use the (essentially gratis) second 64K bank.
but yes, thanks for your input, it is certainly appreciated.

hippy
Posts: 5606
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: My own Retro homecomputer called RhoCoCo

Mon Nov 19, 2018 3:35 pm

The 74LS670 might be something worth looking at. That's a single chip 4x4 dual-port register file which allows 128KB to be mapped to a 64KB address bus in 8K pages, 256KB as 16KB pages, 512KB as 32KB pages.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12025
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: My own Retro homecomputer called RhoCoCo

Mon Nov 19, 2018 4:14 pm

hippy wrote:
Mon Nov 19, 2018 3:35 pm
The 74LS670 might be something worth looking at. That's a single chip 4x4 dual-port register file which allows 128KB to be mapped to a 64KB address bus in 8K pages, 256KB as 16KB pages, 512KB as 32KB pages.
Interesting, this could work, its a nice and small 16-pin DIP chip. Don't immediately see how it can work, but I see the potential. (if it can translate A14, A15, A16, and generate a programmable A17 on the fly) I will print out a datasheet and study it.

I could make place for it by reducing the 20-pin chip that holds I/O request addresses from an 8-bit latch to a 4-bit address latch in a 14 or 16-pin DIP if such a chip exists with four latches with three-state outputs.
or maybe I can cram it in somehow between the 74HCT574 and the PCF8574A.
have to see about that....

Thanks..!

hippy
Posts: 5606
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: My own Retro homecomputer called RhoCoCo

Mon Nov 19, 2018 5:15 pm

mahjongg wrote:
Mon Nov 19, 2018 4:14 pm
Don't immediately see how it can work, but I see the potential. (if it can translate A14, A15, A16, and generate a programmable A17 on the fly) I will print out a datasheet and study it.
Having looked at the datasheet I got the page specs a bit wrong but basically what Memotech Bill described, all in a single package -

Code: Select all

                                   .--------.
       .--------.                  |     Q3 |--> A18
       |     Q3 |--> A17           |     Q2 |--> A17
       |     Q2 |--> A16    A16 >--| RB  Q1 |--> A16
A15 >--| RB  Q1 |--> A15    A15 >--| RA  Q0 |--> A15
A14 >--| RA  Q0 |--> A14           `--------'
       `--------'
The A16/RB on the right can be tied to 0V if one only has a 64K address bus.

It's been a long time since I used that, way back in my MC6800 days, so I can't recall how the registers were written and set. Added: Probably D0-D3 to the data bus, WA to A0, WB to A1, /W decoded from the rest of the address bus.

I recall we did actually replace it with a PLA.

User avatar
scruss
Posts: 2359
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: My own Retro homecomputer called RhoCoCo

Mon Nov 19, 2018 9:56 pm

The Zeta SBC V2 uses a 74LS670 for this very purpose. The Zeta's a nice machine, but perhaps has too high a chip count for what you want to do. The folks on the RetroBrew Computers Forum have been all over bank switching options.

For a video controller, the VS23S010 is a bit clever, though not through-hole. It's used by the BASIC Engine gaming SBC along with an ESP8266 as processor.

6502 is alive and well in the VT Famiclone chips. There are also many 6502s available refurbed/repackaged, so I wouldn't feel bad about using it. You can make a tiny computer with a 6502 and not much else.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12025
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: My own Retro homecomputer called RhoCoCo

Tue Nov 20, 2018 10:22 am

scruss wrote:
Mon Nov 19, 2018 9:56 pm
The Zeta SBC V2 uses a 74LS670 for this very purpose. The Zeta's a nice machine, but perhaps has too high a chip count for what you want to do. The folks on the RetroBrew Computers Forum have been all over bank switching options.

For a video controller, the VS23S010 is a bit clever, though not through-hole. It's used by the BASIC Engine gaming SBC along with an ESP8266 as processor.

6502 is alive and well in the VT Famiclone chips. There are also many 6502s available refurbed/repackaged, so I wouldn't feel bad about using it. You can make a tiny computer with a 6502 and not much else.
Thanks, very great info.

But my decision to use a Z80 is made.

the VS23S010 is a great find, but I like the idea of VGA output better than PAL or NTSC. Small VGA (or DVI-D) monitors are everywhere, and cheap. and the propeller can also do a great job in providing sound, and do other tasks.

I realize many more people are doing the same kind of stuff as I am, its nice to see there is a small community.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12025
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: My own Retro homecomputer called RhoCoCo

Tue Nov 20, 2018 10:29 am

hippy wrote:
Mon Nov 19, 2018 5:15 pm
mahjongg wrote:
Mon Nov 19, 2018 4:14 pm
Don't immediately see how it can work, but I see the potential. (if it can translate A14, A15, A16, and generate a programmable A17 on the fly) I will print out a datasheet and study it.
Having looked at the datasheet I got the page specs a bit wrong but basically what Memotech Bill described, all in a single package -

Code: Select all

                                   .--------.
       .--------.                  |     Q3 |--> A18
       |     Q3 |--> A17           |     Q2 |--> A17
       |     Q2 |--> A16    A16 >--| RB  Q1 |--> A16
A15 >--| RB  Q1 |--> A15    A15 >--| RA  Q0 |--> A15
A14 >--| RA  Q0 |--> A14           `--------'
       `--------'
The A16/RB on the right can be tied to 0V if one only has a 64K address bus.

It's been a long time since I used that, way back in my MC6800 days, so I can't recall how the registers were written and set. Added: Probably D0-D3 to the data bus, WA to A0, WB to A1, /W decoded from the rest of the address bus.

I recall we did actually replace it with a PLA.
I only really need support for 128K RAM, I still have to see if I can fit another 16-pin DIP, and whether or not I can integrate the 74LS670 into my design. But I will try.
I start to realize that the current choice of propeller I/O ports for VGA and data-bus-IO is not very smart, port 1 (pins 1 to 8) are very close to my VGA port, and layout would be much cleaner if I swap port 1 and port 3. Maybe that will give me some room to work with.

hippy
Posts: 5606
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: My own Retro homecomputer called RhoCoCo

Tue Nov 20, 2018 12:11 pm

scruss wrote:
Mon Nov 19, 2018 9:56 pm
The Zeta SBC V2 uses a 74LS670 for this very purpose. The Zeta's a nice machine, but perhaps has too high a chip count for what you want to do.
Thanks for that link. It's good to see I wasn't entirely mis-remembering things from four decades ago!

The discrete chip count can be high when other memory address decoding is taken into account. That's why we ended up with it all in a PLA and I recall spending some time juggling with multiple CS pins on chips to minimise decoding signals.

CPU's which have separate memory R/W and IO R/W signals are a lot easier to use than needing memory-mapped I/O. I cannot remember now which families had those and which did not.

User avatar
scruss
Posts: 2359
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: My own Retro homecomputer called RhoCoCo

Tue Nov 20, 2018 1:38 pm

mahjongg wrote:
Tue Nov 20, 2018 10:22 am
But my decision to use a Z80 is made.
I'm totally with you on that. For me, the 6502 is that weird chip with too few registers, not enough stack and all those #^$%%$&^%$$ addressing modes. Then again, I've recently started doing things with the Harris HD-6120 (“PDP-8 on a chip”), and it has even fewer registers and no stack.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12025
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: My own Retro homecomputer called RhoCoCo

Wed Nov 21, 2018 12:32 pm

So I begun trying to make space for another 16-pin DIP on the very small PCB of rhococo.

This is how I plan to use the 74LS670:

Note that Z80-A14 and Z80-A15 are used to select one of the four bits for containing the settings for RAM-A14 RAM-A15 and RAM-A16. The bits are programmed using Z80-D0 .. Z80-D5, two databits are used to select one of the four bits, and three what the bits should contain. To program them the Z80 is halted, and tri-stated, so that the propeller can drive the data-bus. (below picture has been corrected).

Image

Memotech Bill
Posts: 23
Joined: Sun Nov 18, 2018 9:23 am

Re: My own Retro homecomputer called RhoCoCo

Wed Nov 21, 2018 12:55 pm

I think you may have the read and write addresses transposed. Otherwise looks good.

The one limitation of the chip is that it has no reset pin, which would be an issue if using a simple Z80 ROM & RAM boot.

Using the Propeller to perform the reset solves that. However, while that architecture minimises chip count, I am not sure it help understandability.
Last edited by Memotech Bill on Wed Nov 21, 2018 1:03 pm, edited 1 time in total.

hippy
Posts: 5606
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: My own Retro homecomputer called RhoCoCo

Wed Nov 21, 2018 12:59 pm

mahjongg wrote:
Wed Nov 21, 2018 12:32 pm
This is how I plan to use the 74LS670:
Looks good, should work, but I believe Ax should go to Rx, Dx to Wx.

[ cross-posted with Memotech Bill - Not sure where those 'other posts have been made' warnings keep disappearing to; sometimes one gets them, other times not ].

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12025
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: My own Retro homecomputer called RhoCoCo

Wed Nov 21, 2018 1:29 pm

Good catch! My bad, I corrected the picture, this one should now be okay, With the Z80 addresses on the read inputs, and the databits on the write inputs.

Image

the previous picture is also corrected, as they link to the same (now updated) picture.

That the chip has no reset input is of no concern, as the propeller initializes this chip, and also writes the ROM contents to the RAM, Rhococo needs no conventional ROM chips, everything runs from (pre-initialized) RAM.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12025
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: My own Retro homecomputer called RhoCoCo

Thu Nov 22, 2018 5:13 pm

Memotech Bill wrote:
Sun Nov 18, 2018 9:54 am
@mahjongg you may be interested in http://primrosebank.net/computers/mtx/p ... b80col.htm, a Propeller video generator specifically designed to interface with a Z80. Capabilities:

"Native Mode":
Text: 80x24x64 colours
Graphics: 320x240x64 colours (restricted to 2 colours per 8x10 character cell)

Also emulates a Texas Instruments TMS 9929A video processor (including sprites).

For the firmware source see the CFX-II Firmware page on the same site. The site also has a USB keyboard to Matrix keyboard translator, also using a Propeller.
I think I found the 80-columns .SPIN firmware here: http://primrosebank.net/computers/mtx/p ... m#firmware, but you said "Also emulates a Texas Instruments TMS 9929A video processor (including sprites).", but I don't think you meant that the same .SPIN code can do this too. I'm very interested in .SPIN code that emulates the TMS9929A code, as most video drivers I have found are either extremely simple (TV.SPIN) with very few characters per line, and numbers of lines, and no graphics modes, or are for very high density text modes (also without graphics). I want a video driver that does 40x25 text, and 320x240 graphics, in a high enough color resolution for games, and supports sprites. Especially sprites are invaluable.
So can you tell me where I can find propeller code that emulates a TMS9929A chip, as it sounds ideal.

The video driver should use no more than say 5 cogs, so that at least 3 cogs are left over for the Z80 interface (clock drivers, I/O and keyboard handling, and interrupt base video memory DMA between Z80 RAM and propeller framebuffer RAM) and a sound chip emulator.

I found a video driver that promises C64 text and graphics modes, but without sprites, but what I'm actually looking for is a video driver more like a spectrum, but sprites would be great.

Memotech Bill
Posts: 23
Joined: Sun Nov 18, 2018 9:23 am

Re: My own Retro homecomputer called RhoCoCo

Thu Nov 22, 2018 5:51 pm

@mahjongg, you found the correct code. (I had to download it again to check).

Yes the same code can either do "Native Mode", or do a mode switch to "Emulator Mode". This was designed to support the Memotech MTX range of computers which would either use "Native Mode" when running CP/M, or "Emulator Mode" when using ROM Basic or 8-bit games. Send the characters 0x1B, 0x9B to switch into "Emulator Mode". I will have to produce some better documentation. I think it was @DavidS who said that this is the hardest part of any project.

The "Emulator Mode" code is in the file "MTX_VDP.spin".

From memory the code currently uses all eight cogs. Partly that comes from clocking from 4MHz (X16 multiplier). If I remember correctly, if clocked from 6MHz, then "Native Mode" could save one cog. I will check over the weekend how many cogs are used for "Emulator Mode", however from memory:
  • Video generation: 2 cogs
  • Pattern plane rendering: 2 cogs
  • Sprite rendering: 2 cogs
  • Z80 Interface: 1 cog

Memotech Bill
Posts: 23
Joined: Sun Nov 18, 2018 9:23 am

Re: My own Retro homecomputer called RhoCoCo

Thu Nov 22, 2018 6:06 pm

One source of documentation for the TMS9929A is the back of the Memotech manuals, either "Memotech BASIC Tutor Reference and Operators Manual " or "Memotech Operator's Manual", downloadable from http://primrosebank.net/computers/mtx/mtxmanuals.htm.

Memotech were very good about documenting their hardware.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12025
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: My own Retro homecomputer called RhoCoCo

Thu Nov 22, 2018 6:54 pm

Memotech Bill wrote:
Thu Nov 22, 2018 6:06 pm
One source of documentation for the TMS9929A is the back of the Memotech manuals, either "Memotech BASIC Tutor Reference and Operators Manual " or "Memotech Operator's Manual", downloadable from http://primrosebank.net/computers/mtx/mtxmanuals.htm.

Memotech were very good about documenting their hardware.
Oh, I wrote low level code for MSX-1 (and MSX-2) so I am quite familiar with the TMS9929A, and the MSX white book, but thanks for the TIP.

I will study your TMS9929A emulator, I have an old Hydra system, I can try it on (with a 5-MHZ crystal instead of the Hydras normal 10-MHz one) before I order my RhoCoCo PCB's.

I'm very curious how well your TMS9929A emulator works, I understand you could run memotech games with it? So it should be quite good.

My original plan was to use a DMA mechanism to copy Z80 video RAM content to the propellers video buffer, on each vertical frame tick, but that might turn out to be slow, so using an I/O driven system such as the TMS9929A emulation supports could be a good alternative, especially if I can implement the native horizontal and vertical scroll support which the TMS9929A doesn't have, and which is the reason MSX games often don't do scrolling.
I might even in the far future try to implement some form of multi plane parallax scrolling, but that is just a point on my wish list.

Memotech Bill
Posts: 23
Joined: Sun Nov 18, 2018 9:23 am

Re: My own Retro homecomputer called RhoCoCo

Thu Nov 22, 2018 7:19 pm

VDP Emulation:
  • The top half of Propellor RAM emulates the 16KB RAM used by the VDP.
  • Another 12KB of Propeller RAM buffers 1/3rd of the raster display. The six video generation cogs chase each other around this buffer.
  • The first two cogs render alternate pattern lines into the buffer.
  • The next two cogs render alternate raster lines of the sprites onto the top of the background pattern.
  • The final two video cogs output alternate VDP raster lines (each raster line becomming two VGA lines).
  • There are flags to record the rendering status of each raster line.
  • A seventh cog, monitors the Z80 bus for writes to the VDP and copies the data into the emulated VDP RAM.
  • The final cog is used to provide a non-standard way of peeking back into the Propeller memory.

The emulation is reasonable, but not perfect. It is assumed that the Memotech is also running a real VDP, which will do the sprite collision detection and return the result. Also the VGA frame output is running at 60Hz, while the real VDP is producing frames at 50Hz. As a results you see some artifacts due to incomplete frame updates in the Propeller output.

Memotech Bill
Posts: 23
Joined: Sun Nov 18, 2018 9:23 am

Re: My own Retro homecomputer called RhoCoCo

Thu Nov 22, 2018 7:49 pm

It is also worth mentioning that the "mode switch" is messy. There is not enough room in ROM (or RAM) for the code and data for both modes simultaneously. So the data for one mode overlaps the code for the other.

If doing "Emulation Mode" only, much of this could be simplified. In "Emulation Mode" all the running code is on the cogs, and Hub RAM is used for data only.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12025
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: My own Retro homecomputer called RhoCoCo

Fri Nov 23, 2018 1:29 am

I foresee no immediate need for the 80 column video mode, but not having sprite collision detection might be a problem.
I will probably more use your code as a base, and build my own version up around it.

I have to study it some (a lot actually).

Thanks for the short explanation of the basics.

my main advantage is that I'm not concerned with needing to exactly emulate an old standard, as long as I get a capable video output.

at this moment in time I'm busy with trying to get the electronics ready, meaning adding a 74LS670 to my existing design, of which the layout was already finished, before I got some brand new ideas. For one, the information that the propeller can actually tolerate 5V on its GPIO's as long as you use a series resistor to limit the current flowing into protection diodes to 3V3 I did not know, and so I thought I needed a resistor divider.
And now I know how to implement a bank switching mechanism, hopefully I can manage to put it in while maintaining the size of my PCB.

Memotech Bill
Posts: 23
Joined: Sun Nov 18, 2018 9:23 am

Re: My own Retro homecomputer called RhoCoCo

Fri Nov 23, 2018 8:20 am

Yes, the Propeller can tolerate inputs from 5v logic, providing there is a suitable current limit. There is a data sheet somewhere on this.

However, there is a potential issue with bi-directional pins when outputting to LS chips. With the current limit resistors in place the pin on the LS chip is not pulled down hard enough to be reliably recognised as a zero. Not an issue when connected to HC chips as these have negligable input current.

Edit to add location of datasheet, here: https://www.parallax.com/sites/default/ ... e-v1.0.pdf
Last edited by Memotech Bill on Fri Nov 23, 2018 1:29 pm, edited 2 times in total.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12025
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: My own Retro homecomputer called RhoCoCo

Fri Nov 23, 2018 9:59 am

True, it means I need to find a HC(T) version of the LS670, I checked, and they do exist, even in DIP (CD74HC670E) but they might be hard to get. The SMT version is much easier to get. :(

another solution would be to use the data-bits directly from the propeller, but the layout is already very dense, it is probably not possible, but I can try.

User avatar
Gavinmc42
Posts: 3455
Joined: Wed Aug 28, 2013 3:31 am

Re: My own Retro homecomputer called RhoCoCo

Fri Nov 23, 2018 10:28 am

How old does the Pi have to be before it is retro?
When the Pi4 comes out , will it be "oh the old BCM2835 was so much more fun".

Most of us who can remember these old CPU's are getting a bit Retro ourselves ;)
I was looking for a TV/display with RCA input today, could not find one, wanted to test the Pi's composite output.
Gert has done VGA, perhaps use a Zero as a VDP/6845 emulator?

1802 was my fav CPU, only because I am into low power stuff.
Is the point of Retro is we like to think we knew everything back then and had total control?
Of course I am only using Pi's because the Prop 2 is still not here ;)

I can remember my Applix1616 68000 running Minix and an add on Z80 board came out for it and someone made a retro CP/M OS for it.
Now if you made PCBs for the RhoCoCo I might dig through the junk boxes and try to find a CMOS Z80.
Trying to remember how bank switching worked on the MicroBee.
Are 22LV10's still available?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Return to “Off topic discussion”