Previous 15994 Revisions Next

r9245 Tuesday 28th September, 2010 at 02:20:43 UTC by Curt Coder
[VIDBRAIN] Fixed interrupts and video, implemented SMI. Now shows graphics for all games but does not work yet.
[src/emu/cpu/f8]f8.c f8.h
[src/emu/machine]f3853.h
[src/mess]mess.mak
[src/mess/drivers]mk1.c vidbrain.c
[src/mess/includes]vidbrain.h

src/emu/cpu/f8/f8.h
r9244r9245
4343        F8_R56, F8_R57, F8_R58, F8_R59, F8_R60, F8_R61, F8_R62, F8_R63
4444};
4545
46#define F8_INT_NONE  0
47#define F8_INT_INTR  1
46#define F8_INPUT_LINE_INT_REQ   1
4847
4948DECLARE_LEGACY_CPU_DEVICE(F8, f8);
5049
src/emu/cpu/f8/f8.c
r9244r9245
18781878       break;
18791879   default:
18801880       if (cpustate->w&I && cpustate->irq_request) {
1881      ROMC_1C(cpustate, cL);
1882      ROMC_0F(cpustate);
1883      ROMC_13(cpustate);
1881         ROMC_1C(cpustate, cL);
1882         ROMC_0F(cpustate);
1883         ROMC_13(cpustate);
18841884       }
18851885       if((op>=0x30)&&(op<=0x3f))   /* SKR - DS is a long cycle inst */
18861886          ROMC_00(cpustate, cL);
r9244r9245
19301930       cpustate->pc0 += 1;
19311931      break;
19321932   case CPUINFO_INT_PREVIOUSPC:   break;   /* TODO? */
1933   case CPUINFO_INT_INPUT_STATE:      cpustate->irq_request = info->i;            break;
1933   case CPUINFO_INT_INPUT_STATE + F8_INPUT_LINE_INT_REQ:      cpustate->irq_request = info->i;            break;
19341934   case CPUINFO_INT_REGISTER + F8_PC0:
19351935      cpustate->pc0 = info->i;
19361936      cpustate->dbus = cpustate->direct->read_decrypted_byte(cpustate->pc0);
r9244r9245
20482048   case CPUINFO_INT_PC:            info->i = (cpustate->pc0 - 1) & 0xffff;   break;
20492049   case CPUINFO_INT_PREVIOUSPC:      info->i = 0;   /* TODO??? */      break;
20502050
2051   case CPUINFO_INT_INPUT_STATE:         info->i = cpustate->irq_request;         break;
2051   case CPUINFO_INT_INPUT_STATE + F8_INPUT_LINE_INT_REQ:         info->i = cpustate->irq_request;         break;
20522052
20532053   case CPUINFO_INT_REGISTER + F8_PC0:   info->i = (cpustate->pc0 - 1) & 0xffff;   break;
20542054   case CPUINFO_INT_REGISTER + F8_PC1: info->i = cpustate->pc1;               break;
src/emu/machine/f3853.h
r9244r9245
1/**********************************************************************
1/***************************************************************************
22
33    Fairchild F3853 SRAM interface with integrated interrupt
44    controller and timer
r9244r9245
66    This chip is a timer shift register, basically the same as in the
77    F3851.
88
9**********************************************************************/
9****************************************************************************
10                            _____   _____
11                   Vgg   1 |*    \_/     | 40  Vdd
12                   PHI   2 |             | 39  ROMC4
13                 WRITE   3 |             | 38  ROMC3
14              _INT REQ   4 |             | 37  ROMC2
15               _PRI IN   5 |             | 36  ROMC1
16            _RAM WRITE   6 |             | 35  ROMC0
17              _EXT INT   7 |             | 34  CPU READ
18                 ADDR7   8 |             | 33  REG DR
19                 ADDR6   9 |             | 32  ADDR15
20                 ADDR5  10 |    F3853    | 31  ADDR14
21                 ADDR4  11 |             | 30  ADDR13
22                 ADDR3  12 |             | 29  ADDR12
23                 ADDR2  13 |             | 28  ADDR11
24                 ADDR1  14 |             | 27  ADDR10
25                 ADDR0  15 |             | 26  ADDR9
26                   DB0  16 |             | 25  ADDR8
27                   DB1  17 |             | 24  DB7
28                   DB2  18 |             | 23  DB6
29                   DB3  19 |             | 22  DB5
30                   Vss  20 |_____________| 21  DB4
1031
32***************************************************************************/
33
1134#pragma once
1235
1336#ifndef __F3853_H__
src/mess/includes/vidbrain.h
r9244r9245
77#define F3853_TAG      "cd5"
88#define SCREEN_TAG      "screen"
99#define DISCRETE_TAG   "discrete"
10#define TIMER_Y_INT_TAG   "y_int"
11#define TIMER_FIELD_TAG   "field"
1012#define CASSETTE_TAG   "cassette"
1113
1214class vidbrain_state : public driver_device
r9244r9245
1517   vidbrain_state(running_machine &machine, const driver_device_config_base &config)
1618      : driver_device(machine, config) { }
1719
20   /* F3853 SMI state */
21   UINT16 vector;
22   int int_enable;
23   int ext_int_latch;
24   int timer_int_latch;
25
1826   /* keyboard state */
1927   UINT8 keylatch;
2028   int joy_enable;
21   int uv201_31;
2229
2330   /* video state */
24   UINT8 *video_ram;
25   UINT8 bg_color;
26   UINT8 vlsi[0x100];
31   UINT8 vlsi_ram[0x90];
32   UINT8 y_int;
33   UINT8 fmod;
34   UINT8 bg;
35   UINT8 cmd;
36   UINT8 freeze_x;
37   UINT16 freeze_y;
38   int field;
2739
2840   /* sound state */
2941   int sound_clk;
r9244r9245
3143
3244   /* devices */
3345   running_device *discrete;
46   screen_device *screen;
47   timer_device *timer_y_int;
3448};
3549
50/*----------- defined in driver/vidbrain.c -----------*/
51
52void vidbrain_interrupt_check(running_machine *machine);
53
54/*----------- defined in video/vidbrain.c -----------*/
55
56READ8_HANDLER( vidbrain_vlsi_r );
57WRITE8_HANDLER( vidbrain_vlsi_w );
58
59MACHINE_CONFIG_EXTERN(vidbrain_video);
60
3661#endif
src/mess/mess.mak
r9244r9245
398398   $(MESSOBJ)/trs.a \
399399   $(MESSOBJ)/unisys.a \
400400   $(MESSOBJ)/veb.a \
401   $(MESSOBJ)/vidbrain.a \
401402   $(MESSOBJ)/visual.a \
402403   $(MESSOBJ)/votrax.a \
403404   $(MESSOBJ)/vtech.a \
r9244r9245
16101611   $(MESS_DRIVERS)/sc1.o      \
16111612   $(MESS_DRIVERS)/sc2.o      \
16121613
1614$(MESSOBJ)/vidbrain.a:         \
1615   $(MESS_DRIVERS)/vidbrain.o   \
1616   $(MESS_VIDEO)/vidbrain.o   \
1617
16131618$(MESSOBJ)/visual.a:         \
16141619   $(MESS_DRIVERS)/v1050.o      \
16151620   $(MESS_VIDEO)/v1050.o      \
r9244r9245
17051710   $(MESS_DRIVERS)/unior.o      \
17061711   $(MESS_DRIVERS)/unistar.o   \
17071712   $(MESS_DRIVERS)/vector4.o   \
1708   $(MESS_DRIVERS)/vidbrain.o   \
17091713   $(MESS_DRIVERS)/vii.o      \
17101714   $(MESS_DRIVERS)/xor100.o   \
17111715   $(MESS_DRIVERS)/z80dev.o   \
src/mess/drivers/mk1.c
r9244r9245
165165static void mk1_interrupt( running_device *device, UINT16 addr, int level )
166166{
167167   cpu_set_input_line_vector(device->machine->device("maincpu"), 0, addr );
168   cputag_set_input_line(device->machine,"maincpu", 0, level ? F8_INT_INTR : F8_INT_NONE );
168
169   cputag_set_input_line(device->machine,"maincpu", F8_INPUT_LINE_INT_REQ, level ? ASSERT_LINE : CLEAR_LINE );
169170}
170171
171172
src/mess/drivers/vidbrain.c
r9244r9245
55    http://www.atariprotos.com/othersystems/videobrain/videobrain.htm
66    http://www.seanriddle.com/vbinfo.html
77    http://www.seanriddle.com/videobrain.html
8   http://www.google.com/patents?q=4232374
89
910    07/04/2009 Skeleton driver.
1011
r9244r9245
1415
1516    TODO:
1617
17    - SMI 3853
18    - colors
19    - low resolution mode
18   - use machine/f3853.h
2019    - discrete sound
2120    - joystick scan timer 555
2221    - reset on cartridge eject
r9244r9245
3837***************************************************************************/
3938
4039/*-------------------------------------------------
41    vlsi_r - video VLSI read
42-------------------------------------------------*/
43
44static READ8_HANDLER( vlsi_r )
45{
46   switch (offset)
47   {
48   case 0xfa:
49      return 0xff;
50
51   case 0xfb:
52      // alternate this between 0xf5 and 0x34 to make Checkers boot
53      return 0xff;
54   }
55
56   return 0;
57}
58
59/*-------------------------------------------------
60    vlsi_w - video VLSI write
61-------------------------------------------------*/
62
63static WRITE8_HANDLER( vlsi_w )
64{
65   vidbrain_state *state = space->machine->driver_data<vidbrain_state>();
66
67   switch (offset)
68   {
69   case 0xf5:
70      state->bg_color = data;
71      break;
72
73   case 0xf7:
74      /*
75
76            bit     description
77
78            0
79            1
80            2
81            3
82            4       keyboard column 8
83            5
84            6
85            7
86
87        */
88
89      state->uv201_31 = BIT(data, 4);
90      break;
91   }
92
93   state->vlsi[offset] = data;
94
95   logerror("VLSI %02x = %02x\n", offset, data);
96}
97
98/*-------------------------------------------------
9940    keyboard_w - keyboard column write
10041-------------------------------------------------*/
10142
r9244r9245
15495   if (BIT(state->keylatch, 5)) data |= input_port_read(space->machine, "IO05");
15596   if (BIT(state->keylatch, 6)) data |= input_port_read(space->machine, "IO06");
15697   if (BIT(state->keylatch, 7)) data |= input_port_read(space->machine, "IO07");
157   if (state->uv201_31)      data |= input_port_read(space->machine, "UV201-31");
98   if (!BIT(state->cmd, 4)) data |= input_port_read(space->machine, "UV201-31");
15899
159100   return data;
160101}
r9244r9245
184125
185126   /* sound clock */
186127   int sound_clk = BIT(data, 7);
187
128   
188129   if (!state->sound_clk && sound_clk)
189130   {
190131      state->sound_q[0] = BIT(state->keylatch, 0);
r9244r9245
200141   state->joy_enable = BIT(data, 7);
201142}
202143
144/*-------------------------------------------------
145    vidbrain_interrupt_check - check interrupts
146-------------------------------------------------*/
147
148void vidbrain_interrupt_check(running_machine *machine)
149{
150   vidbrain_state *state = machine->driver_data<vidbrain_state>();
151
152   int interrupt = CLEAR_LINE;
153
154   switch (state->int_enable)
155   {
156   case 1:
157      if (state->ext_int_latch) interrupt = ASSERT_LINE;
158      break;
159
160   case 3:
161      if (state->timer_int_latch) interrupt = ASSERT_LINE;
162      break;
163   }
164
165   cputag_set_input_line(machine, F3850_TAG, F8_INPUT_LINE_INT_REQ, interrupt);
166}
167
168/*-------------------------------------------------
169    f3853_w - F3853 SMI write
170-------------------------------------------------*/
171
172static WRITE8_HANDLER( f3853_w )
173{
174   vidbrain_state *state = space->machine->driver_data<vidbrain_state>();
175
176   switch (offset)
177   {
178   case 0:
179      // interrupt vector address high
180      state->vector = (data << 8) | (state->vector & 0xff);
181      logerror("F3853 Interrupt Vector %04x\n", state->vector);
182      break;
183
184   case 1:
185      // interrupt vector address low
186      state->vector = (state->vector & 0xff00) | data;
187      logerror("F3853 Interrupt Vector %04x\n", state->vector);
188      break;
189
190   case 2:
191      // interrupt control
192      state->int_enable = data & 0x03;
193      logerror("F3853 Interrupt Control %u\n", state->int_enable);
194      vidbrain_interrupt_check(space->machine);
195
196      if (state->int_enable == 0x03) fatalerror("F3853 Timer not supported!");
197      break;
198
199   case 3:
200      // timer 8-bit polynomial counter
201      fatalerror("F3853 Timer not supported!");
202      break;
203   }
204}
205
203206/***************************************************************************
204207    MEMORY MAPS
205208***************************************************************************/
r9244r9245
210213
211214static ADDRESS_MAP_START( vidbrain_mem, ADDRESS_SPACE_PROGRAM, 8 )
212215   AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0xc000) AM_ROM
213   AM_RANGE(0x0800, 0x08ff) AM_READWRITE(vlsi_r, vlsi_w)
214   AM_RANGE(0x0c00, 0x0fff) AM_MIRROR(0xe000) AM_RAM AM_BASE_MEMBER(vidbrain_state, video_ram)
215   AM_RANGE(0x1000, 0x1fff) AM_ROM
216   AM_RANGE(0x0800, 0x08ff) AM_READWRITE(vidbrain_vlsi_r, vidbrain_vlsi_w)
217   AM_RANGE(0x0c00, 0x0fff) AM_MIRROR(0xe000) AM_RAM
218   AM_RANGE(0x1000, 0x1fff) AM_MIRROR(0xe000) AM_ROM
216219   AM_RANGE(0x2000, 0x27ff) AM_MIRROR(0xc000) AM_ROM
217220ADDRESS_MAP_END
218221
r9244r9245
223226static ADDRESS_MAP_START( vidbrain_io, ADDRESS_SPACE_IO, 8 )
224227   AM_RANGE(0x00, 0x00) AM_WRITE(keyboard_w)
225228   AM_RANGE(0x01, 0x01) AM_READWRITE(keyboard_r, sound_w)
229   AM_RANGE(0x0c, 0x0f) AM_WRITE(f3853_w)
230//   AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE(F3853_TAG, f3853_r, f3853_w)
226231ADDRESS_MAP_END
227232
228233/***************************************************************************
r9244r9245
328333INPUT_PORTS_END
329334
330335/***************************************************************************
331    VIDEO
332***************************************************************************/
333
334/*-------------------------------------------------
335    PALETTE_INIT( vidbrain )
336-------------------------------------------------*/
337
338static PALETTE_INIT( vidbrain )
339{
340   palette_set_color_rgb(machine,  0, 0x00, 0x00, 0x00 ); //
341   palette_set_color_rgb(machine,  1, 0xff, 0x00, 0x00 ); // red
342   palette_set_color_rgb(machine,  2, 0x00, 0xff, 0x00 ); //
343   palette_set_color_rgb(machine,  3, 0xff, 0xff, 0x00 ); //
344   palette_set_color_rgb(machine,  4, 0x00, 0x00, 0xff ); // blue
345   palette_set_color_rgb(machine,  5, 0xff, 0x00, 0xff ); //
346   palette_set_color_rgb(machine,  6, 0x00, 0xff, 0xff ); //
347   palette_set_color_rgb(machine,  7, 0xff, 0xff, 0xff ); //
348
349   palette_set_color_rgb(machine,  8, 0x00, 0x00, 0x00 ); //
350   palette_set_color_rgb(machine,  9, 0x80, 0x00, 0x00 ); // red
351   palette_set_color_rgb(machine, 10, 0x00, 0x80, 0x00 ); //
352   palette_set_color_rgb(machine, 11, 0x80, 0x80, 0x00 ); //
353   palette_set_color_rgb(machine, 12, 0x00, 0x00, 0x80 ); // blue
354   palette_set_color_rgb(machine, 13, 0x80, 0x00, 0x80 ); //
355   palette_set_color_rgb(machine, 14, 0x00, 0x80, 0x80 ); //
356   palette_set_color_rgb(machine, 15, 0x80, 0x80, 0x80 ); //
357}
358
359/*-------------------------------------------------
360    VIDEO_START( vidbrain )
361-------------------------------------------------*/
362
363static VIDEO_START( vidbrain )
364{
365}
366
367/*-------------------------------------------------
368    VIDEO_UPDATE( vidbrain )
369-------------------------------------------------*/
370
371static VIDEO_UPDATE( vidbrain )
372{
373   vidbrain_state *state = screen->machine->driver_data<vidbrain_state>();
374
375   UINT16 addr = 0x2f;
376
377   for (int y = 0; y < 49; y++)
378   {
379      int row = y / 7;
380
381      for (int sx = 0; sx < 16; sx++)
382      {
383         UINT8 data = state->video_ram[addr++];
384
385         for (int x = 0; x < 8; x++)
386         {
387            *BITMAP_ADDR16(bitmap, y, (sx * 8) + x) = BIT(data, 7) ? (state->vlsi[0x10+row] >> 5) : state->bg_color;
388            data <<= 1;
389         }
390      }
391   }
392
393    return 0;
394}
395
396/*-------------------------------------------------
397    gfx_layout vidbrain_charlayout
398-------------------------------------------------*/
399
400static const gfx_layout vidbrain_charlayout =
401{
402   8, 7,               /* 8 x 7 characters */
403   59,                  /* 59 characters */
404   1,                  /* 1 bits per pixel */
405   { 0 },               /* no bitplanes */
406   /* x offsets */
407   { 0, 1, 2, 3, 4, 5, 6, 7 },
408   /* y offsets */
409   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
410   8*7               /* every char takes 7 bytes */
411};
412
413/*-------------------------------------------------
414    GFXDECODE( vidbrain )
415-------------------------------------------------*/
416
417static GFXDECODE_START( vidbrain )
418   GFXDECODE_ENTRY( F3850_TAG, 0x2010, vidbrain_charlayout, 0, 1 )
419GFXDECODE_END
420
421/***************************************************************************
422336    SOUND
423337***************************************************************************/
424338
r9244r9245
437351***************************************************************************/
438352
439353/*-------------------------------------------------
354    f3853_interface smi_intf
355-------------------------------------------------*/
356/*
357static void f3853_int_req_w(running_device *device, UINT16 addr, int level)
358{
359   cpu_set_input_line_vector(device->machine->device(F3850_TAG), 0, addr);
360
361   cputag_set_input_line(device->machine, F3850_TAG, F8_INPUT_LINE_INT_REQ, level);
362}
363
364static const f3853_interface smi_intf =
365{
366   f3853_int_req_w
367};
368*/
369/*-------------------------------------------------
440370    cassette_config vidbrain_cassette_config
441371-------------------------------------------------*/
442372
r9244r9245
476406    MACHINE INITIALIZATION
477407***************************************************************************/
478408
409static IRQ_CALLBACK( vidbrain_int_ack )
410{
411   vidbrain_state *state = device->machine->driver_data<vidbrain_state>();
412
413   switch (state->int_enable)
414   {
415   case 1:
416      state->ext_int_latch = 0;
417      break;
418
419   case 3:
420      state->timer_int_latch = 0;
421      break;
422   }
423
424   vidbrain_interrupt_check(device->machine);
425
426   return state->vector;
427}
428
479429/*-------------------------------------------------
480430    MACHINE_START( vidbrain )
481431-------------------------------------------------*/
r9244r9245
484434{
485435   vidbrain_state *state = machine->driver_data<vidbrain_state>();
486436
437   /* register IRQ callback */
438   cpu_set_irq_callback(machine->device(F3850_TAG), vidbrain_int_ack);
439
487440   /* find devices */
488441   state->discrete = machine->device(DISCRETE_TAG);
489442
490443   /* register for state saving */
444   state_save_register_global(machine, state->vector);
445   state_save_register_global(machine, state->int_enable);
446   state_save_register_global(machine, state->ext_int_latch);
447   state_save_register_global(machine, state->timer_int_latch);
491448   state_save_register_global(machine, state->keylatch);
492449   state_save_register_global(machine, state->joy_enable);
493   state_save_register_global(machine, state->uv201_31);
494   state_save_register_global(machine, state->bg_color);
495450   state_save_register_global(machine, state->sound_clk);
496451   state_save_register_global_array(machine, state->sound_q);
497452}
r9244r9245
501456***************************************************************************/
502457
503458/*-------------------------------------------------
504    MACHINE_CONFIG_START( vidbrain, driver_device )
459    MACHINE_CONFIG( vidbrain )
505460-------------------------------------------------*/
506461
507462static MACHINE_CONFIG_START( vidbrain, vidbrain_state )
508
509463    /* basic machine hardware */
510464    MDRV_CPU_ADD(F3850_TAG, F8, XTAL_14_31818MHz/8)
511465    MDRV_CPU_PROGRAM_MAP(vidbrain_mem)
r9244r9245
513467
514468    MDRV_MACHINE_START(vidbrain)
515469
516    /* video hardware */
517    MDRV_SCREEN_ADD(SCREEN_TAG, RASTER)
518    MDRV_SCREEN_REFRESH_RATE(50)
519    MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
520    MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
521    MDRV_SCREEN_SIZE(128, 49)
522    MDRV_SCREEN_VISIBLE_AREA(0, 128-1, 0, 49-1)
523   MDRV_GFXDECODE(vidbrain)
524    MDRV_PALETTE_LENGTH(16)
525    MDRV_PALETTE_INIT(vidbrain)
470   /* video hardware */
471   MDRV_FRAGMENT_ADD(vidbrain_video)
526472
527    MDRV_VIDEO_START(vidbrain)
528    MDRV_VIDEO_UPDATE(vidbrain)
529
530473   /* sound hardware */
531474   MDRV_SPEAKER_STANDARD_MONO("mono")
532475
r9244r9245
535478   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
536479
537480   /* devices */
481//   MDRV_F3853_ADD(F3853_TAG, XTAL_14_31818MHz/8, smi_intf)
538482   MDRV_CASSETTE_ADD(CASSETTE_TAG, vidbrain_cassette_config)
539483
540484   /* cartridge */
r9244r9245
544488   MDRV_CARTSLOT_LOAD(vidbrain_cart)
545489
546490   /* software lists */
547   MDRV_SOFTWARE_LIST_ADD("cart_list","vidbrain")
491   MDRV_SOFTWARE_LIST_ADD("cart_list", "vidbrain")
548492
549493   /* internal ram */
550494   MDRV_RAM_ADD("messram")

Previous 15994 Revisions Next


© 1998-2018 The MESS Team