aboutsummaryrefslogtreecommitdiff
path: root/examples/wrapper.s
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <msabate@suse.com>2023-09-27 09:49:50 +0200
committerMiquel Sabaté Solà <mikisabate@gmail.com>2025-02-04 20:58:20 +0100
commitbe2414f5b11b182998fca7e87712ff0502c8ee93 (patch)
tree2445618e7ee4115ee2ae96181f8f09a12264f344 /examples/wrapper.s
parentbc87587330e9265b23861d0f763fdb1612e5f632 (diff)
downloadcode.nes-be2414f5b11b182998fca7e87712ff0502c8ee93.tar.gz
code.nes-be2414f5b11b182998fca7e87712ff0502c8ee93.zip
Add a sprite example
This is way better documented. Moreover, the `input.s` example has been further simplified. Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'examples/wrapper.s')
-rw-r--r--examples/wrapper.s90
1 files changed, 0 insertions, 90 deletions
diff --git a/examples/wrapper.s b/examples/wrapper.s
deleted file mode 100644
index 673c697..0000000
--- a/examples/wrapper.s
+++ /dev/null
@@ -1,90 +0,0 @@
-;;;
-;; This is an empty wrapper for the NES. It does some basic hardware
-;; initialization and finally calls a `Main` subroutine that is to be provided
-;; by another file. After that, it loops indefinitely.
-;;
-;; There are some variations of this file already, I just took it from
-;; NESHacker: https://github.com/NesHacker (definitely check his Youtube
-;; channel, it's extra-dope!); originally licensed under the MIT License.
-;;;
-
-.import Main
-
-.segment "HEADER"
- .byte $4E, $45, $53, $1A ; iNES header identifier
- .byte 2 ; 2x 16KB PRG-ROM Banks
- .byte 1 ; 1x 8KB CHR-ROM
- .byte $01, $00 ; mapper 0, vertical mirroring
-
-.segment "VECTORS"
- .addr nmi
- .addr reset
- .addr 0
-
-.segment "STARTUP"
-
-.segment "CHARS"
-
-.segment "CODE"
-
-.proc nmi
- bit $2002
- lda #0
- sta $2006
- sta $2006
- rti
-.endproc
-
-.proc ResetPalettes
- bit $2002
- lda #$3f
- sta $2006
- lda #$00
- sta $2006
- lda #$0F
- ldx #$20
-@paletteLoadLoop:
- sta $2007
- dex
- bne @paletteLoadLoop
- rts
-.endproc
-
-.proc reset
- sei
- cld
- ldx #%01000000
- stx $4017
- ldx #$ff
- txs
- ldx #0
- stx $2000
- stx $2001
- stx $4010
- bit $2002
-@vblankWait1:
- bit $2002
- bpl @vblankWait1
-@clearMemory:
- lda #$00
- sta $0000, x
- sta $0100, x
- sta $0200, x
- sta $0300, x
- sta $0400, x
- sta $0500, x
- sta $0600, x
- sta $0700, x
- inx
- bne @clearMemory
-@vblankWait2:
- bit $2002
- bpl @vblankWait2
- jsr ResetPalettes
-main:
- jsr Main
- lda #%00001000
- sta $2001
-endlessLoop:
- jmp endlessLoop
-.endproc