[TI ASM] unexpected invalid dim error

Got questions? Got answers? Go here for both.

Moderator: MaxCoderz Staff

Post Reply
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

[TI ASM] unexpected invalid dim error

Post by King Harold »

i ran a test on my appvar program, well, everything ok (so far only making and deleting) but when you want a size of say 2000 it errors

Code: Select all

.nolist
#include "ti83plus.inc"
#define    ProgStart    $9D95
.list
.org    ProgStart - 2
    .db    t2ByteTok, tAsmCmp
        bcall(_RclAns)		; recall Ans
        ld hl,1			; 1st element in Real List
        bcall(_GetLtoOp1)	; get element
        bcall(_ConvOp1)		; returns a as LSByte (and de as the total 16bit value)
	CP 0
	JP Z,create_var
	CP 1
	JP Z,del_var
	CP 2
	JP Z,put_int
	JP return

create_var:
	bcall(_RclAns)		;rcl ans because its lost
	ld hl, 2		;2nd list element (size)
	bcall(_GetLtoOp1)	;put it in op1
	bcall(_ConvOp1)		;make it a number and put it in de
	push de			;push de because it gets destructed
	ld hl,3			;3rd list element (name)
	bcall(_GetLtoOp1)	;put it in op1
	bcall(_ConvOp1)		;make it a number and put it in de (somehow this has to make a name)
				;name generation based on de (3rd element of list) (later)
	ld hl, var_name		;testingfase namegeneration
	bcall(_Mov9ToOP1)	;put the name in hl
	bcall(_ChkFindSym)	;see if it needs to be deleted
	JR C, create_var_2	;jump if it doesnt exist
	bcall(_DelVarArc)	;delete if so
create_var_2:
	pop hl			;pop size (was de) in hl, name is still in OP1
	bcall(_CreateAppVar)	;duhh..
	JR return
