Serial Devices

Tuesday, 17 February 2009 08:41 administrator
Print

The BIOS serial device functions provide support for the four logical serial device under CPM2.2 (CON, LST, RDR, PUN). Each of the four logical serial devices can be mapped to one of four hardware devices.  The logical devices can be mapped as follows;

The BIOS is responsible for using the correct physical device when a function is called against a logical device. The memory address three contains the logical serial device mappings this memory location is referred to as the IOBYTE. The IOBYTE uses two bits per logical device to select one of a possible four hardware devices. Under CPM2.2 a program should use the BDOS service functions seven and eight to read and write the IOBYTE. If the IOBYTE memory location is changed directly by a program the BDOS current device mappings could become out of sync with the IOBYTE.

More information is available on the BIOS on the CPM BIOS page.

BIOS 00 WBOOT

The WBOOT function is used to terminate the calling program and reload the CPP and BDOS portions of CPM2.2 into memory. Next the memory from address 0 to 0100 hex is initialized by CPM. The CPP is then started and disk "A" is selected. If disk "A" user area 0 contains a file named "$$$.SUB" the next sumbit command is removed from the file and executed. If the $$$.SUB file is not found the user is prompted for a command on the logical console (CON) serial device.

Most CPM programs use a jump to memory address 0 to request a warm boot. Memory address 0 contains a jump instruction to the jump instruction in the BIOS entry table for the warm boot function. The BDOS service function 0 can also be used by a program to request a warm boot.

Not all CPM programs are required to end by calling the BIOS WBOOT or BDOS service function 0. If a program is small enough to not overwrite the CPP portion of the CPM operating system the program can simply return control to the CPP once its work is completed. When a program is loaded by the CPP the program is placed at memory address 0100 hex. The CPP then uses an 8080 cpu CALL instruction to memory address 0100 hex to start the program. If the program restores the CPU stack pointer to the state when the program started and uses an 8080 RET instruction control will return to the CPP. By skipping the reloading of the BDOS and CPP control is returned to the CPP faster.

BIOS 01 CONST

The CONST function is used to determine if a character is waiting to be read by the BIOS CONIN function. On return if the 8080 register "A" contains 0 no character is waiting to be read, if a non zero value is returned in register "A" a character is ready for input. Normally the non zero value in register "A" will be FF hex, but not all BIOS implementations follow this. The BDOS service function 11duplicates this BIOS function.

BIOS 02 CONIN

The CONIN function is used to read the next character from the logical console device. In most early CPM system this BIOS function would set the character's high bit to 0 assuming that it represents a parity bit. In later CPM system BIOSs all eight bits are returned. If no character is ready to be read the calling program is suspended until a character is ready to be read on the current console. When the CONIN function returns control to the calling program the 8080 CPU "A" register will contain the value of the character read. The BDOS service function 6 input duplicates this BIOS function.

BIOS 03 CONOUT

The CONOUT function is used to write a character to the logical console device. The character to be written is placed in the 8080 CPU "C" register. In most early CPM systems this BIOS function would expect the character's high bit to be set to 0. If the output device attached to the console is not ready to write a character the calling program is suspended until the device is ready to be accept the next character. The BDOS service function 6 output duplicates this BIOS function.

BIOS 04 LIST

The LIST function is used to write a character to the logical list device. The character to be written is placed in the 8080 CPU "C" register.  In most early CPM systems this BIOS function would expect the character's high bit to be set to 0. If the output device attached to the logical list (LST) is not ready to write a character the calling program is suspended until the device is ready to be accept the next character. The BDOS service function 5 duplicates this BIOS function.

BIOS 05 PUNCH

The PUNCH function is used to write a character to the logical PUNCH device. The character to be written is placed in the 8080 CPU "C" register.  In most early CPM systems this BIOS function would expect the character's high bit to be set to 0. If the output device attached to the logical punch (PUN) is not ready to write a character the calling program is suspended until the device is ready to be accept the next character. The BDOS service function 4 duplicates this BIOS function.

BIOS 06 READER

The READER function is used to read the next character from the logical reader device. If no character is ready to be read the calling program is suspended until a character is ready to be read on the current reader. When the READER function returns control to the calling program the 8080 CPU "A" register will contain the value of the character read. The BDOS service function 3 duplicates this BIOS function.

BIOS 14 LISTST

The LISTST function is used to determine if a character can be written by the BIOS LIST function. On return from a call to this function the 8080 register "A" contains a 0 to indicate that no character can be written to the list device. If a non zero value is returned in register "A" the list device is ready to output a character. Normally the non zero value in register "A" will be FF hex, but not all BIOS implementations follow this. The BDOS does not duplicate this BIOS function.