From 5e9b9783ded719eed6d604e3f16136d05f9ea162 Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Sun, 2 Jan 2022 16:48:33 +0100 Subject: [PATCH] cat works --- src/cat.asm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cat.asm b/src/cat.asm index 77cc96d..59905bc 100644 --- a/src/cat.asm +++ b/src/cat.asm @@ -1,4 +1,5 @@ extern open_file_arg + extern println_num global _start @@ -29,23 +30,22 @@ _start: cmp rax, 0 jl file_not_found - mov rdi, rax + mov r12, rax jmp init stdin_init: - mov rdi, STDIN_FD + mov r12, STDIN_FD init: - ; the input fd is in rdi at this point - xor r13, r13 + ; the input fd is in r12 at this point process: ; read in from the file + mov rdi, r12 mov rax, 0 mov rsi, io_buf mov rdx, IO_BUF_SIZE syscall - ; test whether it is finished cmp rax, 0 jz finish