about summary refs log tree commit diff stats
path: root/examples/ex4.subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-09-11 19:04:49 -0700
committerKartik Agaram <vc@akkartik.com>2019-09-11 19:53:23 -0700
commitecfbbfb5b58aaba9f9265cb13b9fb4a914bdcf37 (patch)
tree486cd5f4ee75323b5c733912c7a58501d65b0325 /examples/ex4.subx
parent4d53de8afa0d44e29d3caeb01ccdd02bc2e4cd70 (diff)
downloadmu-ecfbbfb5b58aaba9f9265cb13b9fb4a914bdcf37.tar.gz
5647 - experimental support for swapping OS
Diffstat (limited to 'examples/ex4.subx')
-rw-r--r--examples/ex4.subx19
1 files changed, 8 insertions, 11 deletions
diff --git a/examples/ex4.subx b/examples/ex4.subx
index a8e0efaa..4ef72749 100644
--- a/examples/ex4.subx
+++ b/examples/ex4.subx
@@ -4,16 +4,16 @@
 #   $ ./subx translate examples/ex4.subx -o examples/ex4
 #   $ ./subx run examples/ex4
 
-== data 0x0a000000
+== data
 
 # the global variable we save to
 X:
     0/imm32  # space for read() to write to
 
-== code 0x09000000
+== code
 
 Entry:
-# syscall(read, stdin, X, 1)
+# read(stdin, X, 1)
 # . fd = 0 (stdin)
 bb/copy-to-ebx  0/imm32
 # . data = X (location to write result to)
@@ -21,10 +21,9 @@ b9/copy-to-ecx  X/imm32
 # . size = 1 character
 ba/copy-to-edx  1/imm32
 # . syscall
-b8/copy-to-eax  3/imm32/read
-cd/syscall  0x80/imm8
+e8/call  syscall_read/disp32
 
-# syscall(write, stdout, X, 1)
+# write(stdout, X, 1)
 # . fd = 1 (stdout)
 bb/copy-to-ebx  1/imm32
 # . initialize X (location to read from)
@@ -32,11 +31,9 @@ b9/copy-to-ecx  X/imm32
 # . size = 1 character
 ba/copy-to-edx  1/imm32
 # . syscall
-b8/copy-to-eax  4/imm32/write
-cd/syscall  0x80/imm8
+e8/call  syscall_write/disp32
 
-# syscall(exit, ebx)
-b8/copy-to-eax  1/imm32/exit
-cd/syscall  0x80/imm8
+# exit(ebx)
+e8/call  syscall_exit/disp32
 
 # . . vim:nowrap:textwidth=0