Monday, December 19, 2022

Z80-MBC2 Build Follow-Up: What Can It Do?


This is a follow-up to my 3 part “Z80-MBC2 Build”, you may want to check that out before reading this, links are below. All of the screenshots, GIFs, or video that I use in this post are captured from the uTerm output using a VGA to HDMI adapter feeding into a standard HDMI to USB capture device. More on that can be found on my “Cheap Capture Setup” page.

Building the Z80-MBC2: https://theclassicgeek.blogspot.com/2022/09/the-z80-mbc2-retro-homebrew-computer.html

Building the uTerm Terminal: https://theclassicgeek.blogspot.com/2022/10/z80-mbc2-build-part-2-uterm-vt100-style.html

The Final Assembly: https://theclassicgeek.blogspot.com/2022/12/z80-mbc2-build-part-3-final-assembly.html

Note: All of the games and software I talk about in this article can be found via the links below.

http://cpmarchives.classiccmp.org/

https://www.z80cpu.eu/mirrors/klaw/files.htm

http://cpmarchives.classiccmp.org/cpm/Software/rlee/index_dirHTML.html 

http://cpmarchives.classiccmp.org/cpm/mirrors/www.triton.vg/TesseractRCPM+Catalog.html




Now that we have that out of the way, and you have your newly built Z80-MBC2 computer up and running, what exactly do you do with it? That answer is probably going to be different for everyone, and if you’re one of those asking, “Why build something like this? It’s so OLD!”, then none of this is going to make much sense to you anyway. However, I will tell you what I’m using mine for and what it can be used for, at least at the time I wrote of this article.

The Z80-MBC2 isn’t a particularly powerful computer, however it’s considerably more capable than the original 70’s era machines it’s inspired by. One of my favorite things about this homebrew computer is its simplicity. As I said in my first post, I never had the chance to mess with machines of that era, this gave me a little bit of that opportunity, albeit with a modern design. I wanted to build this computer to give me an insight to the Z80 processor, a chance to play around with something other than a 6502 powered machine, and to play around in CP/M. All things I never had the chance to do before. Just for a bit of fun, and if you're curious how powerful this little homebrew computer is, here is the "ASCIART.BAS" BASIC program often used as a benchmark on these old machines. It manages to run it in approximately 2 minutes 30 seconds at 8MHz. Definitely not a speed demon, but for what this thing is, I can honestly say, it's not bad either. 

 NOTE: You may have to manually set the video quality to 720P.

I'm very happy with what this build, but you may be asking, what can it actually do? What can you use it for? The Z80-MBC2 is actually a pretty capable little computer considering its limitations. It can be a lot of fun to play around on and even be useful if you really wanted it to be.

Let’s start off with the first question most people ask about early computers, what types of games can it play? The Z80-MBC2 isn’t really capable of traditional graphics without external help, basically being limited to ASCII characters, and it has no sound, an Atari 2600 is lightyears ahead of it in those terms. That all being said, there are actually quite a few cool games you can play on this machine, and where it really shines is early text adventures!

Now before I jump into the games, I want to note that everything here is based on using the Z80-MBC2 with the uTerm. The Z80-MBC2 itself is actually capable of much more with different hardware and software. In fact, there is a pretty cool project I came across using a Raspberry Pi as a bare-metal ANSI terminal emulator, called PiGFX (linked below) that I will definitely be checking out in the near future. This gives the Z80-MBC2 the ability to display primitive color graphics, somewhat similar to that of the Atari 2600 or Colecovision. I highly recommend checking it out!

PiGFX Project: https://github.com/fbergama/pigfx

 



Zork, Zork 2, and Zork 3 are by far the most well-known text adventures you can play on the Z80-MBC2. All three games work perfectly and are a must for anyone looking to experience a true era appropriate gaming experience. There’s nothing like hand drawing maps on graph paper and having to actually use your imagination to visualize the environment. One thing these early text adventure games were very good at was descriptive storytelling, they had to be, and it’s rare to find games today that even come close to that level of storytelling. The best way I can describe them is classic “which way books”, it’s like reading an interactive novel, where your actions and decisions have a direct effect on the story and if you can reach the end of it. 

 


Of course, Zork isn’t the only text adventure series that can be played on the Z80-MBC2, Hitchhikers Guide to the Galaxy, Nemesis, Leather Goddesses of Phobos, and Planetfall are just a few more of the well-known text adventure games, all made by a company called Infocom. You can find all these games, and more, at the links at the top of this post.

If text adventure games aren’t your cup of tea, there are other options. As I stated above, the Z80-MBC2 doesn’t have real graphical capability, but it can display ASCII characters to create very basic graphics. Two well-known games, both actually written in BASIC, that take advantage of this are Gorilla and Star Trek. Both games are included with the Z80-MBC2 software.

Gorilla, a turn-based artillery game, is a simple game where two players try and hit each other with explosive bananas, while standing on top of several buildings, by taking turns entering speed and angle numbers to try and hit their opponent. Think “Worms”, but significantly simpler.

Star Trek on the other hand has you take command of the USS Enterprise, your mission is to try and eliminate Klingon warships that have invaded Federation Space, all by entering a series of commands to move the ship around and try to stop the Klingon's from reaching Federation Headquarters.

These are both fun little game that really show off what you can accomplish in BASIC on a machine like this. Of course, there are many simpler BASIC games out there, like the obligatory Poker, Blackjack, Hangman, word searches, and more. 

 




Lastly, there are games like Ladder and Catchum that take full advantage of the ASCII text characters to create two very fun and challenging titles. Ladder is sort of like a simple Donkey Kong, where you jump over holes, falling obstacles, and climb ladders, to try and reach the top of the screen. Whereas Catchum is a Pac-Man clone where you eat the dots while trying to avoid the monsters trying to eat you. Both games are a must and really show off what was possible on ASCII terminals of the era. Both are also included with the software for the Z80-MBC2, using CP/M 3.

