Page 1 of 1

Author:  tales [ Mon Jun 08, 2015 12:45 pm ]
Post subject:  NES ASM SCREEN

Hi guys, I'm new here, and I'm new in NES ASM program too, I really had many dificult to unsderstand how I draw a background into a toll and put it in my code, than I create a simple screen toll, when we enter with a bitmap (create from yy chr), and draw your screen beside, after than, you click in CREATE CODE and open a window with your map code, just copy and past in your code..

Before you create a code you can choose Vertical or Horizontal (if you use %00000000 or %00000100 in your $2000) ... SCREEN.rar

NES ASM SCREEN.rar [178.5 KiB]
Downloaded 171 times

Author:  nIghtorius [ Mon Jun 08, 2015 1:50 pm ]
Post subject:  Re: NES ASM SCREEN

You should implement a compression scheme too. Which takes less space in your ROM.
I'll dig up my simple compression/decompression algorithm ( probably can be written better, but it suits my needs )

decompression code (ASM):
   ;   Nametable Data.
      lda      $02
      sta      $2006
      lda      $03
      sta      $2006
      ldy      #0   
-      lda      ($00), y      ; load repeat value (1--255, 0=EOP)
      beq      +++
      tax                  ; store this in X
      iny                  ; increment Y
      beq    +            ; increase page.
---      lda      ($00), y      ; load tile
--      sta      $2007
      bne    --            ; loop until X = 0!
      beq      ++            ; increase page
----   bne      -            ; start over again.
+      inc      $01
      bcc      ---
++      inc      $01
      bcc      ----
+++      rts

   ; Macro definition
   MACRO   LoadRLEScene   TableAddr, Graphic
      lda      #<Graphic
      sta      $00
      lda      #>Graphic
      sta      $01
      lda      #<TableAddr
      sta      $03
      lda      #>TableAddr
      sta      $02
      jsr      LoadCompressedScene

Compress the nametables (w/ attr-data) with RAWRLE (Commandline tool)
use the LoadCompressedScene function or LoadRLEScene macro to decompress.

for example: LoadRLEScene $2000, Titlescreen which will decompress the data @ pointer Titlescreen to PPU address 0x2000 ($2000)
warning: it destroys memory located at ZP [0x00-0x03]

Attachments: [253.54 KiB]
Downloaded 86 times

Author:  tales [ Mon Jun 08, 2015 6:40 pm ]
Post subject:  Re: NES ASM SCREEN

Nice... but this toll is just to help me draw a screen with my tiles and create a .db ... maybe I improve this to create a attribute (but first I need to undestand how it works in ASM).

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group