summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/cosmac/cosdasm.h
blob: 38011b792c6c89a9188ff64562025f3705506395 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// license:BSD-3-Clause
// copyright-holders:Curt Coder
/***************************************************************************

    cosdasm.c

    Simple RCA COSMAC disassembler.
    Written by Curt Coder

***************************************************************************/

#ifndef MAME_CPU_COSMAC_COSDASM_H
#define MAME_CPU_COSMAC_COSDASM_H

#pragma once

class cosmac_disassembler : public util::disasm_interface
{
public:
	enum
	{
		TYPE_1801,
		TYPE_1802
	};

	cosmac_disassembler(int variant);
	virtual ~cosmac_disassembler() = default;

	virtual u32 opcode_alignment() const override;
	virtual offs_t disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer &params) override;

private:
	int m_variant;

	offs_t implied(const uint8_t opcode);
	offs_t immediate(offs_t &pc, const data_buffer &params);
	offs_t short_branch(offs_t base_pc, offs_t &pc, const data_buffer &params);
	offs_t long_branch(offs_t &pc, const data_buffer &params);
	offs_t short_skip(offs_t pc);
	offs_t long_skip(offs_t pc);
};

#endif