Chapter 2: TI-83 Plus Specific Information 49
TI-83 Plus Developer Guide Third Release May 28, 2002
Resizing AppVar, Program, and Equation Variables
These data types can be resized in place without having to make an additional copy of
the variable. Following are the two routines, with examples, used to increase the data
size and to decrease the data size.
• Increasing the data size.
InsertMem Increases the size of an existing variable by inserting space at a given
address.
For example, insert 10 bytes at the beginning of an existing AppVar. If there is not
enough free RAM, the AppVar does not exist, or if the AppVar is archived, CA = 1 is
returned.
Insert_10:
LD HL,10 ; number bytes to insert
B_CALL EnoughMem ; check for free RAM
RET C ;retCA=1ifnot
;
LD HL,AppVarName
B_CALL Mov9ToOP1 ; OP1 = name of AppVar
B_CALL ChkFindSym ; DE = pointer to data if exists
RET C ; ret if not found
LD A,B ; archived status
ADD 0FFh ; if archived then CA = 1
RET C ; ret if archived
;
PUSH DE ; save pointer to size bytes of
; data
INC DE
INC DE ; move DE past size bytes
;
LD HL,10 ; number bytes to insert
B_CALL InsertMem ; insert the memory
POP HL ; HL = pointer to size bytes
PUSH HL ; save
;
B_CALL ldHLind ; HL = old size of AppVar,
; number bytes
LD BC,10
ADD HL,BC ; increase by 10, amount inserted
EX DE,HL ; DE = new size
POP HL ; pointer to size bytes location
LD (HL),E
INC HL
LD (HL),D ; write new size.
OR A ; CA = 0
RET
AppVarName:
DB AppVarObj,'AVAR',0
See the System Routine Documentation for details on InsertMem.