It is currently Mon Nov 19, 2018 12:27 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Thu May 10, 2018 6:07 pm 
Offline

Joined: Thu May 10, 2018 5:47 pm
Posts: 3
nondisassembeled code

; iNES Header
; .inesprg 1 ; 1x 16KB bank of PRG code
; .ineschr 1 ; 1x 8KB bank of CHR data
; .inesmap 0 ; mapper 0 = NROM, no bank swapping
; .inesmir 1 ; background mirroring (ignore for now)


; $0000-0800 - Internal RAM, 2KB chip in the NES
; $2000-2007 - PPU access ports
; $4000-4017 - Audio and controller access ports
; $6000-7FFF - Optional WRAM inside the game cart
; $8000-FFFF - Game cart ROM

; iNES Header
; The 16 byte iNES header gives the emulator all the information about the game including mapper, graphics mirroring, and PRG/CHR sizes. You can include all this inside your asm file at the very beginning.
.inesprg 1 ; 1x 16KB PRG code
.ineschr 1 ; 1x 8KB CHR data
.inesmap 0 ; mapper 0 = NROM, no bank swapping
.inesmir 1 ; background mirroring



;; DECLARE SOME VARIABLES HERE
.rsset $0000 ;;start variables at ram location 0 in zero page memory

loopCount .rs 1 ; count the loop
playerx .rs 1 ; players x pos
playervx .rs 1 ; players x vel
playery .rs 1 ; players y pos
playervy .rs 1 ; player y vel (negative is up)
controller1 .rs 1 ; controller 1 button vector

gravity .rs 1 ; gravity


ground .rs 1 ; y value of the ground
inAir .rs 1

enemyx .rs 1
enemyy .rs 1

backgroundLo .rs 1
backgroundHi .rs 1
counterLo .rs 1
counterHi .rs 1


scroll .rs 1 ; horizontal scroll count
nametable .rs 1 ; which nametable to use, 0 or 1
columnLow .rs 1 ; low byte of new column address
columnHigh .rs 1 ; high byte of new column address
sourceLow .rs 1 ; source for column data
sourceHigh .rs 1
columnNumber .rs 1 ; which column of level data to draw


;;;;;;;;;;;;;;;
; NES is powererd on
;
.bank 0 ; NESASM arranges things into 8KB chunks, this is chunk 0
.org $C000 ; Tells the assembler where to start in this 8kb chunk
RESET:
SEI ; disable IRQs
CLD ; disable decimal mode, meant to make decimal arithmetic "easier"
LDX #$40
STX $4017 ; disable APU frame IRQ
LDX #$FF
TXS ; Set up stack
INX ; now X = 0
STX $2000 ; disable NMI
STX $2001 ; disable rendering
STX $4010 ; disable DMC IRQs

vblankwait1: ; First wait for vblank to make sure PPU is ready
BIT $2002
BPL vblankwait1

;; Helper to wipe memory
clrmem:
LDA #$00
STA $0000, x
STA $0100, x
STA $0300, x
STA $0400, x
STA $0500, x
STA $0600, x
STA $0700, x
LDA #$FE
STA $0200, x ;move all sprites off screen
INX
BNE clrmem

vblankwait2: ; Second wait for vblank, PPU is ready after this
BIT $2002
BPL vblankwait2

;;;;;;;;;;;;;;;;;;;;;;
; Load game pallets
LoadPalettes:
LDA $2002 ; read PPU status to reset the high/low latch
LDA #$3F ; max out 0011 1111
STA $2006 ; write the high byte of $3F00 address
LDA #$00
STA $2006 ; write the low byte of $3F00 address
LDX #$00 ; start out at 0
LoadPalettesLoop:
LDA palette, x ; load data from address (palette + the value in x)
; 1st time through loop it will load palette+0
; 2nd time through loop it will load palette+1
; 3rd time through loop it will load palette+2
; etc
STA $2007 ; write to PPU
INX ; X = X + 1
CPX #$20 ; Compare X to hex $10, decimal 16 - copying 16 bytes = 4 sprites
BNE LoadPalettesLoop ; Branch to LoadPalettesLoop if compare was Not Equal to zero


LoadSprites:
LDX #$00 ; start at 0
LoadSpritesLoop:
LDA playersprite, x ; load data from address (sprites + x)
STA $0200, x ; store into RAM address ($0200 + x)
INX ; X = X + 1
CPX #$1C ; Compare X to hex $20, decimal 32
BNE LoadSpritesLoop ; Branch to LoadSpritesLoop if compare was Not Equal to zero
; if compare was equal to 32, keep going down


;; Background is 960 bytes 240 * 4
LoadBackground:
LDA $2002 ; read PPU status to reset the high/low latch
LDA #$20
STA $2006 ; write the high byte of $2000 address
LDA #$00
STA $2006 ; write the low byte of $2000 address
LDX #$00 ; start out at 0

;; we need to copy more that 256
LDA #LOW(background)
STA backgroundLo
LDA #HIGH(background)
STA backgroundHi
;; 960 bytes = $03C0
LDA #$C0;
STA counterLo
LDA #$03
STA counterHi

LDY #$00; keep y zero, we jut need y to be init to 0 for indirect index mode to work in the square bracket
LoadBackgroundLoop:
LDA [backgroundLo], y ; load data from background
STA $2007 ; write to PPU data port to copy to background data
LDA backgroundLo ; load the low byte of the background address into A
CLC ; clear the carry bit
ADC #$01 ; add 1 to A
STA backgroundLo ; store A back into the mem addr
LDA backgroundHi ; load the high byte of the background address into A
ADC #$00 ; add 0, but if there is a carry (overflow) add 1
STA backgroundHi ; inc poitner to the next byte if necessary

LDA counterLo ; load the counter low byte
SEC ; set cary flag
SBC #$01 ; subtract with carry by 1
STA counterLo ; store the low byte of the counter
LDA counterHi ; load the high byte
SBC #$00 ; sub 0, but there is a carry
STA counterHi ; decrement the loop counter

LDA counterLo ; load the low byte
CMP #$00 ; see if it is zero, if not loop
BNE LoadBackgroundLoop
LDA counterHi
CMP #$00 ; see if the high byte is zero, if not loop
BNE LoadBackgroundLoop ; if the loop counter isn't 0000, keep copying


;LDA background, x ; load data from address (background + the value in x)
;STA $2007 ; write to PPU
;INX ; X = X + 1
;CPX #$80 ; Compare X to hex $80, decimal 128 - copying 128 bytes
;BNE LoadBackgroundLoop ; Branch to LoadBackgroundLoop if compare was Not Equal to zero
; if compare was equal to 128, keep going down

LoadAttribute:
LDA $2002 ; read PPU status to reset the high/low latch
LDA #$23
STA $2006 ; write the high byte of $23C0 address
LDA #$C0
STA $2006 ; write the low byte of $23C0 address
LDX #$00 ; start out at 0
LoadAttributeLoop:
LDA attribute, x ; load data from address (attribute + the value in x)
STA $2007 ; write to PPU
INX ; X = X + 1
CPX #$40 ; Compare X to hex $40, decimal 64
BNE LoadAttributeLoop ; Branch to LoadAttributeLoop if compare was Not Equal to zero
; if compare was equal to 128, keep going down


