A86: _PARSEINP (_exec_basic)


[Prev][Next][Index][Thread]

A86: _PARSEINP (_exec_basic)




This _exec_basic code seems to be working fairly well in most circumstances.  
It executes working code fine, and even handles the stop command flawlessly 
as far as I can tell.  Where it blows up is when the basic code has an error: 
if they hit quit it escapes to the home screen but if they do "goto", then it 
seems to interfere with handling any errors from then on.  If I do something 
as simple as "+" on the homescreen and hit enter, it crashes.  This 
presumably has something to do with moving the OPBASE and not restoring it.  
Any ideas on how to trap stop commands without screwing up on errors?  I've 
experimented with using my own error routine (which restores the opbase and 
all) but it still crashes on the next error that's triggered.  Any ideas?

exec_basic:
    call _clrWindow
    bit ProgramExecuting,(iy+NewDispf)
    push af
    set ProgramExecuting,(iy+NewDispf)
#ifdef handle_errors
    ld hl,error_handler
    call _pushErrorHandler
    ld hl,_PARSEVAR
    ld de,basic_backup
    ld bc,_LASTENTRYPTR-_PARSEVAR
    push bc
    push de
    push hl
    ldir
#endif
    ld hl,(_OPBASE)
#ifdef handle_errors
    ld (opbase),hl
#endif
    push hl
    ld hl,(_FPBASE)
#ifdef handle_errors
    ld (fpbase),hl
#endif
    push hl
    ld hl,(_OPS)
    ld (_OPBASE),hl
    ld hl,(_FPS)
    ld (_FPBASE),hl
    ld (_onSP),sp
    call _PARSEINP          ;_exec_basic
    call _runIndicOff
    pop hl
    ld (_FPBASE),hl
    pop hl
    ld (_OPBASE),hl
#ifdef handle_errors
    pop de
    pop hl
    pop bc
    ldir
    call _popErrorHandler
#endif
    pop af
    ret nz
    res ProgramExecuting,(iy+NewDispf)
    ret


#ifdef handle_errors
error_handler:
    push af
    call _runIndicOff
    ld hl,0
fpbase = $-2
    ld (_FPBASE),hl
    ld hl,0
opbase = $-2
    ld (_OPBASE),hl
    ld hl,basic_backup
    ld de,_PARSEVAR
    ld bc,_LASTENTRYPTR-_PARSEVAR
    ldir
    ld a,$0d
    out (5),a    
    call _popErrorHandler
    pop af
    jp _monErrHand
#endif


----
Jonah Cohen
<ComAsYuAre@aol.com>
http://jonah.ticalc.org



Follow-Ups: