Previous 199869 Revisions Next

r18713 Thursday 25th October, 2012 at 22:46:05 UTC by Ryan Holtz
-avr8.c: Added LD Rd,Z+q opcode [MooglyGuy]

-avr8.c: Corrected cycle counts for LD and ST opcodes. [MooglyGuy]

-avr8.c: Fixed a bug where a 2-cycle or 3-cycle opcode encountered during a time
slice were causing all subsequent 1-cycle opcodes to deduct 2 or 3 cycles for
the remainder of the time slice instead. [MooglyGuy]
[src/emu/cpu/avr8]avr8.c
[src/mess/drivers]craft.c

trunk/src/emu/cpu/avr8/avr8.c
r18712r18713
2323
2424#define VERBOSE_LEVEL   (0)
2525
26#define ENABLE_VERBOSE_LOG (1)
26#define ENABLE_VERBOSE_LOG (0)
2727
2828#if ENABLE_VERBOSE_LOG
2929INLINE void verboselog(UINT16 pc, int n_level, const char *s_fmt, ...)
r18712r18713
240240// - Interrupts
241241static void avr8_set_irq_line(avr8_state *cpustate, UINT16 vector, int state);
242242static void avr8_update_interrupt_internal(avr8_state *cpustate, int source);
243static void avr8_poll_interrupt(avr8_state *cpustate);
243//static void avr8_poll_interrupt(avr8_state *cpustate);
244244
245245// - Timers
246246static void avr8_timer_tick(avr8_state *cpustate, int cycles);
r18712r18713
429429   }
430430}
431431
432static void avr8_poll_interrupt(avr8_state *cpustate)
432/*static void avr8_poll_interrupt(avr8_state *cpustate)
433433{
434434   for (int idx = 0; idx < AVR8_INTIDX_COUNT; idx++)
435435   {
436436      avr8_update_interrupt_internal(cpustate, idx);
437437   }
438}
438}*/
439439
440440void avr8_update_interrupt(device_t *device, int source)
441441{
r18712r18713
11321132
11331133    while (cpustate->icount > 0)
11341134    {
1135      opcycles = 1;
1136
11351137        cpustate->pc &= cpustate->addr_mask;
11361138
11371139        debugger_instruction_hook(device, cpustate->pc << 1);
r18712r18713
13531355                switch(op & 0x0208)
13541356                {
13551357                    case 0x0000:    // LDD Rd,Z+q
1356                        //output += sprintf( output, "LD(D)   R%d, Z+%02x", RD5(op), QCONST6(op) );
1357                        unimplemented_opcode(cpustate, op);
1358                        cpustate->r[RD5(op)] = READ_IO_8(cpustate, ZREG + QCONST6(op));
1359                        opcycles = 2;
13581360                        break;
13591361                    case 0x0008:    // LDD Rd,Y+q
13601362                        cpustate->r[RD5(op)] = READ_IO_8(cpustate, YREG + QCONST6(op));
r18712r18713
14331435                                break;
14341436                            case 0x000c:    // LD Rd,X
14351437                               cpustate->r[RD5(op)] = READ_IO_8(cpustate, XREG);
1438                               opcycles = 2;
14361439                                break;
14371440                            case 0x000d:    // LD Rd,X+
14381441                                pd = XREG;
r18712r18713
14851488                                pd++;
14861489                                cpustate->r[29] = (pd >> 8) & 0x00ff;
14871490                                cpustate->r[28] = pd & 0x00ff;
1491                                opcycles = 2;
14881492                                break;
14891493                            case 0x000a:    // ST -Z,Rd
14901494                                //output += sprintf( output, "ST      -Y , R%d", RD5(op) );
r18712r18713
14991503                                pd++;
15001504                                cpustate->r[27] = (pd >> 8) & 0x00ff;
15011505                                cpustate->r[26] = pd & 0x00ff;
1506                                opcycles = 2;
15021507                                break;
15031508                            case 0x000e:    // ST -X,Rd
15041509                                //output += sprintf( output, "ST      -X , R%d", RD5(op) );
r18712r18713
17421747                                        //printf("Pop: %04x\n", cpustate->pc);
17431748                                        cpustate->pc--;
17441749                                        SREG_W(AVR8_SREG_I, 1);
1745                                        if (cpustate->interrupt_pending)
1750                                        /*if (cpustate->interrupt_pending)
17461751                                        {
17471752                                 avr8_poll_interrupt(cpustate);
17481753                                 cpustate->interrupt_pending = false;
1749                              }
1754                              }*/
17501755                                        opcycles = 4;
17511756                                        break;
17521757                                    case 0x0080:    // SLEEP
r18712r18713
18561861                    case 0x0900:    // SBIC A,b
18571862                      if(NOT(BIT(READ_IO_8(cpustate, 32 + ACONST5(op)), (1 << RR3(op)))))
18581863                      {
1859                     opcycles += avr8_is_long_opcode(op) ? 2 : 1;
1864                     opcycles = avr8_is_long_opcode(op) ? 3 : 2;
18601865                            cpustate->pc += avr8_is_long_opcode(op) ? 2 : 1;
18611866                  }
18621867                        break;
r18712r18713
18671872                    case 0x0b00:    // SBIS A,b
18681873                      if(BIT(READ_IO_8(cpustate, 32 + ACONST5(op)), (1 << RR3(op))))
18691874                      {
1870                     opcycles += avr8_is_long_opcode(op) ? 2 : 1;
1875                     opcycles = avr8_is_long_opcode(op) ? 3 : 2;
18711876                            cpustate->pc += avr8_is_long_opcode(op) ? 2 : 1;
18721877                  }
18731878                        break;
trunk/src/mess/drivers/craft.c
r18712r18713
88#include "cpu/avr8/avr8.h"
99#include "sound/dac.h"
1010
11#define VERBOSE_LEVEL   (99)
11#define VERBOSE_LEVEL   (0)
1212
1313#define ENABLE_VERBOSE_LOG (0)
1414

Previous 199869 Revisions Next


© 1997-2024 The MAME Team