Code: Select all
calc_var, push XY regs to the stack
07:E791: 8A TXA
07:E792: 48 PHA
07:E793: 98 TYA
07:E794: 48 PHA
clear result
>07:E795: A9 00 LDA #$00
07:E797: 85 33 STA $33 tmp_var2result_lo = #$3B
07:E799: 85 34 STA $34 tmp_var2result_hi = #$95
loop:
end sub if tmp_var0 = 0
07:E79B: A5 30 LDA $30 tmp_var0_hi = #$00
07:E79D: 05 2F ORA $2F tmp_var0_lo = #$08
07:E79F: F0 21 BEQ $E7C2 end_sub_carry_clear
tmp_var0 / 2
07:E7A1: 46 30 LSR $30 tmp_var0_hi = #$00
07:E7A3: 66 2F ROR $2F tmp_var0_lo = #$08
07:E7A5: 90 0F BCC $E7B6
07:E7A7: 18 CLC
var2 += var1
07:E7A8: A5 33 LDA $33 tmp_var2result_lo = #$3B
07:E7AA: 65 31 ADC $31 tmp_var1_lo = #$10
07:E7AC: 85 33 STA $33 tmp_var2result_lo = #$3B
07:E7AE: A5 34 LDA $34 tmp_var2result_hi = #$95
07:E7B0: 65 32 ADC $32 tmp_var1_hi = #$00
07:E7B2: 85 34 STA $34 tmp_var2result_hi = #$95
07:E7B4: B0 06 BCS $E7BC end_sub_carry_set
tmp_var1 * 2
07:E7B6: 06 31 ASL $31 tmp_var1_lo = #$10
07:E7B8: 26 32 ROL $32 tmp_var1_hi = #$00
07:E7BA: 90 DF BCC $E79B loop
end_sub_carry_set:
07:E7BC: 68 PLA
07:E7BD: A8 TAY
07:E7BE: 68 PLA
07:E7BF: AA TAX
07:E7C0: 38 SEC
07:E7C1: 60 RTS-------------------------
end_sub_carry_clear:
07:E7C2: 68 PLA
07:E7C3: A8 TAY
07:E7C4: 68 PLA
07:E7C5: AA TAX
07:E7C6: 18 CLC
07:E7C7: 60 RTS-------------------------
1. I'm not sure what the point of "E7A5 BCC $E7B6" is. It's looking at the lowest bit of the lowest byte and branching if it's one? So something to do with odd/even numbers
2. Because of the two branches (there's another at E7BA) I'm not really able to understand the code as whole. Could someone please help me understand it?
Thanks.