If you’re having problems getting Ladder and Catchum to display correctly on the uTerm, then I have included links to my Archive.org repository that contain copies of both games that have been edited to include a VT180 config that works great with the uTerm. This was an issue that I had and it prompted me to reach out to Just4Fun, the projects creator, looking for assistance. 

After some back and forth he was kind enough to send me the copies he uses, and they both work perfectly. I got his permission to upload them for others who may be having the same problem. I also figured out you cannot use the original config editors to make changes to the games settings or controls without breaking the custom VT180 working profile. So I opened up the config file for each game in a Hex Editor and changed the controls to use WASD for movement to make it more friendly to modern players and uploaded them to my Archive.Org page.

Archive.Org Download (WASD Controls): https://archive.org/details/uTerm-CPM-Catchum-Ladder-WASD

 





What if you want to do more than just play games? Can a computer based on 40+ year old technology still be useful? The answer is, that depends on what you want it to do. One area a computer like this would excel is simple text editing. With software like WordStar running perfectly, you can easily create, edit, and save text documents in true retro fashion. There are also a good number of useful programs available for simple tasks like math calculations and conversions, recipe and phone number/address storage, custom database creation, and more. 

 


Another area of useful software I should touch on is programming. With the current setup, you can learn to program in languages like MBASIC (Microsoft BASIC) and UCSD Pascal (University of California, San Diego Pascal). Both are 70’s era programming languages that are relatively easy to use and learn and are included in the Z80-MBC2 software package. I will note that if you’re going to play around with MBASIC, then I highly suggest you do so in CP/M as booting into MBASIC does not support file saving, whereas if you run it under CP/M, you can save and load your work.

Like BASIC, UCSD Pascal was very common in the 70’s and early 80’s, and was on many different platforms as well, like the Apple II, original IBM PC, Motorola 68000, Texas Instruments TI-99/4A, and MOS 6502 powered systems like the Commodore machines of the era. UCSD Pascal was a full programming language system than ran on a p-code (portable code) virtual machine called the p-System, and like BASIC came in different versions.

Both MBASIC and UCSD Pascal are interesting trips down memory lane that I highly recommend to anyone who wants to experience this era of programming, and both can still be useful for messing around on old style machines.




The very last thing I’m going to cover is the operating system options currently available for the Z80-MBC2. First and foremost, and what a vast majority of people are going to run, is CP/M. Out of the box you can run CP/M 2.2 or CP/M 3, personally I run CP/M 3. This is a very well documented easy to use operating system that feels a lot like MS-DOS. The story behind CP/M losing out to DOS is a fascinating one that I highly suggest reading about if you don’t already know it.

 


The Z80-MBC2 also comes with the ability to run fig-Forth 1.3, but to be honest I know absolutely nothing about that OS so I’m not going to cover it on here, but a quick Google search will lead you down that rabbit-hole should you so desire. What I do want to touch on is the inclusion of Collapse OS, something that I only discovered recently. With my interest sparked, that’s the rabbit-hole I personally decided to go down.

Collapse OS exists for one reason, to survive the collapse of modern society, hence the name. Based on the aforementioned Forth OS, it’s an operating system and tool set designed to run on minimal and improvised machines to give people the long-term ability to maintain, program, and use simple computers, micro-controllers, and electronics, and to store data without the need for the internet or complex systems that will ultimately break down. It can run on just about anything from Z80, 8086, and 6502 powered machines and has an impressive list of features. It’s also available for free for anyone who wants to mess around with it and see what they can get it up and running on.

It’s a really neat concept, to build a simple OS around the idea that you may have to scavenge for parts or build machines for tasks with very low power requirements and limited tools. Making the OS 8-bit makes a lot of sense from that perspective, if you think about, processors like the Z80 and 6502 are still around in great abundance today, they are very easy to understand and work with, require very little power, and are very robust.

The author of Collapse OS states that the idea isn’t necessarily to preserve computers or computing, but electronics in general. Electricity, micro-controllers, and other simple electronics would indeed be highly beneficial and relevant to communities after such a societal collapse, and having a means to manage, program, and use it would indeed be very handy.

The dark side of my brain really liked the idea of Collapse OS, I’m one of those people who has actually spent time thinking about what I would do if something happened that threw myself and my family into the dark. What would we want to survive and be comfortable? On the technology side of things, low-power low-drain computers and electronics than can run on DC 5V, 9V, or 12V would be very handy since those voltages are very easy to produce, store, and use.

Collapse OS is just a neat idea that I thought was cool to see on the Z80-MBC2, an exercise in what we all hope is silliness. It means the Z80-MBC2 would still be useful in yet another way even after such an event. It’s a cool little “what if” operating system that tickled my inner prepper and was very glad to see included.

About Collapse OS: http://collapseos.org/




While all of this software is primitive by today’s standards, it can still be useful and fun to play with, primitive doesn’t have to mean useless. No one is going to replace their modern hardware with something like this, but there’s no reason you can’t have fun with it and get a little use out of it for the pure nostalgic experience of it all. Personally, there are days I find myself using old or retro machines like this Z80-MBC2 much more than my modern desktop. For me, it often feels much more rewarding and enjoyable to use. I know I’ve said it a couple times now, but if you get it, you get it. If not, then this probably just isn’t your thing.

Thanks for taking the time to read through all of this and I hope you found something useful along the way, or if nothing else you were mildly entertained.

Cheers!


Saturday, December 17, 2022

Z80-MBC2 Build Part 3 – Final Assembly


 
Author's Website (Just4Fun): https://j4f.info/z80-mbc2 <--- Check it out! 
 

 Now that the Z80-MBC2 and uTerm are both up and running, it’s time to give it all a nice home. I went through several different ideas on how I wanted the final computer to look, from doing a full custom 3D printed case, to a small “all-in-one” keyboard style case like the Commodore VIC 20/64 “bread bin”, to something “boxier” to better fit 70’s era machines like the Altair, IMSAI, and SWTPC. The custom 3D printed case idea died very early on, I quickly realized I simply don’t have the time or skills to design and print a custom case that size, at least not yet. Perhaps I will revisit this idea in the future once I’ve honed my 3D design and printing skills further. The VIC 20/C64 style bread bin sounded great until I realized I couldn’t realistically find a case to fit my needs, in the size I wanted, at a reasonable price, and I had no desire to incorporate the keyboard into the final build. In the end I settled on a much more realistic and era appropriate “boxy” case that better represented machines of that era and the vision I had in my head. Also, this style of enclosure is much more readily available, inexpensive, and easy to modify. 

 

