Section: Interp SDK (3)
ilowlevelio - encapsulates all target-specific I/O used by interp
int get_eof( void );
iword map_memory( iword hardware_address, iword length );
int poll_input( void );
void start_time( iword * scratch1, iword * scratch2 );
iword calc_time( iword * scratch1, iword * scratch2 );
void wait_msec( iword wait_time );
ibyte get_char( void );
ibyte *get_input( ibyte * buf, iword max_index );
void put_string( ibyte * buf );
void put_char( ibyte ch );
void put_line( ibyte * buf );
These functions are the I/O portability layer between interp and the hardware,
or host operating system (if there is one.)
Interp does not directly call any c library functions that read or write
from or to a hardware interface (STDOUT, STDIN, UART, et. al.)
LIST OF FUNCTIONS
Returns non-zero if end-of-file (EOF) has been read from the host operating
system standard input (stdin.) For stand-alone (no OS) applications, or
for use with an operating system that does not support input redirection,
this function always returns zero.
Returns an address (>0) if the region of count bytes, beginning at
hardware_address can be mapped into system memory. The returned address is
the proxy address for the mapped hardware. A return value of -1 indicates
that the open of the memory driver (/dev/mem) failed. A return value of -2
indicates that the region failed to map. For stand-alone (no OS) applications,
or for use with a non-posix operating system, this function returns zero.
Returns true (-1) if input is waiting, or false (0) if not. For use with an
operating system that does not support input polling, this function
always returns zero.
Initiates measurement of elapsed time. Pointers for two words of static storage
are passed for whatever use the implementation requires. The first argument
should be a pointer to system constant 26, the second to system constant 27.
Stop measuring elapsed time and return the elapsed time in microseconds.
The two arguments passed in are the same ones passed to start_time().
Will wait at least
milliseconds before returning.
Returns the next character (byte) available from the input hardware.
If necessary, it waits for data to become available.
Returns the next line of input (terminated by either a newline or carriage
return) as a zero-terminated string (without the carriage control characters)
in the buffer provided. It will not transfer more than
characters into the buffer. After which it will append the zero byte
to terminate the string. If necessary, it waits for data to become available.
It returns a pointer to the zero at the end of the string. This facilitates
multiple calls, overwriting the string terminator with the next string.
Outputs a zero-terminated string of literal characters from the buffer
provided to the output hardware. Processing of escape character sequences is
not supported by this function. If carriage control, numeric string literals,
et. al. are needed please refer to the c library's
family of functions. This function does not return until output is finished.
Outputs one byte to the output hardware. This function does not return until
output is finished.
Output a string of literal characters from the buffer provided.
Carriage control (newline) is automatically appended to the string.
This function is well suited to output of literal message strings that must
have a carriage return at their end. It does not return until output is