22
CHAPTER 3 Overview of the Standard I/O Library
3.2 Incorporating the Standard I/O Driver
When using the standard I/O library, you must develop your own code (I/O driver) for
the target system. The driver inputs and outputs individual characters using the actual
hardware.
■ Incorporating the standard I/O driver
Follow the specifications listed below when creating an I/O driver.
❍ Input driver interface
❍ Output driver interface
Programs in the standard I/O library do not issue system calls for exclusive control or
waiting on events. If required, issue system calls from the program that calls the function
or from the I/O driver.
Item Description
Input None
Output
AL: Input character code
In case of an error, return EOF (-1).
Registration method
Store the entry address of the input driver (24-bit
address) in the four bytes commencing from
label “_stdin”.
Register saving
Save all except the AL and AH registers and T,
N, Z, V, and C.
Item Description
Input @sp+4 (2 bytes) Output character code
Output
AL: Output character code
In case of an error, return EOF (-1).
Registration method
Store the entry address of the output driver (24-
bit address) in the four bytes commencing from
label "_stdout".
Register saving
Save all except the AL and AH registers and T,
N, Z, V, and C.