Buy Case: https://amzn.to/3FD9XgF

I really wanted the final machine to look like a “next step” for these early CP/M machines, with proper front panel buttons and lights. As well the keyboard port on the front panel for ease of use. On the back panel I put the SD card, power, VGA output, and the transparent serial connection so you could still connect to the computer that way if necessary. The last thing I would like to do is extend the GPIO to the back so it could be easily accessed, but that’s something I will tackle later since I haven’t decided exactly how I want to accomplish that. I’ll likely use a simple pin header that can connect to an external break-out board via a ribbon cable.

Here are a few things to note that may influence your own design choices, as it did mine…

  1. Once you have the system setup how you like it, you’ll find yourself swapping the SD card out much less often, perhaps on the rare occasion you want to add something else you may have come across or if there’s an update released by the original Z80-MBC2 author. So having external front or back panel access to it isn’t necessarily a must, especially if your case is easy to open. I put mine on back for that reason, and because it’s a micro-SD and wasn’t sure if I could make the slot look nice enough to be front facing. Full size SD cards are easier to work with and I hate when I have to use my fingernail or a tool to insert and remove the micro cards.

  2. I put the keyboard port in the front instead of the back purely for convenience. My system won’t be setup in the same spot all the time, and will get moved around quite a bit, so it made more sense to put it on the front panel. Also, since that’s where the port is on the uTerm, it just made it easier for the internal layout. I also used a PS/2 to USB adapter for ease of use since a majority of USB keyboards will work fine with this computer.

  3. The transparent serial connection went on the back simply because it won’t get much use, but it’s still nice to have. I also went with USB type B because I prefer it over all the other port types. It’s more robust than its smaller counterparts and type B cables are still cheap and very abundant. I could have just used a pin header but incorporating the serial USB into the design just made things easier for later, especially since I have a few of these lying around and can spare one for this build.


Designing the layout and look of the front and back panels took quite a bit of time to get done and went through several different re-designs as the build progressed and I better realized how much space I actually had to work with. Getting it to look like it belonged in the late 70’s or early 80’s, with a bit of modern flare, wasn’t nearly as easy as I had thought. Once I was happy with the design however, it was just a matter of printing it onto sheets of adhesive vinyl to attach to the panels. The panels themselves had two options, drill and cut out the holes on the included panels or printing my own. In the end I decided to print my own to give me more 3D design practice, and it guaranteed a good fit. 

 



The inside layout was also a bit of a challenge, I wanted it as “clean” as possible, but I also had a very limited amount of space to work with. I had to extend everything to the front panel while trying to maintain the ability to easily disconnect everything if necessary. I thought about designing a custom front panel PCB, but I really didn’t want to wait for it to arrive and I wasn’t sure I could make it cleanly fit. So, I decided to just extend everything directly using pin headers. It makes it easy to replace anything that may go bad and it fits into the limited space. I also think it fits better with the overall aesthetic of the machine since many of these early home computers had a lot of DIY modifications.

Mounting the PCBs was accomplished using a custom 3D printed support structure that I designed to hold everything in place, but still allow for easy servicing should the need arise. The Z80-MBC2 and uTerm are both held in place using screws, and the SD card and RTC are held in place using 3M double sided mounting tape. The base of the support structure is screwed to the case, and the two upper sections are sitting on top of 6 removable 3D printed standoffs. It’s not perfect, but the overall design fits in the limited space, holds everything in place, is easy to disassemble, and it looks the part of a homebrew computer.

 



The final result pretty closely matches what I think a “next step” homebrew CP/M machine like this would look like. If nothing else it appeals to me, and that’s really all that matters. I love how it looks and it has given me the opportunity to explore an era of computing that I missed, even if only a little. The question now becomes, what to do with it? Will I actually use it? The short answer is yes, I’ll definitely use it. 


More photos coming soon!

One of the reasons I wanted the Z80-MBC2 was to learn more on how these old machines worked, and since their so simple, they’re easy to learn on. I enjoy messing around with the old software and games, and it can actually still be useful, but that’s not the real point. Sometimes the best part of a trip is the journey, not the destination. Most people will look at old retro machines like this and think “what’s the point?”, and if you have to ask that question, then I’m not going to be able to explain it to you. That simply means this isn’t your thing, and that’s fine, we’re all different, but if you’ve made it this far through all 3 long winded articles, then you probably already understand.

I had a great deal of fun building this machine, I learned a lot along the way, and ended up with a neat little retro computer that will provide me with countless hours of entertainment. From here I will be doing a follow-up article to cover more of software side of things, changes that may have been made, and share why I think an old-style homebrew computer like this can actually still be fun and useful. For now though, I’m just going to enjoy the fruits of my labor and say thank you for taking the time to read through all of this. I hope you found something helpful here, or if nothing else, it was entertaining. 

Read The Build Follow-Up - What Can It Do?: https://theclassicgeek.blogspot.com/2022/12/z80-mbc2-build-follow-up-what-can-it-do.html

Saturday, November 5, 2022

Simple and Inexpensive DIY Electronics Project Power Supply

When I started diving back into electronics a couple years ago, after my long hiatus, one tool I knew I was going to need was a variable power supply. At first, I was looking at just buying a standard bench power supply, they’re relatively inexpensive and would provide more than enough juice for the small low-powered devices I would be building or repairing. In fact, they were a huge overkill since most all the devices I work on run off 12V or less and draw so little power, many designed to run off 5V or battery. The other drawback was the fact I don’t yet have a dedicated workspace for all my projects, meaning I have to setup and tear-down my workspace when I need to work on something, so size and space is a concern.

