Previous 199869 Revisions Next

r19304 Tuesday 4th December, 2012 at 03:53:27 UTC by Angelo Salese
Very preliminary 16 colors mode support
[src/mess/drivers]pc9801.c

trunk/src/mess/drivers/pc9801.c
r19303r19304
1010    - boot is too slow right now, might be due of the floppy / HDD devices
1111    - investigate on POR bit
1212    - Write a PC80S31K device (also used on PC-8801 and PC-88VA, it's the FDC + Z80 sub-system);
13   - Check for mouse support
14   - .FDI support, should be a standard raw image, but then it mis-match with the Western file format ...
15   - kanji support;
1316
1417    TODO (PC-9801RS):
1518    - floppy disk hook-up;
r19303r19304
2831    - Dies on ARTIC check;
2932    - Presumably one ROM is undumped?
3033
34   floppy issues TODO (certain fail, even with a stock F version)
35   - AdventureLand: "disk offline" error
36   - Dokkin Minako Sensei!
37   - Microsoft Windows 1.0 MSDOS.SYS error (can be bypassed by loading MS-DOS first)
38
39   List of per-game TODO:
40   - Dragon Buster: has lots of gfx artifacts;
41   - Far Side Moon: doesn't detect neither mouse nor sound board;
42   - First Queen: has broken text display;
43   - Flappy Plus: keyboard is unresponsive;
44   - Jan Borg Suzume: error text isn't shown;
45   - Jangou 2: floppy fails to load after the title screen;
46   - Lovely Horror: Doesn't show kanji, tries to read it thru the 0xa9 port;
47   - Okuman Chouja 2: needs 16 colors support;
48   - Quarth: should do a split screen effect, it doesn't hence there are broken gfxs
49   - Quarth: uploads a PCG charset
50   - Uchiyama Aki no Chou Bangai: half size gfxs, can't start (needs mouse)?
51   - Xenon 2 - Megablast: copyright isn't shown at device select;
52
3153========================================================================================
3254
3355    This series features a huge number of models released between 1982 and 1997. They
r19303r19304
324346      UINT8 pal_entry;
325347      UINT8 r[16],g[16],b[16];
326348   }m_analog16;
349   UINT8 m_support_16_colors;
327350
328351   /* PC9821 specific */
329352   UINT8 m_analog256,m_analog256e;
r19303r19304
366389   DECLARE_WRITE8_MEMBER(pc9801_tvram_w);
367390   DECLARE_READ8_MEMBER(pc9801_gvram_r);
368391   DECLARE_WRITE8_MEMBER(pc9801_gvram_w);
392//   DECLARE_READ8_MEMBER(pc9801rs_gvram_r);
393   DECLARE_WRITE8_MEMBER(pc9801rs_gvram_w);
369394   DECLARE_READ8_MEMBER(pc9801_opn_r);
370395   DECLARE_WRITE8_MEMBER(pc9801_opn_w);
371396   DECLARE_READ8_MEMBER(pc9801rs_wram_r);
r19303r19304
537562   int res_x,res_y;
538563   UINT8 pen;
539564   UINT8 interlace_on;
565   UINT8 colors16_mode;
540566
541567   if(state->m_video_ff[DISPLAY_REG] == 0) //screen is off
542568      return;
543569
544570   interlace_on = state->m_video_ff[INTERLACE_REG];
571   colors16_mode = (state->m_ex_video_ff[0] && state->m_support_16_colors) ? 16 : 8;
545572
546573   for(xi=0;xi<8;xi++)
547574   {
r19303r19304
551578      pen = ((state->m_video_ram_2[(address & 0x7fff) + (0x08000) + (state->m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 1 : 0;
552579      pen|= ((state->m_video_ram_2[(address & 0x7fff) + (0x10000) + (state->m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 2 : 0;
553580      pen|= ((state->m_video_ram_2[(address & 0x7fff) + (0x18000) + (state->m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 4 : 0;
581      if(state->m_ex_video_ff[0])
582         pen|= ((state->m_video_ram_2[(address & 0x7fff) + (0) + (state->m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 8 : 0;
554583
555584      if(interlace_on)
556585      {
557586         if(res_y*2+0 < 400)
558            bitmap.pix16(res_y*2+0, res_x) = pen + 8;
587            bitmap.pix16(res_y*2+0, res_x) = pen + colors16_mode;
559588         if(res_y*2+1 < 400)
560            bitmap.pix16(res_y*2+1, res_x) = pen + 8;
589            bitmap.pix16(res_y*2+1, res_x) = pen + colors16_mode;
561590      }
562591      else
563         bitmap.pix16(res_y, res_x) = pen + 8;
592         bitmap.pix16(res_y, res_x) = pen + colors16_mode;
564593   }
565594}
566595
r19303r19304
11161145      switch((offset & 0xe) + 1)
11171146      {
11181147         case 0x01:
1119            m_font_addr = (data << 8) | (m_font_addr & 0xff);
1148            m_font_addr = (data & 0xff) | (m_font_addr & 0xff00);
11201149            return;
11211150         case 0x03:
1122            m_font_addr = (data & 0xff) | (m_font_addr & 0xff00);
1151            m_font_addr = (data << 8) | (m_font_addr & 0xff);
11231152            return;
11241153         case 0x05:
1154            //printf("%02x\n",data);
11251155            m_font_line = data & 0x1f;
11261156            m_font_lr = data & 0x20 ? 0x000 : 0x800;
11271157            return;
11281158         case 0x09: //cg window font write
11291159         {
1160            //printf("W\n");
11301161            m_pcg_ram[((m_font_addr & 0x7f7f) << 4) | m_font_lr | m_font_line] = data;
11311162            return;
11321163         }
r19303r19304
12911322   m_video_ram_2[offset+0x08000+m_vram_bank*0x20000] = data;
12921323}
12931324
1325WRITE8_MEMBER(pc9801_state::pc9801rs_gvram_w)
1326{
1327   m_video_ram_2[offset+0+m_vram_bank*0x20000] = data;
1328}
1329
1330
12941331READ8_MEMBER(pc9801_state::pc9801_opn_r)
12951332{
12961333   if((offset & 1) == 0)
r19303r19304
14611498   else if(offset >= 0x000a0000 && offset <= 0x000a3fff)                   { pc9801_tvram_w(space,offset-0xa0000,data);           }
14621499   else if(offset >= 0x000a4000 && offset <= 0x000a4fff)                   { pc9801rs_knjram_w(space,offset & 0xfff,data);        }
14631500   else if(offset >= 0x000a8000 && offset <= 0x000bffff)                   { pc9801_gvram_w(space,offset-0xa8000,data);           }
1464   else if(offset >= 0x00100000 && offset <= 0x00100000+m_ram_size-1) { pc9801rs_ex_wram_w(space,offset-0x00100000,data);    }
1501   else if(offset >= 0x000e0000 && offset <= 0x000e7fff)                   { pc9801rs_gvram_w(space,offset & 0x7fff,data);        }
1502   else if(offset >= 0x00100000 && offset <= 0x00100000+m_ram_size-1)      { pc9801rs_ex_wram_w(space,offset-0x00100000,data);    }
14651503   //else
14661504   //  printf("%08x %08x\n",offset,data);
14671505}
r19303r19304
16521690   AM_RANGE(0x0064, 0x0067) AM_WRITE8(pc9801_vrtc_mask_w, 0xffffffff)
16531691   AM_RANGE(0x0068, 0x006b) AM_WRITE8(pc9801rs_video_ff_w,0xffffffff) //mode FF / <undefined>
16541692   AM_RANGE(0x0070, 0x007b) AM_READWRITE8(pc9801_70_r,        pc9801_70_w,        0xffffffff) //display registers "GRCG" / i8253 pit
1693   AM_RANGE(0x0080, 0x0083) AM_READWRITE8(pc9801_sasi_r,      pc9801_sasi_w,      0xffffffff) //HDD SASI interface / <undefined>
16551694   AM_RANGE(0x0090, 0x0097) AM_READWRITE8(pc9801rs_2hd_r,     pc9801rs_2hd_w,     0xffffffff)
16561695   AM_RANGE(0x00a0, 0x00af) AM_READWRITE8(pc9801_a0_r,        pc9801rs_a0_w,      0xffffffff) //upd7220 bitmap ports / display registers
16571696   AM_RANGE(0x00bc, 0x00bf) AM_READWRITE8(pc9810rs_fdc_ctrl_r,pc9810rs_fdc_ctrl_w,0xffffffff)
16581697   AM_RANGE(0x00c8, 0x00cf) AM_READWRITE8(pc9801rs_2hd_r,     pc9801rs_2hd_w,     0xffffffff)
16591698   AM_RANGE(0x00f0, 0x00ff) AM_READWRITE8(pc9801rs_f0_r,      pc9801rs_f0_w,      0xffffffff)
1699   AM_RANGE(0x0188, 0x018b) AM_READWRITE8(pc9801_opn_r,       pc9801_opn_w,       0xffffffff) //ym2203 opn / <undefined>
16601700   AM_RANGE(0x0438, 0x043b) AM_READWRITE8(pc9801rs_access_ctrl_r,pc9801rs_access_ctrl_w,0xffffffff)
16611701   AM_RANGE(0x043c, 0x043f) AM_WRITE8(pc9801rs_bank_w,    0xffffffff) //ROM/RAM bank
16621702ADDRESS_MAP_END
r19303r19304
17131753   AM_RANGE(0x00bc, 0x00bf) AM_READWRITE8(pc9810rs_fdc_ctrl_r,pc9810rs_fdc_ctrl_w,0xffff)
17141754   AM_RANGE(0x00c8, 0x00cf) AM_READWRITE8(pc9801rs_2hd_r,     pc9801rs_2hd_w,     0xffff)
17151755   AM_RANGE(0x00f0, 0x00ff) AM_READWRITE8(pc9801rs_f0_r,      pc9801rs_f0_w,      0xffff)
1756   AM_RANGE(0x0188, 0x018b) AM_READWRITE8(pc9801_opn_r,       pc9801_opn_w,       0xffff) //ym2203 opn / <undefined>
17161757   AM_RANGE(0x0438, 0x043b) AM_READWRITE8(pc9801rs_access_ctrl_r,pc9801rs_access_ctrl_w,0xffff)
17171758   AM_RANGE(0x043c, 0x043f) AM_WRITE8(pc9801rs_bank_w,    0xffff) //ROM/RAM bank
17181759
r19303r19304
19882029   AM_RANGE(0x00c8, 0x00cf) AM_READWRITE8(pc9801rs_2hd_r,     pc9801rs_2hd_w,     0xffffffff)
19892030//  AM_RANGE(0x00d8, 0x00df) AMD98 (sound?) board
19902031   AM_RANGE(0x00f0, 0x00ff) AM_READWRITE8(pc9801rs_f0_r,      pc9801rs_f0_w,      0xffffffff)
1991//  AM_RANGE(0x0188, 0x018b) YM2203 OPN board / <undefined>
2032   AM_RANGE(0x0188, 0x018b) AM_READWRITE8(pc9801_opn_r,       pc9801_opn_w,       0xffffffff) //ym2203 opn / <undefined>
19922033//  AM_RANGE(0x018c, 0x018f) YM2203 OPN extended ports / <undefined>
19932034//  AM_RANGE(0x0430, 0x0430) IDE bank register
19942035//  AM_RANGE(0x0432, 0x0432) IDE bank register (mirror)
r19303r19304
27242765
27252766void pc9801_state::pc9801rs_fdc_drq(bool state)
27262767{
2727   printf("DRQ %d\n",state);
2768//   printf("DRQ %d\n",state);
27282769
27292770   if(m_fdc_ctrl & 1)
27302771      m_dmac->dreq2_w(state ^ 1);
r19303r19304
27832824   m_ipl_rom = memregion("ipl")->base();
27842825   m_pcg_ram = auto_alloc_array(machine(), UINT8, 0x80000);
27852826
2827   m_support_16_colors = 0;
27862828   state_save_register_global_pointer(machine(), m_pcg_ram, 0x80000);
27872829}
27882830
r19303r19304
28262868   state_save_register_global_pointer(machine(), m_work_ram, 0xa0000);
28272869   state_save_register_global_pointer(machine(), m_ext_work_ram, 0x700000);
28282870
2871   m_support_16_colors = 1;
2872
28292873   upd765a_device *fdc;
28302874   fdc = machine().device<upd765a_device>(":upd765_2hd");
28312875   fdc->setup_intrq_cb(upd765a_device::line_cb(FUNC(pc9801_state::pc9801rs_fdc_irq), this));
r19303r19304
29392983{
29402984//   pc9801_state *state = device->machine().driver_data<pc9801_state>();
29412985
2986   /* TODO: seems to die very often */
29422987   pic8259_ir4_w(device->machine().device("pic8259_slave"), irq);
29432988}
29442989
r19303r19304
30843129   MCFG_SPEAKER_STANDARD_MONO("mono")
30853130
30863131   MCFG_SOUND_ADD("opn", YM2203, 4000000) // unknown clock / divider
3132   MCFG_SOUND_CONFIG(pc98_ym2203_intf)
30873133   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
30883134
30893135   MCFG_SOUND_ADD(BEEPER_TAG, BEEP, 0)
r19303r19304
31453191   MCFG_SPEAKER_STANDARD_MONO("mono")
31463192
31473193   MCFG_SOUND_ADD("opn", YM2203, 4000000) // unknown clock / divider
3194   MCFG_SOUND_CONFIG(pc98_ym2203_intf)
31483195   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
31493196
31503197   MCFG_SOUND_ADD(BEEPER_TAG, BEEP, 0)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team