Paolo Amoroso's Journal

Tech projects, hobby programming, and geeky thoughts of Paolo Amoroso

Exploring the Z80-MBC2 is a required learning step for the adventurous hobbyists and electronic enthusiasts who use this Z80 homebrew computer, to whom it's aimed.

The device comes only with schematics, source code, and a few brochures. However, despite the lack of an official manual, there is a lot of information on the Z80-MBC2 scattered across a number of websites. Put together, this content makes for a solid starting point for further exploration.

In my own journey I'm collecting these resources, which I share here in the hope they will help you get started. I'll update the post with more as I discover them.

Features and operation

The closest thing to a manual is the Z80-MBC2 guide by DarS007, a user who compiled an unofficual user guide. It consists of original notes and snippets from other sources organized into an architectural overview, software information, and tips.

The Z80-MBC2 developer Just4Fun published most of the available information on the project's Hackaday page. All its sections are well worth reading in full, particularly Details and Logs. Section Discussion contains Z80-MBC2 user posts with interesting links and tips.

I also recommend the project page of the Z80-MBC, the Z80-MBC2 predecessor with which it shares most hardware and software features. These pages provide complementary content, i.e. the Z80-MBC page has useful information missing from the Z80-MBC2 page.

Just4Fun published much of the same content on his personal website and has an Instructables guide.

The Z80-MBC2 user Coopzone posted some notes on managing virtual disks and files. Another user blogged his experience with assembling and using the Z80-MBC2.

Operating systems

The Z80-MBC2 can boot a number of operating systems such as CP/M 2.2 and 3.0, as well as UCSD p-System.

Nearly all the existing documentation on these historical systems applies to the versions that ship with the Z80-MBC2. The same goes with the application software for these operating systems that's preinstalled on the Z80-MBC2, for example WordStar and Turbo Pascal.

Some of these operating systems and programs are less known. Refer to the official QP/M and Collapse OS official websites for documentation on Q/PM 2.71 and Collapse OS, bootable from the Z80-MBC2.

As for lesser known application software, see the documentation of the VDE text editor on which the CP/M ZDE16 editor that comes with the Z80-MBC2 is based.

Programming languages

Along with the operating systems, the Z80-MBC2 firmware can boot a couple of programming language interpreters like the BASIC and Forth systems in the ROMs of typical 1980s microcomputers.

The Z80-MBC2 ships with a Nascom BASIC implementation modified by Grant Searles. See the Nascom BASIC documentation.

Development tools

In addition to using the supplied software, it's fun to program the Z80-MBC2 in C or Assembly. The project sites of the major compilers and development tools usable for the Z80-MBC2 usually provide documentation:

#z80mbc2 #sbc #retrocomputing

Discuss... Email | Reply @amoroso@fosstodon.org

The GitHub repo of my Free Python Books project is about to get 3.5K stars. As I write this it has 3,499 stars, 448 forks, and 149 watches.

This milestone is mind blowing, humbling, and unexpected.

The project is a categorized list of Python books that are free to read or download. Despite the simplicity, something in the resource resonates with many Python developers and enthusiasts.

It all started as a personal list of books I discovered while learning Python, which I wanted to read later or reference. I shared the early list on Reddit and it snowballed from there.

I'm happy also because this success hints there are many learners who, in the age of video, still seek books and text resources.

#Python #books

Discuss... Email | Reply @amoroso@fosstodon.org

I created a YouTube playlist about the Z80-MBC2 Z80 homebrew computer.

The videos visually decument my journey to using, learning, and programming the Z80-MBC2. They are screencasts demonstrating various features of the device and my projects, such as feature walkthroughs, running programs, coding sessions, and so on.

As I gain more experience with the Z80-MBC2, I'll publish more videos.

#z80mbc2 #sbc #retrocomputing

Discuss... Email | Reply @amoroso@fosstodon.org

I ported to CP/M Twirl, a twirling bar animation demo in Intel 8080 Assembly. I originally developed it for emuStudio, an emulator and development environment that recreates a number of classic computers and CPUs. The port runs on any CP/M system with an ANSI terminal or display.

