Problems changing syntax from NESASM to ASM6

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
arcangeldemerida
Posts: 21
Joined: Wed Jun 22, 2022 7:00 am

Problems changing syntax from NESASM to ASM6

Post by arcangeldemerida »

I am trying to make modifications to the code of my Pong Game so that I can assemble it with ASM6 assembler.

After making modifications to be able to assemble, I still can't assemble it.

I attach my ASM file and a TXT of the errors that the assembler gives me.
Attachments
failed to assemble.txt
(6.05 KiB) Downloaded 26 times
pong_basic_(ASM6).asm
(38.99 KiB) Downloaded 18 times
User avatar
freem
Posts: 176
Joined: Mon Oct 01, 2012 3:47 pm
Location: freemland (NTSC-U)
Contact:

Re: Problems changing syntax from NESASM to ASM6

Post by freem »

There's a few issues here:

1) ASM6 local label scope (labels that start with @) gets reset when a non-local label is defined. Changing @UpdateGameComponentsDone to UpdateGameComponentsDone everywhere is one way of fixing it.

2) JSR @DrawScore should be JSR DrawScore

3) Macros should have arguments after the macro name (and apparently they can't be numbers). I'm just going to paste the fixed macros here:

Code: Select all

MACRO Test_Button var, btn
	LDA var
	AND #btn
	ENDM
	
MACRO Test_Button_Pressed var, btn
	LDA var+1
	AND #btn
	BNE @Test_Button_Pressed_PrevWasPressed
	LDA var
	AND #btn	
	JMP @Test_Button_Pressed_Done
@Test_Button_Pressed_PrevWasPressed:
	LDX #$FF
	INX
@Test_Button_Pressed_Done:
	ENDM
	
MACRO Test_Button_Released var, btn
	LDA var
	AND #btn
	BNE @Test_Button_Released_CurrWasReleased
	LDA var+1
	AND #btn
	JMP @Test_Button_Released_Done
@Test_Button_Released_CurrWasReleased:
	LDX #$FF
	INX
@Test_Button_Released_Done:
	ENDM
Hope this helps!
arcangeldemerida
Posts: 21
Joined: Wed Jun 22, 2022 7:00 am

Re: Problems changing syntax from NESASM to ASM6

Post by arcangeldemerida »

freem wrote: Mon Aug 01, 2022 11:09 am There's a few issues here:

1) ASM6 local label scope (labels that start with @) gets reset when a non-local label is defined. Changing @UpdateGameComponentsDone to UpdateGameComponentsDone everywhere is one way of fixing it.

2) JSR @DrawScore should be JSR DrawScore

3) Macros should have arguments after the macro name (and apparently they can't be numbers). I'm just going to paste the fixed macros here:

Code: Select all

MACRO Test_Button var, btn
	LDA var
	AND #btn
	ENDM
	
MACRO Test_Button_Pressed var, btn
	LDA var+1
	AND #btn
	BNE @Test_Button_Pressed_PrevWasPressed
	LDA var
	AND #btn	
	JMP @Test_Button_Pressed_Done
@Test_Button_Pressed_PrevWasPressed:
	LDX #$FF
	INX
@Test_Button_Pressed_Done:
	ENDM
	
MACRO Test_Button_Released var, btn
	LDA var
	AND #btn
	BNE @Test_Button_Released_CurrWasReleased
	LDA var+1
	AND #btn
	JMP @Test_Button_Released_Done
@Test_Button_Released_CurrWasReleased:
	LDX #$FF
	INX
@Test_Button_Released_Done:
	ENDM
Hope this helps!
Thank you! :D

With the changes you mentioned plus what I did, now I can assemble it and it works fine.
Attachments
pong_basic_(ASM6).asm
(39.12 KiB) Downloaded 21 times
Post Reply