Submitted by Steve Fewell
Routine:setnumericvar
Name: Store numerical value in the specified variable
Starting Address: &B32B
Entry criteria: Either the IWA or the FWA
contains the value & the variable address and type details are stored on the Stack (3 bytes).
Exit: The specified variable has been set to the numerical value from the IWA or FWA.
Description:
(if called from &B328 then evaluate the expression value (this will be the value that we
will set the variable to).
Temporarily pop the return address from the Stack (that is the address to return to after the end
of subroutine RTS statement!).
Pop the variable return type from the stack and store this value in &39.
Pop the Variable value address from the stack and store this address in &37-&38.
Push the return address back onto the stack.
If called from &B338, then the stack manipulation is skipped, as the variable address details and variable type
information has already been set (and ae not located on the stack).
B325 | L | 076 146 144 | 4C 92 90 | JMP &9092 Type mismatch error |
B328 | ; | 032 059 157 | 20 3B 9D | JSR &9D3B Get result of expression |
B32B | z | 122 | 7A | PLY |
B32C | 250 | FA | PLX | |
B32D | h | 104 | 68 | PLA |
B32E | 9 | 133 057 | 85 39 | STA &39 |
B330 | h | 104 | 68 | PLA |
B331 | 8 | 133 056 | 85 38 | STA &38 |
B333 | h | 104 | 68 | PLA |
B334 | 7 | 133 055 | 85 37 | STA &37 |
B336 | 218 | DA | PHX | |
B337 | Z | 090 | 5A | PHY |
B338 | 9 | 165 057 | A5 39 | LDA &39 |
B33A | 201 005 | C9 05 | CMP#&05 | |
B33C | " | 240 034 | F0 22 | BEQ 34 --> &B360 Set Float variable |
B33E | ' | 165 039 | A5 27 | LDA &27 |
B340 | 240 227 | F0 E3 | BEQ -29 --> &B325 issue 'Type mismatch' error | |
B342 | 016 003 | 10 03 | BPL 3 --> &B347 Store IWA to address | |
B344 | 032 195 150 | 20 C3 96 | JSR &96C3 Convert Float to Integer | |
B347 | ... Store IWA to address [iout] |
B360 | ' | 165 039 | A5 27 | LDA &27 |
B362 | 240 193 | F0 C1 | BEQ -63 --> &B325 Issue 'Type mismatch' error | |
B364 | 0 | 048 003 | 30 03 | BMI 3 --> &B369 |
B366 | 032 133 129 | 20 85 81 | JSR &8185 Convert Integer to Floating-Point | |
B369 | 0 | 165 048 | A5 30 | LDA &30 |
B36B | 7 | 146 055 | 92 37 | STA (&37) |
B36D | 160 001 | A0 01 | LDY#&01 | |
B36F | . | 165 046 | A5 2E | LDA &2E |
B371 | E1 | 069 049 | 45 31 | EOR &31 |
B373 | ) | 041 128 | 29 80 | AND#&80 |
B375 | E1 | 069 049 | 45 31 | EOR &31 |
B377 | 7 | 145 055 | 91 37 | STA (&37),Y |
B379 | 200 | C8 | INY | |
B37A | 2 | 165 050 | A5 32 | LDA &32 |
B37C | 7 | 145 055 | 91 37 | STA (&37),Y |
B37E | 200 | C8 | INY | |
B37F | 3 | 165 051 | A5 33 | LDA &33 |
B381 | 7 | 145 055 | 91 37 | STA (&37),Y |
B383 | 200 | C8 | INY | |
B384 | 4 | 165 052 | A5 34 | LDA &34 |
B386 | 7 | 145 055 | 91 37 | STA (&37),Y |
B388 | ` | 096 | 60 | RTS |