diff options
author | arbee <rb6502@users.noreply.github.com> | 2015-02-21 22:43:48 -0500 |
---|---|---|
committer | arbee <rb6502@users.noreply.github.com> | 2015-02-21 22:43:48 -0500 |
commit | 70d7ea601cc12d1439704103339716d85e9fdab4 (patch) | |
tree | 9532b127c19988e6a0957b60256be217e8917e5a | |
parent | 99d7d21bdef13f828212f4390f98aef0a3df0ecd (diff) |
(MESS) apple3: Implement 'smooth scrolling' feature for all video modes. [R. Belmont]
-rw-r--r-- | src/mess/includes/apple3.h | 2 | ||||
-rw-r--r-- | src/mess/machine/apple3.c | 35 | ||||
-rw-r--r-- | src/mess/video/apple3.c | 128 |
3 files changed, 130 insertions, 35 deletions
diff --git a/src/mess/includes/apple3.h b/src/mess/includes/apple3.h index d6b60c09961..5e65643a6ac 100644 --- a/src/mess/includes/apple3.h +++ b/src/mess/includes/apple3.h @@ -164,6 +164,8 @@ private: int m_analog_sel; bool m_ramp_active; int m_pdl_charge; + int m_va, m_vb, m_vc; + int m_smoothscr; }; #endif /* APPLE3_H_ */ diff --git a/src/mess/machine/apple3.c b/src/mess/machine/apple3.c index e90f67b36df..c46c7bdf0c8 100644 --- a/src/mess/machine/apple3.c +++ b/src/mess/machine/apple3.c @@ -240,18 +240,32 @@ READ8_MEMBER(apple3_state::apple3_c0xx_r) result = 0x00; break; - case 0xd9: - popmessage("Smooth scroll enabled, contact MESSdev"); + case 0xd8: case 0xd9: + m_smoothscr = offset & 1; break; case 0xDB: apple3_write_charmem(); break; - case 0xE0: case 0xE1: case 0xE2: case 0xE3: - case 0xE4: case 0xE5: case 0xE6: case 0xE7: - case 0xE8: case 0xE9: case 0xEA: case 0xEB: - case 0xEC: case 0xED: case 0xEE: case 0xEF: + case 0xE0: case 0xE1: + result = m_fdc->read(space, offset&0xf); + m_va = offset & 1; + break; + + case 0xE2: case 0xE3: + result = m_fdc->read(space, offset&0xf); + m_vb = offset & 1; + break; + + case 0xE4: case 0xE5: + result = m_fdc->read(space, offset&0xf); + m_vc = offset & 1; + break; + + case 0xE6: case 0xE7: case 0xE8: case 0xE9: + case 0xEA: case 0xEB: case 0xEC: case 0xED: + case 0xEE: case 0xEF: result = m_fdc->read(space, offset&0xf); break; @@ -659,6 +673,10 @@ DRIVER_INIT_MEMBER(apple3_state,apple3) m_via_1_a = ~0; m_via_0_irq = 0; m_via_1_irq = 0; + m_va = 0; + m_vb = 0; + m_vc = 0; + m_smoothscr = 0; // kludge round +12v pull up resistors, which after conversion will bring this low when nothing is plugged in. issue also affects dcd/dsr but those don't affect booting. m_acia->write_cts(0); @@ -707,6 +725,10 @@ DRIVER_INIT_MEMBER(apple3_state,apple3) save_item(NAME(m_analog_sel)); save_item(NAME(m_ramp_active)); save_item(NAME(m_pdl_charge)); + save_item(NAME(m_va)); + save_item(NAME(m_vb)); + save_item(NAME(m_vc)); + save_item(NAME(m_smoothscr)); machine().save().register_postload(save_prepost_delegate(FUNC(apple3_state::apple3_postload), this)); } @@ -1275,3 +1297,4 @@ WRITE_LINE_MEMBER(apple3_state::a2bus_nmi_w) m_maincpu->set_input_line(INPUT_LINE_NMI, state); } } + diff --git a/src/mess/video/apple3.c b/src/mess/video/apple3.c index 17ff125ccd4..1ab0830bb43 100644 --- a/src/mess/video/apple3.c +++ b/src/mess/video/apple3.c @@ -138,7 +138,7 @@ VIDEO_START_MEMBER(apple3_state,apple3) void apple3_state::apple3_video_text40(bitmap_ind16 &bitmap) { - int x, y, col, row; + int x, y, col, row, lc; offs_t offset; UINT8 ch; const UINT8 *char_data; @@ -146,6 +146,7 @@ void apple3_state::apple3_video_text40(bitmap_ind16 &bitmap) UINT16 *dest; UINT8 *ram = m_ram->pointer(); UINT32 ram_size = m_ram->size(); + int smooth = m_va | (m_vb << 1) | (m_vc << 2); for (y = 0; y < 24; y++) { @@ -164,9 +165,9 @@ void apple3_state::apple3_video_text40(bitmap_ind16 &bitmap) } else { - /* monochrome */ + /* monochrome - on a real /// with an RGB monitor, text is white */ bg = BLACK; - fg = GREEN; + fg = WHITE; } /* inverse? */ @@ -183,7 +184,17 @@ void apple3_state::apple3_video_text40(bitmap_ind16 &bitmap) { for (col = 0; col < 7; col++) { - dest = &bitmap.pix16(y * 8 + row, x * 14 + col * 2); + if (m_smoothscr) + { + // get the offset into the group of 8 lines + lc = (col + smooth) & 7; + } + else + { + lc = col; + } + + dest = &bitmap.pix16(y * 8 + row, x * 14 + lc * 2); dest[0] = (char_data[row] & (1 << col)) ? fg : bg; dest[1] = (char_data[row] & (1 << col)) ? fg : bg; } @@ -196,7 +207,7 @@ void apple3_state::apple3_video_text40(bitmap_ind16 &bitmap) void apple3_state::apple3_video_text80(bitmap_ind16 &bitmap) { - int x, y, col, row; + int x, y, col, row, lc; offs_t offset; UINT8 ch; const UINT8 *char_data; @@ -204,6 +215,7 @@ void apple3_state::apple3_video_text80(bitmap_ind16 &bitmap) UINT16 *dest; UINT8 *ram = m_ram->pointer(); UINT32 ram_size = m_ram->size(); + int smooth = m_va | (m_vb << 1) | (m_vc << 2); for (y = 0; y < 24; y++) { @@ -221,7 +233,17 @@ void apple3_state::apple3_video_text80(bitmap_ind16 &bitmap) { for (col = 0; col < 7; col++) { - dest = &bitmap.pix16(y * 8 + row, x * 14 + col + 0); + if (m_smoothscr) + { + // get the offset into the group of 8 lines + lc = (col + smooth) & 7; + } + else + { + lc = col; + } + + dest = &bitmap.pix16(y * 8 + row, x * 14 + lc + 0); *dest = (char_data[row] & (1 << col)) ? fg : bg; } } @@ -249,18 +271,30 @@ void apple3_state::apple3_video_text80(bitmap_ind16 &bitmap) void apple3_state::apple3_video_graphics_hgr(bitmap_ind16 &bitmap) { /* hi-res mode: 280x192x2 */ - int y, i, x; + int y, i, x, ly, lyb; const UINT8 *pix_info; UINT16 *ptr; UINT8 b; UINT8 *ram = m_ram->pointer(); + int smooth = m_va | (m_vb << 1) | (m_vc << 2); for (y = 0; y < 192; y++) { + ly = y; + if (m_smoothscr) + { + // get our base Y position + ly = y & ~7; + // get the offset into the group of 8 lines + lyb = ((y % 8) + smooth) & 7; + // add to the base + ly += lyb; + } + if (m_flags & VAR_VM2) - pix_info = &ram[m_hgr_map[y]]; + pix_info = &ram[m_hgr_map[ly]]; else - pix_info = &ram[m_hgr_map[y] - 0x2000]; + pix_info = &ram[m_hgr_map[ly] - 0x2000]; ptr = &bitmap.pix16(y); for (i = 0; i < 40; i++) @@ -280,25 +314,37 @@ void apple3_state::apple3_video_graphics_hgr(bitmap_ind16 &bitmap) void apple3_state::apple3_video_graphics_chgr(bitmap_ind16 &bitmap) { /* color hi-res mode: 280x192x16 */ - int y, i, x; + int y, i, x, ly, lyb; const UINT8 *pix_info; const UINT8 *col_info; UINT16 *ptr; UINT8 b; UINT16 fgcolor, bgcolor; UINT8 *ram = m_ram->pointer(); + int smooth = m_va | (m_vb << 1) | (m_vc << 2); for (y = 0; y < 192; y++) { + ly = y; + if (m_smoothscr) + { + // get our base Y position + ly = y & ~7; + // get the offset into the group of 8 lines + lyb = ((y % 8) + smooth) & 7; + // add to the base + ly += lyb; + } + if (m_flags & VAR_VM2) { - pix_info = &ram[m_hgr_map[y] + 0x2000]; - col_info = &ram[m_hgr_map[y] + 0x4000]; + pix_info = &ram[m_hgr_map[ly] + 0x2000]; + col_info = &ram[m_hgr_map[ly] + 0x4000]; } else { - pix_info = &ram[m_hgr_map[y] - 0x2000]; - col_info = &ram[m_hgr_map[y]]; + pix_info = &ram[m_hgr_map[ly] - 0x2000]; + col_info = &ram[m_hgr_map[ly]]; } ptr = &bitmap.pix16(y); @@ -326,24 +372,36 @@ void apple3_state::apple3_video_graphics_chgr(bitmap_ind16 &bitmap) void apple3_state::apple3_video_graphics_shgr(bitmap_ind16 &bitmap) { /* super hi-res mode: 560x192x2 */ - int y, i, x; + int y, i, x, ly, lyb; const UINT8 *pix_info1; const UINT8 *pix_info2; UINT16 *ptr; UINT8 b1, b2; UINT8 *ram = m_ram->pointer(); + int smooth = m_va | (m_vb << 1) | (m_vc << 2); for (y = 0; y < 192; y++) { + ly = y; + if (m_smoothscr) + { + // get our base Y position + ly = y & ~7; + // get the offset into the group of 8 lines + lyb = ((y % 8) + smooth) & 7; + // add to the base + ly += lyb; + } + if (m_flags & VAR_VM2) { - pix_info1 = &ram[m_hgr_map[y] + 0x2000]; - pix_info2 = &ram[m_hgr_map[y] + 0x4000]; + pix_info1 = &ram[m_hgr_map[ly] + 0x2000]; + pix_info2 = &ram[m_hgr_map[ly] + 0x4000]; } else { - pix_info1 = &ram[m_hgr_map[y] - 0x2000]; - pix_info2 = &ram[m_hgr_map[y]]; + pix_info1 = &ram[m_hgr_map[ly] - 0x2000]; + pix_info2 = &ram[m_hgr_map[ly]]; } ptr = &bitmap.pix16(y); @@ -373,27 +431,39 @@ void apple3_state::apple3_video_graphics_chires(bitmap_ind16 &bitmap) { UINT16 *pen; UINT8 p1, p2, p3, p4; - int y, i; + int y, i, ly, lyb; UINT8 *ram = m_ram->pointer(); + int smooth = m_va | (m_vb << 1) | (m_vc << 2); for (y = 0; y < 192; y++) { + ly = y; + if (m_smoothscr) + { + // get our base Y position + ly = y & ~7; + // get the offset into the group of 8 lines + lyb = ((y % 8) + smooth) & 7; + // add to the base + ly += lyb; + } + pen = &bitmap.pix16(y); for (i = 0; i < 20; i++) { if (m_flags & VAR_VM2) { - p1 = ram[m_hgr_map[y] + 0x2000 + (i * 2) + 0]; - p2 = ram[m_hgr_map[y] + 0x4000 + (i * 2) + 0]; - p3 = ram[m_hgr_map[y] + 0x2000 + (i * 2) + 1]; - p4 = ram[m_hgr_map[y] + 0x4000 + (i * 2) + 1]; + p1 = ram[m_hgr_map[ly] + 0x2000 + (i * 2) + 0]; + p2 = ram[m_hgr_map[ly] + 0x4000 + (i * 2) + 0]; + p3 = ram[m_hgr_map[ly] + 0x2000 + (i * 2) + 1]; + p4 = ram[m_hgr_map[ly] + 0x4000 + (i * 2) + 1]; } else { - p1 = ram[m_hgr_map[y] - 0x2000 + (i * 2) + 0]; - p2 = ram[m_hgr_map[y] - 0x0000 + (i * 2) + 0]; - p3 = ram[m_hgr_map[y] - 0x2000 + (i * 2) + 1]; - p4 = ram[m_hgr_map[y] - 0x0000 + (i * 2) + 1]; + p1 = ram[m_hgr_map[ly] - 0x2000 + (i * 2) + 0]; + p2 = ram[m_hgr_map[ly] - 0x0000 + (i * 2) + 0]; + p3 = ram[m_hgr_map[ly] - 0x2000 + (i * 2) + 1]; + p4 = ram[m_hgr_map[ly] - 0x0000 + (i * 2) + 1]; } pen[ 0] = pen[ 1] = pen[ 2] = pen[ 3] = (p1 & 0x0f); @@ -412,7 +482,7 @@ void apple3_state::apple3_video_graphics_chires(bitmap_ind16 &bitmap) UINT32 apple3_state::screen_update_apple3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { -// printf("gfx mode %x\n", m_flags & (VAR_VM3|VAR_VM1|VAR_VM0)); +// printf("gfx mode %x\n", m_flags & (VAR_VM3|VAR_VM1|VAR_VM0)); switch(m_flags & (VAR_VM3|VAR_VM1|VAR_VM0)) { |