Page 1 of 1

.struct usage compilation error

Posted: Thu 08 Jul, 2010 2:51 am
by puromtec
I have copied the struct example from the brass manual and I get a compile error: "Could not parse expression 'Me.X' (Invalid number)". The non-struct variable is created and written to fine (by commenting ou the ld call on the struct variable).

Here is the code:

Code: Select all

; ===============================================================
; Echo1
; ===============================================================

.variablename "ECH1"
.inclabels "ti8x.lbl"
.defpage 0, 16*1024, $4000 ;Page 0 definition
.export

.page 0


EXT_APP = 1 ;????

.block 128


;.include "MyMacros.asm"



Main:
		; Program entry point
	;call SplashText



	.define safe_ram_1 $CED5
	;.define safe_ram_2 $F000
	
	.varloc safe_ram_1, 128
	;.varloc safe_ram_2, 256
	
	.var 2, word_test
	;.var 100, big_area
	;.var 100, other_big
	
	
	.var word_test, Test1
	ld a, 3
	ld (Test1),a
	ld a, 5
	ld (Test1), a
	
	.struct Point2D 
	.var db, X 
	.var db, Y 
	.endstruct 
	; Use it 
	
	.var Point2D, Me
	 
	ld a,10 
	ld (Me.X),a 
	ld a,32 
	ld (Me.Y),a 
	.breakpoint b55


;	call VarDemo
		
	bcall(_getkey)
	
EndApp:
	bjump(_JForceCmdNoChar) ; exit


Any suggestions are appreciated. Thanks.

Re: .struct usage compilation error

Posted: Thu 08 Jul, 2010 2:31 pm
by benryves
It appears that you need to be within a module for this to work - try adding .module _ (substitute anything you like for _) at the top of the source file. You may also need .local if you don't already have that. Please check the output .inc file if you suspect things are not working as intended.

I still go with what I previously warned and strongly recommend against using Brass 1.x as it is rather erratic (at best).

Re: .struct usage compilation error

Posted: Sun 11 Jul, 2010 4:07 pm
by puromtec
>It appears that you need to be within a module for this to work

Thanks. But, I tried adding it. Did not work, must be something else I am doing. When I discover, I'll post experience.