Page 1 of 1
.var in support of "Creating Variables"
Posted: Sun 11 Jul, 2010 4:50 pm
by puromtec
I'd like to clear up a point of confusion on my part. How does the .var brass command help in creating variables that are created through TI's CreateAppVar, Create..., etc.?
From Brass manual on .var syntax:
>This is another way to declare a label, designed to make adding variables which point >to some location of safe RAM easier.
I notice that this call works in conjuntion with .varloc and it seems like it might zero out the SIZE amount. To me this looks like a good way to handle runtime only variables, but if I want to archive the variables, i should instead let CreateAppVar do the work instead.
Am I off in my thinking?
Thanks, in advance.
Re: .var in support of "Creating Variables"
Posted: Sun 11 Jul, 2010 6:08 pm
by King Harold
They're not even nearly the same thing, the things created through .var are not really things and nor really created. They're just global variables allocated at assemble-time by the assembler. And they aren't properly "allocated" either, they only won't overlap with other .var's in the same program, but no one else knows they even exist. To make "sure" they don't overlap, the best you can do is .varloc-ing only ram that you "know" will be free (but you don't really know, that piece of ram looks just as free to other programs, so it's a good thing there is no multitasking)
Re: .var in support of "Creating Variables"
Posted: Sun 11 Jul, 2010 9:49 pm
by puromtec
Thanks.
I got a variable created using this code below. However,...
1. It does not show up in the "Variables window" in PTI during debug.
2. Also, the keyword AppOnErr (which I have commmented out) does not compile, some "Instruction 'nomem' not understood" compilation error. Is there an alternative?
3. On another note, I got fed up with the '.module', i could not make calls to bcall macro for instance from a module when using them. I know about the noname being default if no module specified, and tried noname.bcall().
Code: Select all
LD hl, VarName
bcall(_Mov9ToOP1)
;AppOnErr NoMem ; error handler
LD hl, 20
.breakpoint ss
bcall(_CreateAppVar)
.breakpoint cc
inc de
inc de
ld hl, Identifier
ld bc, 4
ldir
.breakpoint tt
;de is pointing to the location of the data for new variable
VarName:
.db AppVarObj, 'SomeObj',0
Identifier:
.db "TMKR",0
;NoMem:
; SCF ; CA = 1 if not successful
; RET
ret
Re: .var in support of "Creating Variables"
Posted: Mon 12 Jul, 2010 10:23 am
by benryves
AppOnErr/
AppOffErr are macros. Here they are from ti83plus.inc (ZDS macros):
Code: Select all
APP_PUSH_ERRORH EQU 59h
APP_POP_ERRORH EQU 5Ch
;
AppOnErr macro handaddr
LD HL,handaddr ;hl -> stack handler address
CALL APP_PUSH_ERRORH ;establish error handler context
.endm
AppOffErr macro
CALL APP_POP_ERRORH ;remove error handler context
.endm
bcall() should work within modules - the default Latenite template would bung everything inside a
Program module and
bcall(_XXXX) works there.
Re: .var in support of "Creating Variables"
Posted: Mon 12 Jul, 2010 10:35 pm
by puromtec
Thanks Ben!