Jump to content
Sign in to follow this  
Propane13

Implementing Pause

Recommended Posts

Maybe my synapses just aren't firing today.

 

I can't seem to find the info on how to implement the Pause buttonin 7800 code when I search the forums and the 7800 programmer's guide-- but it's gotta be somewhere, so I must just be overlooking it..

 

Could someone point me in the right direction?

 

Regards,

-John

Share this post


Link to post
Share on other sites

It on port SWCHB data bit three. When you press the console's PAUSE switch the data bit goes low. If that happens put your game into pause mode. If the player presses PAUSE again then go back to game mode. You might need a bit of switch debouncing too.

Share this post


Link to post
Share on other sites

AFAIK it's the same as reading the color/B&W switch for 2600 programming...bit 3 of SWCHB (address $0282). What you need to do is use an additional ram bit of storage to hold a current game state (i.e. paused or not paused) as well as a bit to hold a copy of what the switch state was on the previous frame...and only flip the former when the latter changes from %1000 to %0000 (i.e. the switch is initially being pressed).

Share this post


Link to post
Share on other sites

An example here. To keep things simple, I stored SWCHB to a full byte...but you can probably notice how to trim that down to a single bit.

 

 

lda SWCHB ;get new switches

tax ;save for later

eor old_copy ;compare with old

and #$08 ;keep only pause switch

beq QUIT ;branch if no change

and old_copy ;was it on (and now off)?

beq QUIT ;branch if not

lda game_state

eor #PAUSE_FLAG ;flip pause status

sta game_state ;and update game state

 

QUIT

stx old_copy ;save current switches

Share this post


Link to post
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.

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...