summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/upd7725
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2016-10-22 13:13:17 +0200
committer Miodrag Milanovic <mmicko@gmail.com>2016-10-22 13:13:17 +0200
commitddb290d5f615019c33c42b8d94e5a5254cabcf33 (patch)
treea70f688b0df3acd19da7b1151e5902e3c6af3fa5 /src/devices/cpu/upd7725
parent333bff8de64dfaeb98134000412796b4fdef970b (diff)
NOTICE (TYPE NAME CONSOLIDATION)
Use standard uint64_t, uint32_t, uint16_t or uint8_t instead of UINT64, UINT32, UINT16 or UINT8 also use standard int64_t, int32_t, int16_t or int8_t instead of INT64, INT32, INT16 or INT8
Diffstat (limited to 'src/devices/cpu/upd7725')
-rw-r--r--src/devices/cpu/upd7725/dasm7725.cpp28
-rw-r--r--src/devices/cpu/upd7725/upd7725.cpp66
-rw-r--r--src/devices/cpu/upd7725/upd7725.h70
3 files changed, 82 insertions, 82 deletions
diff --git a/src/devices/cpu/upd7725/dasm7725.cpp b/src/devices/cpu/upd7725/dasm7725.cpp
index 987002412ac..8edeb821e53 100644
--- a/src/devices/cpu/upd7725/dasm7725.cpp
+++ b/src/devices/cpu/upd7725/dasm7725.cpp
@@ -15,22 +15,22 @@
CPU_DISASSEMBLE( upd7725 )
{
static char output[256];
- UINT32 opcode = oprom[2] | (oprom[1] << 8) | (oprom[0] << 16);
- UINT32 type = (opcode >> 22);
+ uint32_t opcode = oprom[2] | (oprom[1] << 8) | (oprom[0] << 16);
+ uint32_t type = (opcode >> 22);
// printf("dasm: PC %x opcode %08x\n", pc, opcode);
memset(output, 0, sizeof(output));
if(type == 0 || type == 1) { //OP,RT
- UINT8 pselect = (opcode >> 20)&0x3; //P select
- UINT8 alu = (opcode >> 16)&0xf; //ALU operation mode
- UINT8 asl = (opcode >> 15)&0x1; //accumulator select
- UINT8 dpl = (opcode >> 13)&0x3; //DP low modify
- UINT8 dphm = (opcode >> 9)&0xf; //DP high XOR modify
- UINT8 rpdcr = (opcode >> 8)&0x1; //RP decrement
- UINT8 src = (opcode >> 4)&0xf; //move source
- UINT8 dst = (opcode >> 0)&0xf; //move destination
+ uint8_t pselect = (opcode >> 20)&0x3; //P select
+ uint8_t alu = (opcode >> 16)&0xf; //ALU operation mode
+ uint8_t asl = (opcode >> 15)&0x1; //accumulator select
+ uint8_t dpl = (opcode >> 13)&0x3; //DP low modify
+ uint8_t dphm = (opcode >> 9)&0xf; //DP high XOR modify
+ uint8_t rpdcr = (opcode >> 8)&0x1; //RP decrement
+ uint8_t src = (opcode >> 4)&0xf; //move source
+ uint8_t dst = (opcode >> 0)&0xf; //move destination
switch(alu) {
case 0: strcat(output, "nop "); break;
@@ -147,8 +147,8 @@ CPU_DISASSEMBLE( upd7725 )
}
if(type == 2) { //JP
- UINT16 brch = (opcode >> 13) & 0x1ff; //branch
- UINT16 na = (opcode >> 2) & 0x7ff; //next address
+ uint16_t brch = (opcode >> 13) & 0x1ff; //branch
+ uint16_t na = (opcode >> 2) & 0x7ff; //next address
switch(brch) {
case 0x000: strcat(output, "jmpso "); break;
@@ -201,8 +201,8 @@ CPU_DISASSEMBLE( upd7725 )
if(type == 3) { //LD
strcat(output, "ld ");
- UINT16 id = opcode >> 6;
- UINT8 dst = (opcode >> 0) & 0xf; //destination
+ uint16_t id = opcode >> 6;
+ uint8_t dst = (opcode >> 0) & 0xf; //destination
char temp[16];
sprintf(temp, "$%x,", id);
diff --git a/src/devices/cpu/upd7725/upd7725.cpp b/src/devices/cpu/upd7725/upd7725.cpp
index 9564d380bc9..841d9322050 100644
--- a/src/devices/cpu/upd7725/upd7725.cpp
+++ b/src/devices/cpu/upd7725/upd7725.cpp
@@ -24,7 +24,7 @@
const device_type UPD7725 = &device_creator<upd7725_device>;
const device_type UPD96050 = &device_creator<upd96050_device>;
-necdsp_device::necdsp_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, UINT32 abits, UINT32 dbits, const char *name, const char *shortname, const char *source)
+necdsp_device::necdsp_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint32_t abits, uint32_t dbits, const char *name, const char *shortname, const char *source)
: cpu_device(mconfig, type, name, tag, owner, clock, shortname, source),
m_program_config("program", ENDIANNESS_BIG, 32, abits, -2), // data bus width, address bus width, -2 means DWORD-addressable
m_data_config("data", ENDIANNESS_BIG, 16, dbits, -1), m_icount(0), // -1 for WORD-addressable
@@ -47,12 +47,12 @@ necdsp_device::necdsp_device(const machine_config &mconfig, device_type type, co
}
-upd7725_device::upd7725_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+upd7725_device::upd7725_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: necdsp_device(mconfig, UPD7725, tag, owner, clock, 11, 11, "uPD7725", "upd7725", __FILE__)
{
}
-upd96050_device::upd96050_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+upd96050_device::upd96050_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: necdsp_device(mconfig, UPD96050, tag, owner, clock, 14, 12, "uPD96050", "upd96050", __FILE__)
{
}
@@ -238,7 +238,7 @@ void necdsp_device::state_string_export(const device_state_entry &entry, std::st
// cycles it takes for one instruction to execute
//-------------------------------------------------
-UINT32 necdsp_device::execute_min_cycles() const
+uint32_t necdsp_device::execute_min_cycles() const
{
return 4;
}
@@ -249,7 +249,7 @@ UINT32 necdsp_device::execute_min_cycles() const
// cycles it takes for one instruction to execute
//-------------------------------------------------
-UINT32 necdsp_device::execute_max_cycles() const
+uint32_t necdsp_device::execute_max_cycles() const
{
return 4;
}
@@ -260,7 +260,7 @@ UINT32 necdsp_device::execute_max_cycles() const
// input/interrupt lines
//-------------------------------------------------
-UINT32 necdsp_device::execute_input_lines() const
+uint32_t necdsp_device::execute_input_lines() const
{
return 3; // TODO: there should be 11: INT, SCK, /SIEN, /SOEN, SI, and /DACK, plus SO, /SORQ and DRQ; for now, just INT, P0, and P1 are enough.
}
@@ -287,7 +287,7 @@ void necdsp_device::execute_set_input(int inputnum, int state)
// of the shortest instruction, in bytes
//-------------------------------------------------
-UINT32 necdsp_device::disasm_min_opcode_bytes() const
+uint32_t necdsp_device::disasm_min_opcode_bytes() const
{
return 4;
}
@@ -298,7 +298,7 @@ UINT32 necdsp_device::disasm_min_opcode_bytes() const
// of the longest instruction, in bytes
//-------------------------------------------------
-UINT32 necdsp_device::disasm_max_opcode_bytes() const
+uint32_t necdsp_device::disasm_max_opcode_bytes() const
{
return 4;
}
@@ -308,7 +308,7 @@ UINT32 necdsp_device::disasm_max_opcode_bytes() const
// helper function
//-------------------------------------------------
-offs_t necdsp_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options)
+offs_t necdsp_device::disasm_disassemble(char *buffer, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options)
{
extern CPU_DISASSEMBLE( upd7725 );
return CPU_DISASSEMBLE_NAME(upd7725)(this, buffer, pc, oprom, opram, options);
@@ -316,7 +316,7 @@ offs_t necdsp_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *o
void necdsp_device::execute_run()
{
- UINT32 opcode;
+ uint32_t opcode;
do
{
@@ -336,7 +336,7 @@ void necdsp_device::execute_run()
case 3: exec_ld(opcode); break;
}
- INT32 result = (INT32)regs.k * regs.l; //sign + 30-bit result
+ int32_t result = (int32_t)regs.k * regs.l; //sign + 30-bit result
regs.m = result >> 15; //store sign + top 15-bits
regs.n = result << 1; //store low 15-bits + zero
@@ -345,15 +345,15 @@ void necdsp_device::execute_run()
} while (m_icount > 0);
}
-void necdsp_device::exec_op(UINT32 opcode) {
- UINT8 pselect = (opcode >> 20)&0x3; //P select
- UINT8 alu = (opcode >> 16)&0xf; //ALU operation mode
- UINT8 asl = (opcode >> 15)&0x1; //accumulator select
- UINT8 dpl = (opcode >> 13)&0x3; //DP low modify
- UINT8 dphm = (opcode >> 9)&0xf; //DP high XOR modify
- UINT8 rpdcr = (opcode >> 8)&0x1; //RP decrement
- UINT8 src = (opcode >> 4)&0xf; //move source
- UINT8 dst = (opcode >> 0)&0xf; //move destination
+void necdsp_device::exec_op(uint32_t opcode) {
+ uint8_t pselect = (opcode >> 20)&0x3; //P select
+ uint8_t alu = (opcode >> 16)&0xf; //ALU operation mode
+ uint8_t asl = (opcode >> 15)&0x1; //accumulator select
+ uint8_t dpl = (opcode >> 13)&0x3; //DP low modify
+ uint8_t dphm = (opcode >> 9)&0xf; //DP high XOR modify
+ uint8_t rpdcr = (opcode >> 8)&0x1; //RP decrement
+ uint8_t src = (opcode >> 4)&0xf; //move source
+ uint8_t dst = (opcode >> 0)&0xf; //move destination
switch(src) {
case 0: regs.idb = regs.trb; break;
@@ -375,7 +375,7 @@ void necdsp_device::exec_op(UINT32 opcode) {
}
if(alu) {
- UINT16 p=0, q=0, r=0;
+ uint16_t p=0, q=0, r=0;
Flag flag;
bool c=0;
@@ -474,19 +474,19 @@ void necdsp_device::exec_op(UINT32 opcode) {
if(rpdcr) regs.rp--;
}
-void necdsp_device::exec_rt(UINT32 opcode) {
+void necdsp_device::exec_rt(uint32_t opcode) {
exec_op(opcode);
regs.pc = regs.stack[--regs.sp];
regs.sp &= 0xf;
}
-void necdsp_device::exec_jp(UINT32 opcode) {
- UINT16 brch = (opcode >> 13) & 0x1ff; //branch
- UINT16 na = (opcode >> 2) & 0x7ff; //next address
- UINT16 bank = (opcode >> 0) & 0x3; //bank address
+void necdsp_device::exec_jp(uint32_t opcode) {
+ uint16_t brch = (opcode >> 13) & 0x1ff; //branch
+ uint16_t na = (opcode >> 2) & 0x7ff; //next address
+ uint16_t bank = (opcode >> 0) & 0x3; //bank address
- UINT16 jps = (regs.pc & 0x2000) | (bank << 11) | (na << 0);
- UINT16 jpl = (bank << 11) | (na << 0);
+ uint16_t jps = (regs.pc & 0x2000) | (bank << 11) | (na << 0);
+ uint16_t jpl = (bank << 11) | (na << 0);
switch(brch) {
case 0x000: regs.pc = regs.so; return; //JMPSO
@@ -537,9 +537,9 @@ void necdsp_device::exec_jp(UINT32 opcode) {
}
}
-void necdsp_device::exec_ld(UINT32 opcode) {
- UINT16 id = opcode >> 6; //immediate data
- UINT8 dst = (opcode >> 0) & 0xf; //destination
+void necdsp_device::exec_ld(uint32_t opcode) {
+ uint16_t id = opcode >> 6; //immediate data
+ uint8_t dst = (opcode >> 0) & 0xf; //destination
regs.idb = id;
@@ -566,7 +566,7 @@ void necdsp_device::exec_ld(UINT32 opcode) {
}
}
-UINT8 necdsp_device::snesdsp_read(bool mode) {
+uint8_t necdsp_device::snesdsp_read(bool mode) {
if (!mode)
{
return regs.sr >> 8;
@@ -595,7 +595,7 @@ UINT8 necdsp_device::snesdsp_read(bool mode) {
}
}
-void necdsp_device::snesdsp_write(bool mode, UINT8 data) {
+void necdsp_device::snesdsp_write(bool mode, uint8_t data) {
if (!mode) return;
if (regs.sr.drc == 0)
diff --git a/src/devices/cpu/upd7725/upd7725.h b/src/devices/cpu/upd7725/upd7725.h
index 94a7f85869f..80714d376eb 100644
--- a/src/devices/cpu/upd7725/upd7725.h
+++ b/src/devices/cpu/upd7725/upd7725.h
@@ -73,7 +73,7 @@ class necdsp_device : public cpu_device
{
protected:
// construction/destruction
- necdsp_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, UINT32 abits, UINT32 dbits, const char *name, const char *shortname, const char *source);
+ necdsp_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint32_t abits, uint32_t dbits, const char *name, const char *shortname, const char *source);
public:
@@ -89,8 +89,8 @@ public:
//template<class _Object> static devcb_base &set_out_sorq_callback(device_t &device, _Object object) { return downcast<necdsp_device &>(device).m_out_sorq_cb.set_callback(object); }
//template<class _Object> static devcb_base &set_out_drq_callback(device_t &device, _Object object) { return downcast<necdsp_device &>(device).m_out_drq_cb.set_callback(object); }
- UINT8 snesdsp_read(bool mode);
- void snesdsp_write(bool mode, UINT8 data);
+ uint8_t snesdsp_read(bool mode);
+ void snesdsp_write(bool mode, uint8_t data);
protected:
// device-level overrides
@@ -98,9 +98,9 @@ protected:
virtual void device_reset() override;
// device_execute_interface overrides
- virtual UINT32 execute_min_cycles() const override;
- virtual UINT32 execute_max_cycles() const override;
- virtual UINT32 execute_input_lines() const override;
+ virtual uint32_t execute_min_cycles() const override;
+ virtual uint32_t execute_max_cycles() const override;
+ virtual uint32_t execute_input_lines() const override;
virtual void execute_run() override;
virtual void execute_set_input(int inputnum, int state) override;
@@ -113,14 +113,14 @@ protected:
virtual void state_string_export(const device_state_entry &entry, std::string &str) const override;
// device_disasm_interface overrides
- virtual UINT32 disasm_min_opcode_bytes() const override;
- virtual UINT32 disasm_max_opcode_bytes() const override;
- virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) override;
+ virtual uint32_t disasm_min_opcode_bytes() const override;
+ virtual uint32_t disasm_max_opcode_bytes() const override;
+ virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) override;
// inline data
const address_space_config m_program_config, m_data_config;
- UINT16 dataRAM[2048];
+ uint16_t dataRAM[2048];
private:
struct Flag
@@ -161,32 +161,32 @@ private:
struct Regs
{
- UINT16 pc; //program counter
- UINT16 stack[16]; //LIFO
- UINT16 rp; //ROM pointer
- UINT16 dp; //data pointer
- UINT8 sp; //stack pointer
- INT16 k;
- INT16 l;
- INT16 m;
- INT16 n;
- INT16 a; //accumulator
- INT16 b; //accumulator
+ uint16_t pc; //program counter
+ uint16_t stack[16]; //LIFO
+ uint16_t rp; //ROM pointer
+ uint16_t dp; //data pointer
+ uint8_t sp; //stack pointer
+ int16_t k;
+ int16_t l;
+ int16_t m;
+ int16_t n;
+ int16_t a; //accumulator
+ int16_t b; //accumulator
Flag flaga;
Flag flagb;
- UINT16 tr; //temporary register
- UINT16 trb; //temporary register
+ uint16_t tr; //temporary register
+ uint16_t trb; //temporary register
Status sr; //status register
- UINT16 dr; //data register
- UINT16 si;
- UINT16 so;
- UINT16 idb;
+ uint16_t dr; //data register
+ uint16_t si;
+ uint16_t so;
+ uint16_t idb;
} regs;
- void exec_op(UINT32 opcode);
- void exec_rt(UINT32 opcode);
- void exec_jp(UINT32 opcode);
- void exec_ld(UINT32 opcode);
+ void exec_op(uint32_t opcode);
+ void exec_rt(uint32_t opcode);
+ void exec_jp(uint32_t opcode);
+ void exec_ld(uint32_t opcode);
int m_icount;
int m_irq; // old irq line state, for detecting rising edges.
@@ -213,17 +213,17 @@ class upd7725_device : public necdsp_device
{
public:
// construction/destruction
- upd7725_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ upd7725_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
};
class upd96050_device : public necdsp_device
{
public:
// construction/destruction
- upd96050_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ upd96050_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- UINT16 dataram_r(UINT16 addr) { return dataRAM[addr]; }
- void dataram_w(UINT16 addr, UINT16 data) { dataRAM[addr] = data; }
+ uint16_t dataram_r(uint16_t addr) { return dataRAM[addr]; }
+ void dataram_w(uint16_t addr, uint16_t data) { dataRAM[addr] = data; }
};
// device type definition