From 5cea4ef897c0aac2b35315c4208140e0ed66bd34 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sat, 28 Jul 2018 14:31:58 -0700 Subject: 4449 --- subx/ex5.subx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'subx/ex5.subx') 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) -- cgit 1.4.1-2-gfad0