Sunday, January 16, 2011

today’s nintendo goal: completed!

download this here.

this screenshot is of a modified version of one of No Carrier’s tutorial programs. here’s a link to what my goal was - here.

i’ll keep your dashboard tidy and hide the rest of this behind the cut.

first, i added two variables for the horizontal and vertical positions of the sprite right after the variables that were already listed:

buttons EQU $20                 ; variables for the buttons
oldbuttons EQU $22
justpressed EQU $24

v_position EQU $6000
h_position EQU $6001

then i modified the rom header information to support the MMC1 mapper.

        .ORG $7ff0              ; start at $7ff0 - 16 byte .NES header (iNES format)
Header:                         ; this is used only for emulators
    .db “NES”, $1a
    .db $02
    .db $01
    .db %00000010
    .db %00000000
        .db $00
        .db $00
        .db $00
        .db $00
        .db $00
        .db $00
        .db $00

easy enough so far. next step, i’ll make it so when you press start, it saves the vertical and horizontal positions of the sprite to the two variables i created earlier.

CheckStart:
    LDA #%00001000
    AND justpressed
    BEQ CheckB

    lda $0500
    sta v_position

    lda $0503
    sta h_position

and now i’ll make it so when you press select, it will store the info from the variables into the horizontal and vertical positions of the sprite.

CheckSel:
    LDA #%00000100
    AND justpressed
    BEQ CheckStart


    lda v_position
    sta $0500

    lda h_position
    sta $0503


and that’s it! open the program, move the sprite around, save it’s position, close / reopen the program, then when you press select it will move the sprite to wherever you had saved it. works perfect. aside from those few changes, the code is exactly the same as what’s in the zip file i linked before.

this is pretty basic but i’m really excited that i’ve figured it out.

here’s a link to download my modified version of the sprite program - http://www.box.net/shared/5seixkoha1

Notes

  1. nintendomusicsuperstudio reblogged this from nickmaynard
  2. nickmaynard posted this