diff options
author | Kartik Agaram <vc@akkartik.com> | 2021-01-22 23:29:04 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2021-01-22 23:29:04 -0800 |
commit | 0f73127ef1eba0a8ea814c26115523da3590ffe2 (patch) | |
tree | f2480aea129e680e5fc995e730e2083074c44b32 /baremetal/400.mu | |
parent | a451b2e14f06c19eaf98f32dcc2b45e2940a570b (diff) | |
download | mu-0f73127ef1eba0a8ea814c26115523da3590ffe2.tar.gz |
7547 - baremetal: rpn calculator
Still in progress. Known bugs: * Cursor management is broken. Every line currently seems to leave behind a shadow cursor. * No shift-key support yet, which means no addition or multiplication. (This app doesn't have division yet.)
Diffstat (limited to 'baremetal/400.mu')
-rw-r--r-- | baremetal/400.mu | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/baremetal/400.mu b/baremetal/400.mu index 7ebd90ae..5035042e 100644 --- a/baremetal/400.mu +++ b/baremetal/400.mu @@ -26,6 +26,12 @@ sig parse-hex-int in: (addr array byte) -> _/eax: int sig parse-hex-int-from-slice in: (addr slice) -> _/eax: int #sig parse-hex-int-helper start: (addr byte), end: (addr byte) -> _/eax: int sig is-hex-digit? c: byte -> _/eax: boolean +#sig from-hex-char in/eax: byte -> out/eax: nibble +sig parse-decimal-int in: (addr array byte) -> _/eax: int +sig parse-decimal-int-from-slice in: (addr slice) -> _/eax: int +sig parse-decimal-int-from-stream in: (addr stream byte) -> _/eax: int +#sig parse-decimal-int-helper start: (addr byte), end: (addr byte) -> _/eax: int +sig decimal-size n: int -> _/eax: int #sig allocate ad: (addr allocation-descriptor), n: int, out: (addr handle _) #sig allocate-raw ad: (addr allocation-descriptor), n: int, out: (addr handle _) sig lookup h: (handle _T) -> _/eax: (addr _T) @@ -35,7 +41,18 @@ sig copy-handle src: (handle _T), dest: (addr handle _T) #sig allocate-array ad: (addr allocation-descriptor), n: int, out: (addr handle _) sig copy-array ad: (addr allocation-descriptor), src: (addr array _T), out: (addr handle array _T) #sig zero-out start: (addr byte), size: int +sig slice-empty? s: (addr slice) -> _/eax: boolean +sig slice-equal? s: (addr slice), p: (addr array byte) -> _/eax: boolean +sig slice-starts-with? s: (addr slice), head: (addr array byte) -> _/eax: boolean +sig write-slice out: (addr stream byte), s: (addr slice) +# bad name alert +sig slice-to-string ad: (addr allocation-descriptor), in: (addr slice), out: (addr handle array byte) sig write-int32-decimal out: (addr stream byte), n: int sig is-decimal-digit? c: grapheme -> _/eax: boolean sig to-decimal-digit in: grapheme -> _/eax: int +# bad name alert +# next-word really tokenizes +# next-raw-word really reads whitespace-separated words +sig next-word line: (addr stream byte), out: (addr slice) # skips '#' comments +sig next-raw-word line: (addr stream byte), out: (addr slice) # does not skip '#' comments sig stream-empty? s: (addr stream _) -> _/eax: boolean |