One of the documents I am learning about it from is a super mario bros. disassembly document.
It would have been great, if you had included a link to the source, and especially for what system the source was meant - after all, Super Mario Bros. has been ported to many many different systems. Also, what assembler the source was meant for, as each has its own directives. Saves a lot of guessing.
.index 8
.mem 8
Well, this looks quite like a setup for a 65816 (*1), doesn't it? (*2)
So I guess the system is a SNES?
The 65816 can operate in various combinations of 8 and 16 bit wide data modes. These are set by the m
(accumulator and Memory width) and x
(indeX width) status register bits. Instructions behave differently depending on how these bits are set and code generation has to be made accordingly (*3). Since the assembler got no idea of the state of these bits (*4), the programmer must give some hint to the assembler.
.index 8
tells the assembler to generate code as if the index register (X/Y) width is set to 8 bit.
.mem 8
likely advises the assembler to generate code as if memory access is 8 bit wide.
.org $8000
now just means to assemble the following code starting at Address $8000.
I have never heard of these directives.
I've got some doubt, as ORG is about the most basic directive that every assembler does support.
Is there some kind of reference document out there that has all of these 6502 directives on it with an explanation as to what they do?
You may want to read a bit about assemblers in general and the manual for the one you are about to use - and eventually the one the source is meant for as well.
Here for example, a very brief introduction of the 65816 for already experienced 6502 programmers.
But then again, 6502.org is always a good start and should be your first stop for everything about the 6502. In particular the tutorials page. Some assembly required.
*1 - While WDC did try to standardise the 65816 assembler syntax (See section 6 of the datasheet), they did not provide any guideline for the new directives needed.
*2 - No, it isn't, as the later added source link shows, it's rather clean 6502 (even NMOS) code, but the original author used an 65816 assembler (x816, a somewhat dated assembler for MS-DOS) that requires these directives to make sure 8 bit code is produced. Adding references is a great way to avoid false guessing, isn't it?
*3 - Explaining all the details are way out of scope here, get some 65816 manual/lecture and spend some time reading.
*4 - They are dynamic at runtime and set/reset by SEP
/REP
instructions.