(MESS) enterp: converted the Nick Graphics Chip to be a device. [Fabio Priuli]

This commit is contained in:
Fabio Priuli 2013-05-29 21:01:08 +00:00
parent 2efdb1703b
commit 0a87be2f6f
5 changed files with 556 additions and 546 deletions

1
.gitattributes vendored
View File

@ -8059,6 +8059,7 @@ src/mess/video/ef9345.c svneol=native#text/plain
src/mess/video/ef9345.h svneol=native#text/plain
src/mess/video/electron.c svneol=native#text/plain
src/mess/video/epnick.c svneol=native#text/plain
src/mess/video/epnick.h svneol=native#text/plain
src/mess/video/fm7.c svneol=native#text/plain
src/mess/video/fmtowns.c svneol=native#text/plain
src/mess/video/galaxy.c svneol=native#text/plain

View File

@ -160,6 +160,7 @@ static const dave_interface enterprise_dave_interface =
void ep_state::machine_start()
{
m_maincpu->set_input_line_vector(0, 0xff);
m_nick->set_vram(m_ram->pointer());
for (int i = 0; i < 10; i++)
{
@ -167,7 +168,6 @@ void ep_state::machine_start()
sprintf(str, "LINE%i", i);
m_key[i] = ioport(str);
}
}
void ep_state::machine_reset()
@ -176,6 +176,50 @@ void ep_state::machine_reset()
}
UINT32 ep_state::screen_update_enterp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_nick->screen_update_epnick(screen, bitmap, cliprect);
return 0;
}
// FIXME: Should this be here or in the Nick device?!?
/* Enterprise has 256 colours, all may be on the screen at once!
the NICK_GET_RED8, NICK_GET_GREEN8, NICK_GET_BLUE8 macros
return a 8-bit colour value for the index specified. */
/* given a colour index in range 0..255 gives the Red component */
#define NICK_GET_RED8(x) \
(( \
(BIT(x, 0) << 2) | \
(BIT(x, 3) << 1) | \
(BIT(x, 6) << 0) \
) << 5)
/* given a colour index in range 0..255 gives the Red component */
#define NICK_GET_GREEN8(x) \
(( \
(BIT(x, 1) << 2) | \
(BIT(x, 4) << 1) | \
(BIT(x, 7) << 0) \
) << 5)
/* given a colour index in range 0..255 gives the Red component */
#define NICK_GET_BLUE8(x) \
(( \
(BIT(x, 2) << 1) | \
(BIT(x, 5) << 0) \
) << 6)
/* initial the palette */
void ep_state::palette_init()
{
for (int i = 0; i < 256; i++)
palette_set_color_rgb(machine(), i, NICK_GET_RED8(i), NICK_GET_GREEN8(i), NICK_GET_BLUE8(i));
}
/***************************************************************************
FLOPPY/EXDOS
***************************************************************************/
@ -251,7 +295,7 @@ static ADDRESS_MAP_START( enterprise_io, AS_IO, 8, ep_state )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x10, 0x13) AM_MIRROR(0x04) AM_DEVREADWRITE_LEGACY("wd1770", wd17xx_r, wd17xx_w)
AM_RANGE(0x18, 0x18) AM_MIRROR(0x04) AM_READWRITE(exdos_card_r, exdos_card_w)
AM_RANGE(0x80, 0x8f) AM_WRITE(epnick_reg_w)
AM_RANGE(0x80, 0x8f) AM_DEVWRITE("nick", nick_device, reg_w)
AM_RANGE(0xa0, 0xbf) AM_DEVREADWRITE("custom", dave_sound_device, reg_r, reg_w)
ADDRESS_MAP_END
@ -452,10 +496,12 @@ static MACHINE_CONFIG_START( ep64, ep_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
MCFG_SCREEN_SIZE(ENTERPRISE_SCREEN_WIDTH, ENTERPRISE_SCREEN_HEIGHT)
MCFG_SCREEN_VISIBLE_AREA(0, ENTERPRISE_SCREEN_WIDTH-1, 0, ENTERPRISE_SCREEN_HEIGHT-1)
MCFG_SCREEN_UPDATE_DRIVER(ep_state, screen_update_epnick)
MCFG_SCREEN_UPDATE_DRIVER(ep_state, screen_update_enterp)
MCFG_PALETTE_LENGTH(NICK_PALETTE_SIZE)
MCFG_NICK_ADD("nick")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("custom", DAVE, 0)

View File

@ -2,21 +2,11 @@
#define __ENTERP_H__
/* there are 64us per line, although in reality
about 50 are visible. */
#define ENTERPRISE_SCREEN_WIDTH (50*16)
/* there are 312 lines per screen, although in reality
about 35*8 are visible */
#define ENTERPRISE_SCREEN_HEIGHT (35*8)
#define NICK_PALETTE_SIZE 256
#include "machine/ram.h"
#include "audio/dave.h"
struct NICK_STATE;
#include "video/epnick.h"
class ep_state : public driver_device
{
@ -25,57 +15,32 @@ public:
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_dave(*this, "custom"),
m_nick(*this, "nick"),
m_ram(*this, RAM_TAG),
m_joy(*this, "JOY1") { }
required_device<cpu_device> m_maincpu;
required_device<dave_sound_device> m_dave;
required_device<nick_device> m_nick;
required_device<ram_device> m_ram;
required_ioport m_joy;
UINT8 exdos_card_value; /* state of the wd1770 irq/drq lines */
UINT8 keyboard_line; /* index of keyboard line to read */
bitmap_ind16 m_bitmap;
NICK_STATE *nick;
ioport_port *m_key[10];
DECLARE_READ8_MEMBER(exdos_card_r);
DECLARE_WRITE8_MEMBER(exdos_card_w);
DECLARE_WRITE8_MEMBER(epnick_reg_w);
virtual void machine_start();
virtual void machine_reset();
virtual void video_start();
virtual void palette_init();
UINT32 screen_update_epnick(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_enterp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE8_MEMBER(enterprise_dave_reg_write);
DECLARE_READ8_MEMBER(enterprise_dave_reg_read);
DECLARE_WRITE_LINE_MEMBER(enterp_wd1770_intrq_w);
DECLARE_WRITE_LINE_MEMBER(enterp_wd1770_drq_w);
void enterprise_update_memory_page(address_space &space, offs_t page, int index);
char Nick_FetchByte(unsigned long Addr);
void nick_write_pixel(int ci);
void Nick_CalcVisibleClocks(int Width);
void Nick_Init();
void Nick_WriteBorder(int Clocks);
void Nick_DoLeftMargin();
void Nick_DoRightMargin();
int Nick_GetColourIndex(int PenIndex);
void Nick_WritePixels2Colour(unsigned char Pen0, unsigned char Pen1, unsigned char DataByte);
void Nick_WritePixels2ColourLPIXEL(unsigned char Pen0, unsigned char Pen1, unsigned char DataByte);
void Nick_WritePixels(unsigned char DataByte, unsigned char CharIndex);
void Nick_WritePixelsLPIXEL(unsigned char DataByte, unsigned char CharIndex);
void Nick_DoPixel(int ClocksVisible);
void Nick_DoLPixel(int ClocksVisible);
void Nick_DoAttr(int ClocksVisible);
void Nick_DoCh256(int ClocksVisible);
void Nick_DoCh128(int ClocksVisible);
void Nick_DoCh64(int ClocksVisible);
void Nick_DoDisplay();
void Nick_UpdateLPT();
void Nick_ReloadLPT();
void Nick_DoLine();
void Nick_DoScreen(bitmap_ind16 &bm);
};

File diff suppressed because it is too large Load Diff

125
src/mess/video/epnick.h Normal file
View File

@ -0,0 +1,125 @@
#ifndef __EPNICK_H__
#define __EPNICK_H__
/* there are 64us per line, although in reality
about 50 are visible. */
#define ENTERPRISE_SCREEN_WIDTH (50*16)
/* there are 312 lines per screen, although in reality
about 35*8 are visible */
#define ENTERPRISE_SCREEN_HEIGHT (35*8)
/* Nick executes a Display list, in the form of a list of Line Parameter
Tables, this is the form of the data */
struct LPT_ENTRY
{
UINT8 SC; /* scanlines in this modeline (two's complement) */
UINT8 MB; /* the MODEBYTE (defines video display mode) */
UINT8 LM; /* left margin etc */
UINT8 RM; /* right margin etc */
UINT8 LD1L; /* (a7..a0) of line data pointer LD1 */
UINT8 LD1H; /* (a8..a15) of line data pointer LD1 */
UINT8 LD2L; /* (a7..a0) of line data pointer LD2 */
UINT8 LD2H; /* (a8..a15) of line data pointer LD2 */
UINT8 COL[8]; /* COL0..COL7 */
};
class nick_device : public device_t
{
public:
nick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual ~nick_device();
void set_vram(UINT8 *vram) { m_videoram = vram; }
DECLARE_WRITE8_MEMBER(reg_w);
UINT32 screen_update_epnick(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
protected:
// device-level overrides
virtual void device_start();
virtual void device_reset();
private:
inline UINT8 fetch_byte(UINT32 offs) { return m_videoram[offs & 0x0ffff]; }
void write_pixel(int ci);
void calc_visible_clocks(int width);
void init();
void write_border(int clocks);
void do_left_margin();
void do_right_margin();
int get_color_index(int pen_index);
void write_pixels2color(UINT8 pen0, UINT8 pen1, UINT8 data_byte);
void write_pixels2color_lpixel(UINT8 pen0, UINT8 pen1, UINT8 data_byte);
void write_pixels(UINT8 data_byte, UINT8 char_idx);
void write_pixels_lpixel(UINT8 data_byte, UINT8 char_idx);
void do_pixel(int clocks_visible);
void do_lpixel(int clocks_visible);
void do_attr(int clocks_visible);
void do_ch256(int clocks_visible);
void do_ch128(int clocks_visible);
void do_ch64(int clocks_visible);
void do_display();
void update_lpt();
void reload_lpt();
void do_line();
void do_screen(bitmap_ind16 &bm);
bitmap_ind16 m_bitmap;
/* horizontal position */
UINT8 horizontal_clock;
/* current scanline within LPT */
UINT8 m_scanline_count;
UINT8 m_FIXBIAS;
UINT8 m_BORDER;
UINT8 m_LPL;
UINT8 m_LPH;
UINT16 m_LD1;
UINT16 m_LD2;
LPT_ENTRY m_LPT;
UINT16 *m_dest;
int m_dest_pos;
int m_dest_max_pos;
UINT8 m_reg[16];
/* first clock visible on left hand side */
int m_first_visible_clock;
/* first clock visible on right hand side */
int m_last_visible_clock;
/* given a bit pattern, this will get the pen index */
UINT8 m_pen_idx_4col[256];
/* given a bit pattern, this will get the pen index */
UINT8 m_pen_idx_16col[256];
UINT8 *m_videoram;
};
// device type definition
extern const device_type NICK;
/***************************************************************************
DEVICE CONFIGURATION MACROS
***************************************************************************/
#define MCFG_NICK_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, NICK, 0)
#endif