diff --git a/src/mess/drivers/thomson.c b/src/mess/drivers/thomson.c index c5c26accad1..696ab3ed17a 100644 --- a/src/mess/drivers/thomson.c +++ b/src/mess/drivers/thomson.c @@ -1091,6 +1091,9 @@ static MACHINE_CONFIG_DERIVED( mo5, to7 ) MCFG_DEVICE_REMOVE( "mc6846" ) + MCFG_PALETTE_MODIFY( "palette" ) + MCFG_PALETTE_INIT_OWNER(thomson_state, mo5) + MCFG_DEVICE_MODIFY(THOM_PIA_SYS) MCFG_PIA_READPA_HANDLER(READ8(thomson_state, mo5_sys_porta_in)) MCFG_PIA_READPB_HANDLER(READ8(thomson_state, mo5_sys_portb_in)) diff --git a/src/mess/includes/thomson.h b/src/mess/includes/thomson.h index d81f71a633f..3e2848ed692 100644 --- a/src/mess/includes/thomson.h +++ b/src/mess/includes/thomson.h @@ -259,6 +259,7 @@ public: void to9_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); void bitmap4_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); void bitmap4alt_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void bitmap4althalf_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); void bitmap16_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); void mode80_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); void mode80_to9_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); @@ -271,6 +272,7 @@ public: void to9_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); void bitmap4_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); void bitmap4alt_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); + void bitmap4althalf_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); void bitmap16_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); void mode80_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); void mode80_to9_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len ); @@ -306,6 +308,7 @@ public: WRITE_LINE_MEMBER( fdc_index_3_w ); void thomson_index_callback(legacy_floppy_image_device *device, int state); DECLARE_PALETTE_INIT(thom); + DECLARE_PALETTE_INIT(mo5); optional_device m_mc6854; @@ -519,6 +522,7 @@ protected: void thom_set_mode_point( int point ); void thom_floppy_active( int write ); unsigned to7_lightpen_gpl( int decx, int decy ); + void thom_configure_palette( double gamma, const UINT16* pal, palette_device& palette ); int thom_floppy_make_addr( chrn_id id, UINT8* dst, int sector_size ); int thom_floppy_make_sector( legacy_floppy_image_device* img, chrn_id id, UINT8* dst, int sector_size ); @@ -602,7 +606,8 @@ protected: #define THOM_VMODE_OVERLAY3 9 #define THOM_VMODE_TO9 10 #define THOM_VMODE_80_TO9 11 -#define THOM_VMODE_NB 12 +#define THOM_VMODE_BITMAP4_ALT_HALF 12 +#define THOM_VMODE_NB 13 class to7_io_line_device : public device_t diff --git a/src/mess/machine/thomson.c b/src/mess/machine/thomson.c index de5e6a9c8ac..77a94351778 100644 --- a/src/mess/machine/thomson.c +++ b/src/mess/machine/thomson.c @@ -2039,10 +2039,16 @@ void thomson_state::to9_set_video_mode( UINT8 data, int style ) thom_set_video_mode( THOM_VMODE_TO9 ); break; + // undocumented, but tested on a real TO8D + case 0x20: thom_set_video_mode( THOM_VMODE_MO5 ); break; + case 0x21: thom_set_video_mode( THOM_VMODE_BITMAP4 ); break; case 0x41: thom_set_video_mode( THOM_VMODE_BITMAP4_ALT ); break; + // also undocumented but tested + case 0x59: thom_set_video_mode( THOM_VMODE_BITMAP4_ALT_HALF ); break; + case 0x2a: if ( style==0 ) thom_set_video_mode( THOM_VMODE_80_TO9 ); @@ -2110,7 +2116,6 @@ WRITE8_MEMBER( thomson_state::to9_vreg_w ) color = m_to9_palette_data[ 2 * idx + 1 ]; color = m_to9_palette_data[ 2 * idx ] | (color << 8); thom_set_palette( idx ^ 8, color & 0x1fff ); - m_to9_palette_idx = ( m_to9_palette_idx + 1 ) & 31; } break; diff --git a/src/mess/video/thomson.c b/src/mess/video/thomson.c index 398aa208519..90ffd6675d7 100644 --- a/src/mess/video/thomson.c +++ b/src/mess/video/thomson.c @@ -495,6 +495,29 @@ UPDATE_LOW( bitmap4alt ) END_UPDATE +/* 160x200, 4 colors, no constraint, using only one memory page (undocumented) */ + +UPDATE_HI( bitmap4althalf ) +{ + dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = pal[ rama >> 6 ]; + dst[ 4] = dst[ 5] = dst[ 6] = dst[ 7] = pal[ (rama >> 4) & 3 ]; + dst[ 8] = dst[ 9] = dst[10] = dst[11] = pal[ (rama >> 2) & 3]; + dst[12] = dst[13] = dst[14] = dst[15] = pal[ rama & 3 ]; + (void)ramb; // ramb is not used +} +END_UPDATE + +UPDATE_LOW( bitmap4althalf ) +{ + dst[0] = dst[1] = pal[ rama >> 6 ]; + dst[2] = dst[3] = pal[ (rama >> 4) & 3 ]; + dst[4] = dst[5] = pal[ (rama >> 2) & 3]; + dst[6] = dst[7] = pal[ rama & 3 ]; + (void)ramb; // ramb is not used +} +END_UPDATE + + /* 160x200, 16-colors, no constraint */ @@ -702,6 +725,7 @@ static const thom_scandraw thom_scandraw_funcs[THOM_VMODE_NB][2] = FUN(to770), FUN(mo5), FUN(bitmap4), FUN(bitmap4alt), FUN(mode80), FUN(bitmap16), FUN(page1), FUN(page2), FUN(overlay), FUN(overlay3), FUN(to9), FUN(mode80_to9), + FUN(bitmap4althalf), }; @@ -1002,7 +1026,10 @@ void thomson_state::thom_vblank( screen_device &screen, bool state ) /* -------------- initialization --------------- */ - +/* TO7, TO7/70 palette, hardcoded in ROM + without further information, we assume that the hardcoded values + are the same as those setup by the TO8/TO9+/MO6 when booting up + */ static const UINT16 thom_pal_init[16] = { 0x1000, /* 0: black */ 0x000f, /* 1: red */ @@ -1012,9 +1039,23 @@ static const UINT16 thom_pal_init[16] = 0x0777, /* 8: gray */ 0x033a, /* 9: pink */ 0x03a3, /* a: light green */ 0x03aa, /* b: light yellow */ 0x0a33, /* c: light blue */ 0x0a3a, /* d: redish pink */ - 0x0ee7, /* e: light cyan */ 0x003b, /* f: orange */ + 0x0ee7, /* e: light cyan */ 0x007b, /* f: orange */ }; +/* MO5 palette, hardcoded in a ROM + values are from "Manuel Technique du MO5", p.19 + */ +static const UINT16 mo5_pal_init[16] = +{ + 0x1000, /* 0: black */ 0x055f, /* 1: red */ + 0x00f0, /* 2: geen */ 0x00ff, /* 3: yellow */ + 0x0f55, /* 4: blue */ 0x0f0f, /* 5: purple */ + 0x0ff5, /* 6: cyan */ 0x0fff, /* 7: white */ + 0x0aaa, /* 8: gray */ 0x0aaf, /* 9: pink */ + 0x0afa, /* a: light green */ 0x0aff, /* b: light yellow */ + 0x0fa5, /* c: light blue */ 0x0faf, /* d: parama pink */ + 0x0ffa, /* e: light cyan */ 0x05af, /* f: orange */ +}; VIDEO_START_MEMBER( thomson_state, thom ) @@ -1022,8 +1063,6 @@ VIDEO_START_MEMBER( thomson_state, thom ) LOG (( "thom: video start called\n" )); /* scan-line state */ - memcpy( m_thom_last_pal, thom_pal_init, 32 ); - memcpy( m_thom_pal, thom_pal_init, 32 ); memset( m_thom_border_l, 0xff, sizeof( m_thom_border_l ) ); memset( m_thom_border_r, 0xff, sizeof( m_thom_border_r ) ); memset( m_thom_vbody, 0, sizeof( m_thom_vbody ) ); @@ -1082,15 +1121,13 @@ VIDEO_START_MEMBER( thomson_state, thom ) } - -PALETTE_INIT_MEMBER(thomson_state, thom) +/* sets the fixed palette (for MO5,TO7,TO7/70) and gamma correction */ +void thomson_state::thom_configure_palette(double gamma, const UINT16* pal, palette_device& palette) { - double gamma = 0.6f; - unsigned i; + memcpy( m_thom_last_pal, pal, 32 ); + memcpy( m_thom_pal, pal, 32 ); - LOG (( "thom: palette init called\n" )); - - for ( i = 0; i < 4097; i++ ) + for ( int i = 0; i < 4097; i++ ) { UINT8 r = 255. * pow( (i & 15) / 15., gamma ); UINT8 g = 255. * pow( ((i>> 4) & 15) / 15., gamma ); @@ -1101,6 +1138,34 @@ PALETTE_INIT_MEMBER(thomson_state, thom) } +PALETTE_INIT_MEMBER(thomson_state, thom) +{ + LOG (( "thom: palette init called\n" )); + + /* TO8 and later use an EF9369 color palette chip + The spec shows a built-in gamma correction for gamma=2.8 + i.e., output is out = in ^ (1/2.8) + + For the TO7, the gamma correction is irrelevant. + + For the TO7/70, we use the same palette and gamma has the TO8, + which gives good results (but is not verified). + */ + thom_configure_palette(1.0 / 2.8, thom_pal_init, palette); +} + +PALETTE_INIT_MEMBER(thomson_state, mo5) +{ + LOG (( "thom: MO5 palette init called\n" )); + + /* The MO5 has a different fixed palette than the TO7/70. + We use a smaller gamma correction which gives intutively better + results (but is not verified). + */ + thom_configure_palette(1.0, mo5_pal_init, palette); +} + + /***************************** TO7 / T9000 *************************/