Previous 15994 Revisions Next

r5916 Tuesday 29th September, 2009 at 17:52:53 UTC by Harmony
Added mouse button support and rudimentary plane blending. CD-i's initial menus are navigable with text. [Harmony]
[src/mess/drivers]cdi.c

src/mess/drivers/cdi.c
r5915r5916
891891static READ16_HANDLER( slave_r )
892892{
893893   static UINT32 return_count = 0;
894   verboselog(space->machine, 0, "slave_r: UNIMPLEMENTED: Unknown address: %04x & %04x\n", offset*2, mem_mask);
894   if(offset != 0x00 || slave_register != 0xf7)
895   {
896      verboselog(space->machine, 0, "slave_r: UNIMPLEMENTED: Unknown address: %04x & %04x\n", offset*2, mem_mask);
897   }
895898   if(offset == 0x00)
896899   {
897900      switch(slave_register)
r5915r5916
901904            static UINT16 x = 0;
902905            static UINT16 y = 0;
903906            static UINT8 bytes[4] = { 0, 0, 0, 0 };
907            static UINT8 buttons = 0;
908            static UINT8 old_buttons = 0;
904909            return_count %= 4;
905910            if(return_count == 0)
906911            {
912               UINT8 button_up = 0;
913               UINT8 button_down = 0;
914               old_buttons = buttons;
915               buttons = input_port_read(space->machine, "MOUSEBTN");
916               button_down = buttons &~ old_buttons;
917               button_up = old_buttons &~ buttons;
907918               x = input_port_read(space->machine, "MOUSEX");
908919               y = input_port_read(space->machine, "MOUSEY");
909               bytes[0] = (x & 0x380) >> 7;
920               bytes[0] = ((x & 0x380) >> 7);
910921               bytes[1] = x & 0x7f;
911922               bytes[2] = (y & 0x380) >> 7;
912923               bytes[3] = y & 0x7f;
924               if(button_up)
925               {
926                  bytes[0] |= (buttons << 4) | 0x08;
927               }
928               else
929               {
930                  bytes[0] |= buttons << 4;
931               }
913932            }
914933            return bytes[return_count++];
915934         }
r5915r5916
974993
975994static WRITE16_HANDLER( slave_w )
976995{
977   verboselog(space->machine, 0, "slave_w: UNIMPLEMENTED: Unknown address: %04x = %04x & %04x\n", offset*2, data, mem_mask);
996   if(offset != 0x00)
997   {
998      verboselog(space->machine, 0, "slave_w: UNIMPLEMENTED: Unknown address: %04x = %04x & %04x\n", offset*2, data, mem_mask);
999   }
9781000   if(offset == 0x00)
9791001   {
9801002      if(ACCESSING_BITS_0_7)
r5915r5916
11131135
11141136mcd212_t mcd212;
11151137
1116#define MCD212_CURCNT_COLOR      0x00000f   // Cursor color
1117#define MCD212_CURCNT_CUW      0x008000   // Cursor width
1118#define MCD212_CURCNT_COF      0x070000   // Cursor off time
1119#define MCD212_CURCNT_COF_SHIFT   16
1120#define MCD212_CURCNT_CON      0x280000   // Cursor on time
1121#define MCD212_CURCNT_CON_SHIFT   19
1122#define MCD212_CURCNT_BLKC      0x400000   // Blink type
1123#define MCD212_CURCNT_EN      0x800000   // Cursor enable
1138#define MCD212_CURCNT_COLOR         0x00000f   // Cursor color
1139#define MCD212_CURCNT_CUW         0x008000   // Cursor width
1140#define MCD212_CURCNT_COF         0x070000   // Cursor off time
1141#define MCD212_CURCNT_COF_SHIFT      16
1142#define MCD212_CURCNT_CON         0x280000   // Cursor on time
1143#define MCD212_CURCNT_CON_SHIFT      19
1144#define MCD212_CURCNT_BLKC         0x400000   // Blink type
1145#define MCD212_CURCNT_EN         0x800000   // Cursor enable
11241146
1125#define MCD212_CSR2R_IT1      0x0004   // Interrupt 1
1126#define MCD212_CSR2R_IT2      0x0002   // Interrupt 2
1127#define MCD212_CSR2R_BE         0x0001   // Bus Error
1147#define MCD212_TCR_DISABLE_MX      0x800000   // Mix disable
1148#define MCD212_TCR_TB            0x000f00   // Plane B
1149#define MCD212_TCR_TB_SHIFT         8
1150#define MCD212_TCR_TA            0x00000f   // Plane A
1151#define MCD212_TCR_COND_1         0x0         // Transparent if: Always (Plane Disabled)
1152#define MCD212_TCR_COND_KEY_1      0x1         // Transparent if: Color Key = True
1153#define MCD212_TCR_COND_XLU_1      0x2         // Transparent if: Transparency Bit = 1
1154#define MCD212_TCR_COND_RF0_1      0x3         // Transparent if: Region Flag 0 = True
1155#define MCD212_TCR_COND_RF1_1      0x4         // Transparent if: Region Flag 1 = True
1156#define MCD212_TCR_COND_RF0KEY_1   0x5         // Transparent if: Region Flag 0 = True || Color Key = True
1157#define MCD212_TCR_COND_RF1KEY_1   0x6         // Transparent if: Region Flag 1 = True || Color Key = True
1158#define MCD212_TCR_COND_UNUSED0      0x7         // Unused
1159#define MCD212_TCR_COND_0         0x8         // Transparent if: Never (No Transparent Area)
1160#define MCD212_TCR_COND_KEY_0      0x9         // Transparent if: Color Key = False
1161#define MCD212_TCR_COND_XLU_0      0xa         // Transparent if: Transparency Bit = 0
1162#define MCD212_TCR_COND_RF0_0      0xb         // Transparent if: Region Flag 0 = False
1163#define MCD212_TCR_COND_RF1_0      0xc         // Transparent if: Region Flag 1 = False
1164#define MCD212_TCR_COND_RF0KEY_0   0xd         // Transparent if: Region Flag 0 = False && Color Key = False
1165#define MCD212_TCR_COND_RF1KEY_0   0xe         // Transparent if: Region Flag 1 = False && Color Key = False
1166#define MCD212_TCR_COND_UNUSED1      0xf         // Unused
11281167
1129#define MCD212_DCR_DE         0x8000   // Display Enable
1130#define MCD212_DCR_CF         0x4000   // Crystal Frequency
1131#define MCD212_DCR_FD         0x2000   // Frame Duration
1132#define MCD212_DCR_SM         0x1000   // Scan Mode
1133#define MCD212_DCR_CM         0x0800   // Color Mode Ch.1/2
1134#define MCD212_DCR_ICA         0x0200   // ICA Enable Ch.1/2
1135#define MCD212_DCR_DCA         0x0100   // DCA Enable Ch.1/2
1168#define MCD212_POR_AB            0         // Plane A in front of Plane B
1169#define MCD212_POR_BA            1         // Plane B in front of Plane A
11361170
1137#define MCD212_DDR_FT         0x0300   // Display File Type
1138#define MCD212_DDR_FT_BMP      0x0000   // Bitmap
1139#define MCD212_DDR_FT_BMP2      0x0100   // Bitmap (alt.)
1140#define MCD212_DDR_FT_RLE      0x0200   // Run-Length Encoded
1141#define MCD212_DDR_FT_MOSAIC   0x0300   // Mosaic
1171#define MCD212_CSR2R_IT1         0x0004   // Interrupt 1
1172#define MCD212_CSR2R_IT2         0x0002   // Interrupt 2
1173#define MCD212_CSR2R_BE            0x0001   // Bus Error
11421174
1175#define MCD212_DCR_DE            0x8000   // Display Enable
1176#define MCD212_DCR_CF            0x4000   // Crystal Frequency
1177#define MCD212_DCR_FD            0x2000   // Frame Duration
1178#define MCD212_DCR_SM            0x1000   // Scan Mode
1179#define MCD212_DCR_CM            0x0800   // Color Mode Ch.1/2
1180#define MCD212_DCR_ICA            0x0200   // ICA Enable Ch.1/2
1181#define MCD212_DCR_DCA            0x0100   // DCA Enable Ch.1/2
1182
1183#define MCD212_DDR_FT            0x0300   // Display File Type
1184#define MCD212_DDR_FT_BMP         0x0000   // Bitmap
1185#define MCD212_DDR_FT_BMP2         0x0100   // Bitmap (alt.)
1186#define MCD212_DDR_FT_RLE         0x0200   // Run-Length Encoded
1187#define MCD212_DDR_FT_MOSAIC      0x0300   // Mosaic
1188
11431189static READ16_HANDLER(mcd212_r)
11441190{
11451191   UINT8 channel = 1 - (offset / 8);
r5915r5916
11491195      case 0x10/2:
11501196         if(ACCESSING_BITS_0_7)
11511197         {
1152            verboselog(space->machine, 11, "mcd212_r: Status Register %d: %02x & %04x\n", channel + 1, mcd212.channel[1 - (offset / 8)].csrr, mem_mask);
1198            verboselog(space->machine, channel ? 0 : 11, "mcd212_r: Status Register %d: %02x & %04x\n", channel + 1, mcd212.channel[1 - (offset / 8)].csrr, mem_mask);
11531199            if(channel == 0)
11541200            {
11551201               return mcd212.channel[0].csrr | 0x20;
r5915r5916
12571303      case 0xc0: // Image Coding Method
12581304         if(channel == 0)
12591305         {
1260            verboselog(machine, 11, "          %04xxxxx: %d: Image Coding Method = %08x\n", channel * 0x20, channel, value );
1306            verboselog(machine, 0, "          %04xxxxx: %d: Image Coding Method = %08x\n", channel * 0x20, channel, value );
12611307            mcd212.channel[channel].image_coding_method = value;
12621308         }
12631309         break;
12641310      case 0xc1: // Transparency Control
12651311         if(channel == 0)
12661312         {
1267            verboselog(machine, 11, "          %04xxxxx: %d: Transparency Control = %08x\n", channel * 0x20, channel, value );
1313            verboselog(machine, 0, "          %04xxxxx: %d: Transparency Control = %08x\n", channel * 0x20, channel, value );
12681314            mcd212.channel[channel].transparency_control = value;
12691315         }
12701316         break;
12711317      case 0xc2: // Plane Order
12721318         if(channel == 0)
12731319         {
1274            verboselog(machine, 11, "          %04xxxxx: %d: Plane Order = %08x\n", channel * 0x20, channel, value & 7);
1320            verboselog(machine, 0, "          %04xxxxx: %d: Plane Order = %08x\n", channel * 0x20, channel, value & 7);
12751321            mcd212.channel[channel].plane_order = value & 0x00000007;
12761322         }
12771323         break;
12781324      case 0xc3: // CLUT Bank Register
1279         verboselog(machine, 11, "          %04xxxxx: %d: CLUT Bank Register = %08x\n", channel * 0x20, channel, value & 3);
1325         verboselog(machine, 0, "          %04xxxxx: %d: CLUT Bank Register = %08x\n", channel * 0x20, channel, value & 3);
12801326         mcd212.channel[channel].clut_bank = value & 0x00000003;
12811327         break;
12821328      case 0xc4: // Transparent Color A
12831329         if(channel == 0)
12841330         {
1285            verboselog(machine, 11, "          %04xxxxx: %d: Transparent Color A = %08x\n", channel * 0x20, channel, value );
1331            verboselog(machine, 0, "          %04xxxxx: %d: Transparent Color A = %08x\n", channel * 0x20, channel, value );
12861332            mcd212.channel[channel].transparent_color_a = value;
12871333         }
12881334         break;
12891335      case 0xc6: // Transparent Color B
12901336         if(channel == 1)
12911337         {
1292            verboselog(machine, 11, "          %04xxxxx: %d: Transparent Color B = %08x\n", channel * 0x20, channel, value );
1338            verboselog(machine, 0, "          %04xxxxx: %d: Transparent Color B = %08x\n", channel * 0x20, channel, value );
12931339            mcd212.channel[channel].transparent_color_b = value;
12941340         }
12951341         break;
12961342      case 0xc7: // Mask Color A
12971343         if(channel == 0)
12981344         {
1299            verboselog(machine, 11, "          %04xxxxx: %d: Mask Color A = %08x\n", channel * 0x20, channel, value );
1345            verboselog(machine, 0, "          %04xxxxx: %d: Mask Color A = %08x\n", channel * 0x20, channel, value );
13001346            mcd212.channel[channel].mask_color_a = value;
13011347         }
13021348         break;
13031349      case 0xc9: // Mask Color B
13041350         if(channel == 1)
13051351         {
1306            verboselog(machine, 11, "          %04xxxxx: %d: Mask Color B = %08x\n", channel * 0x20, channel, value );
1352            verboselog(machine, 0, "          %04xxxxx: %d: Mask Color B = %08x\n", channel * 0x20, channel, value );
13071353            mcd212.channel[channel].mask_color_b = value;
13081354         }
13091355         break;
13101356      case 0xca: // Delta YUV Absolute Start Value A
13111357         if(channel == 0)
13121358         {
1313            verboselog(machine, 11, "          %04xxxxx: %d: Delta YUV Absolute Start Value A = %08x\n", channel * 0x20, channel, value );
1359            verboselog(machine, 0, "          %04xxxxx: %d: Delta YUV Absolute Start Value A = %08x\n", channel * 0x20, channel, value );
13141360            mcd212.channel[channel].dyuv_abs_start_a = value;
13151361         }
13161362         break;
13171363      case 0xcb: // Delta YUV Absolute Start Value B
13181364         if(channel == 1)
13191365         {
1320            verboselog(machine, 11, "          %04xxxxx: %d: Delta YUV Absolute Start Value B = %08x\n", channel * 0x20, channel, value );
1366            verboselog(machine, 0, "          %04xxxxx: %d: Delta YUV Absolute Start Value B = %08x\n", channel * 0x20, channel, value );
13211367            mcd212.channel[channel].dyuv_abs_start_b = value;
13221368         }
13231369         break;
13241370      case 0xcd: // Cursor Position
13251371         if(channel == 0)
13261372         {
1327            verboselog(machine, 6, "          %04xxxxx: %d: Cursor Position = %08x\n", channel * 0x20, channel, value );
1373            verboselog(machine, 11, "          %04xxxxx: %d: Cursor Position = %08x\n", channel * 0x20, channel, value );
13281374            mcd212.channel[channel].cursor_position = value;
13291375         }
13301376         break;
r5915r5916
13501396      case 0xd5:
13511397      case 0xd6:
13521398      case 0xd7:
1353         verboselog(machine, 11, "          %04xxxxx: %d: Region Control %d = %08x\n", channel * 0x20, channel, reg & 7, value );
1399         verboselog(machine, 0, "          %04xxxxx: %d: Region Control %d = %08x\n", channel * 0x20, channel, reg & 7, value );
13541400         mcd212.channel[channel].region_control[reg & 7] = value;
13551401         break;
13561402      case 0xd8: // Backdrop Color
13571403         if(channel == 0)
13581404         {
1359            verboselog(machine, 11, "          %04xxxxx: %d: Backdrop Color = %08x\n", channel * 0x20, channel, value );
1405            verboselog(machine, 0, "          %04xxxxx: %d: Backdrop Color = %08x\n", channel * 0x20, channel, value );
13601406            mcd212.channel[channel].backdrop_color = value;
13611407         }
13621408         break;
13631409      case 0xd9: // Mosaic Pixel Hold Factor A
13641410         if(channel == 0)
13651411         {
1366            verboselog(machine, 11, "          %04xxxxx: %d: Mosaic Pixel Hold Factor A = %08x\n", channel * 0x20, channel, value );
1412            verboselog(machine, 0, "          %04xxxxx: %d: Mosaic Pixel Hold Factor A = %08x\n", channel * 0x20, channel, value );
13671413            mcd212.channel[channel].mosaic_hold_a = value;
13681414         }
13691415         break;
13701416      case 0xda: // Mosaic Pixel Hold Factor B
13711417         if(channel == 1)
13721418         {
1373            verboselog(machine, 11, "          %04xxxxx: %d: Mosaic Pixel Hold Factor B = %08x\n", channel * 0x20, channel, value );
1419            verboselog(machine, 0, "          %04xxxxx: %d: Mosaic Pixel Hold Factor B = %08x\n", channel * 0x20, channel, value );
13741420            mcd212.channel[channel].mosaic_hold_b = value;
13751421         }
13761422         break;
13771423      case 0xdb: // Weight Factor A
13781424         if(channel == 0)
13791425         {
1380            verboselog(machine, 11, "          %04xxxxx: %d: Weight Factor A = %08x\n", channel * 0x20, channel, value );
1426            verboselog(machine, 0, "          %04xxxxx: %d: Weight Factor A = %08x\n", channel * 0x20, channel, value );
13811427            mcd212.channel[channel].weight_factor_a = value;
13821428         }
13831429         break;
13841430      case 0xdc: // Weight Factor B
13851431         if(channel == 1)
13861432         {
1387            verboselog(machine, 11, "          %04xxxxx: %d: Weight Factor B = %08x\n", channel * 0x20, channel, value );
1433            verboselog(machine, 0, "          %04xxxxx: %d: Weight Factor B = %08x\n", channel * 0x20, channel, value );
13881434            mcd212.channel[channel].weight_factor_b = value;
13891435         }
13901436         break;
r5915r5916
14371483      {
14381484         case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07:   // STOP
14391485         case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f:
1440            verboselog(machine, 11, "%08x: %08x: ICA %d: STOP\n", addr * 2 + channel * 0x200000, cmd, channel );
1486            verboselog(machine, channel ? 0 : 11, "%08x: %08x: ICA %d: STOP\n", addr * 2 + channel * 0x200000, cmd, channel );
14411487            stop = 1;
14421488            break;
14431489         case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17: // NOP
r5915r5916
14461492            break;
14471493         case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27: // RELOAD DCP
14481494         case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e: case 0x2f:
1449            verboselog(machine, 11, "%08x: %08x: ICA %d: RELOAD DCP\n", addr * 2 + channel * 0x200000, cmd, channel );
1495            verboselog(machine, channel ? 0 : 11, "%08x: %08x: ICA %d: RELOAD DCP\n", addr * 2 + channel * 0x200000, cmd, channel );
14501496            mcd212_set_dcp(channel, cmd & 0x001fffff);
14511497            break;
14521498         case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: // RELOAD DCP and STOP
14531499         case 0x38: case 0x39: case 0x3a: case 0x3b: case 0x3c: case 0x3d: case 0x3e: case 0x3f:
1454            verboselog(machine, 11, "%08x: %08x: ICA %d: RELOAD DCP and STOP\n", addr * 2 + channel * 0x200000, cmd, channel );
1500            verboselog(machine, channel ? 0 : 11, "%08x: %08x: ICA %d: RELOAD DCP and STOP\n", addr * 2 + channel * 0x200000, cmd, channel );
14551501            mcd212_set_dcp(channel, cmd & 0x001fffff);
14561502            stop = 1;
14571503            break;
14581504         case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x45: case 0x46: case 0x47: // RELOAD ICA
14591505         case 0x48: case 0x49: case 0x4a: case 0x4b: case 0x4c: case 0x4d: case 0x4e: case 0x4f:
1460            verboselog(machine, 11, "%08x: %08x: ICA %d: RELOAD ICA\n", addr * 2 + channel * 0x200000, cmd, channel );
1506            verboselog(machine, channel ? 0 : 11, "%08x: %08x: ICA %d: RELOAD ICA\n", addr * 2 + channel * 0x200000, cmd, channel );
14611507            addr = (cmd & 0x001fffff) / 2;
14621508            break;
14631509         case 0x50: case 0x51: case 0x52: case 0x53: case 0x54: case 0x55: case 0x56: case 0x57: // RELOAD VSR and STOP
14641510         case 0x58: case 0x59: case 0x5a: case 0x5b: case 0x5c: case 0x5d: case 0x5e: case 0x5f:
1465            verboselog(machine, 11, "%08x: %08x: ICA %d: RELOAD VSR and STOP\n", addr * 2 + channel * 0x200000, cmd, channel );
1511            verboselog(machine, channel ? 0 : 11, "%08x: %08x: ICA %d: RELOAD VSR and STOP\n", addr * 2 + channel * 0x200000, cmd, channel );
14661512            mcd212_set_vsr(channel, cmd & 0x001fffff);
14671513            stop = 1;
14681514            break;
14691515         case 0x60: case 0x61: case 0x62: case 0x63: case 0x64: case 0x65: case 0x66: case 0x67: // INTERRUPT
14701516         case 0x68: case 0x69: case 0x6a: case 0x6b: case 0x6c: case 0x6d: case 0x6e: case 0x6f:
1471            verboselog(machine, 11, "%08x: %08x: ICA %d: INTERRUPT\n", addr * 2 + channel * 0x200000, cmd, channel );
1517            verboselog(machine, channel ? 0 : 11, "%08x: %08x: ICA %d: INTERRUPT\n", addr * 2 + channel * 0x200000, cmd, channel );
14721518            mcd212.channel[1].csrr |= 1 << (2 - channel);
14731519            if(mcd212.channel[1].csrr & MCD212_CSR2R_IT1)
14741520            {
14751521               UINT8 interrupt = (scc68070_regs.lir >> 4) & 7;
14761522               if(interrupt)
14771523               {
1478                  verboselog(machine, 4, "Flagging interrupt 1, line %d\n", interrupt );
14791524                  cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), M68K_IRQ_1 + (interrupt - 1), 56 + interrupt);
14801525                  cputag_set_input_line(machine, "maincpu", M68K_IRQ_1 + (interrupt - 1), ASSERT_LINE);
14811526               }
r5915r5916
14851530               UINT8 interrupt = scc68070_regs.lir & 7;
14861531               if(interrupt)
14871532               {
1488                  verboselog(machine, 4, "Flagging interrupt 2, line %d\n", interrupt );
14891533                  cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), M68K_IRQ_1 + (interrupt - 1), 24 + interrupt);
14901534                  cputag_set_input_line(machine, "maincpu", M68K_IRQ_1 + (interrupt - 1), ASSERT_LINE);
14911535               }
14921536            }
14931537            break;
14941538         case 0x78: case 0x79: case 0x7a: case 0x7b: case 0x7c: case 0x7d: case 0x7e: case 0x7f: // RELOAD DISPLAY PARAMETERS
1495            verboselog(machine, 11, "%08x: %08x: ICA %d: RELOAD DISPLAY PARAMETERS\n", addr * 2 + channel * 0x200000, cmd, channel );
1539            verboselog(machine, channel ? 0 : 11, "%08x: %08x: ICA %d: RELOAD DISPLAY PARAMETERS\n", addr * 2 + channel * 0x200000, cmd, channel );
14961540            mcd212_set_display_parameters(channel, cmd & 0x1f);
14971541            break;
14981542         default:
r5915r5916
15231567      {
15241568         case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07:   // STOP
15251569         case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f:
1526            verboselog(machine, 11, "%08x: %08x: DCA %d: STOP\n", addr * 2 + channel * 0x200000, cmd, channel );
1570            verboselog(machine, channel ? 0 : 11, "%08x: %08x: DCA %d: STOP\n", addr * 2 + channel * 0x200000, cmd, channel );
15271571            stop = 1;
15281572            break;
15291573         case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17: // NOP
r5915r5916
15321576            break;
15331577         case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27: // RELOAD DCP
15341578         case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e: case 0x2f:
1535            verboselog(machine, 11, "%08x: %08x: DCA %d: RELOAD DCP (NOP)\n", addr * 2 + channel * 0x200000, cmd, channel );
1579            verboselog(machine, channel ? 0 : 11, "%08x: %08x: DCA %d: RELOAD DCP (NOP)\n", addr * 2 + channel * 0x200000, cmd, channel );
15361580            break;
15371581         case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: // RELOAD DCP and STOP
15381582         case 0x38: case 0x39: case 0x3a: case 0x3b: case 0x3c: case 0x3d: case 0x3e: case 0x3f:
1539            verboselog(machine, 11, "%08x: %08x: DCA %d: RELOAD DCP and STOP\n", addr * 2 + channel * 0x200000, cmd, channel );
1583            verboselog(machine, channel ? 0 : 11, "%08x: %08x: DCA %d: RELOAD DCP and STOP\n", addr * 2 + channel * 0x200000, cmd, channel );
15401584            mcd212_set_dcp(channel, cmd & 0x001fffff);
15411585            stop = 1;
15421586            break;
15431587         case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x45: case 0x46: case 0x47: // RELOAD VSR
15441588         case 0x48: case 0x49: case 0x4a: case 0x4b: case 0x4c: case 0x4d: case 0x4e: case 0x4f:
1545            verboselog(machine, 11, "%08x: %08x: DCA %d: RELOAD VSR\n", addr * 2 + channel * 0x200000, cmd, channel );
1589            verboselog(machine, channel ? 0 : 11, "%08x: %08x: DCA %d: RELOAD VSR\n", addr * 2 + channel * 0x200000, cmd, channel );
15461590            mcd212_set_vsr(channel, cmd & 0x001fffff);
15471591            break;
15481592         case 0x50: case 0x51: case 0x52: case 0x53: case 0x54: case 0x55: case 0x56: case 0x57: // RELOAD VSR and STOP
15491593         case 0x58: case 0x59: case 0x5a: case 0x5b: case 0x5c: case 0x5d: case 0x5e: case 0x5f:
1550            verboselog(machine, 11, "%08x: %08x: DCA %d: RELOAD VSR and STOP\n", addr * 2 + channel * 0x200000, cmd, channel );
1594            verboselog(machine, channel ? 0 : 11, "%08x: %08x: DCA %d: RELOAD VSR and STOP\n", addr * 2 + channel * 0x200000, cmd, channel );
15511595            mcd212_set_vsr(channel, cmd & 0x001fffff);
15521596            stop = 1;
15531597            break;
15541598         case 0x60: case 0x61: case 0x62: case 0x63: case 0x64: case 0x65: case 0x66: case 0x67: // INTERRUPT
15551599         case 0x68: case 0x69: case 0x6a: case 0x6b: case 0x6c: case 0x6d: case 0x6e: case 0x6f:
1556            verboselog(machine, 11, "%08x: %08x: DCA %d: INTERRUPT\n", addr * 2 + channel * 0x200000, cmd, channel );
1600            verboselog(machine, channel ? 0 : 11, "%08x: %08x: DCA %d: INTERRUPT\n", addr * 2 + channel * 0x200000, cmd, channel );
15571601            mcd212.channel[1].csrr |= 1 << (2 - channel);
15581602            if(mcd212.channel[1].csrr & MCD212_CSR2R_IT1)
15591603            {
r5915r5916
15751619            }
15761620            break;
15771621         case 0x78: case 0x79: case 0x7a: case 0x7b: case 0x7c: case 0x7d: case 0x7e: case 0x7f: // RELOAD DISPLAY PARAMETERS
1578            verboselog(machine, 11, "%08x: %08x: DCA %d: RELOAD DISPLAY PARAMETERS\n", addr * 2 + channel * 0x200000, cmd, channel );
1622            verboselog(machine, channel ? 0 : 11, "%08x: %08x: DCA %d: RELOAD DISPLAY PARAMETERS\n", addr * 2 + channel * 0x200000, cmd, channel );
15791623            mcd212_set_display_parameters(channel, cmd & 0x1f);
15801624            break;
15811625         default:
r5915r5916
16841728               // 8-bit Bitmap
16851729               for(; x < 768; x++)
16861730               {
1687                  pixels[x++] = mcd212.channel[channel].clut[byte];
1688                  pixels[x] = mcd212.channel[channel].clut[byte];
1731                  pixels[x++] = mcd212.channel[channel].clut[((channel == 1) ? 0x80 : 0x00) + (byte & 0x7f)];
1732                  pixels[x] = mcd212.channel[channel].clut[((channel == 1) ? 0x80 : 0x00) + (byte & 0x7f)];
16891733                  byte = data[vsr++ ^ 1];
16901734               }
1735               mcd212_set_vsr(channel, vsr - 1);
16911736            }
16921737            done = 1;
16931738            break;
r5915r5916
17131758                     // Go to the end of the line
17141759                     for(; x < 768; x++)
17151760                     {
1716                        pixels[x++] = mcd212.channel[channel].clut[byte & 0x7f];
1717                        pixels[x] = mcd212.channel[channel].clut[byte & 0x7f];
1761                        pixels[x++] = mcd212.channel[channel].clut[((channel == 1) ? 0x80 : 0x00) + (byte & 0x7f)];
1762                        pixels[x] = mcd212.channel[channel].clut[((channel == 1) ? 0x80 : 0x00) + (byte & 0x7f)];
17181763                     }
17191764                     done = 1;
17201765                     mcd212_set_vsr(channel, vsr);
r5915r5916
18311876   }
18321877}
18331878
1879static void mcd212_mix_lines(running_machine *machine, UINT32 *plane_a, UINT32 *plane_b, UINT32 *out)
1880{
1881   int x = 0;
1882   UINT32 backdrop = 0;
1883   if(mcd212.channel[0].transparency_control != 0x800101)
1884   {
1885      verboselog(machine, 0, "Unhandled transparency control value for mixing, %08x, visual results may not be accurate\n", mcd212.channel[0].transparency_control);
1886   }
1887   switch(mcd212.channel[0].backdrop_color)
1888   {
1889      case 0x01:
1890         backdrop = 0x0000007f;
1891         break;
1892      case 0x02:
1893         backdrop = 0x00007f00;
1894         break;
1895      case 0x03:
1896         backdrop = 0x00007f7f;
1897         break;
1898      case 0x04:
1899         backdrop = 0x007f0000;
1900         break;
1901      case 0x05:
1902         backdrop = 0x007f007f;
1903         break;
1904      case 0x06:
1905         backdrop = 0x007f7f00;
1906         break;
1907      case 0x07:
1908         backdrop = 0x007f7f7f;
1909         break;
1910      case 0x09:
1911         backdrop = 0x000000ff;
1912         break;
1913      case 0x0a:
1914         backdrop = 0x0000ff00;
1915         break;
1916      case 0x0b:
1917         backdrop = 0x0000ffff;
1918         break;
1919      case 0x0c:
1920         backdrop = 0x00ff0000;
1921         break;
1922      case 0x0d:
1923         backdrop = 0x00ff00ff;
1924         break;
1925      case 0x0e:
1926         backdrop = 0x00ffff00;
1927         break;
1928      case 0x0f:
1929         backdrop = 0x00ffffff;
1930         break;
1931   }
1932   for(x = 0; x < 768; x++)
1933   {
1934      out[x] = backdrop;
1935      switch(mcd212.channel[0].plane_order)
1936      {
1937         case MCD212_POR_AB:
1938            if(plane_a[x] != mcd212.channel[0].transparent_color_a)
1939            {
1940               out[x] = plane_a[x];
1941            }
1942            else if(plane_b[x] != mcd212.channel[1].transparent_color_b)
1943            {
1944               out[x] = plane_b[x];
1945            }
1946            else
1947            break;
1948         case MCD212_POR_BA:
1949            if(plane_b[x] != mcd212.channel[1].transparent_color_b)
1950            {
1951               out[x] = plane_b[x];
1952            }
1953            else if(plane_a[x] != mcd212.channel[0].transparent_color_a)
1954            {
1955               out[x] = plane_a[x];
1956            }
1957            break;
1958      }
1959   }
1960}
1961
18341962static void mcd212_draw_scanline(running_machine *machine, int y)
18351963{
18361964   bitmap_t *bitmap = tmpbitmap;
18371965   UINT32 plane_a[768];
18381966   UINT32 plane_b[768];
1967   UINT32 out[768];
18391968   UINT32 *scanline = BITMAP_ADDR32(bitmap, y, 0);
18401969   int x;
18411970   mcd212_process_vsr(machine, 0, plane_a);
18421971   mcd212_process_vsr(machine, 1, plane_b);
1972   mcd212_mix_lines(machine, plane_a, plane_b, out);
18431973   for(x = 0; x < 768; x++)
18441974   {
1845      scanline[x] = plane_a[x];
1975      scanline[x] = out[x];
18461976   }
18471977   mcd212_draw_cursor(machine, scanline, y);
18481978}
r5915r5916
19712101
19722102   PORT_START("MOUSEY")
19732103   PORT_BIT(0x3ff, 0x000, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0)
2104
2105   PORT_START("MOUSEBTN")
2106   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_CODE(MOUSECODE_BUTTON2) PORT_NAME("Mouse Button 2")
2107   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_CODE(MOUSECODE_BUTTON1) PORT_NAME("Mouse Button 1")
2108   PORT_BIT(0xfc, IP_ACTIVE_HIGH, IPT_UNUSED)
19742109INPUT_PORTS_END
19752110
19762111static MACHINE_RESET( cdi )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team