|
|
Power 6/32 Unix version 1.2b
Directory : /va/accts/integ/code/macro/io/Lib
This is a stand alone library contains I/O routines to CPU2 console.
The following routines are available :
readc(), reads(s), writec(c), writes(s), writeh(hex), writed(dec)
(1)** Usage from C program :
#include "/va/accts/integ/code/macro/io/Lib/bio.c
#include "/va/accts/integ/code/macro/io/Lib/cp.c
dummy()
{ char c, s[200];
long hex, dec;
c = readc(); /* Read 1 char from console */
reads(s); /* Read a string, terminated by '\0' */
/* or '\n' from console */
writec(c); /* Write a char to console */
writes(s); /* Write a string to console */
writeh(hex); /* Write a number in HEX to console */
writed(dec); /* Write a number in DEC to console */
}
(2)** Usage from assembly program :
pushb c
callf $8,_writec /* Write char c to console */
pushab s
callf $8,_writes /* Write string s to console */
pushl hex
callf $8,_writeh /* Write a hex number to console */
pushl dec
callf $8,_writed /* Write a decimal number to console */
callf $4,_readc /* Read a char from console */
movb r0,c
pushab str
callf $8,_reads /* Read a string from console */
.data
c: .byte 'a'
str: .space 200
s: .ascii "abcdefghi......w\0"
.align 2
hex: .long 0
dec: .long 0
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.