X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=main.asm;h=d2cd54deb29e91c65f5d366d344aba29911eba39;hb=02f53b20b4f7244a84a442bbae10eb8401abcfc5;hp=2e880d9b36871b250057378f14c6b62b1c6c7d87;hpb=423e2197f05d6af11aa75a7a15aa3f8e3be78cbf;p=rrq%2Fjonasforth.git diff --git a/main.asm b/main.asm index 2e880d9..d2cd54d 100644 --- a/main.asm +++ b/main.asm @@ -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' @@ -527,7 +538,7 @@ forth IMMEDIATE, 'IMMEDIATE', 1 dq LIT, 1 dq LATEST, GET dq LIT, 8, PLUS - dq PUT + dq PUT_BYTE dq EXIT ;; Given the address of a word, return 0 if the given word is not immediate.