assembly for two cogs
electric550
Posts: 122
I was wondering if anyone had a recommendation on formatting assembly code for two cogs in on document. Does it require two org statements and two fit statements. Or should I split the two programs into two different files and call them as objects? If there is an example that someone could point me to, or a suggestion would be good.
For example
I am just trying to make sure that assembly gets loaded into its own cog. I assume that when cog new gets called it loads the assembly from the specified identifier until it reaches the fit statement?
For example
CON ........... OBJ .......... Var long var1 long var2 Pub Start cognew(@Assembly1,@var1) cognew(@Assembly2,@var2) DAT '-------------------------------------------------------------- org 0 Assembly1 MOV V1, PAR V1 res 1 FIT 496 '-------------------------------------------------------------- org 0 Assembly2 MOV V2, PAR V2 res 1 FIT 496
I am just trying to make sure that assembly gets loaded into its own cog. I assume that when cog new gets called it loads the assembly from the specified identifier until it reaches the fit statement?
Comments
Nick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!
The DIY Digital-Readout for mills, lathes etc.:
YADRO
The ORG is a compiler statement which tells the compiler how to translate the HUB adresses (that's where the PASM code lives during program-load) to the COG adresses (that's where the program shall run). It's an offset that has to be used in all the labels you use inside of that DAT section. The FIT is a compiler statement which tells you if a PASM program is to big to fit into the COG-RAM. If you are sure that your PASM is smaller you don't really need it.
So, if you have 2 PASM parts in your program, you need 2 ORG 0 statements if these PASM programs are started in a COG. Only in case you work with overlays, then it makes sense to have an ORG statement which is different from 0.
PS: My guess is you don't need 2 DAT sections, but because of the different colors it makes sense as you can distinguish the different PASM programs.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Composite NTSC sprite driver: Forum
NTSC & PAL driver templates: ObEx Forum
OnePinTVText driver: ObEx Forum