X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;ds=sidebyside;f=main.asm;h=93e576fe684543b77547aa936a2b74a109e34116;hb=9b08decf6a8f5d454c90dbcbf12d42cb8954a022;hp=407d3a30a9baad7bbd6b05b9818d50d29cf889b6;hpb=d8a61fe84d4b71c21c4ce18a9b7bc78000db725a;p=rrq%2Fjonasforth.git diff --git a/main.asm b/main.asm index 407d3a3..93e576f 100644 --- a/main.asm +++ b/main.asm @@ -1,10 +1,16 @@ ;; vim: syntax=fasm ;; At compile-time we load the module given by the environment variable -;; OS_INCLUDE. This module should define the following macros: +;; OS_INCLUDE. All of the following these procedures should preserve the value +;; of RSI and RSP. They may use other registers as they like. ;; -;; Each of these functions should preserve the value of RSI and RSP. They may -;; use other registers as they like. +;; The module should provide the following: +;; +;; os_code_section +;; Macro to start the text segment. +;; +;; os_data_section +;; Macro to start the data segment. ;; ;; os_initialize ;; Called at initialization. @@ -78,11 +84,11 @@ macro forth_asm label, name, immediate { .start: } -section '.text' code readable executable - include "impl.asm" ; Misc. subroutines include "bootstrap.asm" ; Forth words encoded in Assembly +os_code_section + main: cld ; Clear direction flag so LODSQ does the right thing. mov rbp, return_stack_top ; Initialize return stack @@ -609,7 +615,7 @@ forth INPUT_LENGTH, 'INPUT-LENGTH' dq LIT, input_buffer_length dq EXIT -section '.data' readable writable +os_data_section ;; The LATEST variable holds a pointer to the word that was last added to the ;; dictionary. This pointer is updated as new words are added, and its value is @@ -657,6 +663,8 @@ return_stack_top: ;; We store some Forth code in sys.f that defined common words that the user ;; would expect to have available at startup. To execute these words, we just ;; include the file directly in the binary, and then interpret it at startup. -sysf file 'sys.f' +sysf: +file 'sys.f' +file 'example.f' sysf.len = $ - sysf