Previous 15994 Revisions Next

r2526 Friday 2nd May, 2008 at 15:12:27 UTC by Miodrag Milanović
[B2M] Colors support, there is now switch for BW/Color monitor since other palette is used
[src/mess/drivers]b2m.c
[src/mess/includes]b2m.h
[src/mess/machine]b2m.c
[src/mess/video]b2m.c

src/mess/includes/b2m.h
r2525r2526
3030extern WRITE8_HANDLER( b2m_8255_1_w );
3131extern READ8_HANDLER( b2m_8255_2_r );
3232extern WRITE8_HANDLER( b2m_8255_2_w );
33extern READ8_HANDLER( b2m_palette_r );
34extern WRITE8_HANDLER( b2m_palette_w );
35extern READ8_HANDLER( b2m_localmachine_r );
36extern WRITE8_HANDLER( b2m_localmachine_w );
3337extern DEVICE_IMAGE_LOAD( b2m_floppy );
3438/*----------- defined in video/b2m.c -----------*/
3539extern VIDEO_START( b2m );
src/mess/video/b2m.c
r2525r2526
3535         }         
3636         for (b = 7; b >= 0; b--)
3737         {                       
38            col = (((code1 >> b) & 0x01)<<1) + ((code2 >> b) & 0x01);
38            col = (((code2 >> b) & 0x01)<<1) + ((code1 >> b) & 0x01);
3939            *BITMAP_ADDR16(bitmap, y, x*8+b) =  col;
4040         }
4141      }           
r2525r2526
4646
4747const rgb_t b2m_palette[4] = {
4848   MAKE_RGB(0x00, 0x00, 0x00), // 0
49   MAKE_RGB(0x60, 0x60, 0x60), // 1
50   MAKE_RGB(0xa0, 0xa0, 0xa0), // 2
51   MAKE_RGB(0xff, 0xff, 0xff), // 3 
49   MAKE_RGB(0x00, 0x00, 0x00), // 1
50   MAKE_RGB(0x00, 0x00, 0x00), // 2
51   MAKE_RGB(0x00, 0x00, 0x00), // 3 
5252};
5353
5454PALETTE_INIT( b2m )
src/mess/machine/b2m.c
r2525r2526
1616#include "machine/pit8253.h"
1717#include "machine/wd17xx.h"
1818#include "machine/pic8259.h"
19#include "machine/msm8251.h"
1920
21static int b2m_8255_porta;
22UINT16 b2m_video_scroll;
23static int b2m_8255_portc;
24
25UINT8 b2m_video_page;
26static UINT8 b2m_drive;
27static UINT8 b2m_side;
28
29static UINT8 b2m_romdisk_lsb;
30static UINT8 b2m_romdisk_msb;
31
32static UINT8 b2m_color[4];
33static UINT8 b2m_localmachine;
34
2035READ8_HANDLER (b2m_keyboard_r )
2136{     
2237   UINT8 key = 0x00;
r2525r2526
166181   }
167182};
168183
169static int b2m_8255_porta;
170UINT16 b2m_video_scroll;
171static int b2m_8255_portc;
172
173UINT8 b2m_video_page;
174
175
176184WRITE8_HANDLER (b2m_8255_porta_w )
177185{   
178186   b2m_8255_porta = data;
r2525r2526
211219   b2m_8255_portc_w
212220};
213221
214UINT8 b2m_drive;
215UINT8 b2m_side;
216222
217
218UINT8 b2m_8255_portc_e;
219223WRITE8_HANDLER (b2m_ext_8255_porta_w )
220224{   
221225}
r2525r2526
261265   b2m_ext_8255_portc_w
262266};
263267
264
265
266UINT8 b2m_romdisk_lsb;
267UINT8 b2m_romdisk_msb;
268
269268READ8_HANDLER (b2m_romdisk_porta_r )
270269{
271270   UINT8 *romdisk = memory_region(REGION_CPU1) + 0x12000;     
272   return romdisk[b2m_romdisk_msb*256+b2m_romdisk_lsb-0x8000];   
271   return romdisk[b2m_romdisk_msb*256+b2m_romdisk_lsb];   
273272}
274273
275274WRITE8_HANDLER (b2m_romdisk_portb_w )
r2525r2526
278277}
279278
280279WRITE8_HANDLER (b2m_romdisk_portc_w )
281{     
282   b2m_romdisk_msb = data;   
280{         
281   b2m_romdisk_msb = data & 0x7f;   
283282}
284283
285284const ppi8255_interface b2m_ppi8255_interface_3 =
r2525r2526
332331   memset(mess_ram,0,128*1024);   
333332}
334333
334WRITE8_HANDLER ( b2m_palette_w )
335{
336   UINT8 b = (3 - ((data >> 6) & 3)) * 0x55;
337   UINT8 g = (3 - ((data >> 4) & 3)) * 0x55;
338   UINT8 r = (3 - ((data >> 2) & 3)) * 0x55;
339   
340   UINT8 bw = (3 - (data & 3)) * 0x55;
341   
342   b2m_color[offset] = data;     
343   
344   if (input_port_read_indexed(machine,11)==1) {
345      palette_set_color_rgb(machine,offset, r, g, b);
346   } else {
347      palette_set_color_rgb(machine,offset, bw, bw, bw);
348   }
349}
350
351READ8_HANDLER ( b2m_palette_r )
352{
353   return b2m_color[offset];
354}
355
356WRITE8_HANDLER ( b2m_localmachine_w )
357{
358   b2m_localmachine = data;
359}
360
361READ8_HANDLER ( b2m_localmachine_r )
362{
363   return b2m_localmachine;
364}
365
366static const struct msm8251_interface b2m_msm8251_interface =
367{
368   NULL,
369   NULL,
370   NULL
371};
372
335373MACHINE_START(b2m)
336374{
337375   wd17xx_init(machine, WD_TYPE_1793, NULL , NULL);   
376   msm8251_init(&b2m_msm8251_interface);
338377}
339378
340379IRQ_CALLBACK(b2m_irq_callback)
r2525r2526
351390MACHINE_RESET(b2m)
352391{
353392   wd17xx_reset();
393   msm8251_reset();
354394   
355395   b2m_side = 0;
356396   b2m_drive = 0;
src/mess/drivers/b2m.c
r2525r2526
1313#include "machine/8255ppi.h"
1414#include "machine/pit8253.h"
1515#include "machine/pic8259.h"
16#include "machine/msm8251.h"
1617#include "machine/wd17xx.h"
1718#include "devices/basicdsk.h"
1819#include "includes/b2m.h"
r2525r2526
3233   AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(PIT8253, "pit8253", pit8253_r,pit8253_w)
3334   AM_RANGE(0x04, 0x07) AM_READWRITE(b2m_8255_1_r,b2m_8255_1_w)
3435     AM_RANGE(0x08, 0x0b) AM_READWRITE(b2m_8255_0_r,b2m_8255_0_w)
35  //AM_RANGE(0x0c, 0x0c) AM_READWRITE(b2m_localmachine_r,b2m_localmachine_w)
36//  AM_RANGE(0x10, 0x13) AM_READWRITE(b2m_palette_r,b2m_palette_w)   
36    AM_RANGE(0x0c, 0x0c) AM_READWRITE(b2m_localmachine_r,b2m_localmachine_w)
37   AM_RANGE(0x10, 0x13) AM_READWRITE(b2m_palette_r,b2m_palette_w)   
3738   AM_RANGE(0x14, 0x15) AM_DEVREADWRITE(PIC8259, "pic8259", pic8259_r, pic8259_w )
39   AM_RANGE(0x18, 0x18) AM_READWRITE(msm8251_data_r,msm8251_data_w)
40   AM_RANGE(0x19, 0x19) AM_READWRITE(msm8251_status_r,msm8251_control_w)
3841     AM_RANGE(0x1c, 0x1c) AM_READWRITE(wd17xx_status_r,wd17xx_command_w)
3942     AM_RANGE(0x1d, 0x1d) AM_READWRITE(wd17xx_track_r,wd17xx_track_w)
4043     AM_RANGE(0x1e, 0x1e) AM_READWRITE(wd17xx_sector_r,wd17xx_sector_w)
r2525r2526
4649   AM_RANGE(0x00, 0x03) AM_DEVREADWRITE(PIT8253, "pit8253", pit8253_r,pit8253_w)
4750   AM_RANGE(0x04, 0x07) AM_READWRITE(b2m_8255_2_r,b2m_8255_2_w)
4851     AM_RANGE(0x08, 0x0b) AM_READWRITE(b2m_8255_0_r,b2m_8255_0_w)
49  //AM_RANGE(0x0c, 0x0c) AM_READWRITE(b2m_localmachine_r,b2m_localmachine_w)
50//  AM_RANGE(0x10, 0x13) AM_READWRITE(b2m_palette_r,b2m_palette_w)   
52    AM_RANGE(0x0c, 0x0c) AM_READWRITE(b2m_localmachine_r,b2m_localmachine_w)
53   AM_RANGE(0x10, 0x13) AM_READWRITE(b2m_palette_r,b2m_palette_w)   
5154   AM_RANGE(0x14, 0x15) AM_DEVREADWRITE(PIC8259, "pic8259", pic8259_r, pic8259_w )
52     AM_RANGE(0x1c, 0x1c) AM_READWRITE(wd17xx_status_r,wd17xx_command_w)
53     AM_RANGE(0x1d, 0x1d) AM_READWRITE(wd17xx_track_r,wd17xx_track_w)
54     AM_RANGE(0x1e, 0x1e) AM_READWRITE(wd17xx_sector_r,wd17xx_sector_w)
55     AM_RANGE(0x1f, 0x1f) AM_READWRITE(wd17xx_data_r,wd17xx_data_w)   
55   AM_RANGE(0x18, 0x18) AM_READWRITE(msm8251_data_r,msm8251_data_w)
56   AM_RANGE(0x19, 0x19) AM_READWRITE(msm8251_status_r,msm8251_control_w)
5657ADDRESS_MAP_END
5758
5859
r2525r2526
157158      PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3)
158159      PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2)
159160      PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1)
161   PORT_START /* port 11 */
162      PORT_CONFNAME(0x01, 0x01, "Monitor")
163         PORT_CONFSETTING(0x01, "Color")     
164         PORT_CONFSETTING(0x00, "B/W")         
160165INPUT_PORTS_END
161166 
162167/* Machine driver */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team