del_var:
	bcall(_RclAns)
	ld hl, 2		;for deleting the name should be in the 2nd element
	bcall(_GetLtoOp1)	;2nd element to op1
	bcall(_ConvOp1)		;store the number in de
				;name generation based on de.. (need help on that)
	ld hl, var_name		;name in hl
	bcall(_Mov9ToOP1)	;name in op1
	bcall(_ChkFindSym)	;check if it exists, cant delete non-existant things
	JR C, not_found		;if not found, dont delete
	bcall(_DelVar)		;else delete
	ld a, 1			;1 in a
	bcall(_SetxxOP1)	;1 in op1
	bcall(_StoX)		;op1 in x (tell user that the appvar has (probebly) succesfully been 

deleted
	JR return
put_int:
	JR return
var_name:
	.db AppVarObj, "testvar "
not_found:
	ld a, 0		;if the appvar has not been found, 0 to a
	bcall(_SetxxOp1)	;a to op1
	bcall(_StoX)		;op1 to x
	JR return
return:
	ret
.end
END
no jump table yet - just a test version, also no name generation yet

but why does it error? i mean: i put the size in a 16big reg and push it, aught to work
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

Where does the error occur?
Also, how big is HL when you create the app var? (Chuck a breakpoint in before the call) - I didn't think those calls will cause an error, though.

I don't think the DIM error is related to the size of the app var. I'm not too hot on the other TIOS routines you're using though, so can't comment on what it might be. I can only suggest putting in breakpoints before every bcall and running it until it shows the error.

There are some minor points on general coding style, in any case -

Those "jr return" at the end are not required. You can just "ret".

Minor, but "xor a" will set a to 0. It alters the flags, but that's not important in this case.

cp 0 \ cp 1 \ cp 2 \ ... can be optimised by using "dec a" instead. "dec a" will set the zero flag if a becomes zero, so:

Code: Select all

   CP 0 
   JP Z,create_var 
   CP 1 
   JP Z,del_var 
   CP 2 
   JP Z,put_int 
   JP return
...could be:

Code: Select all

   or a
   jr z,create_var 
   dec a
   jr z,del_var 
   dec a 
   jr z,put_int 
   ret
Note the initial "or a" instead of "cp 0" as well.
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

thanx for optimizations, its just a test version though so i just threw some code together, as for where the error occurs: (edit in a min lol)
uhm.. how do i set breakpoints.. (im using ti 83+ flash debugger is that bad?)
also for some reason i get a duplicate label error when putting in more hten one ret
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

I can only speak for Latenite+Brass+PindurTI, in which you'd insert ".breakpoint" into your code. :|

If you swap TI-83+ Flash Debugger for PindurTI, you can use the debugger in that to set breakpoints manually too. I'm not sure about FD, though.
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

all i have to do is dump my rom then...
pindurTI says "Error invalid file format"

i forgot to mention, values >1 and <256 work fine
Last edited by King Harold on Mon 07 Aug, 2006 2:26 pm, edited 1 time in total.
CompWiz
Calc King
Posts: 1950
Joined: Thu 13 Oct, 2005 1:54 pm
Location: UB

Post by CompWiz »

what calculator are you using? You do know that PindurTI only supports 83 and 83+ roms, right?
In Memory of the Maxcoderz Trophy Image
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

84+ and no i didnt i just thought "oh ok i'll get pindutTI then" and did so
so im testing with TI 83 flash debugger
but i still dont get how i can get an error like this
the fact that values <256 work make me think its something with a 8bits reg but it shouldnt since its hl which obviously is 16bit
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

Code: Select all

.nolist
#include "ti83plus.inc"
#define    ProgStart    $9D95
.list
.org    ProgStart - 2
    .db    t2ByteTok, tAsmCmp
        bcall(_RclAns)		; recall Ans
        ld hl,1			; 1st element in Real List
        bcall(_GetLtoOp1)	; get element
        bcall(_ConvOp1)		; returns a as LSByte (and de as the total 16bit value)
	or a			
	JP Z,create_var		
	dec a			
	JP Z,del_var		
	dec a		
	JP Z,put_int		
	ret		

create_var:
	bcall(_RclAns)		;rcl ans because its lost
	ld hl, 2		;2nd list element (size)
	bcall(_GetLtoOp1)	;put it in op1
	bcall(_ConvOp1)		;make it a number and put it in de
	push de			;push de because it gets destructed
	ld hl,3			;3rd list element (name)
	bcall(_GetLtoOp1)	;put it in op1
	bcall(_ConvOp1)		;make it a number and put it in de (somehow this has to make a name)
				;name generation based on de (3rd element of list) (later)
	ld hl, var_name		;testingfase namegeneration
	bcall(_Mov9ToOP1)	;put the name in hl
	bcall(_ChkFindSym)	;see if it needs to be deleted
	JR C, create_var_2	;jump if it doesnt exist
	bcall(_DelVarArc)	;delete if so
create_var_2:
	pop hl			;pop size (was de) in hl, name is still in OP1
	bcall(_CreateAppVar)	;duhh..
	ret
del_var:
	bcall(_RclAns)
	ld hl, 2		;for deleting the name should be in the 2nd element
	bcall(_GetLtoOp1)	;2nd element to op1
	bcall(_ConvOp1)		;store the number in de
				;name generation based on de.. (need help on that)
	ld hl, var_name		;name in hl
	bcall(_Mov9ToOP1)	;name in op1
	bcall(_ChkFindSym)	;check if it exists, cant delete non-existant things
	JR C, not_found		;if not found, dont delete
	bcall(_DelVar)		;else delete
	ld a, 1			;1 in a
	bcall(_SetxxOP1)	;1 in op1
	bcall(_StoX)		;op1 in x (tell user that the appvar has (probebly) been deleted
	ret
put_int:
	ret			;not made yet
var_name:
	.db AppVarObj, "testvar "	;testname untill i make name generation
not_found:
	xor a			;if the appvar has not been found, 0 to a
	bcall(_SetxxOp1)	;a to op1
	bcall(_StoX)		;op1 to x (0 to x)
	ret

.end
END
the error now occurs when the size is LOWER then 256
chickendude
Extreme Poster
Posts: 340
Joined: Fri 07 Jul, 2006 2:39 pm

Post by chickendude »

Whoa, I never knew that little .breakpoint tidbit. How do you use that?
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

you just put it in right?
anyway could you plz stick to my question..?
threefingeredguy
Calc King
Posts: 2195
Joined: Sun 27 Mar, 2005 4:06 am
Location: sleeping
Contact:

Post by threefingeredguy »

Is the name null-terminated or determined by length? Also, are you sure that OP1 was not destroyed before createappvar?
Image
King Harold
Calc King
Posts: 1513
Joined: Sat 05 Aug, 2006 7:22 am

Post by King Harold »

I dont know about the name, in the version you see there the name works but there is a size bug (which doesnt allow certain sizes)
Post Reply