M62-OS Operating System Test
Info & Guidelines
To test your M62-OS operating system program, we'll use the earlier hardware configuration involving the 16550 UART and the TeraTerm v4.1 terminal emulator.
The Operating System is being continually updated. The most recent available download of the assembled OS file is m62-os_2019-03-07_v1.1.2.zip
Giving Credit Where It's Due
Peter Murray of 39k.ca initiated and developed the idea of the M62-OS operating system for the Z80 project. I offer help where I can but this really is his "baby".
About the OS file
The O/S is currently a standalone application that is assembled using TASM v3.2.3 to run at $4000, Bank 1, of the 64KB+ Z80 system.
The first thing the O/S does is to check if there is a Memory Expansion Board (MEB). The MEB can be 2MB or 4MB in size with 4 or 8 memory chips installed. If the O/S finds the card, it shows you the I/O address needed to select any of the 16KB ($4000) banks of memory for your apps or CP/M v x.x to run. In the adjacent screenshot, we can see that it is $C0. More info on the Memory Expansion Board (MEB) can be found in the PCBs menu.
Making the O/S work
Typing '?' or 'help" will bring up the current list of commands.
I typed 'memstat' which examines the MEB to see what's available. It has determined that chips 0 to 2 are RAM, chip 3 is ROM and chip locations 4 to 7 are empty.
How does the MEB work?
You or the O/S or an app can use an OUT instruction to switch the Z80's Bank 2 to a particular chip/16KB block on the EMB.
Here's an example:
LD A, $00
LD C, $C0
OUT (C), A
$C0 is the address jumpered on the MEB to select this board; it can be $C0 to $C7. Sending value $00 will select the first chip. Adding $20 to that value will access the next chip in succession: $20 is the second chip, $40 is the third, etc., up to a maximum of $E0 for the eighth chip on this single EMB.
On a 512KB chip, there are 32 blocks each containing 16KB. On the first chip, $00, the first block is also $00. The next block would be $01, then $02, etc., until we reach $1F for a total of 32 blocks. The next block will be on the next chip, so I/O address $20 selects the second chip and its first block, $21 would be chip 2 and block 2, etc. That is what is depicted in the bottom adjacent screenshot, MEB Chip/Block Addressing.
The M62-OS Memory Map
Board SBC2 (Peter's board) or ZB64PC (my board design) have bank switching circuitry (Peter's design) on them. The backplanes (4- or 6-slot) route the Bank_0 to Bank_3 signals from the Z80 board to the MEB(s). These permit us to switch out the 16KB bank, Bank_2, from the Z80 board to the MEB where there are many 16KB banks waiting to be used. To keep things simple, we'll call the Z80 board's "banks" and the EMB's "blocks". This way you'll know that the second bank on the second chip, $21, is being substituted for Bank_2 that always spans $8000 to $BFFF.
As you can see in the adjacent operating system Memory Map, Bank 1 starts at $4000. At the beginning of the bank you can see "OS" for the M62-OS. That is why we uploaded the m62-os.bin file earlier using 'x' from within the BIOS, and then executed it using 'g'. Now that the O/S is in charge of applications, our receive and execute commands change from 'x' and 'g' to 'receive' and 'execute'. Additionally, there are a few new commands that Peter has added. As you can see from the help screen of the top-most screenshot in the adjacent panel, they are resume, clear, and status. More info will be provided as these commands take shape.
Why do I have to upload the O/S like an app?
Why? Because your boot ROM currently holds just the BIOS and Monitor functions. Peter is building a ROM file system that will permit you to put your O/S and applications permanently on ROM for fast boot and access. Wait for it...
How do I get my standalone program into RAM?
With your Z80 system fired up, use 'x' from the BIOS menu to "Receive Binary file via UART" from your PC. Give it an address of 4000 when prompted. From the TeraTerm VT v4.1 terminal emulation software screen, choose File then Send File. Select the assembled m62-os.bin file and click Open. The file will upload and you will be returned to the BIOS '>' prompt.
From the BIOS menu, type 'g' to go to a specific address to execute the uploaded program. Earlier we uploaded to $4000, so now we type 4000. Your app will now run.
M62-OS Operating System
Memory Expansion Board (MEB)
M62-OS Memory Map
MEB Chip/Block Addressing