Annoying PropTool 1.2 Bug/Feature
hippy
Posts: 1,981
This fails to compile ...
This works ...
Obviously there is a workround but it's not aesthetically pleasing.
Added : Dang ! @var1 and @var2 are given the same value
Post Edited (hippy) : 9/1/2008 8:25:34 PM GMT
PUB GetVar1Address | a1, a2 a1 := @var1 a2 := @var2 DAT org $000 var1 res 1 var2 res 1
This works ...
PUB GetVar1Address
a1 := @var1
a2 := @var2
DAT org $000
var1
res 1
var2
res 1
Obviously there is a workround but it's not aesthetically pleasing.
Added : Dang ! @var1 and @var2 are given the same value

Post Edited (hippy) : 9/1/2008 8:25:34 PM GMT

Comments
Post Edited (Mike Green) : 9/1/2008 6:25:28 PM GMT
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Still some PropSTICK Kit bare PCBs left!
The behaviour makes some sense in so far that @var1 and @var2 will be correct hub addresses for something like this ...
var1 long 123 res 10 var2 long 456IMO, @label should give the hub address the cog location was loaded from, or would have been loaded from.
It would also be useful to have @$label to get the cog location ( "$" being the 'current cog location counter ) which as Mike notes is missing.
Your first example would make sense, assuming @var1 == @var2 == 0. I can see the logic of flagging it as an error, though, since a beginner might erroneously expect the RES to reserve space in cog memory. I like the @$label idea and can see where it would come in handy. Not even the following would give the desired result in the present framework (the error notwithstanding):
... x := @label1 - @origin ... DAT origin ORG 0 ... label0 RES 1 label1 RES 1-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'Still some PropSTICK Kit bare PCBs left!
The code I now have is ..
OVERLAY GetArg mov $1F7,GetArg_Ret sub $1F7,#1 movd :PtrGet,$1F7 mov $1F7,PAR :PtrInc add $1F7,#0 :PtrGet rdlong 0-0,$1F7 add :PtrInc,#4 GetArg_Ret ret OVERLAY_END org OVERLAY opc res 1 lhs res 1 rhs res 1 OVERLAY_opc word opc OVERLAY_lhs word lhs OVERLAY_rhs word rhsWhereas I was using "cogAddress = ( @label - @PASM_BASE ) >> 2" I'm now using "@OVERLAY_label" when needed and -
PRI GetCogAddress( atCogLabel ) if atCogLabel => @OVERLAY_END return word[noparse][[/noparse] atCogLabel ] else return ( atCogLabel - @PASM_BASE) >> 2