6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 10, 2024 8:13 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu Feb 02, 2017 3:41 am 
Offline

Joined: Thu Feb 02, 2017 3:38 am
Posts: 2
Location: Boise, ID
Hi all, newbie here ... I've been reading through a few tutorials and have been coming across syntax like this:

Code:
ldx #32*\1+\2


The way I have been interpreting this is that we are loading the decimal value
Code:
32
to the X register. But what does
Code:
*\1 + \2
mean? Specifically what does the
Code:
*
and
Code:
\
signify?

_________________
Hah, I'm going to attempt to make a SUPER NINTENDO game!


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 02, 2017 3:54 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8479
Location: Midwestern USA
urbanspr1nter wrote:
Hi all, newbie here ... I've been reading through a few tutorials and have been coming across syntax like this:

Code:
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.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 02, 2017 4:10 am 
Offline

Joined: Sat Dec 13, 2003 3:37 pm
Posts: 1004
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.


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 02, 2017 4:55 am 
Offline

Joined: Thu Feb 02, 2017 3:38 am
Posts: 2
Location: Boise, ID
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:
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. :)

_________________
Hah, I'm going to attempt to make a SUPER NINTENDO game!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: