Previous 15994 Revisions Next

r12834 Tuesday 13th September, 2011 at 10:29:57 UTC by Robbbert
CHANNELF - modernised.
[src/mess/audio]channelf.c
[src/mess/drivers]camplynx.c cd2650.c channelf.c
[src/mess/includes]channelf.h
[src/mess/video]channelf.c

src/mess/audio/channelf.c
r12833r12834
1#include <math.h>
2
3#include "emu.h"
41#include "includes/channelf.h"
52
63
src/mess/video/channelf.c
r12833r12834
1#include "emu.h"
21#include "includes/channelf.h"
32
43static const rgb_t channelf_palette[] =
r12833r12834
3837VIDEO_START( channelf )
3938{
4039   channelf_state *state = machine.driver_data<channelf_state>();
41   state->m_videoram = auto_alloc_array(machine, UINT8, 0x2000);
40   state->m_p_videoram = machine.region("vram")->base();
4241}
4342
4443static int recalc_palette_offset(int reg1, int reg2)
r12833r12834
5251SCREEN_UPDATE( channelf )
5352{
5453   channelf_state *state = screen->machine().driver_data<channelf_state>();
55   UINT8 *videoram = state->m_videoram;
56   int x,y,offset, palette_offset;
57   int color;
58   UINT16 pen;
54   UINT8 y,col;
55   UINT16 ma=0,x;
56   int palette_offset;
5957
60   for(y=0;y<64;y++)
58   for(y = 0; y < 64; y++ )
6159   {
62      palette_offset = recalc_palette_offset(videoram[y*128+125]&3,videoram[y*128+126]&3);
63      for (x=0;x<128;x++)
60      UINT16 *p = BITMAP_ADDR16(bitmap, y, 0);
61      palette_offset = recalc_palette_offset(state->m_p_videoram[y*128+125]&3, state->m_p_videoram[y*128+126]&3);
62
63      for (x = ma; x < ma + 128; x++)
6464      {
65         offset = y*128+x;
66         color = palette_offset+(videoram[offset]&3);
67         pen = colormap[color];
68         *BITMAP_ADDR16(bitmap, y, x) = pen;
65         col = palette_offset+(state->m_p_videoram[x|(y<<7)]&3);
66         *p++ = colormap[col];
6967      }
68      ma+=128;
7069   }
7170   return 0;
7271}
src/mess/includes/channelf.h
r12833r12834
77#ifndef CHANNELF_H_
88#define CHANNELF_H_
99
10#include "emu.h"
11#include "cpu/f8/f8.h"
12#include "imagedev/cartslot.h"
13
14
1015/* SKR - 2102 RAM chip on carts 10 and 18 I/O ports */
1116typedef struct
1217{
r12833r12834
2429   channelf_state(const machine_config &mconfig, device_type type, const char *tag)
2530      : driver_device(mconfig, type, tag) { }
2631
27   UINT8 *m_videoram;
32   DECLARE_READ8_MEMBER(channelf_port_0_r);
33   DECLARE_READ8_MEMBER(channelf_port_1_r);
34   DECLARE_READ8_MEMBER(channelf_port_4_r);
35   DECLARE_READ8_MEMBER(channelf_port_5_r);
36   DECLARE_READ8_MEMBER(channelf_2102A_r);
37   DECLARE_READ8_MEMBER(channelf_2102B_r);
38   DECLARE_WRITE8_MEMBER(channelf_port_0_w);
39   DECLARE_WRITE8_MEMBER(channelf_port_1_w);
40   DECLARE_WRITE8_MEMBER(channelf_port_4_w);
41   DECLARE_WRITE8_MEMBER(channelf_port_5_w);
42   DECLARE_WRITE8_MEMBER(channelf_2102A_w);
43   DECLARE_WRITE8_MEMBER(channelf_2102B_w);
44   UINT8 *m_p_videoram;
2845   UINT8 m_latch[6];
2946   r2102_t m_r2102;
3047   UINT8 m_val_reg;
3148   UINT8 m_row_reg;
3249   UINT8 m_col_reg;
50   UINT8 port_read_with_latch(UINT8 ext, UINT8 latch_state);
3351};
3452
3553
src/mess/drivers/camplynx.c
r12833r12834
9090   m_maincpu(*this, "maincpu"),
9191   //m_cass(*this, CASSETTE_TAG),
9292   //m_wave(*this, WAVE_TAG),
93   //m_speaker(*this, SPEAKER_TAG),
9493   //m_printer(*this, "centronics"),
9594   m_crtc(*this, "crtc")
9695   //m_fdc(*this, "fdc")
r12833r12834
9998   required_device<cpu_device> m_maincpu;
10099   //required_device<cassette_image_device> m_cass;
101100   //required_device<device_t> m_wave;
102   //required_device<device_t> m_speaker;
103101   //required_device<device_t> m_printer;
104102   required_device<mc6845_device> m_crtc;
105103   //optional_device<device_t> m_fdc;
src/mess/drivers/channelf.c
r12833r12834
1010 *    also spanning from $3000 to $FFFF. Added clones
1111 *
1212 ******************************************************************/
13#define ADDRESS_MAP_MODERN
1314
14#include "emu.h"
15#include "cpu/f8/f8.h"
1615#include "includes/channelf.h"
17#include "imagedev/cartslot.h"
1816
19
2017#ifndef VERBOSE
2118#define VERBOSE 0
2219#endif
r12833r12834
4037 * should not be latched in this way. (See mk1 driver)
4138 *
4239 * The f8 cannot determine how its ports are mapped at runtime,
43 * so it can't easily decide to state->m_latch or not.
40 * so it can't easily decide to latch or not.
4441 *
4542 * ...so it stays here for now.
4643 */
4744
48
49static UINT8 port_read_with_latch(UINT8 ext, UINT8 latch_state)
45UINT8 channelf_state::port_read_with_latch(UINT8 ext, UINT8 latch_state)
5046{
5147   return (~ext | latch_state);
5248}
5349
54static READ8_HANDLER( channelf_port_0_r )
50READ8_MEMBER( channelf_state::channelf_port_0_r )
5551{
56   channelf_state *state = space->machine().driver_data<channelf_state>();
57   return port_read_with_latch(input_port_read(space->machine(), "PANEL"),state->m_latch[0]);
52   return port_read_with_latch(input_port_read(machine(), "PANEL"), m_latch[0]);
5853}
5954
60static READ8_HANDLER( channelf_port_1_r )
55READ8_MEMBER( channelf_state::channelf_port_1_r )
6156{
62   channelf_state *state = space->machine().driver_data<channelf_state>();
6357   UINT8 ext_value;
6458
65   if ((state->m_latch[0] & 0x40) == 0)
66   {
67      ext_value = input_port_read(space->machine(), "RIGHT_C");
68   }
59   if ((m_latch[0] & 0x40) == 0)
60      ext_value = input_port_read(machine(), "RIGHT_C");
6961   else
70   {
71      ext_value = 0xc0 | input_port_read(space->machine(), "RIGHT_C");
72   }
73   return port_read_with_latch(ext_value,state->m_latch[1]);
62      ext_value = 0xc0 | input_port_read(machine(), "RIGHT_C");
63
64   return port_read_with_latch(ext_value,m_latch[1]);
7465}
7566
76static READ8_HANDLER( channelf_port_4_r )
67READ8_MEMBER( channelf_state::channelf_port_4_r )
7768{
78   channelf_state *state = space->machine().driver_data<channelf_state>();
7969   UINT8 ext_value;
8070
81   if ((state->m_latch[0] & 0x40) == 0)
82   {
83      ext_value = input_port_read(space->machine(), "LEFT_C");
84   }
71   if ((m_latch[0] & 0x40) == 0)
72      ext_value = input_port_read(machine(), "LEFT_C");
8573   else
86   {
8774      ext_value = 0xff;
88   }
89   return port_read_with_latch(ext_value,state->m_latch[2]);
75
76   return port_read_with_latch(ext_value,m_latch[2]);
9077}
9178
92static READ8_HANDLER( channelf_port_5_r )
79READ8_MEMBER( channelf_state::channelf_port_5_r )
9380{
94   channelf_state *state = space->machine().driver_data<channelf_state>();
95   return port_read_with_latch(0xff,state->m_latch[3]);
81   return port_read_with_latch(0xff, m_latch[3]);
9682}
9783
98static  READ8_HANDLER( channelf_2102A_r )   /* SKR */
84READ8_MEMBER( channelf_state::channelf_2102A_r )   /* SKR */
9985{
100   channelf_state *state = space->machine().driver_data<channelf_state>();
10186   UINT8 pdata;
10287
103   if(state->m_r2102.r_w==0) {
104      state->m_r2102.addr=(state->m_r2102.a[0]&1)+((state->m_r2102.a[1]<<1)&2)+((state->m_r2102.a[2]<<2)&4)+((state->m_r2102.a[3]<<3)&8)+((state->m_r2102.a[4]<<4)&16)+((state->m_r2102.a[5]<<5)&32)+((state->m_r2102.a[6]<<6)&64)+((state->m_r2102.a[7]<<7)&128)+((state->m_r2102.a[8]<<8)&256)+((state->m_r2102.a[9]<<9)&512);
105      state->m_r2102.d=state->m_r2102.ram[state->m_r2102.addr]&1;
106      pdata=state->m_latch[4]&0x7f;
107      pdata|=(state->m_r2102.d<<7);
108      LOG(("rhA: addr=%d, d=%d, r_w=%d, ram[%d]=%d,  a[9]=%d, a[8]=%d, a[7]=%d, a[6]=%d, a[5]=%d, a[4]=%d, a[3]=%d, a[2]=%d, a[1]=%d, a[0]=%d\n",state->m_r2102.addr,state->m_r2102.d,state->m_r2102.r_w,state->m_r2102.addr,state->m_r2102.ram[state->m_r2102.addr],state->m_r2102.a[9],state->m_r2102.a[8],state->m_r2102.a[7],state->m_r2102.a[6],state->m_r2102.a[5],state->m_r2102.a[4],state->m_r2102.a[3],state->m_r2102.a[2],state->m_r2102.a[1],state->m_r2102.a[0]));
88   if (m_r2102.r_w==0)
89   {
90      m_r2102.addr=(m_r2102.a[0]&1)+((m_r2102.a[1]<<1)&2)+((m_r2102.a[2]<<2)&4)+((m_r2102.a[3]<<3)&8)+((m_r2102.a[4]<<4)&16)+((m_r2102.a[5]<<5)&32)+((m_r2102.a[6]<<6)&64)+((m_r2102.a[7]<<7)&128)+((m_r2102.a[8]<<8)&256)+((m_r2102.a[9]<<9)&512);
91      m_r2102.d=m_r2102.ram[m_r2102.addr]&1;
92      pdata=m_latch[4]&0x7f;
93      pdata|=(m_r2102.d<<7);
94      LOG(("rhA: addr=%d, d=%d, r_w=%d, ram[%d]=%d,  a[9]=%d, a[8]=%d, a[7]=%d, a[6]=%d, a[5]=%d, a[4]=%d, a[3]=%d, a[2]=%d, a[1]=%d, a[0]=%d\n",m_r2102.addr,m_r2102.d,m_r2102.r_w,m_r2102.addr,m_r2102.ram[m_r2102.addr],m_r2102.a[9],m_r2102.a[8],m_r2102.a[7],m_r2102.a[6],m_r2102.a[5],m_r2102.a[4],m_r2102.a[3],m_r2102.a[2],m_r2102.a[1],m_r2102.a[0]));
10995      return port_read_with_latch(0xff,pdata);
110   } else
111      LOG(("rhA: r_w=%d\n",state->m_r2102.r_w));
112      return port_read_with_latch(0xff,state->m_latch[4]);
96   }
97   else
98      LOG(("rhA: r_w=%d\n",m_r2102.r_w));
99
100   return port_read_with_latch(0xff, m_latch[4]);
113101}
114102
115static  READ8_HANDLER( channelf_2102B_r )  /* SKR */
103READ8_MEMBER( channelf_state::channelf_2102B_r )  /* SKR */
116104{
117   channelf_state *state = space->machine().driver_data<channelf_state>();
118105   LOG(("rhB\n"));
119   return port_read_with_latch(0xff,state->m_latch[5]);
106   return port_read_with_latch(0xff, m_latch[5]);
120107}
121108
122static WRITE8_HANDLER( channelf_port_0_w )
109WRITE8_MEMBER( channelf_state::channelf_port_0_w )
123110{
124   channelf_state *state = space->machine().driver_data<channelf_state>();
125   UINT8 *videoram = state->m_videoram;
126111   int offs;
127112
128   state->m_latch[0] = data;
113   m_latch[0] = data;
129114
130115   if (data & 0x20)
131116   {
132      offs = state->m_row_reg*128+state->m_col_reg;
133      if (videoram[offs] != state->m_val_reg)
134         videoram[offs] = state->m_val_reg;
117      offs = m_row_reg*128+m_col_reg;
118      m_p_videoram[offs] = m_val_reg;
135119   }
136120}
137121
138static WRITE8_HANDLER( channelf_port_1_w )
122WRITE8_MEMBER( channelf_state::channelf_port_1_w )
139123{
140   channelf_state *state = space->machine().driver_data<channelf_state>();
141   state->m_latch[1] = data;
142   state->m_val_reg = ((data ^ 0xff) >> 6) & 0x03;
124   m_latch[1] = data;
125   m_val_reg = ((data ^ 0xff) >> 6) & 0x03;
143126}
144127
145static WRITE8_HANDLER( channelf_port_4_w )
128WRITE8_MEMBER( channelf_state::channelf_port_4_w )
146129{
147   channelf_state *state = space->machine().driver_data<channelf_state>();
148   state->m_latch[2] = data;
149   state->m_col_reg = (data | 0x80) ^ 0xff;
130   m_latch[2] = data;
131   m_col_reg = (data | 0x80) ^ 0xff;
150132}
151133
152static WRITE8_HANDLER( channelf_port_5_w )
134WRITE8_MEMBER( channelf_state::channelf_port_5_w )
153135{
154   channelf_state *state = space->machine().driver_data<channelf_state>();
155   state->m_latch[3] = data;
156   channelf_sound_w(space->machine().device("custom"), (data>>6)&3);
157   state->m_row_reg = (data | 0xc0) ^ 0xff;
136   m_latch[3] = data;
137   channelf_sound_w(machine().device("custom"), (data>>6)&3);
138   m_row_reg = (data | 0xc0) ^ 0xff;
158139}
159140
160static WRITE8_HANDLER( channelf_2102A_w )  /* SKR */
141WRITE8_MEMBER( channelf_state::channelf_2102A_w )  /* SKR */
161142{
162   channelf_state *state = space->machine().driver_data<channelf_state>();
163   state->m_latch[4]=data;
164   state->m_r2102.a[2]=(data>>2)&1;
165   state->m_r2102.a[3]=(data>>1)&1;
166   state->m_r2102.r_w=data&1;
167   state->m_r2102.addr=(state->m_r2102.a[0]&1)+((state->m_r2102.a[1]<<1)&2)+((state->m_r2102.a[2]<<2)&4)+((state->m_r2102.a[3]<<3)&8)+((state->m_r2102.a[4]<<4)&16)+((state->m_r2102.a[5]<<5)&32)+((state->m_r2102.a[6]<<6)&64)+((state->m_r2102.a[7]<<7)&128)+((state->m_r2102.a[8]<<8)&256)+((state->m_r2102.a[9]<<9)&512);
168   state->m_r2102.d=(data>>3)&1;
169   if(state->m_r2102.r_w==1)
170      state->m_r2102.ram[state->m_r2102.addr]=state->m_r2102.d;
171   LOG(("whA: data=%d, addr=%d, d=%d, r_w=%d, ram[%d]=%d\n",data,state->m_r2102.addr,state->m_r2102.d,state->m_r2102.r_w,state->m_r2102.addr,state->m_r2102.ram[state->m_r2102.addr]));
143   m_latch[4]=data;
144   m_r2102.a[2]=(data>>2)&1;
145   m_r2102.a[3]=(data>>1)&1;
146   m_r2102.r_w=data&1;
147   m_r2102.addr=(m_r2102.a[0]&1)+((m_r2102.a[1]<<1)&2)+((m_r2102.a[2]<<2)&4)+((m_r2102.a[3]<<3)&8)+((m_r2102.a[4]<<4)&16)+((m_r2102.a[5]<<5)&32)+((m_r2102.a[6]<<6)&64)+((m_r2102.a[7]<<7)&128)+((m_r2102.a[8]<<8)&256)+((m_r2102.a[9]<<9)&512);
148   m_r2102.d=(data>>3)&1;
149   if(m_r2102.r_w==1)
150      m_r2102.ram[m_r2102.addr]=m_r2102.d;
151   LOG(("whA: data=%d, addr=%d, d=%d, r_w=%d, ram[%d]=%d\n",data,m_r2102.addr,m_r2102.d,m_r2102.r_w,m_r2102.addr,m_r2102.ram[m_r2102.addr]));
172152}
173153
174static WRITE8_HANDLER( channelf_2102B_w )  /* SKR */
154WRITE8_MEMBER( channelf_state::channelf_2102B_w )  /* SKR */
175155{
176   channelf_state *state = space->machine().driver_data<channelf_state>();
177   state->m_latch[5]=data;
178   state->m_r2102.a[9]=(data>>7)&1;
179   state->m_r2102.a[8]=(data>>6)&1;
180   state->m_r2102.a[7]=(data>>5)&1;
181   state->m_r2102.a[1]=(data>>4)&1;
182   state->m_r2102.a[6]=(data>>3)&1;
183   state->m_r2102.a[5]=(data>>2)&1;
184   state->m_r2102.a[4]=(data>>1)&1;
185   state->m_r2102.a[0]=data&1;
186   LOG(("whB: data=%d, a[9]=%d,a[8]=%d,a[0]=%d\n",data,state->m_r2102.a[9],state->m_r2102.a[8],state->m_r2102.a[0]));
156   m_latch[5]=data;
157   m_r2102.a[9]=(data>>7)&1;
158   m_r2102.a[8]=(data>>6)&1;
159   m_r2102.a[7]=(data>>5)&1;
160   m_r2102.a[1]=(data>>4)&1;
161   m_r2102.a[6]=(data>>3)&1;
162   m_r2102.a[5]=(data>>2)&1;
163   m_r2102.a[4]=(data>>1)&1;
164   m_r2102.a[0]=data&1;
165   LOG(("whB: data=%d, a[9]=%d,a[8]=%d,a[0]=%d\n",data,m_r2102.a[9],m_r2102.a[8],m_r2102.a[0]));
187166}
188167
189static ADDRESS_MAP_START( channelf_map, AS_PROGRAM, 8 )
168static ADDRESS_MAP_START( channelf_map, AS_PROGRAM, 8, channelf_state )
190169   AM_RANGE(0x0000, 0x07ff) AM_ROM
191170   AM_RANGE(0x0800, 0x27ff) AM_ROM /* Cartridge Data */
192171   AM_RANGE(0x2800, 0x2fff) AM_RAM /* Schach RAM */
193172   AM_RANGE(0x3000, 0xffff) AM_ROM /* Cartridge Data continued */
194173ADDRESS_MAP_END
195174
196static ADDRESS_MAP_START( channelf_io, AS_IO, 8 )
175static ADDRESS_MAP_START( channelf_io, AS_IO, 8, channelf_state )
197176   AM_RANGE(0x00, 0x00) AM_READWRITE(channelf_port_0_r, channelf_port_0_w) /* Front panel switches */
198177   AM_RANGE(0x01, 0x01) AM_READWRITE(channelf_port_1_r, channelf_port_1_w) /* Right controller     */
199178   AM_RANGE(0x04, 0x04) AM_READWRITE(channelf_port_4_r, channelf_port_4_w) /* Left controller      */
r12833r12834
392371   /* sound hardware */
393372   MCFG_SPEAKER_STANDARD_MONO("mono")
394373   MCFG_SOUND_ADD("custom", CHANNELF, 0)
395   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
374   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
396375
397376   MCFG_FRAGMENT_ADD( channelf_cart )
398377MACHINE_CONFIG_END
r12833r12834
404383   ROM_SYSTEM_BIOS( 1, "sl31253", "Channel F" )
405384   ROMX_LOAD("sl31253.rom",  0x0000, 0x0400, CRC(04694ed9) SHA1(81193965a374d77b99b4743d317824b53c3e3c78), ROM_BIOS(2))
406385   ROM_LOAD("sl31254.rom",   0x0400, 0x0400, CRC(9c047ba3) SHA1(8f70d1b74483ba3a37e86cf16c849d601a8c3d2c))
386   ROM_REGION(0x2000, "vram", ROMREGION_ERASE00)
407387ROM_END
408388
409389#define rom_sabavdpl rom_channelf
src/mess/drivers/cd2650.c
r12833r12834
187187
188188/* Driver */
189189
190/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT     COMPANY   FULLNAME       FLAGS */
191COMP( 1977, cd2650,  0,       0,   cd2650,    cd2650,     0,   "Central Data",   "CD 2650",      GAME_NOT_WORKING | GAME_NO_SOUND )
192
190/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT     COMPANY        FULLNAME       FLAGS */
191COMP( 1977, cd2650, 0,      0,       cd2650,    cd2650,  0,   "Central Data",   "CD 2650", GAME_NOT_WORKING | GAME_NO_SOUND )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team