Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub drawBackground
- 'HELP MY BRAIN IS MELTING
- Dim As Integer Offset
- Dim As Integer tileDrawn 'Offset for the number of tiles drawn already so we don't overwrite shit
- If (cpu.memory(&h2000) Shr 4) = 0 Then Offset = 0 Else Offset = &h1000 'Background pattern Address
- If cpu.memory(&h2002) Shr 7 = 0 Then
- Do
- For i As UByte = 0 To 7 'Draw 8 pixels
- 'Ok, so this next line is a bit crazy
- ppu.background(ppu.tilesDrawn * 8 + i,(ppu.tilesDrawn * 8)/256) = (ppu.pattern(ppu.VRAM(offset + ppu.tilesDrawn)) Shr (7-i)And 1) 'Fills n - rows with the low bit of pixels
- ppu.background(ppu.tilesDrawn * 8 + i,(ppu.tilesDrawn * 8)/256) or= (ppu.pattern(ppu.VRAM(offset + ppu.tilesDrawn + 8)) Shr (7-i)And 1) 'Same as above but for high bit
- rowsDrawn += 1
- next
- Loop While ppu.tilesToDraw > 0
- endif
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement