Users browsing this thread: 1 Guest(s)
Expansion of Treasure Chest subroutine

#7
Posts: 200
Threads: 1
Thanks Received: 10
Thanks Given: 0
Joined: Oct 2015
Reputation: 18
Status
None
C0/D722:

for accuracy: switch the order of the $22 and $24 operations, so you can then rotate the Carry from the low bytes into the high.
for speed and size: also, there's no need to load them into A.

Code:
ASL $22
ROL $24

----

C0/D737: unless you plan to alter other CPU flags here, "CLC" is smaller.

----

for a similar but smaller way to do your non-special-register multiplication, look at C1/1867 and C1/18F4.  here's the former since Slick is down for an eternity now:
Code:
(Multiply 16-bit $2E by 8-bit $2C, and put result in 32-bit $30-$33.
Wow, this and C1/18F4 are total clones.)

C1/1867: 64 30        STZ $30
C1/1869: 64 32        STZ $32
C1/186B: 64 34        STZ $34
C1/186D: A2 08 00     LDX #$0008
C1/1870: 46 2C        LSR $2C
C1/1872: 90 0D        BCC $1881
C1/1874: A5 30        LDA $30
C1/1876: 18           CLC
C1/1877: 65 2E        ADC $2E
C1/1879: 85 30        STA $30
C1/187B: A5 32        LDA $32
C1/187D: 65 34        ADC $34
C1/187F: 85 32        STA $32
C1/1881: 06 2E        ASL $2E
C1/1883: 26 34        ROL $34
C1/1885: CA           DEX
C1/1886: D0 E8        BNE $1870
C1/1888: 60           RTS
Quote  
[-] The following 1 user says Thank You to assassin for this post:
  • NPCnextdoor (07-15-2018)



Messages In This Thread
RE: Expansion of Treasure Chest subroutine - by assassin - 07-15-2018, 01:01 AM

Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite