X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=main.asm;h=1a41bb9a2c1dc30f1050200a9e724a56885eff47;hb=d0c63c32298a6a7fd2957624c092df01df66cdca;hp=086d1dc243dcfa4d8641d2eba627eedd804c1138;hpb=03fd7979b12ff7cc5d074bb83c9d4e3fcdf616c3;p=rrq%2Fjonasforth.git diff --git a/main.asm b/main.asm index 086d1dc..1a41bb9 100644 --- a/main.asm +++ b/main.asm @@ -235,16 +235,6 @@ forth_asm TERMINATE, 'TERMINATE' mov rdi, 0 syscall -forth HELLO, 'HELLO' - dq LIT, 'H', EMIT - dq LIT, 'e', EMIT - dq LIT, 'l', EMIT - dq LIT, 'l', EMIT - dq LIT, 'o', EMIT - dq LIT, '!', EMIT - dq NEWLINE - dq EXIT - ;; Duplicate a pair of elements. forth_asm PAIRDUP, '2DUP' pop rbx @@ -563,8 +553,35 @@ forth_asm TICK, "'" push rax next +forth_asm ROT, 'ROT' + pop rax + pop rbx + pop rdx + push rax + push rdx + push rbx + next + +forth_asm PICK, 'PICK' + pop rax + lea rax, [rsp + 8 * rax] + mov rax, [rax] + push rax + next + +forth_asm EQL, '=' + pop rax + pop rbx + cmp rax, rbx + je .eq +.noteq: + push 0 + next +.eq: + push 1 + next + forth MAIN, 'MAIN' - dq HELLO dq INTERPRET dq BRANCH, -8 * 2 dq TERMINATE