Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .inesprg $10 ; 16x 16KB PRG code
- .ineschr $10 ; 16x 8KB CHR data
- .inesmap $01 ; mapper 1 = MMC1, 4KB CHR bank swapping
- .inesmir 0 ; background mirroring
- ;;;;;;;;;;;; N.B.: This could also probably be done with CNROM. However, this is made to test the MMC1.
- ;;;;;;;;;;;; If you want to do a CNROM game for whatever reason, feel free to try and port this to CNROM,
- ;;;;;;;;;;;; if you need to refresh your CNROM skillz :P
- .rsset $0000
- bankNumber .rs 1 ;Bank number :)
- title_black .rs 1 ;A racist variable
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 0
- .org $8000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 1
- .org $A000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 2
- .org $8000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 3
- .org $A000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; *Buzz to Woody* Unused banks! Unused banks everywhere!
- .bank 4
- .org $8000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 5
- .org $A000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 6
- .org $8000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 7
- .org $A000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 8
- .org $8000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 9
- .org $A000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 10
- .org $8000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 11
- .org $A000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 12
- .org $8000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 13
- .org $A000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 14
- .org $8000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 15
- .org $A000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 16
- .org $8000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 17
- .org $A000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 18
- .org $8000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 19
- .org $A000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 20
- .org $8000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 21
- .org $A000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 22
- .org $8000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 23
- .org $A000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 24
- .org $8000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 25
- .org $A000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 26
- .org $8000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 27
- .org $A000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 28
- .org $8000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 29
- .org $A000
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 30
- .org $C000
- ;;;;;;;;;;
- RESET:
- SEI ; disable IRQs
- CLD ; disable decimal mode
- 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
- 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
- INX
- BNE clrmem
- LDA #$80 ;Reset the MMC1
- STA $8000
- LDA #%00011111 ;Horizontal mirroring, 2 4KB CHR banks, 2 16 KB banks, swapping at $8000.
- STA $8000
- LSR A
- STA $8000
- LSR A
- STA $8000
- LSR A
- STA $8000
- LSR A
- STA $8000
- LDA #%00000000 ;Set the first bank of CHR to be $0000-$0FFF
- STA $A000
- LSR A
- STA $A000
- LSR A
- STA $A000
- LSR A
- STA $A000
- LSR A
- STA $A000
- LDA #%00000001 ;And the second one for the $1000-$1FFF range
- STA $C000
- LSR A
- STA $C000
- LSR A
- STA $C000
- LSR A
- STA $C000
- LSR A
- STA $C000
- LDA #%00010000 ;This just sets the PRG bank. For now, no PRG swapping, and no WRAM
- STA $E000
- LSR A
- STA $E000
- LSR A
- STA $E000
- LSR A
- STA $E000
- LSR A
- STA $E000
- vblankwait2: ; Second wait for vblank to make sure PPU is ready
- BIT $2002
- BPL vblankwait2
- PalLoad:
- LDA $2002 ;PPU? r u there? We need to reset the HiLo latch!
- LDA #$3F ;Hi part of $3F00
- STA $2006
- LDA #$00 ;Lo part of it
- STA $2006
- LDX #$00
- PalLoop:
- LDA pal, x
- STA $2007 ;Load 'em palettes to PPU
- INX
- CPX #$20
- BNE PalLoop ;Advance only when all 32 palettes are copied!
- RTS
- LoadTitle:
- LDA $2002
- LDA #$20
- STA $2006
- LDA #$45
- STA $2006 ;Begins at $2000
- LDA #$0A ;Should write tile 0A to the background... DOES JACK SHITHFASIFGSAFIJAHF;AJKSD!!!!1!!111one!!
- STA $2007
- LDA #%10010000 ; enable NMI, 8x8 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
- Forever:
- JMP Forever
- NMI:
- LDA #$00
- STA $2003 ; set the low byte (00) of the RAM address
- LDA #$02
- STA $4014 ; set the high byte (02) of the RAM address, start the transfer
- PPUCleanup:
- LDA #%10010000 ; enable NMI, 8x16 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 ; no scrolling
- STA $2005
- STA $2005
- RTI
- ;;;;;;;;;;;;;;;;;;;;;;
- .bank 31
- .org $E000
- pal:
- .db $0F,$1C,$2C,$3C,$1A,$04,$14,$24,$10,$00,$10,$20,$1A,$18,$28,$38
- .db $0F,$0F,$17,$36,$0F,$0F,$21,$36,$0F,$0F,$27,$17,$0F,$07,$2A,$2B
- title:
- .db $FE,$60
- .db $60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$6a,$6b,$6c,$6d,$6e,$6f
- .db $70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$7a,$7b,$7c,$7d,$7e,$7f
- .db $60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$6a,$6b,$6c,$6d,$6e,$6f
- .db $70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$7a,$7b,$7c,$7d,$7e,$7f
- .db $60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$6a,$6b,$6c,$6d,$6e,$6f
- .db $70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$7a,$7b,$7c,$7d,$7e,$7f
- .db $60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$6a,$6b,$6c,$6d,$6e,$6f
- .db $70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$7a,$7b,$7c,$7d,$7e,$7f
- .db $60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$6a,$6b,$6c,$6d,$6e,$6f
- .db $70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$7a,$7b,$7c,$7d,$7e,$7f
- .db $60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$6a,$6b,$6c,$6d,$6e,$6f
- .db $70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$7a,$7b,$7c,$7d,$7e,$7f
- .db $60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$6a,$6b,$6c,$6d,$6e,$6f
- .db $70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$7a,$7b,$7c,$7d,$7e,$7f
- .db $60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$6a,$6b,$6c,$6d,$6e,$6f
- .db $70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$7a,$7b,$7c,$7d,$7e,$7f
- .org $FFFA ;first of the three vectors starts here
- .dw NMI ;when an NMI happens (once per frame if enabled) the
- ;processor will jump to the label NMI:
- .dw RESET ;when the processor first turns on or is reset, it will jump
- ;to the label RESET:
- .dw 0 ;external interrupt IRQ is not used in this tutorial
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 32
- .org $0000
- .incbin "FoE-spr1.chr" ;Include the first sprite sheet
- .incbin "FoE-bgr.chr" ;Include the "Faces of Evil" background file
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 33
- .org $0000
- .incbin "FoE-spr2.chr" ;Include the first sprite sheet
- .incbin "FoE-bgr.chr" ;Include the "Faces of Evil" background file
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 34
- .org $0000
- .incbin "FoE-spr3.chr" ;Include the first sprite sheet
- .incbin "FoE-bgr.chr" ;Include the "Faces of Evil" background file
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 35
- .org $0000
- .incbin "FoE-spr1.chr" ;Include the third sprite sheet
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 36
- .org $0000
- .incbin "FoE-bgr.chr" ;Include the "Faces of Evil" background file
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 37
- .org $0000
- .incbin "FoE-spr1.chr" ;Include the first sprite sheet
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 38
- .org $0000
- .incbin "FoE-spr2.chr" ;Include the second sprite sheet
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 39
- .org $0000
- .incbin "FoE-spr1.chr" ;Include the third sprite sheet
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 40
- .org $0000
- .incbin "FoE-bgr.chr" ;Include the "Faces of Evil" background file
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 41
- .org $0000
- .incbin "FoE-spr1.chr" ;Include the first sprite sheet
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 42
- .org $0000
- .incbin "FoE-spr2.chr" ;Include the second sprite sheet
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 43
- .org $0000
- .incbin "FoE-spr1.chr" ;Include the third sprite sheet
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 44
- .org $0000
- .incbin "FoE-bgr.chr" ;Include the "Faces of Evil" background file
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 45
- .org $0000
- .incbin "FoE-spr1.chr" ;Include the first sprite sheet
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 46
- .org $0000
- .incbin "FoE-spr2.chr" ;Include the second sprite sheet
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- .bank 47
- .org $0000
- .incbin "FoE-spr1.chr" ;Include the third sprite sheet
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement