Calling a 2nd object's ASM Code directly
Steel
Posts: 313
Is there a way to directly call ASM code in a different object?
I know you can use object1 to call a sub-routine in object2·that then calls·the ASM in Object2...But I would like to call the ASM in Object2 directly from Object1.
The reason is that Object1 is the location for my global variables.· I need the ASM in object2 to talk to these variables·while the code is running.
If I just call a sub-routine to start the ASM, I just pass the variables along...but then that is it.· The ASM in object2 doesn't actually see the·global variables...only what you passed it at passing time.
I would like the ASM in Object2 to be able to directly talk to the Global Variables in Object1.
Has anybody done this?
Thanks
Shaun
Post Edited (Steel) : 8/7/2007 11:42:30 PM GMT
I know you can use object1 to call a sub-routine in object2·that then calls·the ASM in Object2...But I would like to call the ASM in Object2 directly from Object1.
The reason is that Object1 is the location for my global variables.· I need the ASM in object2 to talk to these variables·while the code is running.
If I just call a sub-routine to start the ASM, I just pass the variables along...but then that is it.· The ASM in object2 doesn't actually see the·global variables...only what you passed it at passing time.
I would like the ASM in Object2 to be able to directly talk to the Global Variables in Object1.
Has anybody done this?
Thanks
Shaun
Post Edited (Steel) : 8/7/2007 11:42:30 PM GMT
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
___________________________________
OBJECT1 SPIN CODE:
CON
· {required constants}
OBJ
··OBJ2· : "OBJECT_2"
VAR
····· LONG VARTOPASS
PUB
····· OBJ2.START(@VARTOPASS)
····· ....other code here....
DATA
····· .........
_________________________________________
________________________________________
OBJECT_2 SPIN CODE:
CON
····· {REQUIRED CON HERE}
VAR
PUB START(POINTER)
····· COGINIT(1,@ASM_CODE_START, POINTER)
DAT
······· ORG ·0
·· ASM_CODE_START
······· MOV· ····· PTR,·············· PAR
······· RDLONG··· PASSED_DATA, PTR
·PTR··············· long· $0
·PASSED_DATA· long ·$0
_________________________________________
For example, why are you using COGINIT rather than COGNEW? How do you know what cogs are available?