projects
/
rrq
/
jonasforth.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implement some arithmetic words
[rrq/jonasforth.git]
/
main.asm
diff --git
a/main.asm
b/main.asm
index 67e9a7b6a96a1225d9fc37ca322b3bd6030528b3..d2cd54deb29e91c65f5d366d344aba29911eba39 100644
(file)
--- a/
main.asm
+++ b/
main.asm
@@
-431,6
+431,17
@@
forth_asm MINUS, '-'
push rbx
next
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'
;; Get the location of the STATE variable. It can be set with '!' and read with
;; '@'.
forth STATE, 'STATE'