about summary refs log tree commit diff stats
path: root/rpn.mu
diff options
context:
space:
mode:
Diffstat (limited to 'rpn.mu')
-rw-r--r--rpn.mu16
1 files changed, 8 insertions, 8 deletions
diff --git a/rpn.mu b/rpn.mu
index f7a56bd1..719fd03d 100644
--- a/rpn.mu
+++ b/rpn.mu
@@ -15,7 +15,7 @@
 #
 # Error handling is non-existent. This is just a prototype.
 
-fn main {
+fn main screen: (addr screen), keyboard: (addr keyboard) {
   var in-storage: (stream byte 0x80)
   var in/esi: (addr stream byte) <- address in-storage
   var y/ecx: int <- copy 0
@@ -23,13 +23,13 @@ fn main {
   # read-eval-print loop
   {
     # print prompt
-    var x/eax: int <- draw-text-rightward 0/screen, "> ", 0/x, 0x80/xmax, y, 3/fg/cyan, 0/bg
-    set-cursor-position 0/screen, x, y
+    var x/eax: int <- draw-text-rightward screen, "> ", 0/x, 0x80/xmax, y, 3/fg/cyan, 0/bg
+    set-cursor-position screen, x, y
     # read line from keyboard
     clear-stream in
     {
-      draw-cursor 0/screen, space
-      var key/eax: byte <- read-key 0/keyboard
+      draw-cursor screen, space
+      var key/eax: byte <- read-key keyboard
       compare key, 0xa/newline
       break-if-=
       compare key, 0
@@ -37,17 +37,17 @@ fn main {
       var key2/eax: int <- copy key
       append-byte in, key2
       var g/eax: grapheme <- copy key2
-      draw-grapheme-at-cursor 0/screen, g, 0xf/fg, 0/bg
+      draw-grapheme-at-cursor screen, g, 0xf/fg, 0/bg
       move-cursor-right 0
       loop
     }
     # clear cursor
-    draw-grapheme-at-cursor 0/screen, space, 3/fg/never-used, 0/bg
+    draw-grapheme-at-cursor screen, space, 3/fg/never-used, 0/bg
     # parse and eval
     var out/eax: int <- simplify in
     # print
     y <- increment
-    out, y <- draw-int32-decimal-wrapping-right-then-down 0/screen, out, 0/xmin, y, 0x80/xmax, 0x30/ymax, 0/x, y, 7/fg, 0/bg
+    out, y <- draw-int32-decimal-wrapping-right-then-down screen, out, 0/xmin, y, 0x80/xmax, 0x30/ymax, 0/x, y, 7/fg, 0/bg
     # newline
     y <- increment
     #
/pre>
1ead3562 ^
d5f89e0f ^

acc4792d ^
d5f89e0f ^


1ead3562 ^
d5f89e0f ^



a796831f ^

8619c618 ^
d18d1d3d ^




a796831f ^



a796831f ^

b24eb476 ^
a796831f ^
1f7e3c05 ^
79eef536 ^
21c27706 ^
79eef536 ^
a796831f ^



780b2ce1 ^
a796831f ^




a796831f ^

2d713167 ^



a796831f ^




2d713167 ^



a796831f ^



2d713167 ^



a796831f ^




d5f89e0f ^
a796831f ^



555d95c1 ^
4ad0f652 ^
a796831f ^


c4e143d6 ^

9dcbec39 ^
c4e143d6 ^


9dcbec39 ^
c4e143d6 ^


66abe7c1 ^






ce2e604e ^


c4e143d6 ^
08cf048f ^
79eef536 ^
b74443e5 ^
eb4eecea ^
66abe7c1 ^






ce2e604e ^
a17f9186 ^
a796831f ^
a796831f ^



79eef536 ^
a796831f ^
66abe7c1 ^




a072f674 ^
eb4eecea ^
a072f674 ^

a796831f ^

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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151