Users browsing this thread: 2 Guest(s)
Cursed Tintinabar
The main problem with your code is that some of the opcodes you're using use the stack relative addressing:
STA $00,s would store a value to the current stack address.
83, C3, and E3 should be changed to 85, C5, and E5 for direct addressing.
You also want to make sure you use an address for temp storage that isn't storing anything important, $1E should be fine since it's used as a temp in the original code.
Something like this:
Or you could use subtraction by addition:
The big advantage being no free space needed.
Code:
C0/D9E0: 83 00 STA $00,s
C0/D9E2: B9 09 16 LDA $1609,y
C0/D9E5: C3 00 CMP $00,s
C0/D9E7: 90 04 BCC $D9ED
C0/D9E9: A9 00 00 LDA #$0000
C0/D9EC: 60 RTS $60
C0/D9ED: E3 00 SBC $00,s
C0/D9EF: 60 RTS
83, C3, and E3 should be changed to 85, C5, and E5 for direct addressing.
You also want to make sure you use an address for temp storage that isn't storing anything important, $1E should be fine since it's used as a temp in the original code.
Something like this:
Code:
C0/D9E0: 85 1E STA $1E
C0/D9E2: B9 09 16 LDA $1609,y
C0/D9E5: C5 1E CMP $1E
C0/D9E7: 90 04 BCC $D9ED
C0/D9E9: A9 00 00 LDA #$0000
C0/D9EC: 60 RTS $60
C0/D9ED: E5 1E SBC $1E
C0/D9EF: 60 RTS
Or you could use subtraction by addition:
Code:
C0/4A7D: B9 1C 16 LDA $161C,y
C0/4A80: 4A LSR
C0/4A81: 4A LSR
C0/4A82: C2 21 REP #$21
C0/4A84: 49 FF FF EOR #$FFFF
C0/4A87: 79 09 16 ADC $1609,y
C0/4A8A: B0 01 BCS $4A8D
C0/4A8C: 7B TDC
C0/4A8D: 99 09 16 STA $1609,y
The big advantage being no free space needed.
« Next Oldest | Next Newest »
|
||||
Users browsing this thread: 2 Guest(s)