Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
John P. Willis
ilxi
Commits
facafaec
Commit
facafaec
authored
May 10, 2016
by
John P. Willis
Browse files
Initial work on XOS
parent
a57808fb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
5 deletions
+73
-5
xiasm.bas
xiasm.bas
+5
-5
xos/kernel.xa
xos/kernel.xa
+68
-0
No files found.
xiasm.bas
View file @
facafaec
...
@@ -42,7 +42,7 @@ sub do_asm(filename as string, argi as integer)
...
@@ -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
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 i as integer
dim e as undef_entry
dim e as undef_entry
...
@@ -61,7 +61,7 @@ sub do_asm(filename as string, argi as integer)
...
@@ -61,7 +61,7 @@ sub do_asm(filename as string, argi as integer)
print "FATAL UNRESOLVED SYMBOL "; e.e_key
print "FATAL UNRESOLVED SYMBOL "; e.e_key
end
end
else
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
st_write_word argi, fixup_offset, f.offset
end if
end if
...
@@ -146,7 +146,7 @@ sub initial_pass(page_number as ushort)
...
@@ -146,7 +146,7 @@ sub initial_pass(page_number as ushort)
else
else
asm_offset = get_lexer_entry(1).intval
asm_offset = get_lexer_entry(1).intval
end if
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
origin = asm_offset
case "EQU"
case "EQU"
t_sym.e_key = get_lexer_entry(1).strval
t_sym.e_key = get_lexer_entry(1).strval
...
@@ -205,7 +205,7 @@ sub initial_pass(page_number as ushort)
...
@@ -205,7 +205,7 @@ sub initial_pass(page_number as ushort)
fixup_flag = 0
fixup_flag = 0
ts = expand_macros(input_lines(i))
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_assemble ts
asm_offset += 1
asm_offset += 1
...
@@ -301,7 +301,7 @@ function expand_macros(input_string as string) as string
...
@@ -301,7 +301,7 @@ function expand_macros(input_string as string) as string
' resolution until next pass if not resolved
' resolution until next pass if not resolved
'
'
if symbol.resolved = 0 then
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
dim uent as undef_entry
...
...
xos/kernel.xa
0 → 100644
View file @
facafaec
;
; 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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment