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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
// license:BSD-3-Clause
// copyright-holders:David Haywood
#include "emu.h"
#include "arcompact_helper.ipp"
// #######################################################################################################################
// IIII I SSS
// ASL_S b,b,u5 1011 1bbb 000u uuuu
// #######################################################################################################################
uint32_t arcompact_device::handleop_ASL_S_b_b_u5(uint16_t op)
{
uint8_t breg = common16_get_and_expand_breg(op);
uint32_t u = common16_get_u5(op);
m_regs[breg] = m_regs[breg] << (u & 0x1f);
return m_pc + 2;
}
// #######################################################################################################################
// IIII I SSS
// LSR_S b,b,u5 1011 1bbb 001u uuuu
// #######################################################################################################################
uint32_t arcompact_device::handleop_LSR_S_b_b_u5(uint16_t op)
{
uint8_t breg = common16_get_and_expand_breg(op);
uint32_t u = common16_get_u5(op);
m_regs[breg] = m_regs[breg] >> (u & 0x1f);
return m_pc + 2;
}
// #######################################################################################################################
// IIII I SSS
// ASR_S b,b,u5 1011 1bbb 010u uuuu
// #######################################################################################################################
uint32_t arcompact_device::handleop_ASR_S_b_b_u5(uint16_t op)
{
uint8_t breg = common16_get_and_expand_breg(op);
uint32_t u = common16_get_u5(op);
uint32_t source = m_regs[breg];
uint32_t result = m_regs[breg] >> (u & 0x1f);
if (source & 0x80000000)
result |= 0xffffffff << (31 - (u & 0x1f));
m_regs[breg] = result;
return m_pc + 2;
}
// #######################################################################################################################
// IIII I SSS
// SUB_S b,b,u5 1011 1bbb 011u uuuu
// #######################################################################################################################
uint32_t arcompact_device::handleop_SUB_S_b_b_u5(uint16_t op)
{
uint8_t breg = common16_get_and_expand_breg(op);
uint32_t u = common16_get_u5(op);
m_regs[breg] = m_regs[breg] - u;
return m_pc + 2;
}
// #######################################################################################################################
// IIII I SSS
// BSET_S b,b,u5 1011 1bbb 100u uuuu
// #######################################################################################################################
uint32_t arcompact_device::handleop_BSET_S_b_b_u5(uint16_t op)
{
uint8_t breg = common16_get_and_expand_breg(op);
uint32_t u = common16_get_u5(op);
m_regs[breg] = m_regs[breg] | (1 << (u & 0x1f));
return m_pc + 2;
}
// #######################################################################################################################
// IIII I SSS
// BCLR_S b,b,u5 1011 1bbb 101u uuuu
// #######################################################################################################################
uint32_t arcompact_device::handleop_BCLR_S_b_b_u5(uint16_t op)
{
uint8_t breg = common16_get_and_expand_breg(op);
uint32_t u = common16_get_u5(op);
m_regs[breg] = m_regs[breg] & ~(1 << u);
return m_pc + 2;
}
// #######################################################################################################################
// IIII I SSS
// BMSK_S b,b,u5 1011 1bbb 110u uuuu
// #######################################################################################################################
uint32_t arcompact_device::handleop_BMSK_S_b_b_u5(uint16_t op)
{
uint8_t breg = common16_get_and_expand_breg(op);
uint32_t u = common16_get_u5(op);
m_regs[breg] = m_regs[breg] & ((1 << (u + 1)) - 1);
return m_pc + 2;
}
// #######################################################################################################################
// IIII I SSS
// BTST_S b,u5 1011 1bbb 111u uuuu
// #######################################################################################################################
uint32_t arcompact_device::handleop_BTST_S_b_u5(uint16_t op)
{
uint8_t breg = common16_get_and_expand_breg(op);
uint32_t u = common16_get_u5(op);
uint32_t result = m_regs[breg] & (1 << u);
do_flags_nz(result);
return m_pc + 2;
}
|