Users browsing this thread: 1 Guest(s)
Condensing Spell List in Battle
10-04-2017, 11:46 PM
for giggles, was wondering how to do that with minimal revamping. i wonder if tweaking my algorithm posted on 9/17 could do it (stuff between dotted lines is new):
or maybe the X and Y even/odd test should be before the X==Y test? and we'd probably want A in 16-bit mode here.
no, i'm not suggesting that untested code should replace proven code with dual list thresholds and various optimizations built into it.
just that the +1 advancement is more apparent within that algorithm to me. and indulging weeks-after-the-fact suggestions is alright when the method only takes 5 minutes to concoct. (yet somehow typing the rest of this post took me a good 15 minutes. wtf?)
Code:
stx $f0
cpy $f0 ; does full list index == output index? yes, i use
; this variable in a single place, because no other
; easy way to compare X and Y. :/
beq noCopy ; skip copying if so, but still advance
-----
tya
eor $f0
and #$04 ; does even/odd-ness of input index match that
; of output index?
beq noColumnChange ; branch if so
inx
inx
inx
inx ; move one output slot forward
noColumnChange:
-----
clc
rep #$20
copyLoop:
lda ($F2),Y ; read two spell menu bytes from original position
phy
txy
sta ($F2),Y ; save to new position
or maybe the X and Y even/odd test should be before the X==Y test? and we'd probably want A in 16-bit mode here.
no, i'm not suggesting that untested code should replace proven code with dual list thresholds and various optimizations built into it.
just that the +1 advancement is more apparent within that algorithm to me. and indulging weeks-after-the-fact suggestions is alright when the method only takes 5 minutes to concoct. (yet somehow typing the rest of this post took me a good 15 minutes. wtf?)
« Next Oldest | Next Newest »
Users browsing this thread: 1 Guest(s)