char write_opcodes (void)
{
	char err;
	opcs = get_opcodes();
	if (pass == 1)
	{
	addr = addr + opcs;
	return;
	}
	if (pass==2)
		{
		if (opcs == 0)
			{
			opc0 = get_opcode0();
			err = write_output(addr,0,(unsigned char *)file_line,line);
			}
		if (opcs == 1) 
			{
			opc0 = get_opcode0();
			err = write_output(addr,opc0,(unsigned char *)file_line,line);
			addr++;
			}
		if (opcs == 2)
			{
			opc0 = get_opcode0();
			opc1 = get_opcode1();
			err = write_output(addr,opc0,(unsigned char *)file_line,line);
			addr++;
			err = write_output(addr,opc1,(unsigned char *)"",line);
			addr++;
			}
		}
return err;
}
Exemple #2
0
const std::vector<std::string> & reaver::assembler::get_known_mnemonics()
{
    if (_mnemonics.empty())
    {
        for (auto & op : get_opcodes())
        {
            _mnemonics.push_back(op.first);
        }
    }

    return _mnemonics;
}
Exemple #3
0
/*
 *	The function disass() is the only global function of
 *	this module. The first argument is a pointer to a
 *	unsigned char pointer, which points to the op-code
 *	to disassemble. The output of the disassembly goes
 *	to stdout, terminated by a newline. After the
 *	disassembly the pointer to the op-code will be
 *	increased by the size of the op-code, so that
 *	disass() can be called again.
 *	The second argument is the (Z80) address of the
 *	op-code to disassemble. It is used to calculate the
 *	destination address of relative jumps.
 */
void disass(unsigned char **p, int adr)
{
	register int len;

	addr = adr;
	len = (*optab[**p].fun)	(optab[**p].text, p);
#ifndef WANT_GUI
	printf(Disass_Str);
#endif
#ifdef WANT_GUI
        get_opcodes(p, len);
#endif
	*p += len;
}
int main()
{
	char** opcodes = get_opcodes();
	generate_opcode(opcodes);
}