ilxi.bas 1.03 KB
Newer Older
John P. Willis's avatar
John P. Willis committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
#include "ilxi.bi"
#include "cpu.bi"
#include "lexer.bi"

startup

sub startup()
    print "ILXI Virtual Machine"
    print " Copyright (C) 2015 Coherent Logic Development LLC"
    print ""

    init_cpu    
    cli

    end
end sub

sub cli()
    dim cli_cmd as string
    dim cmd_name as string
    dim trace as integer 

    dim arg_count as integer = 0

    trace = 0

    do
        line input "ilxi> ", cli_cmd	

	arg_count = lex(cli_cmd)
	cmd_name = get_lexer_entry(0).strval

	select case cmd_name
	       case "gr"
		    
	       case "dumpcpu"
	       	    cpu_dump_state
	       case "trace"
	       	    if trace = 0 then
		       trace = 1
		       print "trace on"
		    else
		       trace = 0
		       print "trace off"		             	
		    end if
		    
		    cpu_state.te = trace	
	       case "ver"
	       	    print "ILXI 0.1"
	       case "run"
	       	    cpu
	       case "reset"
	            init_cpu
		    cpu_state.te = trace
	       case else
	       	    shell cli_cmd
        end select

    loop until cli_cmd = "exit"
end sub