Previous 15994 Revisions Next

r8813 Friday 20th August, 2010 at 11:58:28 UTC by Robbbert
[GAMECOM] Restore the CPU files that were overwritten - again..
Can someone put this into MAME..
[src/emu/cpu/sm8500]sm8500.c sm8500.h sm8500d.c sm85ops.h

src/emu/cpu/sm8500/sm8500d.c
r8812r8813
4141   "iret", "jmp",  "mov",  "movm", "movw",  "mult", "neg",  "nop",  "or",
4242   "orw",  "pop",  "popw", "push", "pushw", "ret",  "rl",   "rlc",
4343   "rr",   "rrc",  "sbc",  "sbcw", "setc", "sll",   "sra",  "srl",  "stop",
44   "sub",  "subw", "swap", "xor",  "xorw", "mov PS0,", "invalid", "dm?",
44   "sub",  "subw", "swap", "xor",  "xorw", "mov PS0,", "invalid", "dm?",
4545/* unknowns */
4646"unk5A", "unk5B",
4747
src/emu/cpu/sm8500/sm8500.h
r8812r8813
3636
3737extern CPU_DISASSEMBLE( sm8500 );
3838
39UINT8 *sm8500_get_internal_ram(legacy_cpu_device *device);
40
4139#endif /* __SM8500_H__ */
src/emu/cpu/sm8500/sm85ops.h
r8812r8813
488488         case 0x0F: /* NC  */ if ( ! (cpustate->PS1 & FLAG_C) ) res = 1; break; \
489489         }
490490
491#define PUSH8(X)   cpustate->SP = cpustate->SP - 1; \
492         if ( ( cpustate->SYS & 0x40 ) == 0 ) { \
493            cpustate->SP = cpustate->SP & 0xFF; \
494         } \
491#define PUSH8(X)   cpustate->SP--; \
492         if ( ( cpustate->SYS & 0x40 ) == 0 ) cpustate->SP &= 0xFF; \
495493         sm85cpu_mem_writebyte( cpustate, cpustate->SP, X );
496494
497495#define POP8(X)      X = sm85cpu_mem_readbyte( cpustate, cpustate->SP ); \
498         cpustate->SP = cpustate->SP + 1; \
499         if ( ( cpustate->SYS & 0x40 ) == 0 ) { \
500            cpustate->SP = cpustate->SP & 0xFF; \
501         }
496         cpustate->SP++; \
497         if ( ( cpustate->SYS & 0x40 ) == 0 ) cpustate->SP &= 0xFF;
502498
503499case 0x00:   /* CLR R - 4 cycles - Flags affected: -------- */
504500   ARG_R;
r8812r8813
910906   break;
911907case 0x2E:   /* MOV PS0,#00 - 4 cycles - Flags affected: -------- */
912908   ARG_R;
913   cpustate->PS0 = r1; cpustate->register_base = cpustate->internal_ram + ( r1 & 0xF8 );
909   cpustate->PS0 = r1;
914910        mycycles += 4;
915911   break;
916912case 0x2F:   /* BTST R,i - 6 cycles - Flags affected: -Z-0---- */
r8812r8813
12801276   break;
12811277case 0x5B:   /* unk5B - 6,7,11,8,7 cycles */
12821278logerror( "%04X: unk%02x\n", cpustate->PC-1,op );
1283   ARG_ad16;
1279/* NOTE: This unknown command is used in several carts, the code below allows those carts to boot */
1280   ARG_iR;
1281   r1 = r2 & 7;
1282   res = sm85cpu_mem_readbyte( cpustate, r1 ) + 1;
1283   sm85cpu_mem_writebyte( cpustate, r1, res );
12841284   mycycles += 6;
12851285   break;
12861286case 0x5C:   /* DIV RRr,RRs - 47 cycles - Flags affected: -Z-V---- */
src/emu/cpu/sm8500/sm8500.c
r8812r8813
77  this cpu, and made educated guesses on the number of cycles for each instruction.
88
99  Code by Wilbert Pol
10
11
12There is some internal ram for the main cpu registers. They are offset by an index value.
13The address is (PS0 & 0xF8) + register number. It is not known what happens when PS0 >= F8.
14The assumption is that F8 to 107 is used, but it might wrap around instead.
15The registers also mirror out to main RAM, appearing at 0000 to 000F regardless of where
16they are internally.
17
1018*/
1119
1220#include "emu.h"
r8812r8813
2735{
2836   SM8500_CONFIG config;
2937   UINT16 PC;
30   UINT8 *register_base;
3138   UINT8 IE0;
3239   UINT8 IE1;
3340   UINT8 IR0;
3441   UINT8 IR1;
35   UINT8 P0;
36   UINT8 P1;
37   UINT8 P2;
38   UINT8 P3;
3942   UINT8 SYS;
4043   UINT8 CKC;
4144   UINT8 clock_changed;
4245   UINT16 SP;
4346   UINT8 PS0;
4447   UINT8 PS1;
45   UINT8 P0C;
46   UINT8 P1C;
47   UINT8 P2C;
48   UINT8 P3C;
49   UINT8 IFLAGS;
48   UINT16 IFLAGS;
5049   UINT8 CheckInterrupts;
5150   int halted;
5251   int icount;
5352   device_irq_callback irq_callback;
5453   legacy_cpu_device *device;
5554   address_space *program;
56   UINT8 internal_ram[0x500];
55   UINT16 oldpc;
56   UINT8 register_ram[0x108];
5757};
5858
5959INLINE sm8500_state *get_safe_token(running_device *device)
r8812r8813
6767        0, 8, 2, 10, 4, 12, 6, 14
6868};
6969
70static UINT8 sm85cpu_mem_readbyte( sm8500_state *cpustate, UINT32 offset ) {
71   return ( offset < 0x10 ) ? cpustate->register_base[offset] : cpustate->program->read_byte( offset );
70INLINE void sm8500_get_sp( sm8500_state *cpustate )
71{
72   UINT16 data = cpustate->program->read_byte(0x1c) << 8;
73   cpustate->SP = cpustate->program->read_byte(0x1d);
74   if (cpustate->SYS&0x40) cpustate->SP |= data;
7275}
7376
74static void sm85cpu_mem_writebyte( sm8500_state *cpustate, UINT32 offset, UINT8 data ) {
75   if ( offset < 0x10 ) {
76      cpustate->register_base[offset] = data;
77   } else {
78      cpustate->program->write_byte( offset, data );
77static UINT8 sm85cpu_mem_readbyte( sm8500_state *cpustate, UINT32 offset )
78{
79   offset &= 0xffff;
80   return (offset < 0x10) ? cpustate->register_ram[offset + (cpustate->PS0 & 0xF8)]
81      : cpustate->program->read_byte( offset );
82}
83
84static void sm85cpu_mem_writebyte( sm8500_state *cpustate, UINT32 offset, UINT8 data )
85{
86   UINT8 i;
87   offset &= 0xffff;
88   if (offset < 0x10)
89      cpustate->register_ram[offset + (cpustate->PS0 & 0xF8)] = data;
90
91   cpustate->program->write_byte ( offset, data );
92
93   switch (offset)
94   {
95      case 0x10: cpustate->IE0 = data; break;
96      case 0x11: cpustate->IE1 = data; break;
97      case 0x12: cpustate->IR0 = data; break;
98      case 0x13: cpustate->IR1 = data; break;
99      case 0x19: cpustate->SYS = data; break;
100      case 0x1a: cpustate->CKC = data; break;
101      case 0x1c:
102      case 0x1d: sm8500_get_sp(cpustate); break;
103      case 0x1e: cpustate->PS0 = data;
104            for (i = 0; i < 16; i++)   // refresh register contents in debugger
105               cpustate->program->write_byte(i, sm85cpu_mem_readbyte(cpustate, i)); break;
106      case 0x1f: cpustate->PS1 = data; break;
79107   }
80108}
81109
110
82111INLINE UINT16 sm85cpu_mem_readword( sm8500_state *cpustate, UINT32 address )
83112{
84   UINT16 value = (UINT16) sm85cpu_mem_readbyte( cpustate, address ) << 8;
85   value |= sm85cpu_mem_readbyte( cpustate, ( address + 1 ) & 0xffff );
86   return value;
113   return (sm85cpu_mem_readbyte( cpustate, address ) << 8) | (sm85cpu_mem_readbyte( cpustate, address+1 ));
87114}
88115
89116INLINE void sm85cpu_mem_writeword( sm8500_state *cpustate, UINT32 address, UINT16 value )
90117{
91118   sm85cpu_mem_writebyte( cpustate, address, value >> 8 );
92   sm85cpu_mem_writebyte( cpustate, ( address + 1 ) & 0xffff, value & 0xff );
119   sm85cpu_mem_writebyte( cpustate, address+1, value );
93120}
94121
95122static CPU_INIT( sm8500 )
r8812r8813
106133      cpustate->config.handle_dma = NULL;
107134      cpustate->config.handle_timers = NULL;
108135   }
109   cpustate->register_base = cpustate->internal_ram;
110136}
111137
112138static CPU_RESET( sm8500 )
r8812r8813
114140   sm8500_state *cpustate = get_safe_token(device);
115141
116142   cpustate->PC = 0x1020;
117   cpustate->IE0 = 0;
118   cpustate->IE1 = 0;
119   cpustate->IR0 = 0;
120   cpustate->IR1 = 0;
121   cpustate->P0 = 0xFF;
122   cpustate->P1 = 0xFF;
123   cpustate->P2 = 0xFF;
124   cpustate->P3 = 0;
125   cpustate->SYS = 0;
126   cpustate->CKC = 0; cpustate->clock_changed = 0;
127   cpustate->PS1 = 0;
128   cpustate->register_base = cpustate->internal_ram;
143   cpustate->clock_changed = 0;
129144   cpustate->halted = 0;
145   sm85cpu_mem_writeword(cpustate, 0x10, 0);                 // IE0, IE1
146   sm85cpu_mem_writeword(cpustate, 0x12, 0);                 // IR0, IR1
147   sm85cpu_mem_writeword(cpustate, 0x14, 0xffff);            // P0, P1
148   sm85cpu_mem_writeword(cpustate, 0x16, 0xff00);            // P2, P3
149   sm85cpu_mem_writebyte(cpustate, 0x19, 0);                 // SYS
150   sm85cpu_mem_writebyte(cpustate, 0x1a, 0);                 // CKC
151   sm85cpu_mem_writebyte(cpustate, 0x1f, 0);                 // PS1
152   sm85cpu_mem_writebyte(cpustate, 0x2b, 0xff);              // URTT
153   sm85cpu_mem_writebyte(cpustate, 0x2d, 0x42);              // URTS
154   sm85cpu_mem_writebyte(cpustate, 0x5f, 0x38);              // WDTC
130155}
131156
132157static CPU_EXIT( sm8500 )
133158{
134159}
135160
136#define PUSH_BYTE(X)   cpustate->SP = cpustate->SP - 1; \
137         if ( ( cpustate->SYS & 0x40 ) == 0 ) { \
138            cpustate->SP = cpustate->SP & 0xFF; \
139         } \
161#define PUSH_BYTE(X)   cpustate->SP--; \
162         if ( ( cpustate->SYS & 0x40 ) == 0 ) cpustate->SP &= 0xFF; \
140163         sm85cpu_mem_writebyte( cpustate, cpustate->SP, X );
141164
142165INLINE void sm8500_do_interrupt(sm8500_state *cpustate, UINT16 vector) {
166   /* Get regs from ram */
167   sm8500_get_sp(cpustate);
168   cpustate->SYS = cpustate->program->read_byte(0x19);   
169   cpustate->PS1 = cpustate->program->read_byte(0x1f);   
143170   /* Push PC */
144171   PUSH_BYTE( cpustate->PC & 0xFF );
145172   PUSH_BYTE( cpustate->PC >> 8 );
r8812r8813
147174   PUSH_BYTE( cpustate->PS1 );
148175   /* Clear I flag */
149176   cpustate->PS1 &= ~ 0x01;
177   /* save regs to ram */
178   cpustate->program->write_byte (0x1f, cpustate->PS1);
179   cpustate->program->write_byte (0x1d, cpustate->SP&0xFF);
180   if (cpustate->SYS&0x40) cpustate->program->write_byte(0x1c, cpustate->SP>>8);
150181   /* Change PC to address stored at "vector" */
151182   cpustate->PC = sm85cpu_mem_readword( cpustate, vector );
152183}
r8812r8813
157188      while( irqline < 11 ) {
158189         if ( cpustate->IFLAGS & ( 1 << irqline ) ) {
159190            cpustate->halted = 0;
191            cpustate->IE0 = cpustate->program->read_byte(0x10);
192            cpustate->IE1 = cpustate->program->read_byte(0x11);
193            cpustate->IR0 = cpustate->program->read_byte(0x12);
194            cpustate->IR1 = cpustate->program->read_byte(0x13);
195            cpustate->PS0 = cpustate->program->read_byte(0x1e);
196            cpustate->PS1 = cpustate->program->read_byte(0x1f);
160197            switch( irqline ) {
161            case ILL_INT:
198            case WDT_INT:
162199               sm8500_do_interrupt( cpustate, 0x101C );
163200               break;
164            case WDT_INT:
165               sm8500_do_interrupt( cpustate, 0x101E );
166               break;
201            case ILL_INT:
167202            case NMI_INT:
168203               sm8500_do_interrupt( cpustate, 0x101E );
169204               break;
r8812r8813
217252               break;
218253            }
219254            cpustate->IFLAGS &= ~ ( 1 << irqline );
255            cpustate->program->write_byte(0x12, cpustate->IR0);
256            cpustate->program->write_byte(0x13, cpustate->IR1);
220257         }
221258         irqline++;
222259      }
r8812r8813
227264{
228265   sm8500_state *cpustate = get_safe_token(device);
229266   UINT8   op;
230   UINT16 oldpc;
231267   int   mycycles;
232268
233269   do
r8812r8813
238274      UINT32   res;
239275
240276      debugger_instruction_hook(device, cpustate->PC);
241      oldpc = cpustate->PC;
277      cpustate->oldpc = cpustate->PC;
242278      mycycles = 0;
243279      sm8500_process_interrupts(cpustate);
244280      if ( !cpustate->halted ) {
245281         op = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ );
282         cpustate->SYS = cpustate->program->read_byte(0x19);
283         cpustate->PS0 = cpustate->program->read_byte(0x1e);
284         cpustate->PS1 = cpustate->program->read_byte(0x1f);
285         sm8500_get_sp(cpustate);
246286         switch( op )
247287         {
248288#include "sm85ops.h"
249289         }
290         if (cpustate->SYS&0x40) cpustate->program->write_byte(0x1c,cpustate->SP>>8);
291         cpustate->program->write_byte(0x1d,cpustate->SP&0xFF);
292         sm85cpu_mem_writebyte(cpustate,0x1e,cpustate->PS0);   // need to update debugger
293         cpustate->program->write_byte(0x1f,cpustate->PS1);
250294      } else {
251295         mycycles = 4;
252296         if ( cpustate->config.handle_dma ) {
r8812r8813
278322   case STATE_GENPC:
279323   case SM8500_PC:      return cpustate->PC;
280324   case STATE_GENSP:
281   case SM8500_SP:      return ( cpustate->SYS & 0x40 ) ? cpustate->SP : cpustate->SP & 0xFF ;
282   case SM8500_PS:      return ( cpustate->PS0 << 8 ) | cpustate->PS1;
325   case SM8500_SP:      return cpustate->SP;
326   case SM8500_PS:      return sm85cpu_mem_readword( cpustate, 0x1e );
283327   case SM8500_SYS16:   return cpustate->SYS;
284328   case SM8500_RR0:   return sm85cpu_mem_readword( cpustate, 0x00 );
285329   case SM8500_RR2:   return sm85cpu_mem_readword( cpustate, 0x02 );
r8812r8813
289333   case SM8500_RR10:   return sm85cpu_mem_readword( cpustate, 0x0A );
290334   case SM8500_RR12:   return sm85cpu_mem_readword( cpustate, 0x0C );
291335   case SM8500_RR14:   return sm85cpu_mem_readword( cpustate, 0x0E );
292   case SM8500_IE0:   return cpustate->IE0;
293   case SM8500_IE1:   return cpustate->IE1;
294   case SM8500_IR0:   return cpustate->IR0;
295   case SM8500_IR1:   return cpustate->IR1;
296   case SM8500_P0:      return cpustate->P0;
297   case SM8500_P1:      return cpustate->P1;
298   case SM8500_P2:      return cpustate->P2;
299   case SM8500_P3:      return cpustate->P3;
300   case SM8500_SYS:   return cpustate->SYS;
301   case SM8500_CKC:   return cpustate->CKC;
302   case SM8500_SPH:   return (cpustate->SP >> 8);
303   case SM8500_SPL:   return cpustate->SP & 0xFF;
304   case SM8500_PS0:   return cpustate->PS0;
305   case SM8500_PS1:   return cpustate->PS1;
306   case SM8500_P0C:   return cpustate->P0C;
307   case SM8500_P1C:   return cpustate->P1C;
308   case SM8500_P2C:   return cpustate->P2C;
309   case SM8500_P3C:   return cpustate->P3C;
336   case SM8500_IE0:   return sm85cpu_mem_readbyte( cpustate, 0x10 );
337   case SM8500_IE1:   return sm85cpu_mem_readbyte( cpustate, 0x11 );
338   case SM8500_IR0:   return sm85cpu_mem_readbyte( cpustate, 0x12 );
339   case SM8500_IR1:   return sm85cpu_mem_readbyte( cpustate, 0x13 );
340   case SM8500_P0:      return sm85cpu_mem_readbyte( cpustate, 0x14 );
341   case SM8500_P1:      return sm85cpu_mem_readbyte( cpustate, 0x15 );
342   case SM8500_P2:      return sm85cpu_mem_readbyte( cpustate, 0x16 );
343   case SM8500_P3:      return sm85cpu_mem_readbyte( cpustate, 0x17 );
344   case SM8500_SYS:   return sm85cpu_mem_readbyte( cpustate, 0x19 );
345   case SM8500_CKC:   return sm85cpu_mem_readbyte( cpustate, 0x1a );
346   case SM8500_SPH:   return sm85cpu_mem_readbyte( cpustate, 0x1c );
347   case SM8500_SPL:   return sm85cpu_mem_readbyte( cpustate, 0x1d );
348   case SM8500_PS0:   return sm85cpu_mem_readbyte( cpustate, 0x1e );
349   case SM8500_PS1:   return sm85cpu_mem_readbyte( cpustate, 0x1f );
350   case SM8500_P0C:   return sm85cpu_mem_readbyte( cpustate, 0x20 );
351   case SM8500_P1C:   return sm85cpu_mem_readbyte( cpustate, 0x21 );
352   case SM8500_P2C:   return sm85cpu_mem_readbyte( cpustate, 0x22 );
353   case SM8500_P3C:   return sm85cpu_mem_readbyte( cpustate, 0x23 );
310354   }
311355   return 0;
312356}
r8812r8813
318362   case STATE_GENPC:
319363   case SM8500_PC:      cpustate->PC = val; break;
320364   case STATE_GENSP:
321   case SM8500_SP:      cpustate->SP = val; break;
322   case SM8500_PS:      sm8500_set_reg( cpustate, SM8500_PS0, ( val >> 8 ) & 0xFF ); sm8500_set_reg( cpustate, SM8500_PS1, val & 0xFF ); break;
323   case SM8500_SYS16:   cpustate->SYS = val; break;
365   case SM8500_SP:      cpustate->SP = val; cpustate->program->write_byte(0x1d, val&0xff); if (cpustate->SYS&0x40) cpustate->program->write_byte(0x1c, val>>8); break;
366   case SM8500_PS:      sm85cpu_mem_writeword( cpustate, 0x1e, val); break;
367   case SM8500_SYS16:   val&=0xff; sm85cpu_mem_writebyte( cpustate, 0x19, val); break;
324368   case SM8500_RR0:   sm85cpu_mem_writeword( cpustate, 0x00, val); break;
325369   case SM8500_RR2:   sm85cpu_mem_writeword( cpustate, 0x02, val); break;
326370   case SM8500_RR4:   sm85cpu_mem_writeword( cpustate, 0x04, val); break;
r8812r8813
329373   case SM8500_RR10:   sm85cpu_mem_writeword( cpustate, 0x0A, val); break;
330374   case SM8500_RR12:   sm85cpu_mem_writeword( cpustate, 0x0C, val); break;
331375   case SM8500_RR14:   sm85cpu_mem_writeword( cpustate, 0x0E, val); break;
332   case SM8500_IE0:   cpustate->IE0 = val; break;
333   case SM8500_IE1:   cpustate->IE1 = val; break;
334   case SM8500_IR0:   cpustate->IR0 = val; break;
335   case SM8500_IR1:   cpustate->IR1 = val; break;
336   case SM8500_P0:      cpustate->P0 = val; break;
337   case SM8500_P1:      cpustate->P1 = val; break;
338   case SM8500_P2:      cpustate->P2 = val; break;
339   case SM8500_P3:      cpustate->P3 = val; break;
340   case SM8500_SYS:   cpustate->SYS = val; break;
341   case SM8500_CKC:   cpustate->CKC = val; if ( val & 0x80 ) { cpustate->clock_changed = 1; }; break;
342   case SM8500_SPH:   cpustate->SP = ( ( val & 0xFF ) << 8 ) | ( cpustate->SP & 0xFF ); break;
343   case SM8500_SPL:   cpustate->SP = ( cpustate->SP & 0xFF00 ) | ( val & 0xFF ); break;
344   case SM8500_PS0:   cpustate->PS0 = val; cpustate->register_base = cpustate->internal_ram + ( val & 0xF8 ); break;
345   case SM8500_PS1:   cpustate->PS1 = val; break;
346   case SM8500_P0C:   cpustate->P0C = val; break;
347   case SM8500_P1C:   cpustate->P1C = val; break;
348   case SM8500_P2C:   cpustate->P2C = val; break;
349   case SM8500_P3C:   cpustate->P3C = val; break;
376   case SM8500_IE0:   sm85cpu_mem_writebyte( cpustate, 0x10, val); break;
377   case SM8500_IE1:   sm85cpu_mem_writebyte( cpustate, 0x11, val); break;
378   case SM8500_IR0:   sm85cpu_mem_writebyte( cpustate, 0x12, val); break;
379   case SM8500_IR1:   sm85cpu_mem_writebyte( cpustate, 0x13, val); break;
380   case SM8500_P0:      sm85cpu_mem_writebyte( cpustate, 0x14, val); break;
381   case SM8500_P1:      sm85cpu_mem_writebyte( cpustate, 0x15, val); break;
382   case SM8500_P2:      sm85cpu_mem_writebyte( cpustate, 0x16, val); break;
383   case SM8500_P3:      sm85cpu_mem_writebyte( cpustate, 0x17, val); break;
384   case SM8500_SYS:   sm85cpu_mem_writebyte( cpustate, 0x19, val); break;
385   case SM8500_CKC:   sm85cpu_mem_writebyte( cpustate, 0x1a, val); if ( val & 0x80 ) { cpustate->clock_changed = 1; }; break;
386   case SM8500_SPH:   sm85cpu_mem_writebyte( cpustate, 0x1c, val); break;
387   case SM8500_SPL:   sm85cpu_mem_writebyte( cpustate, 0x1d, val); break;
388   case SM8500_PS0:   sm85cpu_mem_writebyte( cpustate, 0x1e, val); break;
389   case SM8500_PS1:   sm85cpu_mem_writebyte( cpustate, 0x1f, val); break;
390   case SM8500_P0C:   sm85cpu_mem_writebyte( cpustate, 0x20, val); break;
391   case SM8500_P1C:   sm85cpu_mem_writebyte( cpustate, 0x21, val); break;
392   case SM8500_P2C:   sm85cpu_mem_writebyte( cpustate, 0x22, val); break;
393   case SM8500_P3C:   sm85cpu_mem_writebyte( cpustate, 0x23, val); break;
350394   }
351395}
352396
353397static void sm8500_set_irq_line( sm8500_state *cpustate, int irqline, int state )
354398{
399   cpustate->IR0 = cpustate->program->read_byte(0x12);
400   cpustate->IR1 = cpustate->program->read_byte(0x13);
355401   if ( state == ASSERT_LINE ) {
356402      cpustate->IFLAGS |= ( 0x01 << irqline );
357403      cpustate->CheckInterrupts = 1;
r8812r8813
381427         cpustate->CheckInterrupts = 0;
382428      }
383429   }
430   cpustate->program->write_byte(0x12, cpustate->IR0);
431   cpustate->program->write_byte(0x13, cpustate->IR1);
384432}
385433
386UINT8 *sm8500_get_internal_ram(legacy_cpu_device *device)
387{
388   sm8500_state *cpustate = get_safe_token(device);
389   return cpustate->internal_ram;
390}
391
392434static CPU_SET_INFO( sm8500 )
393435{
394436   sm8500_state *cpustate = get_safe_token(device);
r8812r8813
438480   case CPUINFO_INT_REGISTER + SM8500_P1C:
439481   case CPUINFO_INT_REGISTER + SM8500_P2C:
440482   case CPUINFO_INT_REGISTER + SM8500_P3C:
441                     sm8500_set_reg( cpustate, state - CPUINFO_INT_REGISTER, info->i ); break;
483      sm8500_set_reg( cpustate, state - CPUINFO_INT_REGISTER, info->i ); break;
442484
443485   }
444486}
r8812r8813
475517   case CPUINFO_INT_INPUT_STATE + 4:
476518   case CPUINFO_INT_INPUT_STATE + 5:
477519   case CPUINFO_INT_INPUT_STATE + 6:
478   case CPUINFO_INT_INPUT_STATE + 7:         info->i = cpustate->IFLAGS & ( 1 << (state - CPUINFO_INT_INPUT_STATE)); break;
520   case CPUINFO_INT_INPUT_STATE + 7:
521   case CPUINFO_INT_INPUT_STATE + 8:
522   case CPUINFO_INT_INPUT_STATE + 9:
523   case CPUINFO_INT_INPUT_STATE + 10:         info->i = cpustate->IFLAGS & ( 1 << (state - CPUINFO_INT_INPUT_STATE)); break;
479524   case CPUINFO_INT_REGISTER + SM8500_RR0:
480525   case CPUINFO_INT_REGISTER + SM8500_RR2:
481526   case CPUINFO_INT_REGISTER + SM8500_RR4:
r8812r8813
509554                        info->i = sm8500_get_reg( cpustate, state - CPUINFO_INT_REGISTER ); break;
510555   case CPUINFO_INT_REGISTER + STATE_GENPC:         info->i = sm8500_get_reg( cpustate, SM8500_PC ); break;
511556   case CPUINFO_INT_REGISTER + STATE_GENSP:         info->i = sm8500_get_reg( cpustate, SM8500_SP ); break;
512   case CPUINFO_INT_PREVIOUSPC:            info->i = 0x0000; break;
557   case CPUINFO_INT_PREVIOUSPC:            info->i = cpustate->oldpc; break;
513558
514559
515560   case CPUINFO_FCT_SET_INFO:            info->setinfo = CPU_SET_INFO_NAME(sm8500); break;
r8812r8813
548593   case CPUINFO_STR_REGISTER + SM8500_PC:         sprintf(info->s, "PC:%04X", cpustate->PC); break;
549594   case CPUINFO_STR_REGISTER + SM8500_SP:         sprintf(info->s, "SP:%04X", cpustate->SP); break;
550595   case CPUINFO_STR_REGISTER + SM8500_PS:         sprintf(info->s, "PS:%04X", ( cpustate->PS0 << 8 ) | cpustate->PS1 ); break;
551   case CPUINFO_STR_REGISTER + SM8500_SYS16:      sprintf(info->s, "SYS:%04X", cpustate->SYS ); break;
596   case CPUINFO_STR_REGISTER + SM8500_SYS16:      sprintf(info->s, "SYS:%02X", cpustate->SYS ); break;
552597   }
553598}
554599

Previous 15994 Revisions Next


© 1998-2018 The MESS Team