mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-11-17 21:04:45 +00:00
5f10818f04
.9 Fixed: Renamed ambigious command 'DL' to 'B' to list all bytes being treated as data Renamed command: 'B' to 'Z' as an alias to treat byte(s) as data .8 Fixed: Define Code 'X' wasn't removing entries .7 Fixed: DATA1 was using call win setup for code, not data. .6 Cleanup of command table to have the proper internal command enum. D // CMD_MEM_MINI_DUMP_HEX_1 moved to alias section M1 // CMD_MEM_MINI_DUMP_HEX_1 moved to alias section M2 // CMD_MEM_MINI_DUMP_HEX_2 moved to alias section TEXT81 // CMD_VIEW_TEXT81 <- CMD_VIEW_TEXT8X TEXT82 // CMD_VIEW_TEXT82 <- CMD_VIEW_TEXT8X W // CMD_WATCH <- CMD_WATCH_ADD .5 Added: Internal consistency checking for commands and their internal command enum. .4 Fixed: Added customer assembler type and debugger disassembly display uses variable instead of always being hard-coded to Merlin directives. .5 Fixed: Data disassembler help -- was using wrong command help offset due to wrong order of commands. .3 Fixed: Assembler now accepts lower-case mnemonics
215 lines
5.5 KiB
C
215 lines
5.5 KiB
C
#ifndef DEBUGGER_ASSEMBLER_H
|
|
#define DEBUGGER_ASSEMBLER_H
|
|
|
|
// Directives
|
|
|
|
// Assemblers
|
|
// A = Acme
|
|
// B = Big Mac S= S-C Macro Assembler
|
|
// D = DOS Tool Kit T = TED II
|
|
// L = Lisa W = Weller's Assembler
|
|
// M = Merlin
|
|
// u = MicroSparc
|
|
// O = ORCA/M
|
|
enum Assemblers_e
|
|
{
|
|
ASM_ACME
|
|
, ASM_BIG_MAC
|
|
, ASM_DOS_TOOL_KIT
|
|
, ASM_LISA
|
|
, ASM_MERLIN
|
|
, ASM_MICROSPARC
|
|
, ASM_ORCA
|
|
, ASM_SC
|
|
, ASM_TED
|
|
, ASM_WELLERS
|
|
, ASM_CUSTOM
|
|
,NUM_ASSEMBLERS
|
|
};
|
|
|
|
enum AsmAcmeDirective_e
|
|
{
|
|
ASM_A_DEFINE_BYTE
|
|
,NUM_ASM_A_DIRECTIVES
|
|
};
|
|
|
|
enum AsmBigMacDirective_e
|
|
{
|
|
ASM_B_DEFINE_BYTE
|
|
,NUM_ASM_B_DIRECTIVES
|
|
};
|
|
|
|
enum AsmDosToolKitDirective_e
|
|
{
|
|
ASM_D_DEFINE_BYTE
|
|
,NUM_ASM_D_DIRECTIVES
|
|
};
|
|
|
|
enum AsmLisaDirective_e
|
|
{
|
|
ASM_L_DEFINE_BYTE
|
|
,NUM_ASM_L_DIRECTIVES
|
|
};
|
|
|
|
enum AsmMerlinDirective_e
|
|
{
|
|
ASM_M_ASCII
|
|
, ASM_M_DEFINE_WORD
|
|
, ASM_M_DEFINE_BYTE
|
|
, ASM_M_DEFINE_STORAGE
|
|
, ASM_M_HEX
|
|
, ASM_M_ORIGIN
|
|
, NUM_ASM_M_DIRECTIVES
|
|
, ASM_M_DEFINE_BYTE_ALIAS
|
|
, ASM_M_DEFINE_WORD_ALIAS
|
|
};
|
|
|
|
enum AsmMicroSparcDirective_e
|
|
{
|
|
ASM_u_DEFINE_BYTE
|
|
,NUM_ASM_u_DIRECTIVES
|
|
};
|
|
|
|
enum AsmOrcamDirective_e
|
|
{
|
|
ASM_O_DEFINE_BYTE
|
|
,NUM_ASM_O_DIRECTIVES
|
|
};
|
|
|
|
enum AsmSCMacroDirective_e
|
|
{
|
|
ASM_S_ORIGIN
|
|
,ASM_S_TARGET_ADDRESS
|
|
,ASM_S_END_PROGRAM
|
|
,ASM_S_EQUATE
|
|
,ASM_S_DATA
|
|
,ASM_S_ASCII_STRING
|
|
,ASM_S_HEX_STRING
|
|
,NUM_ASM_S_DIRECTIVES
|
|
};
|
|
|
|
enum AsmTedDirective_e
|
|
{
|
|
ASM_T_DEFINE_BYTE
|
|
,NUM_ASM_T_DIRECTIVES
|
|
};
|
|
|
|
enum AsmWellersDirective_e
|
|
{
|
|
ASM_W_DEFINE_BYTE
|
|
,NUM_ASM_W_DIRECTIVES
|
|
};
|
|
|
|
enum AsmCustomDirective_e
|
|
{
|
|
ASM_DEFINE_BYTE
|
|
,ASM_DEFINE_WORD
|
|
// ,ASM_DEFINE_ADDRESS_8
|
|
,ASM_DEFINE_ADDRESS_16
|
|
// String/Text/Ascii
|
|
,ASM_DEFINE_ASCII_TEXT
|
|
,ASM_DEFINE_APPLE_TEXT
|
|
,ASM_DEFINE_TEXT_HI_LO // i.e. Applesoft Basic Tokens
|
|
// FAC
|
|
,ASM_DEFINE_FLOAT // Applesoft float
|
|
,ASM_DEFINE_FLOAT_X // Applesoft float unpacked/expanded
|
|
,NUM_ASM_Z_DIRECTIVES
|
|
};
|
|
|
|
// NOTE: Keep in sync AsmDirectives_e g_aAssemblerDirectives !
|
|
enum AsmDirectives_e
|
|
{
|
|
FIRST_A_DIRECTIVE = 1,
|
|
FIRST_B_DIRECTIVE = FIRST_A_DIRECTIVE + NUM_ASM_A_DIRECTIVES, // Acme
|
|
FIRST_D_DIRECTIVE = FIRST_B_DIRECTIVE + NUM_ASM_B_DIRECTIVES, // Big Mac
|
|
FIRST_L_DIRECTIVE = FIRST_D_DIRECTIVE + NUM_ASM_D_DIRECTIVES, // DOS Tool Kit
|
|
FIRST_M_DIRECTIVE = FIRST_L_DIRECTIVE + NUM_ASM_L_DIRECTIVES, // Lisa
|
|
FIRST_u_DIRECTIVE = FIRST_M_DIRECTIVE + NUM_ASM_M_DIRECTIVES, // Merlin
|
|
FIRST_O_DIRECTIVE = FIRST_u_DIRECTIVE + NUM_ASM_u_DIRECTIVES, // MicroSparc
|
|
FIRST_S_DIRECTIVE = FIRST_O_DIRECTIVE + NUM_ASM_O_DIRECTIVES, // Orca
|
|
FIRST_T_DIRECTIVE = FIRST_S_DIRECTIVE + NUM_ASM_S_DIRECTIVES, // SC
|
|
FIRST_W_DIRECTIVE = FIRST_T_DIRECTIVE + NUM_ASM_T_DIRECTIVES, // Ted
|
|
FIRST_Z_DIRECTIVE = FIRST_W_DIRECTIVE + NUM_ASM_W_DIRECTIVES, // Weller
|
|
NUM_ASM_DIRECTIVES = FIRST_Z_DIRECTIVE + NUM_ASM_Z_DIRECTIVES // Custom
|
|
|
|
// NUM_ASM_DIRECTIVES = 1 + // Opcode ... rest are psuedo opcodes
|
|
// NUM_ASM_A_DIRECTIVES + // Acme
|
|
// NUM_ASM_B_DIRECTIVES + // Big Mac
|
|
// NUM_ASM_D_DIRECTIVES + // DOS Tool Kit
|
|
// NUM_ASM_L_DIRECTIVES + // Lisa
|
|
// NUM_ASM_M_DIRECTIVES + // Merlin
|
|
// NUM_ASM_u_DIRECTIVES + // MicroSparc
|
|
// NUM_ASM_O_DIRECTIVES + // Orca
|
|
// NUM_ASM_S_DIRECTIVES + // SC
|
|
// NUM_ASM_T_DIRECTIVES + // Ted
|
|
// NUM_ASM_W_DIRECTIVES // Weller
|
|
};
|
|
|
|
extern int g_iAssemblerSyntax;
|
|
extern int g_aAssemblerFirstDirective[ NUM_ASSEMBLERS ];
|
|
|
|
// Addressing _____________________________________________________________________________________
|
|
|
|
extern AddressingMode_t g_aOpmodes[ NUM_ADDRESSING_MODES ];
|
|
|
|
// Assembler ______________________________________________________________________________________
|
|
|
|
// Hashing for Assembler
|
|
typedef unsigned int Hash_t;
|
|
|
|
struct HashOpcode_t
|
|
{
|
|
int m_iOpcode;
|
|
Hash_t m_nValue;
|
|
|
|
// functor
|
|
bool operator () (const HashOpcode_t & rLHS, const HashOpcode_t & rRHS) const
|
|
{
|
|
bool bLessThan = (rLHS.m_nValue < rRHS.m_nValue);
|
|
return bLessThan;
|
|
}
|
|
};
|
|
|
|
struct AssemblerDirective_t
|
|
{
|
|
char *m_pMnemonic;
|
|
Hash_t m_nHash;
|
|
};
|
|
|
|
extern int g_bAssemblerOpcodesHashed; // = false;
|
|
extern Hash_t g_aOpcodesHash[ NUM_OPCODES ]; // for faster mnemonic lookup, for the assembler
|
|
extern bool g_bAssemblerInput; // = false;
|
|
extern int g_nAssemblerAddress; // = 0;
|
|
|
|
extern const Opcodes_t *g_aOpcodes; // = NULL; // & g_aOpcodes65C02[ 0 ];
|
|
|
|
extern const Opcodes_t g_aOpcodes65C02[ NUM_OPCODES ];
|
|
extern const Opcodes_t g_aOpcodes6502 [ NUM_OPCODES ];
|
|
|
|
extern AssemblerDirective_t g_aAssemblerDirectives[ NUM_ASM_DIRECTIVES ];
|
|
|
|
// Prototypes _______________________________________________________________
|
|
|
|
int _6502_GetOpmodeOpbyte( const int iAddress, int & iOpmode_, int & nOpbytes_ );
|
|
// void _6502_GetOpcodeOpmode( int & iOpcode_, int & iOpmode_, int & nOpbytes_ );
|
|
void _6502_GetOpcodeOpmodeOpbyte( int & iOpcode_, int & iOpmode_, int & nOpbytes_ );
|
|
bool _6502_GetStackReturnAddress( WORD & nAddress_ );
|
|
bool _6502_GetTargets( WORD nAddress, int *pTargetPartial_, int *pTargetPointer_, int * pBytes_
|
|
, const bool bIgnoreJSRJMP = true, bool bIgnoreBranch = true );
|
|
bool _6502_GetTargetAddress( const WORD & nAddress, WORD & nTarget_ );
|
|
bool _6502_IsOpcodeBranch( int nOpcode );
|
|
bool _6502_IsOpcodeValid( int nOpcode );
|
|
|
|
int AssemblerHashMnemonic ( const TCHAR * pMnemonic );
|
|
// bool AssemblerGetAddressingMode ( int iArg, int nArgs, WORD nAddress, vector<int> & vOpcodes );
|
|
void _CmdAssembleHashDump ();
|
|
|
|
int AssemblerDelayedTargetsSize();
|
|
void AssemblerStartup ();
|
|
bool Assemble( int iArg, int nArgs, WORD nAddress );
|
|
|
|
void AssemblerOn ();
|
|
void AssemblerOff ();
|
|
|
|
#endif
|