From 8b4f79d0c811c1b8dccd23ef58cfa487629140c4 Mon Sep 17 00:00:00 2001 From: "John P. Willis" Date: Thu, 3 Oct 2019 17:04:01 -0600 Subject: [PATCH] Begin work on console improvements --- examples/setscr.bin | Bin 0 -> 65536 bytes src/libilxi/console.bas | 21 ++- src/libilxi/cpu.bas | 3 - src/vm/.ilximrc | 2 + src/vm/ilxi.xmf | 297 ++++++++++++++++++++++++++++++++++++++++ src/vm/rom.bin | 0 src/xiasm/xiasm.bas | 2 +- 7 files changed, 317 insertions(+), 8 deletions(-) create mode 100644 examples/setscr.bin create mode 100644 src/vm/.ilximrc create mode 100644 src/vm/ilxi.xmf create mode 100644 src/vm/rom.bin diff --git a/examples/setscr.bin b/examples/setscr.bin new file mode 100644 index 0000000000000000000000000000000000000000..4d9b0123a486a41fd7cd6f1ced56859c1754b3c6 GIT binary patch literal 65536 zcmeIuK@os35CpKjfhqtI)a5;^x*&u^LTWvov)1e!vq!qJ@4oT|0|pEjFkrxd0RsjM z7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b* z1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd z0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwA zz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEj zFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r S3>YwAz<>b*1`HVZ)4&G^SOz`- literal 0 HcmV?d00001 diff --git a/src/libilxi/console.bas b/src/libilxi/console.bas index 8a1643f..5e204b7 100644 --- a/src/libilxi/console.bas +++ b/src/libilxi/console.bas @@ -165,7 +165,21 @@ sub console_output(port_number as ushort, value as ushort) for i = CONSOLE_OFFSET to CONSOLE_LIMIT - 1 st_write_byte CONSOLE_PAGE, i, value next i - + + case (console_io_base + 5) + + dim s_width as ushort + dim s_height as ushort + + s_width = cpu_state.ga + s_height = cpu_state.gb + + screenres s_width, s_height + + if err > 0 then + message_print "console(): cannot set graphics mode" + cpu_set_flag FL_HALT + end if end select end sub ' console_output() @@ -174,9 +188,8 @@ sub console_cycle_local(byval userdata as any ptr) do - sleep sleep_duration, 1 - - console_refresh_local + sleep sleep_duration, 1 + console_refresh_local if bus_get_stop_flag(0) = 1 then exit do loop diff --git a/src/libilxi/cpu.bas b/src/libilxi/cpu.bas index eedb2f1..f2b8b65 100644 --- a/src/libilxi/cpu.bas +++ b/src/libilxi/cpu.bas @@ -756,7 +756,6 @@ function cpu_get_reg(register as ubyte) as ushort return cpu_state.go case NREG_GP return cpu_state.gp - case NREG_LA return (cpu_state.ga and LSB_MASK) case NREG_LB @@ -767,7 +766,6 @@ function cpu_get_reg(register as ubyte) as ushort return (cpu_state.gd and LSB_MASK) case NREG_LE return (cpu_state.ge and LSB_MASK) - case NREG_HA return (cpu_state.ga and MSB_MASK) shr 8 case NREG_HB @@ -778,7 +776,6 @@ function cpu_get_reg(register as ubyte) as ushort return (cpu_state.gd and MSB_MASK) shr 8 case NREG_HE return (cpu_state.ge and MSB_MASK) shr 8 - end select end function ' cpu_get_reg() diff --git a/src/vm/.ilximrc b/src/vm/.ilximrc new file mode 100644 index 0000000..4451a57 --- /dev/null +++ b/src/vm/.ilximrc @@ -0,0 +1,2 @@ +[console] +mode=local diff --git a/src/vm/ilxi.xmf b/src/vm/ilxi.xmf new file mode 100644 index 0000000..44e129e --- /dev/null +++ b/src/vm/ilxi.xmf @@ -0,0 +1,297 @@ +@index +ILXI Interactive Commands + +loadpage, lp - load memory segment from host file +savepage, sp - save memory segment to host file +writesect, ws - write sector to disk +assemble, a - interactively assemble instructions to a memory segment +disassemble, di - disassemble instructions in memory +step - single-step through a program +pushb - push a byte to the stack +pushw - push a word to the stack +getm - dump memory segments to the screen +setm - set the value of bytes or words in memory +getr - get the value of a CPU register +setr - set the value of a CPU register +dumpcpu, d - display the current state of CPU registers +trace - toggles instruction tracing +ver - display the current version of ILXI +run - run the CPU +reset - re-initialize the CPU +help - display online help topics +? - display this list of ILXI operations +exit, quit - exit ILXI + +@loadpage +loadpage - Load a memory segment from host file + +Syntax: [loadpage|lp] + +Details: + +loadpage loads a single 64Kb segment from a memory image file +on the host machine. This can be a program, assembled with +the xiasm assembler, or generated from other ILXI compilers. +@lp +lp - see help for "loadpage" +@savepage +savepage - Save a memory segment to host file + +Syntax: [savepage|sp] + +Details: + +savepage saves a single 64Kb segment from ilxi into the specified +memory image file on the host. When used with the assemble command, +this allows the user to use ILXI as an interactive program development +environment. +@sp +sp - see help for "savepage" +@writesect +writesect - Write to one sector of an attached disk + +Syntax: [writesect|ws] + +Details: + +writesect writes data from segment-number:offset to the specified disk sector. +@ws +ws - see help for "writesect" +@assemble +assemble - interactively assemble instructions directly into memory + +Syntax: assemble + +Details: + +assemble allows you to interactively assemble instructions into ILXI memory. +The starting address is EP:, where EP is the CPU's EP register. +@disassemble +disassemble - disassemble instructions in memory + +Syntax: [disassemble|di] + +Details: + +disassemble will convert instructions of machine code +starting at CP: +@di +di - see help for "disassemble" +@step +step - single-step through program instructions + +Syntax: step + +Details: + +step will advance the program counter register and execute the next instruction. +@getr +getr - get the value of a CPU register + +Syntax: getr + +Details: + +getr will return the value contained in the CPU register denoted by +@setr +setr - set the value of a CPU register + +Syntax: setr + +Details: + +setr will set the CPU register denoted by to +@pushb +pushb - push a BYTE value onto the stack + +Syntax: pushb + +Details: + +pushb will push onto the stack, and update CPU registers +accordingly. +@pushw +pushw - push a WORD value onto the stack + +Syntax: pushw + +Details: + +pushw will push onto the stack, and update CPU registers +accordingly. +@getm +getm - dump memory contents to screen + +Syntax: getm + +Details: + +getm will display the contents of memory from DP: to +DP: on the screen. +@setm +setm - set the value of bytes or words in memory + +Syntax: setm + +Details: + +setm will write to memory address DP:. +The can be either a BYTE or a WORD. +@dumpcpu +dumpcpu - displays the state of CPU registers + +Syntax: [dumpcpu|d] + +Details: + +The dumpcpu command will display the current contents of +all CPU registers and flags. +@d +See help for "dumpcpu" +@trace +trace - toggle program trace + +Syntax: trace + +Details: + +trace will turn program trace on and off. can be +either 1 or 0, where 1 turns tracing on and 0 turns tracing off. + +In program trace mode, the CPU will halt after each instruction, +something like an automated single-step. +@ver +ver - display the current version of ILXI + +Syntax: ver + +Details: + +Displays the current version of ILXI. +@run +run - run the CPU + +Syntax: run + +Details: + +The "run" command will start the CPU running at address CP:PC +@reset +reset - re-initialize the CPU + +Syntax: reset + +Details: + +This command resets the CPU. The interrupt queue will be cleared, +registers zeroed, the INTERRUPT flag enabled, the ROM firmware reloaded, +the bus initialized, and signals initialized. + +This command must be used in order to perform single-step operations +on a program after a program-generated HALT is encountered. +@help +help - display online help + +Syntax: help + +Details: + +Displays online help topic on the screen. +@? +? - display list of help topics + +Syntax: ? + +Details: + +Displays a list of available help topics +@exit +exit - exit the ILXI environment + +Syntax: exit + +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" diff --git a/src/vm/rom.bin b/src/vm/rom.bin new file mode 100644 index 0000000..e69de29 diff --git a/src/xiasm/xiasm.bas b/src/xiasm/xiasm.bas index 7d9848b..96813b6 100644 --- a/src/xiasm/xiasm.bas +++ b/src/xiasm/xiasm.bas @@ -73,7 +73,7 @@ sub do_asm(filename as string, page_number as integer) f = lookup_symbol(e.e_key) if f.resolved = 1 then - for j = 1 to s + 'for j = 1 to s end if next i -- GitLab