diff options
| author | Miquel Sabaté Solà <msabate@suse.com> | 2023-11-12 09:39:05 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-02-04 21:02:11 +0100 |
| commit | db9cb2118e7b2575ed3b0f535e50dd85c24df25a (patch) | |
| tree | 8bfe1a7e48bd85e2e9ab0c650c248a7bed1955b7 /basics | |
| parent | cb854722b9890c171f7d0600812a7e9a3a2a25c9 (diff) | |
| download | code.nes-db9cb2118e7b2575ed3b0f535e50dd85c24df25a.tar.gz code.nes-db9cb2118e7b2575ed3b0f535e50dd85c24df25a.zip | |
space: Simplify the code and its goals
Originally this was supposed to be a sort of mini game, but that would
have probably made it too complex for newcomers. Thus, let's just keep
it to subpixel movement and shooting bullets, which is already a big
step from the `basics/sprite.s` example.
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'basics')
| -rw-r--r-- | basics/sprite.s | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/basics/sprite.s b/basics/sprite.s index 09dd8e5..fc024f7 100644 --- a/basics/sprite.s +++ b/basics/sprite.s @@ -185,10 +185,11 @@ reset: inx bne @ram_reset_loop ; if x overflows back to #00, then we are done. - ;; And now another thing we can do is to reset the sprites. In NES programs - ;; sprites live in a special range of memory addresses from the RAM called - ;; OAM (Object Attribute Memory). This range is located in $0200-02ff (the - ;; range we did not initialize when cleaning up RAM). + ;; And now another thing we can do is to reset the sprites. We will reserve + ;; space for sprites in $0200-02ff (the range we did not initialize when + ;; cleaning up RAM). With this in mind we will perform a DMA process right + ;; after this block of code that will take this memory range and bulk it + ;; into PPU OAM space. ;; ;; "Resetting sprites" is just a matter of giving them a value which will ;; not bother us in the future. One way to do this is to set each value to @@ -209,8 +210,8 @@ reset: ;; the byte given at the OAMADDR, thus XX = #$00; and N = 2 (see `lda ;; #$02`). Therefore, we are telling the PPU to start the DMA process from ;; $200. The PPU will assume that the following 256 bytes of memory are the - ;; ones to be copied, resulting in a DMA copy of $200-$2ff, right where the - ;; sprite data is located in memory. + ;; ones to be copied, resulting in a DMA copy of $200-$2ff, right where we + ;; stored the sprite data in advance. lda #$00 sta $2003 ; OAMADDR lda #$02 |
