Previous 15994 Revisions Next

r9525 Friday 5th November, 2010 at 19:08:54 UTC by Wilbert Pol
[PHUNSY] Added graphics proms. Implemented graphics.
[src/mess/drivers]phunsy.c

src/mess/drivers/phunsy.c
r9524r9525
99#include "emu.h"
1010#include "cpu/s2650/s2650.h"
1111
12
13class phunsy_state : public driver_device
14{
15public:
16   phunsy_state(running_machine &machine, const driver_device_config_base &config)
17      : driver_device(machine, config) { }
18
19   UINT8 *video_ram;
20};
21
22
1223static ADDRESS_MAP_START(phunsy_mem, ADDRESS_SPACE_PROGRAM, 8)
1324   ADDRESS_MAP_UNMAP_HIGH
1425   AM_RANGE( 0x0000, 0x07ff) AM_ROM
1526   AM_RANGE( 0x0800, 0x0fff) AM_RAM
16   AM_RANGE( 0x1000, 0x17ff) AM_RAM // Video RAM
27   AM_RANGE( 0x1000, 0x17ff) AM_RAM   AM_BASE_MEMBER( phunsy_state, video_ram ) // Video RAM
1728   AM_RANGE( 0x1800, 0x1fff) AM_RAM // Banked ROM
18   AM_RANGE( 0x4000, 0xffff) AM_RAM // Bankek RAM
29   AM_RANGE( 0x4000, 0xffff) AM_RAMBANK("bank2") // Banked RAM
1930ADDRESS_MAP_END
2031
32
33static READ8_HANDLER( phunsy_sense_r )
34{
35   return 0;
36}
37
38
2139static ADDRESS_MAP_START( phunsy_io , ADDRESS_SPACE_IO, 8)
2240   ADDRESS_MAP_UNMAP_HIGH
41   AM_RANGE( S2650_SENSE_PORT,S2650_SENSE_PORT) AM_READ( phunsy_sense_r)
2342ADDRESS_MAP_END
2443
44
2545/* Input ports */
2646INPUT_PORTS_START( phunsy )
2747INPUT_PORTS_END
2848
2949
3050static MACHINE_RESET(phunsy)
31{   
51{
52   memory_set_bankptr( machine, "bank2", memory_region(machine, "ram_4000") );
3253}
3354
55
56static PALETTE_INIT( phunsy )
57{
58   for ( int i = 0; i < 8; i++ )
59   {
60      int j = ( i << 5 ) | ( i << 2 ) | ( i >> 1 );
61
62      palette_set_color_rgb( machine, i, j, j, j );
63   }
64}
65
66
3467static VIDEO_START( phunsy )
3568{
3669}
3770
71
3872static VIDEO_UPDATE( phunsy )
3973{
74   phunsy_state *state = screen->machine->driver_data<phunsy_state>();
75   UINT8   *gfx = memory_region( screen->machine, "gfx" );
76   UINT8   *v = state->video_ram;
77
78   for ( int h = 0; h < 32; h++ )
79   {
80      for ( int w = 0; w < 64; w++ )
81      {
82         UINT8 c = *v;
83
84         if ( c & 0x80 )
85         {
86            UINT8 grey = ( c >> 4 ) & 0x07;
87            /* Graphics mode */
88            for ( int i = 0; i < 4; i++ )
89            {
90               UINT16 *p = BITMAP_ADDR16( bitmap, h * 8 + i, w * 6 );
91
92               p[0] = ( c & 0x01 ) ? grey : 0;
93               p[1] = ( c & 0x01 ) ? grey : 0;
94               p[2] = ( c & 0x01 ) ? grey : 0;
95               p[3] = ( c & 0x02 ) ? grey : 0;
96               p[4] = ( c & 0x02 ) ? grey : 0;
97               p[5] = ( c & 0x02 ) ? grey : 0;
98            }
99            for ( int i = 0; i < 4; i++ )
100            {
101               UINT16 *p = BITMAP_ADDR16( bitmap, h * 8 + 4 + i, w * 6 );
102
103               p[0] = ( c & 0x04 ) ? grey : 0;
104               p[1] = ( c & 0x04 ) ? grey : 0;
105               p[2] = ( c & 0x04 ) ? grey : 0;
106               p[3] = ( c & 0x08 ) ? grey : 0;
107               p[4] = ( c & 0x08 ) ? grey : 0;
108               p[5] = ( c & 0x08 ) ? grey : 0;
109            }
110         }
111         else
112         {
113            /* ASCII mode */
114            for ( int i = 0; i < 8; i++ )
115            {
116               UINT16 *p = BITMAP_ADDR16( bitmap, h * 8 + i, w * 6 );
117               UINT8 pat = gfx[ c * 8 + i];
118
119               p[0] = ( pat & 0x20 ) ? 7 : 0;
120               p[1] = ( pat & 0x10 ) ? 7 : 0;
121               p[2] = ( pat & 0x08 ) ? 7 : 0;
122               p[3] = ( pat & 0x04 ) ? 7 : 0;
123               p[4] = ( pat & 0x02 ) ? 7 : 0;
124               p[5] = ( pat & 0x01 ) ? 7 : 0;
125            }
126         }
127
128         v++;
129      }
130   }
40131    return 0;
41132}
42133
43static MACHINE_CONFIG_START( phunsy, driver_device )
134
135static MACHINE_CONFIG_START( phunsy, phunsy_state )
44136    /* basic machine hardware */
45137    MDRV_CPU_ADD("maincpu",S2650, XTAL_1MHz)
46138    MDRV_CPU_PROGRAM_MAP(phunsy_mem)
r9524r9525
58150   */
59151   MDRV_SCREEN_RAW_PARAMS(XTAL_8MHz, 480, 0, 64*6, 313, 0, 256)
60152    MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
61    MDRV_PALETTE_LENGTH(2)
62    MDRV_PALETTE_INIT(black_and_white)
153    MDRV_PALETTE_LENGTH(8)
154    MDRV_PALETTE_INIT(phunsy)
63155
64156    MDRV_VIDEO_START(phunsy)
65157    MDRV_VIDEO_UPDATE(phunsy)
r9524r9525
73165   ROM_LOAD( "dass.bin",        0x0800, 0x0800, CRC(13380140) SHA1(a999201cb414abbf1e10a7fcc1789e3e000a5ef1))
74166   ROM_LOAD( "pdcr.bin",        0x1000, 0x0800, CRC(74bf9d0a) SHA1(8d2f673615215947f033571f1221c6aa99c537e9))
75167   ROM_LOAD( "labhnd.bin",      0x1800, 0x0800, CRC(1d5a106b) SHA1(a20d09e32e21cf14db8254cbdd1d691556b473f0))
76   ROM_REGION( 0x0080, "gfx", ROMREGION_ERASEFF )
168   ROM_REGION( 0x0400, "gfx", ROMREGION_ERASEFF )
169   ROM_LOAD( "ph_char1.bin", 0x0000, 0x0200, CRC(a7e567fc) SHA1(b18aae0a2d4f92f5a7e22640719bbc4652f3f4ee))
170   ROM_LOAD( "ph_char2.bin", 0x0200, 0x0200, CRC(3d5786d3) SHA1(8cf87d83be0b5e4becfa9fd6e05b01250a2feb3b))
171   /* 16 x 16KB RAM banks */
172   ROM_REGION( 0x40000, "ram_4000", ROMREGION_ERASEFF )
77173ROM_END
78174
79175/* Driver */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team