Question about variables across cogs / across spin and assembly
Hi, it's been a long time since my last propeller project, and I've forgot quite a bit. Lately I was trying to hack the maccasoft VGA serial terminal, adding the ability to strip the MSB from incoming characters.
My question is here in my fork: https://github.com/sbelectronics/prop_ser_term/blob/ae8f5034cd4aa27d5ca89f457e7fe05d361e3672/src/terminal.spin#L588
I tried to set a variable called mode7bit. Setting this variable works fine if done prior to initializing the vt100 cog (see line 225 for a working example). I'm reading this variable from line 890 using rdbyte
which I understand reads from hub memory. So it seems to me the change should work fine from one cog to another.
This terminal does make use of "overlays" which is a technique that I didn't use back during my active propeller years, so I'm not sure if there's something I'm just not understanding.
Anyhow, can any spin or pasm experts spot where my problem is? Simply hitting the reset button after changing my settings is fine, but it would be nice to understand what the issue is.
Also, where have all the prop folks gone? I remember this place as being bustling with activity, but I don't see many of the familiar faces.
Thanks,
Scott
Comments
mode7bit
is defined as an initialized cog register. So you can change its initial value before you launch the cog by assigning to it. When the cog is launched it gets copied into that cog's cog RAM with whatever value it has at the time.This is not how RDBYTE works. What this will do is read a byte from hub memory at the address stored in
mode7bit
(in your case 0000 or 0001). The reason this appears to work is because the first bytes in hub are normally 00 B4 C4 04 (because clkfreq is usually 80000000), so reading a byte from address zero will actually return zero.If you want this to work, you can set
mode7bit := @mode7bit
before starting, though that'll confuse people reading the code :PThanks, this makes a lot of sense!
Some will be waiting for the Prop2 docs to be fleshed out before diving in on that.
Many of the talkers possibly have moved on to other pastures. RaspberryPi likely clean out a lot of 'em over the years. And a number have died of old age too.
There is new names showing up still.