blob: 6c19f582d02d89514feea329f6bc4e60c2edf78a (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
// license:BSD-3-Clause
// copyright-holders:David Haywood
#include "emu.h"
#include "arcompact_helper.ipp"
// #######################################################################################################################
// ADD_S c,b,u3 0110 1bbb ccc0 0uuu
// #######################################################################################################################
uint32_t arcompact_device::handleop_ADD_S_c_b_u3(uint16_t op)
{
uint32_t u = common16_get_u3(op);
uint8_t breg = common16_get_and_expand_breg(op);
uint8_t creg = common16_get_and_expand_creg(op);
uint32_t result = m_regs[breg] + u;
m_regs[creg] = result;
return m_pc + 2;
}
// #######################################################################################################################
// SUB_S c,b,u3 0110 1bbb ccc0 1uuu
// #######################################################################################################################
uint32_t arcompact_device::handleop_SUB_S_c_b_u3(uint16_t op)
{
uint32_t u = common16_get_u3(op);
uint8_t breg = common16_get_and_expand_breg(op);
uint8_t creg = common16_get_and_expand_creg(op);
uint32_t result = m_regs[breg] - u;
m_regs[creg] = result;
return m_pc + 2;
}
// #######################################################################################################################
// IIII I S S
// ASL_S c,b,u3 0110 1bbb ccc1 0uuu
// #######################################################################################################################
uint32_t arcompact_device::handleop_ASL_S_c_b_u3(uint16_t op)
{
uint32_t u = common16_get_u3(op);
uint8_t breg = common16_get_and_expand_breg(op);
uint8_t creg = common16_get_and_expand_creg(op);
uint32_t result = m_regs[breg] << u;
m_regs[creg] = result;
return m_pc + 2;
}
// #######################################################################################################################
// IIII I S S
// ASR_S c,b,u3 0110 1bbb ccc1 1uuu
// #######################################################################################################################
uint32_t arcompact_device::handleop_ASR_S_c_b_u3(uint16_t op)
{
uint32_t u = common16_get_u3(op);
uint8_t breg = common16_get_and_expand_breg(op);
uint8_t creg = common16_get_and_expand_creg(op);
uint32_t source = m_regs[breg];
uint32_t result = source >> u;
if (source & 0x80000000)
result |= 0xffffffff << (31 - u);
m_regs[creg] = result;
return m_pc + 2;
}
|