Skip to content

Commit 46db962

Browse files
authored
chapter 13, problem 3
1 parent b96effe commit 46db962

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

fileWrite.asm

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ LF equ 10 ; line feed
66
NULL equ 0 ; end of string
77
TRUE equ 1
88
FALSE equ 0
9+
SUCCESS equ 1
10+
NOSUCCESS equ 0
911
EXIT_SUCCESS equ 0 ; success code
1012
STDIN equ 0 ; standard input
1113
STDOUT equ 1 ; standard output
@@ -112,21 +114,25 @@ openInputFile:
112114
mov rdi, qword[fileDesc]
113115
syscall
114116

117+
mov rax, SUCCESS
115118
jmp exampleDone
116119

117120
; Error on open
118121
errorOnOpen:
119122
mov rdi, errMsgOpen
120123
call printString
124+
mov rax, NOSUCCESS
121125
jmp exampleDone
122126

123127
; Error on write
124128
errorOnWrite:
125129
mov rdi, errMsgWrite
126130
call printString
131+
mov rax, NOSUCCESS
127132
jmp exampleDone
128133

129134
exampleDone:
135+
130136
ret
131137

132138

0 commit comments

Comments
 (0)