Those factors lead me to look for an alternative solution, which landed me squarely in buck-boost converter territory. Small inexpensive DC to DC converters that can either boost or reduce an input voltage. I’m not going to go into a great deal of detail on the devices themselves, but you can check out this Wikipedia article on them if you’re curious. Since my power needs are currently so small, a decent buck-boost converter with a decent power supply to feed it is all I need, so that’s the path I chose.

From the start I knew I wanted two of them, a small “portable” one I can also use as a backup, and a somewhat larger more convenient one to use much more often. The small portable one was easy, I just bought one on Amazon from a company I already knew and trusted, Drok. I have used some of their buck converters in the past and all of them worked perfectly, so I picked up the model you see below. It’s more than capable of handling anything I would ever be using it for, inexpensive, and small enough to fit in my electronics toolbox. 

 


Buck Boost Converter: https://amzn.to/3tkr0i1

For my “project power supply” however, I wanted something a bit easier to use, and decided I would just build something simple around a buck-boost converter that I could quickly and easily adjust, connect and disconnect power, monitor power usage, and that I could mount in an enclosure but not take up a lot of space. I had originally wanted to buy a Drok unit like above, but they were sold out at the time, so I ended up going with a lesser-known seller, but it still worked just as well. The converter from “TXKEC” you see below is when I ended up buying.

Once it arrived, I tested it out to make sure it was working as intended and then looked for an enclosure to put it in so I could wire up a couple terminals, a power switch, and a barrel jack so I could use a standard brick power supply to run it. Lucky for me, I already had one on hand that ended up working out perfectly!

 

Enclosure: https://amzn.to/3UvRqsG

Buck Boost Converter: https://amzn.to/3fJ0cVb

Drok Buck Boost Converter: https://amzn.to/3FNI6Ml

For connectivity, I added a single banana plug style screw terminal and a single spring-joint clamp terminal. Like I said above, this will only be used on very low powered devices at 12V or less, so I don’t need anything “beefy”. For the power input I used a standard 5.5mmx2.5mm barrel jack so I could use many standard brick power supplies, with the one I chose being a 12V 36W 3A model, way more than I will ever need on this thing. From there I just had to modify the case to fit everything, add a power switch, wire it all up, make a couple cables using banana plugs, and make it all look nice. The end result is what you see below. 



This was a very simple build to perform a very simple task. For the low powered devices I work with a vast majority of the time, it’s all I need. It works perfectly and allows me to easily select the desired voltage, monitor the input output voltage, as well as the output current, power, and capacity. Using the two terminals I decided to go with means I can easily connect it up to just about anything I need. 

Overall, I’m very happy with my little “project power supply”. When the time comes and I need more power or more control, such as with classic computer repair or higher-powered devices, I’ll invest in a proper bench power supply, until then, this little guy is all I need.

Thanks for reading!

 

Monday, October 10, 2022

Z80-MBC2 Build Part 2 – The uTerm VT100 Style Terminal



 
Author's Website (Just4Fun): https://j4f.info/z80-mbc2 <--- Check it out!



The next step in building my idea of a “modern retro CP/M & BASIC computer” is building the uTerm. A VT100 style terminal for the Z80-MBC2 that gives it the ability to act more like a stand-alone computer. The uTerm would be the modern equivalent of a classic terminal you would have used back in the 70’s and 80’s to connect to a machine like this, allowing you to hook up a keyboard, monitor, and 9V power supply instead of having to use a serial connection to an existing computer, though that feature is still maintained via a transparent USB serial connection on the board.

The uTerm uses a standard old-school PS/2 style keyboard port, but most standard keyboards should still work with a simple USB to PS/2 adapter.

NOTE: 60% keyboards may not work, I have 2 of them I use for other tasks and neither worked on the uTerm. However, every other “standard” keyboard I have, including 10-keyless, worked fine.

It also uses a D'SUB VGA connector for the video, but here again adapters can be used to connect to displays that may not have that connection available. The best part about the uTerm is the fact you no longer have to use a terminal emulator, like Putty, to use the Z80-MBC2. It outputs a 30x80 column display and even has the ability to set the text color to either white, green, amber, or cyan to complete the retro feel of this machine.



Just like the Z80-MBC2, the build is pretty straight forward, there is bill of materials and schematics included that spell out all the components you need and where they go. All you have to do is track down the components and solder them into place according to those documents. Just like all builds, it’s good practice to test the components you can before using them in your build.

To make things even easier, you can buy the PCB on eBay for around $15 that already has the surface mounted STM32 chip pre-programmed, saving you one extra step if you don’t already have the necessary tools to flash the chip or ae not comfortable with SMD soldering. All the other components are relatively inexpensive and easy to find on Amazon, eBay, and other sites. Just like the Z80-MBC2, I already had most of the parts on hand, making the build even cheaper.

If you can't find the specific heatsink used in the authors build, that's not a problem. Any standard heatsink that fits the LM7805 and covers the entire regulator back, as seen on mine, will work just fine. It does get warm, but dropping 9V to 5V on such a low drain device doesn't produce enough heat to cause any problems using a smaller heatsink. If you have thermal pads or paste you can use, that helps as well.

 

The same advice for building the Z80-MBC2 also applies here, and I have compiled a list of links to all the parts you need on Amazon and eBay to help you along, and most of them are the ones I actually used. 

 

 

eBay Search for 74HCT00 NAND Gate - Note that it must be a 74HCT00N NAND Gate IC, any brand will work. Buy from sellers in the USA (or your local area) when possible to increase your chances of getting "good" parts. It  also makes it a lot quicker and easier to not only get your parts, but do returns if necessary.

eBay Search for uTerm PCB - If the PCB with the pre-programmed STM32 chip is still available, I suggest getting that one. If not, it simply means you have to buy the STM32F030F4P6 surface-mount chip yourself and program it. However, as of writing this article (October 2022), the STM32 chip is nearly impossible to find, so you may have to really look to find one.

