#include #include #include #include #include M68Assembler::M68Assembler(void) : mLastLineNumber(0) { createSymbolTable(mSymbolTable); } M68Assembler::M68Assembler(const M68Assembler &someM68Assembler) { // private implementation *this=someM68Assembler; } M68Assembler::~M68Assembler() { } M68Assembler &M68Assembler::operator=(const M68Assembler &/*someM68Assembler*/) { // private implementation return *this; } bool M68Assembler::operator==(const M68Assembler &/*someM68Assembler*/)const { // private implementation return FALSE; } const String &M68Assembler::strLastMessage(void)const { return mLastMessage; } DWORD M68Assembler::lastLineNumber(void)const { return mLastLineNumber; } void M68Assembler::createSymbolTable(Table &symbolTable) { Block symbols; symbolTable.remove(); symbols.insert(&Symbol("aba",Scan::aba1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x1B)))); symbols.insert(&Symbol("abx",Scan::abx1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x3A)))); symbols.insert(&Symbol("aby",Scan::aby1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x3A,0x18)))); symbols.insert(&Symbol("adca",Scan::adca1,Symbol::KeywordSymbol,Instruction(5,Instruction::SingleByte,AddressMode(AddressMode::Immediate,0x89),AddressMode(AddressMode::Direct,0x99),AddressMode(AddressMode::Extended,0xB9),AddressMode(AddressMode::Indexed,0xA9),AddressMode(AddressMode::Indexed,0xA9,0x18)))); symbols.insert(&Symbol("adcb",Scan::adcb1,Symbol::KeywordSymbol,Instruction(5,Instruction::SingleByte,AddressMode(AddressMode::Immediate,0xC9),AddressMode(AddressMode::Direct,0xD9),AddressMode(AddressMode::Extended,0xF9),AddressMode(AddressMode::Indexed,0xE9),AddressMode(AddressMode::Indexed,0xE9,0x18)))); symbols.insert(&Symbol("adda",Scan::adda1,Symbol::KeywordSymbol,Instruction(5,Instruction::SingleByte,AddressMode(AddressMode::Immediate,0x8B),AddressMode(AddressMode::Direct,0x9B),AddressMode(AddressMode::Extended,0xBB),AddressMode(AddressMode::Indexed,0xAB),AddressMode(AddressMode::Indexed,0xAB,0x18)))); symbols.insert(&Symbol("addb",Scan::addb1,Symbol::KeywordSymbol,Instruction(5,Instruction::SingleByte,AddressMode(AddressMode::Immediate,0xCB),AddressMode(AddressMode::Direct,0xDB),AddressMode(AddressMode::Extended,0xFB),AddressMode(AddressMode::Indexed,0xEB),AddressMode(AddressMode::Indexed,0xEB,0x18)))); symbols.insert(&Symbol("addd",Scan::addd1,Symbol::KeywordSymbol,Instruction(5,Instruction::DoubleByte,AddressMode(AddressMode::Immediate,0xC3),AddressMode(AddressMode::Direct,0xD3),AddressMode(AddressMode::Extended,0xF3),AddressMode(AddressMode::Indexed,0xE3),AddressMode(AddressMode::Indexed,0xE3,0x18)))); symbols.insert(&Symbol("anda",Scan::anda1,Symbol::KeywordSymbol,Instruction(5,Instruction::SingleByte,AddressMode(AddressMode::Immediate,0x84),AddressMode(AddressMode::Direct,0x94),AddressMode(AddressMode::Extended,0xB4),AddressMode(AddressMode::Indexed,0xA4),AddressMode(AddressMode::Indexed,0xA4,0x18)))); symbols.insert(&Symbol("andb",Scan::andb1,Symbol::KeywordSymbol,Instruction(5,Instruction::SingleByte,AddressMode(AddressMode::Immediate,0xC4),AddressMode(AddressMode::Direct,0xD4),AddressMode(AddressMode::Extended,0xF4),AddressMode(AddressMode::Indexed,0xE4),AddressMode(AddressMode::Indexed,0xE4,0x18)))); symbols.insert(&Symbol("asl",Scan::asl1,Symbol::KeywordSymbol,Instruction(3,Instruction::NotApplicable,AddressMode(AddressMode::Extended,0x78),AddressMode(AddressMode::Indexed,0x68),AddressMode(AddressMode::Indexed,0x68,0x18)))); symbols.insert(&Symbol("asla",Scan::asla1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x48)))); symbols.insert(&Symbol("aslb",Scan::aslb1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x58)))); symbols.insert(&Symbol("asld",Scan::asld1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x05)))); symbols.insert(&Symbol("asr",Scan::asr1,Symbol::KeywordSymbol,Instruction(3,Instruction::NotApplicable,AddressMode(AddressMode::Extended,0x77),AddressMode(AddressMode::Indexed,0x67),AddressMode(AddressMode::Indexed,0x67,0x18)))); symbols.insert(&Symbol("asra",Scan::asra1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x47)))); symbols.insert(&Symbol("asrb",Scan::asrb1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x57)))); symbols.insert(&Symbol("bcc",Scan::bcc1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Relative,0x24)))); symbols.insert(&Symbol("bclr",Scan::bclr1,Symbol::KeywordSymbol,Instruction(3,Instruction::NotApplicable,AddressMode(AddressMode::DirectMask,0x15),AddressMode(AddressMode::IndexedMask,0x1D),AddressMode(AddressMode::IndexedMask,0x1D,0x18)))); symbols.insert(&Symbol("bcs",Scan::bcs1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Relative,0x25)))); symbols.insert(&Symbol("beq",Scan::beq1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Relative,0x27)))); symbols.insert(&Symbol("bge",Scan::bge1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Relative,0x2C)))); symbols.insert(&Symbol("bgt",Scan::bgt1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Relative,0x2E)))); symbols.insert(&Symbol("bhi",Scan::bhi1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Relative,0x22)))); symbols.insert(&Symbol("bhs",Scan::bhs1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Relative,0x24)))); symbols.insert(&Symbol("bita",Scan::bita1,Symbol::KeywordSymbol,Instruction(5,Instruction::SingleByte,AddressMode(AddressMode::Immediate,0x85),AddressMode(AddressMode::Direct,0x95),AddressMode(AddressMode::Extended,0xB5),AddressMode(AddressMode::Indexed,0xA5),AddressMode(AddressMode::Indexed,0xA5,0x18)))); symbols.insert(&Symbol("bitb",Scan::bitb1,Symbol::KeywordSymbol,Instruction(5,Instruction::SingleByte,AddressMode(AddressMode::Immediate,0xC5),AddressMode(AddressMode::Direct,0xD5),AddressMode(AddressMode::Extended,0xF5),AddressMode(AddressMode::Indexed,0xE5),AddressMode(AddressMode::Indexed,0xE5,0x18)))); symbols.insert(&Symbol("ble",Scan::ble1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Relative,0x2F)))); symbols.insert(&Symbol("blo",Scan::blo1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Relative,0x25)))); symbols.insert(&Symbol("bls",Scan::bls1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Relative,0x23)))); symbols.insert(&Symbol("blt",Scan::blt1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Relative,0x2D)))); symbols.insert(&Symbol("bmi",Scan::bmi1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Relative,0x2B)))); symbols.insert(&Symbol("bne",Scan::bne1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Relative,0x26)))); symbols.insert(&Symbol("bpl",Scan::bpl1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Relative,0x2A)))); symbols.insert(&Symbol("bra",Scan::bra1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Relative,0x20)))); symbols.insert(&Symbol("brclr",Scan::brclr1,Symbol::KeywordSymbol,Instruction(3,Instruction::NotApplicable,AddressMode(AddressMode::DirectRelativeMask,0x13),AddressMode(AddressMode::IndexedRelativeMask,0x1F),AddressMode(AddressMode::IndexedRelativeMask,0x1F,0x18)))); symbols.insert(&Symbol("brn",Scan::brn1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Relative,0x21)))); symbols.insert(&Symbol("brset",Scan::brset1,Symbol::KeywordSymbol,Instruction(3,Instruction::NotApplicable,AddressMode(AddressMode::DirectRelativeMask,0x12),AddressMode(AddressMode::IndexedRelativeMask,0x1E),AddressMode(AddressMode::IndexedRelativeMask,0x1E,0x18)))); symbols.insert(&Symbol("bset",Scan::bset1,Symbol::KeywordSymbol,Instruction(3,Instruction::NotApplicable,AddressMode(AddressMode::DirectMask,0x14),AddressMode(AddressMode::IndexedMask,0x1C),AddressMode(AddressMode::IndexedMask,0x1C,0x18)))); symbols.insert(&Symbol("bsr",Scan::bsr1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Relative,0x8D)))); symbols.insert(&Symbol("bvc",Scan::bvc1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Relative,0x28)))); symbols.insert(&Symbol("bvs",Scan::bvs1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Relative,0x29)))); symbols.insert(&Symbol("cba",Scan::cba1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x11)))); symbols.insert(&Symbol("clc",Scan::clc1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x0C)))); symbols.insert(&Symbol("cli",Scan::cli1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x0E)))); symbols.insert(&Symbol("clr",Scan::clr1,Symbol::KeywordSymbol,Instruction(3,Instruction::NotApplicable,AddressMode(AddressMode::Extended,0x7F),AddressMode(AddressMode::Indexed,0x6F),AddressMode(AddressMode::Indexed,0x6F,0x18)))); symbols.insert(&Symbol("clra",Scan::clra1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x4F)))); symbols.insert(&Symbol("clrb",Scan::clrb1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x5F)))); symbols.insert(&Symbol("clv",Scan::clv1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x0A)))); symbols.insert(&Symbol("cmpa",Scan::cmpa1,Symbol::KeywordSymbol,Instruction(5,Instruction::SingleByte,AddressMode(AddressMode::Immediate,0x81),AddressMode(AddressMode::Direct,0x91),AddressMode(AddressMode::Extended,0xB1),AddressMode(AddressMode::Indexed,0xA1),AddressMode(AddressMode::Indexed,0xA1,0x18)))); symbols.insert(&Symbol("cmpb",Scan::cmpb1,Symbol::KeywordSymbol,Instruction(5,Instruction::SingleByte,AddressMode(AddressMode::Immediate,0xC1),AddressMode(AddressMode::Direct,0xD1),AddressMode(AddressMode::Extended,0xF1),AddressMode(AddressMode::Indexed,0xE1),AddressMode(AddressMode::Indexed,0xE1,0x18)))); symbols.insert(&Symbol("com",Scan::com1,Symbol::KeywordSymbol,Instruction(3,Instruction::NotApplicable,AddressMode(AddressMode::Extended,0x73),AddressMode(AddressMode::Indexed,0x63),AddressMode(AddressMode::Indexed,0x63,0x18)))); symbols.insert(&Symbol("coma",Scan::coma1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x43)))); symbols.insert(&Symbol("comb",Scan::comb1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x53)))); symbols.insert(&Symbol("cpd",Scan::cpd1,Symbol::KeywordSymbol,Instruction(5,Instruction::DoubleByte,AddressMode(AddressMode::Immediate,0x83,0x1A),AddressMode(AddressMode::Direct,0x93,0x1A),AddressMode(AddressMode::Extended,0xB3,0x1A),AddressMode(AddressMode::Indexed,0xA3,0x1A),AddressMode(AddressMode::Indexed,0xA3,0xCD)))); symbols.insert(&Symbol("cpx",Scan::cpx1,Symbol::KeywordSymbol,Instruction(5,Instruction::DoubleByte,AddressMode(AddressMode::Immediate,0x8C),AddressMode(AddressMode::Direct,0x9C),AddressMode(AddressMode::Extended,0xBC),AddressMode(AddressMode::Indexed,0xAC),AddressMode(AddressMode::Indexed,0xAC,0xCD)))); symbols.insert(&Symbol("cpy",Scan::cpy1,Symbol::KeywordSymbol,Instruction(5,Instruction::DoubleByte,AddressMode(AddressMode::Immediate,0x8C,0x18),AddressMode(AddressMode::Direct,0x9C,0x18),AddressMode(AddressMode::Extended,0xBC,0x18),AddressMode(AddressMode::Indexed,0xAC,0x1A),AddressMode(AddressMode::Indexed,0xAC,0x18)))); symbols.insert(&Symbol("daa",Scan::daa1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x19)))); symbols.insert(&Symbol("dec",Scan::dec1,Symbol::KeywordSymbol,Instruction(3,Instruction::NotApplicable,AddressMode(AddressMode::Extended,0x7A),AddressMode(AddressMode::Indexed,0x6A),AddressMode(AddressMode::Indexed,0x6A,0x18)))); symbols.insert(&Symbol("deca",Scan::deca1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x4A)))); symbols.insert(&Symbol("decb",Scan::decb1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x5A)))); symbols.insert(&Symbol("des",Scan::des1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x34)))); symbols.insert(&Symbol("dex",Scan::dex1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x09)))); symbols.insert(&Symbol("dey",Scan::dey1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x09,0x18)))); symbols.insert(&Symbol("eora",Scan::eora1,Symbol::KeywordSymbol,Instruction(5,Instruction::SingleByte,AddressMode(AddressMode::Immediate,0x88),AddressMode(AddressMode::Direct,0x98),AddressMode(AddressMode::Extended,0xB8),AddressMode(AddressMode::Indexed,0xA8),AddressMode(AddressMode::Indexed,0xA8,0x18)))); symbols.insert(&Symbol("eorb",Scan::eorb1,Symbol::KeywordSymbol,Instruction(5,Instruction::SingleByte,AddressMode(AddressMode::Immediate,0xC8),AddressMode(AddressMode::Direct,0xD8),AddressMode(AddressMode::Extended,0xF8),AddressMode(AddressMode::Indexed,0xE8),AddressMode(AddressMode::Indexed,0xE8,0x18)))); symbols.insert(&Symbol("fdiv",Scan::fdiv1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x03)))); symbols.insert(&Symbol("idiv",Scan::idiv1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x02)))); symbols.insert(&Symbol("inc",Scan::inc1,Symbol::KeywordSymbol,Instruction(3,Instruction::NotApplicable,AddressMode(AddressMode::Extended,0x7C),AddressMode(AddressMode::Indexed,0x6C),AddressMode(AddressMode::Indexed,0x6C,0x18)))); symbols.insert(&Symbol("inca",Scan::inca1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x4C)))); symbols.insert(&Symbol("incb",Scan::incb1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x5C)))); symbols.insert(&Symbol("ins",Scan::ins1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x31)))); symbols.insert(&Symbol("inx",Scan::inx1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x08)))); symbols.insert(&Symbol("iny",Scan::iny1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x08,0x18)))); symbols.insert(&Symbol("jmp",Scan::jmp1,Symbol::KeywordSymbol,Instruction(3,Instruction::NotApplicable,AddressMode(AddressMode::Extended,0x7E),AddressMode(AddressMode::Indexed,0x6E),AddressMode(AddressMode::Indexed,0x6E,0x18)))); symbols.insert(&Symbol("jsr",Scan::jsr1,Symbol::KeywordSymbol,Instruction(4,Instruction::NotApplicable,AddressMode(AddressMode::Direct,0x9D),AddressMode(AddressMode::Extended,0xBD),AddressMode(AddressMode::Indexed,0xAD),AddressMode(AddressMode::Indexed,0xAD,0x18)))); symbols.insert(&Symbol("ldaa",Scan::ldaa1,Symbol::KeywordSymbol,Instruction(5,Instruction::SingleByte,AddressMode(AddressMode::Immediate,0x86),AddressMode(AddressMode::Direct,0x96),AddressMode(AddressMode::Extended,0xB6),AddressMode(AddressMode::Indexed,0xA6),AddressMode(AddressMode::Indexed,0xA6,0x18)))); symbols.insert(&Symbol("ldab",Scan::ldab1,Symbol::KeywordSymbol,Instruction(5,Instruction::SingleByte,AddressMode(AddressMode::Immediate,0xC6),AddressMode(AddressMode::Direct,0xD6),AddressMode(AddressMode::Extended,0xF6),AddressMode(AddressMode::Indexed,0xE6),AddressMode(AddressMode::Indexed,0xE6,0x18)))); symbols.insert(&Symbol("ldd",Scan::ldd1,Symbol::KeywordSymbol,Instruction(5,Instruction::DoubleByte,AddressMode(AddressMode::Immediate,0xCC),AddressMode(AddressMode::Direct,0xDC),AddressMode(AddressMode::Extended,0xFC),AddressMode(AddressMode::Indexed,0xEC),AddressMode(AddressMode::Indexed,0xEC,0x18)))); symbols.insert(&Symbol("lds",Scan::lds1,Symbol::KeywordSymbol,Instruction(5,Instruction::DoubleByte,AddressMode(AddressMode::Immediate,0x8E),AddressMode(AddressMode::Direct,0x9E),AddressMode(AddressMode::Extended,0xBE),AddressMode(AddressMode::Indexed,0xAE),AddressMode(AddressMode::Indexed,0xAE,0x18)))); symbols.insert(&Symbol("ldx",Scan::ldx1,Symbol::KeywordSymbol,Instruction(5,Instruction::DoubleByte,AddressMode(AddressMode::Immediate,0xCE),AddressMode(AddressMode::Direct,0xDE),AddressMode(AddressMode::Extended,0xFE),AddressMode(AddressMode::Indexed,0xEE),AddressMode(AddressMode::Indexed,0xEE,0xCD)))); symbols.insert(&Symbol("ldy",Scan::ldy1,Symbol::KeywordSymbol,Instruction(5,Instruction::DoubleByte,AddressMode(AddressMode::Immediate,0xCE,0x18),AddressMode(AddressMode::Direct,0xDE,0x18),AddressMode(AddressMode::Extended,0xFE,0x18),AddressMode(AddressMode::Indexed,0xEE,0x1A),AddressMode(AddressMode::Indexed,0xEE,0x18)))); symbols.insert(&Symbol("lsl",Scan::lsl1,Symbol::KeywordSymbol,Instruction(3,Instruction::NotApplicable,AddressMode(AddressMode::Extended,0x78),AddressMode(AddressMode::Indexed,0x68),AddressMode(AddressMode::Indexed,0x68,0x18)))); symbols.insert(&Symbol("lsla",Scan::lsla1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x48)))); symbols.insert(&Symbol("lslb",Scan::lslb1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x58)))); symbols.insert(&Symbol("lsld",Scan::lsld1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x05)))); symbols.insert(&Symbol("lsr",Scan::lsr1,Symbol::KeywordSymbol,Instruction(3,Instruction::NotApplicable,AddressMode(AddressMode::Extended,0x74),AddressMode(AddressMode::Indexed,0x64),AddressMode(AddressMode::Indexed,0x64,0x18)))); symbols.insert(&Symbol("lsra",Scan::lsra1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x44)))); symbols.insert(&Symbol("lsrb",Scan::lsrb1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x54)))); symbols.insert(&Symbol("lsrd",Scan::lsrd1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x04)))); symbols.insert(&Symbol("mul",Scan::mul1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x3D)))); symbols.insert(&Symbol("neg",Scan::neg1,Symbol::KeywordSymbol,Instruction(3,Instruction::NotApplicable,AddressMode(AddressMode::Extended,0x70),AddressMode(AddressMode::Indexed,0x60),AddressMode(AddressMode::Indexed,0x60,0x18)))); symbols.insert(&Symbol("nega",Scan::nega1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x40)))); symbols.insert(&Symbol("negb",Scan::negb1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x50)))); symbols.insert(&Symbol("nop",Scan::nop1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x01)))); symbols.insert(&Symbol("oraa",Scan::oraa1,Symbol::KeywordSymbol,Instruction(5,Instruction::SingleByte,AddressMode(AddressMode::Immediate,0x8A),AddressMode(AddressMode::Direct,0x9A),AddressMode(AddressMode::Extended,0xBA),AddressMode(AddressMode::Indexed,0xAA),AddressMode(AddressMode::Indexed,0xAA,0x18)))); symbols.insert(&Symbol("orab",Scan::orab1,Symbol::KeywordSymbol,Instruction(5,Instruction::SingleByte,AddressMode(AddressMode::Immediate,0xCA),AddressMode(AddressMode::Direct,0xDA),AddressMode(AddressMode::Extended,0xFA),AddressMode(AddressMode::Indexed,0xEA),AddressMode(AddressMode::Indexed,0xEA,0x18)))); symbols.insert(&Symbol("psha",Scan::psha1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x36)))); symbols.insert(&Symbol("pshb",Scan::pshb1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x37)))); symbols.insert(&Symbol("pshx",Scan::pshx1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x3C)))); symbols.insert(&Symbol("pshy",Scan::pshy1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x3C,0x18)))); symbols.insert(&Symbol("pula",Scan::pula1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x32)))); symbols.insert(&Symbol("pulb",Scan::pulb1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x33)))); symbols.insert(&Symbol("pulx",Scan::pulx1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x38)))); symbols.insert(&Symbol("puly",Scan::puly1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x38,0x18)))); symbols.insert(&Symbol("rol",Scan::rol1,Symbol::KeywordSymbol,Instruction(3,Instruction::NotApplicable,AddressMode(AddressMode::Extended,0x79),AddressMode(AddressMode::Indexed,0x69),AddressMode(AddressMode::Indexed,0x69,0x18)))); symbols.insert(&Symbol("rola",Scan::rola1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x49)))); symbols.insert(&Symbol("rolb",Scan::rolb1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x59)))); symbols.insert(&Symbol("ror",Scan::ror1,Symbol::KeywordSymbol,Instruction(3,Instruction::NotApplicable,AddressMode(AddressMode::Extended,0x76),AddressMode(AddressMode::Indexed,0x66),AddressMode(AddressMode::Indexed,0x66,0x18)))); symbols.insert(&Symbol("rora",Scan::rora1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x46)))); symbols.insert(&Symbol("rorb",Scan::rorb1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x56)))); symbols.insert(&Symbol("rti",Scan::rti1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x3B)))); symbols.insert(&Symbol("rts",Scan::rts1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x39)))); symbols.insert(&Symbol("sba",Scan::sba1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x10)))); symbols.insert(&Symbol("sbca",Scan::sbca1,Symbol::KeywordSymbol,Instruction(5,Instruction::SingleByte,AddressMode(AddressMode::Immediate,0x82),AddressMode(AddressMode::Direct,0x92),AddressMode(AddressMode::Extended,0xB2),AddressMode(AddressMode::Indexed,0xA2),AddressMode(AddressMode::Indexed,0xA2,0x18)))); symbols.insert(&Symbol("sbcb",Scan::sbcb1,Symbol::KeywordSymbol,Instruction(5,Instruction::SingleByte,AddressMode(AddressMode::Immediate,0xC2),AddressMode(AddressMode::Direct,0xD2),AddressMode(AddressMode::Extended,0xF2),AddressMode(AddressMode::Indexed,0xE2),AddressMode(AddressMode::Indexed,0xE2,0x18)))); symbols.insert(&Symbol("sec",Scan::sec1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x0D)))); symbols.insert(&Symbol("sei",Scan::sei1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x0F)))); symbols.insert(&Symbol("sev",Scan::sev1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x0B)))); symbols.insert(&Symbol("staa",Scan::staa1,Symbol::KeywordSymbol,Instruction(4,Instruction::SingleByte,AddressMode(AddressMode::Direct,0x97),AddressMode(AddressMode::Extended,0xB7),AddressMode(AddressMode::Indexed,0xA7),AddressMode(AddressMode::Indexed,0xA7,0x18)))); symbols.insert(&Symbol("stab",Scan::stab1,Symbol::KeywordSymbol,Instruction(4,Instruction::SingleByte,AddressMode(AddressMode::Direct,0xD7),AddressMode(AddressMode::Extended,0xF7),AddressMode(AddressMode::Indexed,0xE7),AddressMode(AddressMode::Indexed,0xE7,0x18)))); symbols.insert(&Symbol("std",Scan::std1,Symbol::KeywordSymbol,Instruction(4,Instruction::NotApplicable,AddressMode(AddressMode::Direct,0xDD),AddressMode(AddressMode::Extended,0xFD),AddressMode(AddressMode::Indexed,0xED),AddressMode(AddressMode::Indexed,0xED,0x18)))); symbols.insert(&Symbol("stop",Scan::stop1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0xCF)))); symbols.insert(&Symbol("sts",Scan::sts1,Symbol::KeywordSymbol,Instruction(4,Instruction::NotApplicable,AddressMode(AddressMode::Direct,0x9F),AddressMode(AddressMode::Extended,0xBF),AddressMode(AddressMode::Indexed,0xAF),AddressMode(AddressMode::Indexed,0xAF,0x18)))); symbols.insert(&Symbol("stx",Scan::stx1,Symbol::KeywordSymbol,Instruction(4,Instruction::NotApplicable,AddressMode(AddressMode::Direct,0xDF),AddressMode(AddressMode::Extended,0xFF),AddressMode(AddressMode::Indexed,0xEF),AddressMode(AddressMode::Indexed,0xEF,0xCD)))); symbols.insert(&Symbol("sty",Scan::sty1,Symbol::KeywordSymbol,Instruction(4,Instruction::NotApplicable,AddressMode(AddressMode::Direct,0xDF,0x18),AddressMode(AddressMode::Extended,0xFF,0x18),AddressMode(AddressMode::Indexed,0xEF,0x1A),AddressMode(AddressMode::Indexed,0xEF,0x18)))); symbols.insert(&Symbol("suba",Scan::suba1,Symbol::KeywordSymbol,Instruction(5,Instruction::SingleByte,AddressMode(AddressMode::Immediate,0x80),AddressMode(AddressMode::Direct,0x90),AddressMode(AddressMode::Extended,0xB0),AddressMode(AddressMode::Indexed,0xA0),AddressMode(AddressMode::Indexed,0xA0,0x18)))); symbols.insert(&Symbol("subb",Scan::subb1,Symbol::KeywordSymbol,Instruction(5,Instruction::SingleByte,AddressMode(AddressMode::Immediate,0xC0),AddressMode(AddressMode::Direct,0xD0),AddressMode(AddressMode::Extended,0xF0),AddressMode(AddressMode::Indexed,0xE0),AddressMode(AddressMode::Indexed,0xE0,0x18)))); symbols.insert(&Symbol("subd",Scan::subd1,Symbol::KeywordSymbol,Instruction(5,Instruction::DoubleByte,AddressMode(AddressMode::Immediate,0x83),AddressMode(AddressMode::Direct,0x93),AddressMode(AddressMode::Extended,0xB3),AddressMode(AddressMode::Indexed,0xA3),AddressMode(AddressMode::Indexed,0xA3,0x18)))); symbols.insert(&Symbol("swi",Scan::swi1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x3F)))); symbols.insert(&Symbol("tab",Scan::tab1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x16)))); symbols.insert(&Symbol("tap",Scan::tap1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x06)))); symbols.insert(&Symbol("tba",Scan::tba1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x17)))); symbols.insert(&Symbol("test",Scan::test1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x00)))); symbols.insert(&Symbol("tpa",Scan::tpa1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x07)))); symbols.insert(&Symbol("tst",Scan::tst1,Symbol::KeywordSymbol,Instruction(3,Instruction::NotApplicable,AddressMode(AddressMode::Extended,0x7D),AddressMode(AddressMode::Indexed,0x6D),AddressMode(AddressMode::Indexed,0x6D,0x18)))); symbols.insert(&Symbol("tsta",Scan::tsta1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x4D)))); symbols.insert(&Symbol("tstb",Scan::tstb1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x5D)))); symbols.insert(&Symbol("tsx",Scan::tsx1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x30)))); symbols.insert(&Symbol("tsy",Scan::tsy1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Indexed,0x30,0x18)))); symbols.insert(&Symbol("txs",Scan::txs1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x35)))); symbols.insert(&Symbol("tys",Scan::tys1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x35,0x18)))); symbols.insert(&Symbol("wai",Scan::wai1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x3E)))); symbols.insert(&Symbol("xgdx",Scan::xgdx1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x8F)))); symbols.insert(&Symbol("xgdy",Scan::xgdy1,Symbol::KeywordSymbol,Instruction(1,Instruction::NotApplicable,AddressMode(AddressMode::Inherent,0x8F,0x18)))); symbols.insert(&Symbol("ix",Scan::ix1,Symbol::RegisterSymbol)); symbols.insert(&Symbol("iy",Scan::iy1,Symbol::RegisterSymbol)); symbols.insert(&Symbol("org",Scan::origin1,Symbol::DirectiveSymbol)); symbols.insert(&Symbol("equ",Scan::equ1,Symbol::DirectiveSymbol)); symbols.insert(&Symbol("rmb",Scan::rmb1,Symbol::DirectiveSymbol)); shuffle(symbols); for(int index=0;index &symbols) { int swapFrom; int swapTo; double ratio; Symbol swapItem; if(!symbols.size())return; ratio=((double)symbols.size()-1.00)/(double)RAND_MAX; for(int index=0;index &includePath) { String strPathOutFile(strPathFileName); strPathOutFile=strPathFileName.betweenString(0,'.'); if(strPathOutFile==strPathFileName)return FALSE; strPathOutFile+=String(".bin"); return assemble(strPathFileName,strPathOutFile,includePath); } bool M68Assembler::assemble(const String &strPathFileName,const String &strPathOutFile,Block &includePath) { FileHandle inFile; bool returnCode; mCodeSize=0; if(!inFile.open(strPathFileName,FileHandle::Read,FileHandle::ShareRead))return FALSE; FileMap inMap(inFile); FileMap outMap("SCANOUT",0,MaxScanBytes); FileMap parseMap("PARSEOUT",0,MaxParseBytes); PureViewOfFile inView(inMap); PureViewOfFile outView(outMap); PureViewOfFile parseView(parseMap); Scan scanner(inView,outView,mSymbolTable,includePath); if(!scanner.analyze()) { mLastMessage=scanner.lastMessage(); return returnCode=false; } outView.rewind(); for(int index=0;index codeLines; GlobalData codeBytes; DiskInfo diskInfo; strPathHexFile=strPathOutFile.betweenString(0,'.'); if(strPathHexFile==strPathOutFile)return false; strPathHexFile+=".lst"; diskInfo.unlink(strPathHexFile); if(!codeLength)return FALSE; codeBytes.size(codeLength); ::memcpy((BYTE*)&codeBytes[0],(BYTE*)parseView.base(),codeLength); formatLines.hexLines(codeLines,codeBytes); if(!outFile.open(strPathHexFile,FileHandle::Write,FileHandle::ShareRead,FileHandle::Overwrite))return FALSE; for(int index=0;index