This is so that I can double the screen size Ala SMB3 by using adjacent tiles to get a certain effect of doubling the screen size using one hex memory address, effectively filling both "screens" of the PPU. While my arrogance that has shown prominently during this wants to explain how I did it, I want to tell you what it was originally
Code: Select all
DrawColumn:
LDA #%00100100 ; set to increment +32 mode
STA $2000
LDA $2002 ; read PPU status to reset the high/low latch
LDA columnHigh
STA $2006 ; write the high byte of column address
LDA columnLow
STA $2006 ; write the low byte of column address
LDX #$1E ; copy 30 bytes
LDY #$1E
DrawColumnLoop:
LDA [sourceLow], y
STA $2007
INY
DEX
BNE DrawColumnLoop
DrawNewColumn2:
LDA scroll ; calculate new column address using scroll register
LSR A
LSR A
LSR A ; shift right 3 times = divide by 8
STA columnLow2 ; $00 to $1F, screen is 32 tiles wide
LDA nametable ; calculate new column address using current nametable
EOR #$01 ; invert low bit, A = $00 or $01
ASL A ; shift up, A = $00 or $02
ASL A ; $00 or $04
CLC
ADC #$28 ; add high byte of nametable base address ($2000) can change to lower name table $2000 = ADC #$20 $2800 = ADC #$28 changes what loads the name table in the bottem name table in
STA columnHigh ; now address = $20 or $24 for nametable 0 or 1
LDA columnNumber2 ; column number * 32 = column data offset
ASL A
ASL A
ASL A
ASL A
ASL A
STA sourceLow2
LDA columnNumber
LSR A
LSR A
LSR A
STA sourceHigh2
LDA sourceLow ; column data start + offset = address to load column data from
CLC
ADC #$04
STA sourceLow2
LDA sourceHigh
ADC #$04
STA sourceHigh2
DrawColumn2:
LDA #%00100100 ; set to increment +32 mode
STA $2000
LDA $2002 ; read PPU status to reset the high/low latch
LDA columnHigh
STA $2006 ; write the high byte of column address
LDA columnLow
STA $2006 ; write the low byte of column address
LDX #$1E ; copy 30 bytes
LDY #$1E
DrawColumnLoop2:
LDA [sourceLow2], y
STA $2007
INY
DEX
BNE DrawColumnLoop2
;;;;;;;;;;
scrollCheck:
LDA player
CLC
ADC #$08
CMP #$80
BEQ ReadController1
LDA player
CLC
ADC #$08
CMP #$80
BCC Rights
LDA player
SEC
SBC #$01
STA player
LDA #$00
STA sdir
JMP ReadController1
RTS
The new code like you said
Whitch keeps the level long without compensating the length.[writes] the value from [sourcelow],y to $2007, then adding 1 that value and writing that to $2007. So for every byte in the address pointed to in sourcelow, you're writing two bytes.
Answer to the second question:
The game isn't finished. When I learn Bank switching and r-a-m- -s-t-o-r-a-g-e(already done) , I'll get working on the other game elements. If there's problem with it, tell me please.