Skip to content

Commit

Permalink
Added Linux Makefile plus small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Arakula authored Jan 27, 2021
1 parent 8e4f16f commit 306be9a
Show file tree
Hide file tree
Showing 24 changed files with 1,125 additions and 900 deletions.
16 changes: 8 additions & 8 deletions Dasm6301.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ Dasm6301::~Dasm6301(void)
/* ParseCode : parse instruction at given memory address for labels */
/*****************************************************************************/

addr_t Dasm6301::ParseCode
adr_t Dasm6301::ParseCode
(
addr_t addr,
adr_t addr,
int bus /* ignored for 6800 and derivates */
)
{
Expand All @@ -174,7 +174,7 @@ uint16_t W;
int MI;
const char *I;
bool bSetLabel;
addr_t PC = FetchInstructionDetails(addr, O, T, M, W, MI, I);
adr_t PC = FetchInstructionDetails(addr, O, T, M, W, MI, I);

switch (M) /* which mode is this ? */
{
Expand Down Expand Up @@ -211,22 +211,22 @@ return PC - addr; /* pass back # processed bytes */
/* DisassembleCode : disassemble code instruction at given memory address */
/*****************************************************************************/

addr_t Dasm6301::DisassembleCode
adr_t Dasm6301::DisassembleCode
(
addr_t addr,
adr_t addr,
string &smnemo,
string &sparm,
int bus /* ignored for 6800 and derivates */
)
{
uint8_t O, T, M;
uint16_t W;
addr_t Wrel;
adr_t Wrel;
int MI;
const char *I;
bool bGetLabel;
Label *lbl;
addr_t PC = FetchInstructionDetails(addr, O, T, M, W, MI, I, &smnemo);
adr_t PC = FetchInstructionDetails(addr, O, T, M, W, MI, I, &smnemo);

switch (M) /* which mode is this? */
{
Expand All @@ -242,7 +242,7 @@ switch (M) /* which mode is this? */
if (Wrel)
{
W = (int)((unsigned char)T) + (uint16_t)Wrel;
sparm += Label2String((addr_t)((int)((unsigned char)T)), 4,
sparm += Label2String((adr_t)((int)((unsigned char)T)), 4,
bGetLabel, PC) + GetIx8IndexReg(O);
}
else if (lbl)
Expand Down
4 changes: 2 additions & 2 deletions Dasm6301.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ class Dasm6301 : public Dasm6801

protected:
// parse instruction at given memory address for labels
virtual addr_t ParseCode(addr_t addr, int bus = BusCode);
virtual adr_t ParseCode(adr_t addr, int bus = BusCode);
// disassemble instruction at given memory address
virtual addr_t DisassembleCode(addr_t addr, string &smnemo, string &sparm, int bus = BusCode);
virtual adr_t DisassembleCode(adr_t addr, string &smnemo, string &sparm, int bus = BusCode);

protected:
// additional 6309 addressing modes
Expand Down
47 changes: 25 additions & 22 deletions Dasm6309.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ uint8_t Dasm6309::h6309_codes11[512] =
_ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* FC..FF */
};

static char *h6309_exg_tfr[] =
static const char *h6309_exg_tfr[] =
{
"D", "X", "Y", "U", "S", "PC","W" ,"V",
"A", "B", "CC","DP","0", "0", "E", "F"
Expand Down Expand Up @@ -398,15 +398,15 @@ if (bus == BusCode)
if (bSetSysVec)
{
// set up DIV0 system vector
addr_t addr = 0xfff0;
adr_t addr = 0xfff0;
MemoryType memType = GetMemType(addr);
if (memType != Untyped && /* if system vector loaded */
memType != Const && /* and not defined as constant */
!FindLabel(addr)) /* and no label set in info file */
{
SetMemType(addr, Data); /* that's a data word */
SetCellSize(addr, 2);
addr_t tgtaddr = GetUWord(addr); /* look whether it points to loaded */
adr_t tgtaddr = GetUWord(addr); /* look whether it points to loaded */
if (GetMemType(tgtaddr) != Untyped)
{ /* if so, */
SetMemType(tgtaddr, Code); /* that's code there */
Expand All @@ -424,12 +424,12 @@ return Dasm6809::InitParse(bus);
/* IndexParse : parses index for labels */
/*****************************************************************************/

addr_t Dasm6309::IndexParse(int MI, addr_t pc)
adr_t Dasm6309::IndexParse(int MI, adr_t pc, adr_t instaddr)
{
uint8_t T;
uint16_t W;
char R;
addr_t PC = pc;
adr_t PC = pc;
bool bSetLabel = true;

T = GetUByte(PC++);
Expand Down Expand Up @@ -466,20 +466,23 @@ if (T & 0x80)
break;
}
}
return Dasm6809::IndexParse(MI, pc);

(void)R; // unused ATM

return Dasm6809::IndexParse(MI, pc, instaddr);
}

/*****************************************************************************/
/* IndexString : converts index to string */
/*****************************************************************************/

string Dasm6309::IndexString(addr_t &pc)
string Dasm6309::IndexString(adr_t &pc)
{
uint8_t T;
uint16_t W;
char R;
string buf;
addr_t PC = pc;
adr_t PC = pc;
bool bGetLabel;
Label *lbl;

Expand Down Expand Up @@ -565,9 +568,9 @@ return Dasm6809::IndexString(pc);
/* ParseCode : parse instruction at given memory address for labels */
/*****************************************************************************/

addr_t Dasm6309::ParseCode
adr_t Dasm6309::ParseCode
(
addr_t addr,
adr_t addr,
int bus /* ignored for 6800 and derivates */
)
{
Expand All @@ -576,8 +579,8 @@ uint16_t W;
int MI;
const char *I;
bool bSetLabel;
addr_t dp = GetDirectPage(addr);
addr_t PC = FetchInstructionDetails(addr, O, T, M, W, MI, I);
adr_t dp = GetDirectPage(addr);
adr_t PC = FetchInstructionDetails(addr, O, T, M, W, MI, I);

#if 1
// speed up things a bit by checking here (would be done in 6809 anyway)
Expand All @@ -594,7 +597,7 @@ switch (M) /* which mode is this ? */
if (!bSetLabel)
SetDefLabelUsed(PC, bus);
T = GetUByte(PC);
if (dp >= 0)
if ((sadr_t)dp >= 0)
{
W = (uint16_t)dp | T;
if (bSetLabel)
Expand All @@ -610,7 +613,7 @@ switch (M) /* which mode is this ? */
T = GetUByte(PC);
SetDefLabelUsed(PC);
PC++;
PC = IndexParse(MI, PC);
PC = IndexParse(MI, PC, addr);
break;

case _be: /* Bit Manipulation extended */
Expand Down Expand Up @@ -660,10 +663,10 @@ return PC - addr; /* pass back # processed bytes */
/* DisassembleData : disassemble data area at given memory address */
/*****************************************************************************/

addr_t Dasm6309::DisassembleData
adr_t Dasm6309::DisassembleData
(
addr_t addr,
addr_t end,
adr_t addr,
adr_t end,
uint32_t flags,
string &smnemo,
string &sparm,
Expand All @@ -674,7 +677,7 @@ addr_t Dasm6309::DisassembleData
if (!(flags & SHMF_RMB) && /* if display necessary */
((flags & 0xff) == 3)) /* and dword-sized */
{
addr_t done;
adr_t done;

smnemo = "FQB";
/* assemble as many as possible */
Expand All @@ -700,9 +703,9 @@ return Dasm6809::DisassembleData(addr, end, flags, smnemo, sparm, maxparmlen, bu
/* DisassembleCode : disassemble code instruction at given memory address */
/*****************************************************************************/

addr_t Dasm6309::DisassembleCode
adr_t Dasm6309::DisassembleCode
(
addr_t addr,
adr_t addr,
string &smnemo,
string &sparm,
int bus /* ignored for 6800 and derivates */
Expand All @@ -713,9 +716,9 @@ uint16_t W;
int MI;
const char *I;
bool bGetLabel;
addr_t dp = GetDirectPage(addr);
adr_t dp = GetDirectPage(addr);
Label *lbl;
addr_t PC = FetchInstructionDetails(addr, O, T, M, W, MI, I, &smnemo);
adr_t PC = FetchInstructionDetails(addr, O, T, M, W, MI, I, &smnemo);

#if 1
// speed up things a bit by checking here (would be done in 6809 anyway)
Expand Down
10 changes: 5 additions & 5 deletions Dasm6309.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ class Dasm6309 : public Dasm6809

protected:
// parse instruction at given memory address for labels
virtual addr_t ParseCode(addr_t addr, int bus = BusCode);
virtual adr_t ParseCode(adr_t addr, int bus = BusCode);
// disassemble data area at given memory address
virtual addr_t DisassembleData(addr_t addr, addr_t end, uint32_t flags, string &smnemo, string &sparm, int maxparmlen, int bus = BusCode);
virtual adr_t DisassembleData(adr_t addr, adr_t end, uint32_t flags, string &smnemo, string &sparm, int maxparmlen, int bus = BusCode);
// disassemble instruction at given memory address
virtual addr_t DisassembleCode(addr_t addr, string &smnemo, string &sparm, int bus = BusCode);
virtual adr_t DisassembleCode(adr_t addr, string &smnemo, string &sparm, int bus = BusCode);

protected:
// additional 6309 addressing modes
Expand Down Expand Up @@ -162,8 +162,8 @@ class Dasm6309 : public Dasm6809
static OpCode opcodes[mnemo6309_count - mnemo6809_count];

protected:
virtual addr_t IndexParse(int MI, addr_t pc);
virtual string IndexString(addr_t &pc);
virtual adr_t IndexParse(int MI, adr_t pc, adr_t instaddr = NO_ADDRESS);
virtual string IndexString(adr_t &pc);
};

#endif // __Dasm6309_h_defined__
Loading

0 comments on commit 306be9a

Please sign in to comment.