Yes its not bad what you have gathered, and also nice you try to do it out in the open. Ok, compliment mode off.
You can not log or view custom ignition angles in ZWIST (or any other variable for that matter) if you place them in ZWOUT. That is because they never passed through there. You change it right at the end of the chain. But if you log ZWOUT and see the number, you can be sure actual follows this.
That is what we have been telling you, but you seem to like the sightseeing tourist tour approach
let me help you:
ROM:008A4040 ; =============== S U B R O U T I N E =======================================
ROM:008A4040
ROM:008A4040
ROM:008A4040 als_zwoutset: ; CODE XREF: sub_89CD08:zwout_als1P
ROM:008A4040 ; sub_89CD08:loc_89CDA6P ...
ROM:008A4040 extp #0E0h, #1 ; 'a'
ROM:008A4044 movb rl6, B_alsflags
ROM:008A4048 cmpb rl6, #0
ROM:008A404C jmpr cc_NZ, als_zwout
ROM:008A404E
ROM:008A404E stk_zwout:
ROM:008A404E movb zwout, [r12]
ROM:008A4052 jmpr cc_UC, zwout_ret
Ok, all fine up to here. But then you totally screw things up!
ROM:008A4054 ; ---------------------------------------------------------------------------
ROM:008A4054
ROM:008A4054 als_zwout: ; CODE XREF: als_zwoutset+Cj
ROM:008A4054 movb rl4, #0E4h ; 'S' ------------------>this is your hardcoded value? (E4 translates to -21*)
ROM:008A4058 movb rl4, zwout ; ---------------------> ok, so whatever you just did, you erased it and placed zwout over it...
ROM:008A405C jmpr cc_UC, zwout_ret ; --------------> so now you jump back to the original code with zwout in rl4, but nothing new in zwout?
Read it, think about it and understand where the error is.
Advanced version of this:
To make the function more flexible, you can change the hardcoded number and place either a flash location (extp #8Ah, movb rl4, byte_8A1234 for example and place your editable angle there). Benefit of this is you place the
value somewhere safe, where people dont accidentally write the wrong parts of the code.
You can also make a seperate lookup function for 2D or 3D and have the result end in custom ram adress 0x381234. Then you can use this ram adress in your code (extp 0E0h, movb rl4, byte_381234). Benefit of this approach is you have a
variable that will be calculated from a map, conditions etc.