src/mess/video/super80.c
| r4396 | r4397 | |
| 119 | 119 | videoram[offset+0x800] = data;
|
| 120 | 120 | |
| 121 | 121 | if (super80v_rom_pcg)
|
| 122 | | {
|
| 123 | | int chr = 0x80 + (offset>>4);
|
| 124 | 122 | pcgram[0x800+offset] = data;
|
| 125 | | |
| 126 | | /* decode character graphics again */
|
| 127 | | gfx_element_mark_dirty(space->machine->gfx[0], chr);
|
| 128 | | }
|
| 129 | 123 | }
|
| 130 | 124 | }
|
| 131 | 125 | |
| r4396 | r4397 | |
| 213 | 207 | if (screen_on)
|
| 214 | 208 | code = memory_read_byte(cputag_get_address_space(screen->machine,"maincpu",ADDRESS_SPACE_PROGRAM), vidpg | x | (y<<5));
|
| 215 | 209 | |
| 216 | | drawgfx(bitmap, screen->machine->gfx[0], code & mask, 0, 0, 0, x*8, y*10,
|
| 217 | | cliprect, TRANSPARENCY_NONE, 0);
|
| 210 | drawgfx(bitmap, screen->machine->gfx[0], code & mask, 0, 0, 0, x*8, y*10, cliprect, TRANSPARENCY_NONE, 0);
|
| 218 | 211 | }
|
| 219 | 212 | }
|
| 220 | 213 | |
| r4396 | r4397 | |
| 251 | 244 | if (!(options & 0x40)) col = memory_read_byte(cputag_get_address_space(screen->machine,"maincpu",ADDRESS_SPACE_PROGRAM), 0xfe00 | x | (y<<5)); /* byte of colour to display */
|
| 252 | 245 | }
|
| 253 | 246 | |
| 254 | | drawgfx(bitmap, screen->machine->gfx[cgen], code, col, 0, 0, x*8, y*10,
|
| 255 | | cliprect, TRANSPARENCY_NONE, 0);
|
| 247 | drawgfx(bitmap, screen->machine->gfx[cgen], code, col, 0, 0, x*8, y*10, cliprect, TRANSPARENCY_NONE, 0);
|
| 256 | 248 | }
|
| 257 | 249 | }
|
| 258 | 250 | |
| r4396 | r4397 | |
| 261 | 253 | |
| 262 | 254 | VIDEO_UPDATE( super80v )
|
| 263 | 255 | {
|
| 256 | UINT8 y,z,chr,col,gfx,fg,bg;
|
| 257 | UINT16 mem,sy=0,sx=0,x;
|
| 264 | 258 | static UINT8 framecnt=0;
|
| 265 | | UINT16 i, bytes = mc6845_reg[1]*mc6845_reg[6];
|
| 266 | 259 | UINT8 speed = mc6845_reg[10]&0x20, flash = mc6845_reg[10]&0x40; // cursor modes
|
| 267 | 260 | UINT16 cursor = (mc6845_reg[14]<<8) | mc6845_reg[15]; // get cursor position
|
| 268 | 261 | UINT16 screen_home = (mc6845_reg[12]<<8) | mc6845_reg[13]; // screen home offset (usually zero)
|
| 269 | 262 | UINT8 options=input_port_read(screen->machine, "CONFIG");
|
| 270 | 263 | framecnt++;
|
| 271 | 264 | |
| 272 | | /* Get the graphics of the character under the cursor, xor with the visible cursor scan lines,
|
| 273 | | and store as character number 256. If inverse mode, drop bit 7 of character before xoring */
|
| 274 | | if (!super80v_rom_pcg)
|
| 275 | | for ( i = 0; i < ARRAY_LENGTH(mc6845_cursor); i++)
|
| 276 | | pcgram[0x1000+i] = pcgram[(videoram[cursor]&0x7f)*16+i] ^ mc6845_cursor[i];
|
| 277 | | else
|
| 278 | | for ( i = 0; i < ARRAY_LENGTH(mc6845_cursor); i++)
|
| 279 | | pcgram[0x1000+i] = pcgram[(videoram[cursor])*16 + i] ^ mc6845_cursor[i];
|
| 280 | | |
| 281 | | gfx_element_mark_dirty(screen->machine->gfx[0],256); // and into machine graphics
|
| 282 | | |
| 283 | | for( i = 0; i < bytes; i++ )
|
| 265 | for (y = 0; y < mc6845_reg[6]; y++) // for each row of chars
|
| 284 | 266 | {
|
| 285 | | int mem = (i + screen_home) & 0xfff;
|
| 286 | | int sy = (i / mc6845_reg[1]) * (mc6845_reg[9] + 1);
|
| 287 | | int sx = (i % mc6845_reg[1]) * 7;
|
| 288 | | int chr = videoram[mem];
|
| 267 | for (z = 0; z < mc6845_reg[9]+1; z++) // for each scanline
|
| 268 | {
|
| 269 | UINT16 *p = BITMAP_ADDR16(bitmap, sy++, 0);
|
| 289 | 270 | |
| 290 | | /* get colour or b&w */
|
| 291 | | int col = 5; /* green */
|
| 292 | | if ((options & 0x60) == 0x60) col = 15; /* b&w */
|
| 293 | | if (!(options & 0x40)) col = colorram[mem]; // read a byte of colour
|
| 271 | for (x = sx; x < sx + mc6845_reg[1]; x++) // for each character
|
| 272 | {
|
| 273 | UINT8 inv=0;
|
| 274 | mem = (x + screen_home) & 0xfff;
|
| 275 | chr = videoram[mem];
|
| 294 | 276 | |
| 295 | | if ((!super80v_rom_pcg) && (chr > 0x7f)) // is it a high chr in inverse mode
|
| 296 | | {
|
| 297 | | col = BITSWAP8(col,3,2,1,0,7,6,5,4); // swap nibbles
|
| 298 | | chr &= 0x7f; // and drop bit 7
|
| 299 | | }
|
| 277 | /* get colour or b&w */
|
| 278 | col = 5; /* green */
|
| 279 | if ((options & 0x60) == 0x60) col = 15; /* b&w */
|
| 280 | if (!(options & 0x40)) col = colorram[mem]; // read a byte of colour
|
| 300 | 281 | |
| 301 | | /* if cursor is on and we are at cursor position, show it */
|
| 302 | | /* NOTE: flash rates obtained from real hardware */
|
| 282 | /* if inverse mode, replace any pcgram chrs with inverse chrs */
|
| 283 | if ((!super80v_rom_pcg) && (chr & 0x80)) // is it a high chr in inverse mode
|
| 284 | {
|
| 285 | inv = 0xff; // invert the chr
|
| 286 | chr &= 0x7f; // and drop bit 7
|
| 287 | }
|
| 303 | 288 | |
| 304 | | if ((((!flash) && (!speed)) || // (5,6)=(0,0) = cursor on always
|
| 305 | | ((flash) && (speed) && (framecnt & 0x10)) || // (5,6)=(1,1) = cycle per 32 frames
|
| 306 | | ((flash) && (!speed) && (framecnt & 8))) && // (5,6)=(0,1) = cycle per 16 frames
|
| 307 | | (i == cursor)) // displaying at cursor position?
|
| 308 | | chr = 256; // 256 = cursor character
|
| 289 | /* process cursor */
|
| 290 | if ((((!flash) && (!speed)) || // (5,6)=(0,0) = cursor on always
|
| 291 | ((flash) && (speed) && (framecnt & 0x10)) || // (5,6)=(1,1) = cycle per 32 frames
|
| 292 | ((flash) && (!speed) && (framecnt & 8))) && // (5,6)=(0,1) = cycle per 16 frames
|
| 293 | (x == cursor)) // displaying at cursor position?
|
| 294 | inv ^= mc6845_cursor[z]; // cursor scan row
|
| 309 | 295 | |
| 310 | | drawgfx( bitmap, screen->machine->gfx[0],chr,col,0,0,sx,sy,
|
| 311 | | cliprect,TRANSPARENCY_NONE,0); // put character on the screen
|
| 296 | /* get pattern of pixels for that character scanline */
|
| 297 | gfx = pcgram[(chr<<4) | z] ^ inv;
|
| 298 | fg = ((col & 0x0f) << 1) + 1;
|
| 299 | bg = ((col & 0xf0) >> 3) + 1;
|
| 312 | 300 | |
| 301 | /* Display a scanline of a character (7 pixels) */
|
| 302 | *p = ( gfx & 0x80 ) ? fg : bg; p++;
|
| 303 | *p = ( gfx & 0x40 ) ? fg : bg; p++;
|
| 304 | *p = ( gfx & 0x20 ) ? fg : bg; p++;
|
| 305 | *p = ( gfx & 0x10 ) ? fg : bg; p++;
|
| 306 | *p = ( gfx & 0x08 ) ? fg : bg; p++;
|
| 307 | *p = ( gfx & 0x04 ) ? fg : bg; p++;
|
| 308 | *p = ( gfx & 0x02 ) ? fg : bg; p++;
|
| 309 | }
|
| 310 | }
|
| 311 | sx+=mc6845_reg[1];
|
| 313 | 312 | }
|
| 314 | | |
| 315 | 313 | return 0;
|
| 316 | 314 | }
|
| 317 | 315 | |