about summary refs log tree commit diff stats
path: root/subx/apps
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-09-22 21:56:00 -0700
committerKartik Agaram <vc@akkartik.com>2018-09-22 22:17:09 -0700
commit2b36eee9b13eb16fb2e4b05d7e26f6d09f431912 (patch)
tree6da2091b71b7ea6928e417699641b70bc65381ee /subx/apps
parent8c580ba1de3a6587c6c8e21387a518c93399e538 (diff)
downloadmu-2b36eee9b13eb16fb2e4b05d7e26f6d09f431912.tar.gz
4502 - support string literals directly in code
Doesn't de-duplicate in the data segment, though. If you use the literal
"foo" a hundred times in your code segment you're gonna spend a hundred
times the space you need to.

We can now simplify our test harness a bit in the factorial app, but we
still have to put in commandline args to compare with manually. We only
support length-prefixed strings, not null-terminated ones.
Diffstat (limited to 'subx/apps')
-rw-r--r--subx/apps/factorial.subx16
1 files changed, 2 insertions, 14 deletions
diff --git a/subx/apps/factorial.subx b/subx/apps/factorial.subx
index c8de4790..9aef6634 100644
--- a/subx/apps/factorial.subx
+++ b/subx/apps/factorial.subx
@@ -94,7 +94,7 @@ test_factorial:
   75/jump-if-unequal              .               .             .           .             .           .           $test_factorial:else/disp8
     # print('.')
       # push args
-  68/push  Test_passed/imm32
+  68/push  "."/imm32
       # call
   e8/call  write_stderr/disp32
       # discard arg
@@ -105,7 +105,7 @@ test_factorial:
 $test_factorial:else:
     # print('F')
       # push args
-  68/push  Test_failed/imm32
+  68/push  "F"/imm32
       # call
   e8/call  write_stderr/disp32
       # discard arg
@@ -181,16 +181,4 @@ Test_argv:  # null-terminated
   # data
   74/t 65/e 73/s 74/t 00/null
 
-Test_passed:
-  # size
-  01 00 00 00
-  # data
-  2e/dot
-
-Test_failed:
-  # size
-  01 00 00 00
-  # data
-  46/F
-
 # vim:ft=subx:nowrap:so=0