Lord_Klump_Of_Kongo_Bongo
Active member
Yo! so as you all know I'm working on my Indie NES game currently known as Project Hexagon. But anyway my current issue is when loading the units aka the tile changes during postscreenload.asm
the game while working one hundred percent correctly in gameplay... the graphics bug out hard! here is an example:
so yeah... again in postscreenload this happens when loading all these tiles at once for gameplay purposes
here is my tile change macro's (originally made by @dale_coop) subroutine for changing tiles:
also ignore the fact the units are numbers, just wanted to make it easier for me to debug something else I already solved
UPDATE:
found the script that probably is the one that needs a paint job being -
doUpadateScrollColumn.asm:
almost got it!
it seems when I remove the top two lines of this routine (which looked odd to me) it mostly fixes it!
so it went from this:
to this:
but now the other half of the screen's tile changes are a bit iffy... any thoughts?
the game while working one hundred percent correctly in gameplay... the graphics bug out hard! here is an example:
so yeah... again in postscreenload this happens when loading all these tiles at once for gameplay purposes
here is my tile change macro's (originally made by @dale_coop) subroutine for changing tiles:
and to clarify where I think the bug resides it's in this part:doLoadUnitTiles:
LDA arg1_hold
ASL
ASL
ASL
ASL
AND #%11110000
STA tempz
LDA arg0_hold
ORA tempz
TAY
LDA arg4_hold
BEQ +isEvenCt
; is an odd ct, so looking in collisionTable2
LDA arg3_hold
STA collisionTable2,y
JMP +doneWithTileUpdate
+isEvenCt
LDA arg3_hold
STA collisionTable,y
+doneWithTileUpdate
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; This part will actually update the tile with tile 0 in the tile set.
; ys is carried over from above.
; GET THE HIGH BYTE OF THE TILE TO CHANGE
LDA arg4_hold
BEQ +isEvenNt
;;is odd nt
LDA #$24
JMP +gotNt
+isEvenNt
;;is even nt
LDA #$24
+gotNt
STA temp1
; GET THE LOW BYTE OF THE TILE TO CHANGE
TYA
STA temp
LSR
LSR
LSR
LSR
LSR
LSR
clc
ADC temp1
STA temp2 ;;;temp16+1
TYA
AND #%11110000
ASL
ASL
STA tempz
TYA
AND #%00001111
ASL
ORA tempz
STA temp3 ;temp16
; SET THE TILE NUMBER TO CHANGE TO.
LDA arg2_hold ;; the tile to change.
; this is in tiles, so if you wanted the second "metatile",
; use 2, not 1. If you wanted the tile in the next row,
; use #$20, not #$10. Etc.
STA tempA
CLC
ADC #$01
STA tempB
CLC
ADC #$0F
STA tempC
CLC
ADC #$01
STA tempD
LDY scrollOffsetCounter
LDA temp2
STA scrollUpdateRam,y
INY
LDA temp3
STA scrollUpdateRam,y
INY
LDA tempA
STA scrollUpdateRam,y
INY
LDA temp2
STA scrollUpdateRam,y
INY
LDA temp3
CLC
ADC #$01
STA scrollUpdateRam,y
INY
LDA tempB
STA scrollUpdateRam,y
INY
LDA temp3
CLC
ADC #$20
STA temp3
LDA temp2
ADC #$00
STA temp2
LDA temp2
STA scrollUpdateRam,y
INY
LDA temp3
STA scrollUpdateRam,y
INY
LDA tempC
STA scrollUpdateRam,y
INY
LDA temp2
STA scrollUpdateRam,y
INY
LDA temp3
CLC
ADC #$01
STA scrollUpdateRam,y
INY
LDA tempD
STA scrollUpdateRam,y
INY
TYA
STA scrollOffsetCounter
STA maxScrollOffsetCounter
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Turn on update screen on next frame.
LDA updateScreenData
ORA #%0000100
STA updateScreenData
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
RTS
so yeah... any advice?TYA
STA scrollOffsetCounter ; <--- the culprit line of code when removed stops the graphical errors but only loads the last unit in postscreenload as a trade-off
STA maxScrollOffsetCounter
also ignore the fact the units are numbers, just wanted to make it easier for me to debug something else I already solved
UPDATE:
found the script that probably is the one that needs a paint job being -
doUpadateScrollColumn.asm:
when I remove this code no PostScreenLoad.asm tiles appear at all so again I think I'm onto something to solve my weird graphics bug;;; This routine will spread over two frames.
;; The offset for where in the column is being drawn will be held in scrollOffsetCounter.
;; It will load 32 (#$20) tiles per frame, but not quite, because the screen is only
;; 240 px high. So there are 3 reads per tile, 12 per metatile...12x15 rows = 180.
LDY scrollOffsetCounter
LDX #$10
loop_LoadScrollColumn:
LDA scrollUpdateRam,y
STA $2006
STA $07FE
INY
LDA scrollUpdateRam,y
STA $2006
STA $07FF
INY
LDA scrollUpdateRam,y
STA $2007
INY
TYA
STA scrollOffsetCounter
CMP maxScrollOffsetCounter ;; this should probably be variable.
BEQ doneUpdatingColumn
DEX
BNE loop_LoadScrollColumn
JMP notDoneUpdatingColumn
doneUpdatingColumn:
LDA updateScreenData
AND #%11111011
STA updateScreenData
LDA scrollByte
AND #%11111110
STA scrollByte
LDA #$00
STA scrollOffsetCounter
notDoneUpdatingColumn:
almost got it!
it seems when I remove the top two lines of this routine (which looked odd to me) it mostly fixes it!
it seems to eliminate most of the graphical errors!LDY scrollOffsetCounter <--- the top two lines
LDX #$10
so it went from this:
to this:
but now the other half of the screen's tile changes are a bit iffy... any thoughts?
Last edited: