diff options
Diffstat (limited to 'putstr.lang')
-rw-r--r-- | putstr.lang | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/putstr.lang b/putstr.lang index b13e2c5..7485d8f 100644 --- a/putstr.lang +++ b/putstr.lang @@ -6,7 +6,17 @@ func putstr(char[] str) { } } -func int main() {return 0;} +func int main() { + char[] str := new char[100]; + str[0] = 'k'; + str[1] = 'a'; + str[2] = str[1]; + str[3] = 's'; + str[4] = '\n'; + str[5] = '\0'; + putstr(str); + return 0; +} @@ -17,24 +27,19 @@ irfunc putstr(char[] str) jmp 7 }}} {{{(7) - mov t15Q <- t5Q - add t15Q, 8Q - mov t13Q <- astrQ - add t13Q, t15Q - load t16B <- *t13Q - neq t16B, 0B - jne t16B, 0Q -> 9 | 6 + add t17Q <- t5Q, 8Q + add t18Q <- astrQ, t17Q + load t19B <- *t18Q + neq t22Q <- t19B, 0B + jne t22Q, 0Q -> 9 | 6 }}} {{{(9) - mov t25Q <- t5Q - add t25Q, 8Q - mov t23Q <- astrQ - add t23Q, t25Q - load t26B <- *t23Q - call putc (t26B) - mov t30Q <- t5Q - add t30Q, 1Q - mov t5Q <- t30Q + add t30Q <- t5Q, 8Q + add t31Q <- astrQ, t30Q + load t32B <- *t31Q + call putc (t32B) + add t39Q <- t5Q, 1Q + mov t5Q <- t39Q jmp 7 }}} {{{(6) |