Previous 15994 Revisions Next

r8794 Tuesday 17th August, 2010 at 01:01:35 UTC by Angelo Salese
[A310]: Updated to the latest source tree
[src/mame/includes]archimds.h
[src/mame/machine]archimds.c
[src/mess/drivers]a310.c

src/mame/machine/archimds.c
r8793r8794
3030#include "cpu/arm/arm.h"
3131#include "sound/dac.h"
3232#include "includes/archimds.h"
33#include "machine/i2cmem.h"
3334
3435#ifdef MESS
3536#include "machine/wd17xx.h"
r8793r8794
4041UINT32 *archimedes_memc_physmem;
4142static UINT32 memc_pagesize;
4243static int memc_latchrom;
43static INT16 memc_pages[(32*1024*1024)/(4096)];   // the logical RAM area is 32 megs, and the smallest page size is 4k
44static UINT32 vidc_regs[256];
45static UINT8 ioc_regs[0x80/4];
44INT16 memc_pages[(32*1024*1024)/(4096)];   // the logical RAM area is 32 megs, and the smallest page size is 4k
45UINT32 vidc_regs[256];
46UINT8 ioc_regs[0x80/4];
4647static UINT32 ioc_timercnt[4], ioc_timerout[4];
4748static UINT32 vidc_sndstart, vidc_sndend, vidc_sndcur;
49UINT8 i2c_clk;
4850
49static emu_timer *vbl_timer, *timer[4], *snd_timer;
51static emu_timer *timer[4], *snd_timer;
52emu_timer  *vbl_timer;
5053
54#define CONTROL         0
55#define IRQ_STATUS_A    4
56#define IRQ_MASK_A       6
57#define IRQ_STATUS_B   8
58#define IRQ_MASK_B      10
59#define FIQ_STATUS      12
60#define FIQ_MASK      14
61
5162void archimedes_request_irq_a(running_machine *machine, int mask)
5263{
53   ioc_regs[4] |= mask;
64   ioc_regs[IRQ_STATUS_A] |= mask;
5465
55   if (ioc_regs[6] & mask)
66   if (ioc_regs[IRQ_MASK_A] & mask)
5667   {
5768      cputag_set_input_line(machine, "maincpu", ARM_IRQ_LINE, ASSERT_LINE);
5869   }
r8793r8794
6071
6172void archimedes_request_irq_b(running_machine *machine, int mask)
6273{
63   ioc_regs[8] |= mask;
74   ioc_regs[IRQ_STATUS_B] |= mask;
6475
65   if (ioc_regs[10] & mask)
76   if (ioc_regs[IRQ_MASK_B] & mask)
6677   {
6778      generic_pulse_irq_line(machine->device("maincpu"), ARM_IRQ_LINE);
6879   }
r8793r8794
7081
7182void archimedes_request_fiq(running_machine *machine, int mask)
7283{
73   ioc_regs[12] |= mask;
84   ioc_regs[FIQ_STATUS] |= mask;
7485
75   if (ioc_regs[14] & mask)
86   if (ioc_regs[FIQ_MASK] & mask)
7687   {
7788      generic_pulse_irq_line(machine->device("maincpu"), ARM_FIRQ_LINE);
7889   }
r8793r8794
8091
8192void archimedes_clear_irq_a(running_machine *machine, int mask)
8293{
83   ioc_regs[4] &= ~mask;
94   ioc_regs[IRQ_STATUS_A] &= ~mask;
8495}
8596
8697void archimedes_clear_irq_b(running_machine *machine, int mask)
8798{
88   ioc_regs[8] &= ~mask;
99   ioc_regs[IRQ_STATUS_B] &= ~mask;
89100}
90101
91102void archimedes_clear_fiq(running_machine *machine, int mask)
92103{
93   ioc_regs[12] &= ~mask;
104   ioc_regs[FIQ_STATUS] &= ~mask;
94105}
95106
96107static TIMER_CALLBACK( vidc_vblank )
r8793r8794
103114
104115static TIMER_CALLBACK( a310_audio_tick )
105116{
117   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
118
119   dac_signed_data_w(space->machine->device("dac"), 0x80 | (memory_read_byte(space,vidc_sndcur)));
120
106121   vidc_sndcur++;
107122
108123   if (vidc_sndcur >= vidc_sndend)
109124   {
110125      archimedes_request_irq_b(machine, ARCHIMEDES_IRQB_SOUND_EMPTY);
126      timer_adjust_oneshot(snd_timer, attotime_never, 0);
127      dac_signed_data_w(space->machine->device("dac"), 0x80);
111128   }
112129}
113130
r8793r8794
118135   if(ioc_timercnt[tmr] != 0) // FIXME: dmdtouch does a divide by zero?
119136   {
120137      freq = 2000000.0 / (double)ioc_timercnt[tmr];
121   //  logerror("IOC: starting timer %d, %d ticks, freq %f Hz\n", tmr, ioc_timercnt[tmr], freq);
138//     logerror("IOC: starting timer %d, %d ticks, freq %f Hz\n", tmr, ioc_timercnt[tmr], freq);
122139      timer_adjust_oneshot(timer[tmr], ATTOTIME_IN_HZ(freq), tmr);
123140   }
124141}
r8793r8794
154171      memc_pages[i] = -1;      // indicate unmapped
155172   }
156173
157   ioc_regs[4] = 0x10; //set up POR (Power On Reset) at start-up
158   ioc_regs[8] = 0x02; //set up IL[1] On
174   ioc_regs[IRQ_STATUS_A] = 0x10 | 0x80; //set up POR (Power On Reset) and Force IRQ at start-up
175   ioc_regs[IRQ_STATUS_B] = 0x02; //set up IL[1] On
176   ioc_regs[FIQ_STATUS] = 0x80;   //set up Force FIQ
177
178   /* Aristocrat MK-5 tests this inside the CPU check routine *without* firing a latch command in the POST, could be open bus, fixed value or undefined behaviour,
179      almost surely something checked as an anti-cheat measure */
180   ioc_timerout[1] = 0xf5;
159181}
160182
161183void archimedes_init(running_machine *machine)
r8793r8794
205227      }
206228      else
207229      {
208         logerror("ARCHIMEDES_MEMC: Reading unmapped page, what do we do?\n");
230         logerror("ARCHIMEDES_MEMC: Reading unmapped page %02x\n",page);
231         return 0xdeadbeef;
209232      }
210233   }
211234
r8793r8794
235258      }
236259      else
237260      {
238         logerror("ARCHIMEDES_MEMC: Writing unmapped page, what do we do?\n");
261         logerror("ARCHIMEDES_MEMC: Writing unmapped page %02x, what do we do?\n",page);
239262      }
240263   }
241264}
r8793r8794
324347   #endif
325348   if (offset*4 >= 0x200000 && offset*4 < 0x300000)
326349   {
350      logerror("IOC: R %s = %02x (PC=%x) %02x\n", ioc_regnames[offset&0x1f], ioc_regs[offset&0x1f], cpu_get_pc( space->cpu ),offset & 0x1f);
351
327352      switch (offset & 0x1f)
328353      {
354         case CONTROL:
355         {
356            UINT8 i2c_data;
357
358            i2c_data = (i2cmem_sda_read(space->machine->device("i2cmem")) & 1);
359
360            return (ioc_regs[CONTROL] & 0xfc) | (i2c_clk<<1) | i2c_data;
361         }
362
329363         case 1:   // keyboard read
330364            archimedes_request_irq_b(space->machine, ARCHIMEDES_IRQB_KBD_XMIT_EMPTY);
331365            break;
332366
367         case IRQ_STATUS_A:
368            return (ioc_regs[IRQ_STATUS_A] & 0x7f) | 0x80; // Force IRQ is always '1'
369
370         case FIQ_STATUS:
371            return (ioc_regs[FIQ_STATUS] & 0x7f) | 0x80; // Force FIQ is always '1'
372
333373         case 16:   // timer 0 read
334374            return ioc_timerout[0]&0xff;
335375         case 17:
r8793r8794
348388            return (ioc_timerout[3]>>8)&0xff;
349389      }
350390
351      logerror("IOC: R %s = %02x (PC=%x) %02x\n", ioc_regnames[offset&0x1f], ioc_regs[offset&0x1f], cpu_get_pc( space->cpu ),offset & 0x1f);
352391      return ioc_regs[offset&0x1f];
353392   }
354393   #ifdef MESS
r8793r8794
375414
376415   if (offset*4 >= 0x200000 && offset*4 < 0x300000)
377416   {
378//        logerror("IOC: W %02x @ reg %s (PC=%x)\n", data&0xff, ioc_regnames[offset&0x1f], cpu_get_pc( space->cpu ));
417        logerror("IOC: W %02x @ reg %s (PC=%x)\n", data&0xff, ioc_regnames[offset&0x1f], cpu_get_pc( space->cpu ));
379418
380419      switch (offset&0x1f)
381420      {
382421         case 0:   // I2C bus control
383422            //logerror("IOC I2C: CLK %d DAT %d\n", (data>>1)&1, data&1);
423            i2cmem_sda_write(space->machine->device("i2cmem"), data & 0x01);
424            i2cmem_scl_write(space->machine->device("i2cmem"), (data & 0x02) >> 1);
425            i2c_clk = (data & 2) >> 1;
384426            break;
385427
428         case IRQ_MASK_A:
429            ioc_regs[IRQ_MASK_A] = data & 0xff;
430
431            if(data & 0x80) //force an IRQ
432               archimedes_request_irq_a(space->machine,ARCHIMEDES_IRQA_FORCE);
433
434            break;
435
436         case FIQ_MASK:
437            ioc_regs[FIQ_MASK] = data & 0xff;
438
439            if(data & 0x80) //force a FIRQ
440               archimedes_request_fiq(space->machine,ARCHIMEDES_FIQ_FORCE);
441
442            break;
443
386444         case 5:    // IRQ clear A
387            ioc_regs[4] &= ~(data&0xff);
445            ioc_regs[IRQ_STATUS_A] &= ~(data&0xff);
388446
389447            // if that did it, clear the IRQ
390            if (ioc_regs[4] == 0)
448            if (ioc_regs[IRQ_STATUS_A] == 0)
391449            {
392450               cputag_set_input_line(space->machine, "maincpu", ARM_IRQ_LINE, CLEAR_LINE);
393451            }
r8793r8794
526584   };
527585   #endif
528586
587
529588   // 0x00 - 0x3c Video Palette Logical Colors (16 colors)
530589   // 0x40 Border Color
531590   // 0x44 - 0x4c Cursor Palette Logical Colors
r8793r8794
604663            {
605664               double sndhz;
606665
607               sndhz = 250000.0 / (double)((vidc_regs[0xc0]&0xff)+2);
666               /* FIXME: is the frequency correct? */
667               sndhz = (125000.0 / 2) / (double)((vidc_regs[0xc0]&0xff)+2);
608668
609669               logerror("MEMC: Starting audio DMA at %f Hz, buffer from %x to %x\n", sndhz, vidc_sndstart, vidc_sndend);
610670
r8793r8794
614674            }
615675            else
616676            {
617               timer_adjust_oneshot(snd_timer, attotime_never, 0);
618               dac_signed_data_w(space->machine->device("dac"), 0x80);
677               //timer_adjust_oneshot(snd_timer, attotime_never, 0);
678               //dac_signed_data_w(space->machine->device("dac"), 0x80);
619679            }
620680            break;
621681
src/mame/includes/archimds.h
r8793r8794
1313#define ARCHIMEDES_IRQA_PRINTER_BUSY (0x01)
1414#define ARCHIMEDES_IRQA_SERIAL_RING  (0x02)
1515#define ARCHIMEDES_IRQA_PRINTER_ACK  (0x04)
16#define ARCHIMEDES_IRQA_VBL          (0x08)
16#define ARCHIMEDES_IRQA_VBL            (0x08)
1717#define ARCHIMEDES_IRQA_RESET        (0x10)
1818#define ARCHIMEDES_IRQA_TIMER0       (0x20)
1919#define ARCHIMEDES_IRQA_TIMER1       (0x40)
20#define ARCHIMEDES_IRQA_ALWAYS       (0x80)
20#define ARCHIMEDES_IRQA_FORCE        (0x80)
2121
2222#define ARCHIMEDES_IRQB_PODULE_FIQ   (0x01)
2323#define ARCHIMEDES_IRQB_SOUND_EMPTY  (0x02)
src/mess/drivers/a310.c
r8793r8794
3535#include "cpu/arm/arm.h"
3636#include "sound/dac.h"
3737#include "includes/archimds.h"
38#include "machine/i2cmem.h"
3839
3940static VIDEO_START( a310 )
4041{
r8793r8794
210211   {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3}
211212};
212213
214#define   NVRAM_SIZE 1024
215#define   NVRAM_PAGE_SIZE   16   /* max size of one write request */
216
217static const i2cmem_interface i2cmem_interface =
218{
219   I2CMEM_SLAVE_ADDRESS, NVRAM_PAGE_SIZE, NVRAM_SIZE
220};
221
213222static MACHINE_DRIVER_START( a310 )
214223   /* basic machine hardware */
215224   MDRV_CPU_ADD("maincpu", ARM, 8000000)        /* 8 MHz */
216225   MDRV_CPU_PROGRAM_MAP(a310_mem)
217226
227   MDRV_MACHINE_START( a310 )
218228   MDRV_MACHINE_RESET( a310 )
219   MDRV_MACHINE_START( a310 )
220229
230   MDRV_I2CMEM_ADD("i2cmem",i2cmem_interface)
231
221232   /* video hardware */
222233   MDRV_SCREEN_ADD("screen", RASTER)
223234   MDRV_SCREEN_REFRESH_RATE(60)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team