Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; NO ONE EVER USE THIS, IT IS HORRIBLE. I am just
- ; saving it here so I can look back at it and laugh : )
- a_punch = $01
- b_punch = $02
- select_punch = $04
- start_punch = $08
- up_punch = $10
- down_punch = $20
- left_punch = $40
- right_punch = $80
- sprite = $200
- sprite2 = $204
- sprite3 = $208
- sprite4 = $20c
- sprite5 = $210
- sprite6 = $214
- sprite7 = $218
- sprite8 = $21c
- sprite9 = $220
- sprite10 = $224
- sprite11 = $228
- init = $898a
- play = $8977
- .segment "ZEROPAGE"
- control_pad: .res 1
- control_old: .res 1
- nmi_num: .res 1
- on_title: .res 1
- on_instr: .res 1
- on_game: .res 1
- .segment "CODE"
- .incbin "music\ncat.nsf"
- reset:
- sei
- cld
- ldx #$00
- stx $4015
- ldx #$40
- stx $4017
- ldx #$ff
- txs
- inx
- stx $2000
- stx $2001
- : bit $2002
- bpl :-
- : bit $2002
- bpl :-
- txa
- clrmem:
- sta $000,x
- sta $100,x
- sta $200,x
- sta $300,x
- sta $400,x
- sta $500,x
- sta $600,x
- sta $700,x
- inx
- bne clrmem
- : bit $2002
- bpl :-
- ldx #$ff
- txs
- jsr PPU_off
- jsr graphics
- jsr init
- jsr song1
- jsr PPU_with_sprites
- loop:
- jsr wait_for_nmi
- jmp loop
- graphics:
- ldx #$0 ; Pull in bytes for sprites and their
- : lda orig_sprite_data,x ; attributes which are stored in
- sta sprite,x ; the_sprites. Use X as an index
- inx ; to load and store each byte, which
- cpx #$04 ; get stored starting in $200, where
- bne :- ; 'sprite' is located at.
- lda #$3F
- ldx #$00
- sta $2006
- stx $2006
- : lda palette,x
- sta $2007
- inx
- cpx #$20
- bne :-
- jsr title_screen
- rts
- song1:
- lda #$0
- ldx #$00
- jsr init
- lda #%10000000
- sta $2000
- rts
- song2:
- lda #$1
- ldx #$00
- jsr init
- lda #%10000000
- sta $2000
- rts
- shift_sprite_down:
- lda #$85
- sta sprite
- rts
- shift_sprite_up:
- lda #$75
- sta sprite
- rts
- title_screen:
- lda #$01
- sta on_title
- jsr PPU_off
- ldy #$00
- sty on_game
- sty on_instr
- ldx #$04
- lda #<title
- sta $10
- lda #>title
- sta $11
- lda #$20
- sta $2006
- lda #$00
- sta $2006
- : lda ($10),y
- sta $2007
- iny
- bne :-
- inc $11
- dex
- bne :-
- jsr PPU_no_sprites
- jsr PPU_with_sprites
- lda #$00
- sta $2006
- sta $2006
- sta $2005
- sta $2005
- rts
- game_area:
- lda #$01
- sta on_game
- jsr PPU_off
- ldy #$00
- sty on_title
- sty on_instr
- ldx #$04
- lda #<room
- sta $10
- lda #>room
- sta $11
- lda #$20
- sta $2006
- lda #$00
- sta $2006
- : lda ($10),y
- sta $2007
- iny
- bne :-
- inc $11
- dex
- bne :-
- jsr song2
- jsr PPU_no_sprites
- ldx #$00 ; Pull in bytes for sprites and their
- : lda orig_sprite_data+4,x ; attributes which are stored in
- sta sprite,x ; the_sprites. Use X as an index
- inx ; to load and store each byte, which
- cpx #$2c ; get stored starting in $200, where
- bne :- ; 'sprite' is located at.
- jsr PPU_with_sprites
- lda #$00
- sta $2006
- sta $2006
- sta $2005
- sta $2005
- rts
- instructions:
- lda #$01
- sta on_instr
- jsr PPU_off
- ldy #$00
- sty on_game
- sty on_title
- ldx #$04
- lda #<instr
- sta $10
- lda #>instr
- sta $11
- lda #$20
- sta $2006
- lda #$00
- sta $2006
- : lda ($10),y
- sta $2007
- iny
- bne :-
- inc $11
- dex
- bne :-
- jsr PPU_no_sprites
- lda #$00
- sta $2006
- sta $2006
- sta $2005
- sta $2005
- rts
- title_control: ; Control routine for the title screen
- jsr control_update
- ; Start button
- lda control_pad
- eor control_old
- and control_pad
- and #start_punch
- beq no_start_punch
- lda sprite
- cmp #$77
- bne load_instr
- jsr game_area
- jmp no_start_punch
- load_instr:
- jsr instructions
- no_start_punch: ; Select button
- lda control_pad
- eor control_old
- and control_pad
- and #select_punch
- beq no_select_punch
- lda sprite
- cmp #$77
- beq move_up
- sec
- lda sprite
- sbc #$10
- sta sprite
- jmp no_select_punch
- move_up:
- clc
- lda sprite
- adc #$10
- sta sprite
- no_select_punch:
- rts
- instr_control:
- jsr control_update
- lda control_pad
- eor control_old
- and control_pad
- and #b_punch
- beq no_b_punch
- jsr title_screen
- no_b_punch:
- rts
- game_control:
- jsr control_update
- lda control_pad ; Down button
- eor control_old
- and control_pad
- and #down_punch
- beq no_down_punch
- lda sprite
- cmp #$d7
- beq at_bottom
- clc
- lda sprite
- adc #$0a
- sta sprite
- ; jmp no_down_punch
- at_bottom:
- jmp no_down_punch
- ; lda control_pad ; Down button
- ; eor control_old
- ; and control_pad
- ; and #$06
- ; jmp no_down_punch
- no_down_punch: ; Up button
- lda control_pad
- eor control_old
- and control_pad
- and #up_punch
- beq no_up_punch
- lda sprite
- cmp #$af
- beq at_top
- sec
- lda sprite
- sbc #$0a
- sta sprite
- ; jmp no_up_punch
- at_top:
- jmp no_up_punch
- no_up_punch: ; A button
- lda control_pad
- eor control_old
- and control_pad
- and #a_punch
- rts
- control_update:
- lda #$01
- sta $4016
- lda #$00
- sta $4016
- lda control_pad
- sta control_old
- ldx #$08
- :
- lda $4016
- lsr A
- ror control_pad
- dex
- bne :-
- rts
- sprite_cram:
- lda #>sprite
- sta $4014
- rts
- PPU_off:
- lda #$00
- sta $2000
- sta $2001
- rts
- PPU_with_sprites:
- lda #%10010000
- sta $2000
- lda #%00011110
- sta $2001
- rts
- PPU_no_sprites:
- lda #%10010000
- sta $2000
- lda #%00001110
- sta $2001
- rts
- wait_for_nmi:
- lda nmi_num
- @check:
- cmp nmi_num
- beq @check
- rts
- nmi:
- pha
- txa
- pha
- tya
- pha
- inc nmi_num
- lda on_title
- beq try_instr
- jsr title_control
- jmp continue_nmi
- try_instr:
- lda on_instr
- beq try_game
- jsr instr_control
- jmp continue_nmi
- try_game:
- lda on_game
- beq continue_nmi
- jsr game_control
- jmp continue_nmi
- continue_nmi:
- jsr sprite_cram
- jsr play
- lda #$00
- sta $2005
- sta $2005
- end_nmi:
- pla
- tay
- pla
- tax
- pla
- rti
- irq:
- rti
- palette:
- .incbin "palettes\ncat.pal"
- ; *********************************************************
- ; The .bytes below are setup for the sprites to be used *
- ; .byte (Y-Pos),(Tile Number),(Attributes),(X-Pos) *
- ; *********************************************************
- orig_sprite_data:
- .byte $77,$01,$01,$4d ; title sprite
- .byte $af,$02,$02,$09 ; menu sprite
- .byte $90,$03,$01,$80
- .byte $90,$04,$01,$88
- .byte $90,$05,$01,$90
- .byte $90,$06,$01,$98
- .byte $98,$13,$01,$80
- .byte $98,$14,$01,$88
- .byte $98,$15,$01,$90
- .byte $98,$16,$01,$98
- .byte $98,$17,$01,$a0
- ; *********************************************************
- ; Include all of the nametables for the game below *
- ; *********************************************************
- title:
- .incbin "nametables\ncat_title.nam"
- instr:
- .incbin "nametables\ncat_instr.nam"
- room:
- .incbin "nametables\ncat_room.nam"
- .segment "VECTORS"
- .addr nmi
- .addr reset
- .addr irq
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement