%include "CONSTANTS.h" O_RDONLY equ 0 SYS_OPEN equ 2 SYS_CLOSE equ 3 MAX_WORD_SIZE equ 50 extern GetString extern StringDone section .data FileName: db `ocap.txt`,0 ;FileName: db `afile`,0 fd: dq 0 stringLine: db `"%s"\n`,0; section .bss newWord: resb MAX_WORD_SIZE + 1 section .text global main main: mov rax, SYS_OPEN mov rdi, FileName mov rsi, O_RDONLY syscall mov [fd], rax top: mov rdi, [fd] mov rsi, newWord mov rdx, MAX_WORD_SIZE mov r12, rsp and rsp, -16 call GetString mov rsp, r12 cmp rax, 1 jne done mov rdi, stringLine mov rsi, newWord call CallPrintf jmp top done: mov rax, SYS_CLOSE mov rdi, [fd] syscall jmp Exit