Major EF9365 driver update : All display functions emulated [jfdelnero]

This commit is contained in:
David Haywood 2015-12-28 03:22:48 +00:00
parent ef916a88e5
commit 1090e62e24
3 changed files with 845 additions and 266 deletions

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@
ef9365.h
Thomson EF9365 video controller
Thomson EF9365/EF9366 video controller
*********************************************************************/
@ -13,10 +13,21 @@
#ifndef __EF9365_H__
#define __EF9365_H__
#define EF936X_BITPLAN_MAX_SIZE 0x8000
#define EF936X_MAX_BITPLANS 8
#define MCFG_EF9365_PALETTE(_palette_tag) \
#define MCFG_EF936X_PALETTE(_palette_tag) \
ef9365_device::static_set_palette_tag(*device, "^" _palette_tag);
#define MCFG_EF936X_BITPLANS_CNT(_bitplans_number) \
ef9365_device::static_set_nb_bitplans(*device,_bitplans_number);
#define MCFG_EF936X_DISPLAYMODE(_display_mode) \
ef9365_device::static_set_display_mode(*device,_display_mode);
#define MCFG_EF936X_IRQ_HANDLER(_devcb) \
devcb = &ef9365_device::set_irq_handler(*device, DEVCB_##_devcb);
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@ -33,14 +44,18 @@ public:
// static configuration
static void static_set_palette_tag(device_t &device, const char *tag);
static void static_set_nb_bitplans(device_t &device, int nb_bitplans );
static void static_set_display_mode(device_t &device, int display_mode );
template<class _Object> static devcb_base &set_irq_handler(device_t &device, _Object object) { return downcast<ef9365_device &>(device).m_irq_handler.set_callback(object); }
// device interface
DECLARE_READ8_MEMBER( data_r );
DECLARE_WRITE8_MEMBER( data_w );
void update_scanline(UINT16 scanline);
void static_set_color_filler( UINT8 color );
void static_set_color_entry( int index, UINT8 r, UINT8 g, UINT8 b );
void set_color_filler( UINT8 color );
void set_color_entry( int index, UINT8 r, UINT8 g, UINT8 b );
UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
protected:
@ -58,13 +73,22 @@ protected:
// inline helper
private:
void draw_character( unsigned char c, int block, int smallblock );
int get_char_pix( unsigned char c, int x, int y );
void plot(int x_pos,int y_pos);
int draw_character( unsigned char c, int block, int smallblock );
int draw_vector(int x1,int y1,int x2,int y2);
unsigned int get_x_reg();
unsigned int get_y_reg();
void set_x_reg(unsigned int x);
void set_y_reg(unsigned int y);
void screen_scanning( int force_clear );
void set_busy_flag(int period);
void set_video_mode(void);
void draw_border(UINT16 line);
void ef9365_exec(UINT8 cmd);
int cycles_to_us(int cycles);
void update_interrupts();
// internal state
static const device_timer_id BUSY_TIMER = 0;
@ -72,36 +96,55 @@ private:
memory_region *m_charset;
address_space *m_videoram;
UINT8 m_irq_state;
UINT8 m_irq_vb;
UINT8 m_irq_lb;
UINT8 m_irq_rdy;
UINT8 m_current_color;
UINT8 m_bf; //busy flag
UINT8 m_registers[0x10]; //registers
UINT8 m_state; //status register
UINT8 m_border[80]; //border color
rgb_t palette[16];
rgb_t palette[256]; // 8 bitplans max -> 256 colors max
int nb_of_bitplans;
int nb_of_colors;
int bitplan_xres;
int bitplan_yres;
UINT16 overflow_mask_x;
UINT16 overflow_mask_y;
int vsync_scanline_pos;
UINT32 clock_freq;
bitmap_rgb32 m_screen_out;
// timers
emu_timer *m_busy_timer;
required_device<palette_device> m_palette;
devcb_write_line m_irq_handler;
};
// device type definition
extern const device_type EF9365;
#define EF9365_REG_STATUS 0x00
#define EF9365_REG_CMD 0x00
#define EF9365_REG_CTRL1 0x01
#define EF9365_REG_CTRL2 0x02
#define EF9365_REG_CSIZE 0x03
#define EF9365_REG_DELTAX 0x05
#define EF9365_REG_DELTAY 0x07
#define EF9365_REG_X_MSB 0x08
#define EF9365_REG_X_LSB 0x09
#define EF9365_REG_Y_MSB 0x0A
#define EF9365_REG_Y_LSB 0x0B
#define EF9365_REG_XLP 0x0C
#define EF9365_REG_YLP 0x0D
#define EF936X_REG_STATUS 0x00
#define EF936X_REG_CMD 0x00
#define EF936X_REG_CTRL1 0x01
#define EF936X_REG_CTRL2 0x02
#define EF936X_REG_CSIZE 0x03
#define EF936X_REG_DELTAX 0x05
#define EF936X_REG_DELTAY 0x07
#define EF936X_REG_X_MSB 0x08
#define EF936X_REG_X_LSB 0x09
#define EF936X_REG_Y_MSB 0x0A
#define EF936X_REG_Y_LSB 0x0B
#define EF936X_REG_XLP 0x0C
#define EF936X_REG_YLP 0x0D
#define EF936X_256x256_DISPLAY_MODE 0x00
#define EF936X_512x512_DISPLAY_MODE 0x01
#define EF936X_512x256_DISPLAY_MODE 0x02
#endif