Here is a socket kit I have not used, but contains all the necessary sizes: https://amzn.to/3E5tuaz 

I did not include individual links to all the resistors because these are really easy to find and have a pretty wide tolerance, and it’s somewhat difficult to get resistors so far out of spec you can’t use them when a project like this gives you a 5% tolerance variance. Many "cheap" resistors that claim they are within 1%, are actually 2-3%. Either way, for this project and many others, as long as you buy ones that say 1%, you’re generally safe.

Amazon Search 1/4 Watt Resistors: https://amzn.to/3SCccGt

Also, there are a lot of good resistor assortment kits sold on Amazon, and many contain almost all the ones you need for the Z80-MBC2 and uTerm, so you will only need to buy a couple values separately. Just remember 5% (shoot for 1%) and ¼ watt and you’re good.

In the bill of materials, they list 4k7 and 2k2 resistor values, this is just another way of writing 4.7K  ohms and 2.2K ohms.

For the LEDs, be sure to use the colors indicated, or other colors with the same forward voltage value. This is talked about on the project page as well.



If you bought the PCB with the pre-programmed STM32 chip already installed, then there really isn’t much more required once you have it all assembled, other than using the jumpers to select your color choice.

If you bought a bare board and the STM32 separately, then you’re going to have to solder the chip to the board, fully assemble the uTerm, and then flash the chip before you can use it. A programmer is needed to do this, but thankfully they’re cheap and easy to find on Amazon. The full instructions on how to do it are covered on the project’s homepage, linked above and below.

Programmer: https://amzn.to/3SOjk2o

How to Program the STM32: https://hackaday.io/project/165325-uterm/details 

(Scroll down to "HOW TO FLASH THE STM32 WITH THE ST-LINK V2" at the link above.)

 


Using the uTerm is easy. To power both the Z80-MBC2 and uTerm, all you need is a 9V power supply, a PS/2 keyboard or USB to PS/2 adapter and just about any USB keyboard, and a standard D'SUB VGA cable (and an adapter if you don’t have a monitor that accepts the VGA input). If you’re connecting the uTerm to the Z80-MBC2 directly, you don’t need the supplemental power cord running between the uTerm and Z80-MBC2, but if you’re going to run it detached the supplemental power connection is highly recommended. Mine has been slightly altered to better fit into my final case design. If you're using the supplemental power between the uTerm and Z80-MBC2, ensure you have the polarity correct before powering it up! Also, the 9V power supply must be center pin positive!

You don't need a beefy power supply, in fact, it will even run off a 9V battery for a while if necessary. As you can see from the photos, I'm powering mine using a simple DIY power supply I put together to test small 12V or less projects, that also allows me to measure usage information.

Here are some power and temp numbers running under load. Using ASCIART.BAS and LOG10K.BAS as benchmarks. Readings taken from my PSU and IR thermometer. Temps taken after 30 minutes of operation at idle and then under load at around 70F (21C) ambient.

Standard Keyboard (No Backlight): 0.090 to 0.100A / 0.81 to 0.105W max draw - Around 100F (38C) on the LM7805, hovering around 98F.

Standard LED Backlit Keyboard: 0.255 to 0.265A / 2.25 to 2.40W max draw - Around 110 to 115F on the LM7805, hovering around 111F (44C).

Note that the power draw and temps are affected by your choice of keyboard, however the numbers are so small it really doesn't matter much as long as your 9V source can provide the power needed. The temps using the smaller heatsink are also well within the safe operational range of the LM7805 voltage regulator. Remember, these voltage regulators work by dissipating the excess voltage as heat, and you generally don't want to operate electronics anywhere near their max operational temperature. The LM7805 can handle a lot of heat, but the max temp often used for safety is about 110C (230F), and we never go over 46C (115F). So this system stays nice and "cool" by LM7805 standards.

Once you have it all hooked up, just power it up and enjoy! I'm not going to cover troubleshooting in any detail for the same reason as on the Z80-MBC2, not enough time. However, if it's not working, make sure all the connections are hooked up correctly and securely, check to ensure you have the correct input selected on your monitor, and press the “Reset” button on the uTerm to see if that helps. You can also check the jumper settings for the color selector. If all else fails, hook the Z80-MBC2 back up to your PC using the USB serial adapter to ensure it's working. Note that there are test points on the uTerm PCB if you know how and need to use them, labeled as TP1, TP2 etc.

There's also a modified firmware version available that adds a few more options you can try if nothing else is working, or you can re-flash the original firmware if you have the programming tool to do so. 

Modified Firmware: https://gitlab.com/luckynate4/nuterm

My uTerm fired right up and has been working just fine. Since building the Z80-MBC2, I has since settled in on using CP/M 3 and have grown quite attached to the classic green text. The Asus monitors I use have legacy VGA inputs and have the ability to run that input at 4:3, so it's about as “authentic” as you can get using modern hardware.





Now that I have the uTerm all setup and running, the final step is to cram it all into a case that does the build justice, completing the “modern-retro” look I want for this cool little Z80 computer.

I did print the brackets the author included, the flat (horizontal) mount version, just to see how they worked, and they print just fine on my Ender 3, as you can see. The print time is about 5 1/2 minutes per bracket.

 

I will be using a pre-existing enclosure and modifying it to fit my needs for the final build. I had considered 3D printing a full custom case, but to be blunt, that’s a little outside my 3D design capability at the moment considering the overall size, however I have found a couple cases I can easily modify and 3D print only the parts I need to complete the build.

Thanks for reading and I’ll see you in the 3rd and final part, where it all comes together!

Read Part 3 - The Final Assembly: https://theclassicgeek.blogspot.com/2022/12/z80-mbc2-build-part-3-final-assembly.html

 

 

Saturday, September 24, 2022

Building The Z80-MBC2 Retro Homebrew Computer (Part 1)




Project Source: https://hackaday.io/project/159973-z80-mbc2-a-4-ics-homebrew-z80-computer

Project Source Alt.: https://www.instructables.com/An-Easy-to-Build-Real-Homemade-Computer-Z80-MBC2/

