Gear Emulator
dr hydra
Posts: 212
How accurate is the gear emulator:
look at the code below...what would x1 equal after the program is ran
CON
······· _clkmode······· = xtal1 + pll8x
······· _xinfreq······· = 10_000_000 + 3000
PUB ex01
cognew(@ex01A, 0)
DAT
ORG 0
ex01A
······· add x1,x2
·······
x1····· long 5000
x2····· long· 2000
FIT 496
look at the code below...what would x1 equal after the program is ran
CON
······· _clkmode······· = xtal1 + pll8x
······· _xinfreq······· = 10_000_000 + 3000
PUB ex01
cognew(@ex01A, 0)
DAT
ORG 0
ex01A
······· add x1,x2
·······
x1····· long 5000
x2····· long· 2000
FIT 496
Comments
Why don't you tell us?
Post Edited (kuroneko) : 6/16/2010 1:26:45 AM GMT
What's that about?
Jim
Try putting a jmp #$ after the add and see what happens.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"I mean, if I went around sayin' I was an emperor just because some moistened bint had lobbed a scimitar at me they'd put me away!"
7000 [noparse]:)[/noparse]
Post Edited (kuroneko) : 6/16/2010 1:34:15 AM GMT
The jmp#$ works...but why
Because it stops the cog running off and executing random data.
Picture it this way. The cog is your car. You are driving on an incomplete overhead freeway (the cog is executing the code). Suddenly you find the road stops as its only half built and your car falls off the end (you have no more valid code after the add). What happens to your car?
Now see the same scenario with a big flashing roadblock where the road ends (jmp #$). You stop your car and sit there. You don't die.
Without the roadblock, the cog merrily goes along its way trying to drive over everything in front of it, executing random code that has been loaded from the cog and doing unpredictable things. Put the road block in front of it and it sits there spinning its wheels waiting for something to happen.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"I mean, if I went around sayin' I was an emperor just because some moistened bint had lobbed a scimitar at me they'd put me away!"
So it puts the cog into an endless spinning loop doing nothing at full speed.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"I mean, if I went around sayin' I was an emperor just because some moistened bint had lobbed a scimitar at me they'd put me away!"
Thank you..thank you...I spent all day working on this