src/mess/drivers/mycom.c
| r8679 | r8680 | |
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | | Japan Electronics College MYCOMZ-80A |
| 3 | MYCOMZ-80A (c) 1981 Japan Electronics College |
| 4 | 4 | |
| 5 | | 21/07/2010 Skeleton driver. |
| 5 | preliminary driver by Angelo Salese |
| 6 | 6 | |
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| r8679 | r8680 | |
| 16 | 16 | static UINT16 vram_addr; |
| 17 | 17 | static UINT16 cursor_addr,cursor_raster; |
| 18 | 18 | static UINT8 keyb_press,keyb_press_flag,shift_press_flag; |
| 19 | static UINT8 video_mode; |
| 19 | 20 | |
| 20 | 21 | static VIDEO_START( mycom ) |
| 21 | 22 | { |
| r8679 | r8680 | |
| 25 | 26 | { |
| 26 | 27 | int x,y,count; |
| 27 | 28 | int xi,yi; |
| 29 | int width; |
| 28 | 30 | static UINT8 *vram = memory_region(screen->machine, "vram"); |
| 29 | 31 | static UINT8 *gfx_rom = memory_region(screen->machine, "gfx"); |
| 30 | 32 | |
| 31 | 33 | count = 0; |
| 32 | 34 | |
| 33 | | for(y=0;y<24;y++) |
| 35 | if(video_mode & 0x40) |
| 34 | 36 | { |
| 35 | | for(x=0;x<40;x++) |
| 37 | width = (video_mode & 0x80) ? 160 : 320; |
| 38 | |
| 39 | for(y=0;y<24;y++) |
| 36 | 40 | { |
| 37 | | int tile = vram[count]; |
| 38 | | //int color = (display_reg & 0x80) ? 7 : (attr & 0x07); |
| 41 | for(x=0;x<width;x+=4) |
| 42 | { |
| 43 | //int xi,yi; |
| 44 | int xi,yi; |
| 39 | 45 | |
| 40 | | for(yi=0;yi<8;yi++) |
| 41 | | { |
| 42 | | for(xi=0;xi<8;xi++) |
| 46 | for(yi=0;yi<4;yi++) |
| 43 | 47 | { |
| 44 | | int pen; |
| 48 | for(xi=0;xi<2;xi++) |
| 49 | { |
| 50 | int pen; |
| 45 | 51 | |
| 46 | | pen = (gfx_rom[tile*8+yi] >> (7-xi) & 1) ? 1 : 0; |
| 52 | pen = vram[count] >> (yi+(xi*4)); |
| 53 | pen &= 1; |
| 47 | 54 | |
| 48 | | //if(pen) |
| 49 | | *BITMAP_ADDR16(bitmap, y*8+yi, x*8+xi) = screen->machine->pens[pen]; |
| 55 | *BITMAP_ADDR16(bitmap, y*8+(yi*2+0), (x+(xi*2+0))*2+0) = screen->machine->pens[pen]; |
| 56 | *BITMAP_ADDR16(bitmap, y*8+(yi*2+0), (x+(xi*2+1))*2+0) = screen->machine->pens[pen]; |
| 57 | *BITMAP_ADDR16(bitmap, y*8+(yi*2+1), (x+(xi*2+0))*2+0) = screen->machine->pens[pen]; |
| 58 | *BITMAP_ADDR16(bitmap, y*8+(yi*2+1), (x+(xi*2+1))*2+0) = screen->machine->pens[pen]; |
| 59 | *BITMAP_ADDR16(bitmap, y*8+(yi*2+0), (x+(xi*2+0))*2+1) = screen->machine->pens[pen]; |
| 60 | *BITMAP_ADDR16(bitmap, y*8+(yi*2+0), (x+(xi*2+1))*2+1) = screen->machine->pens[pen]; |
| 61 | *BITMAP_ADDR16(bitmap, y*8+(yi*2+1), (x+(xi*2+0))*2+1) = screen->machine->pens[pen]; |
| 62 | *BITMAP_ADDR16(bitmap, y*8+(yi*2+1), (x+(xi*2+1))*2+1) = screen->machine->pens[pen]; |
| 63 | } |
| 50 | 64 | } |
| 65 | |
| 66 | count++; |
| 51 | 67 | } |
| 68 | } |
| 52 | 69 | |
| 53 | | if(cursor_addr == count) |
| 70 | return 0; |
| 71 | } |
| 72 | else |
| 73 | { |
| 74 | width = (video_mode & 0x80) ? 40 : 80; |
| 75 | |
| 76 | for(y=0;y<24;y++) |
| 77 | { |
| 78 | for(x=0;x<width;x++) |
| 54 | 79 | { |
| 55 | | int xc,yc,cursor_on; |
| 80 | int tile = vram[count]; |
| 81 | //int color = (display_reg & 0x80) ? 7 : (attr & 0x07); |
| 56 | 82 | |
| 57 | | cursor_on = 0; |
| 58 | | switch(cursor_raster & 0x60) |
| 59 | | { |
| 60 | | case 0x00: cursor_on = 1; break; //always on |
| 61 | | case 0x20: cursor_on = 0; break; //always off |
| 62 | | case 0x40: if(screen->machine->primary_screen->frame_number() & 0x10) { cursor_on = 1; } break; //fast blink |
| 63 | | case 0x60: if(screen->machine->primary_screen->frame_number() & 0x20) { cursor_on = 1; } break; //slow blink |
| 64 | | } |
| 83 | for(yi=0;yi<8;yi++) |
| 84 | { |
| 85 | for(xi=0;xi<8;xi++) |
| 86 | { |
| 87 | int pen; |
| 65 | 88 | |
| 66 | | if(cursor_on) |
| 67 | | { |
| 68 | | for(yc=0;yc<(8-(cursor_raster & 7));yc++) |
| 89 | pen = (gfx_rom[tile*8+yi] >> (7-xi) & 1) ? 1 : 0; |
| 90 | |
| 91 | //if(pen) |
| 92 | *BITMAP_ADDR16(bitmap, y*8+yi, x*8+xi) = screen->machine->pens[pen]; |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | if(cursor_addr == count) |
| 69 | 97 | { |
| 70 | | for(xc=0;xc<8;xc++) |
| 98 | int xc,yc,cursor_on; |
| 99 | |
| 100 | cursor_on = 0; |
| 101 | switch(cursor_raster & 0x60) |
| 71 | 102 | { |
| 72 | | *BITMAP_ADDR16(bitmap, y*8+yc, x*8+xc) = screen->machine->pens[0x1]; |
| 103 | case 0x00: cursor_on = 1; break; //always on |
| 104 | case 0x20: cursor_on = 0; break; //always off |
| 105 | case 0x40: if(screen->machine->primary_screen->frame_number() & 0x10) { cursor_on = 1; } break; //fast blink |
| 106 | case 0x60: if(screen->machine->primary_screen->frame_number() & 0x20) { cursor_on = 1; } break; //slow blink |
| 73 | 107 | } |
| 108 | |
| 109 | if(cursor_on) |
| 110 | { |
| 111 | for(yc=0;yc<(8-(cursor_raster & 7));yc++) |
| 112 | { |
| 113 | for(xc=0;xc<8;xc++) |
| 114 | { |
| 115 | *BITMAP_ADDR16(bitmap, y*8+yc, x*8+xc) = screen->machine->pens[0x1]; |
| 116 | } |
| 117 | } |
| 118 | } |
| 74 | 119 | } |
| 75 | | } |
| 120 | |
| 121 | count++; |
| 76 | 122 | } |
| 77 | | |
| 78 | | count++; |
| 79 | 123 | } |
| 80 | 124 | } |
| 81 | 125 | |
| r8679 | r8680 | |
| 210 | 254 | PORT_BIT(0x00000080,IP_ACTIVE_HIGH,IPT_UNUSED) //0x27 ' |
| 211 | 255 | PORT_BIT(0x00000100,IP_ACTIVE_HIGH,IPT_UNUSED) //0x28 ( |
| 212 | 256 | PORT_BIT(0x00000200,IP_ACTIVE_HIGH,IPT_UNUSED) //0x29 ) |
| 213 | | PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2a * |
| 257 | PORT_BIT(0x00000400,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK) PORT_CHAR('*') //0x2a * |
| 214 | 258 | PORT_BIT(0x00000800,IP_ACTIVE_HIGH,IPT_UNUSED) |
| 215 | 259 | PORT_BIT(0x00001000,IP_ACTIVE_HIGH,IPT_UNUSED) //0x2c , |
| 216 | 260 | PORT_BIT(0x00002000,IP_ACTIVE_HIGH,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') |
| r8679 | r8680 | |
| 346 | 390 | return keyb_press; |
| 347 | 391 | } |
| 348 | 392 | |
| 393 | static WRITE8_DEVICE_HANDLER( output_1c ) |
| 394 | { |
| 395 | /* |
| 396 | x--- ---- width 80/40 (0 = 80, 1 = 40) |
| 397 | -x-- ---- video mode (0= tile, 1 = bitmap) |
| 398 | --x- ---- PSG CS bit |
| 399 | ---x ---- PSG WE bit |
| 400 | ---- x--- cmt remote |
| 401 | ---- -x-- cmt output |
| 402 | ---- --x- printer reset |
| 403 | ---- ---x printer strobe |
| 404 | */ |
| 405 | |
| 406 | video_mode = data & 0xc0; |
| 407 | } |
| 408 | |
| 349 | 409 | static I8255A_INTERFACE( ppi8255_intf_0 ) |
| 350 | 410 | { |
| 351 | 411 | DEVCB_NULL, /* Port A read */ |
| r8679 | r8680 | |
| 363 | 423 | DEVCB_NULL, /* Port C read */ |
| 364 | 424 | DEVCB_NULL, /* Port A write */ |
| 365 | 425 | DEVCB_NULL, /* Port B write */ |
| 366 | | DEVCB_NULL /* Port C write */ |
| 426 | DEVCB_HANDLER(output_1c) /* Port C write */ |
| 367 | 427 | }; |
| 368 | 428 | |
| 369 | 429 | static I8255A_INTERFACE( ppi8255_intf_2 ) |