View File

@ -67,6 +67,7 @@
#define MAIN_CLOCK XTAL_14MHz
#define AY_CLOCK MAIN_CLOCK / 8 /* 1.75 Mhz */
#define VIDEO_CLOCK MAIN_CLOCK / 8 /* 1.75 Mhz */
#define CPU_CLOCK MAIN_CLOCK / 4 /* 3.50 Mhz */
class squale_state : public driver_device
@ -153,7 +154,7 @@ WRITE8_MEMBER( squale_state::ctrl_w )
membank("rom_bank")->set_entry(data >> 7);
m_ef9365->static_set_color_filler(data & 0xF);
m_ef9365->set_color_filler(data & 0xF);
}
/**********************************
@ -684,12 +685,12 @@ void squale_state::machine_start()
// Generate Squale hardware palette
for(i=0;i<8;i++)
{
m_ef9365->static_set_color_entry(i,(((i&4)>>2)^1) * 255,(((i&2)>>1)^1) * 255, ((i&1)^1) * 255 );
m_ef9365->set_color_entry(i,(((i&4)>>2)^1) * 255,(((i&2)>>1)^1) * 255, ((i&1)^1) * 255 );
}
for(i=0;i<8;i++)
{
m_ef9365->static_set_color_entry(i + 8,(((i&4)>>2)^1) * 127,(((i&2)>>1)^1) * 127, ((i&1)^1) * 127 );
m_ef9365->set_color_entry(i + 8,(((i&4)>>2)^1) * 127,(((i&2)>>1)^1) * 127, ((i&1)^1) * 127 );
}
}
@ -734,15 +735,17 @@ static MACHINE_CONFIG_START( squale, squale_state )
/* screen */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_REFRESH_RATE(50)
MCFG_SCREEN_UPDATE_DEVICE("ef9365", ef9365_device, screen_update)
MCFG_SCREEN_SIZE(336, 270)
MCFG_SCREEN_VISIBLE_AREA(00, 336-1, 00, 270-1)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 256-1)
MCFG_PALETTE_ADD("palette", 16)
MCFG_DEVICE_ADD("ef9365", EF9365, 0)
MCFG_EF9365_PALETTE("palette")
MCFG_DEVICE_ADD("ef9365", EF9365, VIDEO_CLOCK)
MCFG_EF936X_PALETTE("palette")
MCFG_EF936X_BITPLANS_CNT(4);
MCFG_EF936X_DISPLAYMODE(EF936X_256x256_DISPLAY_MODE);
MCFG_TIMER_DRIVER_ADD_SCANLINE("squale_sl", squale_state, squale_scanline, "screen", 0, 10)
/* Floppy */