Monday, April 5, 2021

VT180 with ImageDisk and Gotek Drives

VT180 Robin is a CP/M system from Digital (DEC), released in 1982. 


The VT180 system is basically a VT100 Terminal with VT18X Z80A CPU board and RX180 Dual Floppy Disk Drive unit. The Z80A CPU runs at 4.0 MHz [1]

The RX180 Floppy Disk Drive unit contains two Shugart 400L drives. The drive configuration is single-sided double-density180KB, which is compatible with the floppy disk drive for IBM PC 5150. ImageDisk tools can handle the disks and images for VT180.

***

Several VT180 disk images are found on bitsavers.org. They are '*.P75' files, which are actually raw dump images. It looks like that they are the only VT180 disk images on the Internet.

This page describes the detailed information about how to use ImageDisk tools for VT180. Here are some additional tips:

  • You can connect the Shugart drive inside RX180 directly to the FDD cable from your pc. 1) Use Drive B (the right hand side drive) of RX180, without altering the dip switch settings [2]. 2) Connect the drive to the "Drive A" connector of the FDD cable. The "Drive A" connector is located at the far end of the cable to the connector to motherboard.

  • Use the following command to convert the *.P75 image files to *.IMD:

    bin2imd fname.p75 fname.imd /1 N=40 SS=512 DM=5 SM=1-9

  • Use the following command to write/read the VT180 disks on the PC:

    imd /a c=40 ds=0 lr=250 s=1 il=1

    and then within the ImageDisk app, specify the remaining parameters as you format/read from/write to a disk:
    • Sector size: 512 bytes/sector
    • Tracks per sector: 9






The VT180 runs CP/M Version 2.2. The dual drive configuration seems essential to this system. Single drive system requires frequent disk swaps, which tend to cause the Ctrl-C and BDOS error situation.

***

The Gotek Drive is a modern solution for floppy disk drives. It is basically a PC-compatible floppy disk drive emulator using USB flash drive. By installing a third-party firmware called FlashFloppy, it can emulate much wider range of drives.

Two Gotek drives can replace a whole RX180 unit. The following four steps are required.

1. Install the FlashFloppy firmware

Go to FlashFloppy Wiki page and follow the instructions. The stm32flash tool is required to write the FlashFloppy firmware into Gotek drives. On macOS, stm32flash can be installed using Homebrew:

brew install stm32flash

2. Configure ff.cfg and img.cfg

    These are the ff.cfg and img.cfg files for VT180. These files can be placed in the root (or /FF) directory of the USB flash drives.

    3. Prepare the disk images

    This is the easiest part. Simply rename the *.P75 files to *.P75.DSK, to make them recognized by the FlashFloppy firmware. For example, you can rename the system disk image (on macOS terminal):

    mv VT180CPM.P75 VT180CPM.P75.DSK

    Place these disk image files in the root directory of the USB flash drives.

    4. Connect Gotek drives to VT180

    This is a tricky part. In order to connect two Gotek drives, a standard 34pin FDD cable is required.

    First, connect the 37 pin VT180 Disk Interface port to the FDD cable: 


    Next, connect two Gotek drives to the Drive A and Drive B connectors of the FDD cable. Note that a group of wires (pin10 through pin16) on the cable are 'twisted' for Drive A connector. As a result, the 'SEL0 L' signal from VT180 appears at pin 16 of the Drive A connector. Considering this situation, the jumper settings for the Gotek drives are as follows:

    • Gotek Drive A: MTRON
    • Gotek Drive B: DS1

    Also connect the power pins (+5V and GND) of the Gotek drives to a proper power source.

    Set the USB memory modules to the Gotek drives, turn on the power unit for them, then trun on the VT180. To the prompt from the system ROM, type 'A' to boot from the A drive. The CP/M system starts up:

    What's next? Maybe I can write some programs on it, or make an enclosure for the dual USB drive unit.

    Note:

    1. Although Wikipedia explains that the CPU of VT180 CPU is a 2 MHz Z80 (based on Wikipedia page as of Mar. 2021), VT180 Technical Manual clearly states that VT180 is running a 4.0 MHz Z80A CPU.
    2. With this configuration there is no terminator block on the floppy cable, but it seem working fine, probably because there is no daisy-chained cables in this small configuration.


    Friday, March 27, 2020

    1:4 Scale Monitor II

    This model (also by option8) is originally designed for a 4:3 Composite LCD. I am going to modify it for an HDMI LCD unit.


    Apparently this LCD screen doesn't fit inside the bezel. Edit /boot/config.txt file to adjust screen margins.


    Make an opening for the HDMI connector and USB micro power connector.


    Place the Monitor II on top of the Apple III.


    Run Apple III demo with apple3rtr.

    Sunday, March 22, 2020

    1:4 Scale Apple III Raspberry Pi Case

    I 3D printed, painted and assembled the Apple III Raspberry Pi Case by Charles Mangin/option8.

    1. Spray with gray primer, and airbrush with acrylic paint.

    2. Metallic-black : Buff : White = 2 : 6 : 92.

    3. Attach the logo plates, and spray with semi-gloss lacquer.

    4. Install a Raspberry Pi 3B.

    5. Assemble the parts.

    6. Now the LCD unit also needs an enclosure

    Reference:








    Monday, January 20, 2020

    Apple3rtr on macOS, Ubuntu and Raspbian


    Apple3rtr is the quickest path to set up an Apple III emulator on modern platforms.  The Drop /// Inches podcast discusses details about apple3rtr and other Apple III-related topics.

    In some platforms, however, it is a bit tricky to install the prerequisite software (MAME, SDL, etc.) properly.  This article describes the steps to install apple3rtr on the following platforms:

    1. apple3rtr on macOS Mojave 10.14.6
    2. apple3rtr on Ubuntu 18.04.3 LTS
    3. apple3rtr on Raspbian Buster

    Note: Info on this page was verified as of October 2019.

    1. Apple3rtr on macOS Mojave 10.14.6

    It is a straightforward task to set up apple3rtr on macOS.  The step-by-step instruction is found in apple3rtr Readme (see "SDL and MAME Installation").


    a. Install MAME0214

    Download SDLMAME v0.214 64-bit.zip from http://sdlmame.lngn.net/

    Unzip the file and install the binary:
    unzip mame0214-64bit.zip
    cd mame0214-64bit
    sudo cp mame64 /usr/local/bin
    sudo chmod +x /usr/local/bin/mame64

    b. Install SDL2

    Download SDL2-2.0.10.dmg (or the latest dmg) from http://www.libsdl.org/download-2.0.php

    Then run:
    open SDL2-2.0.10.dmg
    sudo cp -r /Volumes/SDL2/SDL2.framework /Library/Frameworks
    You may be required the admin password.

    c. Clone apple3rtr repository

    git clone https://github.com/datajerk/apple3rtr


    d. Start MAME + apple3rtr

    cd apple3rtr
    mame64 apple3 -window -skip_gameinfo -volume -24 -resolution 1024x768 -effect Scanlines0x4 -sl1 cffa2 -hard apple3.hd -sl2 thclock -sl3 applicard -ramsize 512k -flop1 demodisk.dsk
    The option -flop1 specifies the boot floppy image.  Apple3rtr includes several boot images.  To quit apple3rtr, press F1 and then Esc.

    apple3rtr_demo_osx

    2. Apple3rtr on Ubuntu 18.04.3 LTS

    On Ubuntu, you need to build MAME from the source code, as the MAME from apt package doesn't seem to work with apple3rtr.

    a. Install prerequisite packages

    sudo apt-get update
    sudo apt-get install git build-essential python libsdl2-dev libsdl2-ttf-dev libfontconfig-dev qt5-default

    b. Download MAME 0214 source

    mkdir mame0214; cd mame0214
    wget https://github.com/mamedev/mame/releases/download/mame0214/mame0214s.zip
    unzip mame0214s.zip
    unzip mame.zip 

    c. Build MAME 0214

    make NOWERROR=1 REGENIE=1 -j3
    When done, install mame64:

    sudo cp mame64 /usr/local/bin/
    sudo chmod +x /usr/local/bin/mame64

    d. Clone apple3rtr repository

    git clone https://github.com/datajerk/apple3rtr


    e. Start MAME + apple3rtr

    cd apple3rtr
    mame64 apple3 -window -skip_gameinfo -volume -24 -resolution 1024x768 -effect Scanlines0x4 -sl1 cffa2 -hard apple3.hd -sl2 thclock -sl3 applicard -ramsize 512k -flop1 demodisk.dsk
    The option -flop1 specifies the boot floppy image.  Apple3rtr includes several boot images.  To quit apple3rtr, press F1 and then press Esc.

    apple3rtr_demo_ubuntu

    3. Apple3rtr on Raspbian Buster

    At least a Raspberry Pi 3b+ is required to build MAME from the source.  Raspbian Buster, Kernel 4.19, Sep. 2019 or newer is recommended.

    The latest MAME as of Sep. 2019, MAME 0214, somehow did not work with apple3rtr.  I rolled back to MAME 0187 for a successful build. 

    Due to the RAM size and other resource limitations in the system, a couple of additional steps are required:

    1. Use SOURCES make parameter to limit the number of files to compile.
    2. Temporarily increase the swap space.

    Detailed steps are described below.

    a. Prepare Raspbian system SD memory card

    Download the system image from the Raspberry Pi download page.  As of September 2019, Raspbian Buster kernel 4.19 is the latest.  A 32GB SD card is recommended.  You can use etcher tool to write the image on your SD card. 


    b. Configure Raspberry Pi environment

    Some additional configuration of the Raspberry Pi will be useful for build of MAME.  You may want to:
    • Enable Wifi, ssh and vnc
    • Setup keyboard locale
    • Boot in console
    These tasks can be done using raspi-config

    c. Install prerequisite packages

    sudo apt-get update
    sudo apt-get install git build-essential python libsdl2-dev libsdl2-ttf-dev libfontconfig-dev qt5-default

    d. Download and unzip MAME0187 source tree

    mkdir mame0187; cd mame0187
    wget https://github.com/mamedev/mame/releases/download/mame0187/mame0187s.zip
    unzip mame0187s.zip
    unzip mame.zip


    e. Build MAME0187


    Before building MAME, increase the swap size temporarily.  Edit the swap configuration file:

    sudo vi /etc/dphys-swapfile

    And modify this line:

    CONF_SWAPSIZE=100

    to:

    CONF_SWAPSIZE=2048

    then save the file and restart Raspberry Pi.  After restart, use free command to verify that the swap size is increased:

    pi@raspberrypi3:~ $ free -m
                   total        used        free      shared  buff/cache   available
    Mem:            926         167         461          14         296         691
    Swap:          2047           0        2047

    Now you can build MAME:

    cd mame0187
    make NOWERROR=1 SUBTARGET=apple3 SOURCES=src/mame/drivers/apple3.cpp,src/mame/machine/apple3.cpp -j2

    If you previously ran the make command with different options, add the option REGENIE=1 as well.

    It will take about two to four hours for the command to finish.  After the command is done, verify that the binary file named apple3 is created.  Install it:

    sudo cp apple3 /usr/local/bin/
    sudo chmod +x /usr/local/bin/apple3

    Now the build is done, set the swap size back to the original.  Edit CONF_SWAPSIZE value in /etc/dephys-swapfile:


    CONF_SWAPSIZE=100

    Save file, quit editor, and restart Raspberry Pi.

    f. Clone apple3rtr repository

    git clone https://github.com/datajerk/apple3rtr


    g. Start MAME + apple3rtr

    cd apple3rtr
    apple3 apple3 -skip_gameinfo -nowindow -volume -24 -resolution 512x384 -sl1 cffa2 -hard apple3.hd -sl2 thclock -sl3 applicard -ramsize 512k -flop1 demodisk.dsk

    The option -flop1 specifies the boot floppy image.  Apple3rtr includes several boot images.  To quit apple3rtr, press F1 and then Esc.

    apple3rtr_demo_rpi

    4. Programming in Apple III Business Basic

    1. Boot apple3rtr with bosboot.dsk
    2. From BOS main menu choose Business Basic
    3. Try this code (mandelbrota3.ba3)
    Reference: Apple III Business BASIC Reference Manual Vol 2 

    mandelbrot_set_apple3

    Friday, December 21, 2018

    Apple IIe Zero-Spindle Configuration

    As of 2018, there are a number of options available for Apple II computers to replace conventional spindle drives. Some of the solutions even provide some sort of network capability. Using these options, you can build a network-based cross development platform for the Apple II.

    Currently, the following solid-state storage devices are attached to my Apple IIe:

    - Floppy Emu Model B by Big Mess O' Wires

    Floppy Emu can be connected directly to the Disk II Interface card.

    - Apple II Pi by Dave Schmenk with Raspberry Pi Zero W

    Apple II Pi built on a prototype card

    Based on these two solid-state storage devices, I am building a cross development environment for the Apple IIe using a Mac and a Raspberry Pi.

    My current configuration is like this:

    1. Floppy Emu - Slot #6, Drive 1

    This is the boot drive. Usually I set the Apple2pi startup disk: A2PI-1.6.PO.

    2. Apple II Pi card - Slot #2, Drive 1 and Drive 2

    These are the virtual drives hosted by PiDrive running on the Raspberry Pi Zero W.

    3. Sound card (under development) - Slot #4

    This is the development target. I am writing the driver programs for it.

    Slot 2: Apple II Pi, Slot 4: Sound card, Slot 6: Disk II card to Floppy Emu.

    So, what are the benefits of this configuration? Many potential benefits can be found, but to me, there are two major things:

    1. Apple IIe is connected to the wifi via Raspberry Pi. I don't need to lay a long USB-serial cable from one side of the room (Mac) to the other side (Apple IIe).

    2. The virtual drives on Apple II Pi can be unmounted, updated and then re-mounted using PiDrive and AppleCommander.

    Note that on Raspberry Pi, you can mount/unmount the virtual drives, using the PiDrive tool commands. These commands can be executed from Mac via ssh.

    Once unmounted, those drives are simply disk image files on the Raspberry Pi. If the directory is shared using SMB, you can add any file on the Mac to the disk image files.

    Using all of the above, the cross development steps can be totally controlled from Mac:

    Step 1. Assemble Apple II program into a bin file (ca65/ld65 - CC65)
    Step 2. Write the bin file into a disk image file (ac.sh - AppleCommander)
    Step 3. Mount the disk image file on PiDrive (a2setvd - PiDrive/AppleIIPi on Raspberry Pi, command issued from Mac via ssh)

    Now everything can be executed from the Mac, it is easy to automate the cross development steps. You can write a GNU Makefile, or any other build script for your development platform (Atom build, for example).


    Friday, November 9, 2018

    SBC6800

    Last month, I built the SBC6800 single board computer. 


    SBC6800 was designed and programmed by Tetsuya Suzuki, the author of the Japanese book:モトローラ 6800 伝説(“The Legends of Motorola 6800”). In fact, I read this book before building the SBC6800. So, I will write a bit about the book first.

     ***

    The book starts by depicting a historic electronics shop in Akihabara, where the author finds that some vintage chips, including the original Motorola 6800, were still in stock. He purchases a few of them. 

    He outlines the birth and early history of the microprocessors in the 70s (“4004 - 8080 - 6800”), moving on to several computer kits that featured Motorola's first 8bit processor (Altair 680, SWTPC 6800, and Sphere), and then to a couple of early personal computers in Japan as well: Hitachi Basic Master L2 (6800) and Fujitsu FM-8 (6809). This book covers several notable 6800 software, such as VTL, Tiny Basic, and Robert Uiterwyks Micro BasicAlso a parallel computing project developed by the researchers of the universities in Japan is described, where a cluster of MC6800 processors was used as a processor array.

    All the chapters of this book include a lot of pictures from the documents and magazines, or of the actual hardware, of those days. You might be familiar with them. When you look closely at the pictures of inside of the hardware, you can find the Motorola product numbers printed on the chips.

    The highlight of this book is, however, development of his own single board computers. He designs the SBC6800 and the SBC6809, using MC6800 and MC6809 processors, respectively (his blog reveals the chronological record of development). Each of these SBCs uses a minimum set of chips—an MPU (MC6800/6809), a 6850 ACIA, a 2764 EPROM, a 6264 SRAM, and a few clock/glue logic chips. Thanks to the limited number of chips, these SBCs fit within a 3 x 4 inch PCB, which can be ordered at PCB fabs at the lowest price.

    Next, the author develops a modified version of Mikbug (the system monitor program originally developed by Motorola), as the firmware for SBC6800. According to him, the 6850 ACIA was not in production yet when the original Mikbug was written, and that was why the 6820 PIA was specified in Mikbug for serial communication. He carefully rewrites the I/O routines so that the code will drive the 6850 on his SBC, instead of the 6820, without altering the major entry addresses from the original Mikbug. 

    ***

    As soon as I finished the book, I ordered the PCB and some of the vintage chips for the SBC6800. Waiting for the components to arrive, I installed the 6800 cross-assembler on my Mac and downloaded the source code of his modified Mikbug. After adjusting some syntax differences (for example, I needed to type STAA 0,X’, instead of STA A X as printed in the original Mikbug source code), the source code passed the assembler and the S-format file was generated. [Note: the Mikbug S-format file is provided by the author in SBC6800 data pack]

    Finally, the vintage chips arrived. I built my SBC6800, burned the Mikbug into an EPROM, connected the serial port to my Mac, and then turned on the SBC. The glorious prompt from Mikbug:



    was printed on the terminal window. The first program that I loaded, Hello, world,” successfully ran on the vintage chip!


    As of writing this, information necessary to build the SBCs is available only in Japanese. Google Translate might help. If not, please ask me. The good news is that the required components can be ordered from US, as I already did. Probably the components are available also in some other regions where online/vintage electronics suppliers, such as Mouser and eBay, are accessible.

    If you speak Japanese, I strongly recommend reading the book first, which will increase your excitement when you build and run the SBCs. Or, the book will be interesting and fun on its own, if you dare not solder electronic components.

    I will enjoy retroprogramming on these small SBCs, for the next couple of months, at least.

    Book:『モトローラ 6800 伝説』Rutles (Publisher) | Amazon Japan
    SBC6800 Technical Doc (pdf)
    SBC6800 Data Pack (zip)



    Saturday, October 6, 2018

    Shield Block Diagram

    In this post, I will describe the functional blocks of USB Keyboard Shield for VT100.


    The figure below shows the block diagram of USB Keyboard Shield for VT100 (the center column), along with other components necessary for the keyboard functions of VT100 (left and right columns).

    Fig of USB Keyboard Shield for VT100 Block Diagram
    Fig. USB Keyboard Shield for VT100 Block Diagram
    As shown in the diagram, the shield is composed of three major functional blocks:

    1. Transceiver for VT100 Keyboard Signal
    2. LED Array
    3. Buzzer Driver
    A bit more details of each block will be discussed below.

    1. Transceiver for VT100 Keyboard Signal


    The VT100 keyboard cable has only one signal line, where the incoming signal (VT100 to keyboard) and the outgoing signal (keyboard to VT100) are mixed.

    The transceiver circuit on the shield extracts only the incoming signal from the mixed signal line, and applies a low-pass filter to it. The resulting signal is sent to Arduino Serial RX (Arduino Uno pin 19). Arduino interprets this signal as the keyboard status bytes from VT100 terminal, and sends back a set of codes for the keys that are currently pressed down. The key code signal comes out of Serial TX (Arduino Uno pin 18). This outgoing signal is mixed into the keyboard cable signal line, after properly level-shifted.

    2. LED Array


    This shield has an on-board LED array. Each LED is directly connected to an output pin of the Arduino. The LEDs are turned on/off, as indicated by the keyboard status bytes from VT100 terminal.

    The Arduino controls these LEDs dynamically, and up to only one LED is lit at a time, in order to reduce the power consumption by the LEDs. 

    3. Buzzer Driver


    The sound output (beep signal) from the Arduino is connected to an inverter on the 74LS06, which drives the piezo buzzer on the shield. A 800Hz beep sound is triggered by the Keyboard status bytes. 

    Optionally, the beep signal can be routed to an external amplifier, and then the amplified signal can be fed to an external speaker attached to the keyboard cable. This routing to the external speaker is based on the original design of the VT100 keyboard cable. 

    ***

    If you read the Keyboard section of VT100 Technical Manual, you will see that these functional blocks represent some part of the VT100 keyboard functions. The other functions, UART and the keyboard matrix, are taken care of by the Arduino UNO, the USB Host Shield and a USB keyboard.

    You can find the schematic, shield sketch and other details of USB Keyboard Shield for VT100 in the GitHub repo.