about summary refs log tree commit diff stats
path: root/subx/examples
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-02-18 21:48:19 -0800
committerKartik Agaram <vc@akkartik.com>2019-02-18 21:48:19 -0800
commit8188bbbc9408322c18cdc2d1049126900abf793c (patch)
tree2141b32bc1b7df6106980e12f0edbacc7dcfd329 /subx/examples
parent6607a30415e2bede27c43b57ce3c5cbc42278fa9 (diff)
downloadmu-8188bbbc9408322c18cdc2d1049126900abf793c.tar.gz
4981 - no, go back to 3 phases
Considering how much trouble a merge phase would be (commit 4978), it seems
simpler to just add the extra syntax for controlling the entry point of
the generated ELF binary.

But I wouldn't have noticed this if I hadn't taken the time to write out
the commit messages of 4976 and 4978.

Even if we happened to already have linked list primitives built, this
may still be a good idea considering that I'm saving quite a lot of code
in duplicated entrypoints.
Diffstat (limited to 'subx/examples')
-rw-r--r--subx/examples/ex10.subx2
-rw-r--r--subx/examples/ex11.subx2
-rw-r--r--subx/examples/ex5.subx3
3 files changed, 4 insertions, 3 deletions
diff --git a/subx/examples/ex10.subx b/subx/examples/ex10.subx
index 7e37a54b..7b88f582 100644
--- a/subx/examples/ex10.subx
+++ b/subx/examples/ex10.subx
@@ -12,7 +12,7 @@
 # . op          subop               mod             rm32          base        index         scale       r32
 # . 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
 
-# main: return argv-equal(argv[1], argv[2])
+Entry:  # return argv-equal(argv[1], argv[2])
 #       At the start of a SubX program:
 #         argc: *ESP
 #         argv[0]: *(ESP+4)
diff --git a/subx/examples/ex11.subx b/subx/examples/ex11.subx
index 071a855b..a40c68d4 100644
--- a/subx/examples/ex11.subx
+++ b/subx/examples/ex11.subx
@@ -19,7 +19,7 @@
 # . op          subop               mod             rm32          base        index         scale       r32
 # . 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
 
-# main:
+Entry:  # run all tests
     e8/call  run-tests/disp32  # 'run-tests' is a function created automatically by SubX. It calls all functions that start with 'test-'.
     # syscall(exit, EAX)
     89/copy                         3/mod/direct    3/rm32/EBX    .           .             .           0/r32/EAX   .               .                 # copy EAX to EBX
diff --git a/subx/examples/ex5.subx b/subx/examples/ex5.subx
index 2e421fdf..f9ad9ea8 100644
--- a/subx/examples/ex5.subx
+++ b/subx/examples/ex5.subx
@@ -9,7 +9,8 @@
 # . op          subop               mod             rm32          base        index         scale       r32
 # . 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
 
-# main:
+Entry:
+
     # allocate x on the stack
     81          5/subop/subtract    3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # subtract from ESP