Previous 15994 Revisions Next

r6610 Saturday 12th December, 2009 at 03:22:16 UTC by Barry Rodewald
[FMTOWNS] Temporary fix for text display, added FM IRQ flag, set default resolution to 640x400.
[src/mess/drivers]fmtowns.c
[src/mess/video]fmtowns.c

src/mess/video/fmtowns.c
r6609r6610
22/*
33 * FM Towns video hardware
44 *
5 * Resolution: from 320x200 to 640x400
5 * Resolution: from 320x200 to 768x512
66 *
77 * Up to two graphics layers
88 *
99 * Sprites
1010 *
11 * CRTC registers:
12 *   
11 * CRTC registers (16-bit):
1312 *
13 *  0:  HSync width 1
14 *    1:   HSync width 2
15 *  4:   HSync total
16 *  5:   VSync width 1
17 *    6:   VSync width 2
18 *    7:   Equalising pulse accountable time (what?)
19 *  8:  VSync total
20 * 
21 *    9:
22 *  10:   Graphic layer 0 horizontal start/end
23 *    11:
24 *    12:   Graphic layer 1 horizontal start/end
25 *
26 *    13:
27 *    14:   Graphic layer 0 vertical start/end
28 *    15:
29 *    16: Graphic layer 1 vertical start/end
30 *
31 *    17:   Graphic layer 0 initial address?
32 *    18: Graphic layer 0 horizontal adjust
33 *    19: Graphic layer 0 field indirect address offset
34 *    20: Graphic layer 0 line indirect address offset
35 *
36 *    21-24: As above, but for Graphic layer 1
37 *
38 *    28:   Control register 0
39 *       VSync enable (bit 15) (blank display?)
40 *       Scroll type (layer 0 = bit 4, layer 1 = bit 5)
41 *          0 = spherical scroll, 1 = cylindrical scroll
42 *
43 *  29: Control register 1
44 *       Dot clock (bits 1 and 0)
45 *       0x00 = 28.6363MHz
46 *       0x01 = 24.5454MHz
47 *       0x02 = 25.175MHz
48 *       0x03 = 21.0525MHz (default?)
49 *
50 *    30: Dummy register
51 *
52 *    31:   Control register 2
53 *   
54 *    Video registers:
55 *
56 *    0:   Graphic layer(s) type: (others likely exist)
57 *       bit 4 = 2 layers
58 *       0x0a: 1 layer, 256 colours
59 *       0x0f: 1 layer, highcolour
60 *       0x15: 2 layers, both 16 colours
61 *       0x17: 2 layers, highcolour, 16 colours
62 *       0x1d: 2 layers, 16 colours, highcolour
63 *       0x1f: 2 layers, both highcolour
64 *
65 *    1:  Layer reverse (priority?) (bit 0)
66 *       YM (bit 2) - unknown
67 *       peltype (bits 4 and 5)
68 *
1469 */
1570
1671#include "driver.h"
r6609r6610
1873#include "devices/messram.h"
1974#include "includes/fmtowns.h"
2075
76//#define CRTC_REG_DISP 1
77
2178static UINT8 towns_vram_wplane;
2279static UINT8 towns_vram_rplane;
2380static UINT8 towns_vram_page_sel;
r6609r6610
2683static UINT8 towns_palette_g[256];
2784static UINT8 towns_palette_b[256];
2885static UINT8 towns_degipal[8];
86static UINT8 towns_dpmd_flag;
2987static UINT8 towns_crtc_mix;
3088static UINT8 towns_crtc_sel;  // selected CRTC register
3189static UINT16 towns_crtc_reg[32];
90static UINT8 towns_video_sel;  // selected shifter register
91static UINT8 towns_video_reg[2];
3292static UINT8 towns_tvram_enable;
3393static UINT16 towns_kanji_offset;
3494static UINT8 towns_kanji_code_h;
r6609r6610
41101extern UINT32 towns_mainmem_enable;
42102extern UINT32 towns_ankcg_enable;
43103
104void towns_update_video(running_machine* machine)
105{
106   
107}
108
44109READ8_HANDLER( towns_gfx_high_r )
45110{
46111   return towns_gfxvram[offset];
r6609r6610
216281 *  port 0x440-0x443 - CRTC
217282 *       0x440 = register select
218283 *       0x442/3 = register data (16-bit)
284 *       0x448 = shifter register select
285 *       0x44a = shifter register data (8-bit)
219286 *
220287 */
221288READ8_HANDLER(towns_video_440_r)
r6609r6610
230297      case 0x03:
231298         logerror("CRTC: reading register %i (0x443) [%04x]\n",towns_crtc_sel,towns_crtc_reg[towns_crtc_sel]);
232299         return (towns_crtc_reg[towns_crtc_sel] & 0xff00) >> 8;
300      case 0x08:
301         return towns_video_sel;
302      case 0x0a:
303         logerror("Video: reading register %i (0x44a) [%02x]\n",towns_video_sel,towns_video_reg[towns_video_sel]);
304         return towns_video_reg[towns_video_sel];
305      case 0x0c:
306         if(towns_dpmd_flag != 0)
307         {
308            towns_dpmd_flag = 0;
309            return 0x80;
310         }
311         else
312            return 0x00;
233313      default:
234314         logerror("VID: read port %04x\n",offset+0x440);
235315   }
r6609r6610
253333         towns_crtc_reg[towns_crtc_sel] =
254334            (towns_crtc_reg[towns_crtc_sel] & 0x00ff) | (data << 8);
255335         break;
336      case 0x08:
337         towns_video_sel = data & 0x01;
338         break;
339      case 0x0a:
340         logerror("Video: writing register %i (0x44a) [%02x]\n",towns_video_sel,data);
341         towns_video_reg[towns_video_sel] = data;
342         break;
256343      default:
257344         logerror("VID: wrote 0x%02x to port %04x\n",data,offset+0x440);
258345   }
r6609r6610
266353      case 0x00:  // 0x5c8 - disable TVRAM?
267354      if(towns_tvram_enable != 0)
268355      {
269         towns_tvram_enable = 0;
356         //towns_tvram_enable = 0;
270357         return 0x80;
271358      }
272359      else
r6609r6610
344431      case 0x0e:
345432      case 0x0f:
346433         towns_degipal[offset-0x08] = data;
434         towns_dpmd_flag = 1;
347435         break;
348436   }
349437   logerror("VID: wrote 0x%02x to port %04x\n",data,offset+0xfd90);
r6609r6610
366454 *  Sprite RAM, low memory
367455 *  Writing to 0xc8xxx or 0xcaxxx activates TVRAM mode
368456 *  Writing to I/O port 0x5c8 disables TVRAM mode
369 *     (bit 7 returns high is TVRAM mode was previously active)
457 *     (bit 7 returns high if TVRAM mode was previously active)
370458 *
371459 *  In TVRAM mode:
372460 *    0xc8000-0xc8fff: ASCII text (2 bytes each: ISO646 code, then attribute)
r6609r6610
443531   
444532   if(towns_vram_page_sel != 0)
445533      off = 0x20000;
446   for(y=0;y<480;y++)
534   for(y=0;y<400;y++)
447535   {
448536//      off = 0x50 * y;
449537      for(x=0;x<640;x+=2)
r6609r6610
533621         }
534622      }
535623   }
536     
624   
625#ifdef CRTC_REG_DISP
626   popmessage("CRTC: %i %i %i %i %i %i %i %i %i\n%i %i %i %i | %i %i %i %i\nZOOM: %04x\nShifter: %02x %02x\nText=%i",
627      towns_crtc_reg[0],towns_crtc_reg[1],towns_crtc_reg[2],towns_crtc_reg[3],
628      towns_crtc_reg[4],towns_crtc_reg[5],towns_crtc_reg[6],towns_crtc_reg[7],
629      towns_crtc_reg[8],
630      towns_crtc_reg[9],towns_crtc_reg[10],towns_crtc_reg[11],towns_crtc_reg[12],
631      towns_crtc_reg[13],towns_crtc_reg[14],towns_crtc_reg[15],towns_crtc_reg[16],
632      towns_crtc_reg[27],towns_video_reg[0],towns_video_reg[1],towns_tvram_enable);
633#endif
634
537635    return 0;
538636}
539637
src/mess/drivers/fmtowns.c
r6609r6610
155155static UINT8 towns_kb_output;  // key output
156156static UINT8 towns_kb_extend;  // extended key output
157157static emu_timer* towns_kb_timer;
158static UINT8 towns_fm_irq_flag;
158159
159160static struct towns_cdrom_controller
160161{
r6609r6610
698699   }
699700}
700701
702// Sound/LED control (I/O port 0x4e8-0x4ef)
703// R/O  -- (0x4e9) FM IRQ flag (bit 0), PCM IRQ flag (bit 3)
704// (0x4ea) PCM IRQ mask
705// R/W  -- (0x4eb) PCM IRQ flag
706// W/O  -- (0x4ec) LED control
707static READ8_HANDLER(towns_sound_ctrl_r)
708{
709   UINT8 ret = 0;
710   
711   switch(offset)
712   {
713      case 0x01:
714         if(towns_fm_irq_flag)
715            ret |= 0x01;
716         break;
717      default:
718         logerror("FM: unimplemented port 0x%04x read\n",offset + 0x4e8);
719   }
720   return ret;
721}
722
723static WRITE8_HANDLER(towns_sound_ctrl_w)
724{
725   // TODO:
726}
727
701728static READ32_HANDLER(towns_padport_r)
702729{
703730   logerror("PADPORT: read mask %08x\n",mem_mask);
r6609r6610
14981525{
14991526   const device_config* pic = devtag_get_device(device->machine,"pic8259_slave");
15001527   if(irq)
1528   {
1529      towns_fm_irq_flag = 1;
15011530      pic8259_set_irq_line(pic,5,1);
1531   }
15021532   else
1533   {
1534      towns_fm_irq_flag = 0;
15031535      pic8259_set_irq_line(pic,5,0);
1536   }
15041537}
15051538
15061539static PIC8259_SET_INT_LINE( towns_pic_irq )
r6609r6610
16281661  AM_RANGE(0x04d4,0x04d7) AM_NOP  // R/W  -- (0x4d5) mute?
16291662  AM_RANGE(0x04d8,0x04df) AM_DEVREADWRITE8("fm",ym3438_r,ym3438_w,0x00ff00ff)
16301663  AM_RANGE(0x04e0,0x04e3) AM_NOP  // R/W  -- volume ports
1631  AM_RANGE(0x04e8,0x04ef) AM_NOP  // R/O  -- (0x4e9) FM IRQ flag (bit 0), PCM IRQ flag (bit 3)
1632                                  // (0x4ea) PCM IRQ mask
1633                                  // R/W  -- (0x4eb) PCM IRQ flag
1634                                  // W/O  -- (0x4ec) LED control
1664  AM_RANGE(0x04e8,0x04ef) AM_READWRITE8(towns_sound_ctrl_r,towns_sound_ctrl_w,0xffffffff) 
16351665  AM_RANGE(0x04f0,0x04fb) AM_DEVWRITE8("pcm",rf5c68_w,0xffffffff)
16361666  // CRTC / Video
16371667  AM_RANGE(0x05c8,0x05cb) AM_READWRITE8(towns_video_5c8_r, towns_video_5c8_w, 0xffffffff)
r6609r6610
19491979    MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
19501980   
19511981    MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
1952    MDRV_SCREEN_SIZE(640, 480)
1953    MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
1982    MDRV_SCREEN_SIZE(640, 400)
1983    MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1)
19541984    MDRV_GFXDECODE(towns)
19551985
19561986    /* sound hardware */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team