Jump to content
IGNORED

Stella Debugger Trapping a Bit


Karl G

Recommended Posts

IIRC, this functionality is already built in.  It basically makes use of the '&' operator to look at specific bits.  There are built-in functions that use it, so you could write your own expression to do it too.  This is from the 'help' command in the debugger:

Quote

Built-in functions:
_joy0left   {!(*SWCHA & $40)}   Left joystick moved left
_joy0right  {!(*SWCHA & $80)}   Left joystick moved right
_joy0up     {!(*SWCHA & $10)}   Left joystick moved up
_joy0down   {!(*SWCHA & $20)}   Left joystick moved down
_joy0button {!(*INPT4 & $80)}   Left joystick button pressed
_joy1left   {!(*SWCHA & $04)}   Right joystick moved left
_joy1right  {!(*SWCHA & $08)}   Right joystick moved right
_joy1up     {!(*SWCHA & $01)}   Right joystick moved up
_joy1down   {!(*SWCHA & $02)}   Right joystick moved down
_joy1button {!(*INPT5 & $80)}   Right joystick button pressed
_select     {!(*SWCHB & $02)}   Game Select pressed
_reset      {!(*SWCHB & $01)}   Game Reset pressed
_color      {*SWCHB & $08   }   Color/BW set to Color
_bw         {!(*SWCHB & $08)}   Color/BW set to BW
_diff0b     {!(*SWCHB & $40)}   Left diff. set to B (easy)
_diff0a     {*SWCHB & $40   }   Left diff. set to A (hard)
_diff1b     {!(*SWCHB & $80)}   Right diff. set to B (easy)
_diff1a     {*SWCHB & $80   }   Right diff. set to A (hard)

Note the "& $xx" parts above.  This is only looking at those specific bits.  Since this is using a conditional expression, you need to use the 'IF' versions of trap: trapif, trapreadif, trapwriteif.  In your case, you would use the very last one.  As always, the manual is your friend ?

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...