about summary refs log tree commit diff stats
path: root/subx/ex5.subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-07-28 14:31:58 -0700
committerKartik Agaram <vc@akkartik.com>2018-07-28 14:31:58 -0700
commit5cea4ef897c0aac2b35315c4208140e0ed66bd34 (patch)
tree2a2ea5aa3907b99b344006120266730d86c4f0d4 /subx/ex5.subx
parentb3a3d14f98305af875c9363b9e894965cd4b45f7 (diff)
downloadmu-5cea4ef897c0aac2b35315c4208140e0ed66bd34.tar.gz
4449
Diffstat (limited to 'subx/ex5.subx')
-rw-r--r--subx/ex5.subx10
1 files changed, 4 insertions, 6 deletions
diff --git a/subx/ex5.subx b/subx/ex5.subx
index 540d0315..bdbfe6f4 100644
--- a/subx/ex5.subx
+++ b/subx/ex5.subx
@@ -19,25 +19,23 @@
   ## read(stdin, x, 1)
   # fd = 0 (stdin)
   bb/copy                                                                                                                 0/imm32           # copy 0 to EBX
-  # set location to read character to
+  # initialize x (location to write result to)
   89/copy                         3/mod/direct    1/rm32/ECX                                  5/r32/EBP                                     # copy EBP to ECX
   # size = 1 character
   ba/copy                                                                                                                 1/imm32           # copy 1 to EDX
-  # syscall = read
+  # read(fd, x, size)
   b8/copy                                                                                                                 3/imm32           # copy 3 to EAX
-  # call
   cd/syscall                                                                                                              0x80/imm8         # int 80h
 
   ## write(stdout, x, 1)
   # fd = 1 (stdout)
   bb/copy                                                                                                                 1/imm32           # copy 1 to EBX
-  # set location of character to write out
+  # initialize x (location to read from)
   89/copy                         3/mod/direct    1/rm32/ECX                                  5/r32/EBP                                     # copy EBP to ECX
   # size = 1 character
   ba/copy                                                                                                                 1/imm32           # copy 1 to EDX
-  # syscall = write
+  # write(fd, x, size)
   b8/copy                                                                                                                 4/imm32           # copy 4 to EAX
-  # call
   cd/syscall                                                                                                              0x80/imm8         # int 80h
 
   ## exit(EBX)