diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-07-05 12:21:30 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-07-05 12:21:30 -0700 |
commit | badff12385ff30abc4edc19c3b34265d63e3c0f1 (patch) | |
tree | d5f55637805b6a7c2614b179ed0a3f2eb985fae6 | |
parent | c09c91e185aad8e01b570c2569e13c1e429d2f99 (diff) | |
download | mu-badff12385ff30abc4edc19c3b34265d63e3c0f1.tar.gz |
6613 - first word of vocabulary implemented in Mu
-rw-r--r-- | 401sleep.mu | 21 | ||||
-rw-r--r-- | prototypes/tile/1.mu | 22 | ||||
-rw-r--r-- | prototypes/tile/2.mu | 22 |
3 files changed, 21 insertions, 44 deletions
diff --git a/401sleep.mu b/401sleep.mu new file mode 100644 index 00000000..79ad6bd5 --- /dev/null +++ b/401sleep.mu @@ -0,0 +1,21 @@ +type timespec { + tv_sec: int + tv_nsec: int +} + +# prototype wrapper around syscall_nanosleep +# nsecs must be less than 999999999 or 0x3b9ac9ff nanoseconds +fn sleep secs: int, nsecs: int { + var t: timespec + # initialize t + var tmp/eax: (addr int) <- get t, tv_sec + var tmp2/ecx: int <- copy secs + copy-to *tmp, tmp2 + tmp <- get t, tv_nsec + tmp2 <- copy nsecs + copy-to *tmp, tmp2 + # perform the syscall + var t-addr/ebx: (addr timespec) <- address t + var rem-addr/ecx: (addr timespec) <- copy 0 + syscall_nanosleep +} diff --git a/prototypes/tile/1.mu b/prototypes/tile/1.mu index f0f42709..42c1f08b 100644 --- a/prototypes/tile/1.mu +++ b/prototypes/tile/1.mu @@ -45,25 +45,3 @@ fn animate row: int { loop } } - -type timespec { - tv_sec: int - tv_nsec: int -} - -# prototype wrapper around syscall_nanosleep -# nsecs must be less than 999999999 or 0x3b9ac9ff nanoseconds -fn sleep secs: int, nsecs: int { - var t: timespec - # initialize t - var tmp/eax: (addr int) <- get t, tv_sec - var tmp2/ecx: int <- copy secs - copy-to *tmp, tmp2 - tmp <- get t, tv_nsec - tmp2 <- copy nsecs - copy-to *tmp, tmp2 - # perform the syscall - var t-addr/ebx: (addr timespec) <- address t - var rem-addr/ecx: (addr timespec) <- copy 0 - syscall_nanosleep -} diff --git a/prototypes/tile/2.mu b/prototypes/tile/2.mu index 078cac17..53cc3af1 100644 --- a/prototypes/tile/2.mu +++ b/prototypes/tile/2.mu @@ -75,25 +75,3 @@ $render:render-loop: { loop } } - -type timespec { - tv_sec: int - tv_nsec: int -} - -# prototype wrapper around syscall_nanosleep -# nsecs must be less than 999999999 or 0x3b9ac9ff nanoseconds -fn sleep secs: int, nsecs: int { - var t: timespec - # initialize t - var tmp/eax: (addr int) <- get t, tv_sec - var tmp2/ecx: int <- copy secs - copy-to *tmp, tmp2 - tmp <- get t, tv_nsec - tmp2 <- copy nsecs - copy-to *tmp, tmp2 - # perform the syscall - var t-addr/ebx: (addr timespec) <- address t - var rem-addr/ecx: (addr timespec) <- copy 0 - syscall_nanosleep -} |