Micro Vibe

My Micro Hobby Projects

  • Increase font size
  • Default font size
  • Decrease font size
Home CPM 80 CPM BDOS BDOS Serial Services

BDOS Serial Services

Print

The BDOS Serial Services provide a user program with the ability to access the logical serial devices under CPM. The logical serial devices can also be mapped to the physical hardware serial devices using the set IOBYTE service function. For more information about serial devices see the CPM STAT Utility command and the BIOS Serial Devices articles.

Function 1: Console Input
  RegisterValue
Entry C 01H
Return A ASCII Character

The Console Input function reads the next console character to register A. Graphic characters, along with carriage return, line- feed, and back space (CTRL-H) are echoed to the console. Tab characters, CTRL-I, move the cursor to the next tab stop. A check is made for start/stop scroll, CTRL-S, and start/stop printer echo, CTRL-P. The FDOS does not return to the calling program until a character has been typed, thus suspending execution if a character is not ready.

Function 2: Console Output
  RegisterValue
Entry C 01H
E ASCII Character
Return (none)

The ASCII character from register E is sent to the console device. As in Function 1, tabs are expanded and checks are made for start/stop scroll and printer echo.

Function 3: Reader Input
  RegisterValue
Entry C 03H
Return A ASCII Character

The Reader Input function reads the next character from the logical reader into register A. Control does not return until the character has been read.

Function 4: Punch Output
  RegisterValue
Entry C 04H
E ASCII Character
Return (none)

The Punch Output function sends the character from register E to the logical punch device.

Function 5: List Output
  RegisterValue
Entry C 05H
E ASCII Character
Return (none)

The List Output function sends the ASCII character in register E to the logical listing device.

Function 6: Direct Console I/O
  RegisterValue
Entry C 06H
E 0FFH (input) or
char (output)
Return A char or status

Direct Console I/O is supported under CP/M for those specialized applications where basic console input and output are required. Use of this function should, in general, be avoided since it bypasses all of the CP/M normal control character functions (for example, CTRL-S and CTRL-P). Programs that perform direct I/O through the BIOS under previous releases of CP/M, however, should be changed to use direct I/O under BDOS so that they can be fully supported under future releases of MP/M and CP/M.

Upon entry to Function 6, register E either contains hexadecimal FF, denoting a console input request, or an ASCII character. If the input value is FF, Function 6 returns A = 00 if no character is ready, otherwise A contains the next console input character.

If the input value in E is not FF, Function 6 assumes that E contains a valid ASCII character that is sent to the console.

Function 6 must not be used in conjunction with other console I/O functions.

Function 7: Get I/O Byte
  RegisterValue
Entry C 07H
Return A I/O Byte Value

The Get I/O Byte function returns the current value of IOBYTE in register A.

Function 8: Set I/O Byte
  RegisterValue
Entry C 08H
E I/O Byte Value
Return (none)

The SET I/O Byte function changes the IOBYTE value to that given in register E.

Function 9: Print String
  RegisterValue
Entry C 09H
DE String Address
Return (none)

The Print String function sends the character string stored in memory at the location given by DE to the console device, until a $ is encountered in the string. Tabs are expanded as in Function 2, and checks are made for start/stop scroll and printer echo.

Function 10: Read Console Buffer
  RegisterValue
Entry C 0AH
DE Buffer Address
Return Console Characters in Buffer

The Read Buffer function reads a line of edited console input into a buffer addressed by registers DE. Console input is terminated when either input buffer overflows or a carriage return or line-feed is typed. The Read Buffer takes the form:

DE: +0 +1 +2 +3 +4 +5 +6 +7 +8 ... +n
  mx nc cl c2 c3 c4 c5 c6 c7 ... ??

where mx is the maximum number of characters that the buffer will hold, 1 to 255, and nc is the number of characters read (set by FDOS upon return) followed by the characters read from the console. If nc < mx, then uninitialized positions follow the last character, denoted by ?? in the above figure. A number of control functions, summarized in Table 5-3, are recognized during line editing.

Table 5-3. Edit Control Characters
CharacterEdit Control Function
rub/del removes and echoes the last character
CTRL-C reboots when at the beginning of line
CTRL-E causes physical end of line
CTRL-H backspaces one character position
CTRL-J (line-feed) terminates input line
CTRL-M (return) terminates input line
CTRL-R retypes the current line after new line
CTRL-U removes current line
CTRL-X same as CTRL-U

The user should also note that certain functions that return the carriage to the leftmost position (for example, CTRL-X) do so only to the column position where the prompt ended. In earlier releases, the carriage returned to the extreme left margin. This convention makes operator data input and line correction more legible.

Function 11: Get Console Status
  RegisterValue
Entry C 0BH
Return A Console Status

The Console Status function checks to see if a character has been typed at the console. If a character is ready, the value 0FFH is returned in register A. Otherwise a 00H value is returned.

Last Updated on Thursday, 28 July 2016 05:45