Re: A82: Re: The Ans variable location


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

Re: A82: Re: The Ans variable location



>I have not tried using the ANS variable in a program for the TI82 (yet),
>but since the routines look like the ones on the TI85 it should not be a
>problem. 

Although the VAT problem will occur, you can find the VAT entry of Ans.
Set OP1 to 00 72 00 and call _CHKFINDSYM (ROM_CALL($213E-$1A)).  It
doesn't matter if Ans isn't a real (_CHKFINDSYM will ignore data type for
Ans).  ZASMLOAD.Z80 has an example of this (and the Ans reader could be
ported to 82 fairly easily).

-- Barubary

    include squish.inc
    include tokens.inc
    include memequ.inc

;
;   input : 'Ans' contanis a string with the name of the ASM program to load
;
;
    org     9327h
;
    call    _zeroop1
    ld      a,tans
    ld      (op1+1),a
    call    _findsym
    jp      c,_errundefined  ; error if not there
;
;   de = ptr to data
;
    and     1fh
    cp      strngobj
    jp      nz,_errsyntax
;
    ld      hl,op1
    ld      (hl),progobj
    inc     hl
    ld      a,(de)           ; get size of name
    ld      c,a
    ld      b,0
    inc     de
    inc     de               ; (de) = 1st byte of prog name
    ex      de,hl
    ldir                     ; name to op1
;
;   op1 = name of asm prog to load
;
    call    _chkfindsym      ; look up
    jp      c,_errundefined
;
    ex      de,hl
    call    _ldhlind         ; HL = SIZE of prog to load
    PUSH    HL
    ld      de,insert_start-9327h
    or      a
    sbc     hl,de            ; hl = amount to insert
    push    hl
    CALL    _ERRNOTENOUGHMEM   ; ERROR IF NOT ENOUGH MEM
;
    POP     HL               ; amount to insert
    push    hl
;
    LD      DE,insert_start   ; START OF INSERT
    CALL    _INSERTMEM        ; INSERT MEM, ADJUST PTRS
    POP     HL               ; AMOUNT INSERTTED
    push    hl
;
    ld      de,(usermem_offset)
    add     hl,de                       ; new total insertted
    LD      (USERMEM_OFFSET),HL   ; SAVE AMOUNT SO CAN CLEAN UP LATER
;
    pop     hl
    ld      de,insert_start
    add     hl,de            ; loader here
    jp      (hl)
;
insert_start:
    call    _chkfindsym      ; look up
    jp      c,_errundefined
;
    ex      de,hl
    inc     hl
    inc     hl               ; start of asm compiled
    ld      de,9327h
    pop     bc               ; # bytes
    ldir                     ; copy asm
    jp      9327h