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
80bcf624
Commit
80bcf624
authored
May 09, 2016
by
John P. Willis
Browse files
More console work
parent
227d8ed8
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
212 additions
and
42 deletions
+212
-42
.ilximrc
.ilximrc
+1
-1
console.bas
console.bas
+34
-18
console.bi
console.bi
+5
-6
cpu.bas
cpu.bas
+1
-0
ilxi.bas
ilxi.bas
+7
-5
ilxi.xmf
ilxi.xmf
+81
-2
input.xa
input.xa
+63
-0
mkdisk
mkdisk
+0
-0
xiasm.bas
xiasm.bas
+20
-10
No files found.
.ilximrc
View file @
80bcf624
[console]
mode=
seri
al
mode=
loc
al
port=/dev/modem
bps=9600
parity=N
...
...
console.bas
View file @
80bcf624
...
...
@@ -2,11 +2,6 @@
' console.bas
'
'
' need to redesign:
' I/O port should be used to read, but block waiting on single character.
'
#include "console.bi"
#include "storage.bi"
#include "bus.bi"
...
...
@@ -30,7 +25,7 @@ sub console_attach()
.dev_init = @console_init_local
.dev_reset = @console_reset_local
.dev_cycle = @console_cycle_local
.dev_input = @console_input
.dev_input = @console_input
_local
.dev_output = @console_output
end with
...
...
@@ -47,7 +42,7 @@ sub console_attach()
.dev_init = @console_init_serial
.dev_reset = @console_reset_serial
.dev_cycle = @console_cycle_serial
.dev_input = @console_input
.dev_input = @console_input
_serial
.dev_output = @console_output
end with
...
...
@@ -66,11 +61,11 @@ sub console_attach()
bus_attach 0, console_device
end sub
end sub
' console_attach()
sub console_init_local()
console_mutex = mutexcreate()
end sub
end sub
' console_init_local()
sub console_init_serial()
console_mutex = mutexcreate()
...
...
@@ -90,17 +85,17 @@ sub console_init_serial()
print #console_file_number, chr(27) & "[2J"
end sub
end sub
' console_init_serial()
sub console_reset_local()
end sub
end sub
' console_reset_local()
sub console_reset_serial()
end sub
end sub
' console_reset_serial()
function console_input(port_number as ushort) as ushort
function console_input
_local
(port_number as ushort) as ushort
select case port_number
case (console_io_base + 0)
...
...
@@ -111,13 +106,34 @@ function console_input(port_number as ushort) as ushort
return horizontal_offset
case (console_io_base + 3)
return vertical_offset
case (console_io_base + 4)
case (console_io_base + 4)
console_refresh_local
return asc(input(1))
case else
return 0
end select
end function
end function ' console_input_local()
function console_input_serial(port_number as ushort) as ushort
select case port_number
case (console_io_base + 0)
return cursor_enabled
case (console_io_base + 1)
return sleep_duration
case (console_io_base + 2)
return horizontal_offset
case (console_io_base + 3)
return vertical_offset
case (console_io_base + 4)
return asc(input(1, console_file_number))
case else
return 0
end select
end function ' console_input_serial()
sub console_output(port_number as ushort, value as ushort)
...
...
@@ -152,7 +168,7 @@ sub console_output(port_number as ushort, value as ushort)
end select
end sub
end sub
' console_output()
sub console_cycle_local(byval userdata as any ptr)
...
...
@@ -250,4 +266,4 @@ sub console_refresh_serial()
next i
end sub ' console_refresh_serial()
\ No newline at end of file
end sub ' console_refresh_serial()
console.bi
View file @
80bcf624
'
' console.bi
'
'
' I/O PORT USAGE
...
...
@@ -19,7 +17,7 @@
' 1: Read refresh sleep value (ms)
' 2: Read horizontal offset
' 3: Read vertical offset
' 4: Read one character from console
'
4: Read one character from console
'
#define CONSOLE_PAGE &H0001
...
...
@@ -51,7 +49,8 @@ dim shared console_refresh as sub()
declare sub console_attach()
declare sub console_init_local()
declare sub console_reset_local()
declare function console_input(port_number as ushort) as ushort
declare function console_input_local(port_number as ushort) as ushort
declare function console_input_serial(port_number as ushort) as ushort
declare sub console_output(port_number as ushort, value as ushort)
declare sub console_cycle_local(byval userdata as any ptr)
...
...
@@ -59,4 +58,4 @@ declare sub console_init_serial()
declare sub console_reset_serial()
declare sub console_cycle_serial(byval userdata as any ptr)
declare sub console_refresh_local()
declare sub console_refresh_serial()
\ No newline at end of file
declare sub console_refresh_serial()
cpu.bas
View file @
80bcf624
...
...
@@ -373,6 +373,7 @@ sub cpu_dump_state()
print ""
print ""
print "Page Size:", PAGESIZE,"Page Count:",PAGECOUNT
print "Total Memory:",(PAGESIZE*PAGECOUNT)/1024;" Kb"
print ""
print "PC "; ilxi_pad_left(hex(x.pc),"0",4), "EC "; ilxi_pad_left(hex(x.ec),"0",4), "ES "; ilxi_pad_left(hex(x.es),"0",4), "CP "; ilxi_pad_left(hex(x.cp),"0",4), "DP "; ilxi_pad_left(hex(x.dp),"0",4)
print "EP "; ilxi_pad_left(hex(x.ep),"0",4), "SP "; ilxi_pad_left(hex(x.sp),"0",4), "SO "; ilxi_pad_left(hex(x.so),"0",4), "FL "; ilxi_pad_left(hex(x.fl),"0",4), "SS "; ilxi_pad_left(hex(x.ss),"0",4)
...
...
ilxi.bas
View file @
80bcf624
...
...
@@ -266,11 +266,11 @@ sub cli()
else
cpu_set_flag FL_TRACE
end If
C
ase "?"
print help_get_topic("ilxi.xmf", "index")
case "help"
print help_get_topic("ilxi.xmf", get_lexer_entry(1).strval)
case "ver"
c
ase "?"
print help_get_topic("ilxi.xmf", "index")
case "help"
print help_get_topic("ilxi.xmf", get_lexer_entry(1).strval)
case "ver"
print "ILXI 0.1"
case "run"
if cpu_get_flag(FL_HALT) = 0 then
...
...
@@ -279,6 +279,8 @@ sub cli()
else
message_print "cli(): CPU is halted. Type 'reset' at the prompt before attempting 'run'."
end if
case "clear", "cls"
cls
case "reset"
init_cpu
case "exit", "quit"
...
...
ilxi.xmf
View file @
80bcf624
...
...
@@ -111,9 +111,9 @@ Details:
pushb will push <byte-value> onto the stack, and update CPU registers
accordingly.
@pushw
push
b
- push a WORD value onto the stack
push
w
- push a WORD value onto the stack
Syntax: push
b
<word-value>
Syntax: push
w
<word-value>
Details:
...
...
@@ -215,4 +215,83 @@ Details:
Exits the ILXI environment.
@quit
See help for "exit"
@registers
ILXI CPU Registers
0 8 16
+-----------------+
| PC | PROGRAM COUNTER
+-----------------+
| EC | ERROR CODE
+-----------------+
| ES | ERROR SEVERITY
+-----------------+
| FL | FLAGS
+-----------------+
| CP | CODE PAGE
+-----------------+
| DP | DATA PAGE
+-----------------+
| EP | EXTRA PAGE
+-----------------+
| SP | STACK PAGE
+-----------------+
| SO | STACK OFFSET
+-----------------+
| SS | SOURCE PAGE
+-----------------+
| DS | DESTINATION PAGE
+-----------------+
| SI | SOURCE INDEX
+-----------------+
| DI | DESTINATION INDEX
+-----------------+
| BP | BASE POINTER
+--------+--------+
| LA | HA | GENERAL A
| GA |
+--------+--------+
| LB | HB | GENERAL B
| GB |
+--------+--------+
| LC | HC | GENERAL C
| GC |
+--------+--------+
| LD | HD | GENERAL D
| GD |
+--------+--------+
| LE | HE | GENERAL E
| GE |
+-----------------+
| GF | GENERAL F
+-----------------+
| GG | GENERAL G
+-----------------+
| GH | GENERAL H
+-----------------+
| GI | GENERAL I
+-----------------+
| GJ | GENERAL J
+-----------------+
| GK | GENERAL K
+-----------------+
| GL | GENERAL L
+-----------------+
| GM | GENERAL M
+-----------------+
| GN | GENERAL N
+-----------------+
| GO | GENERAL O
+-----------------+
| GP | GENERAL P
+-----------------+
@clear
clear - clear the screen
Syntax: clear
Details:
Clears the ILXI screen.
@cls
See help for "clear"
input.xa
0 → 100644
View file @
80bcf624
;
; input.xa
;
PROGRAM TITLE 'INPUT'
ORIGIN 0
EQU VID_PAGE 1
EQU VID_BASE 0
EQU DSEG 0
EQU SSEG 10
BRANCH WORD {__START}
VAR ZSTRING PROMPT "ENTER A NUMBER: "
LABEL __START
COPY WORD %DP,{DSEG}
COPY WORD %SP,{SSEG}
COPY WORD %SS,%DP
COPY WORD %SI,{PROMPT}
SCALL WORD {__PROMPT}
OUT WORD 0,1
OUT WORD 1,1
OUT WORD 2,0
OUT WORD 3,0
COPY BYTE %LC,0
LABEL __LOOP
IN WORD %GA,4
HLT
LABEL __PROMPT
;;
;; PRESERVE REGISTERS
;;
PUSH WORD %BP
COPY WORD %BP,%SO
PUSH WORD %SS
PUSH WORD %DS
PUSH WORD %DI
COPY WORD %DS,{VID_PAGE}
CPSZ
;;
;; RESTORE REGISTERS AND RETURN
;;
POP WORD %DI
POP WORD %DS
POP WORD %SS
POP WORD %BP
SRET
mkdisk
deleted
100755 → 0
View file @
227d8ed8
File deleted
xiasm.bas
View file @
80bcf624
...
...
@@ -21,6 +21,10 @@ sub main(args as string)
arg_count = lex(args)
print "ILXI EXTERNAL ASSEMBLER V0.02 (C) COHERENT LOGIC DEVELOPMENT 2016"
print ""
print ""
for argi = 0 to arg_count - 1
do_asm get_lexer_entry(argi).strval, argi
next argi
...
...
@@ -38,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
...
...
@@ -54,10 +58,10 @@ sub do_asm(filename as string, argi as integer)
f = lookup_symbol(e.e_key)
if f.resolved = 0 then
print "
>>> PASS 2 [FATAL]: Unresolved symbol
"; e.e_key
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
...
...
@@ -69,7 +73,7 @@ sub do_asm(filename as string, argi as integer)
st_save_page output_file_name, argi
print "
>>> FILE OUTPUT [INFO]: Produced ";
output_file_name; "
from ";
filename
print "
GENERATED "; ucase(
output_file_name
)
; "
FROM "; ucase(
filename
)
end sub
...
...
@@ -120,7 +124,9 @@ sub initial_pass(page_number as ushort)
dim cur_arg as string
dim t_sym as symtab_entry
dim i as integer
dim origin as integer
dim program_size as integer
origin = 0
cpu_state.ep = page_number
...
...
@@ -140,7 +146,8 @@ 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
t_sym.e_class = SYMCLASS_EQU
...
...
@@ -198,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
...
...
@@ -207,6 +214,9 @@ sub initial_pass(page_number as ushort)
end select
next i
program_size = asm_offset - origin
print "ASSEMBLED "; trim(str(program_size)); " BYTES"
end sub ' initial_pass()
sub install_symbol(sym_entry as symtab_entry)
...
...
@@ -272,14 +282,14 @@ function expand_macros(input_string as string) as string
select case symbol.e_class
case SYMCLASS_EQU
if symbol.resolved = 0 then
print "
>>> PASS 1 [FATAL]: Unresolved EQU symbol
"; macro_name
print "
FATAL UNRESOLVED EQU
"; macro_name
end
end if
b &= trim(symbol.strval)
case SYMCLASS_VAR
if symbol.resolved = 0 then
print "
>>> PASS 1 [FATAL]: Unresolved VAR symbol
"; macro_name
print "
FATAL UNRESOLVED VAR
"; macro_name
end
end if
...
...
@@ -291,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
...
...
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