this was an Allman file (nw)

This commit is contained in:
Vas Crabb 2018-08-13 15:06:14 +10:00
parent 85fcb47e79
commit 58b1bfebf4
2 changed files with 288 additions and 266 deletions

View File

@ -213,7 +213,7 @@ void hp1ll3_device::device_start()
m_videoram = std::make_unique<uint16_t[]>(HPGPU_VRAM_SIZE); m_videoram = std::make_unique<uint16_t[]>(HPGPU_VRAM_SIZE);
save_pointer(NAME(m_videoram) , HPGPU_VRAM_SIZE); save_pointer(NAME(m_videoram), HPGPU_VRAM_SIZE);
m_ram_addr_mask = 0x3fff; m_ram_addr_mask = 0x3fff;
m_horiz_pix_total = visarea.max_x + 1; m_horiz_pix_total = visarea.max_x + 1;
m_vert_pix_total = visarea.max_y + 1; m_vert_pix_total = visarea.max_y + 1;
@ -226,9 +226,9 @@ void hp1ll3_device::device_reset()
m_enable_video = m_enable_cursor = m_enable_sprite = m_busy = false; m_enable_video = m_enable_cursor = m_enable_sprite = m_busy = false;
} }
uint16_t hp1ll3_device::get_pix_addr(uint16_t x , uint16_t y) const uint16_t hp1ll3_device::get_pix_addr(uint16_t x, uint16_t y) const
{ {
return m_org + y * m_conf[ CONF_WPL ] + x / WS; return m_org + y * m_conf[CONF_WPL] + x / WS;
} }
inline void hp1ll3_device::point(int x, int y, bool pix, const uint16_t masks[]) inline void hp1ll3_device::point(int x, int y, bool pix, const uint16_t masks[])
@ -250,25 +250,25 @@ void hp1ll3_device::line(int x1, int y1, int x2, int y2)
int diago,horiz; int diago,horiz;
unsigned char c1; unsigned char c1;
uint16_t rop_masks[ 4 ]; uint16_t rop_masks[4];
get_rop_masks(m_rr, rop_masks); get_rop_masks(m_rr, rop_masks);
uint16_t udl_scan = MSB_MASK; uint16_t udl_scan = MSB_MASK;
c1=0; c1 = 0;
incy=1; incy = 1;
if(x2>x1) if (x2 > x1)
dx = x2 - x1; dx = x2 - x1;
else else
dx = x1 - x2; dx = x1 - x2;
if(y2>y1) if (y2 > y1)
dy = y2 - y1; dy = y2 - y1;
else else
dy = y1 - y2; dy = y1 - y2;
if( dy > dx ) if (dy > dx)
{ {
t = y2; t = y2;
y2 = x2; y2 = x2;
@ -285,7 +285,7 @@ void hp1ll3_device::line(int x1, int y1, int x2, int y2)
c1 = 1; c1 = 1;
} }
if( x1 > x2 ) if (x1 > x2)
{ {
t = y2; t = y2;
y2 = y1; y2 = y1;
@ -296,11 +296,11 @@ void hp1ll3_device::line(int x1, int y1, int x2, int y2)
x2 = t; x2 = t;
} }
horiz = dy<<1; horiz = dy << 1;
diago = ( dy - dx )<<1; diago = (dy - dx) << 1;
e = ( dy<<1 ) - dx; e = (dy << 1) - dx;
if( y1 <= y2 ) if (y1 <= y2)
incy = 1; incy = 1;
else else
incy = -1; incy = -1;
@ -308,17 +308,16 @@ void hp1ll3_device::line(int x1, int y1, int x2, int y2)
x = x1; x = x1;
y = y1; y = y1;
if(c1) if (c1)
{ {
do do
{ {
point(y,x,m_udl & udl_scan,rop_masks); point(y, x, m_udl & udl_scan,rop_masks);
udl_scan >>= 1; udl_scan >>= 1;
if (!udl_scan) { if (!udl_scan)
udl_scan = MSB_MASK; udl_scan = MSB_MASK;
}
if( e > 0 ) if (e > 0)
{ {
y = y + incy; y = y + incy;
e = e + diago; e = e + diago;
@ -330,19 +329,19 @@ void hp1ll3_device::line(int x1, int y1, int x2, int y2)
x++; x++;
} while( x <= x2 ); } while (x <= x2);
} }
else else
{ {
do do
{ {
point(x,y,m_udl & udl_scan,rop_masks); point(x, y, m_udl & udl_scan,rop_masks);
udl_scan >>= 1; udl_scan >>= 1;
if (!udl_scan) { if (!udl_scan) {
udl_scan = MSB_MASK; udl_scan = MSB_MASK;
} }
if( e > 0 ) if (e > 0)
{ {
y = y + incy; y = y + incy;
e = e + diago; e = e + diago;
@ -354,10 +353,8 @@ void hp1ll3_device::line(int x1, int y1, int x2, int y2)
x++; x++;
} while( x <= x2 ); } while (x <= x2);
} }
return;
} }
void hp1ll3_device::label(uint8_t chr, int width) void hp1ll3_device::label(uint8_t chr, int width)
@ -365,31 +362,31 @@ void hp1ll3_device::label(uint8_t chr, int width)
draw_cursor_sprite(); draw_cursor_sprite();
Rectangle clip = get_window(); Rectangle clip = get_window();
Rectangle dst{{ m_cursor_x , m_cursor_y } , { uint16_t(width) , m_fontheight }}; Rectangle dst{{ m_cursor_x, m_cursor_y }, { uint16_t(width), m_fontheight }};
bitblt(m_fontdata + chr * 16 , 16 , 16 , Point { 0 , 0 } , clip , dst , m_rr); bitblt(m_fontdata + chr * 16, 16, 16, Point { 0, 0 }, clip, dst, m_rr);
m_cursor_x += width; m_cursor_x += width;
draw_cursor_sprite(); draw_cursor_sprite();
} }
void hp1ll3_device::wr_video(uint16_t addr , uint16_t v) void hp1ll3_device::wr_video(uint16_t addr, uint16_t v)
{ {
m_videoram[ addr & m_ram_addr_mask ] = v; m_videoram[addr & m_ram_addr_mask] = v;
} }
uint16_t hp1ll3_device::rd_video(uint16_t addr) const uint16_t hp1ll3_device::rd_video(uint16_t addr) const
{ {
return m_videoram[ addr & m_ram_addr_mask ]; return m_videoram[addr & m_ram_addr_mask];
} }
void hp1ll3_device::get_rop_masks(uint16_t rop , uint16_t masks[]) void hp1ll3_device::get_rop_masks(uint16_t rop, uint16_t masks[])
{ {
masks[ 0 ] = BIT(rop , 0) ? ~0 : 0; masks[0] = BIT(rop, 0) ? ~0 : 0;
masks[ 1 ] = BIT(rop , 1) ? ~0 : 0; masks[1] = BIT(rop, 1) ? ~0 : 0;
masks[ 2 ] = BIT(rop , 2) ? ~0 : 0; masks[2] = BIT(rop, 2) ? ~0 : 0;
masks[ 3 ] = BIT(rop , 3) ? ~0 : 0; masks[3] = BIT(rop, 3) ? ~0 : 0;
} }
uint16_t hp1ll3_device::apply_rop(uint16_t old_pix , uint16_t new_pix , uint16_t glob_mask , const uint16_t masks[]) uint16_t hp1ll3_device::apply_rop(uint16_t old_pix, uint16_t new_pix, uint16_t glob_mask, const uint16_t masks[])
{ {
uint16_t diff0 = old_pix & new_pix; uint16_t diff0 = old_pix & new_pix;
uint16_t diff1 = ~old_pix & new_pix; uint16_t diff1 = ~old_pix & new_pix;
@ -399,49 +396,49 @@ uint16_t hp1ll3_device::apply_rop(uint16_t old_pix , uint16_t new_pix , uint16_t
// The idea here is that ROP is forced to be "RR_OLD" for all zero bits in glob_mask // The idea here is that ROP is forced to be "RR_OLD" for all zero bits in glob_mask
// so that the corresponding bits in new_pix are ignored // so that the corresponding bits in new_pix are ignored
return return
((masks[ 0 ] | ~glob_mask) & diff0) | ((masks[0] | ~glob_mask) & diff0) |
(masks[ 1 ] & glob_mask & diff1) | (masks[1] & glob_mask & diff1) |
((masks[ 2 ] | ~glob_mask) & diff2) | ((masks[2] | ~glob_mask) & diff2) |
(masks[ 3 ] & glob_mask & diff3); (masks[3] & glob_mask & diff3);
} }
void hp1ll3_device::rmw_rop(uint16_t addr , uint16_t new_pix , uint16_t glob_mask , const uint16_t masks[]) void hp1ll3_device::rmw_rop(uint16_t addr, uint16_t new_pix, uint16_t glob_mask, const uint16_t masks[])
{ {
wr_video(addr , apply_rop(rd_video(addr), new_pix, glob_mask, masks)); wr_video(addr, apply_rop(rd_video(addr), new_pix, glob_mask, masks));
} }
void hp1ll3_device::clip_coord(int size_1 , int& p1 , int origin_clip , int size_clip , int& origin_2 , int& size_2) const void hp1ll3_device::clip_coord(int size_1, int &p1, int origin_clip, int size_clip, int &origin_2, int &size_2) const
{ {
// origin_1 is implicitly 0 // origin_1 is implicitly 0
int corner_2 = origin_2 + size_2; int corner_2 = origin_2 + size_2;
// Clip origin_2 & p1 w.r.t. clip rectangle // Clip origin_2 & p1 w.r.t. clip rectangle
int t = origin_2 - origin_clip; int t = origin_2 - origin_clip;
if (t < 0) { if (t < 0)
{
p1 -= t; p1 -= t;
origin_2 = origin_clip; origin_2 = origin_clip;
} }
// Clip size_2 w.r.t. clip rectangle // Clip size_2 w.r.t. clip rectangle
int corner_clip = origin_clip + size_clip; int corner_clip = origin_clip + size_clip;
if (corner_2 > corner_clip) { if (corner_2 > corner_clip)
size_2 = corner_clip - origin_2; size_2 = corner_clip - origin_2;
}
// Clip size_2 w.r.t. rectangle 1 (whose origin is 0,0) // Clip size_2 w.r.t. rectangle 1 (whose origin is 0,0)
t = p1 + size_2 - size_1; t = p1 + size_2 - size_1;
if (t > 0) { if (t > 0)
size_2 -= t; size_2 -= t;
}
} }
bool hp1ll3_device::bitblt(uint16_t src_base_addr , unsigned src_width , unsigned src_height , Point src_p , bool hp1ll3_device::bitblt(uint16_t src_base_addr, unsigned src_width, unsigned src_height, Point src_p,
const Rectangle& clip_rect , const Rectangle& dst_rect , uint16_t rop , bool use_m_org) const Rectangle &clip_rect, const Rectangle &dst_rect, uint16_t rop, bool use_m_org)
{ {
DBG_LOG(3,0,("bitblt %04x,%u,%u,(%u,%u),(%u,%u,%u,%u),(%u,%u,%u,%u),%u\n" , src_base_addr , DBG_LOG(3,0,("bitblt %04x,%u,%u,(%u,%u),(%u,%u,%u,%u),(%u,%u,%u,%u),%u\n", src_base_addr,
src_width , src_width,
src_height , src_height,
src_p.x , src_p.x,
src_p.y , src_p.y,
clip_rect.origin.x , clip_rect.origin.y , clip_rect.size.x , clip_rect.size.y , clip_rect.origin.x, clip_rect.origin.y, clip_rect.size.x, clip_rect.size.y,
dst_rect.origin.x , dst_rect.origin.y , dst_rect.size.x , dst_rect.size.y , dst_rect.origin.x, dst_rect.origin.y, dst_rect.size.x, dst_rect.size.y,
rop)); rop));
int src_x = src_p.x; int src_x = src_p.x;
int dst_x = dst_rect.origin.x; int dst_x = dst_rect.origin.x;
@ -454,37 +451,39 @@ bool hp1ll3_device::bitblt(uint16_t src_base_addr , unsigned src_width , unsigne
// Clip y-coordinates // Clip y-coordinates
clip_coord(src_height, src_y, clip_rect.origin.y, clip_rect.size.y, dst_y, dst_height); clip_coord(src_height, src_y, clip_rect.origin.y, clip_rect.size.y, dst_y, dst_height);
DBG_LOG(3,0,("bitblt (%u,%u) (%u,%u,%u,%u)\n" , src_x , src_y , DBG_LOG(3,0,("bitblt (%u,%u) (%u,%u,%u,%u)\n", src_x, src_y, dst_x, dst_y, dst_width, dst_height));
dst_x , dst_y , dst_width , dst_height)); if (dst_width <= 0 || dst_height <= 0)
if (dst_width <= 0 || dst_height <= 0) {
return false; return false;
}
unsigned dst_rounded_width = m_conf[ CONF_WPL ] * WS; unsigned dst_rounded_width = m_conf[CONF_WPL] * WS;
// p1_pix & p2_pix point to a uniquely identified pixel in video RAM // p1_pix & p2_pix point to a uniquely identified pixel in video RAM
unsigned p1_pix = unsigned(src_base_addr) * WS + src_x + src_width * src_y; unsigned p1_pix = unsigned(src_base_addr) * WS + src_x + src_width * src_y;
unsigned p2_pix = unsigned(use_m_org ? m_org : m_sad) * WS + dst_x + dst_rounded_width * dst_y; unsigned p2_pix = unsigned(use_m_org ? m_org : m_sad) * WS + dst_x + dst_rounded_width * dst_y;
DBG_LOG(3,0,("bitblt p1_pix=%u p2_pix=%u\n" , p1_pix , p2_pix)); DBG_LOG(3,0,("bitblt p1_pix=%u p2_pix=%u\n", p1_pix, p2_pix));
uint16_t rop_masks[ 4 ]; uint16_t rop_masks[4];
get_rop_masks(rop, rop_masks); get_rop_masks(rop, rop_masks);
if (p1_pix < p2_pix) { if (p1_pix < p2_pix)
{
// Move block going up (decrease y) // Move block going up (decrease y)
p1_pix += dst_height * src_width + dst_width - 1; p1_pix += dst_height * src_width + dst_width - 1;
p2_pix += dst_height * dst_rounded_width + dst_width - 1; p2_pix += dst_height * dst_rounded_width + dst_width - 1;
DBG_LOG(3,0,("bitblt rev p1_pix=%u p2_pix=%u\n" , p1_pix , p2_pix)); DBG_LOG(3,0,("bitblt rev p1_pix=%u p2_pix=%u\n", p1_pix, p2_pix));
while (dst_height--) { while (dst_height--) {
p1_pix -= src_width; p1_pix -= src_width;
p2_pix -= dst_rounded_width; p2_pix -= dst_rounded_width;
rowbltneg(p1_pix , p2_pix , dst_width , rop_masks); rowbltneg(p1_pix, p2_pix, dst_width, rop_masks);
} }
} else { }
else
{
// Move block going down (increase y) // Move block going down (increase y)
DBG_LOG(3,0,("bitblt fwd\n")); DBG_LOG(3,0,("bitblt fwd\n"));
while (dst_height--) { while (dst_height--)
rowbltpos(p1_pix , p2_pix , dst_width , rop_masks); {
rowbltpos(p1_pix, p2_pix, dst_width, rop_masks);
p1_pix += src_width; p1_pix += src_width;
p2_pix += dst_rounded_width; p2_pix += dst_rounded_width;
} }
@ -493,33 +492,36 @@ bool hp1ll3_device::bitblt(uint16_t src_base_addr , unsigned src_width , unsigne
return true; return true;
} }
void hp1ll3_device::rowbltpos(unsigned p1_pix , unsigned p2_pix , int width , const uint16_t masks[]) void hp1ll3_device::rowbltpos(unsigned p1_pix, unsigned p2_pix, int width, const uint16_t masks[])
{ {
// p1_pix and p2_pix point to the leftmost pixel of the row // p1_pix and p2_pix point to the leftmost pixel of the row
while (width > 0) { while (width > 0)
{
unsigned p1_word = p1_pix / WS; unsigned p1_word = p1_pix / WS;
unsigned p1_bit = p1_pix % WS; unsigned p1_bit = p1_pix % WS;
// Get src pixels and align to MSB // Get src pixels and align to MSB
uint16_t new_pix = rd_video(p1_word) << p1_bit; uint16_t new_pix = rd_video(p1_word) << p1_bit;
if (p1_bit) { if (p1_bit)
new_pix |= rd_video(p1_word + 1) >> (WS - p1_bit); new_pix |= rd_video(p1_word + 1) >> (WS - p1_bit);
}
unsigned p2_word = p2_pix / WS; unsigned p2_word = p2_pix / WS;
unsigned p2_bit = p2_pix % WS; unsigned p2_bit = p2_pix % WS;
uint16_t old_pix = rd_video(p2_word); uint16_t old_pix = rd_video(p2_word);
unsigned w = p2_bit + width; unsigned w = p2_bit + width;
uint16_t glob_mask = ~0; uint16_t glob_mask = ~0;
if (p2_bit) { if (p2_bit)
{
// Left end // Left end
new_pix >>= p2_bit; new_pix >>= p2_bit;
glob_mask >>= p2_bit; glob_mask >>= p2_bit;
} }
if (w < WS) { if (w < WS)
{
// Right end // Right end
glob_mask &= ~0 << (WS - w); glob_mask &= ~0 << (WS - w);
} }
rmw_rop(p2_word, new_pix, glob_mask, masks); rmw_rop(p2_word, new_pix, glob_mask, masks);
DBG_LOG(3,0,("rowbltpos %04x %04x %04x>%04x %u %u %u\n" , old_pix , new_pix , glob_mask , rd_video(p2_word) , p1_pix , p2_pix , width)); DBG_LOG(3,0,("rowbltpos %04x %04x %04x>%04x %u %u %u\n", old_pix, new_pix, glob_mask, rd_video(p2_word), p1_pix, p2_pix, width));
w = WS - p2_bit; w = WS - p2_bit;
p1_pix += w; p1_pix += w;
p2_pix += w; p2_pix += w;
@ -527,10 +529,11 @@ void hp1ll3_device::rowbltpos(unsigned p1_pix , unsigned p2_pix , int width , co
} }
} }
void hp1ll3_device::rowbltneg(unsigned p1_pix , unsigned p2_pix , int width , const uint16_t masks[]) void hp1ll3_device::rowbltneg(unsigned p1_pix, unsigned p2_pix, int width, const uint16_t masks[])
{ {
// p1_pix and p2_pix point to the rightmost pixel of the row // p1_pix and p2_pix point to the rightmost pixel of the row
while (width > 0) { while (width > 0)
{
unsigned p1_word = p1_pix / WS; unsigned p1_word = p1_pix / WS;
unsigned p1_bit = p1_pix % WS; unsigned p1_bit = p1_pix % WS;
// Get src pixels and align to LSB // Get src pixels and align to LSB
@ -543,18 +546,20 @@ void hp1ll3_device::rowbltneg(unsigned p1_pix , unsigned p2_pix , int width , co
uint16_t old_pix = rd_video(p2_word); uint16_t old_pix = rd_video(p2_word);
int w = p2_bit - width; int w = p2_bit - width;
uint16_t glob_mask = ~0; uint16_t glob_mask = ~0;
if (p2_bit != (WS - 1)) { if (p2_bit != (WS - 1))
{
// Right end // Right end
new_pix <<= (WS - 1 - p2_bit); new_pix <<= (WS - 1 - p2_bit);
glob_mask <<= (WS - 1 - p2_bit); glob_mask <<= (WS - 1 - p2_bit);
} }
if (w >= 0) { if (w >= 0)
{
// Left end // Left end
uint16_t tmp = ~0; uint16_t tmp = ~0;
glob_mask &= tmp >> (w + 1); glob_mask &= tmp >> (w + 1);
} }
rmw_rop(p2_word, new_pix, glob_mask, masks); rmw_rop(p2_word, new_pix, glob_mask, masks);
DBG_LOG(3,0,("rowbltneg %04x %04x %04x>%04x %u %u %u\n" , old_pix , new_pix , glob_mask , rd_video(p2_word) , p1_pix , p2_pix , width)); DBG_LOG(3,0,("rowbltneg %04x %04x %04x>%04x %u %u %u\n", old_pix, new_pix, glob_mask, rd_video(p2_word), p1_pix, p2_pix, width));
w = p2_bit + 1; w = p2_bit + 1;
p1_pix -= w; p1_pix -= w;
p2_pix -= w; p2_pix -= w;
@ -562,17 +567,18 @@ void hp1ll3_device::rowbltneg(unsigned p1_pix , unsigned p2_pix , int width , co
} }
} }
void hp1ll3_device::fill(const Rectangle& fill_rect , uint16_t pattern_no) void hp1ll3_device::fill(const Rectangle &fill_rect, uint16_t pattern_no)
{ {
uint16_t pattern_addr = get_pattern_addr(pattern_no); uint16_t pattern_addr = get_pattern_addr(pattern_no);
Point src_p{ 0 , 0 }; Point src_p{ 0, 0 };
// Align to 16x16 tiles in absolute coordinates // Align to 16x16 tiles in absolute coordinates
uint16_t start_x = fill_rect.origin.x & ~0xf; uint16_t start_x = fill_rect.origin.x & ~0xf;
Rectangle dst_rect{{ start_x , uint16_t(fill_rect.origin.y & ~0xf) } , { 16 , 16 }}; Rectangle dst_rect{{ start_x, uint16_t(fill_rect.origin.y & ~0xf) }, { 16, 16 }};
// Iterate over vertical span // Iterate over vertical span
while (bitblt(pattern_addr, 16, 16, src_p, fill_rect, dst_rect, m_rr)) { while (bitblt(pattern_addr, 16, 16, src_p, fill_rect, dst_rect, m_rr))
{
// Iterate over horizontal span // Iterate over horizontal span
do { do {
dst_rect.origin.x += 16; dst_rect.origin.x += 16;
@ -589,17 +595,19 @@ uint16_t hp1ll3_device::get_pattern_addr(uint16_t pattern_no) const
void hp1ll3_device::draw_cursor() void hp1ll3_device::draw_cursor()
{ {
if (m_enable_cursor) { if (m_enable_cursor)
Rectangle dst{{ uint16_t(m_cursor_x + m_cursor_offset) , m_cursor_y } , { 16 , 16 }}; {
bitblt(get_pattern_addr(m_cursor_pattern), 16, 16, Point{ 0 , 0 }, get_screen(), dst, RR_XOR , false); Rectangle dst{{ uint16_t(m_cursor_x + m_cursor_offset), m_cursor_y }, { 16, 16 }};
bitblt(get_pattern_addr(m_cursor_pattern), 16, 16, Point{ 0, 0 }, get_screen(), dst, RR_XOR, false);
} }
} }
void hp1ll3_device::draw_sprite() void hp1ll3_device::draw_sprite()
{ {
if (m_enable_sprite) { if (m_enable_sprite)
Rectangle dst{{ m_sprite_x , m_sprite_y } , { 16 , 16 }}; {
bitblt(get_pattern_addr(m_sprite_pattern), 16, 16, Point{ 0 , 0 }, get_screen(), dst, RR_XOR , false); Rectangle dst{{ m_sprite_x, m_sprite_y }, { 16, 16 }};
bitblt(get_pattern_addr(m_sprite_pattern), 16, 16, Point{ 0, 0 }, get_screen(), dst, RR_XOR, false);
} }
} }
@ -611,7 +619,8 @@ void hp1ll3_device::draw_cursor_sprite()
void hp1ll3_device::set_pen_pos(Point p) void hp1ll3_device::set_pen_pos(Point p)
{ {
if (p.x != m_cursor_x || p.y != m_cursor_y) { if (p.x != m_cursor_x || p.y != m_cursor_y)
{
draw_cursor(); draw_cursor();
m_cursor_x = p.x; m_cursor_x = p.x;
m_cursor_y = p.y; m_cursor_y = p.y;
@ -621,7 +630,8 @@ void hp1ll3_device::set_pen_pos(Point p)
void hp1ll3_device::set_sprite_pos(Point p) void hp1ll3_device::set_sprite_pos(Point p)
{ {
if (p.x != m_sprite_x || p.y != m_sprite_y) { if (p.x != m_sprite_x || p.y != m_sprite_y)
{
draw_sprite(); draw_sprite();
m_sprite_x = p.x; m_sprite_x = p.x;
m_sprite_y = p.y; m_sprite_y = p.y;
@ -631,12 +641,12 @@ void hp1ll3_device::set_sprite_pos(Point p)
hp1ll3_device::Rectangle hp1ll3_device::get_window() const hp1ll3_device::Rectangle hp1ll3_device::get_window() const
{ {
return Rectangle{{ m_window.org_x , m_window.org_y } , { m_window.width , m_window.height }}; return Rectangle{{ m_window.org_x, m_window.org_y }, { m_window.width, m_window.height }};
} }
hp1ll3_device::Rectangle hp1ll3_device::get_screen() const hp1ll3_device::Rectangle hp1ll3_device::get_screen() const
{ {
return Rectangle{{ 0 , 0 } , { uint16_t(m_horiz_pix_total) , uint16_t(m_vert_pix_total) }}; return Rectangle{{ 0, 0 }, { uint16_t(m_horiz_pix_total), uint16_t(m_vert_pix_total) }};
} }
void hp1ll3_device::apply_conf() void hp1ll3_device::apply_conf()
@ -646,22 +656,21 @@ void hp1ll3_device::apply_conf()
uint32_t hp1ll3_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) uint32_t hp1ll3_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
int x, y, offset; if (!m_enable_video)
uint16_t gfx, *p; {
if (!m_enable_video) {
bitmap.fill(rgb_t::black()); bitmap.fill(rgb_t::black());
return 0; return 0;
} }
// XXX last line is not actually drawn on real hw // XXX last line is not actually drawn on real hw
for (y = 0; y < m_vert_pix_total; y++) { for (int y = 0; y < m_vert_pix_total; y++)
offset = m_sad + y*(m_horiz_pix_total/16); {
p = &m_bitmap.pix16(y); int const offset = m_sad + y * (m_horiz_pix_total / 16);
uint16_t *p = &m_bitmap.pix16(y);
for (x = offset; x < offset + m_horiz_pix_total/16; x++) for (int x = offset; x < offset + m_horiz_pix_total / 16; x++)
{ {
gfx = m_videoram[x]; uint16_t const gfx = m_videoram[x];
*p++ = BIT(gfx, 15); *p++ = BIT(gfx, 15);
*p++ = BIT(gfx, 14); *p++ = BIT(gfx, 14);
@ -706,70 +715,77 @@ READ8_MEMBER( hp1ll3_device::read )
{ {
uint8_t data = 0; uint8_t data = 0;
if (offset == 0) { if (offset == 0)
{
data = m_busy ? 1 : 0; data = m_busy ? 1 : 0;
data |= 2; data |= 2;
data |= (screen().vblank() ? 8 : 0); data |= (screen().vblank() ? 8 : 0);
} else { }
if ((m_io_ptr & 1) == 0) { else
{
if (!(m_io_ptr & 1))
{
switch (m_command) switch (m_command)
{ {
case RDMEM: case RDMEM:
m_io_word = rd_video(m_memory_ptr++); m_io_word = rd_video(m_memory_ptr++);
break; break;
case RDWIN: case RDWIN:
{
uint16_t addr = get_pix_addr(m_rw_win_x, m_rw_win_y);
unsigned bit = m_rw_win_x % WS;
int width = m_window.width + m_window.org_x - m_rw_win_x;
if (width <= 0)
{ {
uint16_t addr = get_pix_addr(m_rw_win_x , m_rw_win_y); m_command = NOP;
unsigned bit = m_rw_win_x % WS; }
int width = m_window.width + m_window.org_x - m_rw_win_x; else
if (width <= 0) { {
m_command = NOP; unsigned w = std::min(WS, unsigned(width));
break;
}
unsigned w = std::min(WS , unsigned(width));
m_io_word = rd_video(addr) << bit; m_io_word = rd_video(addr) << bit;
if ((bit + w) > WS) { if ((bit + w) > WS)
m_io_word |= rd_video(addr + 1) >> (WS - bit); m_io_word |= rd_video(addr + 1) >> (WS - bit);
}
m_io_word &= ~0 << (WS - w); m_io_word &= ~0 << (WS - w);
m_rw_win_x += w; m_rw_win_x += w;
if (m_rw_win_x >= (m_window.width + m_window.org_x)) { if (m_rw_win_x >= (m_window.width + m_window.org_x))
{
m_rw_win_x = m_window.org_x; m_rw_win_x = m_window.org_x;
m_rw_win_y++; m_rw_win_y++;
if (m_rw_win_y >= (m_window.height + m_window.org_y)) { if (m_rw_win_y >= (m_window.height + m_window.org_y))
m_command = NOP; m_command = NOP;
}
} }
} }
break;
case RDP:
if (m_io_ptr == 0) {
m_io_word = m_cursor_x;
} else if (m_io_ptr == 2) {
m_io_word = m_cursor_y;
}
break;
case RDSP:
if (m_io_ptr == 0) {
m_io_word = m_sprite_x;
} else if (m_io_ptr == 2) {
m_io_word = m_sprite_y;
}
break;
case ID:
/*
* 'diagb' ROM accepts either of these ID values
* 0x3003, 0x4004, 0x5005, 0x6006
*/
m_io_word = 0x4004;
break;
} }
break;
case RDP:
if (m_io_ptr == 0)
m_io_word = m_cursor_x;
else if (m_io_ptr == 2)
m_io_word = m_cursor_y;
break;
case RDSP:
if (m_io_ptr == 0)
m_io_word = m_sprite_x;
else if (m_io_ptr == 2)
m_io_word = m_sprite_y;
break;
case ID:
/*
* 'diagb' ROM accepts either of these ID values
* 0x3003, 0x4004, 0x5005, 0x6006
*/
m_io_word = 0x4004;
break;
}
data = uint8_t(m_io_word >> 8); data = uint8_t(m_io_word >> 8);
} else { } else
{
data = m_io_word & 0xff; data = m_io_word & 0xff;
} }
m_io_ptr++; m_io_ptr++;
@ -789,75 +805,86 @@ WRITE8_MEMBER( hp1ll3_device::write )
{ {
DBG_LOG(1,"HPGPU", ("W @ %d <- %02x\n", offset, data)); DBG_LOG(1,"HPGPU", ("W @ %d <- %02x\n", offset, data));
if (offset == 0) { if (offset == 0)
{
command(data); command(data);
} else { }
if ((m_io_ptr & 1) == 0) { else
{
if (!(m_io_ptr & 1))
{
m_io_word = uint16_t(data) << 8; m_io_word = uint16_t(data) << 8;
} else { }
else
{
m_io_word |= data; m_io_word |= data;
switch (m_command) switch (m_command)
{
case CONF:
m_conf[m_io_ptr >> 1] = m_io_word;
DBG_LOG(1,"HPGPU",("CONF data word %d received: %04X\n", m_io_ptr >> 1, m_io_word));
if ((m_io_ptr >> 1) == 10) {
apply_conf();
m_io_ptr = -1;
m_command = NOP;
}
break;
case WRMEM:
wr_video(m_memory_ptr++, m_io_word);
break;
case WRWIN:
{ {
case CONF: uint16_t rop_masks[4];
m_conf[ m_io_ptr >> 1 ] = m_io_word; get_rop_masks(m_rr, rop_masks);
DBG_LOG(1,"HPGPU",("CONF data word %d received: %04X\n", m_io_ptr >> 1, m_io_word));
if ((m_io_ptr >> 1) == 10) {
apply_conf();
m_io_ptr = -1;
m_command = NOP;
}
break;
case WRMEM: uint16_t addr = get_pix_addr(m_rw_win_x, m_rw_win_y);
wr_video(m_memory_ptr++ , m_io_word); uint16_t glob_mask = ~0;
break; unsigned bit = m_rw_win_x % WS;
int width = m_window.width + m_window.org_x - m_rw_win_x;
case WRWIN: if (width <= 0)
{ {
uint16_t rop_masks[ 4 ]; m_command = NOP;
get_rop_masks(m_rr , rop_masks); draw_cursor_sprite();
}
else
{
unsigned w = std::min(WS, unsigned(width));
uint16_t addr = get_pix_addr(m_rw_win_x , m_rw_win_y); glob_mask >>= bit;
uint16_t glob_mask = ~0; if ((bit + w) < WS)
unsigned bit = m_rw_win_x % WS; glob_mask &= ~0 << (WS - (bit + w));
int width = m_window.width + m_window.org_x - m_rw_win_x;
if (width <= 0) {
m_command = NOP;
draw_cursor_sprite();
} else {
unsigned w = std::min(WS , unsigned(width));
glob_mask >>= bit; rmw_rop(addr, m_io_word >> bit, glob_mask, rop_masks);
if ((bit + w) < WS) { DBG_LOG(3, 0, ("WRWIN (%u,%u) %d %04x %04x\n", m_rw_win_x, m_rw_win_y, width, m_io_word >> bit, glob_mask));
glob_mask &= ~0 << (WS - (bit + w)); if ((bit + w) > WS)
} {
rmw_rop(addr , m_io_word >> bit , glob_mask , rop_masks); unsigned pad = WS - bit;
DBG_LOG(3, 0, ("WRWIN (%u,%u) %d %04x %04x\n" , m_rw_win_x , m_rw_win_y , width , m_io_word >> bit , glob_mask)); glob_mask = ~0 << (2 * WS - bit - w);
if ((bit + w) > WS) { rmw_rop(addr + 1, uint16_t(m_io_word << pad), glob_mask, rop_masks);
unsigned pad = WS - bit; DBG_LOG(3, 0, ("WRWIN %u %04x %04x\n", pad, m_io_word << pad, glob_mask));
glob_mask = ~0 << (2 * WS - bit - w); }
rmw_rop(addr + 1 , uint16_t(m_io_word << pad) , glob_mask , rop_masks); m_rw_win_x += w;
DBG_LOG(3, 0, ("WRWIN %u %04x %04x\n" , pad , m_io_word << pad , glob_mask)); if (m_rw_win_x >= (m_window.width + m_window.org_x))
} {
m_rw_win_x += w; m_rw_win_x = m_window.org_x;
if (m_rw_win_x >= (m_window.width + m_window.org_x)) { m_rw_win_y++;
m_rw_win_x = m_window.org_x; if (m_rw_win_y >= (m_window.height + m_window.org_y))
m_rw_win_y++; {
if (m_rw_win_y >= (m_window.height + m_window.org_y)) { m_command = NOP;
m_command = NOP; draw_cursor_sprite();
draw_cursor_sprite();
}
} }
} }
} }
break;
default:
if (m_io_ptr <= 4) {
m_input[ m_io_ptr / 2 ] = m_io_word;
}
DBG_LOG(2,"HPGPU",("wrote %02x at %d, input buffer is %04X %04X\n", data, m_io_ptr, m_input[0], m_input[1]));
} }
break;
default:
if (m_io_ptr <= 4)
m_input[m_io_ptr / 2] = m_io_word;
DBG_LOG(2,"HPGPU",("wrote %02x at %d, input buffer is %04X %04X\n", data, m_io_ptr, m_input[0], m_input[1]));
}
} }
m_io_ptr++; m_io_ptr++;
} }
@ -866,8 +893,6 @@ WRITE8_MEMBER( hp1ll3_device::write )
void hp1ll3_device::command(int command) void hp1ll3_device::command(int command)
{ {
int c, w;
switch (command) switch (command)
{ {
@ -912,7 +937,7 @@ void hp1ll3_device::command(int command)
case ENSP: case ENSP:
DBG_LOG(2,"HPGPU",("command: ENSP [%d, 0x%x]\n", command, command)); DBG_LOG(2,"HPGPU",("command: ENSP [%d, 0x%x]\n", command, command));
draw_sprite(); draw_sprite();
m_sprite_pattern = m_input[ 0 ]; m_sprite_pattern = m_input[0];
m_enable_sprite = true; m_enable_sprite = true;
draw_sprite(); draw_sprite();
DBG_LOG(1,"HPGPU",("enable sprite; cursor %d,%d sprite %d,%d\n", m_cursor_x, m_cursor_y, m_sprite_x, m_sprite_y)); DBG_LOG(1,"HPGPU",("enable sprite; cursor %d,%d sprite %d,%d\n", m_cursor_x, m_cursor_y, m_sprite_x, m_sprite_y));
@ -960,7 +985,7 @@ void hp1ll3_device::command(int command)
// set replacement rule (raster op) // set replacement rule (raster op)
case WRRR: case WRRR:
DBG_LOG(2,"HPGPU",("command: WRRR [%d, 0x%x] (0x%04x)\n", command, command, m_input[0])); DBG_LOG(2,"HPGPU",("command: WRRR [%d, 0x%x] (0x%04x)\n", command, command, m_input[0]));
m_rr = m_input[ 0 ]; m_rr = m_input[0];
break; break;
// set user-defined line pattern // set user-defined line pattern
@ -975,18 +1000,20 @@ void hp1ll3_device::command(int command)
command, command, m_input[0], command, command, m_input[0],
m_window.org_x, m_window.org_y, m_window.width, m_window.height, m_rr)); m_window.org_x, m_window.org_y, m_window.width, m_window.height, m_rr));
draw_cursor_sprite(); draw_cursor_sprite();
fill(get_window() , m_input[0]); fill(get_window(), m_input[0]);
draw_cursor_sprite(); draw_cursor_sprite();
break; break;
case LABEL: case LABEL:
DBG_LOG(2,"HPGPU",("command: LABEL [%d, 0x%x] (0x%04x, '%c') at %d,%d\n", command, command, m_input[0], {
(m_input[0]<32||m_input[0]>127) ? ' ' : m_input[0], m_cursor_x, m_cursor_y)); DBG_LOG(2,"HPGPU",("command: LABEL [%d, 0x%x] (0x%04x, '%c') at %d,%d\n", command, command, m_input[0],
c = m_input[0] & 255; (m_input[0]<32||m_input[0]>127) ? ' ' : m_input[0], m_cursor_x, m_cursor_y));
w = (c & 1) ? int const c = m_input[0] & 255;
(rd_video(m_fad + 2 + (c>>1)) & 255) : int const w = (c & 1) ?
(rd_video(m_fad + 2 + (c>>1)) >> 8); (rd_video(m_fad + 2 + (c>>1)) & 255) :
label(c, w); (rd_video(m_fad + 2 + (c>>1)) >> 8);
label(c, w);
}
break; break;
// Write window // Write window
@ -1011,8 +1038,8 @@ void hp1ll3_device::command(int command)
case DRAWPX: case DRAWPX:
{ {
DBG_LOG(2,"HPGPU",("command: DRAWPX [%d, 0x%x] (%d, %d)\n", command, command, m_input[0], m_input[1])); DBG_LOG(2,"HPGPU",("command: DRAWPX [%d, 0x%x] (%d, %d)\n", command, command, m_input[0], m_input[1]));
uint16_t rop_masks[ 4 ]; uint16_t rop_masks[4];
get_rop_masks(m_rr , rop_masks); get_rop_masks(m_rr, rop_masks);
point(m_input[0], m_input[1], true, rop_masks); point(m_input[0], m_input[1], true, rop_masks);
} }
break; break;
@ -1036,11 +1063,11 @@ void hp1ll3_device::command(int command)
{ {
DBG_LOG(2,"HPGPU",("command: COPY [%d, 0x%x] (%d, %d)\n", command, command, m_input[0], m_input[1])); DBG_LOG(2,"HPGPU",("command: COPY [%d, 0x%x] (%d, %d)\n", command, command, m_input[0], m_input[1]));
draw_cursor_sprite(); draw_cursor_sprite();
unsigned rounded_width = m_conf[ CONF_WPL ] * WS; unsigned rounded_width = m_conf[CONF_WPL] * WS;
Rectangle dst_rect{{ m_input[ 0 ] , m_input[ 1 ] } , { m_window.width , m_window.height }}; Rectangle dst_rect{{ m_input[0], m_input[1] }, { m_window.width, m_window.height }};
// COPY apparently doesn't clip anything // COPY apparently doesn't clip anything
bitblt(m_org , rounded_width , 0xffff , Point{ m_window.org_x , m_window.org_y } , bitblt(m_org, rounded_width, 0xffff, Point{ m_window.org_x, m_window.org_y },
Rectangle{{ 0 , 0 } , { uint16_t(rounded_width) , 0xffff }} , dst_rect , m_rr); Rectangle{{ 0, 0 }, { uint16_t(rounded_width), 0xffff }}, dst_rect, m_rr);
draw_cursor_sprite(); draw_cursor_sprite();
} }
break; break;
@ -1048,7 +1075,7 @@ void hp1ll3_device::command(int command)
// move pointer absolute // move pointer absolute
case MOVEP: case MOVEP:
DBG_LOG(2,"HPGPU",("command: MOVEP [%d, 0x%x] (%d, %d)\n", command, command, m_input[0], m_input[1])); DBG_LOG(2,"HPGPU",("command: MOVEP [%d, 0x%x] (%d, %d)\n", command, command, m_input[0], m_input[1]));
set_pen_pos(Point{ m_input[ 0 ] , m_input[ 1 ] }); set_pen_pos(Point{ m_input[0], m_input[1] });
m_saved_x = m_cursor_x; m_saved_x = m_cursor_x;
break; break;
@ -1057,13 +1084,13 @@ void hp1ll3_device::command(int command)
{ {
DBG_LOG(2,"HPGPU",("command: SCROLUP [%d, 0x%x] (%d, %d)\n", command, command, m_input[0], m_input[1])); DBG_LOG(2,"HPGPU",("command: SCROLUP [%d, 0x%x] (%d, %d)\n", command, command, m_input[0], m_input[1]));
draw_cursor_sprite(); draw_cursor_sprite();
Point src_p{ m_window.org_x , uint16_t(m_window.org_y + m_input[ 1 ]) }; Point src_p{ m_window.org_x, uint16_t(m_window.org_y + m_input[1]) };
Rectangle dst_rect = get_window(); Rectangle dst_rect = get_window();
dst_rect.size.y -= m_input[ 1 ]; dst_rect.size.y -= m_input[1];
bitblt(m_org , m_horiz_pix_total , m_vert_pix_total , src_p , get_window() , dst_rect , m_rr); bitblt(m_org, m_horiz_pix_total, m_vert_pix_total, src_p, get_window(), dst_rect, m_rr);
dst_rect.origin.y += dst_rect.size.y; dst_rect.origin.y += dst_rect.size.y;
dst_rect.size.y = m_input[ 1 ]; dst_rect.size.y = m_input[1];
fill(dst_rect , m_input[ 0 ]); fill(dst_rect, m_input[0]);
draw_cursor_sprite(); draw_cursor_sprite();
} }
break; break;
@ -1073,14 +1100,14 @@ void hp1ll3_device::command(int command)
{ {
DBG_LOG(2,"HPGPU",("command: SCROLDN [%d, 0x%x] (%d, %d)\n", command, command, m_input[0], m_input[1])); DBG_LOG(2,"HPGPU",("command: SCROLDN [%d, 0x%x] (%d, %d)\n", command, command, m_input[0], m_input[1]));
draw_cursor_sprite(); draw_cursor_sprite();
Point src_p{ m_window.org_x , m_window.org_y }; Point src_p{ m_window.org_x, m_window.org_y };
Rectangle dst_rect = get_window(); Rectangle dst_rect = get_window();
dst_rect.origin.y += m_input[ 1 ]; dst_rect.origin.y += m_input[1];
dst_rect.size.y -= m_input[ 1 ]; dst_rect.size.y -= m_input[1];
bitblt(m_org , m_horiz_pix_total , m_vert_pix_total , src_p , get_window() , dst_rect , m_rr); bitblt(m_org, m_horiz_pix_total, m_vert_pix_total, src_p, get_window(), dst_rect, m_rr);
dst_rect.origin.y = m_window.org_y; dst_rect.origin.y = m_window.org_y;
dst_rect.size.y = m_input[ 1 ]; dst_rect.size.y = m_input[1];
fill(dst_rect , m_input[ 0 ]); fill(dst_rect, m_input[0]);
draw_cursor_sprite(); draw_cursor_sprite();
} }
break; break;
@ -1088,8 +1115,8 @@ void hp1ll3_device::command(int command)
case ENCURS: case ENCURS:
DBG_LOG(2,"HPGPU",("command: ENCURS [%d, 0x%x]\n", command, command)); DBG_LOG(2,"HPGPU",("command: ENCURS [%d, 0x%x]\n", command, command));
draw_cursor(); draw_cursor();
m_cursor_pattern = m_input[ 0 ]; m_cursor_pattern = m_input[0];
m_cursor_offset = m_input[ 1 ]; m_cursor_offset = m_input[1];
m_enable_cursor = true; m_enable_cursor = true;
draw_cursor(); draw_cursor();
DBG_LOG(1,"HPGPU",("enable cursor; cursor %d,%d sprite %d,%d\n", m_cursor_x, m_cursor_y, m_sprite_x, m_sprite_y)); DBG_LOG(1,"HPGPU",("enable cursor; cursor %d,%d sprite %d,%d\n", m_cursor_x, m_cursor_y, m_sprite_x, m_sprite_y));
@ -1098,13 +1125,13 @@ void hp1ll3_device::command(int command)
// carriage return, line feed // carriage return, line feed
case CRLFx: case CRLFx:
DBG_LOG(2,"HPGPU",("command: CRLF [%d, 0x%x] (%d, %d)\n", command, command, m_input[0], m_input[1])); DBG_LOG(2,"HPGPU",("command: CRLF [%d, 0x%x] (%d, %d)\n", command, command, m_input[0], m_input[1]));
set_pen_pos(Point{ m_saved_x , uint16_t(m_cursor_y + m_fontheight) }); set_pen_pos(Point{ m_saved_x, uint16_t(m_cursor_y + m_fontheight) });
break; break;
// move sprite absolute // move sprite absolute
case MOVESP: case MOVESP:
DBG_LOG(2,"HPGPU",("command: MOVESP [%d, 0x%x] (%d, %d)\n", command, command, m_input[0], m_input[1])); DBG_LOG(2,"HPGPU",("command: MOVESP [%d, 0x%x] (%d, %d)\n", command, command, m_input[0], m_input[1]));
set_sprite_pos(Point{ m_input[ 0 ] , m_input[ 1 ] }); set_sprite_pos(Point{ m_input[0], m_input[1] });
break; break;
// draw to ... // draw to ...
@ -1112,7 +1139,7 @@ void hp1ll3_device::command(int command)
DBG_LOG(2,"HPGPU",("command: DRAWP [%d, 0x%x] (%d, %d) to (%d, %d)\n", DBG_LOG(2,"HPGPU",("command: DRAWP [%d, 0x%x] (%d, %d) to (%d, %d)\n",
command, command, m_cursor_x, m_cursor_y, m_input[0], m_input[1])); command, command, m_cursor_x, m_cursor_y, m_input[0], m_input[1]));
line(m_cursor_x, m_cursor_y, m_input[0], m_input[1]); line(m_cursor_x, m_cursor_y, m_input[0], m_input[1]);
set_pen_pos(Point{ m_input[ 0 ] , m_input[ 1 ] }); set_pen_pos(Point{ m_input[0], m_input[1] });
break; break;
// type 3 command -- CONF -- accept configuration parameters (11 words) // type 3 command -- CONF -- accept configuration parameters (11 words)
@ -1129,7 +1156,7 @@ void hp1ll3_device::command(int command)
m_memory_ptr = m_input[0]; // memory is word-addressable m_memory_ptr = m_input[0]; // memory is word-addressable
break; break;
// type 3 read commands // type 3 read commands
case RDP: case RDP:
case RDSP: case RDSP:
break; break;

View File

@ -12,13 +12,6 @@
#pragma once #pragma once
///*************************************************************************
// INTERFACE CONFIGURATION MACROS
///*************************************************************************
#define MCFG_HP1LL3_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, HP1LL3, 0)
///************************************************************************* ///*************************************************************************
// TYPE DEFINITIONS // TYPE DEFINITIONS
///************************************************************************* ///*************************************************************************
@ -43,31 +36,33 @@ protected:
virtual void device_reset() override; virtual void device_reset() override;
private: private:
struct Point { struct Point
uint16_t x , y; {
uint16_t x, y;
}; };
struct Rectangle { struct Rectangle
{
Point origin; Point origin;
Point size; Point size;
}; };
void command(int command); void command(int command);
uint16_t get_pix_addr(uint16_t x , uint16_t y) const; uint16_t get_pix_addr(uint16_t x, uint16_t y) const;
inline void point(int x, int y, bool pix, const uint16_t masks[]); inline void point(int x, int y, bool pix, const uint16_t masks[]);
void label(uint8_t chr, int width); void label(uint8_t chr, int width);
void line(int x_from, int y_from, int x_to, int y_to); void line(int x_from, int y_from, int x_to, int y_to);
void wr_video(uint16_t addr , uint16_t v); void wr_video(uint16_t addr, uint16_t v);
uint16_t rd_video(uint16_t addr) const; uint16_t rd_video(uint16_t addr) const;
static void get_rop_masks(uint16_t rop , uint16_t masks[]); static void get_rop_masks(uint16_t rop, uint16_t masks[]);
static uint16_t apply_rop(uint16_t old_pix , uint16_t new_pix , uint16_t glob_mask , const uint16_t masks[]); static uint16_t apply_rop(uint16_t old_pix, uint16_t new_pix, uint16_t glob_mask, const uint16_t masks[]);
void rmw_rop(uint16_t addr , uint16_t new_pix , uint16_t glob_mask , const uint16_t masks[]); void rmw_rop(uint16_t addr, uint16_t new_pix, uint16_t glob_mask, const uint16_t masks[]);
void clip_coord(int size_1 , int& p1 , int origin_clip , int size_clip , int& origin_2 , int& size_2) const; void clip_coord(int size_1, int &p1, int origin_clip, int size_clip, int &origin_2, int &size_2) const;
bool bitblt(uint16_t src_base_addr , unsigned src_width , unsigned src_height , Point src_p , bool bitblt(uint16_t src_base_addr, unsigned src_width, unsigned src_height, Point src_p,
const Rectangle& clip_rect , const Rectangle& dst_rect , uint16_t rop , bool use_m_org = true); const Rectangle &clip_rect, const Rectangle &dst_rect, uint16_t rop, bool use_m_org = true);
void rowbltpos(unsigned p1_pix , unsigned p2_pix , int width , const uint16_t masks[]); void rowbltpos(unsigned p1_pix, unsigned p2_pix, int width, const uint16_t masks[]);
void rowbltneg(unsigned p1_pix , unsigned p2_pix , int width , const uint16_t masks[]); void rowbltneg(unsigned p1_pix, unsigned p2_pix, int width, const uint16_t masks[]);
void fill(const Rectangle& fill_rect , uint16_t pattern_no); void fill(const Rectangle &fill_rect, uint16_t pattern_no);
uint16_t get_pattern_addr(uint16_t pattern_no) const; uint16_t get_pattern_addr(uint16_t pattern_no) const;
void draw_cursor(); void draw_cursor();
void draw_sprite(); void draw_sprite();
@ -78,7 +73,7 @@ private:
Rectangle get_screen() const; Rectangle get_screen() const;
void apply_conf(); void apply_conf();
uint16_t m_conf[ 11 ] , m_input[2] , m_io_word; uint16_t m_conf[11], m_input[2], m_io_word;
int m_io_ptr, m_memory_ptr; int m_io_ptr, m_memory_ptr;
int m_command, m_horiz_pix_total, m_vert_pix_total; int m_command, m_horiz_pix_total, m_vert_pix_total;
@ -100,7 +95,7 @@ private:
} m_window; } m_window;
std::unique_ptr<uint16_t[]> m_videoram; std::unique_ptr<uint16_t[]> m_videoram;
uint16_t m_ram_addr_mask; uint16_t m_ram_addr_mask;
uint16_t m_rw_win_x , m_rw_win_y; uint16_t m_rw_win_x, m_rw_win_y;
bool m_busy; bool m_busy;