[plug] Cross-assembler IDE
    Leon Brooks 
    leonb at brooks.fdns.net
       
    Fri Jul 13 09:51:10 WST 2001
    
    
  
Simon.Scott at flexiplan.com wrote:
> Im looking for a good cross-assembler/disassembler IDE for linux, preferably for
> the 6502 processor.
> Ive found a few assemblers, no disassemblers, and nothing that even resembles an
> IDE.
And how hard can a 6502 disassembler be to write? It only has 1-byte 
opcodes - which are highly systematic - and a very simple set of 
addressing schemes.
char * opcodes [256] = {
     "BRK", "ORA", "=error=", "SLO", ...
};
enum {
     NONE, IMPLIED, IMMEDIATE, RELATIVE,
     INDIRX, INDIRY, ZEROPX, ZEROPY, ... } mode;
#define UNDOC 0x80;
short modes [256] = {
     NONE, INDIRX, NONE, INDIRX|UNDOC, ...
};
char * operands (unsigned * pc, mode thismode) {
     char retval [30];
     switch (thismode & ~UNDOC) {
     case NONE:
         retval [0] = '\0';
         break;
     case DIRECT:
         sprintf (retval, "\t#%02X", getchar () & 0xFF);
         break;
     case ...
     }
}
void main (void) {
     int opcode;
     unsigned address;
     address = 0U;
     while ((opcode = getchar ()) != EOF) {
         printf ("%04x\t%s%s\n", address ++, opcodes [opcode & 0xFF],
           operands (& address, modes [opcode & 0xFF]));
     }
}
Give me an opcode table and it's yours in under an hour. (-:
http://pmwww.cs.vu.nl/home/ipoorten/Atari.8bit.Homepage/texts/c64.65xx.85xx.document
    
    
More information about the plug
mailing list