Example #1
0
def value_fre(ins):
    """ FRE: get free memory and optionally collect garbage. """
    val = parse_bracket(ins)
    if val[0] == '$':
        # grabge collection if a string-valued argument is specified.
        var.collect_garbage()
    return fp.pack(fp.Single.from_int(var.fre()))
Example #2
0
 def __init__(self, greet, load):
     """ Initialise the interpreter session. """
     # true if a prompt is needed on next cycle
     self.prompt = True
     # input mode is AUTO (used by AUTO)
     state.basic_state.auto_mode = False
     # interpreter is executing a command
     state.basic_state.parse_mode = False
     # interpreter is waiting for INPUT or LINE INPUT
     state.basic_state.input_mode = False
     # previous interpreter mode
     self.last_mode = False, False
     # syntax error prompt and EDIT
     state.basic_state.edit_prompt = False
     # initialise the display
     display.init()
     # initialise the console
     console.init_mode()
     # set up event handlers
     state.basic_state.events = events.Events()
     # load initial program
     if load:
         # on load, accept capitalised versions and default extension
         with disk.open_native_or_dos_filename(load) as progfile:
             program.load(progfile)
     # set up interpreter and memory model state
     reset.clear()
     # greeting and keys
     if greet:
         console.clear()
         console.write_line(greeting.format(version=plat.version, free=var.fre()))
         console.show_keys(True)
Example #3
0
def value_fre(ins):
    """ FRE: get free memory and optionally collect garbage. """
    val = parse_bracket(ins)
    if val[0] == '$':
        # grabge collection if a string-valued argument is specified.
        var.collect_garbage()
    return fp.pack(fp.Single.from_int(var.fre()))
Example #4
0
def print_greeting(console):
    """ Print the greeting and the KEY row if we're not running a program. """
    import var
    greeting = ('PC-BASIC {version} {note}\r'
                '(C) Copyright 2013--2015 Rob Hagemans.\r'
                '{free} Bytes free')
    # following GW, don't write greeting for redirected input
    # or command-line filter run
    if (not config.get('run') and not config.get('exec')
            and not config.get('input') and not config.get(0)
            and not config.get('interface') == 'none'):
        debugstr = ' [DEBUG mode]' if config.get('debug') else ''
        params = {'version': plat.version, 'note': debugstr, 'free': var.fre()}
        console.clear()
        console.write_line(greeting.format(**params))
        console.show_keys(True)
Example #5
0
def print_greeting(console):
    """ Print the greeting and the KEY row if we're not running a program. """
    import var
    greeting = (
        'PC-BASIC {version} {note}\r'
        '(C) Copyright 2013--2015 Rob Hagemans.\r'
        '{free} Bytes free')
    # following GW, don't write greeting for redirected input
    # or command-line filter run
    if (not config.get('run') and not config.get('exec') and
             not config.get('input') and not config.get(0) and
             not config.get('interface') == 'none'):
        debugstr = ' [DEBUG mode]' if config.get('debug') else ''
        params = { 'version': plat.version, 'note': debugstr, 'free': var.fre()}
        console.clear()
        console.write_line(greeting.format(**params))
        console.show_keys(True)