Page 1 of 1

WLA DX Assembler question

Posted: Thu Feb 02, 2017 3:41 am
by urbanspr1nter
Hi all, newbie here ... I've been reading through a few tutorials and have been coming across syntax like this:

Code: Select all

ldx #32*\1+\2
The way I have been interpreting this is that we are loading the decimal value

Code: Select all

32
to the X register. But what does

Code: Select all

*\1 + \2
mean? Specifically what does the

Code: Select all

*
and

Code: Select all

\
signify?

Re: WLA DX Assembler question

Posted: Thu Feb 02, 2017 3:54 am
by BigDumbDinosaur
urbanspr1nter wrote:
Hi all, newbie here ... I've been reading through a few tutorials and have been coming across syntax like this:

Code: Select all

ldx #32*\1+\2
The way I have been interpreting this is that we are loading the decimal value 32 to the X register. But what does *\1 + \2 mean? Specifically what does the * and \ signify?
Firstly, welcome to our 6502 world.

I'd have to know which assembler is being used to answer your question. Usually, * represents the program counter, but could also mean multiplication (it's context-dependent). The use of \ is something I have not seen before in assembly language.

Re: WLA DX Assembler question

Posted: Thu Feb 02, 2017 4:10 am
by whartung
Looks like it might be macro arguments to me. Can you post more of the code snippet?

Fromt the math it's like it's shift the first argument 5 bits (i.e. 32), then adding in the second.

Re: WLA DX Assembler question

Posted: Thu Feb 02, 2017 4:55 am
by urbanspr1nter
BigDumbDinosaur wrote:
urbanspr1nter wrote:
Hi all, newbie here ... I've been reading through a few tutorials and have been coming across syntax like this:

Code: Select all

ldx #32*\1+\2
The way I have been interpreting this is that we are loading the decimal value 32 to the X register. But what does *\1 + \2 mean? Specifically what does the * and \ signify?
Firstly, welcome to our 6502 world.

I'd have to know which assembler is being used to answer your question. Usually, * represents the program counter, but could also mean multiplication (it's context-dependent). The use of \ is something I have not seen before in assembly language.

Thank you. Actually I think whartung might be right.

I looked over some of the wla documentation and apparently they are macro arguments.

\1 and \2 are the first and second parameters respectively. It looks like it is actually doing what whartung also says... It multiplies the first argument by 32, then adds the second parameter.

I'm just looking over some SNES sample code in terms of loading tile info into VRAM and now it makes more sense. :)