; PPUCTRL ($2000)
; 76543210
; | ||||||
; | ||||++- Base nametable address
; | |||| (0 = $2000; 1 = $2400; 2 = $2800; 3 = $2C00)
; | |||+--- VRAM address increment per CPU read/write of PPUDATA
; | ||| (0: increment by 1, going across; 1: increment by 32, going down)
; | ||+---- Sprite pattern table address for 8x8 sprites (0: $0000; 1: $1000)
; | |+----- Background pattern table address (0: $0000; 1: $1000)
; | +------ Sprite size (0: 8x8; 1: 8x16)
; |
; +-------- Generate an NMI at the start of the
; vertical blanking interval vblank (0: off; 1: on)
LDA #%10010000 ; enable NMI, sprites from Pattern Table 0, background from Pattern Table 1
STA $2000

; PPUMASK ($2001)
; binary byte flags
; 76543210
; ||||||||
; |||||||+- Grayscale (0: normal color; 1: AND all palette entries
; ||||||| with 0x30, effectively producing a monochrome display;
; ||||||| note that colour emphasis STILL works when this is on!)
; ||||||+-- Disable background clipping in leftmost 8 pixels of screen
; |||||+--- Disable sprite clipping in leftmost 8 pixels of screen
; ||||+---- Enable background rendering
; |||+----- Enable sprite rendering
; ||+------ Intensify reds (and darken other colors)
; |+------- Intensify greens (and darken other colors)
; +-------- Intensify blues (and darken other colors)
LDA #%00011110 ; enable sprites, enable background, no clipping on left side
STA $2001


;;;;;;;;;;;;;;;;;;;;
; Initialze some game state variables
InitialzeState:
LDA #$80 ; player x offset
STA playerx

LDA #$00 ; player y offset
STA playery
LDA #$C8 ; player y offset
STA ground

LDA #$00 ; controller state
STA controller1
STA playervx;
STA playervy;
STA loopCount

LDA #$03
STA gravity




Forever:
JMP Forever ;jump back to forever MAINLOOP will interrupt for game logic, infinite loop to keep the rom from exiting

;; Game main loop
MAINLOOP: ; non-maskable interrupt (draw screen)
;; Needs to be done every frame
;; Load graphics into PPU from the memory
LDA #$00 ; load 1 bytes of 0 in A
STA $2003 ; set the low byte (00) of the RAM address
LDA #$02 ; load 1 byte of $02,
STA $4014 ; set the high byte (02) of the RAM address, start the transfer

;; Draw game first
JSR Draw

;; Update game
JSR Update

RTI ; return from interrupt


;;;;;;;;;;;;;;;;;;;;;;
; Draw sprite to screen
Draw:

JSR DrawPlayer

;;This is the PPU clean up section, so rendering the next frame starts properly.
LDA #%10010000 ; enable NMI, sprites from Pattern Table 0, background from Pattern Table 1
STA $2000
LDA #%00011110 ; enable sprites, enable background, no clipping on left side
STA $2001
LDA #$00 ;;tell the ppu there is no background scrolling
STA $2005
STA $2005

RTS


;;;;;;;;;;;;;;;;;;;;;
; Draw Sprites
DrawPlayer:
LDX #$00 ; start at 0
LDY #$00 ; start at 0
DrawPlayerLoop:

LDA $0203, x ; load current x sprite position
CLC
LDA playerspriteoffset, y ; add player x with sprite offset
ADC playerx
INY ; increment sprite offset coutner
STA $0203, x ; store into RAM address ($0203 + x)

LDA $0200, x ; load current y sprite position
CLC
LDA playerspriteoffset, y ; add player y with sprite offset
ADC playery
INY
STA $0200, x ; store into RAM address ($0200 + x)
INX ; X = X + 4 loop to the next sprite
INX
INX
INX
CPX #$1C ; Compare X to hex $1C, decimal 28 meaning all 7 Player sprites done
BNE DrawPlayerLoop ; Branch to LoadSpritesLoop if compare was Not Equal to zero
; if compare was equal to 32, keep going down
RTS

DrawEnemey:
LDX #$00 ; start at 0
LDY #$00 ; start at 0
DrawEnemyLoop:

LDA $0203, x ; load current x sprite position
CLC
LDA enemyspriteoffset, y ; add player x with sprite offset
ADC enemyx
INY ; increment sprite offset coutner
STA $0203, x ; store into RAM address ($0203 + x)

LDA $0200, x ; load current y sprite position
CLC
LDA playerspriteoffset, y ; add player y with sprite offset
ADC enemyy
INY
STA $0200, x ; store into RAM address ($0200 + x)
INX ; X = X + 4 loop to the next sprite
INX
INX
INX
CPX #$08 ; Compare X to hex $1C, decimal 28 meaning all 7 Player sprites done
BNE DrawEnemyLoop ; Branch to LoadSpritesLoop if compare was Not Equal to zero
; if compare was equal to 32, keep going down
RTS

Update:
JSR LatchController
JSR PollController
JSR ReadLeft
JSR ReadRight
JSR ReadA
INC loopCount
JSR UpdatePlayerPosition
RTS


UpdatePlayerPosition:
CLC
LDA loopCount
CMP #$0A
BNE SkipGravity
LDA gravity
ADC playervy
STA playervy
LDA #$00
STA loopCount
SkipGravity:
LDA playervy
CLC
ADC playery
STA playery
CMP ground
BCS PutPlayerOnGround
PlayerOnGroundDone:
LDA playervx
CLC
ADC playerx
STA playerx
RTS
PutPlayerOnGround:
LDA ground
STA playery
LDA #$00
STA playervy
STA inAir
JMP PlayerOnGroundDone


LatchController:
LDA #$01
STA $4016
LDA #$00
STA $4016 ; tell both the controllers to latch buttons
RTS

;;;;;;;;;;;;;;;;;;
; Read controller input into byte vector
; 76543210
; ||||||||
; |||||||+- RIGHT button
; ||||||+-- LEFT Button
; |||||+--- DOWN Button
; ||||+---- UP Button
; |||+----- START Button
; ||+------ SELECT Button
; |+------- B Button
; +-------- A Button

PollController:
LDX #$00 ; 8 buttons total
PollControllerLoop:
LDA $4016 ; player 1 - A
LSR A ; shift right
ROL controller1 ; rotate left button vector in mem location $0003
INX
CPX #$08
BNE PollControllerLoop
RTS

ReadRight:
LDA controller1 ; controller1 1 - A button
AND #%00000001 ; only look at bit 0
BEQ ReadRightDone ; branch to ReadADone if button is NOT pressed (0)
; add instructions here to do something when button IS pressed (1)
LDA $0203 ; load sprite X position
CLC ; make sure the carry flag is clear
LDA playerx
ADC #$02
STA playerx;
ReadRightDone: ; handling this button is done
RTS


ReadLeft:
LDA controller1 ; controller1 1 - B button
AND #%00000010 ; only look at bit 0
BEQ ReadLeftDone ; branch to ReadBDone if button is NOT pressed (0)
; add instructions here to do something when button IS pressed (1)
LDA $0203 ; load sprite X position
CLC
LDA playerx
ADC #$FE
STA playerx
ReadLeftDone: ; handling this button is done
RTS

ReadA:
LDA controller1 ; controller1 1 - B button
AND #%10000000 ; only look at bit 0
BEQ ReadADone ; branch to ReadBDone if button is NOT pressed (0)
; add instructions here to do something when button IS pressed (1)
LDA inAir
CMP #$01
BEQ ReadADone

LDA ground
STA playery
LDA #$FA
STA playervy

LDA #$01
STA inAir

ReadADone: ; handling this button is done
RTS

;;;;;;;;;;;;;;
; Data initialization
; .db command is a macro for storing bytes in memory without having to write
; LDA (byte)
; STA (mem)

.bank 1
.org $E000
palette:
;; Background Palletes (0-3)
.db $08,$1A,$38,$18, $08,$02,$38,$3C, $08,$1C,$15,$14, $08,$02,$38,$2A
;; Character Palletes (0-3)
.db $21,$2C,$11,$15, $0F,$35,$36,$37, $0F,$39,$3A,$3B, $0F,$3D,$3E,$0F

playersprite:
; 1st byte encodes the y position
; 2nd byte encodes the tile index loaded into the PPU
; 3rd byte encodes any sprite attributes
; 76543210
; ||| ||
; ||| ++- Color Palette of sprite. Choose which set of 4 from the 16 colors to use
; |||
; ||+------ Priority (0: in front of background; 1: behind background)
; |+------- Flip sprite horizontally
; +-------- Flip sprite vertically
; 4th byte encodes the x position

;vert tile attr horiz
.db $80, $00, $00, $80 ;sprite 0
.db $80, $01, $00, $88 ;sprite 1
.db $80, $02, $00, $90 ;sprite 2
.db $88, $10, $00, $80 ;sprite 3
.db $88, $11, $00, $88 ;sprite 4
.db $88, $12, $00, $90 ;sprite 5
.db $90, $21, $00, $88 ;sprite 6

playerspriteoffset:
;x y
.db $F8, $F0; (-8, -16)
.db $00, $F0; (0, -16)
.db $08, $F0; (8 , -16)
.db $F8, $F8; (-8, -8)
.db $00, $F8; (0, -8)
.db $08, $F8; (8, -8)
.db $00, $00; (0, 0)


enemyspriteframe1:
.db $F0, $04, $00, $00
.db $F0, $05, $00, $08

enemyspriteframe2:
.db $F0, $14, $00, $00
.db $F0, $15, $00, $08

enemyspriteoffset:
.db $00, $00
.db $00, $08

background:
; nametable 960 bytes long for the background
;.db $10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10
;.db $10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10

;.db $10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10
;.db $10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10

;.db $10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10
;.db $10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10

;.db $10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10
;.db $10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10

.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky

.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky

.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky

.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky


.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky

.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky

.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky


.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky


.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky


.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky


.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky



.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky



.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky


.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky

.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky

.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky

.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky

.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky


.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky


.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky

.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky


.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky


.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky


.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky


.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky


.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;row 1
.db $11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11,$11 ;;all sky

.db $00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01
.db $00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01 ;;ground

.db $10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10
.db $10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10 ;; dirt

.db $10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10
.db $10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10 ;; dirt

.db $10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10
.db $10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10,$10 ;; dirt

attribute:
; 64 bytes following a nametable
;.db $C7,$00,$00,$00, $00,$00,$00,$00
.db $00,$00,$00,$00, $00,$00,$00,$00
.db $00,$00,$00,$00, $00,$00,$00,$00
.db $00,$00,$00,$00, $00,$00,$00,$00
.db $00,$00,$00,$00, $00,$00,$00,$00
.db $00,$00,$00,$00, $00,$00,$00,$00
.db $00,$00,$00,$00, $00,$00,$00,$00
.db $00,$00,$00,$00, $00,$00,$00,$00
.db $00,$00,$00,$00, $00,$00,$00,$00




; Load in level columns
; The first 32 bytes is the first column and so on, each byte is sprite index
;columnData:
;.incbin "level.bin"

; Load column sprite attributes
; TODO how is this defined?
;attribData:
;.incbin "attr.bin"


;;;;;;;;;;;;;;
; Define interrupt vectors at the top of memory $FFFF
; Basically registering callbacks for different functions NMI, RESET, IRQ
; .org means starting at $FFFA
; .dw means store dataword, in the NES that means 16 bits 2 bytes
; stores in little endian order, superior ordering ;) least sig byte first

.bank 1
.org $FFFA ;first of the three vectors starts here
nescallback:
; after this $FFFA + 2 = $FFFC
.dw MAINLOOP ;when an NMI happens (once per frame if enabled) the
;processor will jump to the label NMI:
; after this $FFFC + 2 = $FFFE
.dw RESET ;when the processor first turns on or is reset, it will jump
;to the label RESET:
; after this $FFFC + 1 = $FFFF
.dw 0 ;external interrupt IRQ is not used in this tutorial


;;;;;;;;;;;;;;
; Load in external sprite or audio data

.bank 2
.org $0000
.incbin "art.chr" ;includes 8KB graphics file

disassembled code

