Commit facafaec authored by John P. Willis's avatar John P. Willis

Initial work on XOS

parent a57808fb
......@@ -42,7 +42,7 @@ sub do_asm(filename as string, argi as integer)
if udidx > 0 then ' we have a need for a fix-up pass
'print ">>> PASS 2 [INFO]: Attempting to resolve "; trim(str(udidx)); " symbol(s) left over from pass 1"
print ">>> PASS 2 [INFO]: Attempting to resolve "; trim(str(udidx)); " symbol(s) left over from pass 1"
dim i as integer
dim e as undef_entry
......@@ -61,7 +61,7 @@ sub do_asm(filename as string, argi as integer)
print "FATAL UNRESOLVED SYMBOL "; e.e_key
end
else
'print ">>> PASS 2 [INFO]: Resolved symbol "; e.e_key; " (symbol found at offset "; hex(f.offset); "h, inserted at fix-up offset "; hex(fixup_offset); "h)"
print ">>> PASS 2 [INFO]: Resolved symbol "; e.e_key; " (symbol found at offset "; hex(f.offset); "h, inserted at fix-up offset "; hex(fixup_offset); "h)"
st_write_word argi, fixup_offset, f.offset
end if
......@@ -146,7 +146,7 @@ sub initial_pass(page_number as ushort)
else
asm_offset = get_lexer_entry(1).intval
end if
'print ">>> PASS 1 [INFO]: Program ORIGIN set to offset "; hex(asm_offset)
print ">>> PASS 1 [INFO]: Program ORIGIN set to offset "; hex(asm_offset)
origin = asm_offset
case "EQU"
t_sym.e_key = get_lexer_entry(1).strval
......@@ -205,7 +205,7 @@ sub initial_pass(page_number as ushort)
fixup_flag = 0
ts = expand_macros(input_lines(i))
'print ">>> PASS 1 [OUTPUT]: "; ilxi_pad_left(hex(asm_offset), "0", 4); ": "; ts
print ">>> PASS 1 [OUTPUT]: "; ilxi_pad_left(hex(asm_offset), "0", 4); ": "; ts
asm_assemble ts
asm_offset += 1
......@@ -301,7 +301,7 @@ function expand_macros(input_string as string) as string
' resolution until next pass if not resolved
'
if symbol.resolved = 0 then
'print ">>> PASS 1 [INFO]: Deferring resolution of '"; macro_name; "' until next pass"
print ">>> PASS 1 [INFO]: Deferring resolution of '"; macro_name; "' until next pass"
dim uent as undef_entry
......
;
; ILXI eXtended Operating System - XOS
; Version 0.1
;
; Copyright (C) 2016 Coherent Logic Development
;
; kernel.xa - kernel routines
;
PROGRAM TITLE 'XOS'
ORIGIN 0
EQU PG_SYS 0 ; system code page
EQU PG_VID 1 ; video buffer page
EQU PG_DAT 0 ; system data page
EQU PG_DTA 2 ; disk transfer area
EQU PG_STK 10 ; stack page
BRANCH WORD {__BOOT} ; skip decls, branch to __BOOT
VAR WORD CON_PTR 1 ; console pointer
VAR ZSTRING BOOTMSG "ILXI XOS 0.1"
;****
; CONSOLE_INIT
; Initialize the XOS console
;
LABEL CONSOLE_INIT
OUT 0,1 ; enable cursor
OUT 1,25 ; set console cycle to 25ms
OUT 2,0 ; no horizontal offset
OUT 3,0 ; no vertical offset
COPY WORD (#{CON_PTR}),1 ; initialize console pointer
SRET
;****
; CONSOLE_PRINT
; Print string pointed to by SS:SI
;
LABEL CONSOLE_PRINT
PUSH WORD %BP ; preserve BP
COPY WORD %BP,%SO ; copy stack offset to base ptr
PUSH WORD %SS ; preserve SS
PUSH WORD %DS ; preserve DS
PUSH WORD %DI ; preserve DI
COPY WORD %DS,{PG_VID} ; destination page = video page
COPY WORD %DI,#{CON_PTR} ; destination offset = CON_PTR
CPSZ ; copy SS:SI to video buffer
ADD WORD (#{CON_PTR}),%DI ; update console pointer
POP WORD %DI ; restore DI
POP WORD %DS ; restore DS
POP WORD %SS ; restore SS
POP WORD %BP ; restore BP
SRET
LABEL __BOOT
COPY WORD %DP,{PG_DAT} ; initialize data page
COPY WORD %SP,{PG_STK} ; initialize stack page
COPY WORD %SS,%DP ; point SS:SI to BOOTMSG
COPY WORD %SI,{BOOTMSG}
SCALL WORD {CONSOLE_PRINT} ; call print routine
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment