M62 – Software

software section is currently being created, check back often for more updates!

The M62 Software is divided into 2 main sections; BIOS and Applications

 

M62 BIOS

The foundation software for the M62 system is the BIOS (Basic Input Output System) which consists of the following functions:

  • Initialize the processor and other interface cards on the system
  • Provide most commonly used software routines into an organized repository, this is to negate the need for Applications to have to “re-invent the wheel”
  • Provide drivers for hardware such as UART, PIO, and IDE/CF interfaces,
  • Present the user with a menu allowing the loading of Applications (currently via binary transfer over serial connection)

 

A little about the BIOS

The M62 BIOS was the next step in the evolution after having a simple monitor running on the M62 System, it modularizes the software in the same way as the hardware. The BIOS has been in development for the last few months by Peter Murray (me) and Don Prefontaine, it has progressed into a stable foundation to build upon.

You can find Don’s website here

 

BIOS Menu

As of the current version (Nov 11, 2018) the menu only has 4 options:

  • Show the menu options (?)   – Just shows the menu again if you forgot what the choices are
  • Receive Binary file via the UART (X) – Allows the transferring of binary data and application code from the host computer
  • Go to specific memory address (G) – Jump to the desired address
  • Restart the BIOS (Q) – Jump to the reset vector

 

BIOS Memory Map

The BIOS is designed to have the location of RAM specified in the main file, so the memory map would therefore be a table of offsets from the set location of RAM specified by the user.

No firm map has been produced yet, but that will be updated as soon as it is available.

 

Software routine repository and jump table

The structure of the software routines is constructed in such a way that should an application need a common routine, it would call the known address of that desired routine which resides in the jump table, this location in the table will then jump to the current address of the actual routine the application requested.

When the called routine is done and issues a RET instruction, this will then return to the original return address that was put on the stack when the application performed the call.

Using a jump table allows the BIOS to maintain backwards compatibility with older application code as the location of the jump table (and inherently the locations of the where those jumps are stored) should not change. When the BIOS is updated and assembled, the target of the jumps in the jump table will update, but the jump table should not be altered. New routines are just added to the end of the jump table so it does not interfere with the previously established jump locations.

After assembling of the BIOS, you need to generate an assembly file that contains the labels of the routines in the jump table with the address that they reside at in the jump table. Currently this file is called routine_entry.asm and it takes the form of:

;***************************************
; M62 BIOS Routine Entry locations
;***************************************
; Address for routines available in the BIOS

PUTC:           .EQU $0070 ; Write Character from A to standard output
PUTS:           .EQU $0073 ; Write ASCIIZ String pointed to by HL to standard output
GETC:           .EQU $0076 ; Read Character from standard input into A
TO_UPPER:       .EQU $0079 ; Make the lower case character in A upper case
PRINT_NEW_LINE: .EQU $007C ; Send new line characters (CR+LF) to standard output
CHAR_ISHEX:     .EQU $007F ; C Flag is set if the character in A is hex
GET_HEX_NIB:    .EQU $0082 ; Get single hex digit, store in lower nibble of A from standard input
GET_HEX_BYTE    .EQU $0085 ; Get hex byte, stores in A from standard input
GET_HEX_WORD:   .EQU $0088 ; Get hex word, stores in HL from standard input
....

The locations of these routine entries in the jump table can be found from the .lst file that is generated by the assembler.

The information will look like this:

....
0039 0070          ; Standard I/O Routines
0040 0070 C3 A8 01 PUTC:           JP _PUTC           ; Write Character from A to standard output
0041 0073 C3 A5 01 PUTS:           JP _PUTS           ; Write ASCIIZ String pointed to by HL to standard output
0042 0076 C3 6A 01 GETC:           JP _GETC           ; Read Character from standard input into A
0043 0079 C3 E7 01 TO_UPPER:       JP _TO_UPPER       ; Make the lower case character in A upper case
0044 007C C3 AF 01 PRINT_NEW_LINE: JP _PRINT_NEW_LINE ; Send new line characters (CR+LF) to standard output
0045 007F C3 F0 01 CHAR_ISHEX:     JP _CHAR_ISHEX     ; C Flag is set if the character in A is hex
0046 0082 C3 6E 01 GET_HEX_NIB:    JP _GET_HEX_NIB    ; Get single hex digit, store in lower nibble of A from standard input
0047 0085 C3 89 01 GET_HEX_BYTE    JP _GET_HEX_BYTE   ; Get hex byte, stores in A from standard input
0048 0088 C3 9A 01 GET_HEX_WORD:   JP _GET_HEX_WORD   ; Get hex word, stores in HL from standard input
....

The values in the 2nd column show the address where that jump resides, this is what is used to create the file. (I am working on generating a Java program to do this automatically)

You can see the the jumps are basically just calling a routine of the same name that has been prefixed with an underscore (_), this is to keep it all easier to read when developing.

 

Applications

Application code for the M62 system has to be assembled with the routine_entry.asm file included in order to have access to the common routines. Other than that, you need to make sure the application code is assembled using the the .org directive setting the intended starting address the application is intended to be loaded into.

Once the application is assembled, the binary receive command in the BIOS menu (X) is used to load the binary into the address it needs to go to.

My system has it’s RAM starting at $4000, so I load my test applications there, but it is dependent of your hardware configuration. I could always load it into bank $8000 on my system which is my NVRAM, and then next time I want to use the code I can use the go command in the BIOS (G) to jump to $8000.

More to come soon…