Jump to content

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?




Link to comment
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).

Link to comment
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



stx old_copy ;save current switches

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.

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.

  • Recently Browsing   0 members

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