Author's Website (Just4Fun): https://j4f.info/z80-mbc2 <--- Check it out!

My first adventure into the wonderful world of home computers was in 1981, with the Texas InstrumentsTI-99/4A, from there my horizons expanded to Commodore, Tandy, and forward into what we would better recognize today as a home computer. I never had the opportunity to play around with early home computers like the Altair 8800, IMSAI 8080, or Southwest Technical Products Corporation 6800, they were all before I was old enough to understand what they were, outside of just a cool futuristic looking piece of technology.

As I got older my interest in these early machines grew, but I never really had any interest in owning one simply because I had no idea what I would do with it. Fast forward to 2022, and Adrian Black from Adrian’s Digital Basement featured the SWTPC 6800 in one of his repair videos, and that once again sparked my interest. Still, I had no desire to own an original machine, they’re simply too large and difficult to maintain, but modern reproductions, or similar modern homebrew computers, that’s a completely different story.

The problem with most reproductions is they’re mostly all emulated devices in housings simply made to look and work like the original machines, and I wanted to build something that was less about software emulation and more about the actual hardware. That search led me to two different machines, the RC2014 and the Z80-MBC2, both homebrew computers reminiscent of these early machines, with a few modern conveniences built in.

After quite a bit of consideration, I decided to go with the Z80-MBC2, the amazing little Z80 based homebrew computer from user Just4Fun over on Hackaday.io. Yes, the RC2014 looked the part and had more expandability with its era appropriate card style layout, all plugging into a single back-plane, but I wanted something smaller, with the same basic capabilities. The Z80-MBC2 was simple and cheaper to build than the RC2014, could still run all the software I wanted, and fit better into my final vision of what I wanted to build. 

I also wanted the learning experience of building a homebrew computer myself. Many of the projects I do are primarily based around micro-controllers, but having the ability to learn and understand how to build a simple basic computer would also help me with future project ideas. So this is a win-win for me, I get to build a very cool little retro homebrew computer, and I also get to learn how it’s designed and how it works.

This project will be broken up into 3 parts, the first will be building the Z80-MBC2 itself and getting it up and running. The second will be building the uTerm, a VT100 style terminal add-on from Just4Fun that allows the Z80-MBC2 act more like a stand-alone computer. Finally, putting all the hardware into a case to make an awesome little homebrew computer that feels like a modern extension of these early machines of the 1970s. I will also include links to all the resources you should need to build this project, as well as hints that may help someone building one themselves that may not have as much experience.

First off, it goes without saying that basic soldering skills and tools are required. You'll also need tools to program the AtMega32 and communicate with the Z80-MBC2. A basic understanding of electronic components is also recommended, as well as how to use software tools like the Arduino IDE, AVRDUDE (if necessary or using Linux), and a terminal emulator like Putty (what I use but you can use anything you like). Moving forward, I will assume you have a general understanding of what you’re doing, or are willing to learn. This won’t be a full-on step-by-step tutorial since everything you need to know is already out there, this will just be an overview of how I did my build, and to maybe help point others in the right direction. I will also try and keep everything in “simple English” as much as I possibly can. Lastly, I won’t be covering any troubleshooting since that’s a whole different ball of wax I just don’t have time to work on right now. 

That all being said, let's dive into it!




Everything you need for this build is on the project page for the Z80-MBC2 linked at the top of this post. Moving forward, I'm going to assume you've read that already!

Building the actual computer is relatively straight forward once you track down all the parts you’re going to need. Just solder it all together as indicated in the included BOM (Bill Of Materials) and schematics. Every part, it’s value and location, are clearly spelled out in those documents. If you're in need of software to view the documents, I suggest OpenOffice. It's 100% free, trusted, and can handle most document formats easily.

 

Here are a few key points worth noting for those who may not be as familiar with electronics.

1. As a matter of practice, if you’re able, you should test all your components before soldering them into your project. Personally, I suggest a component tester like one of these, https://amzn.to/3R9azhC or https://amzn.to/3Ra19Tl, but you can also use a good old-fashioned multimeter if you have one, here’s how: https://www.electricaltechnology.org/2014/01/testing-electrical-and-electronics-components-with-multimeter.html

2. If you do decide to go with a component tester, note that most do not read capacitors under 25pF, so they will likely read as unknown or damaged, and the Z80-MBC2 does require two 22pF ceramic capacitors. You can still test these with your multimeter, here is a link on how to do that: https://www.electronicshub.org/how-to-test-a-capacitor/

