src/mess/drivers/bml3.c
| r8641 | r8642 | |
| 10 | 10 | #include "cpu/m6809/m6809.h" |
| 11 | 11 | #include "video/mc6845.h" |
| 12 | 12 | |
| 13 | static UINT8 *work_ram; |
| 14 | static UINT16 cursor_addr,cursor_raster; |
| 15 | |
| 13 | 16 | static VIDEO_START( bml3 ) |
| 14 | 17 | { |
| 15 | 18 | } |
| 16 | 19 | |
| 17 | 20 | static VIDEO_UPDATE( bml3 ) |
| 18 | 21 | { |
| 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 | |
| 19 | 81 | return 0; |
| 20 | 82 | } |
| 21 | 83 | |
| r8641 | r8642 | |
| 30 | 92 | } |
| 31 | 93 | else |
| 32 | 94 | { |
| 33 | | /*if(addr_latch == 0x0a) |
| 95 | if(addr_latch == 0x0a) |
| 34 | 96 | cursor_raster = data; |
| 35 | 97 | if(addr_latch == 0x0e) |
| 36 | 98 | cursor_addr = ((data<<8) & 0x3f00) | (cursor_addr & 0xff); |
| 37 | 99 | else if(addr_latch == 0x0f) |
| 38 | | cursor_addr = (cursor_addr & 0x3f00) | (data & 0xff);*/ |
| 100 | cursor_addr = (cursor_addr & 0x3f00) | (data & 0xff); |
| 39 | 101 | |
| 40 | 102 | mc6845_register_w(space->machine->device("crtc"), 0,data); |
| 41 | 103 | } |
| r8641 | r8642 | |
| 55 | 117 | if(offset == 0xc8) //this seems the keyboard status |
| 56 | 118 | return 0; |
| 57 | 119 | |
| 120 | if(offset == 0xc9) |
| 121 | return 0x11; //put 320 x 200 mode |
| 122 | |
| 58 | 123 | /* TODO: pretty sure that there's a bankswitch for this */ |
| 59 | 124 | return rom[offset+0xff00]; |
| 60 | 125 | } |
| r8641 | r8642 | |
| 70 | 135 | |
| 71 | 136 | static ADDRESS_MAP_START(bml3_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 72 | 137 | ADDRESS_MAP_UNMAP_HIGH |
| 73 | | AM_RANGE(0x0000, 0x9fff) AM_RAM |
| 138 | AM_RANGE(0x0000, 0x9fff) AM_RAM AM_BASE(&work_ram) |
| 74 | 139 | AM_RANGE(0xff00, 0xffff) AM_READWRITE(bml3_io_r,bml3_io_w) |
| 75 | 140 | AM_RANGE(0xa000, 0xffff) AM_ROM |
| 76 | 141 | ADDRESS_MAP_END |
| r8641 | r8642 | |
| 114 | 179 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 115 | 180 | MDRV_SCREEN_SIZE(640, 480) |
| 116 | 181 | 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) |
| 119 | 183 | |
| 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 */ |
| 121 | 185 | |
| 122 | | |
| 123 | 186 | MDRV_VIDEO_START(bml3) |
| 124 | 187 | MDRV_VIDEO_UPDATE(bml3) |
| 125 | 188 | MACHINE_DRIVER_END |
| r8641 | r8642 | |
| 128 | 191 | ROM_START( bml3 ) |
| 129 | 192 | ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) |
| 130 | 193 | 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) |
| 131 | 198 | ROM_END |
| 132 | 199 | |
| 133 | 200 | /* Driver */ |