CDP1802's RC2024/10 Stuff

Can I build some MZ-80K expansione? Let's find out!


Introduction - 09144 @ 0107

I've been quite a fan of the Sharp MZ computers for some time now. I own a handful of 'em, the list as-of writing being the 80K2 80C 80B 700 2200 (boardset only) 2511 2861 3500 and 6550. The 80K2 is without a doubt my favorite of all those models: It's the first of the bunch, it's the simplest of the bunch, it's got lots of cool software, I find the all-in-one form factor really neat, it has a well-documented history from both Japanese owners and UK-based clubs, and it has the dumbest (in a good way) keyboard of the pack.

A few years back I thought it would be pretty cool to try and track down a MZ-80I/O interface unit, the politely rectangular box with five card slots that sits outside the system and never blows RIFAs up causing your basement to smell horrible. Who wouldn't want to expand their computer with cool things like parallel cards? Everyone loves those, right? Well, even if ya don't, I found an I/O box on Yahoo Auctions for something like five thousand yen (it was around when the exchange rate was 114 yen to the dollar which meant I was more than okay with the price) and I couldn't say no to owning it.

Ever since getting that MZ-80I/O box I've had one major issue: I can't seem to find any expansion cards. I was able to get my hands on the goofy 8085-based MZ-80MCR, that thing that cost 198,000 yen back in the day and only exists to read piles of JIS X 6193:1975-spec info cards into your computer, I just haven't found a MZ-80MCB to go with it. I've seen the floppy interface cards go for sale but do I really want to pay $200+ for one let alone getting the always-popular associated drive unit? Worst of all, I haven't even found a parallel card for sale! Ain't that lame?

So, after years of staring at my very empty MZ-80I/O, I'm using RC2024/10 as an excuse to just go make an expansion card or two. My original thoughts were that I'd like to do some sort of RS232 card, a way to control my old Lionel trains, or something that lets me get the 80K2 on wifi that eventually becomes a FujiNet. Those are all neat but plans may have changed.

After filling out my RetroChallenge Entry, I noticed a funny little comment from the people running the event: Maybe CDP1802 can use the Sharp MS-80K to run a popcorn popper?!

I think I know what has to be done.


Things Begin - 10014 @ 1132

Well, it's the first day of October in Pennsylvania. I guess that means it's time to get started. This entry is really mostly just going to be me spitballing bad ideas 'cause I find that typing junk out actually helps me think through how to tackle a problem. Why not type that junk out where everyone else can look at it and find it goofy?

Popcorn. I am quite the popcorn enjoyer. My avatar for most online places is always munching some popcorn. I've got maybe sixty pounds of popcorn kernels in my house at the moment, a nearby ski resort was told to just throw away sacks of month-old kernels at the close of their last season so they let me take a few home. Someone gave me this "Amish Country" popcorn variety pack for Christmas last year that I've still got to try, it's got all sorts of cool-looking popcorn types in it. Have you ever had blue popcorn? I haven't, I guess I should try it since I have it!

Popcorn popper. I don't really own anything fancy. I bought a Presto PopLite when I moved into my current place because it was cheap, people said it's one of the faster machines on the market, and it's dead simple. Operating really couldn't be easier, you just pour however many kernels you want in the top (I usually do a quarter of a cup), put a bowl in front of the machine, put the lid back on, and plug the thing in. It does make a bit of a mess on my countertop but that's alright, it's not like popcorn is hard to pick up.

MZ-80K. It's a simple system. We've got a Z80, an 8255 to handle various things, an 8253, (up to) 48K of RAM, a monitor ROM, a simple character generator, and a goofy expansion port out the back. Said expansion port is what we're going to be focusing on for a little bit here, it's laid out something like this.

How do you talk to a popcorn popper that only understands "power outlet on" and "power outlet off"? Well, thanks to friend seatsafetyswitch and I chatting one night, I was reminded that X10 exists! It's a silly little home automation thing that lets you put lights and devices on a computerized timer of sorts. I have a few of these CM11A interfaces somewhere in my house that the previous owner left behind, I think they're buried back with all ethernet cable in my basement. They've got a little DE9 hanging off a cable, the idea being that you plug said DE9 into a serial port and then run their SW13A software. My MZ-80K is nowhere near powerful enough for said SW13A software, I think it wants at least some form of Windows which I'm a few miles away from technologically. What if I just make a real simple little MZ program to poke the interface?

Step one of things is that I'll need to make some sort of RS232 card. I assume this has been done in the past a million times over, serial ports are useful little things if I say so myself, so maybe digging through archives will get me some sort of schematic? It's alright if not, I have a few different UARTs laying around the home and I'm sure I can rig something up.

Step two will be writing a program, probably in BASIC because it's what I know, that pokes the X10 interface over said RS232 card. No promises that it'll be pretty, just a simple menu is about all I'm really capable of on a good day, but if I have time then I guess I can try my hand at those semigraphic characters.

In theory, with both steps working, I should be able to poke a popcorn popper from anywhere in the house. That would be pretty cool! I'll report back in as soon as I've got an idea of a schematic for said serial card.


Making A Serial Interface, Part 1 - From 10064 @ 2205 to 10074 @ 0123

I got some free time so I got started on step one of things, making some sort of RS232 card. Let's go over what I went over and what I've done:

I figured the first thing that would be useful to me would be the memory map of the MZ-80K, I can't be trying to throw something into a spot taken up by other stuff! The good 'ol Sharp User's Club magazines have a thing showing said memory map on Page 4, it goes something like this:
$0000 - $0FFF: The 4K Monitor ROM
$1000 - $11FF: The 512 bytes of work area for the monitor
$1200 - $CFFF: The 48K of RAM I have installed inside the computer
$D000 - $D3FF: The 1K of RAM for the character generator circuit
$D400 - $DFFF: Nothing
$E000 - $E00F: "Mapped I/O Ports"
$E010 - $EFFF: Nothing
$F000 - $F7FF: Space for a FDD Bootstrap ROM (or whatever else)
$F800 - $FFFF: Nothing

The only thing my brain could think after reading that was where are my periphreals on the memory bus and what the hell is a mapped I/O port? I've never actually designed anything for a Z80 before. I've done stuff with memory-mapped I/O on the 6502 and 68000, this clearly isn't that...

A quick look at the user's manual told me that I had no idea what it was talking about. My second thing I did was searching "how do z80 I/O ports work" which led me to this video. My notes on said video go something like this:

The video explained how the Z80 can use its lower eight address lines A0 through A7 alongside special lines called INT, IORQ, M1, RD, and WR to specifically request and address up to 256 things. It's 256 things because I don't know exactly why, what I do know is that you just divvy A0-3 up into your lower hex digit and A4-7 into the upper hex digit. If I set my lines to 10000001 then I'm probing port 81.

Said video talks about the 6850 ACIA. They mentioned some ACIA rules for function like how the chip:
is addressed when its CS0 and CS1 lines are High, the CS2 line is Low.
will do Transmitting/Receiving when RS is High, will do Control/Status stuff when RS is Low.
has an Enable line called E that sets the chip up when it's pulled high.
will Read data if the RW line is High, Write data if the RW line is Low.

The way they hook the ACIA up in the video is with A6 on CS2, A7 on CS1, M1 on CS0, A0 on RS, an inverted IORQ on E, WR to RW, and INT to IRQ.

So, I'm gonna attempt to see if I think I have the right idea here...
Rule one of the ACIA says that CS0 and CS1 need to be High, CS2 needs to be Low for the chip to to be selected as our I/O device. The M1 line goes active (low) whenever an instruction is being fetched else it's high, so as long as the Z80 isn't doing that then CS0 is set up. An OUT(81H) command will place 10000001 on A0 through A7, that sets up CS1 by A7 going High and sets up CS2 by A6 going Low
Us issuing A0 to go High on that OUT(81H) sets RS High, this tells the ACIA that we'll be doing Tx/Rx stuff.
We have a valid I/O address set on our instruction so the Z80 should see that and flip IORQ Low. We have an inverter flip said Low to High and that sets up our ACIA Enable line, said line enables the I/O buffers in the 6850 and starts clocking data.
If we have valid stuff in the data bus to be written then the Z80 will set its WR line Low, this pulls the ACIA RW line Low. With E enabled + RS set High + RW set Low the ACIA will start letting us transmit data.
If we're instead trying to receiver stuff into the data bus then we'll keep the WR line High, E enabled + RS High + RW High will let us address the ACIA to pull data over.
Did I get all that right? I sure as hell hope so.

So, that tells me at least the very surface-level basics of how I would hook a MC6850 to my Z80. I have a bunch of MC6850s laying around because they're usable in a bunch of old computers, sometimes they die and other times I just want more serial ports so they let me build random serial cards. I feel like I may as well use one here since I've been learning how it works! It really shouldn't require much on the board to work? I'll need the ACIA itself, an inverter (I know I have lots of 74LS04s laying around), something to get me to full RS232 signal levels (MAX232s do that just fine), a clock generator for the ACIA (I know how to do that with a 4060!), and a power supply for the board. I'd say "this is where the MZ-80I/O comes in handy because it gives +5V for my cards" but I don't know if I initially want to try doing this on a whole PCB, I feel like breadboarding the circuit (or perfboarding it) would be a better thing to intially do.

Here's my first attempt at a schematic with those chips, click the image to make it mildly bigger:

Old (@ 0123): I kept that same Port 81H address because I frankly don't know exactly what ports the MZ-80K is or isn't using, I couldn't just find a manual listing of 'em (yet). If I'm doing this on breadboard or something then it should be simple enough to change that if needed? I can just use different address lines or something like that. Will it work? I guess I'll just have to find out.

Edit (@0138): So there's this cool-ass website at http://www43.tok2.com/home/cmpslv/Mz80k/EnrMzk.htm (put that in archive.org because it's a dead site it seems) that just has two useful things in it:


If ya don't read Japanese, basically what that's saying is the following: I/O ports are reserved for actual I/O devices, no internal stuff eats any of 'em up, and basically from 0x05H to 0xEDH there's nothing that any particular periphreals want to reserve. Did you know there's an analog joystick for the MZ-80K? I didn't but now I do.

I'll be going back to my schematic and changing my I/O port to something easy to remember like 0x11H after some sleep. I'll hopefully be back by 1013 with a test version of this serial interface and we'll see if I can get it to do anything!


Return to the Homepage

Last Update: 10074-0123
Thank you for visiting!