[A83] Re: delvar command


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

[A83] Re: delvar command




> I'm curious how you would use the delvar command in asm on a ti-83 and a
> ti-83+.
> -Reece Johnson
>
> P.S. First-time post, let me know if i did anything wrong.  Thanks!
>
>

The inputs for the bcall _delvar are as follows:
hl = pointer to the start of the symbol table entry of the variable
de= pointer to the start of the data of the variable
b= archive page (0 if not archived)

Fortunately, all these inputs are the outputs of the bcalls _findsym and
_chkfindsym, who's inputs are as follows:
(op1) = data type of variable
(op1+1) = name of the variable, zero terminated

So to delete prgmABC (assuming it is an unprotected program) the following
code would work:

delete:
    ld hl,varname
    rst rMov9ToOP1            ;RST routine equivalent to bcall(_Mov9ToOp1)
                                       ;copies the type and name from
varname to (op1)
    bcall(_chkfindsym)          ;look up the variable in (op1) in the VAT
    jr c,notfound                   ; _chkfindsym returns carry=1 if the
variable wasn't found
    bcall(_delvar)                ;delete it
notfound:
    ret


varname:
    .db 5,"ABC",0            ;type = 5 (unprotected program)
                                       ;name = "ABC",0


If the variable you want to delete is not a program, appvar or group, then
you must use _findsym instead of _chkfindsym.
- - Joe






Follow-Ups: References: