-
Notifications
You must be signed in to change notification settings - Fork 11
/
io.asm
56 lines (42 loc) · 1.08 KB
/
io.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
.function: yep/2
allocate_registers %6 local
.name: 5 parent
move %parent local %0 parameters
.name: 1 fd_in
.name: 3 stdout
move %fd_in local %1 parameters
integer %stdout local 1
.name: 2 buffer_size
integer %buffer_size local 512
.name: 4 data
io_read %data local %fd_in local %buffer_size local
print %data local
;io_cancel %4 local
io_wait %data local %data local 10s
;print %4 local
io_write %data local %stdout local %data local
;io_wait %data local %data local 1s
send %parent local %data local
return
.end
.import: [[dynamic]] std::posix::io
.signature: std::posix::io::open/1
.function: main/0
allocate_registers %2 local
frame %1
text %1 local "./io.asm"
move %0 arguments %1 local
call %1 local std::posix::io::open/1
frame %2
;integer %1 local 0
move %1 arguments %1 local
self %1 local
move %0 arguments %1 local
process void yep/2
receive %0 local 10s
print %0 local
io_wait %0 local %0 local 1s
print %0 local
izero %0 local
return
.end