src/mess/drivers/pc8801.c
| r10096 | r10097 | |
| 182 | 182 | |
| 183 | 183 | [4] x--- ---- attribute not separate flag |
| 184 | 184 | [4] -x-- ---- attribute color flag |
| 185 | | [4] --x- ---- attribute not special flag |
| 185 | [4] --x- ---- attribute not special flag (invalidates next register) |
| 186 | [4] ---x xxxx attribute size (+1) |
| 186 | 187 | */ |
| 187 | 188 | |
| 188 | 189 | #define blink_speed ((((crtc.param[0][1] & 0xc0) >> 6) + 1) << 3) |
| 190 | #define text_color_flag (crtc.param[0][4] & 0x40) |
| 189 | 191 | |
| 190 | 192 | static struct |
| 191 | 193 | { |
| r10096 | r10097 | |
| 310 | 312 | return 0; |
| 311 | 313 | } |
| 312 | 314 | |
| 315 | |
| 316 | |
| 317 | static UINT8 extract_text_attribute(running_machine *machine,UINT32 address,int x,int swap) |
| 318 | { |
| 319 | UINT8 *vram = machine->region("maincpu")->base() + WRAM_BASE; |
| 320 | int i; |
| 321 | int fifo_size; |
| 322 | |
| 323 | if(crtc.param[0][4] & 0x80) |
| 324 | { |
| 325 | popmessage("Using non-separate mode for text tilemap, contact MESSdev"); |
| 326 | return 0; |
| 327 | } |
| 328 | |
| 329 | fifo_size = (crtc.param[0][4] & 0x20) ? 0 : ((crtc.param[0][4] & 0x1f) + 1); |
| 330 | |
| 331 | for(i=0;i<fifo_size;i++) |
| 332 | { |
| 333 | /* TODO: do we have a bug lying to somewhere else? N-BASIC attributes doesn't work without this +2 ... */ |
| 334 | if(x < vram[address+swap]) |
| 335 | { |
| 336 | return vram[address+1]; |
| 337 | } |
| 338 | else |
| 339 | address+=2; |
| 340 | } |
| 341 | |
| 342 | return 0; |
| 343 | } |
| 344 | |
| 313 | 345 | static void draw_text_80(running_machine *machine, bitmap_t *bitmap,int y_size) |
| 314 | 346 | { |
| 315 | 347 | int x,y; |
| r10096 | r10097 | |
| 317 | 349 | UINT8 *vram = machine->region("maincpu")->base() + WRAM_BASE; |
| 318 | 350 | UINT8 is_cursor; |
| 319 | 351 | UINT8 y_height; |
| 352 | UINT8 attr; |
| 353 | UINT8 reverse; |
| 354 | UINT8 pal; |
| 320 | 355 | |
| 321 | 356 | y_height = y_size == 20 ? 10 : 8; |
| 322 | 357 | |
| r10096 | r10097 | |
| 324 | 359 | { |
| 325 | 360 | for(x=0;x<80;x++) |
| 326 | 361 | { |
| 362 | attr = extract_text_attribute(machine,(((y*120)+80+dma_address[2]) & 0xffff),(x),0); |
| 363 | |
| 364 | if(text_color_flag) |
| 365 | pal = (attr & 0xe0) >> 5; |
| 366 | else |
| 367 | pal = 7; |
| 368 | |
| 369 | reverse = attr & 4; |
| 370 | |
| 327 | 371 | for(yi=0;yi<8;yi++) |
| 328 | 372 | { |
| 329 | 373 | is_cursor = calc_cursor_pos(machine,x,y,yi); |
| r10096 | r10097 | |
| 340 | 384 | res_x = x*8+xi; |
| 341 | 385 | res_y = y*y_height+yi; |
| 342 | 386 | |
| 343 | | if(is_cursor) |
| 344 | | color = ((gfx_data[tile*8+yi] >> (7-xi)) & 1) ? -1 : 7; |
| 387 | if(is_cursor || reverse) |
| 388 | color = ((gfx_data[tile*8+yi] >> (7-xi)) & 1) ? -1 : pal; |
| 345 | 389 | else |
| 346 | | color = ((gfx_data[tile*8+yi] >> (7-xi)) & 1) ? 7 : -1; |
| 390 | color = ((gfx_data[tile*8+yi] >> (7-xi)) & 1) ? pal : -1; |
| 347 | 391 | |
| 348 | 392 | if((res_x)<=machine->primary_screen->visible_area().max_x && (res_y)<=machine->primary_screen->visible_area().max_y) |
| 349 | 393 | if(color != -1) |
| r10096 | r10097 | |
| 361 | 405 | UINT8 *vram = machine->region("maincpu")->base() + WRAM_BASE; |
| 362 | 406 | UINT8 is_cursor; |
| 363 | 407 | UINT8 y_height; |
| 408 | UINT8 attr; |
| 409 | UINT8 reverse; |
| 364 | 410 | |
| 365 | 411 | y_height = y_size == 20 ? 10 : 8; |
| 366 | 412 | |
| r10096 | r10097 | |
| 371 | 417 | if(x & 1) |
| 372 | 418 | continue; |
| 373 | 419 | |
| 420 | attr = extract_text_attribute(machine,(((y*120)+80+dma_address[2]) & 0xffff),(x),2); |
| 421 | |
| 422 | reverse = attr & 4; |
| 423 | |
| 374 | 424 | for(yi=0;yi<8;yi++) |
| 375 | 425 | { |
| 376 | 426 | is_cursor = calc_cursor_pos(machine,x,y,yi); |
| r10096 | r10097 | |
| 387 | 437 | res_x = (x*8)+xi*2; |
| 388 | 438 | res_y = (y*y_height)+yi; |
| 389 | 439 | |
| 390 | | if(is_cursor) |
| 440 | if(is_cursor || reverse) |
| 391 | 441 | color = ((gfx_data[tile*8+yi] >> (7-xi)) & 1) ? -1 : 7; |
| 392 | 442 | else |
| 393 | 443 | color = ((gfx_data[tile*8+yi] >> (7-xi)) & 1) ? 7 : -1; |
| r10096 | r10097 | |
| 420 | 470 | { |
| 421 | 471 | static int y_size; |
| 422 | 472 | |
| 473 | //popmessage("%02x %02x",crtc.param[0][0],crtc.param[0][4]); |
| 474 | |
| 423 | 475 | y_size = (crtc.param[0][1] & 0x3f) + 1; |
| 424 | 476 | |
| 425 | 477 | if(y_size < 20) y_size = 20; |