[size=200][size=50][size=85][size=85][size=200][/size][/size][/size][/size][/size] * = 0000
0000 E1 EC SBC ($EC,X)
0002 1E A0 E1 ASL $E1A0,X
0005 E0 00 CPX #$00
0007 0C ???
0008 1A ???
0009 E1 AE SBC ($AE,X)
000B 1A ???
000C E1 AE SBC ($AE,X)
000E 1C ???
000F E1 1A SBC ($1A,X)
0011 1D 1A 1E ORA $1E1A,X
0014 E1 EE SBC ($EE,X)
0016 1B ???
0017 AC D1 BA LDY $BAD1
001A CD 1C E1 CMP $E11C
001D CE 1C 1A DEC $1A1C
0020 EA NOP
0021 BE 1C 1C LDX $1C1C,Y
0024 1C ???
0025 E1 CE SBC ($CE,X)
0027 1C ???
0028 BE 1B A0 LDX $A01B,Y
002B C0 00 CPY #$00
002D EE EC DD INC $DDEC
0030 40 RTI
0031 40 RTI
0032 17 ???
0033 DF ???
0034 F2 ???
0035 00 BRK
0036 02 ???
0037 00 BRK
0038 14 ???
0039 01 0B ORA ($0B,X)
003B AA TAX
003C 1B ???
003D 20 02 BB JSR $BB02
0040 AA TAX
0041 1C ???
0042 ED A0 0A SBC $0AA0
0045 00 BRK
0046 00 BRK
0047 A0 10 LDY #$10
0049 0A ASL A
004A 03 ???
004B 00 BRK
004C A0 40 LDY #$40
004E 0A ASL A
004F 05 00 ORA $00
0051 A0 60 LDY #$60
0053 0A ASL A
0054 07 ???
0055 00 BRK
0056 DA ???
0057 FE A0 20 INC $20A0,X
005A 0B ???
005B EC EB AA CPX $AAEB
005E 2B ???
005F 20 02 BB JSR $BB02
0062 AA TAX
0063 2A ROL A
0064 DA ???
0065 EE DA 20 INC $20DA
0068 02 ???
0069 DA ???
006A 3F ???
006B A2 00 LDX #$00
006D 6D A0 0A ADC $0AA0
0070 20 06 D0 JSR $D006
0073 0A ASL A
0074 DA ???
0075 EE DA AE INC $AEDA
0078 EA NOP
0079 20 07 C2 JSR $C207
007C 0B ???
007D EA NOP
007E DA ???
007F EE AD ED INC $EDAD
0082 00 BRK
0083 AD ED AA LDA $AAED
0086 EE A0 20 INC $20A0
0089 0C ???
008A 1C ???
008B BE AD EA LDX $EAAD,Y
008E DB ???
008F AC DD A2 LDY $A2DD
0092 00 BRK
0093 2D A2 0A AND $0AA2
0096 20 06 DA JSR $DA06
0099 00 BRK
009A A2 00 LDX #$00
009C 6D 00 DA ADC $DA00
009F BA TSX
00A0 CD AB AC CMP $ACAB
00A3 DD AB AC CMP $ACAB,X
00A6 DA ???
00A7 BA TSX
00A8 CD DA C0 CMP $C0DA
00AB AC ED A0 LDY $A0ED
00AE 3A ???
00AF CE D0 0A DEC $0AD0
00B2 DB ???
00B3 AC DD AB LDY $ABDD
00B6 AC DA 20 LDY $20DA
00B9 07 ???
00BA DA ???
00BB BA TSX
00BC CD CC AD CMP $ADCC
00BF C0 1A CPY #$1A
00C1 BA TSX
00C2 CD DA BA CMP $BADA
00C5 CD AD C0 CMP $C0AD
00C8 0A ASL A
00C9 BA TSX
00CA CD DA CE CMP $CEDA
00CD EC BC 01 CPX $01BC
00D0 AC ED AC LDY $ACED
00D3 EB ???
00D4 C0 0A CPY #$0A
00D6 CE DA CE DEC $CEDA
00D9 C0 0B CPY #$0B
00DB EA NOP
00DC DB ???
00DD AC DD AC LDY $ACDD
00E0 EC 00 BE CPX $BE00
00E3 AD BA CD LDA $CDBA
00E6 AD AB ED LDA $EDAB
00E9 A2 00 LDX #$00
00EB 2D A2 3A AND $3AA2
00EE 20 06 DA JSR $DA06
00F1 C0 A2 CPY #$A2
00F3 00 BRK
00F4 6D 00 AD ADC $AD00
00F7 AB ???
00F8 ED AA BE SBC $BEAA
00FB A2 00 LDX #$00
00FD 7C ???
00FE 40 RTI
00FF BE AD AB LDX $ABAD,Y
0102 ED A1 00 SBC $00A1
0105 10 00 BPL $0107
0107 0A ASL A
0108 20 00 DA JSR $DA00
010B 00 BRK
010C 01 11 ORA ($11,X)
010E 10 A2 BPL $00B2
0110 00 BRK
0111 1A ???
0112 EA NOP
0113 ED A8 0A SBC $0AA8
0116 AE DA 00 LDX $00DA
0119 AA TAX
011A ED AC 8A SBC $8AAC
011D DD A0 0A CMP $0AA0,X
0120 CE 1A AE DEC $AE1A
0123 AA TAX
0124 EA NOP
0125 CD A0 3A CMP $3AA0
0128 AF ???
0129 EE FE EA INC $EAFE
012C DA ???
012D 00 BRK
012E A2 00 LDX #$00
0130 3D A0 2A AND $2AA0,X
0133 40 RTI
0134 14 ???
0135 DA ???
0136 DA ???
0137 ED AD AA SBC $AAAD
013A ED A1 00 SBC $00A1
013D 10 00 BPL $013F
013F 0A ASL A
0140 20 00 DA JSR $DA00
0143 00 BRK
0144 01 11 ORA ($11,X)
0146 10 A2 BPL $00EA
0148 00 BRK
0149 1D A0 0A ORA $0AA0,X
014C 20 05 A2 JSR $A205
014F 00 BRK
0150 5D AA ED EOR $EDAA,X
0153 00 BRK
0154 D0 0D BNE $0163
0156 AA TAX
0157 ED A0 20 SBC $20A0
015A 3C ???
015B CD AA EE CMP $EEAA
015E FF ???
015F EA NOP
0160 DC ???
0161 AE A0 20 LDX $20A0
0164 3D A0 20 AND $20A0,X
0167 0C ???
0168 CD AA EE CMP $EEAA
016B FF ???
016C EA NOP
016D DC ???
016E AE A0 20 LDX $20A0
0171 0C ???
0172 1C ???
0173 BE DA AE LDX $AEDA,Y
0176 DA ???
0177 EE ED 00 INC $00ED
017A D0 0D BNE $0189
017C AE ED A0 LDX $A0ED
017F 20 3C CD JSR $CD3C
0182 AE EE FF LDX $FFEE
0185 EA NOP
0186 DC ???
0187 EE A0 20 INC $20A0
018A 3D A0 20 AND $20A0,X
018D 0C ???
018E CD AA EE CMP $EEAA
0191 FF ???
0192 EA NOP
0193 DC ???
0194 EE A0 20 INC $20A0
0197 0C ???
0198 08 PHP
0199 BE DA EE LDX $EEDA,Y
019C DA ???
019D EA NOP
019E CC EC EE CPY $EEEC
01A1 AD EF EA LDA $EAEF
01A4 DE AD AC DEC $ACAD,X
01A7 CD AE AE CMP $AEAE
01AA DA ???
01AB EA NOP
01AC EC CD AC CPX $ACCD
01AF C0 AB CPY #$AB
01B1 EA NOP
01B2 DA ???
01B3 AA TAX
01B4 DC ???
01B5 AE AA ED LDX $EDAA
01B8 A0 0A LDY #$0A
01BA CA DEX
01BB DA ???
01BC AE CC AD LDX $ADCC
01BF CA DEX
01C0 EA NOP
01C1 AE CD BC LDX $BCCD
01C4 AE DA ED LDX $EDDA
01C7 DE DA AE DEC $AEDA,X
01CA CC AD CA CPY $CAAD
01CD EA NOP
01CE AE AE DD LDX $DDAE
01D1 AD AA ED LDA $EDAA
01D4 A0 0A LDY #$0A
01D6 AE AA AE LDX $AEAA
01D9 DD EA CC CMP $CCEA,X
01DC ED A0 1A SBC $1AA0
01DF 40 RTI
01E0 16 DA ASL $DA,X
01E2 00 BRK
01E3 A4 01 LDY $01
01E5 6C ED 00 JMP ($00ED)
01E8 CE DA 40 DEC $40DA
01EB 16 AC ASL $AC,X
01ED E1 C0 SBC ($C0,X)
01EF 8B ???
01F0 EC EE AD CPX $ADEE
01F3 DA ???
01F4 CE 1A D0 DEC $D01A
01F7 00 BRK
01F8 00 BRK
01F9 00 BRK
01FA 1B ???
01FB EE AD DE INC $DEAD
01FE DA ???
01FF 02 ???
0200 03 ???
0201 CC DA AE CPY $AEDA
0204 AD C0 2A LDA $2AC0
0207 AE EA DD LDX $DDEA
020A EE AD EF INC $EFAD
020D DA ???
020E CE 1A D0 DEC $D01A
0211 00 BRK
0212 00 BRK
0213 01 0B ORA ($0B,X)
0215 EE AD EF INC $EFAD
0218 DE DA 02 DEC $02DA,X
021B 03 ???
021C CC DA AE CPY $AEDA
021F AD CF EA LDA $EACF
0222 AE EA DE LDX $DEEA
0225 FD EE AD SBC $ADEE,X
0228 AD AC E1 LDA $E1AC
022B AD 10 00 LDA $0010
022E 00 BRK
022F 00 BRK
0230 BE EA DA LDX $DAEA,Y
0233 DE DA AC DEC $ACDA,X
0236 01 BE ORA ($BE,X)
0238 EA NOP
0239 DA ???
023A DE DA DA DEC $DADA,X
023D AE DA FA LDX $FADA
0240 AA TAX
0241 ED A0 1A SBC $1AA0
0244 AE AD AD LDX $ADAD
0247 EB ???
0248 A1 E0 LDA ($E0,X)
024A 00 BRK
024B AE ED B0 LDX $B0ED
024E 81 A3 STA ($A3,X)
0250 81 80 STA ($80,X)
0252 80 ???
0253 23 ???
0254 83 ???
0255 C0 81 CPY #$81
0257 C1 51 CMP ($51,X)
0259 40 RTI
025A 80 ???
025B 23 ???
025C 82 ???
025D AD B2 12 LDA $12B2
0260 C1 11 CMP ($11,X)
0262 50 F3 BVC $0257
0264 53 ???
0265 63 ???
0266 70 F3 BVS $025B
0268 93 ???
0269 A3 ???
026A B0 F3 BCS $025F
026C D3 ???
026D E0 FA CPX #$FA
026F EE DB 80 INC $80DB
0272 00 BRK
0273 00 BRK
0274 80 ???
0275 DB ???
0276 80 ???
0277 01 00 ORA ($00,X)
0279 88 DEY
027A DB ???
027B 80 ???
027C 02 ???
027D 00 BRK
027E 90 DB BCC $025B
0280 88 DEY
0281 10 00 BPL $0283
0283 80 ???
0284 DB ???
0285 88 DEY
0286 11 00 ORA ($00),Y
0288 88 DEY
0289 DB ???
028A 88 DEY
028B 12 ???
028C 00 BRK
028D 90 DB BCC $026A
028F 90 21 BCC $02B2
0291 00 BRK
0292 88 DEY
0293 AE EF FE LDX $FEEF
0296 DB ???
0297 F8 SED
0298 F0 DB BEQ $0275
029A 00 BRK
029B F0 DB BEQ $0278
029D 08 PHP
029E F0 DB BEQ $027B
02A0 F8 SED
02A1 F8 SED
02A2 DB ???
02A3 00 BRK
02A4 F8 SED
02A5 DB ???
02A6 08 PHP
02A7 F8 SED
02A8 DB ???
02A9 00 BRK
02AA 00 BRK
02AB EE EF AE INC $AEEF
02AE 1D BF 00 ORA $00BF,X
02B1 40 RTI
02B2 00 BRK
02B3 0D BF 00 ORA $00BF
02B6 50 00 BVC $02B8
02B8 8E EE FA STX $FAEE
02BB E2 ???
02BC DB ???
02BD F0 14 BEQ $02D3
02BF 00 BRK
02C0 00 BRK
02C1 DB ???
02C2 F0 15 BEQ $02D9
02C4 00 BRK
02C5 08 PHP
02C6 EE EF FE INC $FEEF
02C9 DB ???
02CA 00 BRK
02CB 00 BRK
02CC DB ???
02CD 00 BRK
02CE 08 PHP
02CF BA TSX
02D0 CD DB 11 CMP $11DB
02D3 11 11 ORA ($11),Y
02D5 11 11 ORA ($11),Y
02D7 11 11 ORA ($11),Y
02D9 11 11 ORA ($11),Y
02DB 11 11 ORA ($11),Y
02DD 11 11 ORA ($11),Y
02DF 11 11 ORA ($11),Y
02E1 11 DB ORA ($DB),Y
02E3 11 11 ORA ($11),Y
02E5 11 11 ORA ($11),Y
02E7 11 11 ORA ($11),Y
02E9 11 11 ORA ($11),Y
02EB 11 11 ORA ($11),Y
02ED 11 11 ORA ($11),Y
02EF 11 11 ORA ($11),Y
02F1 11 11 ORA ($11),Y
02F3 DB ???
02F4 11 11 ORA ($11),Y
02F6 11 11 ORA ($11),Y
02F8 11 11 ORA ($11),Y
02FA 11 11 ORA ($11),Y
02FC 11 11 ORA ($11),Y
02FE 11 11 ORA ($11),Y
0300 11 11 ORA ($11),Y
0302 11 11 ORA ($11),Y
0304 DB ???
0305 11 11 ORA ($11),Y
0307 11 11 ORA ($11),Y
0309 11 11 ORA ($11),Y
030B 11 11 ORA ($11),Y
030D 11 11 ORA ($11),Y
030F 11 11 ORA ($11),Y
0311 11 11 ORA ($11),Y
0313 11 11 ORA ($11),Y
0315 DB ???
0316 11 11 ORA ($11),Y
0318 11 11 ORA ($11),Y
031A 11 11 ORA ($11),Y
031C 11 11 ORA ($11),Y
031E 11 11 ORA ($11),Y
0320 11 11 ORA ($11),Y
0322 11 11 ORA ($11),Y
0324 11 11 ORA ($11),Y
0326 DB ???
0327 11 11 ORA ($11),Y
0329 11 11 ORA ($11),Y
032B 11 11 ORA ($11),Y
032D 11 11 ORA ($11),Y
032F 11 11 ORA ($11),Y
0331 11 11 ORA ($11),Y
0333 11 11 ORA ($11),Y
0335 11 11 ORA ($11),Y
0337 DB ???
0338 11 11 ORA ($11),Y
033A 11 11 ORA ($11),Y
033C 11 11 ORA ($11),Y
033E 11 11 ORA ($11),Y
0340 11 11 ORA ($11),Y
0342 11 11 ORA ($11),Y
0344 11 11 ORA ($11),Y
0346 11 11 ORA ($11),Y
0348 DB ???
0349 11 11 ORA ($11),Y
034B 11 11 ORA ($11),Y
034D 11 11 ORA ($11),Y
034F 11 11 ORA ($11),Y
0351 11 11 ORA ($11),Y
0353 11 11 ORA ($11),Y
0355 11 11 ORA ($11),Y
0357 11 11 ORA ($11),Y
0359 DB ???
035A 11 11 ORA ($11),Y
035C 11 11 ORA ($11),Y
035E 11 11 ORA ($11),Y
0360 11 11 ORA ($11),Y
0362 11 11 ORA ($11),Y
0364 11 11 ORA ($11),Y
0366 11 11 ORA ($11),Y
0368 11 11 ORA ($11),Y
036A DB ???
036B 11 11 ORA ($11),Y
036D 11 11 ORA ($11),Y
036F 11 11 ORA ($11),Y
0371 11 11 ORA ($11),Y
0373 11 11 ORA ($11),Y
0375 11 11 ORA ($11),Y
0377 11 11 ORA ($11),Y
0379 11 11 ORA ($11),Y
037B DB ???
037C 11 11 ORA ($11),Y
037E 11 11 ORA ($11),Y
0380 11 11 ORA ($11),Y
0382 11 11 ORA ($11),Y
0384 11 11 ORA ($11),Y
0386 11 11 ORA ($11),Y
0388 11 11 ORA ($11),Y
038A 11 11 ORA ($11),Y
038C DB ???
038D 11 11 ORA ($11),Y
038F 11 11 ORA ($11),Y
0391 11 11 ORA ($11),Y
0393 11 11 ORA ($11),Y
0395 11 11 ORA ($11),Y
0397 11 11 ORA ($11),Y
0399 11 11 ORA ($11),Y
039B 11 11 ORA ($11),Y
039D DB ???
039E 11 11 ORA ($11),Y
03A0 11 11 ORA ($11),Y
03A2 11 11 ORA ($11),Y
03A4 11 11 ORA ($11),Y
03A6 11 11 ORA ($11),Y
03A8 11 11 ORA ($11),Y
03AA 11 11 ORA ($11),Y
03AC 11 11 ORA ($11),Y
03AE DB ???
03AF 11 11 ORA ($11),Y
03B1 11 11 ORA ($11),Y
03B3 11 11 ORA ($11),Y
03B5 11 11 ORA ($11),Y
03B7 11 11 ORA ($11),Y
03B9 11 11 ORA ($11),Y
03BB 11 11 ORA ($11),Y
03BD 11 11 ORA ($11),Y
03BF DB ???
03C0 11 11 ORA ($11),Y
03C2 11 11 ORA ($11),Y
03C4 11 11 ORA ($11),Y
03C6 11 11 ORA ($11),Y
03C8 11 11 ORA ($11),Y
03CA 11 11 ORA ($11),Y
03CC 11 11 ORA ($11),Y
03CE 11 11 ORA ($11),Y
03D0 DB ???
03D1 11 11 ORA ($11),Y
03D3 11 11 ORA ($11),Y
03D5 11 11 ORA ($11),Y
03D7 11 11 ORA ($11),Y
03D9 11 11 ORA ($11),Y
03DB 11 11 ORA ($11),Y
03DD 11 11 ORA ($11),Y
03DF 11 11 ORA ($11),Y
03E1 DB ???
03E2 11 11 ORA ($11),Y
03E4 11 11 ORA ($11),Y
03E6 11 11 ORA ($11),Y
03E8 11 11 ORA ($11),Y
03EA 11 11 ORA ($11),Y
03EC 11 11 ORA ($11),Y
03EE 11 11 ORA ($11),Y
03F0 11 11 ORA ($11),Y
03F2 DB ???
03F3 11 11 ORA ($11),Y
03F5 11 11 ORA ($11),Y
03F7 11 11 ORA ($11),Y
03F9 11 11 ORA ($11),Y
03FB 11 11 ORA ($11),Y
03FD 11 11 ORA ($11),Y
03FF 11 11 ORA ($11),Y
0401 11 11 ORA ($11),Y
0403 DB ???
0404 11 11 ORA ($11),Y
0406 11 11 ORA ($11),Y
0408 11 11 ORA ($11),Y
040A 11 11 ORA ($11),Y
040C 11 11 ORA ($11),Y
040E 11 11 ORA ($11),Y
0410 11 11 ORA ($11),Y
0412 11 11 ORA ($11),Y
0414 DB ???
0415 11 11 ORA ($11),Y
0417 11 11 ORA ($11),Y
0419 11 11 ORA ($11),Y
041B 11 11 ORA ($11),Y
041D 11 11 ORA ($11),Y
041F 11 11 ORA ($11),Y
0421 11 11 ORA ($11),Y
0423 11 11 ORA ($11),Y
0425 DB ???
0426 11 11 ORA ($11),Y
0428 11 11 ORA ($11),Y
042A 11 11 ORA ($11),Y
042C 11 11 ORA ($11),Y
042E 11 11 ORA ($11),Y
0430 11 11 ORA ($11),Y
0432 11 11 ORA ($11),Y
0434 11 11 ORA ($11),Y
0436 DB ???
0437 11 11 ORA ($11),Y
0439 11 11 ORA ($11),Y
043B 11 11 ORA ($11),Y
043D 11 11 ORA ($11),Y
043F 11 11 ORA ($11),Y
0441 11 11 ORA ($11),Y
0443 11 11 ORA ($11),Y
0445 11 11 ORA ($11),Y
0447 DB ???
0448 11 11 ORA ($11),Y
044A 11 11 ORA ($11),Y
044C 11 11 ORA ($11),Y
044E 11 11 ORA ($11),Y
0450 11 11 ORA ($11),Y
0452 11 11 ORA ($11),Y
0454 11 11 ORA ($11),Y
0456 11 11 ORA ($11),Y
0458 DB ???
0459 11 11 ORA ($11),Y
045B 11 11 ORA ($11),Y
045D 11 11 ORA ($11),Y
045F 11 11 ORA ($11),Y
0461 11 11 ORA ($11),Y
0463 11 11 ORA ($11),Y
0465 11 11 ORA ($11),Y
0467 11 11 ORA ($11),Y
0469 DB ???
046A 11 11 ORA ($11),Y
046C 11 11 ORA ($11),Y
046E 11 11 ORA ($11),Y
0470 11 11 ORA ($11),Y
0472 11 11 ORA ($11),Y
0474 11 11 ORA ($11),Y
0476 11 11 ORA ($11),Y
0478 11 11 ORA ($11),Y
047A DB ???
047B 11 11 ORA ($11),Y
047D 11 11 ORA ($11),Y
047F 11 11 ORA ($11),Y
0481 11 11 ORA ($11),Y
0483 11 11 ORA ($11),Y
0485 11 11 ORA ($11),Y
0487 11 11 ORA ($11),Y
0489 11 11 ORA ($11),Y
048B DB ???
048C 11 11 ORA ($11),Y
048E 11 11 ORA ($11),Y
0490 11 11 ORA ($11),Y
0492 11 11 ORA ($11),Y
0494 11 11 ORA ($11),Y
0496 11 11 ORA ($11),Y
0498 11 11 ORA ($11),Y
049A 11 11 ORA ($11),Y
049C DB ???
049D 11 11 ORA ($11),Y
049F 11 11 ORA ($11),Y
04A1 11 11 ORA ($11),Y
04A3 11 11 ORA ($11),Y
04A5 11 11 ORA ($11),Y
04A7 11 11 ORA ($11),Y
04A9 11 11 ORA ($11),Y
04AB 11 11 ORA ($11),Y
04AD DB ???
04AE 11 11 ORA ($11),Y
04B0 11 11 ORA ($11),Y
04B2 11 11 ORA ($11),Y
04B4 11 11 ORA ($11),Y
04B6 11 11 ORA ($11),Y
04B8 11 11 ORA ($11),Y
04BA 11 11 ORA ($11),Y
04BC 11 11 ORA ($11),Y
04BE DB ???
04BF 11 11 ORA ($11),Y
04C1 11 11 ORA ($11),Y
04C3 11 11 ORA ($11),Y
04C5 11 11 ORA ($11),Y
04C7 11 11 ORA ($11),Y
04C9 11 11 ORA ($11),Y
04CB 11 11 ORA ($11),Y
04CD 11 11 ORA ($11),Y
04CF DB ???
04D0 11 11 ORA ($11),Y
04D2 11 11 ORA ($11),Y
04D4 11 11 ORA ($11),Y
04D6 11 11 ORA ($11),Y
04D8 11 11 ORA ($11),Y
04DA 11 11 ORA ($11),Y
04DC 11 11 ORA ($11),Y
04DE 11 11 ORA ($11),Y
04E0 DB ???
04E1 11 11 ORA ($11),Y
04E3 11 11 ORA ($11),Y
04E5 11 11 ORA ($11),Y
04E7 11 11 ORA ($11),Y
04E9 11 11 ORA ($11),Y
04EB 11 11 ORA ($11),Y
04ED 11 11 ORA ($11),Y
04EF 11 11 ORA ($11),Y
04F1 DB ???
04F2 11 11 ORA ($11),Y
04F4 11 11 ORA ($11),Y
04F6 11 11 ORA ($11),Y
04F8 11 11 ORA ($11),Y
04FA 11 11 ORA ($11),Y
04FC 11 11 ORA ($11),Y
04FE 11 11 ORA ($11),Y
0500 11 11 ORA ($11),Y
0502 DB ???
0503 11 11 ORA ($11),Y
0505 11 11 ORA ($11),Y
0507 11 11 ORA ($11),Y
0509 11 11 ORA ($11),Y
050B 11 11 ORA ($11),Y
050D 11 11 ORA ($11),Y
050F 11 11 ORA ($11),Y
0511 11 11 ORA ($11),Y
0513 DB ???
0514 11 11 ORA ($11),Y
0516 11 11 ORA ($11),Y
0518 11 11 ORA ($11),Y
051A 11 11 ORA ($11),Y
051C 11 11 ORA ($11),Y
051E 11 11 ORA ($11),Y
0520 11 11 ORA ($11),Y
0522 11 11 ORA ($11),Y
0524 DB ???
0525 11 11 ORA ($11),Y
0527 11 11 ORA ($11),Y
0529 11 11 ORA ($11),Y
052B 11 11 ORA ($11),Y
052D 11 11 ORA ($11),Y
052F 11 11 ORA ($11),Y
0531 11 11 ORA ($11),Y
0533 11 11 ORA ($11),Y
0535 DB ???
0536 11 11 ORA ($11),Y
0538 11 11 ORA ($11),Y
053A 11 11 ORA ($11),Y
053C 11 11 ORA ($11),Y
053E 11 11 ORA ($11),Y
0540 11 11 ORA ($11),Y
0542 11 11 ORA ($11),Y
0544 11 11 ORA ($11),Y
0546 DB ???
0547 11 11 ORA ($11),Y
0549 11 11 ORA ($11),Y
054B 11 11 ORA ($11),Y
054D 11 11 ORA ($11),Y
054F 11 11 ORA ($11),Y
0551 11 11 ORA ($11),Y
0553 11 11 ORA ($11),Y
0555 11 11 ORA ($11),Y
0557 DB ???
0558 11 11 ORA ($11),Y
055A 11 11 ORA ($11),Y
055C 11 11 ORA ($11),Y
055E 11 11 ORA ($11),Y
0560 11 11 ORA ($11),Y
0562 11 11 ORA ($11),Y
0564 11 11 ORA ($11),Y
0566 11 11 ORA ($11),Y
0568 DB ???
0569 11 11 ORA ($11),Y
056B 11 11 ORA ($11),Y
056D 11 11 ORA ($11),Y
056F 11 11 ORA ($11),Y
0571 11 11 ORA ($11),Y
0573 11 11 ORA ($11),Y
0575 11 11 ORA ($11),Y
0577 11 11 ORA ($11),Y
0579 DB ???
057A 11 11 ORA ($11),Y
057C 11 11 ORA ($11),Y
057E 11 11 ORA ($11),Y
0580 11 11 ORA ($11),Y
0582 11 11 ORA ($11),Y
0584 11 11 ORA ($11),Y
0586 11 11 ORA ($11),Y
0588 11 11 ORA ($11),Y
058A DB ???
058B 11 11 ORA ($11),Y
058D 11 11 ORA ($11),Y
058F 11 11 ORA ($11),Y
0591 11 11 ORA ($11),Y
0593 11 11 ORA ($11),Y
0595 11 11 ORA ($11),Y
0597 11 11 ORA ($11),Y
0599 11 11 ORA ($11),Y
059B DB ???
059C 11 11 ORA ($11),Y
059E 11 11 ORA ($11),Y
05A0 11 11 ORA ($11),Y
05A2 11 11 ORA ($11),Y
05A4 11 11 ORA ($11),Y
05A6 11 11 ORA ($11),Y
05A8 11 11 ORA ($11),Y
05AA 11 11 ORA ($11),Y
05AC DB ???
05AD 11 11 ORA ($11),Y
05AF 11 11 ORA ($11),Y
05B1 11 11 ORA ($11),Y
05B3 11 11 ORA ($11),Y
05B5 11 11 ORA ($11),Y
05B7 11 11 ORA ($11),Y
05B9 11 11 ORA ($11),Y
05BB 11 11 ORA ($11),Y
05BD DB ???
05BE 11 11 ORA ($11),Y
05C0 11 11 ORA ($11),Y
05C2 11 11 ORA ($11),Y
05C4 11 11 ORA ($11),Y
05C6 11 11 ORA ($11),Y
05C8 11 11 ORA ($11),Y
05CA 11 11 ORA ($11),Y
05CC 11 11 ORA ($11),Y
05CE DB ???
05CF 11 11 ORA ($11),Y
05D1 11 11 ORA ($11),Y
05D3 11 11 ORA ($11),Y
05D5 11 11 ORA ($11),Y
05D7 11 11 ORA ($11),Y
05D9 11 11 ORA ($11),Y
05DB 11 11 ORA ($11),Y
05DD 11 11 ORA ($11),Y
05DF DB ???
05E0 11 11 ORA ($11),Y
05E2 11 11 ORA ($11),Y
05E4 11 11 ORA ($11),Y
05E6 11 11 ORA ($11),Y
05E8 11 11 ORA ($11),Y
05EA 11 11 ORA ($11),Y
05EC 11 11 ORA ($11),Y
05EE 11 11 ORA ($11),Y
05F0 DB ???
05F1 11 11 ORA ($11),Y
05F3 11 11 ORA ($11),Y
05F5 11 11 ORA ($11),Y
05F7 11 11 ORA ($11),Y
05F9 11 11 ORA ($11),Y
05FB 11 11 ORA ($11),Y
05FD 11 11 ORA ($11),Y
05FF 11 11 ORA ($11),Y
0601 DB ???
0602 11 11 ORA ($11),Y
0604 11 11 ORA ($11),Y
0606 11 11 ORA ($11),Y
0608 11 11 ORA ($11),Y
060A 11 11 ORA ($11),Y
060C 11 11 ORA ($11),Y
060E 11 11 ORA ($11),Y
0610 11 11 ORA ($11),Y
0612 DB ???
0613 11 11 ORA ($11),Y
0615 11 11 ORA ($11),Y
0617 11 11 ORA ($11),Y
0619 11 11 ORA ($11),Y
061B 11 11 ORA ($11),Y
061D 11 11 ORA ($11),Y
061F 11 11 ORA ($11),Y
0621 11 11 ORA ($11),Y
0623 DB ???
0624 11 11 ORA ($11),Y
0626 11 11 ORA ($11),Y
0628 11 11 ORA ($11),Y
062A 11 11 ORA ($11),Y
062C 11 11 ORA ($11),Y
062E 11 11 ORA ($11),Y
0630 11 11 ORA ($11),Y
0632 11 11 ORA ($11),Y
0634 DB ???
0635 11 11 ORA ($11),Y
0637 11 11 ORA ($11),Y
0639 11 11 ORA ($11),Y
063B 11 11 ORA ($11),Y
063D 11 11 ORA ($11),Y
063F 11 11 ORA ($11),Y
0641 11 11 ORA ($11),Y
0643 11 11 ORA ($11),Y
0645 DB ???
0646 00 BRK
0647 01 00 ORA ($00,X)
0649 01 00 ORA ($00,X)
064B 01 00 ORA ($00,X)
064D 01 00 ORA ($00,X)
064F 01 00 ORA ($00,X)
0651 01 00 ORA ($00,X)
0653 01 00 ORA ($00,X)
0655 01 DB ORA ($DB,X)
0657 00 BRK
0658 01 00 ORA ($00,X)
065A 01 00 ORA ($00,X)
065C 01 00 ORA ($00,X)
065E 01 00 ORA ($00,X)
0660 01 00 ORA ($00,X)
0662 01 00 ORA ($00,X)
0664 01 00 ORA ($00,X)
0666 01 DB ORA ($DB,X)
0668 10 10 BPL $067A
066A 10 10 BPL $067C
066C 10 10 BPL $067E
066E 10 10 BPL $0680
0670 10 10 BPL $0682
0672 10 10 BPL $0684
0674 10 10 BPL $0686
0676 10 10 BPL $0688
0678 DB ???
0679 10 10 BPL $068B
067B 10 10 BPL $068D
067D 10 10 BPL $068F
067F 10 10 BPL $0691
0681 10 10 BPL $0693
0683 10 10 BPL $0695
0685 10 10 BPL $0697
0687 10 10 BPL $0699
0689 DB ???
068A 10 10 BPL $069C
068C 10 10 BPL $069E
068E 10 10 BPL $06A0
0690 10 10 BPL $06A2
0692 10 10 BPL $06A4
0694 10 10 BPL $06A6
0696 10 10 BPL $06A8
0698 10 10 BPL $06AA
069A DB ???
069B 10 10 BPL $06AD
069D 10 10 BPL $06AF
069F 10 10 BPL $06B1
06A1 10 10 BPL $06B3
06A3 10 10 BPL $06B5
06A5 10 10 BPL $06B7
06A7 10 10 BPL $06B9
06A9 10 10 BPL $06BB
06AB DB ???
06AC 10 10 BPL $06BE
06AE 10 10 BPL $06C0
06B0 10 10 BPL $06C2
06B2 10 10 BPL $06C4
06B4 10 10 BPL $06C6
06B6 10 10 BPL $06C8
06B8 10 10 BPL $06CA
06BA 10 10 BPL $06CC
06BC DB ???
06BD 10 10 BPL $06CF
06BF 10 10 BPL $06D1
06C1 10 10 BPL $06D3
06C3 10 10 BPL $06D5
06C5 10 10 BPL $06D7
06C7 10 10 BPL $06D9
06C9 10 10 BPL $06DB
06CB 10 10 BPL $06DD
06CD AB ???
06CE ED B0 00 SBC $00B0
06D1 00 BRK
06D2 00 BRK
06D3 00 BRK
06D4 00 BRK
06D5 00 BRK
06D6 00 BRK
06D7 0D B0 00 ORA $00B0
06DA 00 BRK
06DB 00 BRK
06DC 00 BRK
06DD 00 BRK
06DE 00 BRK
06DF 00 BRK
06E0 0D B0 00 ORA $00B0
06E3 00 BRK
06E4 00 BRK
06E5 00 BRK
06E6 00 BRK
06E7 00 BRK
06E8 00 BRK
06E9 0D B0 00 ORA $00B0
06EC 00 BRK
06ED 00 BRK
06EE 00 BRK
06EF 00 BRK
06F0 00 BRK
06F1 00 BRK
06F2 0D B0 00 ORA $00B0
06F5 00 BRK
06F6 00 BRK
06F7 00 BRK
06F8 00 BRK
06F9 00 BRK
06FA 00 BRK
06FB 0D B0 00 ORA $00B0
06FE 00 BRK
06FF 00 BRK
0700 00 BRK
0701 00 BRK
0702 00 BRK
0703 00 BRK
0704 0D B0 00 ORA $00B0
0707 00 BRK
0708 00 BRK
0709 00 BRK
070A 00 BRK
070B 00 BRK
070C 00 BRK
070D 0D B0 00 ORA $00B0
0710 00 BRK
0711 00 BRK
0712 00 BRK
0713 00 BRK
0714 00 BRK
0715 00 BRK
0716 0B ???
0717 A1 FF LDA ($FF,X)
0719 FA ???
071A EC AB AC CPX $ACAB
071D DA ???
071E DE ED 0B DEC $0BED,X
0721 A2 00 LDX #$00
0723 00 BRK
0724 CB ???
0725 AC 00 00 LDY $0000
0728 .END


