Results 1 to 14 of 14

Thread: Super Mario Bros. - 128 Lives Fix

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Bell (Level 8)
    Join Date
    Dec 2008
    Posts
    1,679
    Thanks Thanks Given 
    0
    Thanks Thanks Received 
    7
    Thanked in
    6 Posts

    Default

    Why would you LDA and INC the number of lives in that second example? It's pointless.

  2. The Following User Says Thank You to SparTonberry For This Useful Post:

    ColecoFan1981 (01-07-2024)

  3. #2
    Cherry (Level 1)
    Join Date
    Oct 2010
    Location
    Milwaukie (Oak Grove), Oregon
    Posts
    352
    Thanks Thanks Given 
    1
    Thanks Thanks Received 
    1
    Thanked in
    1 Post

    Default

    Quote Originally Posted by SparTonberry View Post
    Why would you LDA and INC the number of lives in that second example? It's pointless.
    The same would apply to the first example, too... I too would like to know why not to INC right after LDA? It might be because INC is like LDA #$01+STA.

    A better way to do this would be:
    Code:
    CheckLives:
        lda NumberofLives ;load the lives counter
        cmp #$7f          ;check if player has 127 lives
        bcs EndCheckL     ;skip to end of routine if so
        inc NumberofLives ;otherwise increment counter by one
    EndCheckL:
        rtl
    Saves a lot of bytes.

    Another way...
    Code:
    CheckLives:
        lda NumberofLives ;load the lives counter
        bmi EndCheckL     ;skip to end if negative flag set
        inc NumberofLives ;otherwise increment counter by one
    EndCheckL:
        rtl
    ~Ben
    Last edited by ColecoFan1981; 08-30-2023 at 10:25 PM.

  4. #3
    Cherry (Level 1)
    Join Date
    Oct 2010
    Location
    Milwaukie (Oak Grove), Oregon
    Posts
    352
    Thanks Thanks Given 
    1
    Thanks Thanks Received 
    1
    Thanked in
    1 Post

    Default

    Quote Originally Posted by SparTonberry View Post
    Why would you LDA and INC the number of lives in that second example? It's pointless.
    OK, I fixed the examples I listed. In SMAS, the lives counter is incremented first, and then reloaded to see if the target result has been met.

    ~Ben

Similar Threads

  1. Super Mario Bros. Toy - Two Ladders & Mario Luigi Figures
    By ZackyH in forum Buying and Selling
    Replies: 5
    Last Post: 10-31-2007, 02:06 AM
  2. FS: N64 Mario Kart 64, Mario Golf, Super Smash Bros $35
    By Perkar in forum Buying and Selling
    Replies: 2
    Last Post: 08-24-2006, 11:31 PM
  3. NEW Super Mario Bros. an evolution of classic 2D Mario
    By Jasoco in forum Classic Gaming
    Replies: 28
    Last Post: 05-19-2005, 03:25 PM
  4. FA: Mario Bros / Zelda Toy Chest, Super Mario 2 Inside Out
    By TisLord in forum Buying and Selling
    Replies: 2
    Last Post: 10-21-2004, 09:25 AM
  5. Everybody Rejoice ---- Super Mario Bros. Super Show! - Vol 1
    By www.consolegames.org in forum Classic Gaming
    Replies: 11
    Last Post: 06-28-2004, 04:28 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •