Paolo Amoroso's Journal

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

Write.as is such a low-friction blogging platform it enables me to blog daily. I love sharing my tech projects and experiences, and I can squeeze some writing into pretty much any time snippet.

But life threw at me something I struggle to handle.

The health of my old mom got worse quickly and she became no longer self-sufficient, requiring me to care for her continuously and full time. I love mom so much I even resumed using WhatsApp, I can do all it takes. But the current situation is demanding and exhausting, keeping me at the edge of burnout.

It's not so much I have little time to write. It's I don't have time to work on the projects and stuff I blog about.

I'm posting much less, but I still update this blog. I need it.

#personal #blogging

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

I joined the mastodon.technology Mastodon instance on March 23, 2022. It turned out to be an interesting time as, a few weeks later, Elon Musk tried to acquire Twitter and stirred the debate on alternate social platforms.

Back then the About page of the instance listed, under server stats, about 22K users and 2.2K active monthly users. In the weeks after Elon's bid, the user base of the instance started growing, several introduction toots by new users showed up in the local timeline, and monthly active users peaked at 2.3K.

As I write this there are 23.5K users and 1.66K active monthly users. In the local timeline I haven't seen new user toots for a while.

Although the decreased activity hints at a waning interest in the instance or Mastodon, this can just be a seasonal effect over the summer. Even if the decrease is real, interest in Mastodon seems to come in waves.

We'll see in the fall.

#fediverse

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

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

Enter your email to subscribe to updates.