This procedure did not actually do what it claimed to be doing. It just happened
to work with the way it was called.
;; Parses a string.
;;
;; Parameters:
-;; * [.length] = Length of string
-;; * [.buffer] = Pointer to string buffer
+;; * rcx = Length of string
+;; * rdi = Pointer to string buffer
;;
;; Results:
;; * rax = Value
;; Add (10^(rcx-1) * parse_char(rdi[length - rcx])) to the accumulated value
;; for each rcx.
- mov rcx, [.length]
+ mov [.length], rcx
.loop:
;; First, calcuate 10^(rcx - 1)
mov rax, 1
read_word.length db ?
read_word.char_buffer db ?
-parse_number.buffer dq ?
parse_number.length dq ?
;; Takes a string on the stack and replaces it with the decimal number that the
;; string represents.
forth_asm PARSE_NUMBER, 'PARSE-NUMBER'
- pop [parse_number.length] ; Length
- pop [parse_number.buffer] ; String pointer
+ pop rcx ; Length
+ pop rdi ; String pointer
push rsi
call parse_number