
Hitachi Embedded Workshop User Manual
258
4.22.2
I/O Functions
Table 4.1 lists the supported I/O functions.
Table 4.1
I/O Functions
No.
Function Code
Function Name
Description
1
H’01 (16-bit address)
H’11 (24-bit address)
H'21 (32-bit address)
GETC
Inputs one byte from the standard input
device
2
H’02 (16-bit address)
H’12 (24-bit address)
H'22 (32-bit address)
PUTC
Outputs one byte to the standard output
device
3
H’03 (16-bit address)
H’13 (24-bit address)
H'23 (32-bit address)
GETS
Inputs one line from the standard input device
4
H’04 (16-bit address)
H’14 (24-bit address)
H'24 (32-bit address)
PUTS
Outputs one line to the standard output device
5
H’05 (16-bit address)
H’15 (24-bit address)
H'25 (32-bit address)
FOPEN
Opens a file
6
H'06
FCLOSE
Closes a file
7
H’07(16-bit address)
H’17 (24-bit address)
H'27 (32-bit address)
FGETC
Inputs one byte from a file
8
H’08 (16-bit address)
H’18 (24-bit address)
H'28 (32-bit address)
FPUTC
Outputs one byte to a file
9
H’09 (16-bit address)
H’19 (24-bit address)
H'29 (32-bit address)
FGETS
Inputs one line from a file
10
H’0A (16-bit address)
H’1A (24-bit address)
H'2A (32-bit address)
FPUTS
Outputs one line to a file
11
H'0B
FEOF
Checks for end of the file
12
H'0C
FSEEK
Moves the file pointer
13
H'0D
FTELL
Returns the current position of the file pointer
To perform I/O processing, use the [System Call Address] in the [Simulator System] dialog box (section 4.21.1)
in the following procedure.
1. Set the address specialized for I/O processing in the [System Call Address], select [Enable] and execute the
program.
2. When detecting a subroutine call instruction (BSR, JSR, or BSRF), that is, a system call to the specialized
address during user program execution, the simulator/debugger performs I/O processing by using the R0 and
R1 values (H8/300, H8/300L series) or the ER1 value (H8/300H, H8S series) as the parameters.
Therefore, before issuing a system call, set as follows in the user program:
Set the function code (table 4.1) to the R0 register