Top
 Profile  
 
PostPosted: Thu May 10, 2018 7:10 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 6956
Location: Canada
1. Please ask a question. Do not expect anyone here to want to figure out what you're trying to do from just a big pile of code dumped into a forum post.

2. It is better to attach large blocks of code as a file, or as a pastebin link.


Top
 Profile  
 
PostPosted: Thu May 10, 2018 8:08 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1440
rainwarrior wrote:
2. It is better to attach large blocks of code as a file, or as a pastebin link.

Or at least enclose it in a [code] block so that we don't have to scroll down 35 pages just to get to the first reply...

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
PostPosted: Thu May 10, 2018 8:21 pm 
Offline

Joined: Sat Apr 25, 2015 1:47 pm
Posts: 424
Location: FL
rainwarrior wrote:
1. Please ask a question. Do not expect anyone here to want to figure out what you're trying to do from just a big pile of code dumped into a forum post.

Also, please make the question more descriptive than "why isn't it working?". When all you say is that something is "not working", it's virtually impossible for anyone to actually know what you're having a problem with.


Top
 Profile  
 
PostPosted: Thu May 10, 2018 9:15 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3688
Location: Mountain View, CA
Should I dare mention that the disassembly is being done from the wrong origin address? That honestly looks like CHR data, not PRG data. Source is intended for use with NESASM (version unknown; it matters).

Code:
.inesprg 1 ; 1x 16KB PRG code
.ineschr 1 ; 1x 8KB CHR data
.inesmap 0 ; mapper 0 = NROM, no bank swapping
.inesmir 1 ; background mirroring

Code:
.bank 0 ; NESASM arranges things into 8KB chunks, this is chunk 0
.org $C000 ; Tells the assembler where to start in this 8kb chunk
RESET:
SEI ; disable IRQs

Code:
.bank 1
.org $FFFA ;first of the three vectors starts here
nescallback:
; after this $FFFA + 2 = $FFFC
.dw MAINLOOP ;when an NMI happens (once per frame if enabled) the
;processor will jump to the label NMI:
; after this $FFFC + 2 = $FFFE
.dw RESET ;when the processor first turns on or is reset, it will jump
;to the label RESET:
; after this $FFFC + 1 = $FFFF
.dw 0 ;external interrupt IRQ is not used in this tutorial

Code:
; Load in external sprite or audio data
.bank 2
.org $0000
.incbin "art.chr" ;includes 8KB graphics file


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group