Previous 199869 Revisions Next

r31953 Saturday 6th September, 2014 at 17:00:02 UTC by Miodrag Milanović
(MESS)thomson : improve accuracy of the colors [Antoine Mine]
[src/mess/drivers]thomson.c
[src/mess/includes]thomson.h
[src/mess/machine]thomson.c
[src/mess/video]thomson.c

trunk/src/mess/machine/thomson.c
r31952r31953
20392039         thom_set_video_mode( THOM_VMODE_TO9 );
20402040      break;
20412041
2042        // undocumented, but tested on a real TO8D
2043        case 0x20: thom_set_video_mode( THOM_VMODE_MO5 );         break;
2044
20422045   case 0x21: thom_set_video_mode( THOM_VMODE_BITMAP4 );     break;
20432046
20442047   case 0x41: thom_set_video_mode( THOM_VMODE_BITMAP4_ALT ); break;
20452048
2049        // also undocumented but tested
2050   case 0x59: thom_set_video_mode( THOM_VMODE_BITMAP4_ALT_HALF ); break;
2051
20462052   case 0x2a:
20472053      if ( style==0 )
20482054         thom_set_video_mode( THOM_VMODE_80_TO9 );
r31952r31953
21102116      color = m_to9_palette_data[ 2 * idx + 1 ];
21112117      color = m_to9_palette_data[ 2 * idx ] | (color << 8);
21122118      thom_set_palette( idx ^ 8, color & 0x1fff );
2113
21142119      m_to9_palette_idx = ( m_to9_palette_idx + 1 ) & 31;
21152120   }
21162121   break;
trunk/src/mess/includes/thomson.h
r31952r31953
259259   void to9_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len );
260260   void bitmap4_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len );
261261   void bitmap4alt_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len );
262   void bitmap4althalf_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len );
262263   void bitmap16_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len );
263264   void mode80_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len );
264265   void mode80_to9_scandraw_16( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len );
r31952r31953
271272   void to9_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len );
272273   void bitmap4_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len );
273274   void bitmap4alt_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len );
275   void bitmap4althalf_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len );
274276   void bitmap16_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len );
275277   void mode80_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len );
276278   void mode80_to9_scandraw_8( UINT8* vram, UINT16* dst, UINT16* pal, int org, int len );
r31952r31953
306308   WRITE_LINE_MEMBER( fdc_index_3_w );
307309   void thomson_index_callback(legacy_floppy_image_device *device, int state);
308310   DECLARE_PALETTE_INIT(thom);
311   DECLARE_PALETTE_INIT(mo5);
309312
310313   optional_device<mc6854_device> m_mc6854;
311314
r31952r31953
519522   void thom_set_mode_point( int point );
520523   void thom_floppy_active( int write );
521524   unsigned to7_lightpen_gpl( int decx, int decy );
525   void thom_configure_palette( double gamma, const UINT16* pal, palette_device& palette );
522526
523527   int thom_floppy_make_addr( chrn_id id, UINT8* dst, int sector_size );
524528   int thom_floppy_make_sector( legacy_floppy_image_device* img, chrn_id id, UINT8* dst, int sector_size );
r31952r31953
602606#define THOM_VMODE_OVERLAY3    9
603607#define THOM_VMODE_TO9        10
604608#define THOM_VMODE_80_TO9     11
605#define THOM_VMODE_NB         12
609#define THOM_VMODE_BITMAP4_ALT_HALF 12
610#define THOM_VMODE_NB         13
606611
607612
608613class to7_io_line_device : public device_t
trunk/src/mess/video/thomson.c
r31952r31953
495495END_UPDATE
496496
497497
498/* 160x200, 4 colors, no constraint, using only one memory page (undocumented) */
498499
500UPDATE_HI( bitmap4althalf )
501{
502   dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = pal[ rama >> 6 ];
503   dst[ 4] = dst[ 5] = dst[ 6] = dst[ 7] = pal[ (rama >> 4) & 3 ];
504   dst[ 8] = dst[ 9] = dst[10] = dst[11] = pal[ (rama >> 2) & 3];
505   dst[12] = dst[13] = dst[14] = dst[15] = pal[ rama & 3 ];
506   (void)ramb; // ramb is not used
507}
508END_UPDATE
509
510UPDATE_LOW( bitmap4althalf )
511{
512   dst[0] = dst[1] = pal[ rama >> 6 ];
513   dst[2] = dst[3] = pal[ (rama >> 4) & 3 ];
514   dst[4] = dst[5] = pal[ (rama >> 2) & 3];
515   dst[6] = dst[7] = pal[ rama & 3 ];
516   (void)ramb; // ramb is not used
517}
518END_UPDATE
519
520
521
499522/* 160x200, 16-colors, no constraint */
500523
501524UPDATE_HI( bitmap16 )
r31952r31953
702725   FUN(to770),    FUN(mo5),    FUN(bitmap4), FUN(bitmap4alt),  FUN(mode80),
703726   FUN(bitmap16), FUN(page1),  FUN(page2),   FUN(overlay),     FUN(overlay3),
704727   FUN(to9), FUN(mode80_to9),
728        FUN(bitmap4althalf),
705729};
706730
707731
r31952r31953
10021026/* -------------- initialization --------------- */
10031027
10041028
1005
1029/* TO7, TO7/70 palette, hardcoded in ROM
1030   without further information, we assume that the hardcoded values
1031   are the same as those setup by the TO8/TO9+/MO6 when booting up
1032 */
10061033static const UINT16 thom_pal_init[16] =
10071034{
10081035   0x1000, /* 0: black */        0x000f, /* 1: red */
r31952r31953
10121039   0x0777, /* 8: gray */         0x033a, /* 9: pink */
10131040   0x03a3, /* a: light green */  0x03aa, /* b: light yellow */
10141041   0x0a33, /* c: light blue */   0x0a3a, /* d: redish pink */
1015   0x0ee7, /* e: light cyan */   0x003b, /* f: orange */
1042   0x0ee7, /* e: light cyan */   0x007b, /* f: orange */
10161043};
10171044
1045/* MO5 palette, hardcoded in a ROM
1046   values are from "Manuel Technique du MO5", p.19
1047 */
1048static const UINT16 mo5_pal_init[16] =
1049{
1050   0x1000, /* 0: black */        0x055f, /* 1: red */
1051   0x00f0, /* 2: geen */         0x00ff, /* 3: yellow */
1052   0x0f55, /* 4: blue */         0x0f0f, /* 5: purple */
1053   0x0ff5, /* 6: cyan */         0x0fff, /* 7: white */
1054   0x0aaa, /* 8: gray */         0x0aaf, /* 9: pink */
1055   0x0afa, /* a: light green */  0x0aff, /* b: light yellow */
1056   0x0fa5, /* c: light blue */   0x0faf, /* d: parama pink */
1057   0x0ffa, /* e: light cyan */   0x05af, /* f: orange */
1058};
10181059
10191060
10201061VIDEO_START_MEMBER( thomson_state, thom )
r31952r31953
10221063   LOG (( "thom: video start called\n" ));
10231064
10241065   /* scan-line state */
1025   memcpy( m_thom_last_pal, thom_pal_init, 32 );
1026   memcpy( m_thom_pal, thom_pal_init, 32 );
10271066   memset( m_thom_border_l, 0xff, sizeof( m_thom_border_l ) );
10281067   memset( m_thom_border_r, 0xff, sizeof( m_thom_border_r ) );
10291068   memset( m_thom_vbody, 0, sizeof( m_thom_vbody ) );
r31952r31953
10821121}
10831122
10841123
1085
1086PALETTE_INIT_MEMBER(thomson_state, thom)
1124/* sets the fixed palette (for MO5,TO7,TO7/70) and gamma correction */
1125void thomson_state::thom_configure_palette(double gamma, const UINT16* pal, palette_device& palette)
10871126{
1088   double gamma = 0.6f;
1089   unsigned i;
1127   memcpy( m_thom_last_pal, pal, 32 );
1128   memcpy( m_thom_pal, pal, 32 );
10901129
1091   LOG (( "thom: palette init called\n" ));
1092
1093   for ( i = 0; i < 4097; i++ )
1130   for ( int i = 0; i < 4097; i++ )
10941131   {
10951132      UINT8 r = 255. * pow( (i & 15) / 15., gamma );
10961133      UINT8 g = 255. * pow( ((i>> 4) & 15) / 15., gamma );
r31952r31953
11011138}
11021139
11031140
1141PALETTE_INIT_MEMBER(thomson_state, thom)
1142{
1143   LOG (( "thom: palette init called\n" ));
11041144
1145        /* TO8 and later use an EF9369 color palette chip
1146           The spec shows a built-in gamma correction for gamma=2.8
1147           i.e., output is out = in ^ (1/2.8)
1148
1149           For the TO7, the gamma correction is irrelevant.
1150           
1151           For the TO7/70, we use the same palette and gamma has the TO8,
1152           which gives good results (but is not verified).
1153         */
1154        thom_configure_palette(1.0 / 2.8, thom_pal_init, palette);
1155}
1156
1157PALETTE_INIT_MEMBER(thomson_state, mo5)
1158{
1159   LOG (( "thom: MO5 palette init called\n" ));
1160
1161        /* The MO5 has a different fixed palette than the TO7/70.
1162           We use a smaller gamma correction which gives intutively better
1163           results (but is not verified).
1164         */
1165        thom_configure_palette(1.0, mo5_pal_init, palette);
1166}
1167
1168
1169
11051170/***************************** TO7 / T9000 *************************/
11061171
11071172
trunk/src/mess/drivers/thomson.c
r31952r31953
10911091
10921092   MCFG_DEVICE_REMOVE( "mc6846" )
10931093
1094       MCFG_PALETTE_MODIFY( "palette" )
1095   MCFG_PALETTE_INIT_OWNER(thomson_state, mo5)
1096
10941097   MCFG_DEVICE_MODIFY(THOM_PIA_SYS)
10951098   MCFG_PIA_READPA_HANDLER(READ8(thomson_state, mo5_sys_porta_in))
10961099   MCFG_PIA_READPB_HANDLER(READ8(thomson_state, mo5_sys_portb_in))

Previous 199869 Revisions Next


© 1997-2024 The MAME Team