1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
var stream : int = 0
var a : char = 97
var b : char = 0
var filename : (array char) = ".foo"
fn main [
call create, filename
*stream <- call open, filename, 1/wronly
call write, *stream, a, 1
call close, *stream
stream <- call open, filename, 0/rdonly
call read, *stream, b, 1
call close, *stream
call unlink, filename
var result/EBX : char
result/EBX <- copy b # TODO: copy char to int?
call exit-EBX
]
# like exit, but assumes the code is already in EBX
fn exit-EBX [
code/EAX <- copy 1/exit
syscall
]
|