+;; Duplicate a pair of elements.
+forth_asm PAIRDUP, '2DUP'
+ pop rbx
+ pop rax
+ push rax
+ push rbx
+ push rax
+ push rbx
+ next
+
+;; Swap the top two elements on the stack.
+forth_asm SWAP, 'SWAP'
+ pop rax
+ pop rbx
+ push rax
+ push rbx
+ next
+
+;; Remove the top element from the stack.
+forth_asm DROP, 'DROP'
+ add rsp, 8
+ next
+
+forth_asm NOT_, 'NOT'
+ pop rax
+ cmp rax, 0
+ jz .false
+.true:
+ push 0
+ next
+.false:
+ push 1
+ next
+
+;; The INTERPRET word reads and interprets user input. It's behavior depends on
+;; the current STATE. It provides special handling for integers.
+forth INTERPRET, 'INTERPRET'
+ ;; Read word
+ dq READ_WORD
+ dq PAIRDUP
+ ;; Stack is (word length word length).
+ dq FIND ; Try to find word
+ dq DUP_
+ dq ZBRANCH, 8 * 22 ; Check if word is found
+
+ ;; - Word is found -
+
+ dq STATE, GET, ZBRANCH, 8 * 11 ; Check whether we are in compilation or immediate mode
+
+ ;; (Word found, compilation mode)
+ dq DUP_, IS_IMMEDIATE, NOT_, ZBRANCH, 8 * 6 ; If the word is immediate, continue as we would in immediate mode
+
+ ;; Otherwise, we want to compile this word
+ dq TCFA
+ dq COMMA
+ dq DROP, DROP
+ dq EXIT
+
+ ;; (Word found, immediate mode)
+ ;; Execute word
+ dq TCFA
+ ;; Stack is (word length addr)
+ dq SWAP, DROP
+ dq SWAP, DROP
+ ;; Stack is (addr)
+ dq EXEC
+ dq EXIT
+
+ ;; - No word is found, assume it is an integer literal -
+ ;; Stack is (word length addr)
+ dq DROP
+ dq PARSE_NUMBER
+
+ dq STATE, GET, ZBRANCH, 8 * 5 ; Check whether we are in compilation or immediate mode
+
+ ;; (Number, compilation mode)
+ dq LIT, LIT, COMMA
+ dq COMMA
+ dq EXIT
+
+ ;; (Number, immediate mode)
+ dq EXIT