3. To test your crystal oscillator you need either an oscilloscope, multimeter with the ability to check crystals, or a stand-alone crystal oscillator tester. While I do have an oscilloscope, my preferred method is to use a simple and cheap tester. It's quick, easy, and they're readily available online for under $20. Here is a link to the one I bought, built, and use (https://amzn.to/3SAMiD2), it comes as a DIY kit. However there are many of them available, some assembled, some as kits. Just do a bit of searching for what you prefer.

4. The electrolytic capacitors must be soldered in according to polarity, like a battery, they have both a positive and negative terminal, and is clearly indicated on the capacitor itself. On the PCB the positive side is indicated by a "+" sign and a square pad. The negative is solid white. The ceramic capacitors do NOT have a polarity and may be soldered in any orientation.

5. The diodes must also be installed in a specific direction, as indicated on the PCB. Simply match the line on the diode with the line on the PCB. The side with the lines will also have a square pad. The LEDs are diodes and work the same way, they must be installed one way, according to polarity. The square pad is the "negative" (cathode)  side, and the negative side on the LED itself is the short leg. The long leg is "positive" (anode). The LED colors used are also important becasue different colors have different forward voltages. Sticking with the suggested colors is your best bet if you're not sure.

6. The standard single resistors can all be installed however you choose, but the two resistor arrays (also called network resistors) must be installed one way, as indicated by the small dot on one end of the package. Line up that dot with the square pad on the PCB, the pad on that side is also square.

7. The sockets also have an orientation, simply match the notch on the socket with the notch indicated on the PCB.  

8. The buttons will work no matter the orientation and will only fit in a way they will work.

9. Lastly, look at the photos of the Z80-MBC2 for the orientation of the SD card reader and RTC module. Installing them backwards can and will likely damage them.

All of the parts you need are in the BOM (Bill Of Materials) that you can download on the projects homepage, it's labeled as "A040618 BOM v2.ods" in the "Files" section of the page. 

Below is a list of links to help you track down the components to build the Z80-MBC2.

Buy the Z80-MBC2 PCB


eBay: https://www.ebay.com/sch/i.html?_from=R40&_trksid=p2047675.m570.l1313&_nkw=z80-MBC2&_sacat=0

PCBWay: https://www.pcbway.com/project/shareproject/Z80_MBC2__4ICs_homemade_Z80_computer.html

Individual Components


The following are all Amazon links to the individual components, when possible, just to keep it fast and simple. However, all these components can be found at many other sites like Mouser, Digikey, and more, many can even be found on eBay. You can shop around to save a bit of money, especially when buying in bulk. Many of these components are also available in “kits” on Amazon and other sites, giving you a variety pack you can have on hand for other projects.
 
These are mostly all components I have purchased and used. You will see sellers like HiLetgo, Bojack, Chanzon, E-Projects, and EEEEE pop up a lot in my links because I've bought from them in the past and had good luck getting good quality components. 

Here is a socket kit I have not used, but contains all the necessary sizes: https://amzn.to/3E5tuaz

Notes

I prefer the standard (dual leaf) sockets over the round hole (turned) style. This is just a personal preference, both will work and you can choose whatever you like.

I did not include individual links to all the resistors because these are really easy to find and have a pretty wide tolerance, and it’s somewhat difficult to get resistors so far out of spec you can’t use them when a project like this gives you a 5% tolerance variance. Many "cheap" resistors that claim they are within 1%, are actually 2-3%. Either way, for this project and many others, as long as you buy ones that say 1%, you’re generally safe.

Amazon Search 1/4 Watt Resistors: https://amzn.to/3SCccGt

Also, there are a lot of good resistor assortment kits sold on Amazon, and many contain almost all the ones you need for the Z80-MBC2 and uTerm, so you will only need to but a couple values separately. Just remember 5% (shoot for 1%) and ¼ watt and you’re good.

In the bill of materials, they list 4k7 and 1k2 resistor values, this is just another way of writing 4.7K  ohms and 1.2K ohms.

I will include the link to the 10Kx8 resistors I bought in a kit. I needed a couple others for another project, but just in case you’re having trouble tracking them down or need more.

https://amzn.to/3LWxVGg

 
For the LEDs, be sure to use the colors indicated, or other colors with the same forward voltage value. This is talked about on the project page as well.

Lastly, all the IC's you need can easily be found on eBay, simply search the part numbers. Buy from sellers in the USA (or your local area) when possible to increase your chances of getting "good" parts. It  also makes it a lot quicker and easier to not only get your parts, but do returns if necessary.
 
eBay Search for Z80 CMOS CPU - Remember, Z84C0008PEC and Z84C0020PEC CMOS processors will both work. The number before the "PEC" denotes the max clock speed, so technically anything "08" or higher should be fine.

 
eBay Search for TC551001-70 CMOS RAM - I specifically purchased and used Toshiba TC551001BPL-70L.
 
 eBay Search for 74HC00 Quad 2 Input NAND Gate - Specifically, the SN74HC00N.

eBay Search for MCP23017 16-Bit I/O Expander - Specifically, the MCP23017-E/SP.
 
Important Note: The RTC (Real Time Clock) module, and the MCP23017-E/SP chip listed above, are NOT required for the Z80-MBC2 to operate. The MCP23017-E/SP controls the GPIO on the Z80-MBC2, and if you have no intentions on using the GPIO, then you don't need this chip. The RTC is only needed if you require or want a real-time clock function. Both of these parts can be added later is needed.

RTC Module: https://amzn.to/3CjAEXf



Once you have everything assembled, it’s time to burn the bootloader to the AtMega32 chip and then load the “sketch” that acts like the system ROM. A ROM (Read Only Memory) is a chip used to store information a computer needs to operate, and they’re still used today, the BIOS or UEFI in your modern home computer is a type of ROM. On older machines these would contain the information necessary for the computer to function such as the operating environment (like BASIC) and the characters the computer can display, and things of that nature. Without it, the computer has no idea what to do when you turn it on. In the case of the Z80-MBC2, instead of using a ROM that requires an expensive tool to program, they opted to use an Atmel Microchip AtMega32 micro-controller to act as the system ROM. These can be easily setup right on the board using cheap readily available tools and can do the exact same task as a ROM chip would have done in older machines. This is an over-simplification, but you get the idea.

In order to burn the bootloader to the AtMega32, you’re going to want something like this: https://amzn.to/3ffchky or https://amzn.to/3C7pJA1 They’re not that difficult to use and it can all be done from within the Arduino IDE, here is a link to guide you though the process. 

https://www.instructables.com/Z80-MBC-Programming-the-Atmega32a/

Important Note #1: Make sure nothing else is connected to the Z80-MBC2, other than the programmer. Disconnect the serial USB adapter, SD card reader, and RTC module if you have one.

Important Note #2: Some of these programmers will not work with Windows 10/11 out of the box. Some of them can be flashed with updated firmware to add support, but that’s a whole different ball of wax I don’t suggest for inexperienced users. Be sure to read the information provided for the programmer carefully before buying one, many list what operating systems they’re compatible with. If they don’t, then read the reviews. If you still can’t find that information, then you may want to look at a different one that does list it. However, most all of them work fine in Linux.

In my case, the programmers I have do not work with Windows 10/11 without their firmware being updated, but I opt to just use Ubuntu instead of Windows when I need to use one of them. This is also one of the reasons why I have a “bench computer” running Ubuntu, just in case I run into problems using Windows. Using the Arduino IDE, install MightyCore as you would under Windows, and install AVRDUDE. That combination will work with most of these programmers under Linux and save you a lot of headaches using them on Windows if they’re not already capable of doing so. 

If you already have Arduino IDE and MightyCore installed per the instructions in the link above, installing AVRDUDE in Linux is easy, just type the following into the terminal. Once done, you can burn the bootloader right in Arduino IDE as covered in the link above.

sudo apt-get install avrdude

Once you have the bootloader burned onto the chip, it’s time to load the “sketch”, and that’s a much simpler process. All you need to do is connect the Z80-MBC2 to your PC using your serial USB adapter, making sure all the wires are connected properly so you don’t damage anything. Make sure you have MightyCore installed and setup correctly in the Arduino IDE according to the instructions in the link below, load the sketch into the Arduino IDE, and then click the upload button. If all goes well, it should load the sketch onto the AtMega32 and indicate a successful upload. Here is a link to those instructions, as well as covering the bootloader if you're still having troubles. 

Serial USB Adapter: https://amzn.to/3y6d6CM

https://www.instructables.com/An-Easy-to-Build-Real-Homemade-Computer-Z80-MBC2/



If you haven’t done so already, now would be a good time to copy the OS onto your SD card. Just format the card as FAT32, a 1GB card is more than enough space for anything you’ll likely be doing with this computer. Unzip the contents of the "SD-S220718-R191018-v1.zip" file to the SD cards root directory. It's as simple as that!




Ensure the Z80-MBC2 is disconnected and powered down by unplugging the serial USB adapter from your PC, now connect the SD card reader with the SD card inserted, and RTC module if you have one, then reconnect the serial USB adapter to your PC to power the Z80-MBC2 back up. Press and hold the “USER” button, then press and release the “RESET” button. Continue to hold the "USER" button until the green IOS LED begins to flash, then release. This will bring up the “setup” menu for the computer, but how do you see it?

 



The terminal emulator is the software you use to interact with the Z80-MBC2, allowing you to use your computers monitor and keyboard to control it. Personally, I use Putty as my goto terminal emulator. It’s free, trusted, and easy to use.

Once you have Putty open, you need to tell it where to look for your serial USB adapter, to make this as easy as possible, here are my profile setting I use for the Z80-MBC2. The COM port may be different for you, it’s most likely going to be COM1, COM2, or COM3. If one doesn’t work, try another. 

 

Once you have Putty (or whatever terminal emulator you use) connected to the Z80-MBC2, reset the computer as described above, and you should be greeted with a screen that looks something like the one below, if not, try the reset process again, there is no need to unplug the serial USB adapter. Note that mine may look a bit different since it's been setup already, yours may say the clock is set to 4MHz for example (to set it at 8MHz, just use option 6).


From this menu you can set the operating speed of the computer, I suggest 8MHz, and what operating environment to boot into when you power it up, I have mine set to CP/M 2.2 for the moment. You can make these changes by simply pressing the corresponding number. Easy peasy.

You can setup the system to boot directly into BASIC, the problem is you can’t save your work to the SD card this way. Booting into CP/M and loading up MBASIC gives you the ability to save and load your work easily. You can even control the GPIO pins via BASIC programs.




There is a good deal of software out there that can run in CP/M on the Z80-MBC2, and thankfully a huge archive of it can be found at the link below.

http://cpmarchives.classiccmp.org/

Getting the files from your PC to the Z80-MBC2 can be done in two ways, and one is significantly easier than the other. The drives accessible to CP/M are stored on the SD card as disk images, so you can’t just drag and drop files onto the SD card and access them in CP/M. However, a simple tool does exist that allows you to easily add and remove files from the disk images on the SD card, and this is the method I prefer to use.

Read this first! https://www.instructables.com/Z80-mbc2-Virtual-Disks-Copying-Files/ Read this first!

Authors Site: http://star.gmobb.jp/koji/cgi/wiki.cgi?page=CpmtoolsGUI

Mirror Download: https://www.mediafire.com/file/v0n6vxkqh0o0gw6/CPMTG20190501.zip/file

There is a bit of prep that needs to be done first, and that’s to copy the "diskdefs" from the root directory of the SD card to the same directory you unzipped the software into. Copy it and overwrite the one that’s included with the software.

Once you’ve done that, simply run the software, select the disk image you wish to access, select the proper format, “z80mbc2-d1” for CP/M 2.2 or “z80mbc2-cpm3” for CP/M 3. Now you can add and remove files from the disk images with ease. The "G" button is to "Get" files from the image and move them to your computer, the "P" button it to "Put" files into the selected image from your computer. In the example below, I have image file DS0N06.DSK selected, that is drive "G" in CP/M 2.2.

 

I highly recommend reading the article I linked above on the “manual” way adding files, even if you plan on using the "Cpmtools GUI" software, specifically the section that explains how the image system works so you know where to add your files and how to access them in CP/M on the Z80-MBC2.

If you’re unfamiliar with how to use CP/M, it’s very similar to MS-DOS, but I highly suggest checking out some of the links below to learn more.

CP/M 2.2 Users Guide: http://www.cpm.z80.de/manuals/cpm22-m.pdf

Alt Link: https://vt100.net/rm/docs/pn11901.pdf 

CP/M 3 Users Guide: http://www.cpm.z80.de/manuals/cpm3-cmd.pdf

Alt Link: http://www.s100computers.com/Software Folder/CPM3 BIOS Installation/CPM3 System Guide.pdf

Full List: http://www.cpm.z80.de/drilib.html 




Now that I have my Z80-MBC2 up and running, I will go about customizing the software library to fit my needs and work on building the uTerm board so it can operate as a standalone computer. Then I can start to work on customizing the case I want to put it all in. Look for all that in parts 2 and 3!

For now though, it's time to just mess around and have some fun! 

Thanks for reading and happy retro computing!!!

Read Part 2 - The uTerm Build: https://theclassicgeek.blogspot.com/2022/10/z80-mbc2-build-part-2-uterm-vt100-style.html


 
 
Updated on 9/30/22 to include component links.