Posted: Sun Dec 12, 2010 9:05 pm
BigDumbDinosaur wrote:
Not to be pedantic about it, but you assemble 65xx machine code, not compile. A compiler translates a higher level language (e.g., C or COBOL) to machine language, usually by first generating an assembly language source file and then assembling the assembly language instructions. Compilers confer a degree of portability between systems (e.g., a program written in C is usually portable between systems for which a native C compiler exists) and insulate the programmer from the raw machine code instruction set of the target system. By definition, assembly language is not portable, as each MPU has its own instruction set and each system has its own unique architecture.
An assembler is a compiler, but a degenerate one. An assembler distinguishes itself from other compilers in that it provides a 1:1 correspondence between input source text and output binary image. This is why Forth, despite the routine and informal references to compilation, is nonetheless described as an assembler for a virtual stack machine.
Indeed, nothing in assembly languages implies lack of portability either; Java's VM has several assemblers for it, yet their results are able to be run anywhere a JVM exists. Indeed, IBM's AS/400 system success is very much predicated on this concept. Even in the VAX/VMS world, out of necessity, contemporary VAX assemblers exist for OpenVMS systems which, actually, emit code for Alpha and IA64 architectures. As long as a one-for-one code correspondence exists, it's an assembler.
Compilers, interestingly, don't always imply portability either. BASIC-Stamp systems are tightly integrated with the PIC architecture, as the "Wire" language is for the Arduino platform.
And, I won't get into the dirty little secret behind C's ostensible claim to portability. It's portable, but only with a whole lot of qualifications that often get swept under the rug for marketing or convenience purposes.
Quote:
Start your source code with .ORG <address> or *=<address> to set the starting assembly address. There is seldom a default and the MPU itself goes to $FFFC-$FFFD for the starting address following a hard reset.
To find out at run-time where your code exists, you can use the following clip of code to find out:
Code: Select all
JSR *+3
PLA ; HUH -- I'm so used to working with the 65816,
TAX ; I forgot that not all 6502 variants support PLX. :)
PLA