diff options
Diffstat (limited to 'src/mess/video')
| -rw-r--r-- | src/mess/video/gba.c | 129 | ||||
| -rw-r--r-- | src/mess/video/gf4500.c | 3 | ||||
| -rw-r--r-- | src/mess/video/gf4500.h | 10 | ||||
| -rw-r--r-- | src/mess/video/newport.c | 8 | ||||
| -rw-r--r-- | src/mess/video/newport.h | 18 | ||||
| -rw-r--r-- | src/mess/video/nick.c | 48 | ||||
| -rw-r--r-- | src/mess/video/nick.h | 16 | ||||
| -rw-r--r-- | src/mess/video/stic.c | 230 | ||||
| -rw-r--r-- | src/mess/video/stic.h | 16 | ||||
| -rw-r--r-- | src/mess/video/vic4567.c | 76 | ||||
| -rw-r--r-- | src/mess/video/vic4567.h | 46 | ||||
| -rw-r--r-- | src/mess/video/vtvideo.c | 118 | ||||
| -rw-r--r-- | src/mess/video/vtvideo.h | 8 |
13 files changed, 361 insertions, 365 deletions
diff --git a/src/mess/video/gba.c b/src/mess/video/gba.c index 2bf8756f4e2..ef3fbc1351d 100644 --- a/src/mess/video/gba.c +++ b/src/mess/video/gba.c @@ -53,16 +53,16 @@ inline void gba_state::update_mask(UINT8* mask, int mode, int submode, UINT32* o for (int x = 0; x < 240; x++) { mask[x] = out_mask; - + if ((obj_win[x] & 0x80000000) == 0) mask[x] = m_WINOUT >> 8; - + if (inwin1) { if (is_in_window(x, 1)) mask[x] = in1_mask; } - + if (inwin0) { if (is_in_window(x, 0)) @@ -87,7 +87,7 @@ inline void gba_state::update_mask(UINT8* mask, int mode, int submode, UINT32* o mode_mask = ~0x0b; } - + if (mode_mask) { for (int x = 0; x < 240; x++) @@ -103,8 +103,8 @@ void gba_state::draw_modes(int mode, int submode, int y, UINT32* line0, UINT32* UINT8 inWin0Mask = m_WININ & 0x00ff; UINT8 inWin1Mask = m_WININ >> 8; UINT8 outMask = m_WINOUT & 0x00ff; - UINT8 masks[240]; // this puts together WinMasks with the fact that some modes/submodes skip specific layers! - + UINT8 masks[240]; // this puts together WinMasks with the fact that some modes/submodes skip specific layers! + if (submode == GBA_SUBMODE2) { if (m_DISPCNT & DISPCNT_WIN0_EN) @@ -117,7 +117,7 @@ void gba_state::draw_modes(int mode, int submode, int y, UINT32* line0, UINT32* else inWindow0 |= (y >= v0 || y < v1) ? 1 : 0; } - + if (m_DISPCNT & DISPCNT_WIN1_EN) { UINT8 v0 = m_WIN1V >> 8; @@ -129,7 +129,7 @@ void gba_state::draw_modes(int mode, int submode, int y, UINT32* line0, UINT32* inWindow1 |= (y >= v0 || y < v1) ? 1 : 0; } } - + // Draw BG switch (mode) { @@ -154,7 +154,7 @@ void gba_state::draw_modes(int mode, int submode, int y, UINT32* line0, UINT32* draw_roz_bitmap_scanline(line2, y, DISPCNT_BG2_EN, m_BG2CNT, m_BG2X, m_BG2Y, m_BG2PA, m_BG2PB, m_BG2PC, m_BG2PD, &m_gfxBG2X, &m_gfxBG2Y, m_gfxBG2Changed, bpp); break; } - + // Draw OAM draw_gba_oam(lineOBJ, y); if (submode == GBA_SUBMODE2) @@ -162,73 +162,73 @@ void gba_state::draw_modes(int mode, int submode, int y, UINT32* line0, UINT32* memset(masks, 0xff, sizeof(masks)); update_mask(&masks[0], mode, submode, lineOBJWin, inWindow0, inWindow1, inWin0Mask, inWin1Mask, outMask); - + for (int x = 0; x < 240; x++) { UINT32 color = backdrop; UINT8 top = 0x20; - + if ((UINT8)(line0[x] >> 24) < (UINT8)(color >> 24) && masks[x] & 0x01) { color = line0[x]; top = 0x01; } - + if ((UINT8)(line1[x] >> 24) < (UINT8)(color >> 24) && masks[x] & 0x02) { color = line1[x]; top = 0x02; } - + if ((UINT8)(line2[x] >> 24) < (UINT8)(color >> 24) && masks[x] & 0x04) { color = line2[x]; top = 0x04; } - + if ((UINT8)(line3[x] >> 24) < (UINT8)(color >> 24) && masks[x] & 0x08) { color = line3[x]; top = 0x08; } - + if ((UINT8)(lineOBJ[x] >> 24) < (UINT8)(color >> 24) && masks[x] & 0x10) { color = lineOBJ[x]; top = 0x10; } - + if (color & 0x00010000) { if (submode != GBA_SUBMODE0 || top == 0x10) { UINT32 back = backdrop; UINT8 top2 = 0x20; - + if ((UINT8)(line0[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x01) { back = line0[x]; top2 = 0x01; } - + if ((UINT8)(line1[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x02) { back = line1[x]; top2 = 0x02; } - + if ((UINT8)(line2[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x04) { back = line2[x]; top2 = 0x04; } - + if ((UINT8)(line3[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x08) { back = line3[x]; top2 = 0x08; } - + if (top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); else @@ -260,7 +260,7 @@ void gba_state::draw_modes(int mode, int submode, int y, UINT32* line0, UINT32* { UINT32 back = backdrop; UINT8 top2 = 0x20; - + if ((UINT8)(line0[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x01) { if (top != 0x01) @@ -269,7 +269,7 @@ void gba_state::draw_modes(int mode, int submode, int y, UINT32* line0, UINT32* top2 = 0x01; } } - + if ((UINT8)(line1[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x02) { if (top != 0x02) @@ -278,7 +278,7 @@ void gba_state::draw_modes(int mode, int submode, int y, UINT32* line0, UINT32* top2 = 0x02; } } - + if ((UINT8)(line2[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x04) { if (top != 0x04) @@ -287,7 +287,7 @@ void gba_state::draw_modes(int mode, int submode, int y, UINT32* line0, UINT32* top2 = 0x04; } } - + if ((UINT8)(line3[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x08) { if (top != 0x08) @@ -296,7 +296,7 @@ void gba_state::draw_modes(int mode, int submode, int y, UINT32* line0, UINT32* top2 = 0x08; } } - + if ((UINT8)(lineOBJ[x] >> 24) < (UINT8)(back >> 24) && masks[x] & 0x10) { if (top != 0x10) @@ -305,7 +305,7 @@ void gba_state::draw_modes(int mode, int submode, int y, UINT32* line0, UINT32* top2 = 0x10; } } - + if (top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); } @@ -320,7 +320,7 @@ void gba_state::draw_modes(int mode, int submode, int y, UINT32* line0, UINT32* } } lineMix[x] = color; - } + } if (mode == GBA_MODE1 || mode == GBA_MODE2 || mode == GBA_MODE345) m_gfxBG2Changed = 0; if (mode == GBA_MODE2) @@ -336,13 +336,13 @@ void gba_state::draw_roz_bitmap_scanline(UINT32 *scanline, int ypos, UINT32 enab INT32 sy = (depth == 4) ? 128 : 160; UINT32 prio = ((ctrl & BGCNT_PRIORITY) << 25) + 0x1000000; INT32 cx, cy, pixx, pixy, x; - + if ((depth == 8) && (m_DISPCNT & DISPCNT_FRAMESEL)) src8 += 0xa000; - + if ((depth == 4) && (m_DISPCNT & DISPCNT_FRAMESEL)) src16 += 0xa000/2; - + // sign extend roz parameters if (X & 0x08000000) X |= 0xf0000000; if (Y & 0x08000000) Y |= 0xf0000000; @@ -350,23 +350,23 @@ void gba_state::draw_roz_bitmap_scanline(UINT32 *scanline, int ypos, UINT32 enab if (PB & 0x8000) PB |= 0xffff0000; if (PC & 0x8000) PC |= 0xffff0000; if (PD & 0x8000) PD |= 0xffff0000; - + if(ypos == 0) changed = 3; - + if(changed & 1) *currentx = X; else *currentx += PB; - + if(changed & 2) *currenty = Y; else *currenty += PD; - + cx = *currentx; cy = *currenty; - + if(ctrl & BGCNT_MOSAIC) { INT32 mosaic_line = ((m_MOSAIC & 0xf0) >> 4) + 1; @@ -374,10 +374,10 @@ void gba_state::draw_roz_bitmap_scanline(UINT32 *scanline, int ypos, UINT32 enab cx = X + tempy*PB; cy = Y + tempy*PD; } - + pixx = cx >> 8; pixy = cy >> 8; - + for(x = 0; x < 240; x++) { if(pixx < 0 || pixy < 0 || pixx >= sx || pixy >= sy) @@ -396,14 +396,14 @@ void gba_state::draw_roz_bitmap_scanline(UINT32 *scanline, int ypos, UINT32 enab scanline[x] = src16[pixy*sx + pixx] | prio; } } - + cx += PA; cy += PC; - + pixx = cx >> 8; pixy = cy >> 8; } - + if(ctrl & BGCNT_MOSAIC) { INT32 mosaicx = (m_MOSAIC & 0x0f) + 1; @@ -508,17 +508,17 @@ void gba_state::draw_roz_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, // shall we shift for (ctrl & BGCNT_PALETTE256)?? or is not effective for ROZ? tile = mgba_vram[mapbase + (pixx >> 3) + (pixy >> 3) * (sizes[size] >> 3)]; pixel = mgba_vram[base + (tile << 6) + (tiley << 3) + tilex]; - + // plot it scanline[x] = pixel ? (pgba_pram[pixel] | prio) : 0x80000000; } - + cx += PA; cy += PC; - + pixx = cx >> 8; pixy = cy >> 8; - + if(ctrl & BGCNT_PALETTESET_WRAP) { pixx %= sizes[size]; @@ -573,10 +573,9 @@ void gba_state::draw_bg_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, for (x = 0; x < 240; x++) scanline[x] = 0x80000000; - + if(m_DISPCNT & enablemask) { - switch((ctrl & BGCNT_SCREENSIZE) >> BGCNT_SCREENSIZE_SHIFT) { case 1: @@ -590,13 +589,13 @@ void gba_state::draw_bg_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, height = 512; break; } - + maskx = width - 1; masky = height - 1; - + pixx = hofs & maskx; pixy = (vofs + ypos) & masky; - + if(use_mosaic) { if((ypos % mosaicy) != 0) @@ -605,7 +604,7 @@ void gba_state::draw_bg_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, pixy = (vofs + mosaicy) & masky; } } - + if(pixy > 255 && height > 256) { pixy &= 0x000000ff; @@ -615,9 +614,9 @@ void gba_state::draw_bg_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, screendata += 0x400; } } - + stride = (pixy >> 3) << 5; - + UINT16 *src = screendata + 0x400 * (pixx >> 8) + ((pixx & 255) >> 3) + stride; for(x = 0; x < 240; x++) { @@ -627,7 +626,7 @@ void gba_state::draw_bg_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, INT32 tiley = pixy & 7; UINT8 color; UINT8 palindex; - + if(data & TILEOBJ_HFLIP) { tilex = 7 - tilex; @@ -636,7 +635,7 @@ void gba_state::draw_bg_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, { tiley = 7 - tiley; } - + if (ctrl & BGCNT_PALETTE256) { color = chardata[(tile << 6) + (tiley << 3) + tilex]; @@ -645,19 +644,19 @@ void gba_state::draw_bg_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, else { color = chardata[(tile << 5) + (tiley << 2) + (tilex >> 1)]; - + if (tilex & 1) color >>= 4; else color &= 0x0f; palindex = (data >> 8) & 0x00f0; - } + } if (color) scanline[x] = palette[palindex + color] | priority; else scanline[x] = 0x80000000; - + if (data & TILEOBJ_HFLIP) { if (tilex == 0) @@ -669,7 +668,7 @@ void gba_state::draw_bg_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, { src++; } - + pixx++; if(pixx == 256) { @@ -689,7 +688,7 @@ void gba_state::draw_bg_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, src = screendata + stride; } } - + if(use_mosaic) { if(mosaicx > 1) @@ -707,7 +706,7 @@ void gba_state::draw_bg_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, } } } - + } } @@ -722,7 +721,7 @@ void gba_state::draw_gba_oam_window(UINT32 *scanline, int y) for (x = 0; x < 240; x++) scanline[x] = 0x80000000; - + if (m_DISPCNT & DISPCNT_OBJWIN_EN) { for( gba_oamindex = 127; gba_oamindex >= 0; gba_oamindex-- ) @@ -1170,7 +1169,7 @@ void gba_state::draw_gba_oam(UINT32 *scanline, int y) for (x = 0; x < 240; x++) scanline[x] = 0x80000000; - + if( m_DISPCNT & DISPCNT_OBJ_EN ) { for( gba_oamindex = 0; gba_oamindex < 128; gba_oamindex++ ) @@ -1861,7 +1860,7 @@ void gba_state::draw_scanline(int y) depth = 8; else if ((m_DISPCNT & 7) == 5) depth = 4; - + //printf("mode = %d, %d\n", m_DISPCNT & 7, submode); switch(m_DISPCNT & 7) @@ -1880,7 +1879,7 @@ void gba_state::draw_scanline(int y) fatalerror("Invalid screen mode (6 or 7)!\n"); break; } - + for (int x = 0; x < 240; x++) { scanline[x] = m_xferscan[6][1024 + x] & 0x7fff; diff --git a/src/mess/video/gf4500.c b/src/mess/video/gf4500.c index a8619ea7cc6..4ca6cbf3789 100644 --- a/src/mess/video/gf4500.c +++ b/src/mess/video/gf4500.c @@ -74,7 +74,7 @@ void gf4500_device::device_reset() { m_screen_x = m_screen_y = 0; m_screen_x_max = m_screen_y_max = m_screen_x_min = m_screen_y_min = 0; -} +} void gf4500_device::vram_write16( UINT16 data ) @@ -180,4 +180,3 @@ WRITE32_MEMBER( gf4500_device::write ) } } } - diff --git a/src/mess/video/gf4500.h b/src/mess/video/gf4500.h index 0a4e3299f7e..2e14c450562 100644 --- a/src/mess/video/gf4500.h +++ b/src/mess/video/gf4500.h @@ -15,8 +15,8 @@ class gf4500_device : public device_t public: gf4500_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); ~gf4500_device() {} - - + + DECLARE_READ32_MEMBER( read ); DECLARE_WRITE32_MEMBER( write ); @@ -27,12 +27,12 @@ protected: virtual void device_config_complete(); virtual void device_start(); virtual void device_reset(); - -private: + +private: // internal state void vram_write16(UINT16 data); - + UINT32 *m_data; int m_screen_x; int m_screen_y; diff --git a/src/mess/video/newport.c b/src/mess/video/newport.c index 4f32d6400fb..210d6406f8f 100644 --- a/src/mess/video/newport.c +++ b/src/mess/video/newport.c @@ -102,7 +102,7 @@ void newport_video_device::device_config_complete() void newport_video_device::device_start() { m_base = auto_alloc_array_clear(machine(), UINT32, (1280+64) * (1024+64)); - + save_pointer(NAME(m_base), (1280+64) * (1024+64)); save_item(NAME(m_VC2.nRegister)); save_item(NAME(m_VC2.nRAM)); @@ -203,8 +203,8 @@ void newport_video_device::device_reset() m_REX3.nDrawMode0 = 0x00000000; m_REX3.nDrawMode1 = 0x3002f001; m_REX3.nDCBMode = 0x00000780; - m_REX3.nKludge_SkipLine = 0; -} + m_REX3.nKludge_SkipLine = 0; +} UINT32 newport_video_device::screen_update(screen_device &device, bitmap_rgb32 &bitmap, const rectangle &cliprect) @@ -214,7 +214,7 @@ UINT32 newport_video_device::screen_update(screen_device &device, bitmap_rgb32 & { UINT32 *src = &m_base[1344 * y]; UINT32 *dest = &bitmap.pix32(y, cliprect.min_x); - + /* loop over columns */ for (int x = cliprect.min_x; x < cliprect.max_x; x++) { diff --git a/src/mess/video/newport.h b/src/mess/video/newport.h index 4df773e0ac4..0fa7d9fc198 100644 --- a/src/mess/video/newport.h +++ b/src/mess/video/newport.h @@ -116,22 +116,22 @@ class newport_video_device : public device_t public: newport_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); ~newport_video_device() {} - - + + DECLARE_READ32_MEMBER( rex3_r ); DECLARE_WRITE32_MEMBER( rex3_w ); - + UINT32 screen_update(screen_device &device, bitmap_rgb32 &bitmap, const rectangle &cliprect); - + protected: // device-level overrides virtual void device_config_complete(); virtual void device_start(); virtual void device_reset(); - -private: + +private: // internal state - + DECLARE_READ32_MEMBER( cmap0_r ); DECLARE_WRITE32_MEMBER( cmap0_w ); DECLARE_READ32_MEMBER( cmap1_r ); @@ -142,14 +142,14 @@ private: DECLARE_READ32_MEMBER( vc2_r ); DECLARE_WRITE32_MEMBER( vc2_w ); void DoREX3Command(); - + VC2_t m_VC2; XMAP_t m_XMAP0; XMAP_t m_XMAP1; REX3_t m_REX3; UINT32 *m_base; UINT8 m_nDrawGreen; - CMAP_t m_CMAP0; + CMAP_t m_CMAP0; }; diff --git a/src/mess/video/nick.c b/src/mess/video/nick.c index 57b919e781d..883feb96708 100644 --- a/src/mess/video/nick.c +++ b/src/mess/video/nick.c @@ -104,18 +104,18 @@ ADDRESS_MAP_END nick_device::nick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, NICK, "NICK", tag, owner, clock, "nick", __FILE__), - device_memory_interface(mconfig, *this), - m_space_config("vram", ENDIANNESS_LITTLE, 8, 16, 0, *ADDRESS_MAP_NAME(nick_map)), - m_write_virq(*this), - horizontal_clock(0), - m_scanline_count(0), - m_FIXBIAS(0), - m_BORDER(0), - m_LPL(0), - m_LPH(0), - m_LD1(0), - m_LD2(0), - m_virq(CLEAR_LINE) + device_memory_interface(mconfig, *this), + m_space_config("vram", ENDIANNESS_LITTLE, 8, 16, 0, *ADDRESS_MAP_NAME(nick_map)), + m_write_virq(*this), + horizontal_clock(0), + m_scanline_count(0), + m_FIXBIAS(0), + m_BORDER(0), + m_LPL(0), + m_LPH(0), + m_LD1(0), + m_LD2(0), + m_virq(CLEAR_LINE) { } @@ -243,7 +243,7 @@ WRITE8_MEMBER( nick_device::vram_w ) //------------------------------------------------- -// fixbias_w - +// fixbias_w - //------------------------------------------------- WRITE8_MEMBER( nick_device::fixbias_w ) @@ -253,7 +253,7 @@ WRITE8_MEMBER( nick_device::fixbias_w ) //------------------------------------------------- -// border_w - +// border_w - //------------------------------------------------- WRITE8_MEMBER( nick_device::border_w ) @@ -263,7 +263,7 @@ WRITE8_MEMBER( nick_device::border_w ) //------------------------------------------------- -// lpl_w - +// lpl_w - //------------------------------------------------- WRITE8_MEMBER( nick_device::lpl_w ) @@ -275,7 +275,7 @@ WRITE8_MEMBER( nick_device::lpl_w ) //------------------------------------------------- -// lph_w - +// lph_w - //------------------------------------------------- WRITE8_MEMBER( nick_device::lph_w ) @@ -287,7 +287,7 @@ WRITE8_MEMBER( nick_device::lph_w ) //------------------------------------------------- -// initialize_palette - +// initialize_palette - //------------------------------------------------- void nick_device::initialize_palette() @@ -305,9 +305,9 @@ void nick_device::initialize_palette() for (int i = 0; i < 256; i++) { /* - + bit description - + PC0 100R -- RED PC1 100R -- GREEN PC2 82R -- BLUE @@ -316,7 +316,7 @@ void nick_device::initialize_palette() PC5 220R -- BLUE PC6 470R -- RED PC7 470R -- GREEN - + */ int ra = BIT(i, 0); @@ -340,10 +340,10 @@ void nick_device::initialize_palette() for (int i = 0; i < 256; i++) { int pen_index; - + pen_index = (BIT(i, 7) << 0) | (BIT(i, 3) << 1); m_pen_idx_4col[i] = pen_index; - + pen_index = (BIT(i, 7) << 0) | (BIT(i, 3) << 1) | (BIT(i, 5) << 2) | (BIT(i, 1) << 3); m_pen_idx_16col[i] = pen_index; } @@ -437,10 +437,10 @@ void nick_device::write_pixels2color_lpixel(UINT8 pen0, UINT8 pen1, UINT8 data_b int col_index[2]; int pen_index; UINT8 data = data_byte; - + col_index[0] = get_color_index(pen0); col_index[1] = get_color_index(pen1); - + for (int i = 0; i < 8; i++) { pen_index = col_index[BIT(data, 7)]; diff --git a/src/mess/video/nick.h b/src/mess/video/nick.h index acc3a795c4d..efd6f942a40 100644 --- a/src/mess/video/nick.h +++ b/src/mess/video/nick.h @@ -66,7 +66,7 @@ struct LPT_ENTRY // ======================> nick_device class nick_device : public device_t, - public device_memory_interface + public device_memory_interface { public: // construction/destruction @@ -132,28 +132,28 @@ private: UINT8 horizontal_clock; /* current scanline within LPT */ UINT8 m_scanline_count; - + UINT8 m_FIXBIAS; UINT8 m_BORDER; UINT8 m_LPL; UINT8 m_LPH; - + UINT16 m_LD1; UINT16 m_LD2; - + LPT_ENTRY m_LPT; - + UINT32 *m_dest; int m_dest_pos; int m_dest_max_pos; - + UINT8 m_reg[4]; - + /* first clock visible on left hand side */ int m_first_visible_clock; /* first clock visible on right hand side */ int m_last_visible_clock; - + /* given a bit pattern, this will get the pen index */ UINT8 m_pen_idx_4col[256]; /* given a bit pattern, this will get the pen index */ diff --git a/src/mess/video/stic.c b/src/mess/video/stic.c index cca1631d632..142da8646aa 100644 --- a/src/mess/video/stic.c +++ b/src/mess/video/stic.c @@ -1,11 +1,11 @@ /********************************************************************** - + General Instruments AY-3-8900-1 a.k.a. Standard Television Interface Chip (STIC) emulation for Mattel Intellivision - + Copyright MESS Team. Visit http://mamedev.org for licensing and usage restrictions. - + *********************************************************************/ #include "emu.h" @@ -42,7 +42,7 @@ stic_device::~stic_device() void stic_device::device_start() { machine().primary_screen->register_screen_bitmap(m_bitmap); - + save_item(NAME(m_stic_registers)); save_item(NAME(m_gramdirty)); save_item(NAME(m_gram)); @@ -123,7 +123,7 @@ void stic_device::device_reset() m_col_delay = 0; m_row_delay = 0; m_left_edge_inhibit = 0; - m_top_edge_inhibit = 0; + m_top_edge_inhibit = 0; } ROM_START( stic_grom ) @@ -149,12 +149,12 @@ const rom_entry *stic_device::device_rom_region() const void stic_device::intv_set_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) { int w, h; - + // output scaling x *= m_x_scale; y *= m_y_scale; color = SET_COLOR(color); - + for (h = 0; h < m_y_scale; h++) for (w = 0; w < m_x_scale; w++) bitmap.pix16(y + h, x + w) = color; @@ -174,10 +174,10 @@ void stic_device::intv_plot_box(bitmap_ind16 &bitmap, int x, int y, int w, int h int stic_device::sprites_collide(int spriteNum1, int spriteNum2) { INT16 x0, y0, w0, h0, x1, y1, w1, h1, x2, y2, w2, h2; - + intv_sprite_type* s1 = &m_sprite[spriteNum1]; intv_sprite_type* s2 = &m_sprite[spriteNum2]; - + x0 = STIC_OVERSCAN_LEFT_WIDTH + m_col_delay - STIC_CARD_WIDTH; y0 = STIC_OVERSCAN_TOP_HEIGHT + m_row_delay - STIC_CARD_HEIGHT; x1 = (s1->xpos + x0) * STIC_X_SCALE; y1 = (s1->ypos + y0) * STIC_Y_SCALE; @@ -186,11 +186,11 @@ int stic_device::sprites_collide(int spriteNum1, int spriteNum2) w2 = (s2->doublex ? 2 : 1) * STIC_CARD_WIDTH; h1 = (s1->quady ? 4 : 1) * (s1->doubley ? 2 : 1) * (s1->doubleyres ? 2 : 1) * STIC_CARD_HEIGHT; h2 = (s2->quady ? 4 : 1) * (s2->doubley ? 2 : 1) * (s2->doubleyres ? 2 : 1) * STIC_CARD_HEIGHT; - + if ((x1 >= x2 + w2) || (y1 >= y2 + h2) || (x2 >= x1 + w1) || (y2 >= y1 + h1)) return FALSE; - + // iterate over the intersecting bits to see if any touch x0 = MAX(x1, x2); y0 = MAX(y1, y2); @@ -209,7 +209,7 @@ int stic_device::sprites_collide(int spriteNum1, int spriteNum2) return TRUE; } } - + return FALSE; } @@ -221,13 +221,13 @@ void stic_device::determine_sprite_collisions() intv_sprite_type* s1 = &m_sprite[i]; if (s1->xpos == 0 || !s1->coll) continue; - + for (int j = i + 1; j < STIC_MOBS; j++) { intv_sprite_type* s2 = &m_sprite[j]; if (s2->xpos == 0 || !s2->coll) continue; - + if (sprites_collide(i, j)) { s1->collision |= (1 << j); @@ -246,21 +246,21 @@ void stic_device::render_sprites() INT32 nextX; INT32 nextY; INT32 xInc; - + UINT8* memory = m_grom_region->base(); - + for (int i = 0; i < STIC_MOBS; i++) { intv_sprite_type* s = &m_sprite[i]; - + if (s->grom) cardMemoryLocation = (s->card * STIC_CARD_HEIGHT); else cardMemoryLocation = ((s->card & 0x003F) * STIC_CARD_HEIGHT); - + pixelSize = (s->quady ? 4 : 1) * (s->doubley ? 2 : 1); spritePixelHeight = pixelSize * (s->doubleyres ? 2 : 1) * STIC_CARD_HEIGHT; - + for (int j = 0; j < spritePixelHeight; j++) { nextMemoryLocation = (cardMemoryLocation + (j/pixelSize)); @@ -273,7 +273,7 @@ void stic_device::render_sprites() nextX = (s->xflip ? ((s->doublex ? 2 : 1) * STIC_CARD_WIDTH - 1) : 0); nextY = (s->yflip ? (spritePixelHeight - j - 1) : j); xInc = (s->xflip ? -1: 1); - + for (int k = 0; k < STIC_CARD_WIDTH * (1 + s->doublex); k++) { m_sprite_buffers[i][nextX + k * xInc][nextY] = (nextData & (1 << ((STIC_CARD_WIDTH - 1) - k / (1 + s->doublex)))) != 0; @@ -285,7 +285,7 @@ void stic_device::render_sprites() void stic_device::render_line(bitmap_ind16 &bitmap, UINT8 nextByte, UINT16 x, UINT16 y, UINT8 fgcolor, UINT8 bgcolor) { UINT32 color; - + for (int i = 0; i < STIC_CARD_WIDTH; i++) { color = (nextByte & (1 << ((STIC_CARD_WIDTH - 1) - i)) ? fgcolor : bgcolor); @@ -308,17 +308,17 @@ void stic_device::render_color_stack_mode(bitmap_ind16 &bitmap) UINT8 csPtr = 0; UINT16 nextCard; UINT8 *ram = m_grom_region->base(); - + for (h = 0, nexty = (STIC_OVERSCAN_TOP_HEIGHT + m_row_delay) * STIC_Y_SCALE; - h < STIC_BACKTAB_HEIGHT; - h++, nexty += STIC_CARD_HEIGHT * STIC_Y_SCALE) + h < STIC_BACKTAB_HEIGHT; + h++, nexty += STIC_CARD_HEIGHT * STIC_Y_SCALE) { for (w = 0, nextx = (STIC_OVERSCAN_LEFT_WIDTH + m_col_delay) * STIC_X_SCALE; - w < STIC_BACKTAB_WIDTH; - w++, nextx += STIC_CARD_WIDTH * STIC_X_SCALE) + w < STIC_BACKTAB_WIDTH; + w++, nextx += STIC_CARD_WIDTH * STIC_X_SCALE) { nextCard = m_backtab_buffer[h][w]; - + // colored squares mode if ((nextCard & (STIC_CSTM_FG3|STIC_CSTM_SEL)) == STIC_CSTM_FG3) { @@ -329,10 +329,10 @@ void stic_device::render_color_stack_mode(bitmap_ind16 &bitmap) UINT8 color3 = ((nextCard & STIC_CSQM_D2) >> 11) | ((nextCard & (STIC_CSQM_D10)) >> 9); render_colored_squares(bitmap, nextx, nexty, - (color0 == 7 ? csColor : (color0 | FOREGROUND_BIT)), - (color1 == 7 ? csColor : (color1 | FOREGROUND_BIT)), - (color2 == 7 ? csColor : (color2 | FOREGROUND_BIT)), - (color3 == 7 ? csColor : (color3 | FOREGROUND_BIT))); + (color0 == 7 ? csColor : (color0 | FOREGROUND_BIT)), + (color1 == 7 ? csColor : (color1 | FOREGROUND_BIT)), + (color2 == 7 ? csColor : (color2 | FOREGROUND_BIT)), + (color3 == 7 ? csColor : (color3 | FOREGROUND_BIT))); } //color stack mode else @@ -340,15 +340,15 @@ void stic_device::render_color_stack_mode(bitmap_ind16 &bitmap) UINT8 isGrom; UINT16 memoryLocation, fgcolor, bgcolor; UINT8* memory; - + //advance the color pointer, if necessary if (nextCard & STIC_CSTM_ADV) csPtr = (csPtr+1) & (STIC_CSRS - 1); - + fgcolor = ((nextCard & STIC_CSTM_FG3) >> 9) | (nextCard & (STIC_CSTM_FG20)) | FOREGROUND_BIT; bgcolor = m_stic_registers[STIC_CSR + csPtr] & STIC_CSR_BG; - + isGrom = !(nextCard & STIC_CSTM_SEL); if (isGrom) { @@ -378,20 +378,20 @@ void stic_device::render_fg_bg_mode(bitmap_ind16 &bitmap) UINT16 nextCard, memoryLocation; UINT8* memory; UINT8* ram = m_grom_region->base(); - + for (h = 0, nexty = (STIC_OVERSCAN_TOP_HEIGHT + m_row_delay) * STIC_Y_SCALE; - h < STIC_BACKTAB_HEIGHT; - h++, nexty += STIC_CARD_HEIGHT * STIC_Y_SCALE) + h < STIC_BACKTAB_HEIGHT; + h++, nexty += STIC_CARD_HEIGHT * STIC_Y_SCALE) { for (w = 0, nextx = (STIC_OVERSCAN_LEFT_WIDTH + m_col_delay) * STIC_X_SCALE; - w < STIC_BACKTAB_WIDTH; - w++, nextx += STIC_CARD_WIDTH * STIC_X_SCALE) + w < STIC_BACKTAB_WIDTH; + w++, nextx += STIC_CARD_WIDTH * STIC_X_SCALE) { nextCard = m_backtab_buffer[h][w]; fgcolor = (nextCard & STIC_FBM_FG) | FOREGROUND_BIT; bgcolor = ((nextCard & STIC_FBM_BG2) >> 11) | ((nextCard & STIC_FBM_BG310) >> 9); - + isGrom = !(nextCard & STIC_FBM_SEL); if (isGrom) { @@ -421,27 +421,27 @@ void stic_device::copy_sprites_to_background(bitmap_ind16 &bitmap) INT16 leftX, nextY; INT16 leftBorder, rightBorder, topBorder, bottomBorder; INT32 nextX; - + for (int i = STIC_MOBS - 1; i >= 0; i--) { intv_sprite_type *s = &m_sprite[i]; if (s->xpos == 0 || (!s->coll && !s->visible)) continue; - + borderCollision = FALSE; foregroundCollision = FALSE; - + spritePixelHeight = (s->quady ? 4 : 1) * (s->doubley ? 2 : 1) * (s->doubleyres ? 2 : 1) * STIC_CARD_HEIGHT; width = (s->doublex ? 2 : 1) * STIC_CARD_WIDTH; - + leftX = (s->xpos - STIC_CARD_WIDTH + STIC_OVERSCAN_LEFT_WIDTH + m_col_delay) * STIC_X_SCALE; nextY = (s->ypos - STIC_CARD_HEIGHT + STIC_OVERSCAN_TOP_HEIGHT + m_row_delay) * STIC_Y_SCALE; - + leftBorder = (STIC_OVERSCAN_LEFT_WIDTH + (m_left_edge_inhibit ? STIC_CARD_WIDTH : 0)) * STIC_X_SCALE; rightBorder = (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1 - 1) * STIC_X_SCALE; topBorder = (STIC_OVERSCAN_TOP_HEIGHT + (m_top_edge_inhibit ? STIC_CARD_HEIGHT : 0)) * STIC_Y_SCALE; bottomBorder = (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT) * STIC_Y_SCALE - 1; - + for (y = 0; y < spritePixelHeight; y++) { for (x = 0; x < width; x++) @@ -449,7 +449,7 @@ void stic_device::copy_sprites_to_background(bitmap_ind16 &bitmap) //if this sprite pixel is not on, then don't paint it if (!m_sprite_buffers[i][x][y]) continue; - + nextX = leftX + x; //if the next pixel location is on the border, then we //have a border collision and we can ignore painting it @@ -459,9 +459,9 @@ void stic_device::copy_sprites_to_background(bitmap_ind16 &bitmap) borderCollision = TRUE; continue; } - + currentPixel = intv_get_pixel(bitmap, nextX, nextY); - + //check for foreground collision if (currentPixel & FOREGROUND_BIT) { @@ -469,7 +469,7 @@ void stic_device::copy_sprites_to_background(bitmap_ind16 &bitmap) if (s->behind_foreground) continue; } - + if (s->visible) { intv_set_pixel(bitmap, nextX, nextY, s->color | (currentPixel & FOREGROUND_BIT)); @@ -477,7 +477,7 @@ void stic_device::copy_sprites_to_background(bitmap_ind16 &bitmap) } nextY++; } - + //update the collision bits if (s->coll) { @@ -506,18 +506,18 @@ void stic_device::draw_background(bitmap_ind16 &bitmap, int transparency) int row,col; int fgcolor,bgcolor = 0; int code; - + int colora, colorb, colorc, colord; - + int n_bit; int p_bit; int g_bit; - + int j; - + int x0 = STIC_OVERSCAN_LEFT_WIDTH + m_col_delay; int y0 = STIC_OVERSCAN_TOP_HEIGHT + m_row_delay; - + if (m_color_stack_mode == 1) { m_color_stack_offset = 0; @@ -526,11 +526,11 @@ void stic_device::draw_background(bitmap_ind16 &bitmap, int transparency) for(col = 0; col < STIC_BACKTAB_WIDTH; col++) { value = m_ram16[offs]; - + n_bit = value & STIC_CSTM_ADV; p_bit = value & STIC_CSTM_FG3; g_bit = value & STIC_CSTM_SEL; - + if (p_bit && (!g_bit)) // colored squares mode { colora = value & STIC_CSQM_A; @@ -554,24 +554,24 @@ void stic_device::draw_background(bitmap_ind16 &bitmap, int transparency) m_color_stack_offset += 1; m_color_stack_offset &= (STIC_CSRS - 1); } - + if (p_bit) // pastel color set fgcolor = (value & STIC_CSTM_FG20) + 8; else fgcolor = value & STIC_CSTM_FG20; - + bgcolor = m_stic_registers[STIC_CSR + m_color_stack_offset]; code = (value & STIC_CSTM_C)>>3; - + if (g_bit) // read from gram { code &= (STIC_CSTM_C50 >> 3); // keep from going outside the array //if (m_gramdirtybytes[code] == 1) { decodechar(machine().gfx[1], - code, - m_gram, - machine().config()->gfxdecodeinfo[1].gfxlayout); + code, + m_gram, + machine().config()->gfxdecodeinfo[1].gfxlayout); m_gramdirtybytes[code] = 0; } // Draw GRAM char @@ -580,12 +580,12 @@ void stic_device::draw_background(bitmap_ind16 &bitmap, int transparency) bgcolor*16+fgcolor, 0,0, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, 0,transparency,bgcolor); - + for(j=0;j<8;j++) { //intv_set_pixel(bitmap, (x0 + col * STIC_CARD_WIDTH + j) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + 7) * STIC_Y_SCALE + 1, 1); } - + } else // read from grom { @@ -594,7 +594,7 @@ void stic_device::draw_background(bitmap_ind16 &bitmap, int transparency) bgcolor*16+fgcolor, 0,0, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, 0,transparency,bgcolor); - + for(j=0;j<8;j++) { //intv_set_pixel(bitmap, (x0 + col * STIC_CARD_WIDTH + j) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + 7) * STIC_Y_SCALE + 1, 2); @@ -616,15 +616,15 @@ void stic_device::draw_background(bitmap_ind16 &bitmap, int transparency) fgcolor = value & STIC_FBM_FG; bgcolor = ((value & STIC_FBM_BG2) >> 11) + ((value & STIC_FBM_BG310) >> 9); code = (value & STIC_FBM_C) >> 3; - + if (value & STIC_FBM_SEL) // read for GRAM { //if (m_gramdirtybytes[code] == 1) { decodechar(machine().gfx[1], - code, - m_gram, - machine().config()->gfxdecodeinfo[1].gfxlayout); + code, + m_gram, + machine().config()->gfxdecodeinfo[1].gfxlayout); m_gramdirtybytes[code] = 0; } // Draw GRAM char @@ -656,7 +656,7 @@ void stic_device::draw_sprites(bitmap_ind16 &bitmap, int behind_foreground) int code; int x0 = STIC_OVERSCAN_LEFT_WIDTH + m_col_delay - STIC_CARD_WIDTH; int y0 = STIC_OVERSCAN_TOP_HEIGHT + m_row_delay - STIC_CARD_HEIGHT; - + for (int i = STIC_MOBS - 1; i >= 0; --i) { intv_sprite_type *s = &m_sprite[i]; @@ -671,47 +671,47 @@ void stic_device::draw_sprites(bitmap_ind16 &bitmap, int behind_foreground) //if (m_gramdirtybytes[code] == 1) { decodechar(machine().gfx[1], - code, - m_gram, - machine().config()->gfxdecodeinfo[1].gfxlayout); + code, + m_gram, + machine().config()->gfxdecodeinfo[1].gfxlayout); m_gramdirtybytes[code] = 0; } // Draw GRAM char drawgfxzoom_transpen(bitmap,&machine().screen[0].visarea,machine().gfx[1], - code, - s->color, - s->xflip,s->yflip, - (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE, - 0x8000 * s->xsize, 0x8000 * s->ysize,0); + code, + s->color, + s->xflip,s->yflip, + (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE, + 0x8000 * s->xsize, 0x8000 * s->ysize,0); } else { //if ((m_gramdirtybytes[code] == 1) || (m_gramdirtybytes[code+1] == 1)) { decodechar(machine().gfx[1], - code, - m_gram, - machine().config()->gfxdecodeinfo[1].gfxlayout); + code, + m_gram, + machine().config()->gfxdecodeinfo[1].gfxlayout); decodechar(machine().gfx[1], - code+1, - m_gram, - machine().config()->gfxdecodeinfo[1].gfxlayout); + code+1, + m_gram, + machine().config()->gfxdecodeinfo[1].gfxlayout); m_gramdirtybytes[code] = 0; m_gramdirtybytes[code+1] = 0; } // Draw GRAM char drawgfxzoom_transpen(bitmap,&machine().screen[0].visarea,machine().gfx[1], - code, - s->color, - s->xflip,s->yflip, - (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE + s->yflip * s->ysize * STIC_CARD_HEIGHT, - 0x8000*s->xsize, 0x8000*s->ysize,0); + code, + s->color, + s->xflip,s->yflip, + (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE + s->yflip * s->ysize * STIC_CARD_HEIGHT, + 0x8000*s->xsize, 0x8000*s->ysize,0); drawgfxzoom_transpen(bitmap,&machine().screen[0].visarea,machine().gfx[1], - code+1, - s->color, - s->xflip,s->yflip, - (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE + (1 - s->yflip) * s->ysize * STIC_CARD_HEIGHT, - 0x8000*s->xsize, 0x8000*s->ysize,0); + code+1, + s->color, + s->xflip,s->yflip, + (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE + (1 - s->yflip) * s->ysize * STIC_CARD_HEIGHT, + 0x8000*s->xsize, 0x8000*s->ysize,0); } } else @@ -720,26 +720,26 @@ void stic_device::draw_sprites(bitmap_ind16 &bitmap, int behind_foreground) { // Draw GROM char drawgfxzoom_transpen(bitmap,&machine().screen[0].visarea,machine().gfx[0], - code, - s->color, - s->xflip,s->yflip, - (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE, - 0x8000*s->xsize, 0x8000*s->ysize,0); + code, + s->color, + s->xflip,s->yflip, + (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE, + 0x8000*s->xsize, 0x8000*s->ysize,0); } else { drawgfxzoom_transpen(bitmap,&machine().screen[0].visarea,machine().gfx[0], - code, - s->color, - s->xflip,s->yflip, - (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE + s->yflip * s->ysize * STIC_CARD_HEIGHT, - 0x8000*s->xsize, 0x8000*s->ysize,0); + code, + s->color, + s->xflip,s->yflip, + (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE + s->yflip * s->ysize * STIC_CARD_HEIGHT, + 0x8000*s->xsize, 0x8000*s->ysize,0); drawgfxzoom_transpen(bitmap,&machine().screen[0].visarea,machine().gfx[0], - code+1, - s->color, - s->xflip,s->yflip, - (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE + (1 - s->yflip) * s->ysize * STIC_CARD_HEIGHT, - 0x8000*s->xsize, 0x8000*s->ysize,0); + code+1, + s->color, + s->xflip,s->yflip, + (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE + (1 - s->yflip) * s->ysize * STIC_CARD_HEIGHT, + 0x8000*s->xsize, 0x8000*s->ysize,0); } } } @@ -751,7 +751,7 @@ void stic_device::draw_borders(bitmap_ind16 &bitmap) { intv_plot_box(bitmap, 0, 0, (STIC_OVERSCAN_LEFT_WIDTH + (m_left_edge_inhibit ? STIC_CARD_WIDTH : m_col_delay)) * STIC_X_SCALE, (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT + STIC_OVERSCAN_BOTTOM_HEIGHT) * STIC_Y_SCALE, m_border_color); intv_plot_box(bitmap, (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1) * STIC_X_SCALE, 0, STIC_OVERSCAN_RIGHT_WIDTH, (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT + STIC_OVERSCAN_BOTTOM_HEIGHT) * STIC_Y_SCALE, m_border_color); - + intv_plot_box(bitmap, 0, 0, (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1 + STIC_OVERSCAN_RIGHT_WIDTH) * STIC_X_SCALE, (STIC_OVERSCAN_TOP_HEIGHT + (m_top_edge_inhibit ? STIC_CARD_HEIGHT : m_row_delay)) * STIC_Y_SCALE, m_border_color); intv_plot_box(bitmap, 0, (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT) * STIC_Y_SCALE, (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1 + STIC_OVERSCAN_RIGHT_WIDTH) * STIC_X_SCALE, STIC_OVERSCAN_BOTTOM_HEIGHT * STIC_Y_SCALE, m_border_color); } @@ -765,12 +765,12 @@ void stic_device::screenrefresh() render_background(m_bitmap); // Render the sprites into their buffers render_sprites(); - for (int i = 0; i < STIC_MOBS; i++) + for (int i = 0; i < STIC_MOBS; i++) m_sprite[i].collision = 0; // Copy the sprites to the background copy_sprites_to_background(m_bitmap); determine_sprite_collisions(); - for (int i = 0; i < STIC_MOBS; i++) + for (int i = 0; i < STIC_MOBS; i++) m_stic_registers[STIC_MCR + i] |= m_sprite[i].collision; /* draw the screen borders if enabled */ draw_borders(m_bitmap); @@ -951,7 +951,7 @@ WRITE16_MEMBER( stic_device::write ) //logerror("unmapped write to STIC register %02X: %04X\n", offset, data); break; } - + if (offset < sizeof(m_stic_registers) / sizeof(m_stic_registers[0])) m_stic_registers[offset] = data; } diff --git a/src/mess/video/stic.h b/src/mess/video/stic.h index e5c83699a07..fa8a8a8a1ee 100644 --- a/src/mess/video/stic.h +++ b/src/mess/video/stic.h @@ -476,7 +476,7 @@ public: // construction/destruction stic_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); virtual ~stic_device(); - + DECLARE_READ16_MEMBER(read); DECLARE_READ16_MEMBER(gram_read); DECLARE_READ16_MEMBER(grom_read) { if (offset > 0x800) printf("help! %X\n", offset); return (0xff00 | m_grom_region->base()[offset]); } @@ -488,17 +488,17 @@ public: int read_stic_handshake() { return m_stic_handshake; } void set_x_scale(int val) { m_x_scale = val; } void set_y_scale(int val) { m_y_scale = val; } - + // device-level overrides virtual void device_start(); virtual const rom_entry *device_rom_region() const; virtual void device_reset(); - + void screenrefresh(); UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); private: - + required_memory_region m_grom_region; void intv_set_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); @@ -514,14 +514,14 @@ private: void copy_sprites_to_background(bitmap_ind16 &bitmap); void render_background(bitmap_ind16 &bitmap); void draw_borders(bitmap_ind16 &bitmap); - + #ifdef UNUSED_CODE void draw_background(bitmap_ind16 &bitmap, int transparency); void draw_sprites(bitmap_ind16 &bitmap, int behind_foreground); #endif - + bitmap_ind16 m_bitmap; - + intv_sprite_type m_sprite[STIC_MOBS]; UINT8 m_sprite_buffers[STIC_MOBS][STIC_CARD_WIDTH * 2][STIC_CARD_HEIGHT * 4 * 2 * 2]; UINT16 m_backtab_buffer[STIC_BACKTAB_HEIGHT][STIC_BACKTAB_WIDTH]; @@ -539,7 +539,7 @@ private: UINT8 m_gramdirty; UINT8 m_gram[512]; - UINT8 m_gramdirtybytes[512]; + UINT8 m_gramdirtybytes[512]; }; // device type definition diff --git a/src/mess/video/vic4567.c b/src/mess/video/vic4567.c index 7eb911b67ae..88262ed9d41 100644 --- a/src/mess/video/vic4567.c +++ b/src/mess/video/vic4567.c @@ -159,7 +159,7 @@ void vic3_device::device_config_complete() const vic3_interface *intf = reinterpret_cast<const vic3_interface *>(static_config()); if (intf != NULL) *static_cast<vic3_interface *>(this) = *intf; - + // or initialize to defaults if none provided else { @@ -184,33 +184,33 @@ void vic3_device::device_config_complete() void vic3_device::device_start() { int width, height; - + m_cpu = machine().device(cpu_tag); m_main_screen = machine().device<screen_device>(screen_tag); width = m_main_screen->width(); height = m_main_screen->height(); - + m_bitmap = auto_bitmap_ind16_alloc(machine(), width, height); - + m_type = vic_type; - + m_dma_read.resolve(dma_read, *this); m_dma_read_color.resolve(dma_read_color, *this); m_interrupt.resolve(irq, *this); - + m_port_changed.resolve(port_changed, *this); - + m_c64_mem_r.resolve(c64_mem_r, *this); - + m_lightpen_button_cb.resolve(button_cb, *this); m_lightpen_x_cb.resolve(x_cb, *this); m_lightpen_y_cb.resolve(y_cb, *this); - + m_screen[0] = auto_alloc_array(machine(), UINT8, 216 * 656 / 8); - + for (int i = 1; i < 216; i++) m_screen[i] = m_screen[i - 1] + 656 / 8; - + for (int i = 0; i < 256; i++) { m_foreground[i] = 0; @@ -223,7 +223,7 @@ void vic3_device::device_start() if ((i & 0xc0) > 0x40) m_foreground[i] |= 0xc0; } - + for (int i = 0; i < 256; i++) { m_expandx[i] = 0; @@ -244,7 +244,7 @@ void vic3_device::device_start() if (i & 0x80) m_expandx[i] |= 0xc000; } - + for (int i = 0; i < 256; i++) { m_expandx_multi[i] = 0; @@ -265,24 +265,24 @@ void vic3_device::device_start() if (i & 0x80) m_expandx_multi[i] |= 0xa000; } - + save_item(NAME(m_reg)); - + save_item(NAME(m_on)); - + //save_item(NAME(m_bitmap)); - + save_item(NAME(m_lines)); - + save_item(NAME(m_chargenaddr)); save_item(NAME(m_videoaddr)); save_item(NAME(m_bitmapaddr)); - + save_item(NAME(m_x_begin)); save_item(NAME(m_x_end)); save_item(NAME(m_y_begin)); save_item(NAME(m_y_end)); - + save_item(NAME(m_c64_bitmap)); save_item(NAME(m_bitmapmulti)); save_item(NAME(m_mono)); @@ -290,23 +290,23 @@ void vic3_device::device_start() save_item(NAME(m_ecmcolor)); save_item(NAME(m_colors)); save_item(NAME(m_spritemulti)); - + save_item(NAME(m_lastline)); save_item(NAME(m_rasterline)); save_item(NAME(m_interlace)); - + save_item(NAME(m_columns)); save_item(NAME(m_rows)); - + save_item(NAME(m_shift)); save_item(NAME(m_foreground)); save_item(NAME(m_multi_collision)); - + save_item(NAME(m_palette_red)); save_item(NAME(m_palette_green)); save_item(NAME(m_palette_blue)); save_item(NAME(m_palette_dirty)); - + for (int i = 0; i < 8; i++) { save_item(NAME(m_sprites[i].x), i); @@ -332,32 +332,32 @@ void vic3_device::device_start() void vic3_device::device_reset() { memset(m_reg, 0, ARRAY_LENGTH(m_reg)); - + m_on = 1; - + m_interlace = 0; m_columns = 640; m_rows = 200; m_lines = VIC2_LINES; - + memset(&m_sprites, 0, sizeof(m_sprites)); - + m_chargenaddr = 0; m_videoaddr = 0; m_bitmapaddr = 0; - + m_x_begin = 0; m_x_end = 0; m_y_begin = 0; m_y_end = 0; - + for (int i = 0; i < 2; i++) { m_c64_bitmap[i] = 0; m_mono[i] = 0; m_ecmcolor[i] = 0; } - + for (int i = 0; i < 4; i++) { m_bitmapmulti[i] = 0; @@ -365,16 +365,16 @@ void vic3_device::device_reset() m_colors[i] = 0; m_spritemulti[i] = 0; } - + m_lastline = 0; m_rasterline = 0; - + memset(m_shift, 0, ARRAY_LENGTH(m_shift)); memset(m_multi_collision, 0, ARRAY_LENGTH(m_multi_collision)); memset(m_palette_red, 0, ARRAY_LENGTH(m_palette_red)); memset(m_palette_green, 0, ARRAY_LENGTH(m_palette_green)); memset(m_palette_blue, 0, ARRAY_LENGTH(m_palette_blue)); - + m_palette_dirty = 0; } @@ -535,7 +535,7 @@ void vic3_device::draw_sprite_code_multi( int y, int xbegin, int code, int prior if ((y < YPOS) || (y >= (VIC2_STARTVISIBLELINES + VIC2_VISIBLELINES)) || (xbegin <= 1) || (xbegin >= (VIC2_STARTVISIBLECOLUMNS + VIC2_VISIBLECOLUMNS))) return; - + for (x = 0, mask = 0xc0, shift = 6; x < 8; x += 2, mask >>= 2, shift -= 2) { if (code & mask) @@ -1499,7 +1499,7 @@ WRITE8_MEMBER( vic3_device::port_w ) break; case 0x30: m_reg[offset] = data; - if (!m_port_changed.isnull()) + if (!m_port_changed.isnull()) { DBG_LOG(2, "vic write", ("%.2x:%.2x\n", offset, data)); m_reg[offset] = data; @@ -2058,5 +2058,3 @@ UINT32 vic3_device::video_update( bitmap_ind16 &bitmap, const rectangle &cliprec copybitmap(bitmap, *m_bitmap, 0, 0, 0, 0, cliprect); return 0; } - - diff --git a/src/mess/video/vic4567.h b/src/mess/video/vic4567.h index 67c0727d891..27187276fee 100644 --- a/src/mess/video/vic4567.h +++ b/src/mess/video/vic4567.h @@ -47,10 +47,10 @@ struct vic3_interface struct vic3_sprite { int x, y; - + int repeat; /* expand, line once drawn */ int line; /* 0 not painting, else painting */ - + /* buffer for currently painted line */ int paintedline[8]; UINT8 bitmap[8][SPRITE_BASE_X_SIZE * 2 / 8 + 1 /*for simplier sprite collision detection*/]; @@ -151,7 +151,7 @@ public: DECLARE_WRITE8_MEMBER(port_w); DECLARE_WRITE8_MEMBER(palette_w); DECLARE_READ8_MEMBER(port_r); - + void raster_interrupt_gen(); UINT32 video_update(bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -184,62 +184,62 @@ private: void draw_bitplanes(); TIMER_CALLBACK_MEMBER(timer_timeout); - + vic3_type m_type; - + screen_device *m_main_screen; // screen which sets bitmap properties - + device_t *m_cpu; - + UINT8 m_reg[0x80]; int m_on; /* rastering of the screen */ - + int m_lines; - + UINT16 m_chargenaddr, m_videoaddr, m_bitmapaddr; - + bitmap_ind16 *m_bitmap; int m_x_begin, m_x_end; int m_y_begin, m_y_end; - + UINT16 m_c64_bitmap[2], m_bitmapmulti[4], m_mono[2], m_multi[4], m_ecmcolor[2], m_colors[4], m_spritemulti[4]; - + int m_lastline, m_rasterline; - + int m_interlace; int m_columns, m_rows; - + /* background/foreground for sprite collision */ UINT8 *m_screen[216], m_shift[216]; - + /* convert multicolor byte to background/foreground for sprite collision */ UINT8 m_foreground[256]; UINT16 m_expandx[256]; UINT16 m_expandx_multi[256]; - + /* converts sprite multicolor info to info for background collision checking */ UINT8 m_multi_collision[256]; - + vic3_sprite m_sprites[8]; - + /* DMA */ devcb_resolved_read8 m_dma_read; devcb_resolved_read8 m_dma_read_color; - + /* IRQ */ devcb_resolved_write_line m_interrupt; - + /* Port Changed */ devcb_resolved_write8 m_port_changed; - + /* lightpen */ devcb_resolved_read8 m_lightpen_button_cb; devcb_resolved_read8 m_lightpen_x_cb; devcb_resolved_read8 m_lightpen_y_cb; - + /* C64 memory access */ devcb_resolved_read8 m_c64_mem_r; - + /* palette - vic3 specific items (the ones above are used for VIC II as well) */ UINT8 m_palette_red[0x100]; UINT8 m_palette_green[0x100]; diff --git a/src/mess/video/vtvideo.c b/src/mess/video/vtvideo.c index 61647564972..cf20bdc7052 100644 --- a/src/mess/video/vtvideo.c +++ b/src/mess/video/vtvideo.c @@ -56,7 +56,7 @@ void vt100_video_device::device_config_complete() const vt_video_interface *intf = reinterpret_cast<const vt_video_interface *>(static_config()); if (intf != NULL) *static_cast<vt_video_interface *>(this) = *intf; - + // or initialize to defaults if none provided else { @@ -76,18 +76,18 @@ void vt100_video_device::device_start() /* resolve callbacks */ m_in_ram_func.resolve(m_in_ram_cb, *this); m_clear_video_interrupt.resolve(m_clear_video_cb, *this); - + /* get the screen device */ m_screen = machine().device<screen_device>(m_screen_tag); assert(m_screen != NULL); - + m_gfx = machine().root_device().memregion(m_char_rom_tag)->base(); assert(m_gfx != NULL); - + // LBA7 is scan line frequency update machine().scheduler().timer_pulse(attotime::from_nsec(31778), timer_expired_delegate(FUNC(vt100_video_device::lba7_change),this)); - + save_item(NAME(m_lba7)); save_item(NAME(m_scroll_latch)); save_item(NAME(m_blink_flip_flop)); @@ -108,15 +108,15 @@ void vt100_video_device::device_reset() { palette_set_color_rgb(machine(), 0, 0x00, 0x00, 0x00); // black palette_set_color_rgb(machine(), 1, 0xff, 0xff, 0xff); // white - + m_height = 25; m_lba7 = 0; - + m_scroll_latch = 0; m_blink_flip_flop = 0; m_reverse_field = 0; m_basic_attribute = 0; - + m_columns = 80; m_frequency = 60; m_interlaced = 1; @@ -151,22 +151,22 @@ READ8_MEMBER( vt100_video_device::lba7_r ) WRITE8_MEMBER( vt100_video_device::dc012_w ) { - if (!(data & 0x08)) + if (!(data & 0x08)) { - if (!(data & 0x04)) + if (!(data & 0x04)) { // set lower part scroll m_scroll_latch = (m_scroll_latch & 0x0c) | (data & 0x03); - } - else + } + else { // set higher part scroll m_scroll_latch = (m_scroll_latch & 0x03) | ((data & 0x03) << 2); } - } - else + } + else { - switch (data & 0x0f) + switch (data & 0x0f) { case 0x08: // toggle blink flip flop @@ -206,31 +206,31 @@ WRITE8_MEMBER( vt100_video_device::dc012_w ) WRITE8_MEMBER( vt100_video_device::dc011_w ) { - if (!BIT(data, 5)) + if (!BIT(data, 5)) { UINT8 col = m_columns; - if (!BIT(data, 4)) + if (!BIT(data, 4)) { m_columns = 80; - } - else + } + else { m_columns = 132; } - if (col != m_columns) + if (col != m_columns) { recompute_parameters(); } m_interlaced = 1; - } - else + } + else { - if (!BIT(data, 4)) + if (!BIT(data, 4)) { m_frequency = 60; m_skip_lines = 2; - } - else + } + else { m_frequency = 50; m_skip_lines = 5; @@ -252,7 +252,7 @@ void vt100_video_device::display_char(bitmap_ind16 &bitmap, UINT8 code, int x, i for (int i = 0; i < 10; i++) { - switch (display_type) + switch (display_type) { case 0 : // bottom half, double height j = (i >> 1) + 5; break; @@ -268,7 +268,7 @@ void vt100_video_device::display_char(bitmap_ind16 &bitmap, UINT8 code, int x, i line = m_gfx[(code & 0x7f) * 16 + j]; - if (m_basic_attribute == 1) + if (m_basic_attribute == 1) { if ((code & 0x80) == 0x80) invert = 1; @@ -280,26 +280,26 @@ void vt100_video_device::display_char(bitmap_ind16 &bitmap, UINT8 code, int x, i { prevbit = bit; bit = BIT((line << b), 7); - if (double_width) + if (double_width) { bitmap.pix16(y * 10 + i, x * 20 + b * 2) = (bit | prevbit) ^ invert; bitmap.pix16(y * 10 + i, x * 20 + b * 2 + 1) = bit ^ invert; - } - else + } + else { bitmap.pix16(y * 10 + i, x * 10 + b) = (bit | prevbit) ^ invert; } } prevbit = bit; // char interleave is filled with last bit - if (double_width) + if (double_width) { bitmap.pix16(y * 10 + i, x * 20 + 16) = (bit | prevbit) ^ invert; bitmap.pix16(y * 10 + i, x * 20 + 17) = bit ^ invert; bitmap.pix16(y * 10 + i, x * 20 + 18) = bit ^ invert; bitmap.pix16(y * 10 + i, x * 20 + 19) = bit ^ invert; - } - else + } + else { bitmap.pix16(y * 10 + i, x * 10 + 8) = (bit | prevbit) ^ invert; bitmap.pix16(y * 10 + i, x * 10 + 9) = bit ^ invert; @@ -319,16 +319,16 @@ void vt100_video_device::video_update(bitmap_ind16 &bitmap, const rectangle &cli UINT8 display_type = 3; // binary 11 UINT16 temp = 0; - if (m_in_ram_func(0) != 0x7f) + if (m_in_ram_func(0) != 0x7f) return; - while (line < (m_height + m_skip_lines)) + while (line < (m_height + m_skip_lines)) { code = m_in_ram_func(addr + xpos); - if (code == 0x7f) + if (code == 0x7f) { // end of line, fill empty till end of line - if (line >= m_skip_lines) + if (line >= m_skip_lines) { for (x = xpos; x < ((display_type == 2) ? (m_columns / 2) : m_columns); x++) { @@ -342,22 +342,22 @@ void vt100_video_device::video_update(bitmap_ind16 &bitmap, const rectangle &cli if (addr & 0x1000) addr &= 0xfff; else addr |= 0x2000; scroll_region = (temp >> 15) & 1; display_type = (temp >> 13) & 3; - if (line >= m_skip_lines) + if (line >= m_skip_lines) { ypos++; } xpos = 0; line++; - } - else + } + else { // display regular char - if (line >= m_skip_lines) + if (line >= m_skip_lines) { display_char(bitmap, code, xpos, ypos, scroll_region, display_type); } xpos++; - if (xpos > m_columns) + if (xpos > m_columns) { line++; xpos = 0; @@ -375,7 +375,7 @@ void rainbow_video_device::display_char(bitmap_ind16 &bitmap, UINT8 code, int x, for (int i = 0; i < 10; i++) { - switch (display_type) + switch (display_type) { case 0 : // bottom half, double height j = (i >> 1) + 5; break; @@ -390,9 +390,9 @@ void rainbow_video_device::display_char(bitmap_ind16 &bitmap, UINT8 code, int x, if (j == 0) j = 15; else j = j - 1; line = m_gfx[code * 16 + j]; - if (m_basic_attribute == 1) + if (m_basic_attribute == 1) { - if ((code & 0x80) == 0x80) + if ((code & 0x80) == 0x80) { line = line ^ 0xff; } @@ -401,25 +401,25 @@ void rainbow_video_device::display_char(bitmap_ind16 &bitmap, UINT8 code, int x, for (int b = 0; b < 8; b++) { bit = BIT((line << b), 7); - if (double_width) + if (double_width) { bitmap.pix16(y * 10 + i, x * 20 + b * 2) = bit; bitmap.pix16(y * 10 + i, x * 20 + b * 2 + 1) = bit; - } - else + } + else { bitmap.pix16(y * 10 + i, x * 10 + b) = bit; } } // char interleave is filled with last bit - if (double_width) + if (double_width) { bitmap.pix16(y * 10 + i, x * 20 + 16) = bit; bitmap.pix16(y * 10 + i, x * 20 + 17) = bit; bitmap.pix16(y * 10 + i, x * 20 + 18) = bit; bitmap.pix16(y * 10 + i, x * 20 + 19) = bit; - } - else + } + else { bitmap.pix16(y * 10 + i, x * 10 + 8) = bit; bitmap.pix16(y * 10 + i, x * 10 + 9) = bit; @@ -440,13 +440,13 @@ void rainbow_video_device::video_update(bitmap_ind16 &bitmap, const rectangle &c UINT8 display_type = 3; // binary 11 UINT16 temp = 0; - while (line < (m_height + m_skip_lines)) + while (line < (m_height + m_skip_lines)) { code = m_in_ram_func(addr + xpos); - if (code == 0xff) + if (code == 0xff) { // end of line, fill empty till end of line - if (line >= m_skip_lines) + if (line >= m_skip_lines) { for (x = xpos; x < ((display_type == 2) ? (m_columns / 2) : m_columns); x++) { @@ -462,22 +462,22 @@ void rainbow_video_device::video_update(bitmap_ind16 &bitmap, const rectangle &c temp = m_in_ram_func(attr_addr); scroll_region = (temp) & 1; display_type = (temp>> 1) & 3; - if (line >= m_skip_lines) + if (line >= m_skip_lines) { ypos++; } xpos = 0; line++; - } - else + } + else { // display regular char - if (line >= m_skip_lines) + if (line >= m_skip_lines) { display_char(bitmap, code, xpos, ypos, scroll_region, display_type); } xpos++; - if (xpos > m_columns) + if (xpos > m_columns) { line++; xpos = 0; diff --git a/src/mess/video/vtvideo.h b/src/mess/video/vtvideo.h index 8c7b1323058..956a84d175b 100644 --- a/src/mess/video/vtvideo.h +++ b/src/mess/video/vtvideo.h @@ -19,7 +19,7 @@ struct vt_video_interface { const char *m_screen_tag; /* screen we are acting on */ const char *m_char_rom_tag; /* character rom region */ - + /* this gets called for every memory read */ devcb_read8 m_in_ram_cb; devcb_write8 m_clear_video_cb; @@ -54,12 +54,12 @@ protected: devcb_resolved_read8 m_in_ram_func; devcb_resolved_write8 m_clear_video_interrupt; - + screen_device *m_screen; /* screen */ UINT8 *m_gfx; /* content of char rom */ - + int m_lba7; - + // dc012 attributes UINT8 m_scroll_latch; UINT8 m_blink_flip_flop; |
