Language…
10 users online: codfish1002, eltiolavara9, GiraffeKiller, Ice Man, koffe190, LazyRuns, RicardoDeMelo, SirGabe, yoshi9429, YuriGamer - Guests: 260 - Bots: 412
Users: 64,795 (2,375 active)
Latest user: mathew

Diagonal scrolling with LevelASM

Hi i'd like to make Diagonal BG scrolling with levelASM. Currently im using this code to make it scroll normally.
Code
	STZ $1413			;\ H-Scroll = none
	STZ $1414			;/ V-Scroll = none
LDA $13
AND #$01
BNE Return
	LDA $1466			;\ Load layer 2 X-position (low byte)
	CLC				;| 
	ADC #$01			;| Scroll speed = #$01
	STA $1466			;/ Store at layer 2 X-position (low byte)
	
	LDA $1467			;\ Load layer 2 X-position (high byte)
	ADC #$00			;| Do not change!
	STA $1467			;| Store at layer 2 X-position (high byte)
Return:
RTS	
Add this after STA $1467:

LDA $1468
CLC
ADC #$01
STA $1468

LDA $1469
ADC #$00
STA $1469
Code
	STZ $1413			;\ H-Scroll = none
	STZ $1414			;/ V-Scroll = none
LDA $13
AND #$01
BNE Return
	LDA $1466			;\ Load layer 2 X-position (low byte)
	CLC				;| 
	ADC #$01			;| Scroll speed = #$01
	STA $1466			;/ Store at layer 2 X-position (low byte)
	
	LDA $1467			;\ Load layer 2 X-position (high byte)
	ADC #$00			;| Do not change!
	STA $1467			;| Store at layer 2 X-position (high byte)
LDA $1468
CLC
ADC #$01
STA $1468

LDA $1469
ADC #$00
STA $1469
Return:
RTS

Doesn't work : \
What does 'not work' mean in this sense? I tested the above code in levelASM and it worked correctly for me.
Originally posted by Iceguy
What does 'not work' mean in this sense? I tested the above code in levelASM and it worked correctly for me.

For some reason it only works on a clean rom for me but w/e i'll deal with that later. The only problem is that it's scrolling the wrong way
Change:
LDA $1468
CLC
ADC #$01
STA $1468
LDA $1469
ADC #$00
STA $1469

To:
LDA $1468
SEC
SBC #$01
STA $1468
LDA $1469
SBC #$00
STA $1469
Originally posted by undefinied3
Change:
LDA $1468
CLC
ADC #$01
STA $1468
LDA $1469
ADC #$00
STA $1469

To:
LDA $1468
SEC
SBC #$01
STA $1468
LDA $1469
SBC #$00
STA $1469

thanks works perfectly :3
Just saying you don't need the ADC #$00 or the SBC #$00, since they aren't adding or subtracting anything.
Originally posted by Ladida
Just saying you don't need the ADC #$00 or the SBC #$00, since they aren't adding or subtracting anything.

Not exactly true. If I recall correctly, in this sense the ADC #$00 and SBC #$00 does pseudo 16-bit math.

I explained the same thing to Jimmy a while back and he was trying to convince me that those bits of code were useless.