I recorded a screencast that shows Twirl running under CP/M 3.0 on the Z80-MBC2 computer, controlled from a Minicom terminal emulator session under Crostini Linux on my Chromebox.

How it works

The demo displays an ASCII animation of a bar twirling clockwise at the home position of the console, i.e. the top left corner. After clearing the screen, Twirl repeatedly moves the cursor to the console home, prints the current animation frame, and checks for key presses to decide whether to terminate.

Although visually simple, the program demonstrates some key Assembly programming techniques such as looping, calling BDOS functions, and doing output with ANSI escape codes.

Porting

The original Twirl runs on a virtual Altair 8800 computer with a Lear Siegler ADM-3A terminal emulated by emuStudio.

However, I designed the program intending to port it to CP/M. The necessary work consisted in replacing the Altair-specific I/O rutines with equivalent BDOS calls for printing a single character (function 02h) and a string (09h) of ANSI escape codes, and checking the console status for key presses (0bh).

The program logic works as is, but I had to modify the CP/M version for defining the appropriate constants and ANSI escape strings, as well as adapting to the execution environment of the operating system and returning control to it.

Building and running

For me, the whole point of writing programs like Twirl and getting Z80 hardware is to use Suite8080, the suite of Intel 8080 Assembly cross-development tools I'm writing in Python. The CP/M port is a new Suite8080 Assembly demo I built from source on Linux with asm80, the Suite8080 assembler:

$ asm80 twirl.asm

I tested the resulting 74 bytes twirl.com executable under CP/M 2.2 with the CP/M software emulators ANSI CP/M emulator and z80pack.

Running the demo at the CP/M prompt is straightoward:

B>twirl

Pressing any key quits Twirl and returns control to the operating system.

To exeute Twirl on actual hardware I converted twirl.com to Intel HEX format with z80pack's bin2hex tool, then transferred the twirl.hex file to the Z80-MBC2 under CP/M 3.0.

It was really rewarding to see Twirl come to life on a real Z80 computer and get a sense of its performance.

The code

Here is the full code of the CP/M port of Twirl:

; Twirling bar animation.
;
; Runs on CP/M with an ANSI terminal. Press any key to quit the program.


TPA        equ      100h
BDOS       equ      0005h
WRITESTR   equ      09h                ; Write string
WRITECHR   equ      02h                ; Write character
CONSTAT    equ      0bh                ; Console status

FRAMES     equ      8                  ; Number of animation frames


           org      TPA
            
           mvi      c, WRITESTR
           lxi      d, cls             ; Clear screen
           call     BDOS

loop:      lxi      h, anim            ; Initialize frame pointer...
           mvi      b, FRAMES          ; ...and count

loop1:     push     h
           push     b
           mvi      c, WRITESTR
           lxi      d, home            ; Go to screen home
           call     BDOS
           pop      b
           pop      h

           push     h
           push     b
           mvi      c, WRITECHR
           mov      e, m               ; Print current frame
           call     BDOS
           pop      b
           pop      h

           push     h
           push     b
           mvi      c, CONSTAT         ; Get console status
           call     BDOS
           pop      b
           pop      h
           ora      a                  ; Key pressed?
           jnz      exit               ; Yes

           inx      h                  ; Point to next frame
           dcr      b                  ; One fewer frame
           jnz      loop1

           jmp      loop

exit:      ret


cls:       db       1bh, '[2J$'        ; ANSI clear screen: ESC [ 2 J
home:      db       1bh, '[H$'         ; ANSI go to screen home: ESC [ H
anim:      db       '|/-\|/-\'         ; 8 frames

           end

The program represents the animation as the string |/-\|/-\, a sequence of ASCII characters that show the bar at various steps of the rotation.

After clearing the screen, Twirl begins the main loop loop: by initializing the frame pointer and count. An inner loop loop1: prints each animation frame, i.e. the characters of the animation sequence.

The inner loop moves the cursor to the home position and prints the current frame. Then it updates the frame pointer and count, and checks whether a key was pressed. In case of a key press the inner loop exits the program, otherwise it jumps back to the beginning of the main loop.

#Assembly #retrocomputing #Suite8080 #z80mbc2 #CPM

Discuss... Email | Reply @amoroso@fosstodon.org

Many thanks to Jan Rösner and Bastian Schade, the editors of 8bitnews, for featuring my Z80-MBC2 projects and adventures in issue #55. 8bitnews is my favorite retrocomputing newsletter, I don't miss a single issue and always read it cover to cover.

#z80mbc2 #sbc #retrocomputing

Discuss... Email | Reply @amoroso@fosstodon.org

Twelve years ago these days, in early July 2010, I put aside print books and began reading only ebooks. The transition to digital allowed me to read more, access books faster, and discover new content and authors.

My motivations for trying ebooks were my ageing eyesight, which was making reading printed material increasingly uncomfortable, and the curiosity for checking out a new gadget a friend had bought, an e-ink ebook reading device.

I soon replaced e-ink readers with ebook reading apps on my Android smartphones and tablets. They're equally effective and more practical, thus making dedicated devices unnecessary.

To round up my digital book experience, I also self-published two ebooks. They were mostly experiments for getting familiar with the digital writing, publishing, and promotion tooling and processes.

Over the years, I shared my digital reading experience and data on the ebooks I bought. Here are the latest entries:

I never looked back. Twelve years later, I'm super happy with digital reading and regularly buy or download tons of ebooks.

However, over the past year I resumed buying a handful of paper books.

Why? Because of my interest in retrocomputing.

Some old programming books about early systems and languages are difficult to find, even online. So, when I come across second-hand copies of valuable old technical books at reasonable prices, I buy them as backups, even if I continue reading and referencing their digital copies. I don't want these precious and rare works to disappear.

#ebooks #retrocomputing

Discuss... Email | Reply @amoroso@fosstodon.org

I'm still troubleshooting a file transfer issue between Crostini Linux and the Z80-MBC2. Sending files from Crostini to the Z80 computer via XMODEM times out, but I figured and tested an effective workaround.

The workaround, which works only for ASCII transfers, consists in pasting a text file from the Minicom terminal emulator into an ED session on CP/M, i.e. sending the contents of the file as if they were typed in. Saving ED's buffer makes the file available on CP/M.

More specifically, this sample Minicom session shows the steps I go through for sending the file greet.hex from Crostini to the Z80-MBC2.

Pasting a text file into an ED session from Minicom on Linux to CP/M on the Z80-MBC2.

First off, it's essential to set at least a 5 ms character transmit delay in Minicom's terminal settings, otherwise the board can't keep up with the flow of data. I press the keystrokes ^A T F to execute the command Terminal settings > Character tx delay (ms). I actually changed the Minicom escape from ^A to ^Y, but in the following I'll continue with the default ^A.

Next, at the CP/M prompt I run the ED text editor for creating a new file GREET.HEX to hold the text coming from Crostini:

B>ed greet.hex

After entering insert mode with the i command, ED is ready to accept any characters typed in — or coming through the serial line connected to the terminal.

In Minicom, I proceed to invoke the Paste file command with the keystrokes ^A Y and select greet.hex on the Crostini file system. One by one, the characters of the file appear in ED's buffer. When Minicom completes pasting greet.hex, in ED I execute the commands #w to save the full text and e to exit the editing session.

The file is now available on CP/M. For example, with the standard tool LOAD I can convert GREET.HEX in Intel HEX format to an executable .COM program:

B>load greet.hex

FIRST ADDRESS 0100
LAST  ADDRESS 0121
BYTES READ    0022
RECORDS WRITTEN 01

Finally, the greet.com hello world demo is ready for execution on CP/M:

B>greet
Greetings from Suite8080

This workaround is slower than XMODEM transfers, but still acceptable and practical.

Pasting text files lets me indirectly send arbitrary binary files to CP/M. Executable programs can be converted to HEX format. Other binary, non-excutable files need uuencoding or processing with similar text-encodings.

#z80mbc2 #sbc #CPM

Discuss... Email | Reply @amoroso@fosstodon.org

I read a series of two interesting articles by Tim Bergin on the history of word processing software for early microcomputers, The Origins of Word Processing Software for Personal Computers: 1976−1985 and The Proliferation and Consolidation of Word Processing Software: 1985−1995. Among other things, I learnt mismanagement is what mostly doomed WordStar and WordPerfect.

#retrocomputing

Discuss... Email | Reply @amoroso@fosstodon.org

It's been over a week since I received the Z80-MBC2 Z80 single-board computer, so I got a chance to spent some time exploring and playing with it. Although I shared some usage updates, it's time for some notes on how the board is working, its value and potential, and the issues I'm facing.

I wish to thank the board's developer and the retailer I bought it from, who clarified some features and details.

Hardware

The Z80-MBC2 comes with two additional small cards (a microSD reader and a real-time clock unit) and a USB serial adapter to plug into the main board. It was easy even for someone with no hardware skills like me, but I had to check some product photos and seek help to figure how to match the connectors.

Here is the board with all the parts plugged in.

Z80-MBC2 Z80 single-board computer.

What surpised me about the Z80-MBC2 is its heft compared with the small size. It weighs almost as much as a smartphone, as those old-fashioned chips pack a lot of stuff.

At 10x10 cm, the Z80-MBC2 is compact and fits well next to my Chromebox as this photo shows. Via the USB serial cable, long enough for my setup, I plug the unit into the Chromebox and access it via the Minicom terminal emulator.

Z80-MBC2 Z80 computer board connected to an ASUS Chromebox 3.

I haven't perceived any significant warming of the board after prolonged use. The readings of the built-in temperature sensor usually stick around 32-33° C.

Software

The Z80-MBC2 is a great kit aimed at hobbysts and electronic enthusiasts, but no mnual is available. There's little documentation on how to operate the product and what it can do.

However, some background on computer technology, programming languages, and 1980s 8-bit systems make it easy to learn by experimenting and interacting with the board. The Z80-MBC2 project site, as well as the site of the predecessor Z80-MBC, are useful sources on the features and capabilities of the product.

The firmware comes with lots of software and tools, see this screenshot of the boot menu. There are programming language interpreters like on 1980s microcomputers, such as BASIC and Forth, and a number of operating systems like CP/M 2.2 and 3.0.

Boot menu of the Z80M-MBC2 single-board computer in a Minicom Linux session over a serial USB connection.

The firmware provides an option for uploading an executable file in Intel HEX format. For example, this allows experimenting with software designed to run on the bare metal such as resident monitors or other low-level code.

Value and potential

I bought a professionally assembled and tested Z80-MBC2 unit. The main value of this solution is the product is pretty much plug and play.

It comes with everything needed to start using the board. In particular, the latest version of the firmware, which fixes some I/O issues, and the USB serial adapter. All I have to do is plug the board's USB connector into a port of my Chromebox.

The board is perfect for running my Assembly code on actual hardware.

The Z80-MBC2 is also an interactive history of computing lab, a way of feeling first-hand the performance and latency of early 8-bit microcomputers and I/O. I actually experienced that kind of performance back in the day but lost touch with it long ago.

Issues

I love the Z80-MBC2 but an issue is limiting what I can do with it: XMODEM file transfers from Crostini Linux to the board time out. Given XMODEM is the most effective way of sending code and programs to the board, this is a major inconvenience.

I'm troubleshooting the issue with the help of comp.os.cpm. The Z80-MBC2 developer reassured me it's likely not a firmware problem, as versions earlier than the one I have didn't fully support XMODEM.

Meanwhile, I'm looking for workarounds shouldn't I be able to devise a fix.

For example, I could paste a file from the terminal emulator to a text editor running on the board. Another less practical option would be to copy the files on the microSD card, the mass storage device of the Z80 system.

#z80mbc2 #sbc #CPM

Discuss... Email | Reply @amoroso@fosstodon.org

Back in the CP/M and MS-DOS days, developers shipped software with all sorts of device drivers to support such basic peripherals and system services as terminals, graphics cards, mices and input devices, memory management, mass storage units, printers, network equipment, and more.

Every developer pretty much had to reinvent the wheel. Yet the industry thrived, and many software houses and independent programmers published successful applications and games.

These days mobile developers gripe about Android fragmentation, a consequence of the success of open platforms like CP/M and the IBM PC.

#Android #development #retrocomputing

Discuss... Email | Reply @amoroso@fosstodon.org

Enter your email to subscribe to updates.