* NOTE TO THE READER *: Due to a text size limitation of the Hackaday. io site a few chapters have been moved to "Log files". In this case you have just to click on the link of the chapter's title to open a new tab and read it.
* * PROJECT STATUS (18/04/2023) * *
HW:
- Released all the HW related files (see the FILES section);
- Added the USING A SMALL THERMAL PRINTER chapter;
- Added the USING A uTERM2-S RS232 TERMINAL chapter;
- Added the SPP (STANDARD PARALLEL PORT) ADAPTER BOARD chapter;
- Added documentation to build the SPP Adapter board (A240721-R270921). See the FILES section.
SW:
- Released all the SW related files (see the FILES section);
- Updated IOS S310121-R130421 and SD-S310121-R130421-v1.zip (see the FILES section);
- Added the complete collection of the 4 Manuals of CP/M-68K (see the FILES section);
- Updated IOS S310121-R150421 and SD-S310121-R150421-v1.zip (see the FILES section);
- Added the SW/FW for the Arduino Uno PIC programmer, including the "ICSP Shield" board (see the paragraph: FLASHING THE FIRMWARE WITH AN ARDUINO UNO AS PROGRAMMER);
- Updated SD-S310121-R150421-v2.zip (see the FILES section);
- Released a working experimental doker image for a gcc cross-compiler toolchain (See the paragraph: SLOAD: HOW SETUP A "DOCKERIZED" GCC + NEWLIB CROSS-COMPILING AUTOMATED TOOLCHAIN (LINUX));
- Updated IOS S310121-R250521 and SD-S310121-R250521-v1.zip (see the FILES section);
- Added the 68000 IDE installation files and the custom cstart.asm file for the 68k-MBC (128/512/1024KB versions. See the FILES section);
- Updated SD-S310121-R250521-v2.zip (see the FILES section);
- Updated IOS S310121-R010721 and SD-S310121-R010721-v1.zip (see the FILES section);
- Updated IOS S310121-R220721 and SD-S310121-R220721-v1.zip (see the FILES section);
- Updated IOS S310121-R231021 and SD-S310121-R231021-v1.zip (see the FILES section);
- Updated SD-S310121-R231021-v2.zip (see the FILES section);
- Updated SD-S310121-R231021-v3.zip (see the FILES section).
* * THE PROTOTYPE * *
In the first phase of the design I've used a prototype on a breadboard to check the basic "concepts".
I've used as "companion" MCU a PIC18F47Q10 on a custom board (PicOne) I previously made and that it is directly pluggable on breadboards, and with onboard microSD card and USB-serial adapter.:
To make the firmware for the PIC18F47Q10 I've used MPLAB X IDE with the MCC plugin.
Here a short video with an automated assembler toolchain using Easy68K as assembler and sLoad, a custom SW utility to load from the serial port and execute a Motorola S-record formatted executable:
To allow a real automated toolchain an auto-reset circuit on the breadboard takes the DTR signal from the serial-USB adapter and uses it to reset the MCU (like in the Arduino Uno board), so it is possible reset the breadboard from a batch file running in the PC using a macro of Tera Term.
* * WHY A PIC? * *
Those have followed the previous Z80-MBC2 and V20-MBC boards will note that I haven’t used here an Atmega MCU. Using an Atmega MCU allows to use the friendly Arduino IDE and many ways to flash the MCU, so this is an enabling factor.
Unfortunately Atmega MCU GPIO ports are not TTL compatible, and this limitation was solved in the previous boards using a CMOS CPU that under given conditions can accomplish the digital levels of the Atmega MCU.
But here the 68008 CPU isn’t available in CMOS technology at all, so an Atmega MCU cannot be used.
So I’ve done some searches to find an alternative MCU having three main constraints: must have TTL compatible GPIOs (I mean strictly "guaranteed" TTL compatible), must be a TH part and cheap too.
The only part I’ve found was a PIC18F47Q10 MCU, and I must say that it accomplish the previous constrains very well. More, it is a modern MCU with lot of interesting features and more flash and RAM memory than the previous Atmega32 MCU.
Of course nothing comes free, and the choice of a PIC18F47Q10 brings some complexities. The first is the need for an appropriate HW programmer to perform the flashing (however I've found a way to use a common Arduino Uno board as PIC programmer. See the paragraph "FLASHING THE FIRMWARE WITH AN ARDUINO UNO AS PROGRAMMER" below). The second is the constraint to use a proprietary IDE (MPLAB X) to write or modify the source that is more complex to use than the Arduino IDE (but I must say a lot more powerful…).
Those wanting make modifications to the firmware will have to install the MPLAB X IDE and learn to use it. MPLAB X is a professional tool, and with a lot of “power” comes a lot of complexity too… I hope this won’t be a problem, and after all learn to use a professional tool like MPLAB X IDE is always a good thing.
* * HARDWARE OVERVIEW * *
Here the 68k-MBC hardware main specs:
- 68008 CPU running at 8MHz;
- multi-boot capability;
- two main HW configuration options: Lite or Full. Lite HW configuration option allows to build a minimal 3 ICs 68008 system;
- RAM can be configured as 128/512/1024KB (1024KB supported on the Full HW configuration option only);
- optional RTC and microSD (HD emulation) modules (the same used in the Z80-MBC2);
- optional 16x GPIO port;
- I2C expansion port;
- 2 serial ports (Serial Port 2 supported on the Full HW configuration option only) ;
- on board RS232 drivers for both the two serial ports (Full HW configuration option only);
- serial-USB adapter support on the Serial Port 2 with independent power supply (Full HW configuration option only);
- User led and key;
- ICSP connector (for the PIC18F47Q10) for an easy firmware installation/upgrade;
- it is compatible with the uTerm (https://hackaday.io/project/165325) and uCom (https://hackaday.io/project/165709) add-on boards.
LITE/FULL HW CONFIGURATION OPTIONS
The 68k-MBC allows to choose between two main HW configuration options: Lite or Full. Lite HW configuration allows to build a minimal 3 ICs 68008 system running CP/M-68K.
The two HW configurations are quite different, and some signals behave in a complementary way. The IOS firmware checks which one HW configuration is used at first and changes the signals behavior accordingly (where needed).
The Lite HW configuration need less components populated than the Full one, with the only exception of one resistor (R4) that is needed only for the Lite HW configuration and is not needed with the Full HW configuration (anyway it will not "hurt" if present on the Full HW configuration).
The following photo shows the 68k-MBC with the Lite HW configuration populated:
The following photo shows the 68k-MBC with the Full HW configuration populated (previous PCB revision):
To simplify the selection of the components a modular BOM shows the components needed for the two HW configurations.
An important task to do at first is the configuration of the three solder jumpers (SJ1, SJ2, SJ3) on the bottom side of the PCB.
After you have chosen the wanted HW configuration to implement you must set the three solder jumpers SJ1, SJ2 and SJ3 in the following way:
- If you have chosen the Full HW configuration just leave all the three jumpers open;
- If you have chosen the Lite HW configuration all the three jumpers must be shorted.
WARNING: Permanent damages may occur if you don't follow the previous procedure as described!
WARNING: Permanent damages may occur if the three jumpers are shorted when U1, U2 and U5 are populated!
In the following photo SJ1, SJ2, and SJ3 are all shorted to enable the Lite HW configuration:
LIMITATIONS OF THE LITE HW CONFIGURATION OPTION
The Lite HW configuration option allows to build a 68008 system with a minimal BOM, but brings some limitations compared with the Full one:
- the 1024KB RAM configuration is not supported. Only 128/512KB are allowed;
- in the AUX connector only the I2C port is present;
- only the Serial Port 1 can be used (at the SER1 connector only);
- is not possible to use the CPU interrupts.
Anyway it can run all the provided SW, CP/M-68K included.
RAM CONFIGURATION
The supported RAM configurations are different for the two Lite/Full HW options.
The Full HW option allows three different RAM configurations:
- 128KB (1x128KB);
- 512KB (1x512KB);
- 1024KB (2x512KB).
To set the 128KB RAM configuration the JP1 jumper (A17) must be left open, while to set the 512KB or the 1024KB configuration JP1 must be closed.
This operation must be done when the board is not powered, and before the first power on with the RAM chips installed.
Please note that only a single RAM chip configuration is allowed when using 128KB RAM (2x128KB is not supported).
The Lite HW option supports 128KB and 512KB only, setting JP1 as for the Full one (the 1024KB RAM configuration is not supported for the Lite HW option).
THE GPE OPTION
It is possible to choose to populate on the PCB a GPIO port expander (U9) to add 16 bidirectional GPIO pins. The GPE option (see the schematic) can be used with both the Lite and Full HW configurations.
The modular BOM shows the components needed for the GPE option enabled.
ADDRESS SPACE FOR THE FULL HW CONFIGURATION OPTION
The Full HW configuration uses a 16KB I/O address space (decoding A14-A19 with the three gates U2A, U2B and U5A) while the remaining 1008KB are left for the RAM address space. This seemed to me a good tradeoff between needed HW to implement it and "wasted" RAM address space.
128KB RAM configuration.
When using a 128KB RAM the remaining address space inside the Bank 0 is "mirrored" into the first 128KB address block:
512KB RAM configuration.
When using a 512KB RAM all the Bank 0 address space is used as shown in the following table:
1024KB RAM configuration.
When using a 1024KB RAM the real RAM addressable space is only 1008KB because 16KB are "taken" from the Bank 1 for I/O:
The address space for all the 128/512/1024/KB configurations is always 16KB wide (from 0xFC000 to 0xFFFFF), but only 4 bytes are really used (from 0xFFFFC to 0xFFFFF):
ADDRESS SPACE FOR THE LITE HW CONFIGURATION OPTION
The Lite HW configuration uses a very simplified address decoding scheme (using only A19 to select between RAM and I/O). The whole address space is divided into two 512KB blocks, one for the RAM and one for the I/O.
128KB RAM configuration.
When using a 128KB RAM the remaining address space is "mirrored" into the first 128KB address block:
Only 4 bytes of the 512KB I/O address space are really used (from 0xFFFFC to 0xFFFFF), and due the simplified address decoding scheme the highest 4 bytes of the 128KB RAM address space (from 0x1FFFC to 0x1FFFF) must not be used:
512KB RAM configuration.
When using a 512KB RAM the address space is shown in the following table:
Only the same 4 bytes of the 512KB I/O address space are really used (from 0xFFFFC to 0xFFFFF), and due the simplified address decoding scheme the highest 4 bytes of the 512KB RAM address space (from 0x7FFFC to 0x7FFFF) must not be used:
THE SERIAL PORT 1 CONNECTOR (SER1/J2)
The SER1 port (J1) is used to power the board and to connect the Serial Port 1. It can be connected to a TTL-RS232 adapter or to a serial-USB adapter like the one (CP2102 based) in the following image:
This serial-USB adapter can act also as power source for the 68k-MBC, and has the DTR signal for the "autoreset" to trigger the upload of a S-record formatted stream when using the sLoad boot mode, enabling the implementation of an automated toolchain.
Note that the CTS pin of the SER1 port (J2) is not currently supported and must be left disconnected (as the NC pins) when using a serial-USB adapter.
Also the 3V3 pin of the serial-USB adapter must be left disconnected:
In the following table there is the pin mapping for J2 and how connect a serial-USB adapter (please note that the pin names of J2 on the PCB are referred to the serial-USB side!):
THE AUX CONNECTOR (AUX/J4)
The AUX (J4) connector expands the IOEXP connector used in the previous boards (V20-MBC and Z80-MBC2), supporting both the two serial ports with RS232 levels, the I2C port, the TTL level Serial Port 2 and a serial-USB adapter for the serial 2 with independent power.
The are two different pin mapping for the two Lite/Full HW option configurations (Lite supports only a few pins).
The J4 pin mapping for the Full HW option is the following:
The J4 pin mapping for the Lite HW option is the following:
THE GPIO CONNECTOR (GPIO/J7)
In the following table there is the pin mapping for J7 (GPIO) when the GPE expansion is installed. The GPA and GPB names are referred to the pin names used in the MCP23017 datasheet:
THE AUX RS232 CUSTOM CABLE
To connect the RS232 Serial Port 1 or 2 available on the AUX connector (J4) an AUX RS232 custom cable (A020221) must be assembled. The following image shows the AUX RS232 cable connected to the AUX port for the Serial Port 1:
The AUX RS232 cable uses a common DB-9 female connector and a 3 pin Dupont pin header (female) connector.
The J1 connector of the cable must be inserted into the J4 connector of the 68k-MBC board so that the pin 1 of J1 is connected with the pin 13 of J4/AUX (for the Serial Port 1) or with the pin 14 of J4/AUX (for the Serial Port 2).
The schematic of the cable is in the FILES section (as .pdf file) and in the following image too:
You can use two AUX RS232 cables at the same time to connect both the two RS232 serial ports.
HOW CONNECT THE SERIAL PORT 2 TO AN USB ADAPTER
It is possible connect the Serial Port 2 to a serial-USB adapter using the AUX (J4) connector. The following photo shows a 68k-MBC with both the Serial Port 1 and 2 connected to a serial-USB adapter using two identical CP2102 based adapters (please note that only the SER1 connector can be used to power the board):
The following image shows how connect the serial-USB adapter to the pin 4, 6, 8, 10 of the AUX (J4) port:
Pin 4, 6, 8, 10 of the AUX (J4) connector are intended to operate with a self-powered device.
THE OPTIONAL SD MODULE
The optional SD module is used as HD emulation. The module is a common 6 pins microSD module that can be easily found on ebay:
If a socket is used for the PIC MCU, a little cut is required to allow a good insertion into the J6 connector.
The cut is in the right angle near the connector as shown in the following image:
Pay attention on how and where you plug the module in (the only right connector for it is J6 marked as SD-MOD). If you plug it in the wrong connector or in the wrong way it is possible cause permanent damages to both the module and the 68k-MBC board! So plug it as shown in the following image:
THE OPTIONAL RTC MODULE
The RTC is a common module based on a DS3231 RTC like this one:
This cheap modules have a trickle charging circuit that may cause the "explosion" of the battery if you use a standard CR2032 cell. More, it can damage also a rechargeable LIR2032 cell. For more information and how to fix it see here.
The RTC module has it's own pullup resistors on SDA and SCL. Because the value is 4k7 (the same value used inside the 68k-MBC board), the resulting value will be:
4k7 // 4k7 = 2k3
Because this value is fine there is no need to take away the pullup on the RTC module.
Pay attention on how and where you plug the module in (the only right connector for it is J5 marked as RTC-MOD). If you plug it in the wrong connector or in the wrong way it is possible cause permanent damages to both the module and the 68k-MBC board! So plug it as shown in the following image:
ADD-ON BOARDS
The 68k-MBC is compatible with the uTerm (https://hackaday.io/project/165325) and uCom (https://hackaday.io/project/165709) add-on boards and the related 3D printed parts for a vertical or horizontal assembly:
Both the boards allow an optimal power supply for the 68k-MBC. In this case it is mandatory to use the AUX-P (J1) connector.
* * SOFTWARE OVERVIEW * *
The PIC18F47Q10 MCU is used as universal I/O subsystem, as Eeprom, and as reset and 8MHz clock generator for the 68008 CPU.
The software running into the PIC18F47Q10 is the IOS (Input Output Subsystem) written using MPLAB X IDE with the MCC plugin.
The IOS allows to interface the PIC18F47Q10 directly with the CPU system bus, emulating the needed I/O chips during the memory mapped I/O read, I/O write and IRQ acknowledge CPU bus cycles (see the 68008 datasheet).
In addition, the IOS loads the RAM during the boot phase, "feeding" the CPU with the necessary instructions to load the RAM.
If the "feeding" algorithm "sees" that there is an unexpected bus status, it aborts the boot sequence alerting with a message.
Because the 68008 CPU has a two-word instruction prefetch mechanism, the IOS takes care of this in the "feeding" algorithm during the boot phase and appends at the end of the boot stage a STOP instruction to be sure that the CPU doesn't go further.
The parameters of the two serial ports emulated by the IOS are: 115200 baud, 8N1 with no flow control (anyway you can change the speed for both the two serial ports in the "Select boot mode or system parameters" menu).
Currently IOS allows to use the 68k-MBC in various scenarios:
- Running CP/M-68k as a stand-alone computer;
- Running the stand-alone Basic interpreter (Enhanced 68K Basic);
- Using the sLoad boot mode as a "modern" embedded development board;
- Using the Autoboot boot mode to run a custom binary executable at power-on.
There are also various toolchains available as cross compiler:
- Cross Assembler with Easy68k (Windows);
- Cross Compiler with gcc (Linux);
- Cross Compiler using 68000 IDE (Windows).
FLASHING THE FIRMWARE WITH MPLAB IPE
One of the simplest way to flash the IOS firmware is probably to use the MPLAB IPE utility. I've used with it both the MPLAB PicKit 4 and MPLAB SNAP programmers:
To connect the programmer to the 68k-MBC you also need a simple 6 wire Dupont cable as the one in the previous photo, with female pin headers on a side and male pin headers on the other side. It is strongly recommended that you mark the pin 1 on both sides to avoid errors when connecting it.
In the next it is assumed to use MBLAB SNAP as a programming device. It is also assumed that MPLAB IPE is already installed and that you have read the MPLAB SNAP manual and are "familiar" with it.
STEP 1: You must connect the MPLAB SNAP programmer to the USB first (to power it), then connect it to the 68k-MBC board using the 6 wire cable at the ICSP connector. Please note that the 68k-MBC * must * be not powered in this phase.
STEP 2: Now you can power the 68k-MBC board and then launch the MPLAB IPE utility. You have to select the Advanced Mode from the Setting menu:
STEP 3: At this point you have to logon with the default password (microchip) checking the Keep me logged in option, so the "Advanced mode" will be the default mode:
STEP 4: You have to press the Connect button to activate the programmer. The MPLAB IPE should select the right PIC MCU (PIC18F47Q10) at this point:
STEP 5: You have to select the .hex file to write inside the PIC, using the Browse button to choose it:
STEP 6: Now is time to write the .hex file into the PIC MCU pressing the Program button:
STEP 7: After the end of the programming you can optionally select Release from Reset if you want try to let the PIC MCU run to see the result. Consider that with the MPLAB SNAP programmer connected to the 68k-MBC the User key will be seen by the PIC MCU as permanently pressed. Then you have to press the Disconnect button:
STEP 8: Now you can (in this order) unpower the target board (68k-MBC), disconnect the ICSP cable from the J3 connector (of the 68k-MBC board) and finally disconnect the MPLAB SNAP programmer from the USB. All done.
FLASHING THE FIRMWARE WITH AN ARDUINO UNO AS PROGRAMMER
Searching around for an alternative way to program the PIC MCU without the need of custom programmers, I've found this interesting project here and here that uses a common Arduino Uno board with a proper "control program" on the PC side.
So I've tested it (on a linux PC) and after a little modification it worked!
The modification was needed because the Device Id of the PIC18F47Q10 was exchanged with the one of a very similar device (PIC18F27Q10).
Another modification I've done is inside the .ino file to add a switch that holds the programmer in a "standby" state to allow a safer connection/disconnection to/from an unpowered target board. When the programmer is in this state the Arduino Uno built-in led is blinking.
You need to build a very simple "ICSP Shield" (see the A170421 schematic) with a little piece of perfboard to plug on top of the Arduino board and a 4 wire cable with a 6 pin Dupont socket as in the following images (only pin 1, 3, 4 and 5 are connected) for the ICSP connector.
It is strongly recommended that you mark the pin 1 on both sides to avoid errors when connecting it:
Here all the steps to program the PIC MCU. If you are in a linux machine you have to compile pp3.c at first (with the command: gcc -Wall pp3.c -o pp3).
In the following it is assumed that:
- you have already flashed the pp.ino sketch into the Arduino Uno board;
- the "ICSP Shield" (A170421) is plugged on top of the Arduino board with the MODE (SW1) switch set to STBY;
- the file .hex you want write inside the PIC MCU is in the same directory where the "control program" (pp3 for linux or pp3.exe for windows) is.
STEP 1: You must connect the Aduino Uno to the USB first (to power it). Verify that the MODE (SW1) switch on the "ICSP Shield" (A170421) is in the STBY position and the led is blinking on the Arduino Uno board. At this point connect it to the 68k-MBC board using the 4 wire cable at the ICSP (J3 ) connector (68k-MBC side). Please note that the 68k-MBC * must * be not powered in this phase.
STEP 2: Now you can power the 68k-MBC board and then set the the MODE (SW1) switch on the "ICSP Shield" (A170421) is in the PROG position. The led on the Arduino Uno board now is turned off.
Please note that in this state the RESET key of the 68k-MBC is disabled and the User key will be seen by the PIC MCU as permanently pressed.
STEP 3: Open a shell from the directory where the .hex file to write and the "control program" (pp3 for linux or pp3.exe for windows) are:
Then check that is all ok with the command (eventually changing the /dev/ttyACM0 serial port name if is different in your system):
./pp3 -c /dev/ttyACM0 -s 1700 -p -n -t 18f47q10
STEP 4: Program the MCU with the command:
./pp3 -c /dev/ttyACM0 -s 1700 -t 18f47q10 S310121.hex
changing S310121.hex with the name of the .hex file to write:
STEP 5: Set the the MODE (SW1) switch on the "ICSP Shield" (A170421) in the STBY position and then press the RESET button on the Arduino Uno board. At this point the led on the Arduino Uno should be blinking again. Now the RESET key of the 68k-MBC works again and you can try to run the 68k-MBC board if you want.
STEP 6: Unpower the 68k-MBC board and then disconnect the cable from the ICSP (J3) connector (68k-MBC side).
STEP 7: Disconnect the Arduino Uno from the USB. All done.
All the needed SW/FW with my changes already applied and the documentation (schematic, BOM, etc.) of the "ICSP Shield" board (A170421) are in the FILES section.
NOTE 1: the Arduino Uno PIC programmer should be able to program more than 400 different PIC devices.
NOTE 2: I've also done a small PCB (18mm x 40mm) for the "ICSP Shield" (A170421) board. The gerber files are inside the same .zip file in the FILES section:
THE SD IMAGE
The content of the microSD (I'll call it simply SD from now) is compressed into a zip file in the Files section.
When you update the IOS firmware you must always update the content of the SD too, as the SD image is normally suited for a given IOS revision.
You have to unzip it retaining the structure of the sub-directories into a FAT formatted SD card, so that the various root files (inside the .zip as the various .DSK files and so on...) are in the root of the SD itself.
IOS supports only FAT16 and FAT32. A 1GB SD is more than enough, anyway because they tends to be difficult to find now a 4GB SD can be a good choice.
About the SD technology, only "legacy" SD (aka SDSC with a capacity up to 2GB) and SDHC cards (2GB - 32GB) can be used. Other most recent types are not supported (so, no SDXC, SDUC,...).
What it really needed to let IOS run are only all the files in the root folder. The other sub-directories contain source files or examples or other kind of content (see next paragraphs).
Inside every sub-directory there is a README.TXT file that may contain important info/updates. Please read them all when you use a SD image first time or when update it!
In the root there is a ChangeLog.txt file with the changes log (related to the SD image content).
HOW ENTER IN THE "SELECT BOOT MODE OR SYSTEM PARAMETERS" MENU:
To enter in the "Select boot mode or system parameters" you must press the RESET key (SW2), release it and press immediately the USER key (SW1) and keep it pressed until the USER led (LD4) starts to blink.
An other way is to press both keys, release the RESET key holding the USER key down until the USER led starts to blink, or you see the menu on the screen.
Here a screenshot of the menu:
sLoad: loads and executes a Motorola s-record formatted executable sent from the serial port 1. It is the only loading utility embedded into the IOS firmware, so it can be used in a minimal HW configuration without any optional SD or RTC module;
Enhanced 68K Basic: loads and executes a stand-alone Basic interpreter;
Autoboot: loads and executes a 68008 binary file (AUTOBOOT.BIN) on SD.
Load OS from Disk Set <n>: loads and runs an Operative System installed into the current Disk Set <n> on SD.
Change Disk Set <n>: Changes the current Disk Set to another one (only if it is supported more than one Disk Set). This command implements the Multiboot selection and it is used to switch among multiples OS. NOTE: Currently only the Disk Set 0 can be selected.
Change serial ports speed: Changes the speed of the two serial port. The changes will be effective only after the next reboot;
Change CP/M Autoexec: Turns on or off the execution of the AUTOEXEC.SUB batch file at the cold boot of CP/M-68K.
The remaining choices are self-explanatory.
On the current SD image the file AUTOBOOT.BIN is an "Hello World" demo written in 68008 assembly (the source is in the \src folder on the SD).
THE AUTOBOOT BOOT MODE
The Autoboot boot mode allows to load and execute a binary file (AUTOBOOT.BIN) on the root of the SD.
Starting with IOS S310121-R250521 the Autoboot boot mode allows to set custom loading values for the binary executable file AUTOBOOT.BIN.
To set a custom hexadecimal value for both the loading address (the address from which to start loading the binary file) and the execution address (the address to jump to after loading) you have to create a text file AUTOBOOT.ADR on the root of the SD with a single text line containing both the two values separated by a blank.
I.e. on a linux PC to create the AUTOBOOT.ADR file you can use the command:
echo "0x400 0x404" > autoboot.adr
to set the loading address at 0x400 and the execution address at 0x404.
If the AUTOBOOT.ADR file is not found the default values (0x400, 0x400) will be used.
When the Autoboot boot mode is used now both the loading address and the execution address will be displayed as shown in the following screenshot (autoboot.bin generated from the startrek.c source and compiled with the gcc cross-compiler toolchain specifying the needed custom loading parameters in the autoboot.adr file):
THE BAUD RECOVERY VIRTUAL BUTTON
Changing the speed of the serial ports may happen "to loose" the control of the board (i.e. you forget the speed or set a wrong speed). In this case you can use a "virtual button" to reset both the serial ports to their default speed (115200 bps) without the need of a terminal.
To activate the Baud recovery "virtual button" you have to press both the RESET and USERkey, release the RESET key holding the USER key down until the USER led starts to blink (like for the "Select boot mode or system parameters" menu) and keeping it down at least for 4 seconds more until the USER led starts to blink very quickly. This is the sign that the Baud recovery "virtual button" has been activated.
At the next reboot both the serial ports will be set at the default speed (115200 bps):
NOTE: Starting with IOS S310121-R250521 the behavior of the Baud Recovery virtual button is changed. Now can be triggered only if at least one serial port is set to a not default (115200) value.
CP/M-68K
This is the CP/M-68K v1.3 for the 68000 CPU.
CP/M-68K can run with any supported RAM configuration. I added into the custom Bios a routine to size the installed RAM (128/512/1024KB) and adapt the TPA (Transient Program Area, the user programs space) size accordingly. The detected amount of RAM is printed in the sign-on message:
You have 16 8Mbytes disks from A: to P:. The disk A: is the "system" disk and it mainly contains the CP/M external commands.
Other disks (from B: to P:) may contain some SW or be empty. For those containing SW I've added a file (README.TXT) with the name of the SW inside and other information when needed.
If you want to play with both the serial ports virtualized by the IOS, remember that they are mapped as CP/M physical device names accordingly with the following table:
CP/M-68K device name | IOS device ------------------------------------------------+------------------ CRT:, PTR:, PTP: | Serial port 1 TTY:, BAT:, UC1:, UR1:, UR2:, UP1:, UP2:, UL1: | Serial port 2 LPT: | SPP (*) (*) or Serial port 2 if SPP (Standard Parallel Port) emulation is not enabled.
HOW ADD FILES INSIDE A VIRTUAL DISK USING CPMTOOLSGUI
The 68k-MBC maps any disk like A: B: C: etc. into an image file on SD card with this file name: DSxNyy.DSK;
where x (from 0 to 9) is the Disk Set containing an OS:
0 = CP/M-68K v1.3
and yy (from 00 to 15) is the disk (00 = A: 01 = B: etc.).
You can download CpmtoolsGUI (English Windows version) from here.
Extract the file CpmtoolsGUI.exe in a new folder and add/overwrite the file diskdefs copying it from the cpmtools folder inside the SD.
-> STEP 1
Select in the upper left window (Image File) of the CpmtoolsGUI tool the virtual disk where you want to add files.
For CP/M -68K: select "68kMBC-D0-15" for any disk (disk 0 - 15) in the bottom left window (Format) of CpmtoolsGUI.
In the following image is selected (Image File) the disk DS0N00.DSK that corresponds to the disk A: (yy = disk = 00 = A:) of the CP/M-68K OS (x = 0):
-> STEP 2
To add one or more files to the selected virtual disk you have simply point the upper right selection window to the folder where the new files are stored in your PC, select them using the bottom right selection window and press the "<- P" button. After the add you'll see the added file names in the center window (together with the other files previously present).
-> STEP 3
Exit from the the CpmtoolsGUI tool pressing the eXit button.
To extract one or more files from a virtual disk the procedure is the same, just press the "-> G" button instead.
To delete a file inside the virtual disk, select it in the central window, press the right mouse button and select Delete (you can't overwrite a file in the virtual disk, but you have to delete it first).
HOW TO USE SLOAD
When using sLoad to load an executable program in Motorola s-record format from the serial port, remember to set a 15/90ms delay on every transmitted line into the serial port setting of the SW terminal you are using.
In the following image there is the setting window for TeraTerm:
This is required because both the serial ports don't use any handshaking control.
The same is required also when using i.e. the Enhanced 68K Basic and uploading a Basic program.
SLOAD: HOW SETUP A 68008 CROSS-ASSEMBLER AUTOMATED TOOLCHAIN WITH EASY68K (WINDOWS)
Using the sLoad boot mode it is possible setup an automated toolchain to cross-assemble, load and execute on the target (the 68k-MBC) a 68000 assembler source program without physically touch the board (like a "modern" development board), running a single batch file (AL.BAT) from the Windows command-line shell.
To setup an automated toolchain under Windows you have to install Tera Term and the Easy68K assembler at first.
You have to use an USB-serial adapter with the DTR signal as the one described in the HW section, and the driver must be already installed and "linked" to a COMx: port (the DTR signal is used to reset the board from the workstation and start an sLoad load&execute session).
In the \teraterm folder inside the SD image zip file there are the needed files and the detailed instructions in the README.TXT file (remember to modify both the AL.BAT and Load68k.ttl files according to your installation, as explained in the README.TXT file).
I've used this toolchain under Windows 10 and in a Windows XP VM too.
Here a video using the hello_world_demo.X68 source file example (in the \asm_demo directory inside the SD image):
Before to start writing your first program it is probably a good idea to give a look at the "sLoad-S180221.X68" source file (in the \src directory) and read the details about the memory allocation in the comments at the beginning of the file.
Please note that Tera Term resets the 68k-MBC when the macro (Load68k.ttl) is called from AL.BAT. This explains the need of the DTR signal on the USB-serial adapter (it uses the same "trick" to upload an Arduino sketch).
You have to close the Tera Term window to terminate the execution of the AL.BAT batch (before a new run).
SLOAD: HOW SETUP A "DOCKERIZED" GCC + NEWLIB CROSS-COMPILING AUTOMATED TOOLCHAIN (LINUX)
A "dockerized" ready to use gcc + newlib (standard C library for embedded devices) toolchain with automatic upload customized for the 68k-MBC board can be found here:
https://hub.docker.com/r/just4fun4just/68k-mbc
You have to install docker and minicom in your linux PC to use this docker image to cross-compile with gcc (m68k-elf-gcc) and enable the auto-upload into the 68k-MBC.
Follow the instructions on the 68k-MBC Docker Hub page:
Here an example with the C version of the famous Startrek game:
For more details read the README.TXT file in the /gcc-68k/workdir folder inside the SD image.
NOTE 1: Starting with IOS S310121-R250521 it is possible to use the gcc generated AUTOBOOT.BIN file with the Autoboot boot option (you have to copy the provided AUTOBOOT.ADR file in the /gcc-68k/workdir folder inside the SD image zip file into the root of the SD to enable the execution of any gcc generated AUTOBOOT.BIN binary file).
NOTE 2: the current SD image contains all the needed files to build locally the docker image with the gcc (m68k-elf-gcc) + newlib (standard C library customized for the 68k-MBC) cross-compiler under linux. For more info see the README.TXT file in the /gcc-68k/docker folder inside the SD image.
SLOAD: HOW SETUP THE 68000 IDE AS CROSS COMPILER (C AND ASSEMBLER) WITH AUTO UPLOAD (WINDOWS)
Searching around I've found this interesting freeware tools, the 68000 IDE.
It is a complete IDE for 68000/68020/682XX CPU with an assembler, a C compiler and a simulator:
The original author site seems to be disappeared, but the last version (ide68k30.zip) can be downloaded from here.
Just to be sure I've uploaded it in the FILES section too (to "preserve" it just in case...). I'm currently using it on a Win 10 system without any problem.
It can assemble a single .asm file or use a "project" to compile a C program specifying the library files and a startup file (cstart.asm) with the I/O routines for the target:
Changing the cstart.asm file it is possible "customize" the C compiler startup file (a sort of crt0 file) to run the generated .hex file (s-record formatted) on a custom board.
In the /68K_IDE folder inside the SD image there are the needed files to customize the 68000 IDE for the 68k-MBC board.
After the customization it will be possible run the same C compiled executable on both the 68000 IDE simulator and the 68k-MBC board (unless you don't use simulator specific or 68k-MBC specific stuff inside your program) as the modified cstart.asm can detect if it is running on the simulator or on the 68k-MBC board and select the right I/O routines accordingly:
Read the README.TXT file inside the /68K_IDE folder for the procedure to follow to customize the 68000 IDE for the 68k-MBC and to add the Upload.bat batch file to upload the last assembled/compiled .hex file to the board (using Tera Term).
* * USING A SMALL THERMAL PRINTER * *
Click on the link above to read this chapter.
* * USING A uTERM2-S RS232 TERMINAL * *
Click on the link above to read this chapter.
* * SPP (STANDARD PARALLEL PORT) ADAPTER BOARD * *
Click on the link above to read this chapter.
* * WHERE TO GET A PCB * *
I've prepared an "easy" link to get a small lot (5 pcs minimum) of PCB. The link is this one.
* * HOW TO GET A KIT OR AN ASSEMBLED UNIT * *
If you are looking for a kit with all the needed parts or an assembled unit ready to use now there is a professional seller that can sell both and ship worldwide.
The link to the seller is this one.
* * 68k-MBC USERS GROUP * *
An "Users Group" was created on Facebook (it is the same used for the Z80-MBC2): https://www.facebook.com/groups/388307645238660/
* * LICENSING AND CREDITS * *
PetitFS was developed by ChaN.
The Arduino UNO PIC programmer was developed by Jaromir Sukuba.
All the project files (SW & HW) are licensed under GPL v3.
If you use this material in any way a reference to the author (me ☻) will be appreciated.