src/mess/drivers/pc8801.c
| r10061 | r10062 | |
| 9 | 9 | later models at some point. |
| 10 | 10 | - macros for the various rom / ram areas, it might require various attempts in order to finally get a reasonable arrangement ... |
| 11 | 11 | - dipswitches are WRONG |
| 12 | | - currently it's too slow ... why? |
| 13 | 12 | - implement proper i8214 routing, also add irq latch mechanism. |
| 14 | 13 | - below notes states that plain PC-8801 doesn't have a disk CPU, but the BIOS clearly checks the floppy ports. Wrong info? |
| 14 | - cursor is 8 x 10, not 8 x 8 as current implementation. |
| 15 | 15 | |
| 16 | 16 | Notes: |
| 17 | 17 | - BIOS disk ROM defines what kind of floppies you could load: |
| r10061 | r10062 | |
| 116 | 116 | static UINT8 window_offset_bank; |
| 117 | 117 | static UINT8 layer_mask; |
| 118 | 118 | |
| 119 | /* |
| 120 | CRTC command params: |
| 121 | 0. CRTC reset |
| 122 | |
| 123 | [0] -xxx xxxx screen columns (+2) |
| 124 | [1] xx-- ---- blink speed (in frame unit) (+1, << 3) |
| 125 | [1] --xx xxxx screen lines (+1) |
| 126 | [2] x--- ---- "skip line" |
| 127 | [2] -x-- ---- cursor style (reverse on / underscore off) |
| 128 | [2] --x- ---- cursor blink on/off |
| 129 | |
| 130 | [4] x--- ---- attribute not separate flag |
| 131 | [4] -x-- ---- attribute color flag |
| 132 | [4] --x- ---- attribute not special flag |
| 133 | */ |
| 134 | |
| 135 | #define blink_speed ((((crtc.param[0][1] & 0xc0) >> 6) + 1) << 3) |
| 136 | |
| 137 | static struct |
| 138 | { |
| 139 | UINT8 cmd,param_count,cursor_on; |
| 140 | UINT8 param[8][5]; |
| 141 | }crtc; |
| 142 | |
| 119 | 143 | #define NBASIC_BASE 0x20000 |
| 120 | 144 | #define N88BASIC_BASE 0x28000 |
| 121 | 145 | #define WRAM_BASE 0x00000 |
| r10061 | r10062 | |
| 126 | 150 | |
| 127 | 151 | } |
| 128 | 152 | |
| 153 | static UINT8 calc_cursor_pos(running_machine *machine,int x,int y,int yi) |
| 154 | { |
| 155 | if(!(crtc.cursor_on)) // don't bother if cursor is off |
| 156 | return 0; |
| 157 | |
| 158 | if(x == crtc.param[4][0] && y == crtc.param[4][1]) /* check if position matches */ |
| 159 | { |
| 160 | /* don't pass through if we are using underscore */ |
| 161 | if((!(crtc.param[0][2] & 0x40)) && yi != 7) |
| 162 | return 0; |
| 163 | |
| 164 | /* finally check if blinking is currently active high */ |
| 165 | if(!(crtc.param[0][2] & 0x20)) |
| 166 | return 1; |
| 167 | |
| 168 | if(((machine->primary_screen->frame_number() / blink_speed) & 1) == 0) |
| 169 | return 1; |
| 170 | |
| 171 | return 0; |
| 172 | } |
| 173 | |
| 174 | return 0; |
| 175 | } |
| 176 | |
| 129 | 177 | static VIDEO_UPDATE( pc8801 ) |
| 130 | 178 | { |
| 131 | 179 | int x,y; |
| r10061 | r10062 | |
| 133 | 181 | UINT8 *vram = screen->machine->region("maincpu")->base() + WRAM_BASE; |
| 134 | 182 | UINT8 *gvram = screen->machine->region("maincpu")->base() + GRAM_BASE; |
| 135 | 183 | UINT32 count; |
| 184 | UINT8 is_cursor; |
| 136 | 185 | |
| 137 | 186 | count = 0; |
| 138 | 187 | |
| r10061 | r10062 | |
| 177 | 226 | res_x = x*8+xi; |
| 178 | 227 | res_y = y*8+yi; |
| 179 | 228 | |
| 180 | | color = ((gfx_data[tile*8+yi] >> (7-xi)) & 1) ? 7 : -1; |
| 229 | is_cursor = calc_cursor_pos(screen->machine,x,y,yi); |
| 181 | 230 | |
| 231 | if(is_cursor) |
| 232 | color = ((gfx_data[tile*8+yi] >> (7-xi)) & 1) ? -1 : 7; |
| 233 | else |
| 234 | color = ((gfx_data[tile*8+yi] >> (7-xi)) & 1) ? 7 : -1; |
| 235 | |
| 182 | 236 | if((res_x)<=screen->machine->primary_screen->visible_area().max_x && (res_y)<=screen->machine->primary_screen->visible_area().max_y) |
| 183 | 237 | if(color != -1) |
| 184 | 238 | *BITMAP_ADDR16(bitmap, res_y, res_x) = screen->machine->pens[color]; |
| r10061 | r10062 | |
| 488 | 542 | |
| 489 | 543 | static WRITE8_HANDLER( pc88_crtc_param_w ) |
| 490 | 544 | { |
| 545 | if(crtc.param_count < 5) |
| 546 | { |
| 547 | crtc.param[crtc.cmd][crtc.param_count] = data; |
| 548 | crtc.param_count++; |
| 549 | } |
| 491 | 550 | } |
| 492 | 551 | |
| 493 | 552 | static READ8_HANDLER( pc8801_crtc_status_r ) |
| r10061 | r10062 | |
| 495 | 554 | return 0xff; |
| 496 | 555 | } |
| 497 | 556 | |
| 498 | | /* |
| 499 | | CRTC_RESET = 0, |
| 500 | | CRTC_STOP_DISPLAY = 0, |
| 501 | | CRTC_START_DISPLAY, |
| 502 | | CRTC_SET_INTERRUPT_MASK, |
| 503 | | CRTC_READ_LIGHT_PEN, |
| 504 | | CRTC_LOAD_CURSOR_POSITION, |
| 505 | | CRTC_RESET_INTERRUPT, |
| 506 | | CRTC_RESET_COUNTERS, |
| 507 | | CRTC_READ_STATUS, |
| 508 | | */ |
| 509 | | |
| 510 | 557 | static const char *const crtc_command[] = |
| 511 | 558 | { |
| 512 | 559 | "Reset / Stop Display", // 0 |
| r10061 | r10062 | |
| 521 | 568 | |
| 522 | 569 | static WRITE8_HANDLER( pc88_crtc_cmd_w ) |
| 523 | 570 | { |
| 571 | crtc.cmd = (data & 0xe0) >> 5; |
| 572 | crtc.param_count = 0; |
| 573 | |
| 574 | if(crtc.cmd == 4) // load cursor position ON/OFF |
| 575 | crtc.cursor_on = data & 1; |
| 576 | |
| 524 | 577 | if((data >> 5) != 4) |
| 525 | 578 | printf("CRTC cmd %s polled\n",crtc_command[data >> 5]); |
| 526 | | |
| 527 | 579 | } |
| 528 | 580 | |
| 529 | 581 | static ADDRESS_MAP_START( pc8801_io, ADDRESS_SPACE_IO, 8 ) |
| r10061 | r10062 | |
| 1050 | 1102 | for(i=0;i<0x10000;i++) |
| 1051 | 1103 | gvram[i] = 0x00; |
| 1052 | 1104 | } |
| 1105 | |
| 1106 | { |
| 1107 | crtc.param_count = 0; |
| 1108 | crtc.cmd = 0; |
| 1109 | } |
| 1053 | 1110 | } |
| 1054 | 1111 | |
| 1055 | 1112 | static PALETTE_INIT( pc8801 ) |