.struct usage compilation error

Got questions? Got answers? Go here for both.

Moderator: MaxCoderz Staff

Post Reply
puromtec
New Member
Posts: 43
Joined: Fri 07 May, 2010 11:00 pm

.struct usage compilation error

Post 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.
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Re: .struct usage compilation error

Post 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).
puromtec
New Member
Posts: 43
Joined: Fri 07 May, 2010 11:00 pm

Re: .struct usage compilation error

Post 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.
Post Reply