r8642 Tuesday 27th July, 2010 at 19:09:20 UTC by Angelo Salese
[BASIC MASTER LV3]: Implemented basic video ram, added fake char rom for now (taken from Sharp X1)
[src/mess/drivers]bml3.c

src/mess/drivers/bml3.c
r8641r8642
1010#include "cpu/m6809/m6809.h"
1111#include "video/mc6845.h"
1212
13static UINT8 *work_ram;
14static UINT16 cursor_addr,cursor_raster;
15
1316static VIDEO_START( bml3 )
1417{
1518}
1619
1720static VIDEO_UPDATE( bml3 )
1821{
22   int x,y,count;
23   int xi,yi;
24   static UINT8 *gfx_rom = memory_region(screen->machine, "char");
25
26   count = 0x0400;
27
28   for(y=0;y<25;y++)
29   {
30      for(x=0;x<40;x++)
31      {
32         int pen_b = work_ram[count+0x0000];
33         int pen_r = work_ram[count+0x0000];
34         int pen_g = work_ram[count+0x0000];
35
36         for(yi=0;yi<8;yi++)
37         {
38            for(xi=0;xi<8;xi++)
39            {
40               int pen[3],color;
41
42               pen[0] = (gfx_rom[pen_b*8+yi] >> (7-xi) & 1) ? 1 : 0;
43               pen[1] = (gfx_rom[pen_r*8+yi] >> (7-xi) & 1) ? 2 : 0;
44               pen[2] = (gfx_rom[pen_g*8+yi] >> (7-xi) & 1) ? 4 : 0;
45
46               color = (pen[0]) | (pen[1]) | (pen[2]);
47
48               *BITMAP_ADDR16(bitmap, y*8+yi, x*8+xi) = screen->machine->pens[color];
49            }
50         }
51
52         if(cursor_addr == count)
53         {
54            int xc,yc,cursor_on;
55
56            cursor_on = 0;
57            switch(cursor_raster & 0x60)
58            {
59               case 0x00: cursor_on = 1; break; //always on
60               case 0x20: cursor_on = 0; break; //always off
61               case 0x40: if(screen->machine->primary_screen->frame_number() & 0x10) { cursor_on = 1; } break; //fast blink
62               case 0x60: if(screen->machine->primary_screen->frame_number() & 0x20) { cursor_on = 1; } break; //slow blink
63            }
64
65            if(cursor_on)
66            {
67               for(yc=0;yc<(8-(cursor_raster & 7));yc++)
68               {
69                  for(xc=0;xc<8;xc++)
70                  {
71                     *BITMAP_ADDR16(bitmap, y*8+yc+7, x*8+xc) = screen->machine->pens[0x7];
72                  }
73               }
74            }
75         }
76
77         count++;
78      }
79   }
80
1981    return 0;
2082}
2183
r8641r8642
3092   }
3193   else
3294   {
33      /*if(addr_latch == 0x0a)
95      if(addr_latch == 0x0a)
3496         cursor_raster = data;
3597      if(addr_latch == 0x0e)
3698         cursor_addr = ((data<<8) & 0x3f00) | (cursor_addr & 0xff);
3799      else if(addr_latch == 0x0f)
38         cursor_addr = (cursor_addr & 0x3f00) | (data & 0xff);*/
100         cursor_addr = (cursor_addr & 0x3f00) | (data & 0xff);
39101
40102      mc6845_register_w(space->machine->device("crtc"), 0,data);
41103   }
r8641r8642
55117   if(offset == 0xc8) //this seems the keyboard status
56118      return 0;
57119
120   if(offset == 0xc9)
121      return 0x11; //put 320 x 200 mode
122
58123   /* TODO: pretty sure that there's a bankswitch for this */
59124   return rom[offset+0xff00];
60125}
r8641r8642
70135
71136static ADDRESS_MAP_START(bml3_mem, ADDRESS_SPACE_PROGRAM, 8)
72137   ADDRESS_MAP_UNMAP_HIGH
73   AM_RANGE(0x0000, 0x9fff) AM_RAM
138   AM_RANGE(0x0000, 0x9fff) AM_RAM AM_BASE(&work_ram)
74139   AM_RANGE(0xff00, 0xffff) AM_READWRITE(bml3_io_r,bml3_io_w)
75140   AM_RANGE(0xa000, 0xffff) AM_ROM
76141ADDRESS_MAP_END
r8641r8642
114179    MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
115180    MDRV_SCREEN_SIZE(640, 480)
116181    MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
117    MDRV_PALETTE_LENGTH(2)
118    MDRV_PALETTE_INIT(black_and_white)
182    MDRV_PALETTE_LENGTH(8)
119183
120   MDRV_MC6845_ADD("crtc", H46505, XTAL_3_579545MHz, mc6845_intf)   /* unknown clock, hand tuned to get ~60 fps */
184   MDRV_MC6845_ADD("crtc", H46505, XTAL_3_579545MHz/4, mc6845_intf)   /* unknown clock, hand tuned to get ~60 fps */
121185
122
123186    MDRV_VIDEO_START(bml3)
124187    MDRV_VIDEO_UPDATE(bml3)
125188MACHINE_DRIVER_END
r8641r8642
128191ROM_START( bml3 )
129192    ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
130193   ROM_LOAD( "l3bas.rom", 0xa000, 0x6000, CRC(d81baa07) SHA1(a8fd6b29d8c505b756dbf5354341c48f9ac1d24d))
194
195    ROM_REGION( 0x800, "char", 0 )
196   ROM_LOAD("char.rom", 0x00000, 0x00800, BAD_DUMP CRC(e3995a57) SHA1(1c1a0d8c9f4c446ccd7470516b215ddca5052fb2) ) //Taken from Sharp X1
197   ROM_FILL( 0x0000, 0x0008, 0x00)
131198ROM_END
132199
133200/* Driver */

Previous 509070 RevisionsNext 50


© 1998-2010 The MESS Team