pinosaur
/
sped.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
starting on repl
[sped.git]
/
fileutils.asm
diff --git
a/fileutils.asm
b/fileutils.asm
index
1d96aa0
..
0f829f5
100644
(file)
--- a/
fileutils.asm
+++ b/
fileutils.asm
@@
-6,6
+6,7
@@
extern free
extern memset
global readFile
extern memset
global readFile
+global readLine
section .data
wrongfile_str db `unable to open file, error code: %i\n`, 0x00
section .data
wrongfile_str db `unable to open file, error code: %i\n`, 0x00
@@
-65,8
+66,8
@@
readFile:
mov esi, eax
mov [ebp-IS_EOF], ebx
mov esi, eax
mov [ebp-IS_EOF], ebx
- push esi
- call printf
+
;
push esi
+
;
call printf
; make string buffer bigger
mov eax, DWORD [ebp-LINES_READ]
; make string buffer bigger
mov eax, DWORD [ebp-LINES_READ]
@@
-113,6
+114,7
@@
readFile:
; return:
; eax: location to buffer
; ebx: contains eof
; return:
; eax: location to buffer
; ebx: contains eof
+; ecx: number of chars read
readLine:
%define _FILE_HANDLE 8
%define CHAR_COUNT 4 ; count number of characters read
readLine:
%define _FILE_HANDLE 8
%define CHAR_COUNT 4 ; count number of characters read
@@
-178,6
+180,12
@@
readLine:
_readLine_exit:
_readLine_exit:
+ mov eax, [ebp-BLOCK_COUNT]
+ mov ecx, 63
+ mul ecx
+ add eax, [ebp-CHAR_COUNT]
+ mov ecx,eax
+
mov eax, DWORD [ebp-STR_PTR]
%undef _FILE_HANDLE
mov eax, DWORD [ebp-STR_PTR]
%undef _FILE_HANDLE