|
|
1.1 root 1:
2: Directory : /va/accts/integ/code/macro/io/Lib
3:
4: This is a stand alone library contains I/O routines to CPU2 console.
5: The following routines are available :
6: readc(), reads(s), writec(c), writes(s), writeh(hex), writed(dec)
7:
8: (1)** Usage from C program :
9:
10: #include "/va/accts/integ/code/macro/io/Lib/bio.c
11: #include "/va/accts/integ/code/macro/io/Lib/cp.c
12: dummy()
13: { char c, s[200];
14: long hex, dec;
15:
16: c = readc(); /* Read 1 char from console */
17: reads(s); /* Read a string, terminated by '\0' */
18: /* or '\n' from console */
19: writec(c); /* Write a char to console */
20: writes(s); /* Write a string to console */
21: writeh(hex); /* Write a number in HEX to console */
22: writed(dec); /* Write a number in DEC to console */
23: }
24:
25: (2)** Usage from assembly program :
26:
27: pushb c
28: callf $8,_writec /* Write char c to console */
29: pushab s
30: callf $8,_writes /* Write string s to console */
31: pushl hex
32: callf $8,_writeh /* Write a hex number to console */
33: pushl dec
34: callf $8,_writed /* Write a decimal number to console */
35:
36: callf $4,_readc /* Read a char from console */
37: movb r0,c
38:
39: pushab str
40: callf $8,_reads /* Read a string from console */
41:
42: .data
43:
44: c: .byte 'a'
45: str: .space 200
46: s: .ascii "abcdefghi......w\0"
47:
48: .align 2
49: hex: .long 0
50: dec: .long 0
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.