summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/cpu/i4004/4004dasm.c114
-rw-r--r--src/emu/cpu/i4004/i4004.c138
-rw-r--r--src/emu/cpu/i4004/i4004.h6
-rw-r--r--src/emu/cpu/i8085/i8085.c4
-rw-r--r--src/emu/sound/nes_apu.c60
-rw-r--r--src/emu/sound/speaker.c74
6 files changed, 198 insertions, 198 deletions
diff --git a/src/emu/cpu/i4004/4004dasm.c b/src/emu/cpu/i4004/4004dasm.c
index 4b268558e0a..c66372ffc6e 100644
--- a/src/emu/cpu/i4004/4004dasm.c
+++ b/src/emu/cpu/i4004/4004dasm.c
@@ -3,7 +3,7 @@
* 4004dasm.c
*
* Intel 4004 CPU Disassembly
- *
+ *
* Initial version by Miodrag Milanovic
*
*****************************************************************************/
@@ -18,7 +18,7 @@ CPU_DISASSEMBLE( i4004 )
UINT32 flags = 0;
UINT8 op;
unsigned PC = pc;
- UINT16 page = PC & 0x0f00;
+ UINT16 page = PC & 0x0f00;
switch (op = OP(pc++))
{
case 0x00: sprintf (buffer,"nop"); break;
@@ -26,75 +26,75 @@ CPU_DISASSEMBLE( i4004 )
case 0x12: sprintf (buffer,"jc $%03x",page | ARG(pc)); pc++; break;
case 0x14: sprintf (buffer,"jz $%03x",page | ARG(pc)); pc++; break;
case 0x19: sprintf (buffer,"jt $%03x",page | ARG(pc)); pc++; break;
- case 0x1a: sprintf (buffer,"jnc $%03x",page | ARG(pc)); pc++; break;
- case 0x1c: sprintf (buffer,"jnz $%03x",page | ARG(pc)); pc++; break;
- case 0x10: case 0x13: case 0x15: case 0x16:
- case 0x17: case 0x18: case 0x1b: case 0x1d:
- case 0x1e: case 0x1f:
+ case 0x1a: sprintf (buffer,"jnc $%03x",page | ARG(pc)); pc++; break;
+ case 0x1c: sprintf (buffer,"jnz $%03x",page | ARG(pc)); pc++; break;
+ case 0x10: case 0x13: case 0x15: case 0x16:
+ case 0x17: case 0x18: case 0x1b: case 0x1d:
+ case 0x1e: case 0x1f:
sprintf (buffer,"jcn $%01x,$%03x",op & 0x0f,page | ARG(pc)); pc++; break;
- case 0x20: case 0x22: case 0x24: case 0x26:
- case 0x28: case 0x2a: case 0x2c: case 0x2e:
+ case 0x20: case 0x22: case 0x24: case 0x26:
+ case 0x28: case 0x2a: case 0x2c: case 0x2e:
sprintf (buffer,"fim $%01x,$%02x",op & 0x0f,OP(pc)); pc++; break;
- case 0x21: case 0x23: case 0x25: case 0x27:
- case 0x29: case 0x2b: case 0x2d: case 0x2f:
+ case 0x21: case 0x23: case 0x25: case 0x27:
+ case 0x29: case 0x2b: case 0x2d: case 0x2f:
sprintf (buffer,"src $%01x",(op & 0x0f)-1); break;
- case 0x30: case 0x32: case 0x34: case 0x36:
- case 0x38: case 0x3a: case 0x3c: case 0x3e:
+ case 0x30: case 0x32: case 0x34: case 0x36:
+ case 0x38: case 0x3a: case 0x3c: case 0x3e:
sprintf (buffer,"fin $%01x",op & 0x0f); break;
- case 0x31: case 0x33: case 0x35: case 0x37:
- case 0x39: case 0x3b: case 0x3d: case 0x3f:
+ case 0x31: case 0x33: case 0x35: case 0x37:
+ case 0x39: case 0x3b: case 0x3d: case 0x3f:
sprintf (buffer,"jin $%01x",(op & 0x0f)-1); break;
- case 0x40: case 0x41: case 0x42: case 0x43:
- case 0x44: case 0x45: case 0x46: case 0x47:
- case 0x48: case 0x49: case 0x4a: case 0x4b:
- case 0x4c: case 0x4d: case 0x4e: case 0x4f:
+ case 0x40: case 0x41: case 0x42: case 0x43:
+ case 0x44: case 0x45: case 0x46: case 0x47:
+ case 0x48: case 0x49: case 0x4a: case 0x4b:
+ case 0x4c: case 0x4d: case 0x4e: case 0x4f:
sprintf (buffer,"jun $%01x%02x",op & 0x0f,ARG(pc)); pc++; break;
- case 0x50: case 0x51: case 0x52: case 0x53:
- case 0x54: case 0x55: case 0x56: case 0x57:
- case 0x58: case 0x59: case 0x5a: case 0x5b:
- case 0x5c: case 0x5d: case 0x5e: case 0x5f:
+ case 0x50: case 0x51: case 0x52: case 0x53:
+ case 0x54: case 0x55: case 0x56: case 0x57:
+ case 0x58: case 0x59: case 0x5a: case 0x5b:
+ case 0x5c: case 0x5d: case 0x5e: case 0x5f:
sprintf (buffer,"jms $%01x%02x",op & 0x0f,ARG(pc)); pc++; break;
- case 0x60: case 0x61: case 0x62: case 0x63:
- case 0x64: case 0x65: case 0x66: case 0x67:
- case 0x68: case 0x69: case 0x6a: case 0x6b:
- case 0x6c: case 0x6d: case 0x6e: case 0x6f:
+ case 0x60: case 0x61: case 0x62: case 0x63:
+ case 0x64: case 0x65: case 0x66: case 0x67:
+ case 0x68: case 0x69: case 0x6a: case 0x6b:
+ case 0x6c: case 0x6d: case 0x6e: case 0x6f:
sprintf (buffer,"inc $%01x",op & 0x0f); break;
- case 0x70: case 0x71: case 0x72: case 0x73:
- case 0x74: case 0x75: case 0x76: case 0x77:
- case 0x78: case 0x79: case 0x7a: case 0x7b:
- case 0x7c: case 0x7d: case 0x7e: case 0x7f:
+ case 0x70: case 0x71: case 0x72: case 0x73:
+ case 0x74: case 0x75: case 0x76: case 0x77:
+ case 0x78: case 0x79: case 0x7a: case 0x7b:
+ case 0x7c: case 0x7d: case 0x7e: case 0x7f:
sprintf (buffer,"isz $%01x,%03x",op & 0x0f,page | ARG(pc)); pc++; break;
- case 0x80: case 0x81: case 0x82: case 0x83:
- case 0x84: case 0x85: case 0x86: case 0x87:
- case 0x88: case 0x89: case 0x8a: case 0x8b:
- case 0x8c: case 0x8d: case 0x8e: case 0x8f:
+ case 0x80: case 0x81: case 0x82: case 0x83:
+ case 0x84: case 0x85: case 0x86: case 0x87:
+ case 0x88: case 0x89: case 0x8a: case 0x8b:
+ case 0x8c: case 0x8d: case 0x8e: case 0x8f:
sprintf (buffer,"add $%01x",op & 0x0f); break;
- case 0x90: case 0x91: case 0x92: case 0x93:
- case 0x94: case 0x95: case 0x96: case 0x97:
- case 0x98: case 0x99: case 0x9a: case 0x9b:
- case 0x9c: case 0x9d: case 0x9e: case 0x9f:
+ case 0x90: case 0x91: case 0x92: case 0x93:
+ case 0x94: case 0x95: case 0x96: case 0x97:
+ case 0x98: case 0x99: case 0x9a: case 0x9b:
+ case 0x9c: case 0x9d: case 0x9e: case 0x9f:
sprintf (buffer,"sub $%01x",op & 0x0f); break;
- case 0xa0: case 0xa1: case 0xa2: case 0xa3:
- case 0xa4: case 0xa5: case 0xa6: case 0xa7:
- case 0xa8: case 0xa9: case 0xaa: case 0xab:
- case 0xac: case 0xad: case 0xae: case 0xaf:
+ case 0xa0: case 0xa1: case 0xa2: case 0xa3:
+ case 0xa4: case 0xa5: case 0xa6: case 0xa7:
+ case 0xa8: case 0xa9: case 0xaa: case 0xab:
+ case 0xac: case 0xad: case 0xae: case 0xaf:
sprintf (buffer,"ld $%01x",op & 0x0f); break;
- case 0xb0: case 0xb1: case 0xb2: case 0xb3:
- case 0xb4: case 0xb5: case 0xb6: case 0xb7:
- case 0xb8: case 0xb9: case 0xba: case 0xbb:
- case 0xbc: case 0xbd: case 0xbe: case 0xbf:
+ case 0xb0: case 0xb1: case 0xb2: case 0xb3:
+ case 0xb4: case 0xb5: case 0xb6: case 0xb7:
+ case 0xb8: case 0xb9: case 0xba: case 0xbb:
+ case 0xbc: case 0xbd: case 0xbe: case 0xbf:
sprintf (buffer,"xch $%01x",op & 0x0f); break;
- case 0xc0: case 0xc1: case 0xc2: case 0xc3:
- case 0xc4: case 0xc5: case 0xc6: case 0xc7:
- case 0xc8: case 0xc9: case 0xca: case 0xcb:
- case 0xcc: case 0xcd: case 0xce: case 0xcf:
+ case 0xc0: case 0xc1: case 0xc2: case 0xc3:
+ case 0xc4: case 0xc5: case 0xc6: case 0xc7:
+ case 0xc8: case 0xc9: case 0xca: case 0xcb:
+ case 0xcc: case 0xcd: case 0xce: case 0xcf:
sprintf (buffer,"bbl $%01x",op & 0x0f); break;
- case 0xd0: case 0xd1: case 0xd2: case 0xd3:
- case 0xd4: case 0xd5: case 0xd6: case 0xd7:
- case 0xd8: case 0xd9: case 0xda: case 0xdb:
- case 0xdc: case 0xdd: case 0xde: case 0xdf:
+ case 0xd0: case 0xd1: case 0xd2: case 0xd3:
+ case 0xd4: case 0xd5: case 0xd6: case 0xd7:
+ case 0xd8: case 0xd9: case 0xda: case 0xdb:
+ case 0xdc: case 0xdd: case 0xde: case 0xdf:
sprintf (buffer,"ldm $%01x",op & 0x0f); break;
-
+
case 0xe0: sprintf (buffer,"wrm"); break;
case 0xe1: sprintf (buffer,"wmp"); break;
case 0xe2: sprintf (buffer,"wrr"); break;
@@ -111,7 +111,7 @@ CPU_DISASSEMBLE( i4004 )
case 0xed: sprintf (buffer,"rd1"); break;
case 0xee: sprintf (buffer,"rd2"); break;
case 0xef: sprintf (buffer,"rd3"); break;
-
+
case 0xf0: sprintf (buffer,"clb"); break;
case 0xf1: sprintf (buffer,"clc"); break;
case 0xf2: sprintf (buffer,"iac"); break;
diff --git a/src/emu/cpu/i4004/i4004.c b/src/emu/cpu/i4004/i4004.c
index 8fd9a882aaf..af76a239b36 100644
--- a/src/emu/cpu/i4004/i4004.c
+++ b/src/emu/cpu/i4004/i4004.c
@@ -2,8 +2,8 @@
*
* i4004.c
*
- * Intel 4004 CPU
- *
+ * Intel 4004 CPU
+ *
* Initial version by Miodrag Milanovic
*
*****************************************************************************/
@@ -57,7 +57,7 @@ static const cpu_state_entry state_array[] =
{
I4004_STATE_ENTRY(PC, "%03X", PC.w.l, 0x0fff, 0)
I4004_STATE_ENTRY(GENPC,"%03X", PC.w.l, 0x0fff, CPUSTATE_NOSHOW)
- I4004_STATE_ENTRY(A, "%01X", A, 0x0f, 0)
+ I4004_STATE_ENTRY(A, "%01X", A, 0x0f, 0)
I4004_STATE_ENTRY(R01, "%02X", R[0], 0xff, 0)
I4004_STATE_ENTRY(R23, "%02X", R[1], 0xff, 0)
I4004_STATE_ENTRY(R45, "%02X", R[2], 0xff, 0)
@@ -164,7 +164,7 @@ INLINE UINT8 GET_REG(i4004_state *cpustate, UINT8 num)
{
UINT8 r = cpustate->R[num>>1];
if (num & 1) {
- return r & 0x0f;
+ return r & 0x0f;
} else {
return (r >> 4) & 0x0f;
}
@@ -187,7 +187,7 @@ INLINE void PUSH_STACK(i4004_state *cpustate)
INLINE void POP_STACK(i4004_state *cpustate)
{
cpustate->ADDR[cpustate->pc_pos].d = 0;
- cpustate->pc_pos = (cpustate->pc_pos - 1) & cpustate->addr_mask;
+ cpustate->pc_pos = (cpustate->pc_pos - 1) & cpustate->addr_mask;
}
void i4004_set_test(const device_config *device, UINT8 val)
@@ -202,91 +202,91 @@ static void execute_one(i4004_state *cpustate, int opcode)
switch (opcode)
{
case 0x00: /* NOP */
- /* no op */
+ /* no op */
break;
- case 0x10: case 0x11: case 0x12: case 0x13:
- case 0x14: case 0x15: case 0x16: case 0x17:
- case 0x18: case 0x19: case 0x1a: case 0x1b:
+ case 0x10: case 0x11: case 0x12: case 0x13:
+ case 0x14: case 0x15: case 0x16: case 0x17:
+ case 0x18: case 0x19: case 0x1a: case 0x1b:
case 0x1c: case 0x1d: case 0x1e: case 0x1f: /* JCN */
{
UINT8 arg = ARG(cpustate);
-
+
UINT8 C1 = BIT(opcode,3);
UINT8 C2 = BIT(opcode,2);
UINT8 C3 = BIT(opcode,1);
UINT8 C4 = BIT(opcode,0);
UINT8 JUMP = (((cpustate->A == 0) ? 1 : 0) & C2) | ((cpustate->C) & C3) | ((cpustate->TEST ^ 1) & C4);
cpustate->icount -= 8;
-
+
if(((C1 ^ 1) & JUMP) | (C1 & (JUMP ^ 1))) {
GET_PC.w.l = (GET_PC.w.l & 0x0f00) | arg;
cpustate->PC = GET_PC;
}
}
break;
- case 0x20: case 0x22: case 0x24: case 0x26:
+ case 0x20: case 0x22: case 0x24: case 0x26:
case 0x28: case 0x2a: case 0x2c: case 0x2e: /* FIM */
cpustate->icount -= 8;
cpustate->R[(opcode & 0x0f)>>1] = ROP(cpustate);
break;
- case 0x21: case 0x23: case 0x25: case 0x27:
+ case 0x21: case 0x23: case 0x25: case 0x27:
case 0x29: case 0x2b: case 0x2d: case 0x2f: /* SRC */
- cpustate->RAM.b.l = cpustate->R[(opcode & 0x0f)>>1];
+ cpustate->RAM.b.l = cpustate->R[(opcode & 0x0f)>>1];
break;
- case 0x30: case 0x32: case 0x34: case 0x36:
+ case 0x30: case 0x32: case 0x34: case 0x36:
case 0x38: case 0x3a: case 0x3c: case 0x3e: /* FIN */
cpustate->icount -= 8;
cpustate->R[(opcode & 0x0f)>>1] = READ_ROM(cpustate);
break;
- case 0x31: case 0x33: case 0x35: case 0x37:
+ case 0x31: case 0x33: case 0x35: case 0x37:
case 0x39: case 0x3b: case 0x3d: case 0x3f: /* JIN */
GET_PC.w.l = (GET_PC.w.l & 0x0f00) | cpustate->R[(opcode & 0x0f)>>1];
cpustate->PC = GET_PC;
break;
- case 0x40: case 0x41: case 0x42: case 0x43:
- case 0x44: case 0x45: case 0x46: case 0x47:
- case 0x48: case 0x49: case 0x4a: case 0x4b:
+ case 0x40: case 0x41: case 0x42: case 0x43:
+ case 0x44: case 0x45: case 0x46: case 0x47:
+ case 0x48: case 0x49: case 0x4a: case 0x4b:
case 0x4c: case 0x4d: case 0x4e: case 0x4f: /* JUN */
cpustate->icount -= 8;
GET_PC.w.l = ((opcode & 0x0f) << 8) | ARG(cpustate);
cpustate->PC = GET_PC;
break;
- case 0x50: case 0x51: case 0x52: case 0x53:
- case 0x54: case 0x55: case 0x56: case 0x57:
- case 0x58: case 0x59: case 0x5a: case 0x5b:
+ case 0x50: case 0x51: case 0x52: case 0x53:
+ case 0x54: case 0x55: case 0x56: case 0x57:
+ case 0x58: case 0x59: case 0x5a: case 0x5b:
case 0x5c: case 0x5d: case 0x5e: case 0x5f: /* JMS */
{
UINT16 newPC = ((opcode & 0x0f) << 8) | ARG(cpustate);
- cpustate->icount -= 8;
+ cpustate->icount -= 8;
PUSH_STACK(cpustate);
GET_PC.w.l = newPC;
cpustate->PC = GET_PC;
}
break;
- case 0x60: case 0x61: case 0x62: case 0x63:
- case 0x64: case 0x65: case 0x66: case 0x67:
- case 0x68: case 0x69: case 0x6a: case 0x6b:
+ case 0x60: case 0x61: case 0x62: case 0x63:
+ case 0x64: case 0x65: case 0x66: case 0x67:
+ case 0x68: case 0x69: case 0x6a: case 0x6b:
case 0x6c: case 0x6d: case 0x6e: case 0x6f: /* INC */
SET_REG(cpustate, opcode & 0x0f, GET_REG(cpustate, opcode & 0x0f) + 1);
break;
- case 0x70: case 0x71: case 0x72: case 0x73:
- case 0x74: case 0x75: case 0x76: case 0x77:
- case 0x78: case 0x79: case 0x7a: case 0x7b:
+ case 0x70: case 0x71: case 0x72: case 0x73:
+ case 0x74: case 0x75: case 0x76: case 0x77:
+ case 0x78: case 0x79: case 0x7a: case 0x7b:
case 0x7c: case 0x7d: case 0x7e: case 0x7f: /* ISZ */
- {
+ {
UINT8 val = (GET_REG(cpustate, opcode & 0x0f) + 1) & 0xf;
UINT16 addr = ARG(cpustate);
cpustate->icount -= 8;
- SET_REG(cpustate, opcode & 0x0f, val);
+ SET_REG(cpustate, opcode & 0x0f, val);
if (val!=0) {
- GET_PC.w.l = (GET_PC.w.l & 0x0f00) | addr;
- }
- cpustate->PC = GET_PC;
+ GET_PC.w.l = (GET_PC.w.l & 0x0f00) | addr;
+ }
+ cpustate->PC = GET_PC;
}
break;
- case 0x80: case 0x81: case 0x82: case 0x83:
- case 0x84: case 0x85: case 0x86: case 0x87:
- case 0x88: case 0x89: case 0x8a: case 0x8b:
+ case 0x80: case 0x81: case 0x82: case 0x83:
+ case 0x84: case 0x85: case 0x86: case 0x87:
+ case 0x88: case 0x89: case 0x8a: case 0x8b:
case 0x8c: case 0x8d: case 0x8e: case 0x8f: /* ADD */
{
UINT8 acc = cpustate->A + GET_REG(cpustate, opcode & 0x0f) + cpustate->C;
@@ -294,47 +294,47 @@ static void execute_one(i4004_state *cpustate, int opcode)
cpustate->C = (acc >> 4) & 1;
}
break;
- case 0x90: case 0x91: case 0x92: case 0x93:
- case 0x94: case 0x95: case 0x96: case 0x97:
- case 0x98: case 0x99: case 0x9a: case 0x9b:
+ case 0x90: case 0x91: case 0x92: case 0x93:
+ case 0x94: case 0x95: case 0x96: case 0x97:
+ case 0x98: case 0x99: case 0x9a: case 0x9b:
case 0x9c: case 0x9d: case 0x9e: case 0x9f: /* SUB */
{
UINT8 acc = cpustate->A + (GET_REG(cpustate, opcode & 0x0f) ^ 0x0f) + (cpustate->C ^ 1);
- cpustate->A = acc & 0x0f;
+ cpustate->A = acc & 0x0f;
cpustate->C = (acc >> 4) & 1;
}
break;
- case 0xa0: case 0xa1: case 0xa2: case 0xa3:
- case 0xa4: case 0xa5: case 0xa6: case 0xa7:
- case 0xa8: case 0xa9: case 0xaa: case 0xab:
+ case 0xa0: case 0xa1: case 0xa2: case 0xa3:
+ case 0xa4: case 0xa5: case 0xa6: case 0xa7:
+ case 0xa8: case 0xa9: case 0xaa: case 0xab:
case 0xac: case 0xad: case 0xae: case 0xaf: /* LD */
cpustate->A = GET_REG(cpustate, opcode & 0x0f);
break;
- case 0xb0: case 0xb1: case 0xb2: case 0xb3:
- case 0xb4: case 0xb5: case 0xb6: case 0xb7:
- case 0xb8: case 0xb9: case 0xba: case 0xbb:
+ case 0xb0: case 0xb1: case 0xb2: case 0xb3:
+ case 0xb4: case 0xb5: case 0xb6: case 0xb7:
+ case 0xb8: case 0xb9: case 0xba: case 0xbb:
case 0xbc: case 0xbd: case 0xbe: case 0xbf: /* XCH */
{
UINT8 temp = cpustate->A;
cpustate->A = GET_REG(cpustate, opcode & 0x0f);
SET_REG(cpustate, opcode & 0x0f, temp);
- }
+ }
break;
- case 0xc0: case 0xc1: case 0xc2: case 0xc3:
- case 0xc4: case 0xc5: case 0xc6: case 0xc7:
- case 0xc8: case 0xc9: case 0xca: case 0xcb:
- case 0xcc: case 0xcd: case 0xce: case 0xcf: /* BBL */
+ case 0xc0: case 0xc1: case 0xc2: case 0xc3:
+ case 0xc4: case 0xc5: case 0xc6: case 0xc7:
+ case 0xc8: case 0xc9: case 0xca: case 0xcb:
+ case 0xcc: case 0xcd: case 0xce: case 0xcf: /* BBL */
POP_STACK(cpustate);
cpustate->A = opcode & 0x0f;
cpustate->PC = GET_PC;
break;
- case 0xd0: case 0xd1: case 0xd2: case 0xd3:
- case 0xd4: case 0xd5: case 0xd6: case 0xd7:
- case 0xd8: case 0xd9: case 0xda: case 0xdb:
+ case 0xd0: case 0xd1: case 0xd2: case 0xd3:
+ case 0xd4: case 0xd5: case 0xd6: case 0xd7:
+ case 0xd8: case 0xd9: case 0xda: case 0xdb:
case 0xdc: case 0xdd: case 0xde: case 0xdf: /* LDM */
cpustate->A = opcode & 0x0f;
break;
- case 0xe0: /* WRM */
+ case 0xe0: /* WRM */
WM(cpustate,cpustate->A);
break;
case 0xe1: /* WMP */
@@ -366,14 +366,14 @@ static void execute_one(i4004_state *cpustate, int opcode)
case 0xe9: /* RDM */
cpustate->A = RM(cpustate);
break;
- case 0xea: /* RDR */
+ case 0xea: /* RDR */
cpustate->A = RIO(cpustate);
break;
case 0xeb: /* ADM */
cpustate->A += RM(cpustate) + cpustate->C;
cpustate->C = cpustate->A >> 4;
cpustate->A &= 0x0f;
- break;
+ break;
case 0xec: /* RD0 */
cpustate->A = RMS(cpustate,0);
break;
@@ -386,16 +386,16 @@ static void execute_one(i4004_state *cpustate, int opcode)
case 0xef: /* RD3 */
cpustate->A = RMS(cpustate,3);
break;
-
+
case 0xf0: /* CLB */
cpustate->A = 0;
cpustate->C = 0;
- break;
+ break;
case 0xf1: /* CLC */
cpustate->C = 0;
break;
case 0xf2: /* IAC */
- cpustate->A = cpustate->A++;
+ cpustate->A = cpustate->A++;
cpustate->C = cpustate->A >> 4;
cpustate->A &= 0x0f;
break;
@@ -424,7 +424,7 @@ static void execute_one(i4004_state *cpustate, int opcode)
case 0xf8: /* DAC */
cpustate->A = cpustate->A + 0x0f;
cpustate->C = cpustate->A >> 4;
- cpustate->A &= 0x0f;
+ cpustate->A &= 0x0f;
break;
case 0xf9: /* TCS */
cpustate->A = cpustate->C ? 10 : 9;
@@ -481,20 +481,20 @@ static CPU_EXECUTE( i4004 )
static CPU_INIT( i4004 )
{
i4004_state *cpustate = get_safe_token(device);
-
+
/* set up the state table */
cpustate->state = state_table_template;
cpustate->state.baseptr = cpustate;
cpustate->state.subtypemask = 1;
-
+
cpustate->device = device;
cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
cpustate->data = memory_find_address_space(device, ADDRESS_SPACE_DATA);
cpustate->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
-
+
state_save_register_device_item(device, 0, cpustate->PC);
- state_save_register_device_item(device, 0, cpustate->A);
+ state_save_register_device_item(device, 0, cpustate->A);
state_save_register_device_item(device, 0, cpustate->C);
state_save_register_device_item(device, 0, cpustate->TEST);
state_save_register_device_item(device, 0, cpustate->pc_pos);
@@ -509,8 +509,8 @@ static CPU_INIT( i4004 )
state_save_register_device_item(device, 0, cpustate->R[4]);
state_save_register_device_item(device, 0, cpustate->R[5]);
state_save_register_device_item(device, 0, cpustate->R[6]);
- state_save_register_device_item(device, 0, cpustate->R[7]);
- state_save_register_device_item(device, 0, cpustate->RAM);
+ state_save_register_device_item(device, 0, cpustate->R[7]);
+ state_save_register_device_item(device, 0, cpustate->RAM);
}
@@ -531,7 +531,7 @@ static CPU_RESET( i4004 )
memset(cpustate->ADDR,0,sizeof(cpustate->ADDR));
cpustate->RAM.d = 0;
cpustate->PC = GET_PC;
-
+
}
diff --git a/src/emu/cpu/i4004/i4004.h b/src/emu/cpu/i4004/i4004.h
index 69f5e45eda0..ac974efc4f2 100644
--- a/src/emu/cpu/i4004/i4004.h
+++ b/src/emu/cpu/i4004/i4004.h
@@ -10,13 +10,13 @@
enum
{
- I4004_PC,
+ I4004_PC,
I4004_A,
- I4004_R01, I4004_R23, I4004_R45, I4004_R67, I4004_R89, I4004_RAB, I4004_RCD, I4004_REF,
+ I4004_R01, I4004_R23, I4004_R45, I4004_R67, I4004_R89, I4004_RAB, I4004_RCD, I4004_REF,
I4004_ADDR1,I4004_ADDR2,I4004_ADDR3,I4004_ADDR4,I4004_RAM,
I4004_GENPC = REG_GENPC,
I4004_GENSP = REG_GENSP,
- I4004_GENPCBASE = REG_GENPCBASE
+ I4004_GENPCBASE = REG_GENPCBASE
};
/***************************************************************************
diff --git a/src/emu/cpu/i8085/i8085.c b/src/emu/cpu/i8085/i8085.c
index 7ad1945816c..91ef9f06983 100644
--- a/src/emu/cpu/i8085/i8085.c
+++ b/src/emu/cpu/i8085/i8085.c
@@ -652,10 +652,10 @@ static void execute_one(i8085_state *cpustate, int opcode)
if ((cpustate->AF.b.l&HF) | ((cpustate->AF.b.h&0xf)>9)) cpustate->XX.b.h+=6;
if ((cpustate->AF.b.l&CF) | (cpustate->AF.b.h>0x99)) cpustate->XX.b.h+=0x60;
}
-
+
cpustate->AF.b.l=(cpustate->AF.b.l&3) | (cpustate->AF.b.h&0x28) | (cpustate->AF.b.h>0x99) | ((cpustate->AF.b.h^cpustate->XX.b.h)&0x10) | ZSP[cpustate->XX.b.h];
cpustate->AF.b.h=cpustate->XX.b.h;
-
+
if (IS_8080(cpustate))
{
cpustate->AF.b.l &= 0xd5; // Ignore not used flags
diff --git a/src/emu/sound/nes_apu.c b/src/emu/sound/nes_apu.c
index bfe7ea448bf..2419d70362d 100644
--- a/src/emu/sound/nes_apu.c
+++ b/src/emu/sound/nes_apu.c
@@ -142,10 +142,10 @@ static int8 apu_square(nesapu_state *info, square_t *chan)
int8 output;
/* reg0: 0-3=volume, 4=envelope, 5=hold, 6-7=duty cycle
- ** reg1: 0-2=sweep shifts, 3=sweep inc/dec, 4-6=sweep length, 7=sweep on
- ** reg2: 8 bits of freq
- ** reg3: 0-2=high freq, 7-4=vbl length counter
- */
+ ** reg1: 0-2=sweep shifts, 3=sweep inc/dec, 4-6=sweep length, 7=sweep on
+ ** reg2: 8 bits of freq
+ ** reg3: 0-2=high freq, 7-4=vbl length counter
+ */
if (FALSE == chan->enabled)
return 0;
@@ -215,9 +215,9 @@ static int8 apu_triangle(nesapu_state *info, triangle_t *chan)
int freq;
int8 output;
/* reg0: 7=holdnote, 6-0=linear length counter
- ** reg2: low 8 bits of frequency
- ** reg3: 7-3=length counter, 2-0=high 3 bits of frequency
- */
+ ** reg2: low 8 bits of frequency
+ ** reg3: 7-3=length counter, 2-0=high 3 bits of frequency
+ */
if (FALSE == chan->enabled)
return 0;
@@ -275,9 +275,9 @@ static int8 apu_noise(nesapu_state *info, noise_t *chan)
uint8 output;
/* reg0: 0-3=volume, 4=envelope, 5=hold
- ** reg2: 7=small(93 byte) sample,3-0=freq lookup
- ** reg3: 7-4=vbl length counter
- */
+ ** reg2: 7=small(93 byte) sample,3-0=freq lookup
+ ** reg3: 7-4=vbl length counter
+ */
if (FALSE == chan->enabled)
return 0;
@@ -352,10 +352,10 @@ static int8 apu_dpcm(nesapu_state *info, dpcm_t *chan)
int freq, bit_pos;
/* reg0: 7=irq gen, 6=looping, 3-0=pointer to clock table
- ** reg1: output dc level, 7 bits unsigned
- ** reg2: 8 bits of 64-byte aligned address offset : $C000 + (value * 64)
- ** reg3: length, (value * 16) + 1
- */
+ ** reg1: output dc level, 7 bits unsigned
+ ** reg2: 8 bits of 64-byte aligned address offset : $C000 + (value * 64)
+ ** reg3: length, (value * 16) + 1
+ */
if (chan->enabled)
{
@@ -394,10 +394,10 @@ static int8 apu_dpcm(nesapu_state *info, dpcm_t *chan)
}
if (chan->cur_byte & (1 << bit_pos))
-// chan->regs[1]++;
+// chan->regs[1]++;
chan->vol+=2; /* FIXED * DPCM channel only uses the upper 6 bits of the DAC */
else
-// chan->regs[1]--;
+// chan->regs[1]--;
chan->vol-=2;
}
}
@@ -473,19 +473,19 @@ INLINE void apu_regwrite(nesapu_state *info,int address, uint8 value)
info->APU.tri.regs[3] = value;
/* this is somewhat of a hack. there is some latency on the Real
- ** Thing between when trireg0 is written to and when the linear
- ** length counter actually begins its countdown. we want to prevent
- ** the case where the program writes to the freq regs first, then
- ** to reg 0, and the counter accidentally starts running because of
- ** the sound queue's timestamp processing.
- **
- ** set to a few NES sample -- should be sufficient
- **
- ** 3 * (1789772.727 / 44100) = ~122 cycles, just around one scanline
- **
- ** should be plenty of time for the 6502 code to do a couple of table
- ** dereferences and load up the other triregs
- */
+ ** Thing between when trireg0 is written to and when the linear
+ ** length counter actually begins its countdown. we want to prevent
+ ** the case where the program writes to the freq regs first, then
+ ** to reg 0, and the counter accidentally starts running because of
+ ** the sound queue's timestamp processing.
+ **
+ ** set to a few NES sample -- should be sufficient
+ **
+ ** 3 * (1789772.727 / 44100) = ~122 cycles, just around one scanline
+ **
+ ** should be plenty of time for the 6502 code to do a couple of table
+ ** dereferences and load up the other triregs
+ */
/* used to be 3, but now we run the clock faster, so base it on samples/sync */
info->APU.tri.write_latency = (info->samps_per_sync + 239) / 240;
@@ -548,7 +548,7 @@ INLINE void apu_regwrite(nesapu_state *info,int address, uint8 value)
case APU_IRQCTRL:
if(value & 0x80)
info->APU.step_mode = 5;
- else
+ else
info->APU.step_mode = 4;
break;
diff --git a/src/emu/sound/speaker.c b/src/emu/sound/speaker.c
index 67b3e24b0f8..deb1ebc55e6 100644
--- a/src/emu/sound/speaker.c
+++ b/src/emu/sound/speaker.c
@@ -6,16 +6,16 @@
driven by one or more output bits
Original author: (unsigned)
- Filtering: Anders Hallström
+ Filtering: Anders Hallstr?m
****************************************************************************/
-/* Discussion of oversampling and anti-alias filtering: (Anders Hallström)
+/* Discussion of oversampling and anti-alias filtering: (Anders Hallstr?m)
*
* This driver is for machines that directly control
* one or more simple digital-to-analog converters (DAC)
* connected to one or more audio outputs (such as analog amp + speaker).
* Currently only 1-bit DAC is supported via the interface to this module.
- *
+ *
* Frequently such machines would oversample the DAC
* in order to overcome the limited DAC resolution.
* For faithful reproduction of the sound, this must be carefully handled
@@ -94,9 +94,9 @@ struct _speaker_state
int level;
/* The volume of a composed sample grows incrementally each time the speaker is over-sampled.
- * That is in effect a basic average filter.
- * Another filter can and will be applied to the array of composed samples.
- */
+ * That is in effect a basic average filter.
+ * Another filter can and will be applied to the array of composed samples.
+ */
double composed_volume[FILTER_LENGTH]; /* integrator(s) */
int composed_sample_index; /* array index for composed_volume */
attoseconds_t channel_sample_period; /* in as */
@@ -159,25 +159,25 @@ static DEVICE_START( speaker )
sp->next_interm_sample_time = attotime_add_attoseconds(sp->channel_last_sample_time, sp->interm_sample_period);
sp->interm_sample_index = 0;
/* Note: To avoid time drift due to floating point inaccuracies,
- * it is good if the speaker time synchronizes itself with the stream timing regularly.
- */
+ * it is good if the speaker time synchronizes itself with the stream timing regularly.
+ */
/* Compute filter kernel; */
/* (Done for each device though the data is shared...
- * No problem really, but should be done as part of system init if I knew how)
- */
+ * No problem really, but should be done as part of system init if I knew how)
+ */
#if 1
/* This is an approximated sinc (a perfect sinc makes an ideal low-pass filter).
- * FILTER_STEP determines the cutoff frequency,
- * which should be below the Nyquist freq, i.e. half the sample rate.
- * Smaller step => kernel extends in time domain => lower cutoff freq
- * In this case, with sinc, filter step PI corresponds to the Nyq. freq.
- * Since we do not get a perfect filter => must lower the cutoff freq some more.
- * For example, step PI/(2*RATE_MULTIPLIER) corresponds to cutoff freq = sample rate / 4;
- * With -samplerate 48000, cutoff freq is ca 12kHz while the Nyq. freq is 24kHz.
- * With -samplerate 96000, cutoff freq is ca 24kHz while the Nyq. freq is 48kHz.
- * For a steeper, more efficient filter, increase FILTER_LENGTH at the expense of CPU usage.
- */
+ * FILTER_STEP determines the cutoff frequency,
+ * which should be below the Nyquist freq, i.e. half the sample rate.
+ * Smaller step => kernel extends in time domain => lower cutoff freq
+ * In this case, with sinc, filter step PI corresponds to the Nyq. freq.
+ * Since we do not get a perfect filter => must lower the cutoff freq some more.
+ * For example, step PI/(2*RATE_MULTIPLIER) corresponds to cutoff freq = sample rate / 4;
+ * With -samplerate 48000, cutoff freq is ca 12kHz while the Nyq. freq is 24kHz.
+ * With -samplerate 96000, cutoff freq is ca 24kHz while the Nyq. freq is 48kHz.
+ * For a steeper, more efficient filter, increase FILTER_LENGTH at the expense of CPU usage.
+ */
#define FILTER_STEP (M_PI / 2 / RATE_MULTIPLIER)
/* Distribute symmetrically on x axis; center has x=0 if length is odd */
for (i = 0, x = (0.5 - FILTER_LENGTH / 2.) * FILTER_STEP;
@@ -191,9 +191,9 @@ static DEVICE_START( speaker )
}
#else
/* Trivial average filter with poor frequency cutoff properties;
- * First zero (frequency where amplification=0) = sample rate / filter length
- * Cutoff frequency approx <= first zero / 2
- */
+ * First zero (frequency where amplification=0) = sample rate / filter length
+ * Cutoff frequency approx <= first zero / 2
+ */
for (i = 0, i < FILTER_LENGTH; i++)
ampl[i] = 1;
#endif
@@ -219,9 +219,9 @@ static STREAM_UPDATE( speaker_sound_update )
sampled_time = attotime_mul(sampled_time, samples);
/* Note: since the stream is in the process of being updated,
- * stream_get_time() will return the time before the update! (MAME 0.130)
- * Avoid using it here in order to avoid a subtle dependence on the stream implementation.
- */
+ * stream_get_time() will return the time before the update! (MAME 0.130)
+ * Avoid using it here in order to avoid a subtle dependence on the stream implementation.
+ */
}
if (samples-- > 0)
@@ -277,16 +277,16 @@ void speaker_level_w(const device_config *device, int new_level)
return;
}
/* Reaching here means such time has passed since last stream update
- * that we can add at least one complete sample to the stream.
- * The details have to be handled by speaker_sound_update()
- */
+ * that we can add at least one complete sample to the stream.
+ * The details have to be handled by speaker_sound_update()
+ */
/* Force streams.c to update sound until this point in time now */
stream_update(sp->channel);
/* This is redundant because time update has to be done within speaker_sound_update() anyway,
- * however this ensures synchronization between the speaker and stream timing:
- */
+ * however this ensures synchronization between the speaker and stream timing:
+ */
sp->channel_last_sample_time = stream_get_time(sp->channel);
sp->channel_next_sample_time = attotime_add_attoseconds(sp->channel_last_sample_time, sp->channel_sample_period);
sp->next_interm_sample_time = attotime_add_attoseconds(sp->channel_last_sample_time, sp->interm_sample_period);
@@ -316,9 +316,9 @@ static void update_interm_samples(speaker_state *sp, attotime time, int volume)
init_next_interm_sample(sp);
}
/* Depending on status above:
- * a) Add latest fraction to unfinished composed sample
- * b) The overshooting fraction of time will start a new composed sample
- */
+ * a) Add latest fraction to unfinished composed sample
+ * b) The overshooting fraction of time will start a new composed sample
+ */
fraction = make_fraction(time, sp->last_update_time, sp->interm_sample_period_secfrac);
sp->composed_volume[sp->composed_sample_index] += volume * fraction;
sp->last_update_time = time;
@@ -357,8 +357,8 @@ static void finalize_interm_sample(speaker_state *sp, int volume)
double fraction;
/* Fill the composed sample up if it was incomplete */
- fraction = make_fraction(sp->next_interm_sample_time,
- sp->last_update_time,
+ fraction = make_fraction(sp->next_interm_sample_time,
+ sp->last_update_time,
sp->interm_sample_period_secfrac);
sp->composed_volume[sp->composed_sample_index] += volume * fraction;
/* Update time state */
@@ -395,7 +395,7 @@ static double get_filtered_volume(speaker_state *sp)
double filtered_volume = 0;
double ampsum = 0;
int i, c;
-
+
/* Filter over composed samples (each composed sample is already average filtered) */
for (i = sp->composed_sample_index + 1, c = 0; c < FILTER_LENGTH; i++, c++)
{