Breakable Tools - Need Help
#2
Well, you don't need to worry about the SEP #$20 in this case. Serity's been teaching me about the stack variables and the accumulator and because you used PHP to push it, all that accumulator stuff will be reset with the PLP to pull it back.

I'm inclined to suggest that maybe you should explicitly set $32F4,X with the tool identity in the no_break branch. That would involve preserving that first A, though, before you even multiply it by 30... either in a scratch variable or by loading its value from the stack. The later requires an intimate knowledge of what's on the stack and how tall it is, though, so I'm not sure what value you'd use.

It uses the first in last out method, though... so perhaps it's as simply as LDA $02,S, because A was pushed onto the stack in the subroutine and then P was.

So... you could maybe try this for no_break:
Code:
no_break:
LDA #$10
TSB $B1        ;  set flag to re-add item to inventory at the end of the character's turn
SEP #$10       ;  Set 8-bit X and Y
TYX
LDA $02,S    ; Load A's original value from the stack?
STA $32F4,X    ;  Save as tool to add back to inventory, just to be safe.
LDA $3018,X
Reply


Messages In This Thread
Breakable Tools - Need Help - by PowerPanda - 07-05-2021, 02:36 PM
RE: Breakable Tools - Need Help - by C-Dude - 07-05-2021, 03:31 PM
RE: Breakable Tools - Need Help - by PowerPanda - 07-05-2021, 05:36 PM
RE: Breakable Tools - Need Help - by C-Dude - 07-05-2021, 06:10 PM
RE: Breakable Tools - Need Help - by SirNewtonFig - 07-05-2021, 06:50 PM
RE: Breakable Tools - Need Help - by PowerPanda - 07-05-2021, 09:42 PM
RE: Breakable Tools - Need Help - by C-Dude - 07-06-2021, 12:00 AM
RE: Breakable Tools - Need Help - by Gi Nattak - 07-06-2021, 12:41 AM
RE: Breakable Tools - Need Help - by C-Dude - 07-06-2021, 01:27 AM
RE: Breakable Tools - Need Help - by PowerPanda - 07-06-2021, 10:31 AM
RE: Breakable Tools - Need Help - by Gi Nattak - 07-06-2021, 10:45 AM
RE: Breakable Tools - Need Help - by C-Dude - 07-06-2021, 03:16 PM
RE: Breakable Tools - Need Help - by SirNewtonFig - 07-07-2021, 06:54 AM
RE: Breakable Tools - Need Help - by PowerPanda - 07-07-2021, 09:51 AM
RE: Breakable Tools - Need Help - by Bropedio - 07-07-2021, 10:31 AM
RE: Breakable Tools - Need Help - by SirNewtonFig - 07-07-2021, 01:28 PM
RE: Breakable Tools - Need Help - by Subtraction - 07-07-2021, 11:38 AM
RE: Breakable Tools - Need Help - by PowerPanda - 07-07-2021, 04:10 PM
RE: Breakable Tools - Need Help - by C-Dude - 07-07-2021, 05:33 PM
RE: Breakable Tools - Need Help - by SirNewtonFig - 07-08-2021, 08:21 AM
RE: Breakable Tools - Need Help - by SirNewtonFig - 07-08-2021, 02:16 PM
RE: Breakable Tools - Need Help - by C-Dude - 07-08-2021, 05:31 PM
RE: Breakable Tools - Need Help - by Bropedio - 07-07-2021, 05:46 PM
RE: Breakable Tools - Need Help - by C-Dude - 07-07-2021, 06:18 PM
RE: Breakable Tools - Need Help - by PowerPanda - 07-07-2021, 09:24 PM
RE: Breakable Tools - Need Help - by C-Dude - 07-08-2021, 01:40 AM
RE: Breakable Tools - Need Help - by PowerPanda - 07-08-2021, 11:14 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Glitchy Animation (Tools) Kugawattan 2 3,486 01-01-2016, 08:00 PM
Last Post: Kugawattan
  Tools to Techniques? Royaken 5 5,521 04-23-2014, 01:04 PM
Last Post: Royaken
  Problems with modifying Edgar's Tools BohepansTheFirst 2 3,373 04-10-2014, 03:54 PM
Last Post: Xenovant
  editing tools (chainsaw, drill, flash, ...) luxador 10 14,322 06-05-2013, 02:19 PM
Last Post: madsiur

Forum Jump:


Users browsing this thread: 1 Guest(s)