Re: A86: weird program bug (read only if you have extra time)


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

Re: A86: weird program bug (read only if you have extra time)




I tired your suggestion now instead of crashing the calculator it gives me a 
MEMORY error. Any ideas on what could be causing that?

Thanks,
Andy

P.S. My new source is below

In a message dated 7/7/00 1:20:54 PM Central Daylight Time, rabidcow@juno.com 
writes:

<< my first guess, based on where you says it loops, would be that
 _createequ somehow calls sqrthome.
 try clearing 4,(iy+$24) at the beginning of the sqrt prog and resetting
 it at the end.  this will ensure that it's never called from inside
 itself.
 
 -josh >>

#include "ti86asm.inc"

bcurrlastentry      =   $f688

.org _asm_exec_ram

    nop
    jp      progstart
    .dw     0
    .dw     shelltitle

shelltitle:
    .db     "HomeStck v.1 Install by Andy Hochhaus",0

;this is the installer
progstart:
    res     4,(iy+$24)
    ld      hl,$5a69                ;[sqrt]home name in rom
    rst     20h                     ;"[SQRT]home" in OP1
    rst     10h                     ;_findsym
    call    nc,_delvar              ;delete var if it exists
    ld      hl,codeend-codestart    ;calc size of prog
    push    hl
    call    _createprog             ;make [sqrt] prog
    ld      a,b
    ex      de,hl
    call    _ahl_plus_2_pg3
    call    _set_abs_dest_addr
    xor     a
    pop     hl
    call    _set_mm_num_bytes
    xor     a
    ld      hl,code
    call    _set_abs_src_addr
    call    _mm_ldir
    set     4,(iy+$24)          ;activate [sqrt]home prog
    call    $49dc               ;flushallmenus
    call    _clrScrn            ;clr LCD and TextMem
    ld      a,7                 ;place cursor
    ld      (_curRow),a
    ret

;actual [sqrt]home program starts here
code:
    .org    _asm_exec_ram-2

codestart:
    .db     $8e,$28             ;necessary at start of asm progs

    res     4,(iy+$24)

    call    refreshstack        ;my function to display the stack

    ld      a,(_winBtm)
    dec     a
    ld      b,a

    ld      a,(_curRow)
    cp      b                   ;if (_curRow)<(_winBtm) goto movedown

    call    c,movedown

    ld      a,b
    ld      (_curRow),a
    ld      a,(_asm_reg_a)
    ld      bc,(_asm_reg_bc)

end:
    ld      a,0
    ld      (_currlastentry),a
    set     4,(iy+$24)
    cp      a
    ret

movedown:
    ld      a,(_curRow)
    cp      6
    jp      nz,onemenustillup   ;if one menu is still active don't refresh 
screen based on text mem

    ld      a,(_curCol)
    push    af

    call    $4ac3               ;rstrShadow NOTE:DESTROYS (_curCol) and makes 
screen flicker

    pop     af
    ld      (_curCol),a         ;restores (_curCol)

onemenustillup:
    call    $4a7a               ;_scrollDown

    ld      a,(_winBtm)
    dec     a
    ld      b,a
    ret

;displays the stack on the homescreen in the v width font
refreshstack:
    ld      a,0                     ;entry number to display
    ld      (bcurrlastentry),a
    ld      a,0                     ;location to display at
    ld      (_penCol),a
    ld      h,8
    ld      a,(_curRow)
    dec     a
    ld      l,a
    call    _HtimesL
    ld      a,l
    ld      (_penRow),a             ;calculates where to display based on the 
cursor location

;loop to display as many entrys as there are in the history stack
disphistloop:
    ld      a,(bcurrlastentry)
    inc     a
    ld      (bcurrlastentry),a
    ld      (_currlastentry),a
    ld      b,a
    ld      a,(_numlastentries)
    cp      b
    ret     c                           ;check to see if (_currlastentry) is 
smaller then (_numlastentries)
    call    disphistentry               ;actually displays each individual 
entry
    ld      a,0
    ld      (_penCol),a
    ld      a,(_penRow)
    sub     6
    ld      (_penRow),a
    jp      disphistloop

disphistentry:
    call    $4627                   ;_GETLASTENTRY get ptr to history entry
    call    _ex_ahl_bde
    push    af
    push    hl
    call    _get_word_ahl
    push    de
    push    de
    ld      hl,equvarname-1
    rst     20h
    pop     hl

    call    _createequ
;never gets past this point after running two times
    call    _ex_ahl_bde
    call    _set_abs_dest_addr

    ld      a,0
    pop     hl
    call    _ahl_plus_2_pg3
    call    _set_mm_num_bytes

    pop     hl
    pop     af
    call    _set_abs_src_addr

    call    _mm_ldir            ;copy compiled entry out to a temporary 
program variable

    ld      hl,equvarname-1
    rst     20h

    call    $53ca               ;_setupEditequ open prog in editor
    call    $51d9               ;_detok detokenize
    call    $53d2               ;_bufToTop go to the top
    xor     a                   ; insert $00 at the top
    call    $53ae               ;_bufInsert to mark it as uncompiled
    call    $544a               ;_closeEditequ close prog editor
                                ;program var is now decompiled (plain text 
form)

    ld      hl,equvarname-1
    rst     20h
    rst     10h

    call    _ex_ahl_bde
    call    $521d               ;_get_word_ahl
    dec     e
    ld      b,e
    call    _inc_ptr_ahl

disploop:                       ;displays 0 terminated string at AHL in 
variable width font
    call    $521d               ;_get_word_ahl
    call    $463b               ;_dec_ptr_ahl
    push    af
    push    hl
    push    bc
    ld      a,e
    call    $4aa1               ;_vputmap
    pop     bc
    pop     hl
    pop     de
    ld      a,d
    djnz    disploop

    ld      hl,equvarname-1     ;deletes temporary variable
    rst     20h
    rst     10h
    call    nc,_delvar

    ret

equvarname:
    .db     2,"tv"

codeend:

.end