NES ASM SCREEN

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
NES ASM SCREEN
by on (#148902)
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)


https://dl.dropboxusercontent.com/u/821 ... SCREEN.rar
Re: NES ASM SCREEN
by on (#148906)
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):
Code:
LoadCompressedScene:
   ;   Nametable Data.
      clc
      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
      dex
      bne    --            ; loop until X = 0!
      iny
      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
   ENDM


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]
Re: NES ASM SCREEN
by on (#148919)
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).