X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;ds=sidebyside;f=main.asm;h=e6b0ac280cfc359bbad93881900df086e3e0379e;hb=4d233157714c21c1c15e7b271460a1692da55f52;hp=67e9a7b6a96a1225d9fc37ca322b3bd6030528b3;hpb=c4dd16293a71e782e36f795d302bf944056ffd4c;p=rrq%2Fjonasforth.git diff --git a/main.asm b/main.asm index 67e9a7b..e6b0ac2 100644 --- a/main.asm +++ b/main.asm @@ -198,8 +198,8 @@ forth_asm READ_WORD, 'READ-WORD' ;; 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 @@ -431,6 +431,17 @@ forth_asm MINUS, '-' push rbx next +;; Given two integers a and b on the stack, pushes the quotient and remainder of +;; division of a by b. +forth_asm TIMESMOD, '/MOD' + pop rbx ; b + pop rax ; a + mov rdx, 0 + div rbx + push rax ; a / b + push rdx ; a % b + next + ;; Get the location of the STATE variable. It can be set with '!' and read with ;; '@'. forth STATE, 'STATE'