From b83654d51fc80c0a991237dba6389e684be24b41 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Thu, 20 Sep 2018 16:30:40 -0700 Subject: 4559 --- subx/apps/crenshaw2-1 | Bin 304 -> 333 bytes subx/apps/crenshaw2-1.subx | 16 ++++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/subx/apps/crenshaw2-1 b/subx/apps/crenshaw2-1 index 826d5776..d85b2556 100755 Binary files a/subx/apps/crenshaw2-1 and b/subx/apps/crenshaw2-1 differ diff --git a/subx/apps/crenshaw2-1.subx b/subx/apps/crenshaw2-1.subx index 2b46f07f..32436bad 100644 --- a/subx/apps/crenshaw2-1.subx +++ b/subx/apps/crenshaw2-1.subx @@ -92,6 +92,22 @@ write_stderr: # s : (address array byte) -> # end c3/return +write_stdout: # s : (address array byte) -> + # write(1/stdout, (data) s+4, (size) *s) + # fd = 1 (stdout) + bb/copy . . . . . . . 1/imm32 # copy 1 to EBX + # x = s+4 + 8b/copy 1/mod/*+disp8 4/rm32/SIB 4/base/ESP 4/index/none . 1/r32/ECX 4/disp8 . # copy *(ESP+4) to ECX + 81 0/subop/add 3/mod/direct 1/rm32/ECX . . . . . 4/imm32 # add 4 to ECX + # size = *s + 8b/copy 1/mod/*+disp8 4/rm32/SIB 4/base/ESP 4/index/none . 2/r32/EDX 4/disp8 . # copy *(ESP+4) to EDX + 8b/copy 0/mod/indirect 2/rm32/EDX . . . 2/r32/EDX . . # copy *EDX to EDX + # call write() + b8/copy . . . . . . . 4/imm32/write # copy 1 to EAX + cd/syscall . . . . . . . 0x80/imm8 # int 80h + # end + c3/return + == data Newline: # size -- cgit 1.4.1-2-gfad0