From: Jonas Hvid Date: Thu, 21 Nov 2019 21:55:59 +0000 (+0100) Subject: Add comments to Forth words that we expect to keep X-Git-Url: https://git.rrq.au/?a=commitdiff_plain;h=ad2d7300c0ec7b547259fdfd682bb7f0ee6a01ab;p=rrq%2Fjonasforth.git Add comments to Forth words that we expect to keep --- diff --git a/main.asm b/main.asm index 049cb13..e5444b8 100644 --- a/main.asm +++ b/main.asm @@ -59,6 +59,7 @@ LIT: push rax next +;; Expects a character on the stack and prints it to standard output. EMIT: dq .start .start: @@ -74,6 +75,7 @@ EMIT: popr rsi next +;; Prints a newline to standard output. NEWLINE: dq docol dq LIT, $A @@ -134,6 +136,8 @@ READ_WORD: ; 400170 next +;; Takes a string (in the form of a pointer and a length on the stack) and +;; prints it to standard output. TYPE: dq .start .start: @@ -150,6 +154,14 @@ TYPE: mov rsi, rbx next +;; Exit the program cleanly. +TERMINATE: + dq .start +.start: + mov rax, $3C + mov rdi, 0 + syscall + PUSH_HELLO_CHARS: dq docol dq LIT, $A @@ -178,13 +190,6 @@ HELLO: dq NEWLINE dq EXIT -TERMINATE: - dq .start -.start: - mov rax, $3C - mov rdi, 0 - syscall - MAIN: dq docol dq HELLO @@ -209,7 +214,6 @@ READ_WORD.buffer rb READ_WORD.max_size READ_WORD.length db ? READ_WORD.char_buffer db ? - ;; Return stack rq $2000 return_stack_top: