mkdir -p out
OS_INCLUDE=os/uefi.asm fasm $< $@
+main: main.asm impl.asm bootstrap.asm sys.f os/linux.asm
+ OS_INCLUDE=os/linux.asm fasm $< $@
+
.PHONY: clean
clean:
rm -rf out OVMF_CODE.fd OVMF_VARS.fd
-;; vim: syntax=fasm
-
-section '.text' code readable executable
+os_code_section
macro printlen msg, len {
push rsi
mov rax, 100
call os_terminate
-section '.data' readable writable
+os_data_section
find.search_length dq ?
find.search_buffer dq ?
;; 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.
.start:
}
-section '.text' code readable executable
+os_code_section
include "impl.asm" ; Misc. subroutines
include "bootstrap.asm" ; Forth words encoded in Assembly
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
;; 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