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.
.var in support of "Creating Variables"
Moderator: MaxCoderz Staff
-
- Calc King
- Posts: 1513
- Joined: Sat 05 Aug, 2006 7:22 am
Re: .var in support of "Creating Variables"
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"
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().
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
- benryves
- Maxcoderz Staff
- Posts: 3088
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Re: .var in support of "Creating Variables"
AppOnErr/AppOffErr are macros. Here they are from ti83plus.inc (ZDS macros):
bcall() should work within modules - the default Latenite template would bung everything inside a Program module and bcall(_XXXX) works there.
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
Re: .var in support of "Creating Variables"
Thanks Ben!