V20-mbc How to Build a Custom Cp/m-86 BIOS Windows Version
by coopzone in Circuits > Computers
1343 Views, 2 Favorites, 0 Comments
V20-mbc How to Build a Custom Cp/m-86 BIOS Windows Version
You may find yourself in a position of needing to add custom options to your V20-MBC Bios, for example I am going to use this basic process in the near future to add a PRN: driver that will send data via the GPIO pins on the board. But this example is about how to rebuild the bios, the customise bit is up to you.
The most difficult aspect of doing this rebuild is getting all the various files and programs in one place! The required files are scattered all over the place, some on the web, some have to be extracted from the disk images provided on the v20-mbc boot SD card
I have chosen the utilities used to run the cp/m tools on a first come first used basis, you can of course use other programs to achieve the same aim. See any notes about each download in the "Supplies" section.
In keeping with the use of cmd line, I have elected to use the non-graphical versions of many programs.
Supplies
You will need to get the following software. As a general rules they will download as ZIP files. The process of un-zipping them in windows is to right-click and choose extract all. I would suggest you put the files in a "scrap" directory that you can delete when finished with. The exception being the SD card files from the V20-MBC web site, this is where the finished cpm86.bin file will be kept and copied to a new SD card to test.
These links may change over time, so if they fail please search instead for the tool/file name you need.
IMPORTANT NOTE: I first tried to use the cpmtools GUI version (from http://star.gmobb.jp/koji/cgi/wiki.cgi?page=Cpmto... ) use google translate the original is in Japanese - unless you are skilled enough to read it. I found that windows complained about the binary file not being signed and blocked it on the first run. You need to decide if you trust the author and the program before you use it! I did, but i'm only working on a VM. It did work ok, but these instructions are based on the non-gui version.
The non-gui version, if you prefer, I have based the instructions on this version. (from http://www.cpm8680.com/cpmtools/cpmtoolsWin32.zip... ) This is the original version of the tools, but it requires more effort than the GUI!
cpmtools (one of the following, either GUI or CMD tools)
http://star.gmobb.jp/koji/cgi/wiki.cgi?page=Cpmtoo... - GUI version, see NOTE above.
http://www.cpm8680.com/cpmtools/cpmtoolsWin32.zip
Original SD card image for the V20-MBC project
https://cdn.hackaday.io/files/1709247312812416/SD-...
Portable CP/M command line tools, allows execution of cp/m files on windows
(worth a look at the project on github)
https://github.com/ivanizag/iz-cpm/releases/downlo...
Windows version of DD command
http://www.chrysocome.net/downloads/ddrelease64.ex...
Copy of cpm.h86 hex file from the original distribution of cp/m-86
Create a Place to Put Your Working Files
Simple step, just choose a location on your computer and create a directory - I would suggest cpm86.
This is where you will be putting all the utilities and source files you will use. It's also the place where the finished file cpm86.bin will be found after you finish.
At this point you may also want to install things like your favourite text editor to make change to the Bios file etc.
I normally create a second directory to make a copy of this one in for backup. Just in case it all goes wrong while you are building a new Bios.
So the procedure would be:
Create a new directory, populate it (as in the next steps).
Create a backup directory, copy the contents to it.
Work in the main directory
Copy files from the backup directory if you make a mistake and can't fix it!
You can also make copies of the directory so as to create a history of changes as you go, then you can revert to any of the ones you created as a revision. It's good practice. And since they are very small files it does not take long or use much space so it's worth doing.
Download and Install Cpmtools
Use the links in the "supplies" page to get a copy of cpmtools
Unzip it to a temporary directory by right-clicking on the filename and choosing extract all. Choose a path for your extracted files.
copy the following files to your working directory:
cpmcp.exe
cpmls.exe
Done
The V20-MBC SD Card Image
Download the SD card zip file from the V20-MBC main website, listed in the "Supplies" section on the first step.
Unzip the contents using right-click, extract all. To a temporary location. You need to use something simple like "SD" as the name of the directory to put the files in, the default is to long to keep typing!
You may want to keep this directory after you finish it's useful for creating new SD cards to boot from.
Start a command prompt in your working directory, or cd to it from a command prompt.
Copy the diskdefs file from the cmptools folder (from the unzipped directory)
copy ..\SD\cpmtools\diskdefs .
(this assumes the SD directory is one directory up ".." from this one, be carful to get the dot at the end meaning this direcory)
Then use the cmpcp.exe command to extract the following list of files from the DS1N00.DSK image, like this:
cpmcp.exe -f V20MBC-D0 ..\SD\DS1N00.DSK 0:asm86.com .
cpmcp.exe -f V20MBC-D0 ..\SD\DS1N00.DSK 0:gencmd.com .
Next copy pip.com from the DS0N00.DSK image, like this:
cpmcp.exe -f V20MBC-D0 ..\SD\DS0N00.DSK 0:pip.com .
Note 1: The cpmcp program is not very user friendly, for example if it does not find the file you are trying to extract or if it does not understand the filename it just finishes no error not sorry can't find that file. Nothing.
You can test and look at the contents of a DSK file using the simpler cpmls.exe program, it's useful to be at lease sure you are looking in the right file!, like this:
cpmls.exe -f V20MBC-D0 ..\SD\DS0N00.DSK
Note 2: You can also use these two command on the other disk images from DS0N01.DSK to DS0N15.DSK (or the DS1N.. versions, DS0=cpm2.2, DS1=cpm-86), like this:
cpmls.exe -f V20MBC-D1-15 ..\SD\DS1N01.DSK
use -f V20MBC-D0 for the first disk, A: or DS0N00.DSK and DS1N00.DSK
and use -f V20MBC-D1-15 for the other disks, B: - P: where
DS1N01.DSK or DS0N01.DSK is B:
DS1N02.DSK or DS1N02.DSK is C: etc
Iz-cpm Portable Cp/m Tools
Download iz-cpm tools for windows from the link shown in the "supplies" list or search github.com for it and download the latest version from the release section.
Unzip it to a temporary location by right-clicking the file and using extract to.
copy the file iz-cpm.exe from it to your working folder. using windows file manager.
As a checkpoint, your directory should look like the one above by now.
You can test it works by (from the command prompt) typing:
iz-cpm.exe
you will see a CCP A: prompt, you can do a DIR as you would on a cp/m machine.
to exit press ctrl-c twice then Y to confirm.
It's worth a read through the authors README.MD on github to get familiar with this software, it's useful for testing all sorts of cp/m software as well as this task
DD for Windows
Using the link provided in "supplies" or search the net for DD for windows, down load it to a temporary folder on you computer. Note it's an executable for 64bit windows, the same web site has other versions as well. Because it is an EXE I suspect some web browsers or virus scanners may not let you download an EXE. You should be able to find a zipped up version on the web site, try that one.
Once you have a copy of dd, you may need to rename it to be lust DD.EXE. Then copy it to the working directory.
In my case i downloaded it to the Downloads folder, you can use file manager to rename and copy it or you can use copy from the command prompt, like this:
copy ..\Downloads\ddrelease64.exe dd.exe
done.
CPM.H86 File From the Cp/m Distrobution.
Using the link from the "supplies" section, download the CP/M-86 1.1 SOURCES file C8611src.zip.
Unzip it to a temporary folder using right-click and extract all. Using windows explorer find the file called CPM.H86 and copy it to the working directory.
Done
Copy the CBIOS Source File
You now need a copy of the source file V20CBIOS - S220520.A86 (the exact version may be newer) You can find this file in the SD directory you created back at step 3 from the file downloaded and unzipped (v20-mbc homepage).
Using windows file manager navigate to the "src" then "cpm86". Copy the file V20CBIOS - S220520.A86 to your working directory, rename it to V20CBIOS.A86 (the original is to log for cp/m to use it)
So you should now have all the parts needed to be able to compile a new version of the cpm86.bin file, but just before that step do two things:
1, check you have all the files shown in the picture above.
2, make a copy of your working directory as a backup.
At last ready to go....!
First Time Compile
Assuming you have managed to get all the files in your working directory ok. You are ready to compile a new Bios. Well actually this compile will not be a "new" one, this just take you through the steps needed and since we have not altered the original file yet - we end up with an identical file to that on the boot SD. You do this to prove the process so when it all goes wrong at least you know it's not the process thats wrong!
All these steps are from a command prompt in the working directory.
1,
iz-cpm.exe asm86.com v20cbios.a86
C:\Users\admin\cpm86>iz-cpm.exe asm86.com V20CBIOS.A86
CP/M 8086 ASSEMBLER VER 1.1
END OF PASS 1
END OF PASS 2
END OF ASSEMBLY. NUMBER OF ERRORS: 0. USE FACTOR: 10%
2,
iz-cpm.exe pip.com cpm86.h86=cpm.h86,v20cbios.h86
no output, you should get a new file called cpm86.h86
3,
iz-cpm.exe gencmd.com "cpm86.h86 8080 code[a40]"
BYTES READ 2725
RECORDS WRITTEN 7C
You will also get a new file called cpm86.cmd
4,
dd bs=128 skip=1 if=cpm86.cmd of=cpm86.bin
rawwrite dd for windows version 1.0beta1 WIN64.
Written by John Newbigin This program is covered by terms of the GPL Version 2.
skip to 128
123+0 records in
123+0 records out
If all is well at this point you will have a new file called cpm86.bin, it should be identical to the one on your existing SD card. And if you want you can boot from it by replacing the one on your SD card with this one. Make a copy of the working one first!
Second Time Compile
So if you have got this far, your ready to. go.
for the purposes of this tutorial, i'm only going to add the word "Custom" to the boot up sign on message. Before you dive in make a backup copy of the working directory!
1,
Edit the file V20CBIOS.A86, using you favourite text editor. It must be capable of saving as a text file.
2,
Find the line (use the editors find options):
db 'V20-MBC CP/M-86 BIOS - S220520'
change it to:
db 'Custom V20-MBC CP/M-86 BIOS - S220520'
3, save your new file
Follow the process in the step called "First time compile" (previous step).
copy your new cpm86.bin file to your SD card and boot up!
Done