Previous 15994 Revisions Next

r15124 Tuesday 8th May, 2012 at 14:29:07 UTC by Curt Coder
[VIDBRAIN] Fixed video and added sound. [Curt Coder, Kurt Woloch]
[src/mess/drivers]vidbrain.c
[src/mess/includes]vidbrain.h
[src/mess/video]vidbrain.c

src/mess/includes/vidbrain.h
r15123r15124
33#ifndef __VIDBRAIN__
44#define __VIDBRAIN__
55
6#include "emu.h"
7#include "cpu/f8/f8.h"
8#include "imagedev/cartslot.h"
9#include "machine/f3853.h"
10#include "machine/ram.h"
11#include "sound/discrete.h"
12
613#define F3850_TAG         "cd34"
714#define F3853_TAG         "cd5"
815#define SCREEN_TAG         "screen"
r15123r15124
1623   vidbrain_state(const machine_config &mconfig, device_type type, const char *tag)
1724      : driver_device(mconfig, type, tag),
1825        m_maincpu(*this, F3850_TAG),
26        m_smi(*this, F3853_TAG),
1927        m_discrete(*this, DISCRETE_TAG),
2028        m_screen(*this, SCREEN_TAG),
2129        m_timer_y_odd(*this, TIMER_Y_ODD_TAG),
r15123r15124
2331   { }
2432
2533   required_device<cpu_device> m_maincpu;
34   required_device<f3853_device> m_smi;
2635   required_device<device_t> m_discrete;
2736   required_device<screen_device> m_screen;
2837   required_device<timer_device> m_timer_y_odd;
src/mess/video/vidbrain.c
r15123r15124
22
33    TODO:
44
5    - X order
65    - freeze (light pen)
76    - screen size
87    - scanline based update
r15123r15124
4039
4140// read/write registers - RAM memory
4241#define RAM_RP_LO               0x00   // cartridge pointer low order
43#define RAM_RP_HI               0x10   // cartridge pointer high order and color
44#define RAM_DX                  0x20   // dX, intensity, X-copy
42#define RAM_RP_HI_COLOR            0x10   // cartridge pointer high order and color
43#define RAM_DX_INT_XCOPY         0x20   // dX, intensity, X-copy
4544#define RAM_DY                  0x30   // dY
4645#define RAM_X                  0x40   // X value
4746#define RAM_Y_LO_A               0x50   // Y value low order list A
r15123r15124
6766#define RAM(_offset) \
6867   m_vlsi_ram[_offset + i]
6968
69#define RAM_XORD(_offset) \
70   m_vlsi_ram[_offset + xord]
71
7072#define IS_VISIBLE(_y) \
7173   ((_y >= cliprect.min_y) && (_y <= cliprect.max_y))
7274
r15123r15124
362364
363365   for (int i = 0; i < 16; i++)
364366   {
365      UINT16 rp = ((RAM(RAM_RP_HI) << 8) | RAM(RAM_RP_LO)) & 0x1fff;
366      int color = ((RAM(RAM_DX) >> 2) | (BIT(RAM(RAM_RP_HI), 5) << 2) | (BIT(RAM(RAM_RP_HI), 6) << 1) | (BIT(RAM(RAM_RP_HI), 7))) & 0x1f;
367      int dx = RAM(RAM_DX) & 0x1f;
368      int dy = RAM(RAM_DY);
369      int xcopy = BIT(RAM(RAM_DX), 7);
370      int x = RAM(RAM_X);
371      int xord_a = RAM(RAM_Y_LO_A) & 0x0f;
372      int xord_b = RAM(RAM_Y_LO_B) & 0x0f;
373      int y_a = ((RAM(RAM_XY_HI_A) & 0x80) << 1) | RAM(RAM_Y_LO_A);
374      int y_b = ((RAM(RAM_XY_HI_B) & 0x80) << 1) | RAM(RAM_Y_LO_B);
375      int y = (m_cmd & COMMAND_A_B) ? y_a : y_b;
376      int xord = (m_cmd & COMMAND_A_B) ? xord_a : xord_b;
367      UINT8 xy_hi = (m_cmd & COMMAND_A_B) ? RAM(RAM_XY_HI_A) : RAM(RAM_XY_HI_B);
368      UINT8 y_lo = (m_cmd & COMMAND_A_B) ? RAM(RAM_Y_LO_A) : RAM(RAM_Y_LO_B);
369      UINT16 y = (BIT(xy_hi, 7) << 8) | y_lo;
370      int xord = xy_hi & 0x0f;
377371
378      if (LOG) logerror("Object %u rp %04x color %u dx %u dy %u xcopy %u x %u y %u xord %u\n", i, rp, color, dx, dy, xcopy, x, y, xord);
372      UINT8 rp_hi_color = RAM_XORD(RAM_RP_HI_COLOR);
373      UINT8 rp_lo = RAM_XORD(RAM_RP_LO);
374      UINT16 rp = ((rp_hi_color << 8) | rp_lo) & 0x1fff;
379375
376      UINT8 dx_int_xcopy = RAM_XORD(RAM_DX_INT_XCOPY);
377      int color = ((dx_int_xcopy & 0x60) >> 2) | (BIT(rp_hi_color, 5) << 2) | (BIT(rp_hi_color, 6) << 1) | (BIT(rp_hi_color, 7));
378      UINT8 dx = dx_int_xcopy & 0x1f;
379      UINT8 dy = RAM_XORD(RAM_DY);
380      int xcopy = BIT(dx_int_xcopy, 7);
381      UINT8 x = RAM_XORD(RAM_X);
382
383      if (LOG) logerror("Object %u xord %u y %u x %u dy %u dx %u xcopy %u color %u rp %04x\n", i, xord, y, x, dy, dx, xcopy, color, rp);
384
380385      if (rp == 0) continue;
381386      if (y > 262) continue;
382387
r15123r15124
480485   if ((state->m_cmd & COMMAND_INT) && !(state->m_cmd & COMMAND_FRZ))
481486   {
482487      if (LOG) logerror("Y-Interrupt at scanline %u\n", state->m_screen->vpos());
488
489//      f3853_set_external_interrupt_in_line(state->m_smi, 0);
483490//      f3853_set_external_interrupt_in_line(state->m_smi, 1);
491     
484492      state->m_ext_int_latch = 1;
485493      state->interrupt_check();
486494   }
r15123r15124
499507MACHINE_CONFIG_FRAGMENT( vidbrain_video )
500508    MCFG_SCREEN_ADD(SCREEN_TAG, RASTER)
501509   MCFG_SCREEN_UPDATE_DRIVER(vidbrain_state, screen_update)
502   MCFG_SCREEN_RAW_PARAMS(XTAL_14_31818MHz, 455, 0, 320, 525, 0, 243)
510   MCFG_SCREEN_RAW_PARAMS(XTAL_14_31818MHz, 455, 0, 190, 525, 0, 243)
503511
504512   MCFG_GFXDECODE(vidbrain)
505513
src/mess/drivers/vidbrain.c
r15123r15124
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
8    http://www.google.com/patents/US4232374
9    http://www.google.com/patents/US4177462
910
1011    07/04/2009 Skeleton driver.
1112
r15123r15124
1516
1617    TODO:
1718
19   - video interrupts
20   - reset on cartridge unload
1821    - use machine/f3853.h
19    - discrete sound
2022    - joystick scan timer 555
21    - reset on cartridge eject
2223    - expander 1 (cassette, RS-232)
2324    - expander 2 (modem)
2425
2526*/
2627
2728
28#include "emu.h"
2929#include "includes/vidbrain.h"
30#include "cpu/f8/f8.h"
31#include "imagedev/cartslot.h"
32#include "imagedev/cassette.h"
33#include "machine/ram.h"
34#include "sound/discrete.h"
3530
3631
3732
r15123r15124
7469
7570        bit     description
7671
77        0       keyboard row 0
78        1       keyboard row 1
79        2       keyboard row 2
80        3       keyboard row 3
72        0       keyboard row 0, joystick 1 fire
73        1       keyboard row 1, joystick 2 fire
74        2       keyboard row 2, joystick 3 fire
75        3       keyboard row 3, joystick 4 fire
8176        4
8277        5
8378        6
r15123r15124
8580
8681    */
8782
88   UINT8 data = 0;//machine.root_device().ioport("JOY-R")->read();
83   UINT8 data = ioport("JOY-R")->read();
8984
9085   if (BIT(m_keylatch, 0)) data |= ioport("IO00")->read();
9186   if (BIT(m_keylatch, 1)) data |= ioport("IO01")->read();
r15123r15124
111106
112107        bit     description
113108
114        0       sound Q0
115        1       sound Q1
109        0
110        1
116111        2
117112        3
118113        4       sound clock
119        5
120        6
114        5      accessory jack pin 5
115        6      accessory jack pin 1
121116        7       joystick enable
122117
123118    */
124119
125120   // sound clock
126   int sound_clk = BIT(data, 7);
121   int sound_clk = BIT(data, 4);
127122
128123   if (!m_sound_clk && sound_clk)
129124   {
130      discrete_sound_w(m_discrete, NODE_01, BIT(m_keylatch, 0));
131      discrete_sound_w(m_discrete, NODE_02, BIT(m_keylatch, 1));
125      discrete_sound_w(m_discrete, NODE_01, m_keylatch & 0x03);
132126   }
133127
134128   m_sound_clk = sound_clk;
r15123r15124
330324   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(25) PORT_PLAYER(4)
331325
332326   PORT_START("JOY-R")
333   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
334   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
335   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
336   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4)
327   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
328   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)
329   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(3)
330   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(4)
337331INPUT_PORTS_END
338332
339333
r15123r15124
346340//  DISCRETE_SOUND( vidbrain )
347341//-------------------------------------------------
348342
343static const discrete_dac_r1_ladder vidbrain_dac =
344{
345   2,
346   { RES_K(120), RES_K(120) }, // R=56K, 2R=120K
347   0, 0, RES_K(120), 0
348};
349
349350static DISCRETE_SOUND_START( vidbrain )
350   DISCRETE_INPUT_LOGIC(NODE_01)
351   DISCRETE_INPUT_LOGIC(NODE_02)
351   DISCRETE_INPUT_DATA(NODE_01)
352   DISCRETE_DAC_R1(NODE_02, NODE_01, DEFAULT_TTL_V_LOGIC_1, &vidbrain_dac)
352353   DISCRETE_OUTPUT(NODE_02, 5000)
353354DISCRETE_SOUND_END
354355
r15123r15124
361362//-------------------------------------------------
362363//  f3853_interface smi_intf
363364//-------------------------------------------------
364/*
365
365366static void f3853_int_req_w(device_t *device, UINT16 addr, int level)
366367{
367    device_set_input_line_vector(device->machine().device(F3850_TAG), 0, addr);
368   vidbrain_state *state = device->machine().driver_data<vidbrain_state>();
368369
369    cputag_set_input_line(device->machine(), F3850_TAG, F8_INPUT_LINE_INT_REQ, level);
370    device_set_input_line_vector(state->m_maincpu, F8_INPUT_LINE_INT_REQ, addr);
371
372    state->m_maincpu->set_input_line(F8_INPUT_LINE_INT_REQ, level);
370373}
371374
372375static const f3853_interface smi_intf =
373376{
374377    f3853_int_req_w
375378};
376*/
377379
378380
379//-------------------------------------------------
380//  cassette_interface vidbrain_cassette_interface
381//-------------------------------------------------
382381
383static const cassette_interface vidbrain_cassette_interface =
384{
385   cassette_default_formats,
386   NULL,
387   (cassette_state)(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED),
388   NULL,
389   NULL
390};
391
392
393382//**************************************************************************
394383//  MACHINE INITIALIZATION
395384//**************************************************************************
r15123r15124
465454   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
466455
467456   // devices
468//  MCFG_F3853_ADD(F3853_TAG, XTAL_14_31818MHz/8, smi_intf)
469   MCFG_CASSETTE_ADD(CASSETTE_TAG, vidbrain_cassette_interface)
457   MCFG_F3853_ADD(F3853_TAG, XTAL_14_31818MHz/8, smi_intf)
470458
471459   // cartridge
472460   MCFG_CARTSLOT_ADD("cart")
r15123r15124
505493//**************************************************************************
506494
507495//    YEAR  NAME        PARENT  COMPAT  MACHINE     INPUT       INIT    COMPANY                         FULLNAME                        FLAGS
508COMP( 1977, vidbrain,   0,      0,      vidbrain,   vidbrain,   0,      "VideoBrain Computer Company",   "VideoBrain FamilyComputer",   GAME_NOT_WORKING | GAME_NO_SOUND )
496COMP( 1977, vidbrain,   0,      0,      vidbrain,   vidbrain,   0,      "VideoBrain Computer Company",   "VideoBrain FamilyComputer",   GAME_NOT_WORKING )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team