Rizin
unix-like reverse engineering framework and cli tools
lh5801.h
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2014 Jonathan Neuschäfer
2
// SPDX-License-Identifier: LGPL-3.0-only
3
4
/*
5
* This disassembler is based on the "SHARP PC-1500/A Systemhandbuch"
6
* (system manual) as published by Günter Holtkötter GmbH.
7
*/
8
9
#include <
stdint.h
>
10
#include <stdlib.h>
11
typedef
uint8_t
ut8
;
12
13
/* Instruction classes. That's for example "add with carry". */
14
enum
lh5801_insn_class
{
15
LH5801_INSNC_ADC
,
16
LH5801_INSNC_ADI
,
17
LH5801_INSNC_DCA
,
18
LH5801_INSNC_ADR
,
19
LH5801_INSNC_SBC
,
20
LH5801_INSNC_SBI
,
21
LH5801_INSNC_DCS
,
22
LH5801_INSNC_AND
,
23
LH5801_INSNC_ANI
,
24
LH5801_INSNC_ORA
,
25
LH5801_INSNC_ORI
,
26
LH5801_INSNC_EOR
,
27
LH5801_INSNC_EAI
,
28
LH5801_INSNC_INC
,
29
LH5801_INSNC_DEC
,
30
LH5801_INSNC_CPA
,
31
LH5801_INSNC_CPI
,
32
LH5801_INSNC_BIT
,
33
LH5801_INSNC_BII
,
34
LH5801_INSNC_LDA
,
35
LH5801_INSNC_LDE
,
36
LH5801_INSNC_LIN
,
37
LH5801_INSNC_LDI
,
38
LH5801_INSNC_LDX
,
39
LH5801_INSNC_STA
,
40
LH5801_INSNC_SDE
,
41
LH5801_INSNC_SIN
,
42
LH5801_INSNC_STX
,
43
LH5801_INSNC_PSH
,
44
LH5801_INSNC_POP
,
45
LH5801_INSNC_ATT
,
46
LH5801_INSNC_TTA
,
47
LH5801_INSNC_TIN
,
48
LH5801_INSNC_CIN
,
49
LH5801_INSNC_ROL
,
50
LH5801_INSNC_ROR
,
51
LH5801_INSNC_SHL
,
52
LH5801_INSNC_SHR
,
53
LH5801_INSNC_DRL
,
54
LH5801_INSNC_DRR
,
55
LH5801_INSNC_AEX
,
56
LH5801_INSNC_SEC
,
57
LH5801_INSNC_REC
,
58
LH5801_INSNC_CDV
,
59
LH5801_INSNC_ATP
,
60
LH5801_INSNC_SPU
,
61
LH5801_INSNC_RPU
,
62
LH5801_INSNC_SPV
,
63
LH5801_INSNC_RPV
,
64
LH5801_INSNC_SDP
,
65
LH5801_INSNC_RDP
,
66
LH5801_INSNC_ITA
,
67
LH5801_INSNC_SIE
,
68
LH5801_INSNC_RIE
,
69
LH5801_INSNC_AM0
,
70
LH5801_INSNC_AM1
,
71
LH5801_INSNC_NOP
,
72
LH5801_INSNC_HLT
,
73
LH5801_INSNC_OFF
,
74
LH5801_INSNC_JMP
,
75
LH5801_INSNC_BCH
,
76
LH5801_INSNC_BCC
,
77
LH5801_INSNC_LOP
,
78
LH5801_INSNC_SJP
,
79
LH5801_INSNC_VEJ
,
80
LH5801_INSNC_VMJ
,
81
LH5801_INSNC_VCC
,
82
LH5801_INSNC_RTN
,
83
LH5801_INSNC_RTI
,
84
85
LH5801_INSNC_NUMBER
86
};
87
88
/* Instruction description. */
89
struct
lh5801_insn_class_desc
{
90
char
mnem
[4];
/* Assembler mnemonic */
91
const
char
*
desc
;
/* Textual description (for ?d) */
92
93
/* TODO: rizin insn type? */
94
};
95
96
const
struct
lh5801_insn_class_desc
97
lh5801_insn_class_descs
[
LH5801_INSNC_NUMBER
];
98
99
/* A decoded instruction */
100
struct
lh5801_insn
{
101
ut8
iclass
;
/* an index into lh5801_insn_class_descs */
102
ut8
type
;
/* an index into lh5801_insn_descs */
103
ut8
fd
;
104
ut8
opcode
;
105
ut8
imm
[3];
106
};
107
108
int
lh5801_decode
(
struct
lh5801_insn
*,
const
uint8_t
*,
int
);
109
void
lh5801_print_insn
(
char
*
out
,
int
size
,
const
struct
lh5801_insn
*);
out
const lzma_allocator const uint8_t size_t uint8_t * out
Definition:
block.h:528
size
voidpf void uLong size
Definition:
ioapi.h:138
lh5801_insn_class_descs
const struct lh5801_insn_class_desc lh5801_insn_class_descs[LH5801_INSNC_NUMBER]
Definition:
lh5801.h:96
lh5801_decode
int lh5801_decode(struct lh5801_insn *, const uint8_t *, int)
Definition:
lh5801.c:674
lh5801_print_insn
void lh5801_print_insn(char *out, int size, const struct lh5801_insn *)
Definition:
lh5801.c:792
lh5801_insn_class
lh5801_insn_class
Definition:
lh5801.h:14
LH5801_INSNC_DCS
@ LH5801_INSNC_DCS
Definition:
lh5801.h:21
LH5801_INSNC_PSH
@ LH5801_INSNC_PSH
Definition:
lh5801.h:43
LH5801_INSNC_TIN
@ LH5801_INSNC_TIN
Definition:
lh5801.h:47
LH5801_INSNC_ADC
@ LH5801_INSNC_ADC
Definition:
lh5801.h:15
LH5801_INSNC_SPU
@ LH5801_INSNC_SPU
Definition:
lh5801.h:60
LH5801_INSNC_POP
@ LH5801_INSNC_POP
Definition:
lh5801.h:44
LH5801_INSNC_RPV
@ LH5801_INSNC_RPV
Definition:
lh5801.h:63
LH5801_INSNC_CPA
@ LH5801_INSNC_CPA
Definition:
lh5801.h:30
LH5801_INSNC_SIE
@ LH5801_INSNC_SIE
Definition:
lh5801.h:67
LH5801_INSNC_ATP
@ LH5801_INSNC_ATP
Definition:
lh5801.h:59
LH5801_INSNC_BIT
@ LH5801_INSNC_BIT
Definition:
lh5801.h:32
LH5801_INSNC_TTA
@ LH5801_INSNC_TTA
Definition:
lh5801.h:46
LH5801_INSNC_AM1
@ LH5801_INSNC_AM1
Definition:
lh5801.h:70
LH5801_INSNC_AM0
@ LH5801_INSNC_AM0
Definition:
lh5801.h:69
LH5801_INSNC_DEC
@ LH5801_INSNC_DEC
Definition:
lh5801.h:29
LH5801_INSNC_NUMBER
@ LH5801_INSNC_NUMBER
Definition:
lh5801.h:85
LH5801_INSNC_JMP
@ LH5801_INSNC_JMP
Definition:
lh5801.h:74
LH5801_INSNC_RTN
@ LH5801_INSNC_RTN
Definition:
lh5801.h:82
LH5801_INSNC_SPV
@ LH5801_INSNC_SPV
Definition:
lh5801.h:62
LH5801_INSNC_REC
@ LH5801_INSNC_REC
Definition:
lh5801.h:57
LH5801_INSNC_LDI
@ LH5801_INSNC_LDI
Definition:
lh5801.h:37
LH5801_INSNC_SDE
@ LH5801_INSNC_SDE
Definition:
lh5801.h:40
LH5801_INSNC_DCA
@ LH5801_INSNC_DCA
Definition:
lh5801.h:17
LH5801_INSNC_BCH
@ LH5801_INSNC_BCH
Definition:
lh5801.h:75
LH5801_INSNC_RIE
@ LH5801_INSNC_RIE
Definition:
lh5801.h:68
LH5801_INSNC_LOP
@ LH5801_INSNC_LOP
Definition:
lh5801.h:77
LH5801_INSNC_ATT
@ LH5801_INSNC_ATT
Definition:
lh5801.h:45
LH5801_INSNC_LIN
@ LH5801_INSNC_LIN
Definition:
lh5801.h:36
LH5801_INSNC_VMJ
@ LH5801_INSNC_VMJ
Definition:
lh5801.h:80
LH5801_INSNC_VCC
@ LH5801_INSNC_VCC
Definition:
lh5801.h:81
LH5801_INSNC_ANI
@ LH5801_INSNC_ANI
Definition:
lh5801.h:23
LH5801_INSNC_SBI
@ LH5801_INSNC_SBI
Definition:
lh5801.h:20
LH5801_INSNC_DRR
@ LH5801_INSNC_DRR
Definition:
lh5801.h:54
LH5801_INSNC_CIN
@ LH5801_INSNC_CIN
Definition:
lh5801.h:48
LH5801_INSNC_LDE
@ LH5801_INSNC_LDE
Definition:
lh5801.h:35
LH5801_INSNC_SJP
@ LH5801_INSNC_SJP
Definition:
lh5801.h:78
LH5801_INSNC_OFF
@ LH5801_INSNC_OFF
Definition:
lh5801.h:73
LH5801_INSNC_ITA
@ LH5801_INSNC_ITA
Definition:
lh5801.h:66
LH5801_INSNC_RDP
@ LH5801_INSNC_RDP
Definition:
lh5801.h:65
LH5801_INSNC_STA
@ LH5801_INSNC_STA
Definition:
lh5801.h:39
LH5801_INSNC_LDA
@ LH5801_INSNC_LDA
Definition:
lh5801.h:34
LH5801_INSNC_ORA
@ LH5801_INSNC_ORA
Definition:
lh5801.h:24
LH5801_INSNC_SEC
@ LH5801_INSNC_SEC
Definition:
lh5801.h:56
LH5801_INSNC_AND
@ LH5801_INSNC_AND
Definition:
lh5801.h:22
LH5801_INSNC_SDP
@ LH5801_INSNC_SDP
Definition:
lh5801.h:64
LH5801_INSNC_RTI
@ LH5801_INSNC_RTI
Definition:
lh5801.h:83
LH5801_INSNC_HLT
@ LH5801_INSNC_HLT
Definition:
lh5801.h:72
LH5801_INSNC_VEJ
@ LH5801_INSNC_VEJ
Definition:
lh5801.h:79
LH5801_INSNC_ROR
@ LH5801_INSNC_ROR
Definition:
lh5801.h:50
LH5801_INSNC_ADI
@ LH5801_INSNC_ADI
Definition:
lh5801.h:16
LH5801_INSNC_ADR
@ LH5801_INSNC_ADR
Definition:
lh5801.h:18
LH5801_INSNC_ROL
@ LH5801_INSNC_ROL
Definition:
lh5801.h:49
LH5801_INSNC_CPI
@ LH5801_INSNC_CPI
Definition:
lh5801.h:31
LH5801_INSNC_ORI
@ LH5801_INSNC_ORI
Definition:
lh5801.h:25
LH5801_INSNC_SBC
@ LH5801_INSNC_SBC
Definition:
lh5801.h:19
LH5801_INSNC_LDX
@ LH5801_INSNC_LDX
Definition:
lh5801.h:38
LH5801_INSNC_INC
@ LH5801_INSNC_INC
Definition:
lh5801.h:28
LH5801_INSNC_SIN
@ LH5801_INSNC_SIN
Definition:
lh5801.h:41
LH5801_INSNC_EAI
@ LH5801_INSNC_EAI
Definition:
lh5801.h:27
LH5801_INSNC_SHL
@ LH5801_INSNC_SHL
Definition:
lh5801.h:51
LH5801_INSNC_NOP
@ LH5801_INSNC_NOP
Definition:
lh5801.h:71
LH5801_INSNC_AEX
@ LH5801_INSNC_AEX
Definition:
lh5801.h:55
LH5801_INSNC_SHR
@ LH5801_INSNC_SHR
Definition:
lh5801.h:52
LH5801_INSNC_BII
@ LH5801_INSNC_BII
Definition:
lh5801.h:33
LH5801_INSNC_DRL
@ LH5801_INSNC_DRL
Definition:
lh5801.h:53
LH5801_INSNC_BCC
@ LH5801_INSNC_BCC
Definition:
lh5801.h:76
LH5801_INSNC_EOR
@ LH5801_INSNC_EOR
Definition:
lh5801.h:26
LH5801_INSNC_CDV
@ LH5801_INSNC_CDV
Definition:
lh5801.h:58
LH5801_INSNC_STX
@ LH5801_INSNC_STX
Definition:
lh5801.h:42
LH5801_INSNC_RPU
@ LH5801_INSNC_RPU
Definition:
lh5801.h:61
ut8
uint8_t ut8
Definition:
lh5801.h:11
uint8_t
unsigned char uint8_t
Definition:
sftypes.h:31
stdint.h
lh5801_insn_class_desc
Definition:
lh5801.h:89
lh5801_insn_class_desc::desc
const char * desc
Definition:
lh5801.h:91
lh5801_insn_class_desc::mnem
char mnem[4]
Definition:
lh5801.h:90
lh5801_insn
Definition:
lh5801.h:100
lh5801_insn::fd
ut8 fd
Definition:
lh5801.h:103
lh5801_insn::type
ut8 type
Definition:
lh5801.h:102
lh5801_insn::opcode
ut8 opcode
Definition:
lh5801.h:104
lh5801_insn::iclass
ut8 iclass
Definition:
lh5801.h:101
lh5801_insn::imm
ut8 imm[3]
Definition:
lh5801.h:105
librz
asm
arch
lh5801
lh5801.h
Generated by
1.9.1