diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/devices/cpu/g65816/g65816.cpp | 18 | ||||
-rw-r--r-- | src/devices/cpu/g65816/g65816.h | 2 | ||||
-rw-r--r-- | src/devices/cpu/g65816/g65816cm.h | 20 | ||||
-rw-r--r-- | src/devices/cpu/spc700/spc700.cpp | 3 | ||||
-rw-r--r-- | src/emu/drawgfx.cpp | 347 | ||||
-rw-r--r-- | src/emu/drawgfx.h | 29 | ||||
-rw-r--r-- | src/emu/drawgfxm.h | 1343 | ||||
-rw-r--r-- | src/emu/drawgfxt.ipp | 1911 | ||||
-rw-r--r-- | src/emu/video.cpp | 2 | ||||
-rw-r--r-- | src/lib/util/bitmap.cpp | 39 | ||||
-rw-r--r-- | src/lib/util/bitmap.h | 118 | ||||
-rw-r--r-- | src/mame/drivers/at.cpp | 310 | ||||
-rw-r--r-- | src/mame/drivers/karnov.cpp | 72 | ||||
-rw-r--r-- | src/mame/drivers/pc.cpp | 64 | ||||
-rw-r--r-- | src/mame/mame.lst | 14 | ||||
-rw-r--r-- | src/mame/video/733_asr.cpp | 6 | ||||
-rw-r--r-- | src/mame/video/apexc.cpp | 6 | ||||
-rw-r--r-- | src/mame/video/pdp1.cpp | 9 | ||||
-rw-r--r-- | src/mame/video/psikyosh.cpp | 29 | ||||
-rw-r--r-- | src/mame/video/suna8.cpp | 24 | ||||
-rw-r--r-- | src/mame/video/tc0080vco.cpp | 22 | ||||
-rw-r--r-- | src/mame/video/tx0.cpp | 6 | ||||
-rw-r--r-- | src/osd/mac/windowcontroller.mm | 24 | ||||
-rw-r--r-- | src/osd/modules/lib/osdobj_common.cpp | 2 |
24 files changed, 2527 insertions, 1893 deletions
diff --git a/src/devices/cpu/g65816/g65816.cpp b/src/devices/cpu/g65816/g65816.cpp index 93c93f96ed8..eb46c11242d 100644 --- a/src/devices/cpu/g65816/g65816.cpp +++ b/src/devices/cpu/g65816/g65816.cpp @@ -895,9 +895,7 @@ void g65816_device::device_start() machine().save().register_postload(save_prepost_delegate(FUNC(g65816_device::g65816_restore_state), this)); - m_rw8_cycles = 1; - m_rw16_cycles = 2; - m_rw24_cycles = 3; + m_divider = 1; state_add( G65816_PC, "PC", m_debugger_temp).callimport().callexport().formatstr("%06X"); state_add( G65816_S, "S", m_s).callimport().formatstr("%04X"); @@ -1031,14 +1029,14 @@ int g65816_device::bus_5A22_cycle_burst(unsigned addr) if(addr & 0x408000) { if(addr & 0x800000) - return (m_fastROM & 1) ? 6 : 8; + return (m_fastROM & 1) ? 0 : 2; - return 8; + return 2; } - if((addr + 0x6000) & 0x4000) return 8; - if((addr - 0x4000) & 0x7e00) return 6; + if((addr + 0x6000) & 0x4000) return 2; + if((addr - 0x4000) & 0x7e00) return 0; - return 12; + return 6; } @@ -1048,9 +1046,7 @@ void _5a22_device::device_start() state_add( _5A22_FASTROM, "fastROM", m_debugger_temp).mask(0x01).callimport().callexport().formatstr("%01X"); - m_rw8_cycles = 0; - m_rw16_cycles = 0; - m_rw24_cycles = 0; + m_divider = 6; } void _5a22_device::state_import(const device_state_entry &entry) diff --git a/src/devices/cpu/g65816/g65816.h b/src/devices/cpu/g65816/g65816.h index 454dc7fd1b5..f7028697880 100644 --- a/src/devices/cpu/g65816/g65816.h +++ b/src/devices/cpu/g65816/g65816.h @@ -246,7 +246,7 @@ protected: unsigned m_destination; int m_ICount; int m_cpu_type; - uint8_t m_rw8_cycles, m_rw16_cycles, m_rw24_cycles; + uint8_t m_divider; uint32_t m_debugger_temp; /* 5A22 specific registers */ diff --git a/src/devices/cpu/g65816/g65816cm.h b/src/devices/cpu/g65816/g65816cm.h index 6991eca301e..7956eda871c 100644 --- a/src/devices/cpu/g65816/g65816cm.h +++ b/src/devices/cpu/g65816/g65816cm.h @@ -117,16 +117,16 @@ /* ======================================================================== */ #define CLK_OP 1 -#define CLK_R8 m_rw8_cycles -#define CLK_R16 m_rw16_cycles -#define CLK_R24 m_rw24_cycles -#define CLK_W8 m_rw8_cycles -#define CLK_W16 m_rw16_cycles -#define CLK_W24 m_rw24_cycles -#define CLK_RMW8 m_rw8_cycles+m_rw8_cycles + 1 -#define CLK_RMW16 m_rw16_cycles+m_rw16_cycles + 1 +#define CLK_R8 1 +#define CLK_R16 2 +#define CLK_R24 3 +#define CLK_W8 1 +#define CLK_W16 2 +#define CLK_W24 3 +#define CLK_RMW8 3 +#define CLK_RMW16 5 + -#define CLK_IMPLIED 1 #define CLK_IMPLIED 1 #define CLK_RELATIVE_8 1 #define CLK_RELATIVE_16 2 @@ -169,7 +169,7 @@ #define CLK_W_S 2 #define CLK_W_SIY 5 -#define CLK(A) CLOCKS -= A +#define CLK(A) CLOCKS -= ((A)*(m_divider)) #define CLK_BUS(A) CLOCKS -= A #define USE_ALL_CLKS() CLOCKS = 0 diff --git a/src/devices/cpu/spc700/spc700.cpp b/src/devices/cpu/spc700/spc700.cpp index 3118d97e810..b5d2b835cfc 100644 --- a/src/devices/cpu/spc700/spc700.cpp +++ b/src/devices/cpu/spc700/spc700.cpp @@ -247,7 +247,8 @@ device_memory_interface::space_config_vector spc700_device::memory_space_config( /* ======================================================================== */ /* Use up clock cycles */ -#define CLK(A) CLOCKS -= (A) +#define CLK_DIVIDER 2 +#define CLK(A) CLOCKS -= ((A)*(CLK_DIVIDER)) #define CLK_ALL() CLOCKS = 0 diff --git a/src/emu/drawgfx.cpp b/src/emu/drawgfx.cpp index 841ae7c670f..488a0c9740e 100644 --- a/src/emu/drawgfx.cpp +++ b/src/emu/drawgfx.cpp @@ -8,18 +8,7 @@ *********************************************************************/ #include "emu.h" -#include "drawgfxm.h" - - -/*************************************************************************** - GLOBAL VARIABLES -***************************************************************************/ - -// if this line errors during compile, the size of NO_PRIORITY is wrong and I need to use something else -u8 no_priority_size_is_wrong[2 * (sizeof(NO_PRIORITY) == 3) - 1]; - -bitmap_ind8 drawgfx_dummy_priority_bitmap; - +#include "drawgfxt.ipp" /*************************************************************************** @@ -364,8 +353,7 @@ void gfx_element::opaque(bitmap_ind16 &dest, const rectangle &cliprect, { color = colorbase() + granularity() * (color % colors()); code %= elements(); - DECLARE_NO_PRIORITY; - DRAWGFX_CORE(u16, PIXEL_OP_REBASE_OPAQUE, NO_PRIORITY); + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, [color](u16 &destp, const u8 &srcp) { PIXEL_OP_REBASE_OPAQUE(destp, srcp); }); } void gfx_element::opaque(bitmap_rgb32 &dest, const rectangle &cliprect, @@ -373,8 +361,7 @@ void gfx_element::opaque(bitmap_rgb32 &dest, const rectangle &cliprect, { const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); code %= elements(); - DECLARE_NO_PRIORITY; - DRAWGFX_CORE(u32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, [paldata](u32 &destp, const u8 &srcp) { PIXEL_OP_REMAP_OPAQUE(destp, srcp); }); } @@ -407,8 +394,7 @@ void gfx_element::transpen(bitmap_ind16 &dest, const rectangle &cliprect, // render color = colorbase() + granularity() * (color % colors()); - DECLARE_NO_PRIORITY; - DRAWGFX_CORE(u16, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY); + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, [trans_pen, color](u16 &destp, const u8 &srcp) { PIXEL_OP_REBASE_TRANSPEN(destp, srcp); }); } void gfx_element::transpen(bitmap_rgb32 &dest, const rectangle &cliprect, @@ -435,8 +421,7 @@ void gfx_element::transpen(bitmap_rgb32 &dest, const rectangle &cliprect, // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); - DECLARE_NO_PRIORITY; - DRAWGFX_CORE(u32, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY); + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, [trans_pen, paldata](u32 &destp, const u8 &srcp) { PIXEL_OP_REMAP_TRANSPEN(destp, srcp); }); } @@ -456,8 +441,7 @@ void gfx_element::transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, return; // render - DECLARE_NO_PRIORITY; - DRAWGFX_CORE(u16, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY); + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, [trans_pen, color](u16 &destp, const u8 &srcp) { PIXEL_OP_REBASE_TRANSPEN(destp, srcp); }); } void gfx_element::transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, @@ -470,8 +454,7 @@ void gfx_element::transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, return; // render - DECLARE_NO_PRIORITY; - DRAWGFX_CORE(u32, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY); + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, [trans_pen, color](u32 &destp, const u8 &srcp) { PIXEL_OP_REBASE_TRANSPEN(destp, srcp); }); } @@ -505,8 +488,7 @@ void gfx_element::transmask(bitmap_ind16 &dest, const rectangle &cliprect, // render color = colorbase() + granularity() * (color % colors()); - DECLARE_NO_PRIORITY; - DRAWGFX_CORE(u16, PIXEL_OP_REBASE_TRANSMASK, NO_PRIORITY); + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, [trans_mask, color](u16 &destp, const u8 &srcp) { PIXEL_OP_REBASE_TRANSMASK(destp, srcp); }); } void gfx_element::transmask(bitmap_rgb32 &dest, const rectangle &cliprect, @@ -533,8 +515,7 @@ void gfx_element::transmask(bitmap_rgb32 &dest, const rectangle &cliprect, // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); - DECLARE_NO_PRIORITY; - DRAWGFX_CORE(u32, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY); + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, [trans_mask, paldata](u32 &destp, const u8 &srcp) { PIXEL_OP_REMAP_TRANSMASK(destp, srcp); }); } @@ -554,8 +535,7 @@ void gfx_element::transtable(bitmap_ind16 &dest, const rectangle &cliprect, color = colorbase() + granularity() * (color % colors()); const pen_t *shadowtable = m_palette->shadow_table(); code %= elements(); - DECLARE_NO_PRIORITY; - DRAWGFX_CORE(u16, PIXEL_OP_REBASE_TRANSTABLE16, NO_PRIORITY); + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, [pentable, color, shadowtable](u16 &destp, const u8 &srcp) { PIXEL_OP_REBASE_TRANSTABLE16(destp, srcp); }); } void gfx_element::transtable(bitmap_rgb32 &dest, const rectangle &cliprect, @@ -568,8 +548,7 @@ void gfx_element::transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); const pen_t *shadowtable = m_palette->shadow_table(); code %= elements(); - DECLARE_NO_PRIORITY; - DRAWGFX_CORE(u32, PIXEL_OP_REMAP_TRANSTABLE32, NO_PRIORITY); + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, [pentable, paldata, shadowtable](u32 &destp, const u8 &srcp) { PIXEL_OP_REMAP_TRANSTABLE32(destp, srcp); }); } @@ -594,8 +573,7 @@ void gfx_element::alpha(bitmap_rgb32 &dest, const rectangle &cliprect, // get final code and color, and grab lookup tables const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); - DECLARE_NO_PRIORITY; - DRAWGFX_CORE(u32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32, NO_PRIORITY); + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, [trans_pen, alpha_val, paldata](u32 &destp, const u8 &srcp) { PIXEL_OP_REMAP_TRANSPEN_ALPHA32(destp, srcp); }); } @@ -620,8 +598,7 @@ void gfx_element::zoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, // render color = colorbase() + granularity() * (color % colors()); code %= elements(); - DECLARE_NO_PRIORITY; - DRAWGFXZOOM_CORE(u16, PIXEL_OP_REBASE_OPAQUE, NO_PRIORITY); + drawgfxzoom_core(dest, cliprect, code, flipx, flipy, destx, desty, scalex, scaley, [color](u16 &destp, const u8 &srcp) { PIXEL_OP_REBASE_OPAQUE(destp, srcp); }); } void gfx_element::zoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, @@ -635,8 +612,7 @@ void gfx_element::zoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); code %= elements(); - DECLARE_NO_PRIORITY; - DRAWGFXZOOM_CORE(u32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); + drawgfxzoom_core(dest, cliprect, code, flipx, flipy, destx, desty, scalex, scaley, [paldata](u32 &destp, const u8 &srcp) { PIXEL_OP_REMAP_OPAQUE(destp, srcp); }); } @@ -673,8 +649,7 @@ void gfx_element::zoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, // render color = colorbase() + granularity() * (color % colors()); - DECLARE_NO_PRIORITY; - DRAWGFXZOOM_CORE(u16, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY); + drawgfxzoom_core(dest, cliprect, code, flipx, flipy, destx, desty, scalex, scaley, [trans_pen, color](u16 &destp, const u8 &srcp) { PIXEL_OP_REBASE_TRANSPEN(destp, srcp); }); } void gfx_element::zoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, @@ -705,8 +680,7 @@ void gfx_element::zoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); - DECLARE_NO_PRIORITY; - DRAWGFXZOOM_CORE(u32, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY); + drawgfxzoom_core(dest, cliprect, code, flipx, flipy, destx, desty, scalex, scaley, [trans_pen, paldata](u32 &destp, const u8 &srcp) { PIXEL_OP_REMAP_TRANSPEN(destp, srcp); }); } @@ -730,8 +704,7 @@ void gfx_element::zoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprec return; // render - DECLARE_NO_PRIORITY; - DRAWGFXZOOM_CORE(u16, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY); + drawgfxzoom_core(dest, cliprect, code, flipx, flipy, destx, desty, scalex, scaley, [trans_pen, color](u16 &destp, const u8 &srcp) { PIXEL_OP_REBASE_TRANSPEN(destp, srcp); }); } void gfx_element::zoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, @@ -748,8 +721,7 @@ void gfx_element::zoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprec return; // render - DECLARE_NO_PRIORITY; - DRAWGFXZOOM_CORE(u32, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY); + drawgfxzoom_core(dest, cliprect, code, flipx, flipy, destx, desty, scalex, scaley, [trans_pen, color](u32 &destp, const u8 &srcp) { PIXEL_OP_REBASE_TRANSPEN(destp, srcp); }); } @@ -787,8 +759,7 @@ void gfx_element::zoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, // render color = colorbase() + granularity() * (color % colors()); - DECLARE_NO_PRIORITY; - DRAWGFXZOOM_CORE(u16, PIXEL_OP_REBASE_TRANSMASK, NO_PRIORITY); + drawgfxzoom_core(dest, cliprect, code, flipx, flipy, destx, desty, scalex, scaley, [trans_mask, color](u16 &destp, const u8 &srcp) { PIXEL_OP_REBASE_TRANSMASK(destp, srcp); }); } void gfx_element::zoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, @@ -819,8 +790,7 @@ void gfx_element::zoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); - DECLARE_NO_PRIORITY; - DRAWGFXZOOM_CORE(u32, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY); + drawgfxzoom_core(dest, cliprect, code, flipx, flipy, destx, desty, scalex, scaley, [trans_mask, paldata](u32 &destp, const u8 &srcp) { PIXEL_OP_REMAP_TRANSMASK(destp, srcp); }); } @@ -844,8 +814,7 @@ void gfx_element::zoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, color = colorbase() + granularity() * (color % colors()); const pen_t *shadowtable = m_palette->shadow_table(); code %= elements(); - DECLARE_NO_PRIORITY; - DRAWGFXZOOM_CORE(u16, PIXEL_OP_REBASE_TRANSTABLE16, NO_PRIORITY); + drawgfxzoom_core(dest, cliprect, code, flipx, flipy, destx, desty, scalex, scaley, [pentable, color, shadowtable](u16 &destp, const u8 &srcp) { PIXEL_OP_REBASE_TRANSTABLE16(destp, srcp); }); } void gfx_element::zoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, @@ -862,8 +831,7 @@ void gfx_element::zoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); const pen_t *shadowtable = m_palette->shadow_table(); code %= elements(); - DECLARE_NO_PRIORITY; - DRAWGFXZOOM_CORE(u32, PIXEL_OP_REMAP_TRANSTABLE32, NO_PRIORITY); + drawgfxzoom_core(dest, cliprect, code, flipx, flipy, destx, desty, scalex, scaley, [pentable, paldata, shadowtable](u32 &destp, const u8 &srcp) { PIXEL_OP_REMAP_TRANSTABLE32(destp, srcp); }); } @@ -892,8 +860,7 @@ void gfx_element::zoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); - DECLARE_NO_PRIORITY; - DRAWGFXZOOM_CORE(u32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32, NO_PRIORITY); + drawgfxzoom_core(dest, cliprect, code, flipx, flipy, destx, desty, scalex, scaley, [trans_pen, alpha_val, paldata](u32 &destp, const u8 &srcp) { PIXEL_OP_REMAP_TRANSPEN_ALPHA32(destp, srcp); }); } @@ -918,7 +885,7 @@ void gfx_element::prio_opaque(bitmap_ind16 &dest, const rectangle &cliprect, // render color = colorbase() + granularity() * (color % colors()); code %= elements(); - DRAWGFX_CORE(u16, PIXEL_OP_REBASE_OPAQUE_PRIORITY, u8); + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, priority, [pmask, color](u16 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REBASE_OPAQUE_PRIORITY(destp, pri, srcp); }); } void gfx_element::prio_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, @@ -931,7 +898,7 @@ void gfx_element::prio_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); code %= elements(); - DRAWGFX_CORE(u32, PIXEL_OP_REMAP_OPAQUE_PRIORITY, u8); + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, priority, [pmask, paldata](u32 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REMAP_OPAQUE_PRIORITY(destp, pri, srcp); }); } @@ -968,7 +935,7 @@ void gfx_element::prio_transpen(bitmap_ind16 &dest, const rectangle &cliprect, // render color = colorbase() + granularity() * (color % colors()); - DRAWGFX_CORE(u16, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, u8); + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, priority, [pmask, trans_pen, color](u16 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REBASE_TRANSPEN_PRIORITY(destp, pri, srcp); }); } void gfx_element::prio_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, @@ -998,7 +965,7 @@ void gfx_element::prio_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); - DRAWGFX_CORE(u32, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, u8); + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, priority, [pmask, trans_pen, paldata](u32 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REMAP_TRANSPEN_PRIORITY(destp, pri, srcp); }); } @@ -1021,7 +988,7 @@ void gfx_element::prio_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprec pmask |= 1 << 31; // render - DRAWGFX_CORE(u16, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, u8); + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, priority, [pmask, trans_pen, color](u16 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REBASE_TRANSPEN_PRIORITY(destp, pri, srcp); }); } void gfx_element::prio_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, @@ -1037,7 +1004,7 @@ void gfx_element::prio_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprec pmask |= 1 << 31; // render - DRAWGFX_CORE(u32, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, u8); + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, priority, [pmask, trans_pen, color](u32 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REBASE_TRANSPEN_PRIORITY(destp, pri, srcp); }); } @@ -1074,7 +1041,7 @@ void gfx_element::prio_transmask(bitmap_ind16 &dest, const rectangle &cliprect, // render color = colorbase() + granularity() * (color % colors()); - DRAWGFX_CORE(u16, PIXEL_OP_REBASE_TRANSMASK_PRIORITY, u8); + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, priority, [pmask, trans_mask, color](u16 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REBASE_TRANSMASK_PRIORITY(destp, pri, srcp); }); } void gfx_element::prio_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, @@ -1104,7 +1071,7 @@ void gfx_element::prio_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); - DRAWGFX_CORE(u32, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, u8); + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, priority, [pmask, trans_mask, paldata](u32 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REMAP_TRANSMASK_PRIORITY(destp, pri, srcp); }); } @@ -1128,7 +1095,7 @@ void gfx_element::prio_transtable(bitmap_ind16 &dest, const rectangle &cliprect, color = colorbase() + granularity() * (color % colors()); const pen_t *shadowtable = m_palette->shadow_table(); code %= elements(); - DRAWGFX_CORE(u16, PIXEL_OP_REBASE_TRANSTABLE16_PRIORITY, u8); + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, priority, [pmask, pentable, color, shadowtable](u16 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REBASE_TRANSTABLE16_PRIORITY(destp, pri, srcp); }); } void gfx_element::prio_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, @@ -1144,7 +1111,7 @@ void gfx_element::prio_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); const pen_t *shadowtable = m_palette->shadow_table(); code %= elements(); - DRAWGFX_CORE(u32, PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY, u8); + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, priority, [pmask, pentable, paldata, shadowtable](u32 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY(destp, pri, srcp); }); } @@ -1173,7 +1140,7 @@ void gfx_element::prio_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); - DRAWGFX_CORE(u32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY, u8); + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, priority, [pmask, trans_pen, alpha_val, paldata](u32 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY(destp, pri, srcp); }); } @@ -1202,7 +1169,7 @@ void gfx_element::prio_zoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect // render color = colorbase() + granularity() * (color % colors()); code %= elements(); - DRAWGFXZOOM_CORE(u16, PIXEL_OP_REBASE_OPAQUE_PRIORITY, u8); + drawgfxzoom_core(dest, cliprect, code, flipx, flipy, destx, desty, scalex, scaley, priority, [pmask, color](u16 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REBASE_OPAQUE_PRIORITY(destp, pri, srcp); }); } void gfx_element::prio_zoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, @@ -1219,7 +1186,7 @@ void gfx_element::prio_zoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); code %= elements(); - DRAWGFXZOOM_CORE(u32, PIXEL_OP_REMAP_OPAQUE_PRIORITY, u8); + drawgfxzoom_core(dest, cliprect, code, flipx, flipy, destx, desty, scalex, scaley, priority, [pmask, paldata](u32 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REMAP_OPAQUE_PRIORITY(destp, pri, srcp); }); } @@ -1261,7 +1228,7 @@ void gfx_element::prio_zoom_transpen(bitmap_ind16 &dest, const rectangle &clipre // render color = colorbase() + granularity() * (color % colors()); - DRAWGFXZOOM_CORE(u16, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, u8); + drawgfxzoom_core(dest, cliprect, code, flipx, flipy, destx, desty, scalex, scaley, priority, [pmask, trans_pen, color](u16 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REBASE_TRANSPEN_PRIORITY(destp, pri, srcp); }); } void gfx_element::prio_zoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, @@ -1296,7 +1263,7 @@ void gfx_element::prio_zoom_transpen(bitmap_rgb32 &dest, const rectangle &clipre // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); - DRAWGFXZOOM_CORE(u32, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, u8); + drawgfxzoom_core(dest, cliprect, code, flipx, flipy, destx, desty, scalex, scaley, priority, [pmask, trans_pen, paldata](u32 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REMAP_TRANSPEN_PRIORITY(destp, pri, srcp); }); } @@ -1325,7 +1292,7 @@ void gfx_element::prio_zoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cl pmask |= 1 << 31; // render - DRAWGFXZOOM_CORE(u16, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, u8); + drawgfxzoom_core(dest, cliprect, code, flipx, flipy, destx, desty, scalex, scaley, priority, [pmask, trans_pen, color](u16 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REBASE_TRANSPEN_PRIORITY(destp, pri, srcp); }); } void gfx_element::prio_zoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, @@ -1346,7 +1313,7 @@ void gfx_element::prio_zoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cl pmask |= 1 << 31; // render - DRAWGFXZOOM_CORE(u32, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, u8); + drawgfxzoom_core(dest, cliprect, code, flipx, flipy, destx, desty, scalex, scaley, priority, [pmask, trans_pen, color](u32 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REBASE_TRANSPEN_PRIORITY(destp, pri, srcp); }); } @@ -1389,7 +1356,7 @@ void gfx_element::prio_zoom_transmask(bitmap_ind16 &dest, const rectangle &clipr // render color = colorbase() + granularity() * (color % colors()); - DRAWGFXZOOM_CORE(u16, PIXEL_OP_REBASE_TRANSMASK_PRIORITY, u8); + drawgfxzoom_core(dest, cliprect, code, flipx, flipy, destx, desty, scalex, scaley, priority, [pmask, trans_mask, color](u16 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REBASE_TRANSMASK_PRIORITY(destp, pri, srcp); }); } void gfx_element::prio_zoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, @@ -1424,7 +1391,7 @@ void gfx_element::prio_zoom_transmask(bitmap_rgb32 &dest, const rectangle &clipr // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); - DRAWGFXZOOM_CORE(u32, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, u8); + drawgfxzoom_core(dest, cliprect, code, flipx, flipy, destx, desty, scalex, scaley, priority, [pmask, trans_mask, paldata](u32 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REMAP_TRANSMASK_PRIORITY(destp, pri, srcp); }); } @@ -1453,7 +1420,7 @@ void gfx_element::prio_zoom_transtable(bitmap_ind16 &dest, const rectangle &clip color = colorbase() + granularity() * (color % colors()); const pen_t *shadowtable = m_palette->shadow_table(); code %= elements(); - DRAWGFXZOOM_CORE(u16, PIXEL_OP_REBASE_TRANSTABLE16_PRIORITY, u8); + drawgfxzoom_core(dest, cliprect, code, flipx, flipy, destx, desty, scalex, scaley, priority, [pmask, pentable, color, shadowtable](u16 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REBASE_TRANSTABLE16_PRIORITY(destp, pri, srcp); }); } void gfx_element::prio_zoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, @@ -1474,7 +1441,7 @@ void gfx_element::prio_zoom_transtable(bitmap_rgb32 &dest, const rectangle &clip const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); const pen_t *shadowtable = m_palette->shadow_table(); code %= elements(); - DRAWGFXZOOM_CORE(u32, PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY, u8); + drawgfxzoom_core(dest, cliprect, code, flipx, flipy, destx, desty, scalex, scaley, priority, [pmask, pentable, paldata, shadowtable](u32 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY(destp, pri, srcp); }); } @@ -1509,7 +1476,7 @@ void gfx_element::prio_zoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); - DRAWGFXZOOM_CORE(u32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY, u8); + drawgfxzoom_core(dest, cliprect, code, flipx, flipy, destx, desty, scalex, scaley, priority, [pmask, trans_pen, alpha_val, paldata](u32 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY(destp, pri, srcp); }); } @@ -1554,7 +1521,7 @@ void gfx_element::prio_transpen_additive(bitmap_rgb32 &dest, const rectangle &cl pmask |= 1 << 31; /* render based on dest bitmap depth */ - DRAWGFX_CORE(u32, PIXEL_OP_REMAP_TRANSPEN_PRIORITY_ADDIIVE32, u8); + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, priority, [pmask, trans_pen, paldata](u32 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REMAP_TRANSPEN_PRIORITY_ADDIIVE32(destp, pri, srcp); }); } @@ -1594,14 +1561,14 @@ void gfx_element::prio_zoom_transpen_additive(bitmap_rgb32 &dest, const rectangl /* high bit of the mask is implicitly on */ pmask |= 1 << 31; - DRAWGFXZOOM_CORE(u32, PIXEL_OP_REMAP_TRANSPEN_PRIORITY_ADDIIVE32, u8); + drawgfxzoom_core(dest, cliprect, code, flipx, flipy, destx, desty, scalex, scaley, priority, [pmask, trans_pen, paldata](u32 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REMAP_TRANSPEN_PRIORITY_ADDIIVE32(destp, pri, srcp); }); } //#define MAKE_ARGB_RGB(a, rgb) rgb_t(a, rgb.r(), rgb.g(), rgb.b()) #define MAKE_ARGB_RGB(a, rgb) rgb_t(rgb).set_a(a) // combine in 'alpha' when copying to store in ARGB -#define PIXEL_OP_REMAP_TRANS0_ALPHASTORE32(DEST, PRIORITY, SOURCE) \ +#define PIXEL_OP_REMAP_TRANS0_ALPHASTORE32(DEST, SOURCE) \ do \ { \ u32 srcdata = (SOURCE); \ @@ -1610,7 +1577,7 @@ do } \ while (0) // combine in 'alphatable' value to store in ARGB -#define PIXEL_OP_REMAP_TRANS0_ALPHATABLESTORE32(DEST, PRIORITY, SOURCE) \ +#define PIXEL_OP_REMAP_TRANS0_ALPHATABLESTORE32(DEST, SOURCE) \ do \ { \ u32 srcdata = (SOURCE); \ @@ -1619,7 +1586,7 @@ do } \ while (0) // drawgfxm.h macro to render alpha into 32-bit buffer -#define PIXEL_OP_REMAP_TRANS0_ALPHATABLE32(DEST, PRIORITY, SOURCE) \ +#define PIXEL_OP_REMAP_TRANS0_ALPHATABLE32(DEST, SOURCE) \ do \ { \ u32 srcdata = (SOURCE); \ @@ -1637,7 +1604,6 @@ void gfx_element::alphastore(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, int fixedalpha, u8 *alphatable) { - DECLARE_NO_PRIORITY; const pen_t *paldata; assert(alphatable != nullptr); @@ -1659,14 +1625,9 @@ void gfx_element::alphastore(bitmap_rgb32 &dest, const rectangle &cliprect, return; if (fixedalpha >= 0) - { - u8 alpha = fixedalpha; - DRAWGFX_CORE(u32, PIXEL_OP_REMAP_TRANS0_ALPHASTORE32, NO_PRIORITY); - } + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, [paldata, alpha = fixedalpha, alphatable](u32 &destp, const u8 &srcp) { PIXEL_OP_REMAP_TRANS0_ALPHASTORE32(destp, srcp); }); else - { - DRAWGFX_CORE(u32, PIXEL_OP_REMAP_TRANS0_ALPHATABLESTORE32, NO_PRIORITY); - } + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, [paldata, alphatable](u32 &destp, const u8 &srcp) { PIXEL_OP_REMAP_TRANS0_ALPHATABLESTORE32(destp, srcp); }); } /*------------------------------------------------- @@ -1678,8 +1639,6 @@ void gfx_element::alphatable(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, int fixedalpha, u8 *alphatable) { - DECLARE_NO_PRIORITY; - const pen_t *paldata; /* if we have a fixed alpha, call the standard drawgfx_alpha */ @@ -1701,7 +1660,7 @@ void gfx_element::alphatable(bitmap_rgb32 &dest, const rectangle &cliprect, if (has_pen_usage() && (pen_usage(code) & ~(1 << 0)) == 0) return; - DRAWGFX_CORE(u32, PIXEL_OP_REMAP_TRANS0_ALPHATABLE32, NO_PRIORITY); + drawgfx_core(dest, cliprect, code, flipx, flipy, destx, desty, [paldata, fixedalpha, alphatable](u32 &destp, const u8 &srcp) { PIXEL_OP_REMAP_TRANS0_ALPHATABLE32(destp, srcp); }); } @@ -1716,28 +1675,24 @@ void gfx_element::alphatable(bitmap_rgb32 &dest, const rectangle &cliprect, void draw_scanline8(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u8 *srcptr, const pen_t *paldata) { - DECLARE_NO_PRIORITY; - // palette lookup case if (paldata != nullptr) - DRAWSCANLINE_CORE(u16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); + drawscanline_core(bitmap, destx, desty, length, srcptr, [paldata](u16 &destp, const u8 &srcp) { PIXEL_OP_REMAP_OPAQUE(destp, srcp); }); // raw copy case else - DRAWSCANLINE_CORE(u16, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); + drawscanline_core(bitmap, destx, desty, length, srcptr, [](u16 &destp, const u8 &srcp) { PIXEL_OP_COPY_OPAQUE(destp, srcp); }); } void draw_scanline8(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u8 *srcptr, const pen_t *paldata) { - DECLARE_NO_PRIORITY; - // palette lookup case if (paldata != nullptr) - DRAWSCANLINE_CORE(u32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); + drawscanline_core(bitmap, destx, desty, length, srcptr, [paldata](u32 &destp, const u8 &srcp) { PIXEL_OP_REMAP_OPAQUE(destp, srcp); }); // raw copy case else - DRAWSCANLINE_CORE(u32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); + drawscanline_core(bitmap, destx, desty, length, srcptr, [](u32 &destp, const u8 &srcp) { PIXEL_OP_COPY_OPAQUE(destp, srcp); }); } void prio_draw_scanline8(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u8 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u32 pmask) @@ -1747,11 +1702,11 @@ void prio_draw_scanline8(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, // palette lookup case if (paldata != nullptr) - DRAWSCANLINE_CORE(u16, PIXEL_OP_REMAP_OPAQUE_PRIORITY, u8); + drawscanline_core(bitmap, destx, desty, length, srcptr, priority, [paldata, pmask](u16 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REMAP_OPAQUE_PRIORITY(destp, pri, srcp); }); // raw copy case else - DRAWSCANLINE_CORE(u16, PIXEL_OP_COPY_OPAQUE_PRIORITY, u8); + drawscanline_core(bitmap, destx, desty, length, srcptr, priority, [pmask](u16 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_COPY_OPAQUE_PRIORITY(destp, pri, srcp); }); } void prio_draw_scanline8(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u8 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u32 pmask) @@ -1761,11 +1716,11 @@ void prio_draw_scanline8(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, // palette lookup case if (paldata != nullptr) - DRAWSCANLINE_CORE(u32, PIXEL_OP_REMAP_OPAQUE_PRIORITY, u8); + drawscanline_core(bitmap, destx, desty, length, srcptr, priority, [paldata, pmask](u32 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REMAP_OPAQUE_PRIORITY(destp, pri, srcp); }); // raw copy case else - DRAWSCANLINE_CORE(u32, PIXEL_OP_COPY_OPAQUE_PRIORITY, u8); + drawscanline_core(bitmap, destx, desty, length, srcptr, priority, [pmask](u32 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_COPY_OPAQUE_PRIORITY(destp, pri, srcp); }); } void primask_draw_scanline8(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u8 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u8 pcode, u8 pmask) @@ -1775,11 +1730,11 @@ void primask_draw_scanline8(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 leng // palette lookup case if (paldata != nullptr) - DRAWSCANLINE_CORE(u16, PIXEL_OP_REMAP_OPAQUE_PRIMASK, u8); + drawscanline_core(bitmap, destx, desty, length, srcptr, priority, [paldata, pcode, pmask](u16 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REMAP_OPAQUE_PRIMASK(destp, pri, srcp); }); // raw copy case else - DRAWSCANLINE_CORE(u16, PIXEL_OP_COPY_OPAQUE_PRIMASK, u8); + drawscanline_core(bitmap, destx, desty, length, srcptr, priority, [pcode, pmask](u16 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_COPY_OPAQUE_PRIMASK(destp, pri, srcp); }); } void primask_draw_scanline8(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u8 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u8 pcode, u8 pmask) @@ -1789,11 +1744,11 @@ void primask_draw_scanline8(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 leng // palette lookup case if (paldata != nullptr) - DRAWSCANLINE_CORE(u32, PIXEL_OP_REMAP_OPAQUE_PRIMASK, u8); + drawscanline_core(bitmap, destx, desty, length, srcptr, priority, [paldata, pcode, pmask](u32 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_REMAP_OPAQUE_PRIMASK(destp, pri, srcp); }); // raw copy case else - DRAWSCANLINE_CORE(u32, PIXEL_OP_COPY_OPAQUE_PRIMASK, u8); + drawscanline_core(bitmap, destx, desty, length, srcptr, priority, [pcode, pmask](u32 &destp, u8 &pri, const u8 &srcp) { PIXEL_OP_COPY_OPAQUE_PRIMASK(destp, pri, srcp); }); } @@ -1804,28 +1759,24 @@ void primask_draw_scanline8(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 leng void draw_scanline16(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u16 *srcptr, const pen_t *paldata) { - DECLARE_NO_PRIORITY; - // palette lookup case if (paldata != nullptr) - DRAWSCANLINE_CORE(u16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); + drawscanline_core(bitmap, destx, desty, length, srcptr, [paldata](u16 &destp, const u16 &srcp) { PIXEL_OP_REMAP_OPAQUE(destp, srcp); }); // raw copy case else - DRAWSCANLINE_CORE(u16, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); + drawscanline_core(bitmap, destx, desty, length, srcptr, [](u16 &destp, const u16 &srcp) { PIXEL_OP_COPY_OPAQUE(destp, srcp); }); } void draw_scanline16(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u16 *srcptr, const pen_t *paldata) { - DECLARE_NO_PRIORITY; - // palette lookup case if (paldata != nullptr) - DRAWSCANLINE_CORE(u32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); + drawscanline_core(bitmap, destx, desty, length, srcptr, [paldata](u32 &destp, const u16 &srcp) { PIXEL_OP_REMAP_OPAQUE(destp, srcp); }); // raw copy case else - DRAWSCANLINE_CORE(u32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); + drawscanline_core(bitmap, destx, desty, length, srcptr, [](u32 &destp, const u16 &srcp) { PIXEL_OP_COPY_OPAQUE(destp, srcp); }); } void prio_draw_scanline16(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u16 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u32 pmask) @@ -1835,11 +1786,11 @@ void prio_draw_scanline16(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length // palette lookup case if (paldata != nullptr) - DRAWSCANLINE_CORE(u16, PIXEL_OP_REMAP_OPAQUE_PRIORITY, u8); + drawscanline_core(bitmap, destx, desty, length, srcptr, priority, [paldata, pmask](u16 &destp, u8 &pri, const u16 &srcp) { PIXEL_OP_REMAP_OPAQUE_PRIORITY(destp, pri, srcp); }); // raw copy case else - DRAWSCANLINE_CORE(u16, PIXEL_OP_COPY_OPAQUE_PRIORITY, u8); + drawscanline_core(bitmap, destx, desty, length, srcptr, priority, [pmask](u16 &destp, u8 &pri, const u16 &srcp) { PIXEL_OP_COPY_OPAQUE_PRIORITY(destp, pri, srcp); }); } void prio_draw_scanline16(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u16 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u32 pmask) @@ -1849,11 +1800,11 @@ void prio_draw_scanline16(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length // palette lookup case if (paldata != nullptr) - DRAWSCANLINE_CORE(u32, PIXEL_OP_REMAP_OPAQUE_PRIORITY, u8); + drawscanline_core(bitmap, destx, desty, length, srcptr, priority, [paldata, pmask](u32 &destp, u8 &pri, const u16 &srcp) { PIXEL_OP_REMAP_OPAQUE_PRIORITY(destp, pri, srcp); }); // raw copy case else - DRAWSCANLINE_CORE(u32, PIXEL_OP_COPY_OPAQUE_PRIORITY, u8); + drawscanline_core(bitmap, destx, desty, length, srcptr, priority, [pmask](u32 &destp, u8 &pri, const u16 &srcp) { PIXEL_OP_COPY_OPAQUE_PRIORITY(destp, pri, srcp); }); } void primask_draw_scanline16(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u16 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u8 pcode, u8 pmask) @@ -1863,11 +1814,11 @@ void primask_draw_scanline16(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 len // palette lookup case if (paldata != nullptr) - DRAWSCANLINE_CORE(u16, PIXEL_OP_REMAP_OPAQUE_PRIMASK, u8); + drawscanline_core(bitmap, destx, desty, length, srcptr, priority, [paldata, pcode, pmask](u16 &destp, u8 &pri, const u16 &srcp) { PIXEL_OP_REMAP_OPAQUE_PRIMASK(destp, pri, srcp); }); // raw copy case else - DRAWSCANLINE_CORE(u16, PIXEL_OP_COPY_OPAQUE_PRIMASK, u8); + drawscanline_core(bitmap, destx, desty, length, srcptr, priority, [pcode, pmask](u16 &destp, u8 &pri, const u16 &srcp) { PIXEL_OP_COPY_OPAQUE_PRIMASK(destp, pri, srcp); }); } void primask_draw_scanline16(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u16 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u8 pcode, u8 pmask) @@ -1877,11 +1828,11 @@ void primask_draw_scanline16(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 len // palette lookup case if (paldata != nullptr) - DRAWSCANLINE_CORE(u32, PIXEL_OP_REMAP_OPAQUE_PRIMASK, u8); + drawscanline_core(bitmap, destx, desty, length, srcptr, priority, [paldata, pcode, pmask](u32 &destp, u8 &pri, const u16 &srcp) { PIXEL_OP_REMAP_OPAQUE_PRIMASK(destp, pri, srcp); }); // raw copy case else - DRAWSCANLINE_CORE(u32, PIXEL_OP_COPY_OPAQUE_PRIMASK, u8); + drawscanline_core(bitmap, destx, desty, length, srcptr, priority, [pcode, pmask](u32 &destp, u8 &pri, const u16 &srcp) { PIXEL_OP_COPY_OPAQUE_PRIMASK(destp, pri, srcp); }); } @@ -1892,28 +1843,24 @@ void primask_draw_scanline16(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 len void draw_scanline32(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u32 *srcptr, const pen_t *paldata) { - DECLARE_NO_PRIORITY; - // palette lookup case if (paldata != nullptr) - DRAWSCANLINE_CORE(u16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); + drawscanline_core(bitmap, destx, desty, length, srcptr, [paldata](u16 &destp, const u32 &srcp) { PIXEL_OP_REMAP_OPAQUE(destp, srcp); }); // raw copy case else - DRAWSCANLINE_CORE(u16, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); + drawscanline_core(bitmap, destx, desty, length, srcptr, [](u16 &destp, const u32 &srcp) { PIXEL_OP_COPY_OPAQUE(destp, srcp); }); } void draw_scanline32(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u32 *srcptr, const pen_t *paldata) { - DECLARE_NO_PRIORITY; - // palette lookup case if (paldata != nullptr) - DRAWSCANLINE_CORE(u32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); + drawscanline_core(bitmap, destx, desty, length, srcptr, [paldata](u32 &destp, const u32 &srcp) { PIXEL_OP_REMAP_OPAQUE(destp, srcp); }); // raw copy case else - DRAWSCANLINE_CORE(u32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); + drawscanline_core(bitmap, destx, desty, length, srcptr, [](u32 &destp, const u32 &srcp) { PIXEL_OP_COPY_OPAQUE(destp, srcp); }); } void prio_draw_scanline32(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u32 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u32 pmask) @@ -1923,11 +1870,11 @@ void prio_draw_scanline32(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length // palette lookup case if (paldata != nullptr) - DRAWSCANLINE_CORE(u16, PIXEL_OP_REMAP_OPAQUE_PRIORITY, u8); + drawscanline_core(bitmap, destx, desty, length, srcptr, priority, [paldata, pmask](u16 &destp, u8 &pri, const u32 &srcp) { PIXEL_OP_REMAP_OPAQUE_PRIORITY(destp, pri, srcp); }); // raw copy case else - DRAWSCANLINE_CORE(u16, PIXEL_OP_COPY_OPAQUE_PRIORITY, u8); + drawscanline_core(bitmap, destx, desty, length, srcptr, priority, [pmask](u16 &destp, u8 &pri, const u32 &srcp) { PIXEL_OP_COPY_OPAQUE_PRIORITY(destp, pri, srcp); }); } void prio_draw_scanline32(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u32 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u32 pmask) @@ -1937,11 +1884,11 @@ void prio_draw_scanline32(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length // palette lookup case if (paldata != nullptr) - DRAWSCANLINE_CORE(u32, PIXEL_OP_REMAP_OPAQUE_PRIORITY, u8); + drawscanline_core(bitmap, destx, desty, length, srcptr, priority, [paldata, pmask](u32 &destp, u8 &pri, const u32 &srcp) { PIXEL_OP_REMAP_OPAQUE_PRIORITY(destp, pri, srcp); }); // raw copy case else - DRAWSCANLINE_CORE(u32, PIXEL_OP_COPY_OPAQUE_PRIORITY, u8); + drawscanline_core(bitmap, destx, desty, length, srcptr, priority, [pmask](u32 &destp, u8 &pri, const u32 &srcp) { PIXEL_OP_COPY_OPAQUE_PRIORITY(destp, pri, srcp); }); } void primask_draw_scanline32(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u32 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u8 pcode, u8 pmask) @@ -1951,11 +1898,11 @@ void primask_draw_scanline32(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 len // palette lookup case if (paldata != nullptr) - DRAWSCANLINE_CORE(u16, PIXEL_OP_REMAP_OPAQUE_PRIMASK, u8); + drawscanline_core(bitmap, destx, desty, length, srcptr, priority, [paldata, pcode, pmask](u16 &destp, u8 &pri, const u32 &srcp) { PIXEL_OP_REMAP_OPAQUE_PRIMASK(destp, pri, srcp); }); // raw copy case else - DRAWSCANLINE_CORE(u16, PIXEL_OP_COPY_OPAQUE_PRIMASK, u8); + drawscanline_core(bitmap, destx, desty, length, srcptr, priority, [pcode, pmask](u16 &destp, u8 &pri, const u32 &srcp) { PIXEL_OP_COPY_OPAQUE_PRIMASK(destp, pri, srcp); }); } void primask_draw_scanline32(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u32 *srcptr, const pen_t *paldata, bitmap_ind8 &priority, u8 pcode, u8 pmask) @@ -1965,64 +1912,11 @@ void primask_draw_scanline32(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 len // palette lookup case if (paldata != nullptr) - DRAWSCANLINE_CORE(u32, PIXEL_OP_REMAP_OPAQUE_PRIMASK, u8); + drawscanline_core(bitmap, destx, desty, length, srcptr, priority, [paldata, pcode, pmask](u32 &destp, u8 &pri, const u32 &srcp) { PIXEL_OP_REMAP_OPAQUE_PRIMASK(destp, pri, srcp); }); // raw copy case else - DRAWSCANLINE_CORE(u32, PIXEL_OP_COPY_OPAQUE_PRIMASK, u8); -} - - - -/*************************************************************************** - EXTRACT_SCANLINE IMPLEMENTATIONS -***************************************************************************/ - -/*------------------------------------------------- - extract_scanline8 - copy pixels from a single - scanline of a bitmap to an 8bpp buffer --------------------------------------------------*/ - -void extract_scanline8(const bitmap_ind16 &bitmap, s32 srcx, s32 srcy, s32 length, u8 *destptr) -{ - EXTRACTSCANLINE_CORE(u16); -} - -void extract_scanline8(const bitmap_rgb32 &bitmap, s32 srcx, s32 srcy, s32 length, u8 *destptr) -{ - EXTRACTSCANLINE_CORE(u32); -} - - -/*------------------------------------------------- - extract_scanline16 - copy pixels from a single - scanline of a bitmap to a 16bpp buffer --------------------------------------------------*/ - -void extract_scanline16(const bitmap_ind16 &bitmap, s32 srcx, s32 srcy, s32 length, u16 *destptr) -{ - EXTRACTSCANLINE_CORE(u16); -} - -void extract_scanline16(const bitmap_rgb32 &bitmap, s32 srcx, s32 srcy, s32 length, u16 *destptr) -{ - EXTRACTSCANLINE_CORE(u32); -} - - -/*------------------------------------------------- - extract_scanline32 - copy pixels from a single - scanline of a bitmap to a 32bpp buffer --------------------------------------------------*/ - -void extract_scanline32(const bitmap_ind16 &bitmap, s32 srcx, s32 srcy, s32 length, u32 *destptr) -{ - EXTRACTSCANLINE_CORE(u16); -} - -void extract_scanline32(const bitmap_rgb32 &bitmap, s32 srcx, s32 srcy, s32 length, u32 *destptr) -{ - EXTRACTSCANLINE_CORE(u32); + drawscanline_core(bitmap, destx, desty, length, srcptr, priority, [pcode, pmask](u32 &destp, u8 &pri, const u32 &srcp) { PIXEL_OP_COPY_OPAQUE_PRIMASK(destp, pri, srcp); }); } @@ -2038,14 +1932,12 @@ void extract_scanline32(const bitmap_rgb32 &bitmap, s32 srcx, s32 srcy, s32 leng void copybitmap(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect) { - DECLARE_NO_PRIORITY; - COPYBITMAP_CORE(u16, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); + copybitmap_core(dest, src, flipx, flipy, destx, desty, cliprect, [](u16 &destp, const u16 &srcp) { PIXEL_OP_COPY_OPAQUE(destp, srcp); }); } void copybitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect) { - DECLARE_NO_PRIORITY; - COPYBITMAP_CORE(u32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); + copybitmap_core(dest, src, flipx, flipy, destx, desty, cliprect, [](u32 &destp, const u32 &srcp) { PIXEL_OP_COPY_OPAQUE(destp, srcp); }); } void prio_copybitmap(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask) @@ -2053,7 +1945,7 @@ void prio_copybitmap(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, int // high bit of the mask is implicitly on pmask |= 1 << 31; - COPYBITMAP_CORE(u16, PIXEL_OP_COPY_OPAQUE_PRIORITY, u8); + copybitmap_core(dest, src, flipx, flipy, destx, desty, cliprect, priority, [pmask](u16 &destp, u8 &pri, const u16 &srcp) { PIXEL_OP_COPY_OPAQUE_PRIORITY(destp, pri, srcp); }); } void prio_copybitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask) @@ -2061,7 +1953,7 @@ void prio_copybitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int // high bit of the mask is implicitly on pmask |= 1 << 31; - COPYBITMAP_CORE(u32, PIXEL_OP_COPY_OPAQUE_PRIORITY, u8); + copybitmap_core(dest, src, flipx, flipy, destx, desty, cliprect, priority, [pmask](u32 &destp, u8 &pri, const u32 &srcp) { PIXEL_OP_COPY_OPAQUE_PRIORITY(destp, pri, srcp); }); } void primask_copybitmap(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, bitmap_ind8 &priority, u8 pcode, u8 pmask) @@ -2069,7 +1961,7 @@ void primask_copybitmap(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, if (pcode == 0 && pmask == 0xff) copybitmap(dest, src, flipx, flipy, destx, desty, cliprect); else - COPYBITMAP_CORE(u16, PIXEL_OP_COPY_OPAQUE_PRIMASK, u8); + copybitmap_core(dest, src, flipx, flipy, destx, desty, cliprect, priority, [pcode, pmask](u16 &destp, u8 &pri, const u16 &srcp) { PIXEL_OP_COPY_OPAQUE_PRIMASK(destp, pri, srcp); }); } void primask_copybitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, bitmap_ind8 &priority, u8 pcode, u8 pmask) @@ -2077,7 +1969,7 @@ void primask_copybitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, if (pcode == 0 && pmask == 0xff) copybitmap(dest, src, flipx, flipy, destx, desty, cliprect); else - COPYBITMAP_CORE(u32, PIXEL_OP_COPY_OPAQUE_PRIMASK, u8); + copybitmap_core(dest, src, flipx, flipy, destx, desty, cliprect, priority, [pcode, pmask](u32 &destp, u8 &pri, const u32 &srcp) { PIXEL_OP_COPY_OPAQUE_PRIMASK(destp, pri, srcp); }); } @@ -2089,20 +1981,18 @@ void primask_copybitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, void copybitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, u32 trans_pen) { - DECLARE_NO_PRIORITY; if (trans_pen > 0xffff) copybitmap(dest, src, flipx, flipy, destx, desty, cliprect); else - COPYBITMAP_CORE(u16, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY); + copybitmap_core(dest, src, flipx, flipy, destx, desty, cliprect, [trans_pen](u16 &destp, const u16 &srcp) { PIXEL_OP_COPY_TRANSPEN(destp, srcp); }); } void copybitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, u32 trans_pen) { - DECLARE_NO_PRIORITY; if (trans_pen == 0xffffffff) copybitmap(dest, src, flipx, flipy, destx, desty, cliprect); else - COPYBITMAP_CORE(u32, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY); + copybitmap_core(dest, src, flipx, flipy, destx, desty, cliprect, [trans_pen](u32 &destp, const u32 &srcp) { PIXEL_OP_COPY_TRANSPEN(destp, srcp); }); } void prio_copybitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask, u32 trans_pen) @@ -2113,7 +2003,7 @@ void prio_copybitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, int flip if (trans_pen > 0xffff) prio_copybitmap(dest, src, flipx, flipy, destx, desty, cliprect, priority, pmask); else - COPYBITMAP_CORE(u16, PIXEL_OP_COPY_TRANSPEN_PRIORITY, u8); + copybitmap_core(dest, src, flipx, flipy, destx, desty, cliprect, priority, [pmask, trans_pen](u16 &destp, u8 &pri, const u16 &srcp) { PIXEL_OP_COPY_TRANSPEN_PRIORITY(destp, pri, srcp); }); } void prio_copybitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask, u32 trans_pen) @@ -2124,7 +2014,7 @@ void prio_copybitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flip if (trans_pen == 0xffffffff) prio_copybitmap(dest, src, flipx, flipy, destx, desty, cliprect, priority, pmask); else - COPYBITMAP_CORE(u32, PIXEL_OP_COPY_TRANSPEN_PRIORITY, u8); + copybitmap_core(dest, src, flipx, flipy, destx, desty, cliprect, priority, [pmask, trans_pen](u32 &destp, u8 &pri, const u32 &srcp) { PIXEL_OP_COPY_TRANSPEN_PRIORITY(destp, pri, srcp); }); } void primask_copybitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, u32 trans_pen, bitmap_ind8 &priority, u8 pcode, u8 pmask) @@ -2134,7 +2024,7 @@ void primask_copybitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, int f else if (trans_pen > 0xffff) primask_copybitmap(dest, src, flipx, flipy, destx, desty, cliprect, priority, pcode, pmask); else - COPYBITMAP_CORE(u16, PIXEL_OP_COPY_TRANSPEN_PRIMASK, u8); + copybitmap_core(dest, src, flipx, flipy, destx, desty, cliprect, priority, [trans_pen, pcode, pmask](u16 &destp, u8 &pri, const u16 &srcp) { PIXEL_OP_COPY_TRANSPEN_PRIMASK(destp, pri, srcp); }); } void primask_copybitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, u32 trans_pen, bitmap_ind8 &priority, u8 pcode, u8 pmask) @@ -2144,7 +2034,7 @@ void primask_copybitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int f else if (trans_pen == 0xffffffff) primask_copybitmap(dest, src, flipx, flipy, destx, desty, cliprect, priority, pcode, pmask); else - COPYBITMAP_CORE(u32, PIXEL_OP_COPY_TRANSPEN_PRIMASK, u8); + copybitmap_core(dest, src, flipx, flipy, destx, desty, cliprect, priority, [trans_pen, pcode, pmask](u32 &destp, u8 &pri, const u32 &srcp) { PIXEL_OP_COPY_TRANSPEN_PRIMASK(destp, pri, srcp); }); } @@ -2156,8 +2046,7 @@ void primask_copybitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int f void copybitmap_transalpha(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect) { - DECLARE_NO_PRIORITY; - COPYBITMAP_CORE(u32, PIXEL_OP_COPY_TRANSALPHA, NO_PRIORITY); + copybitmap_core(dest, src, flipx, flipy, destx, desty, cliprect, [](u32 &destp, const u32 &srcp) { PIXEL_OP_COPY_TRANSALPHA(destp, srcp); }); } void prio_copybitmap_transalpha(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, bitmap_ind8 &priority, u32 pmask) @@ -2165,7 +2054,7 @@ void prio_copybitmap_transalpha(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int // high bit of the mask is implicitly on pmask |= 1 << 31; - COPYBITMAP_CORE(u32, PIXEL_OP_COPY_TRANSALPHA_PRIORITY, u8); + copybitmap_core(dest, src, flipx, flipy, destx, desty, cliprect, priority, [pmask](u32 &destp, u8 &pri, const u32 &srcp) { PIXEL_OP_COPY_TRANSALPHA_PRIORITY(destp, pri, srcp); }); } void primask_copybitmap_transalpha(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, bitmap_ind8 &priority, u8 pcode, u8 pmask) @@ -2173,7 +2062,7 @@ void primask_copybitmap_transalpha(bitmap_rgb32 &dest, const bitmap_rgb32 &src, if (pcode == 0 && pmask == 0xff) copybitmap_transalpha(dest, src, flipx, flipy, destx, desty, cliprect); else - COPYBITMAP_CORE(u32, PIXEL_OP_COPY_TRANSALPHA_PRIMASK, u8); + copybitmap_core(dest, src, flipx, flipy, destx, desty, cliprect, priority, [pcode, pmask](u32 &destp, u8 &pri, const u32 &srcp) { PIXEL_OP_COPY_TRANSALPHA_PRIMASK(destp, pri, srcp); }); } @@ -2568,14 +2457,12 @@ void primask_copyscrollbitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, void copyrozbitmap(bitmap_ind16 &dest, const rectangle &cliprect, const bitmap_ind16 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound) { - DECLARE_NO_PRIORITY; - COPYROZBITMAP_CORE(u16, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); + copyrozbitmap_core(dest, cliprect, src, startx, starty, incxx, incxy, incyx, incyy, wraparound, [](u16 &destp, const u16 &srcp) { PIXEL_OP_COPY_OPAQUE(destp, srcp); }); } void copyrozbitmap(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_rgb32 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound) { - DECLARE_NO_PRIORITY; - COPYROZBITMAP_CORE(u32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); + copyrozbitmap_core(dest, cliprect, src, startx, starty, incxx, incxy, incyx, incyy, wraparound, [](u32 &destp, const u32 &srcp) { PIXEL_OP_COPY_OPAQUE(destp, srcp); }); } void prio_copyrozbitmap(bitmap_ind16 &dest, const rectangle &cliprect, const bitmap_ind16 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, bitmap_ind8 &priority, u32 pmask) @@ -2583,7 +2470,7 @@ void prio_copyrozbitmap(bitmap_ind16 &dest, const rectangle &cliprect, const bit // high bit of the mask is implicitly on pmask |= 1 << 31; - COPYROZBITMAP_CORE(u16, PIXEL_OP_COPY_OPAQUE_PRIORITY, u8); + copyrozbitmap_core(dest, cliprect, src, startx, starty, incxx, incxy, incyx, incyy, wraparound, priority, [pmask](u16 &destp, u8 &pri, const u16 &srcp) { PIXEL_OP_COPY_OPAQUE_PRIORITY(destp, pri, srcp); }); } void prio_copyrozbitmap(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_rgb32 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, bitmap_ind8 &priority, u32 pmask) @@ -2591,7 +2478,7 @@ void prio_copyrozbitmap(bitmap_rgb32 &dest, const rectangle &cliprect, const bit // high bit of the mask is implicitly on pmask |= 1 << 31; - COPYROZBITMAP_CORE(u32, PIXEL_OP_COPY_OPAQUE_PRIORITY, u8); + copyrozbitmap_core(dest, cliprect, src, startx, starty, incxx, incxy, incyx, incyy, wraparound, priority, [pmask](u32 &destp, u8 &pri, const u32 &srcp) { PIXEL_OP_COPY_OPAQUE_PRIORITY(destp, pri, srcp); }); } void primask_copyrozbitmap(bitmap_ind16 &dest, const rectangle &cliprect, const bitmap_ind16 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, bitmap_ind8 &priority, u8 pcode, u8 pmask) @@ -2599,7 +2486,7 @@ void primask_copyrozbitmap(bitmap_ind16 &dest, const rectangle &cliprect, const if (pcode == 0 && pmask == 0xff) copyrozbitmap(dest, cliprect, src, startx, starty, incxx, incxy, incyx, incyy, wraparound); else - COPYROZBITMAP_CORE(u16, PIXEL_OP_COPY_OPAQUE_PRIMASK, u8); + copyrozbitmap_core(dest, cliprect, src, startx, starty, incxx, incxy, incyx, incyy, wraparound, priority, [pcode, pmask](u16 &destp, u8 &pri, const u16 &srcp) { PIXEL_OP_COPY_OPAQUE_PRIMASK(destp, pri, srcp); }); } void primask_copyrozbitmap(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_rgb32 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, bitmap_ind8 &priority, u8 pcode, u8 pmask) @@ -2607,7 +2494,7 @@ void primask_copyrozbitmap(bitmap_rgb32 &dest, const rectangle &cliprect, const if (pcode == 0 && pmask == 0xff) copyrozbitmap(dest, cliprect, src, startx, starty, incxx, incxy, incyx, incyy, wraparound); else - COPYROZBITMAP_CORE(u32, PIXEL_OP_COPY_OPAQUE_PRIMASK, u8); + copyrozbitmap_core(dest, cliprect, src, startx, starty, incxx, incxy, incyx, incyy, wraparound, priority, [pcode, pmask](u32 &destp, u8 &pri, const u32 &srcp) { PIXEL_OP_COPY_OPAQUE_PRIMASK(destp, pri, srcp); }); } @@ -2620,14 +2507,12 @@ void primask_copyrozbitmap(bitmap_rgb32 &dest, const rectangle &cliprect, const void copyrozbitmap_trans(bitmap_ind16 &dest, const rectangle &cliprect, const bitmap_ind16 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, u32 trans_pen) { - DECLARE_NO_PRIORITY; - COPYROZBITMAP_CORE(u16, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY); + copyrozbitmap_core(dest, cliprect, src, startx, starty, incxx, incxy, incyx, incyy, wraparound, [trans_pen](u16 &destp, const u16 &srcp) { PIXEL_OP_COPY_TRANSPEN(destp, srcp); }); } void copyrozbitmap_trans(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_rgb32 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, u32 trans_pen) { - DECLARE_NO_PRIORITY; - COPYROZBITMAP_CORE(u32, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY); + copyrozbitmap_core(dest, cliprect, src, startx, starty, incxx, incxy, incyx, incyy, wraparound, [trans_pen](u32 &destp, const u32 &srcp) { PIXEL_OP_COPY_TRANSPEN(destp, srcp); }); } void prio_copyrozbitmap_trans(bitmap_ind16 &dest, const rectangle &cliprect, const bitmap_ind16 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, bitmap_ind8 &priority, u32 pmask, u32 trans_pen) @@ -2635,7 +2520,7 @@ void prio_copyrozbitmap_trans(bitmap_ind16 &dest, const rectangle &cliprect, con // high bit of the mask is implicitly on pmask |= 1 << 31; - COPYROZBITMAP_CORE(u16, PIXEL_OP_COPY_TRANSPEN_PRIORITY, u8); + copyrozbitmap_core(dest, cliprect, src, startx, starty, incxx, incxy, incyx, incyy, wraparound, priority, [pmask, trans_pen](u16 &destp, u8 &pri, const u16 &srcp) { PIXEL_OP_COPY_TRANSPEN_PRIORITY(destp, pri, srcp); }); } void prio_copyrozbitmap_trans(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_rgb32 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, bitmap_ind8 &priority, u32 pmask, u32 trans_pen) @@ -2643,7 +2528,7 @@ void prio_copyrozbitmap_trans(bitmap_rgb32 &dest, const rectangle &cliprect, con // high bit of the mask is implicitly on pmask |= 1 << 31; - COPYROZBITMAP_CORE(u32, PIXEL_OP_COPY_TRANSPEN_PRIORITY, u8); + copyrozbitmap_core(dest, cliprect, src, startx, starty, incxx, incxy, incyx, incyy, wraparound, priority, [pmask, trans_pen](u32 &destp, u8 &pri, const u32 &srcp) { PIXEL_OP_COPY_TRANSPEN_PRIORITY(destp, pri, srcp); }); } void primask_copyrozbitmap_trans(bitmap_ind16 &dest, const rectangle &cliprect, const bitmap_ind16 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, u32 trans_pen, bitmap_ind8 &priority, u8 pcode, u8 pmask) @@ -2651,7 +2536,7 @@ void primask_copyrozbitmap_trans(bitmap_ind16 &dest, const rectangle &cliprect, if (pcode == 0 && pmask == 0xff) copyrozbitmap_trans(dest, cliprect, src, startx, starty, incxx, incxy, incyx, incyy, wraparound, trans_pen); else - COPYROZBITMAP_CORE(u16, PIXEL_OP_COPY_TRANSPEN_PRIMASK, u8); + copyrozbitmap_core(dest, cliprect, src, startx, starty, incxx, incxy, incyx, incyy, wraparound, priority, [trans_pen, pcode, pmask](u16 &destp, u8 &pri, const u16 &srcp) { PIXEL_OP_COPY_TRANSPEN_PRIMASK(destp, pri, srcp); }); } void primask_copyrozbitmap_trans(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_rgb32 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, u32 trans_pen, bitmap_ind8 &priority, u8 pcode, u8 pmask) @@ -2659,5 +2544,5 @@ void primask_copyrozbitmap_trans(bitmap_rgb32 &dest, const rectangle &cliprect, if (pcode == 0 && pmask == 0xff) copyrozbitmap_trans(dest, cliprect, src, startx, starty, incxx, incxy, incyx, incyy, wraparound, trans_pen); else - COPYROZBITMAP_CORE(u32, PIXEL_OP_COPY_TRANSPEN_PRIMASK, u8); + copyrozbitmap_core(dest, cliprect, src, startx, starty, incxx, incxy, incyx, incyy, wraparound, priority, [trans_pen, pcode, pmask](u32 &destp, u8 &pri, const u32 &srcp) { PIXEL_OP_COPY_TRANSPEN_PRIMASK(destp, pri, srcp); }); } diff --git a/src/emu/drawgfx.h b/src/emu/drawgfx.h index 4d3f4d0e0c9..08732a42bfd 100644 --- a/src/emu/drawgfx.h +++ b/src/emu/drawgfx.h @@ -202,6 +202,9 @@ public: // ----- core graphics drawing ----- + // core drawgfx implementation + template <typename BitmapType, typename FunctionClass> void drawgfx_core(BitmapType &dest, const rectangle &cliprect, u32 code, int flipx, int flipy, s32 destx, s32 desty, FunctionClass pixel_op); + // specific drawgfx implementations for each transparency type void opaque(bitmap_ind16 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty); void opaque(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty); @@ -217,6 +220,9 @@ public: // ----- zoomed graphics drawing ----- + // core zoom implementation + template <typename BitmapType, typename FunctionClass> void drawgfxzoom_core(BitmapType &dest, const rectangle &cliprect, u32 code, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, FunctionClass pixel_op); + // specific zoom implementations for each transparency type void zoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley); void zoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley); @@ -232,6 +238,9 @@ public: // ----- priority masked graphics drawing ----- + // core prio implementation + template <typename BitmapType, typename PriorityType, typename FunctionClass> void drawgfx_core(BitmapType &dest, const rectangle &cliprect, u32 code, int flipx, int flipy, s32 destx, s32 desty, PriorityType &priority, FunctionClass pixel_op); + // specific prio implementations for each transparency type void prio_opaque(bitmap_ind16 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, bitmap_ind8 &priority, u32 pmask); void prio_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, bitmap_ind8 &priority, u32 pmask); @@ -247,6 +256,9 @@ public: // ----- priority masked zoomed graphics drawing ----- + // core prio_zoom implementation + template <typename BitmapType, typename PriorityType, typename FunctionClass> void drawgfxzoom_core(BitmapType &dest, const rectangle &cliprect, u32 code, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, PriorityType &priority, FunctionClass pixel_op); + // specific prio_zoom implementations for each transparency type void prio_zoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask); void prio_zoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask); @@ -265,6 +277,7 @@ public: void prio_zoom_transpen_additive(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask, u32 trans_pen); void alphastore(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, int fixedalpha, u8 *alphatable); void alphatable(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, int fixedalpha, u8 *alphatable); + private: // internal helpers void decode(u32 code); @@ -344,22 +357,6 @@ void primask_draw_scanline32(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 len -// ----- scanline extraction ----- - -// copy pixels from a single scanline of a bitmap to an 8bpp buffer -void extract_scanline8(const bitmap_ind16 &bitmap, s32 srcx, s32 srcy, s32 length, u8 *destptr); -void extract_scanline8(const bitmap_rgb32 &bitmap, s32 srcx, s32 srcy, s32 length, u8 *destptr); - -// copy pixels from a single scanline of a bitmap to a 16bpp buffer -void extract_scanline16(const bitmap_ind16 &bitmap, s32 srcx, s32 srcy, s32 length, u16 *destptr); -void extract_scanline16(const bitmap_rgb32 &bitmap, s32 srcx, s32 srcy, s32 length, u16 *destptr); - -// copy pixels from a single scanline of a bitmap to a 32bpp buffer -void extract_scanline32(const bitmap_ind16 &bitmap, s32 srcx, s32 srcy, s32 length, u32 *destptr); -void extract_scanline32(const bitmap_rgb32 &bitmap, s32 srcx, s32 srcy, s32 length, u32 *destptr); - - - // ----- bitmap copying ----- // copy from one bitmap to another, copying all unclipped pixels diff --git a/src/emu/drawgfxm.h b/src/emu/drawgfxm.h deleted file mode 100644 index 6361ed8bf92..00000000000 --- a/src/emu/drawgfxm.h +++ /dev/null @@ -1,1343 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria, Aaron Giles -/********************************************************************* - - drawgfxm.h - - Macros implementing drawgfx core operations. Drivers can use - these if they need custom behavior not provided by the existing - drawgfx functions. -********************************************************************** - - How to use these macros: - - There are two sets of macros. The PIXEL_OP* macros are simple - per-pixel operations, designed to take a SOURCE pixel and - copy it to the DEST, perhaps updating the PRIORITY pixel as - well. On their own, they are not particularly useful. - - The second set of macros represents the core gfx/bitmap walking - and rendering code. These macros generally take the target pixel - type (u8, u16, u32), one of the PIXEL_OP* macros, - and a priority bitmap pixel type (u8, u16, u32, or the - special type NO_PRIORITY). - - Although the code may look inefficient at first, the compiler is - able to easily optimize out unused cases due to the way the - macros are written, leaving behind just the cases we are - interested in. - - The general approach for using these macros is: - - my_drawing_function(params) - { - // ensure that all the required parameters for the mega - // macro are defined (if they are not needed, just declare - // the variables and set them equal to a known constant - // value to help the compiler) - - // set up any additional variables needed by the PIXEL_OP* - // macro you want to use (each macro has its own - // requirements) - - MEGA_MACRO(BITMAP_TYPE, PIXEL_OP, PRIORITY_TYPE); - } - -*********************************************************************/ - -#pragma once - -#ifndef __DRAWGFXM_H__ -#define __DRAWGFXM_H__ - -/* special priority type meaning "none" */ -struct NO_PRIORITY { char dummy[3]; }; - -extern bitmap_ind8 drawgfx_dummy_priority_bitmap; -#define DECLARE_NO_PRIORITY bitmap_t &priority = drawgfx_dummy_priority_bitmap; - - -/* macros for using the optional priority */ -#define PRIORITY_VALID(x) (sizeof(x) != sizeof(NO_PRIORITY)) -#define PRIORITY_ADDR(p,t,y,x) (PRIORITY_VALID(t) ? (&(p).pixt<t>(y, x)) : nullptr) -#define PRIORITY_ADVANCE(t,p,i) do { if (PRIORITY_VALID(t)) (p) += (i); } while (0) - - -/*************************************************************************** - PIXEL OPERATIONS -***************************************************************************/ - -/*------------------------------------------------- - PIXEL_OP_COPY_OPAQUE - render all pixels - regardless of pen, copying directly --------------------------------------------------*/ - -#define PIXEL_OP_COPY_OPAQUE(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - (DEST) = SOURCE; \ -} \ -while (0) -#define PIXEL_OP_COPY_OPAQUE_PRIORITY(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ - (DEST) = SOURCE; \ - (PRIORITY) = 31; \ -} \ -while (0) -#define PIXEL_OP_COPY_OPAQUE_PRIMASK(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - (DEST) = SOURCE; \ - (PRIORITY) = ((PRIORITY) & pmask) | pcode; \ -} \ -while (0) - -/*------------------------------------------------- - PIXEL_OP_COPY_TRANSPEN - render all pixels - except those matching 'transpen', copying - directly --------------------------------------------------*/ - -#define PIXEL_OP_COPY_TRANSPEN(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - u32 srcdata = (SOURCE); \ - if (srcdata != trans_pen) \ - (DEST) = SOURCE; \ -} \ -while (0) -#define PIXEL_OP_COPY_TRANSPEN_PRIORITY(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - u32 srcdata = (SOURCE); \ - if (srcdata != trans_pen) \ - { \ - if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ - (DEST) = SOURCE; \ - (PRIORITY) = 31; \ - } \ -} \ -while (0) -#define PIXEL_OP_COPY_TRANSPEN_PRIMASK(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - u32 srcdata = (SOURCE); \ - if (srcdata != trans_pen) \ - { \ - (DEST) = SOURCE; \ - (PRIORITY) = ((PRIORITY) & pmask) | pcode; \ - } \ -} \ -while (0) - -/*------------------------------------------------- - PIXEL_OP_COPY_TRANSALPHA - render all pixels - except those with an alpha of zero, copying - directly --------------------------------------------------*/ - -#define PIXEL_OP_COPY_TRANSALPHA(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - u32 srcdata = (SOURCE); \ - if ((srcdata & 0xff000000) != 0) \ - (DEST) = SOURCE; \ -} \ -while (0) -#define PIXEL_OP_COPY_TRANSALPHA_PRIORITY(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - u32 srcdata = (SOURCE); \ - if ((srcdata & 0xff000000) != 0) \ - { \ - if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ - (DEST) = SOURCE; \ - (PRIORITY) = 31; \ - } \ -} \ -while (0) -#define PIXEL_OP_COPY_TRANSALPHA_PRIMASK(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - u32 srcdata = (SOURCE); \ - if ((srcdata & 0xff000000) != 0) \ - { \ - (DEST) = SOURCE; \ - (PRIORITY) = ((PRIORITY) & pmask) | pcode; \ - } \ -} \ -while (0) - -/*------------------------------------------------- - PIXEL_OP_REMAP_OPAQUE - render all pixels - regardless of pen, mapping the pen via the - 'paldata' array --------------------------------------------------*/ - -#define PIXEL_OP_REMAP_OPAQUE(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - (DEST) = paldata[SOURCE]; \ -} \ -while (0) -#define PIXEL_OP_REMAP_OPAQUE_PRIORITY(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ - (DEST) = paldata[SOURCE]; \ - (PRIORITY) = 31; \ -} \ -while (0) -#define PIXEL_OP_REMAP_OPAQUE_PRIMASK(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - (DEST) = paldata[SOURCE]; \ - (PRIORITY) = ((PRIORITY) & pmask) | pcode; \ -} \ -while (0) - -/*------------------------------------------------- - PIXEL_OP_REBASE_OPAQUE - render all pixels - regardless of pen, adding 'color' to the - pen value --------------------------------------------------*/ - -#define PIXEL_OP_REBASE_OPAQUE(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - (DEST) = color + (SOURCE); \ -} \ -while (0) -#define PIXEL_OP_REBASE_OPAQUE_PRIORITY(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ - (DEST) = color + (SOURCE); \ - (PRIORITY) = 31; \ -} \ -while (0) - -/*------------------------------------------------- - PIXEL_OP_REMAP_TRANSPEN - render all pixels - except those matching 'trans_pen', mapping the - pen via the 'paldata' array --------------------------------------------------*/ - -#define PIXEL_OP_REMAP_TRANSPEN(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - u32 srcdata = (SOURCE); \ - if (srcdata != trans_pen) \ - (DEST) = paldata[srcdata]; \ -} \ -while (0) -#define PIXEL_OP_REMAP_TRANSPEN_PRIORITY(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - u32 srcdata = (SOURCE); \ - if (srcdata != trans_pen) \ - { \ - if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ - (DEST) = paldata[srcdata]; \ - (PRIORITY) = 31; \ - } \ -} \ -while (0) - -/*------------------------------------------------- - PIXEL_OP_REBASE_TRANSPEN - render all pixels - except those matching 'transpen', adding - 'color' to the pen value --------------------------------------------------*/ - -#define PIXEL_OP_REBASE_TRANSPEN(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - u32 srcdata = (SOURCE); \ - if (srcdata != trans_pen) \ - (DEST) = color + srcdata; \ -} \ -while (0) -#define PIXEL_OP_REBASE_TRANSPEN_PRIORITY(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - u32 srcdata = (SOURCE); \ - if (srcdata != trans_pen) \ - { \ - if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ - (DEST) = color + srcdata; \ - (PRIORITY) = 31; \ - } \ -} \ -while (0) - -/*------------------------------------------------- - PIXEL_OP_REMAP_TRANSMASK - render all pixels - except those matching 'trans_mask', mapping the - pen via the 'paldata' array --------------------------------------------------*/ - -#define PIXEL_OP_REMAP_TRANSMASK(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - u32 srcdata = (SOURCE); \ - if (((trans_mask >> srcdata) & 1) == 0) \ - (DEST) = paldata[srcdata]; \ -} \ -while (0) -#define PIXEL_OP_REMAP_TRANSMASK_PRIORITY(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - u32 srcdata = (SOURCE); \ - if (((trans_mask >> srcdata) & 1) == 0) \ - { \ - if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ - (DEST) = paldata[srcdata]; \ - (PRIORITY) = 31; \ - } \ -} \ -while (0) - -/*------------------------------------------------- - PIXEL_OP_REBASE_TRANSMASK - render all pixels - except those matching 'trans_mask', adding - 'color' to the pen value --------------------------------------------------*/ - -#define PIXEL_OP_REBASE_TRANSMASK(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - u32 srcdata = (SOURCE); \ - if (((trans_mask >> srcdata) & 1) == 0) \ - (DEST) = color + srcdata; \ -} \ -while (0) -#define PIXEL_OP_REBASE_TRANSMASK_PRIORITY(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - u32 srcdata = (SOURCE); \ - if (((trans_mask >> srcdata) & 1) == 0) \ - { \ - if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ - (DEST) = color + srcdata; \ - (PRIORITY) = 31; \ - } \ -} \ -while (0) - -/*------------------------------------------------- - PIXEL_OP_REBASE_TRANSTABLE - look up each pen in - 'pentable'; if the entry is DRAWMODE_NONE, - don't draw it; if the entry is DRAWMODE_SOURCE, - add 'color' to the pen value; if the entry is - DRAWMODE_SHADOW, generate a shadow of the - destination pixel using 'shadowtable' - - PIXEL_OP_REMAP_TRANSTABLE - look up each pen in - 'pentable'; if the entry is DRAWMODE_NONE, - don't draw it; if the entry is DRAWMODE_SOURCE, - look up the pen via the 'paldata' array; if the - entry is DRAWMODE_SHADOW, generate a shadow of - the destination pixel using 'shadowtable' --------------------------------------------------*/ - -#define PIXEL_OP_REBASE_TRANSTABLE16(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - u32 srcdata = (SOURCE); \ - u32 entry = pentable[srcdata]; \ - if (entry != DRAWMODE_NONE) \ - { \ - if (entry == DRAWMODE_SOURCE) \ - (DEST) = color + srcdata; \ - else \ - (DEST) = shadowtable[DEST]; \ - } \ -} \ -while (0) -#define PIXEL_OP_REMAP_TRANSTABLE32(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - u32 srcdata = (SOURCE); \ - u32 entry = pentable[srcdata]; \ - if (entry != DRAWMODE_NONE) \ - { \ - if (entry == DRAWMODE_SOURCE) \ - (DEST) = paldata[srcdata]; \ - else \ - (DEST) = shadowtable[rgb_t(DEST).as_rgb15()]; \ - } \ -} \ -while (0) -#define PIXEL_OP_REBASE_TRANSTABLE16_PRIORITY(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - u32 srcdata = (SOURCE); \ - u32 entry = pentable[srcdata]; \ - if (entry != DRAWMODE_NONE) \ - { \ - u8 pridata = (PRIORITY); \ - if (entry == DRAWMODE_SOURCE) \ - { \ - if (((1 << (pridata & 0x1f)) & pmask) == 0) \ - (DEST) = color + srcdata; \ - (PRIORITY) = 31; \ - } \ - else if ((pridata & 0x80) == 0 && ((1 << (pridata & 0x1f)) & pmask) == 0) \ - { \ - (DEST) = shadowtable[DEST]; \ - (PRIORITY) = pridata | 0x80; \ - } \ - } \ -} \ -while (0) -#define PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - u32 srcdata = (SOURCE); \ - u32 entry = pentable[srcdata]; \ - if (entry != DRAWMODE_NONE) \ - { \ - u8 pridata = (PRIORITY); \ - if (entry == DRAWMODE_SOURCE) \ - { \ - if (((1 << (pridata & 0x1f)) & pmask) == 0) \ - (DEST) = paldata[srcdata]; \ - (PRIORITY) = 31; \ - } \ - else if ((pridata & 0x80) == 0 && ((1 << (pridata & 0x1f)) & pmask) == 0) \ - { \ - (DEST) = shadowtable[rgb_t(DEST).as_rgb15()]; \ - (PRIORITY) = pridata | 0x80; \ - } \ - } \ -} \ -while (0) - -/*------------------------------------------------- - PIXEL_OP_REMAP_TRANSPEN_ALPHA - render all - pixels except those matching 'transpen', - mapping the pen to via the 'paldata' array; - the resulting color is RGB alpha blended - against the destination using 'alpha' --------------------------------------------------*/ - -#define PIXEL_OP_REMAP_TRANSPEN_ALPHA32(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - u32 srcdata = (SOURCE); \ - if (srcdata != trans_pen) \ - (DEST) = alpha_blend_r32((DEST), paldata[srcdata], alpha_val); \ -} \ -while (0) -#define PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - u32 srcdata = (SOURCE); \ - if (srcdata != trans_pen) \ - { \ - if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ - (DEST) = alpha_blend_r32((DEST), paldata[srcdata], alpha_val); \ - (PRIORITY) = 31; \ - } \ -} \ -while (0) - - -/*************************************************************************** - BASIC DRAWGFX CORE -***************************************************************************/ - -/* - Assumed input parameters or local variables: - - bitmap_t &dest - the bitmap to render to - const rectangle &cliprect - a clipping rectangle (assumed to be clipped to the size of 'dest') - gfx_element *gfx - pointer to the gfx_element to render - u32 code - index of the entry within gfx_element - u32 color - index of the color within gfx_element - int flipx - non-zero means render right-to-left instead of left-to-right - int flipy - non-zero means render bottom-to-top instead of top-to-bottom - s32 destx - the top-left X coordinate to render to - s32 desty - the top-left Y coordinate to render to - bitmap_t &priority - the priority bitmap (even if PRIORITY_TYPE is NO_PRIORITY, at least needs a dummy) -*/ - - -#define DRAWGFX_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ -do { \ - g_profiler.start(PROFILER_DRAWGFX); \ - do { \ - const u8 *srcdata; \ - s32 destendx, destendy; \ - s32 srcx, srcy; \ - s32 curx, cury; \ - s32 dy; \ - \ - assert(dest.valid()); \ - assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ - assert(dest.cliprect().contains(cliprect)); \ - assert(code < elements()); \ - \ - /* ignore empty/invalid cliprects */ \ - if (cliprect.empty()) \ - break; \ - \ - /* compute final pixel in X and exit if we are entirely clipped */ \ - destendx = destx + width() - 1; \ - if (destx > cliprect.right() || destendx < cliprect.left()) \ - break; \ - \ - /* apply left clip */ \ - srcx = 0; \ - if (destx < cliprect.left()) \ - { \ - srcx = cliprect.left() - destx; \ - destx = cliprect.left(); \ - } \ - \ - /* apply right clip */ \ - if (destendx > cliprect.right()) \ - destendx = cliprect.right(); \ - \ - /* compute final pixel in Y and exit if we are entirely clipped */ \ - destendy = desty + height() - 1; \ - if (desty > cliprect.bottom() || destendy < cliprect.top()) \ - break; \ - \ - /* apply top clip */ \ - srcy = 0; \ - if (desty < cliprect.top()) \ - { \ - srcy = cliprect.top() - desty; \ - desty = cliprect.top(); \ - } \ - \ - /* apply bottom clip */ \ - if (destendy > cliprect.bottom()) \ - destendy = cliprect.bottom(); \ - \ - /* apply X flipping */ \ - if (flipx) \ - srcx = width() - 1 - srcx; \ - \ - /* apply Y flipping */ \ - dy = rowbytes(); \ - if (flipy) \ - { \ - srcy = height() - 1 - srcy; \ - dy = -dy; \ - } \ - \ - /* fetch the source data */ \ - srcdata = get_data(code); \ - \ - /* compute how many blocks of 4 pixels we have */ \ - u32 numblocks = (destendx + 1 - destx) / 4; \ - u32 leftovers = (destendx + 1 - destx) - 4 * numblocks; \ - \ - /* adjust srcdata to point to the first source pixel of the row */ \ - srcdata += srcy * rowbytes() + srcx; \ - \ - /* non-flipped 8bpp case */ \ - if (!flipx) \ - { \ - /* iterate over pixels in Y */ \ - for (cury = desty; cury <= destendy; cury++) \ - { \ - PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ - PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ - const u8 *srcptr = srcdata; \ - srcdata += dy; \ - \ - /* iterate over unrolled blocks of 4 */ \ - for (curx = 0; curx < numblocks; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - PIXEL_OP(destptr[1], priptr[1], srcptr[1]); \ - PIXEL_OP(destptr[2], priptr[2], srcptr[2]); \ - PIXEL_OP(destptr[3], priptr[3], srcptr[3]); \ - \ - srcptr += 4; \ - destptr += 4; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ - } \ - \ - /* iterate over leftover pixels */ \ - for (curx = 0; curx < leftovers; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - srcptr++; \ - destptr++; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ - } \ - } \ - } \ - \ - /* flipped 8bpp case */ \ - else \ - { \ - /* iterate over pixels in Y */ \ - for (cury = desty; cury <= destendy; cury++) \ - { \ - PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ - PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ - const u8 *srcptr = srcdata; \ - srcdata += dy; \ - \ - /* iterate over unrolled blocks of 4 */ \ - for (curx = 0; curx < numblocks; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[ 0]); \ - PIXEL_OP(destptr[1], priptr[1], srcptr[-1]); \ - PIXEL_OP(destptr[2], priptr[2], srcptr[-2]); \ - PIXEL_OP(destptr[3], priptr[3], srcptr[-3]); \ - \ - srcptr -= 4; \ - destptr += 4; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ - } \ - \ - /* iterate over leftover pixels */ \ - for (curx = 0; curx < leftovers; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - srcptr--; \ - destptr++; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ - } \ - } \ - } \ - } while (0); \ - g_profiler.stop(); \ -} while (0) - - - -/*************************************************************************** - BASIC DRAWGFXZOOM CORE -***************************************************************************/ - -/* - Assumed input parameters or local variables: - - bitmap_t &dest - the bitmap to render to - const rectangle &cliprect - a clipping rectangle (assumed to be clipped to the size of 'dest') - gfx_element *gfx - pointer to the gfx_element to render - u32 code - index of the entry within gfx_element - u32 color - index of the color within gfx_element - int flipx - non-zero means render right-to-left instead of left-to-right - int flipy - non-zero means render bottom-to-top instead of top-to-bottom - s32 destx - the top-left X coordinate to render to - s32 desty - the top-left Y coordinate to render to - u32 scalex - the 16.16 scale factor in the X dimension - u32 scaley - the 16.16 scale factor in the Y dimension - bitmap_t &priority - the priority bitmap (even if PRIORITY_TYPE is NO_PRIORITY, at least needs a dummy) -*/ - - -#define DRAWGFXZOOM_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ -do { \ - g_profiler.start(PROFILER_DRAWGFX); \ - do { \ - const u8 *srcdata; \ - u32 dstwidth, dstheight; \ - s32 destendx, destendy; \ - s32 srcx, srcy; \ - s32 curx, cury; \ - s32 dx, dy; \ - \ - assert(dest.valid()); \ - assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ - assert(dest.cliprect().contains(cliprect)); \ - \ - /* ignore empty/invalid cliprects */ \ - if (cliprect.empty()) \ - break; \ - \ - /* compute scaled size */ \ - dstwidth = (scalex * width() + 0x8000) >> 16; \ - dstheight = (scaley * height() + 0x8000) >> 16; \ - if (dstwidth < 1 || dstheight < 1) \ - break; \ - \ - /* compute 16.16 source steps in dx and dy */ \ - dx = (width() << 16) / dstwidth; \ - dy = (height() << 16) / dstheight; \ - \ - /* compute final pixel in X and exit if we are entirely clipped */ \ - destendx = destx + dstwidth - 1; \ - if (destx > cliprect.right() || destendx < cliprect.left()) \ - break; \ - \ - /* apply left clip */ \ - srcx = 0; \ - if (destx < cliprect.left()) \ - { \ - srcx = (cliprect.left() - destx) * dx; \ - destx = cliprect.left(); \ - } \ - \ - /* apply right clip */ \ - if (destendx > cliprect.right()) \ - destendx = cliprect.right(); \ - \ - /* compute final pixel in Y and exit if we are entirely clipped */ \ - destendy = desty + dstheight - 1; \ - if (desty > cliprect.bottom() || destendy < cliprect.top()) \ - { \ - g_profiler.stop(); \ - return; \ - } \ - \ - /* apply top clip */ \ - srcy = 0; \ - if (desty < cliprect.top()) \ - { \ - srcy = (cliprect.top() - desty) * dy; \ - desty = cliprect.top(); \ - } \ - \ - /* apply bottom clip */ \ - if (destendy > cliprect.bottom()) \ - destendy = cliprect.bottom(); \ - \ - /* apply X flipping */ \ - if (flipx) \ - { \ - srcx = (dstwidth - 1) * dx - srcx; \ - dx = -dx; \ - } \ - \ - /* apply Y flipping */ \ - if (flipy) \ - { \ - srcy = (dstheight - 1) * dy - srcy; \ - dy = -dy; \ - } \ - \ - /* fetch the source data */ \ - srcdata = get_data(code); \ - \ - /* compute how many blocks of 4 pixels we have */ \ - u32 numblocks = (destendx + 1 - destx) / 4; \ - u32 leftovers = (destendx + 1 - destx) - 4 * numblocks; \ - \ - /* iterate over pixels in Y */ \ - for (cury = desty; cury <= destendy; cury++) \ - { \ - PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ - PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ - const u8 *srcptr = srcdata + (srcy >> 16) * rowbytes(); \ - s32 cursrcx = srcx; \ - srcy += dy; \ - \ - /* iterate over unrolled blocks of 4 */ \ - for (curx = 0; curx < numblocks; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[cursrcx >> 16]); \ - cursrcx += dx; \ - PIXEL_OP(destptr[1], priptr[1], srcptr[cursrcx >> 16]); \ - cursrcx += dx; \ - PIXEL_OP(destptr[2], priptr[2], srcptr[cursrcx >> 16]); \ - cursrcx += dx; \ - PIXEL_OP(destptr[3], priptr[3], srcptr[cursrcx >> 16]); \ - cursrcx += dx; \ - \ - destptr += 4; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ - } \ - \ - /* iterate over leftover pixels */ \ - for (curx = 0; curx < leftovers; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[cursrcx >> 16]); \ - cursrcx += dx; \ - destptr++; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ - } \ - } \ - } while (0); \ - g_profiler.stop(); \ -} while (0) - - - -/*************************************************************************** - BASIC COPYBITMAP CORE -***************************************************************************/ - -/* - Assumed input parameters or local variables: - - bitmap_t &dest - the bitmap to copy to - bitmap_t &src - the bitmap to copy from (must be same bpp as dest) - const rectangle &cliprect - a clipping rectangle (assumed to be clipped to the size of 'dest') - int flipx - non-zero means render right-to-left instead of left-to-right - int flipy - non-zero means render bottom-to-top instead of top-to-bottom - s32 destx - the top-left X coordinate to copy to - s32 desty - the top-left Y coordinate to copy to - bitmap_t &priority - the priority bitmap (even if PRIORITY_TYPE is NO_PRIORITY, at least needs a dummy) -*/ - -#define COPYBITMAP_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ -do { \ - g_profiler.start(PROFILER_COPYBITMAP); \ - do { \ - const PIXEL_TYPE *srcdata; \ - u32 numblocks, leftovers; \ - s32 destendx, destendy; \ - s32 srcx, srcy; \ - s32 curx, cury; \ - s32 dx, dy; \ - \ - assert(dest.valid()); \ - assert(src.valid()); \ - assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ - assert(dest.cliprect().contains(cliprect)); \ - \ - /* ignore empty/invalid cliprects */ \ - if (cliprect.empty()) \ - break; \ - \ - /* standard setup; dx counts bytes in X, dy counts pixels in Y */ \ - dx = 1; \ - dy = src.rowpixels(); \ - \ - /* compute final pixel in X and exit if we are entirely clipped */ \ - destendx = destx + src.width() - 1; \ - if (destx > cliprect.right() || destendx < cliprect.left()) \ - break; \ - \ - /* apply left clip */ \ - srcx = 0; \ - if (destx < cliprect.left()) \ - { \ - srcx = cliprect.left() - destx; \ - destx = cliprect.left(); \ - } \ - \ - /* apply right clip */ \ - if (destendx > cliprect.right()) \ - destendx = cliprect.right(); \ - \ - /* compute final pixel in Y and exit if we are entirely clipped */ \ - destendy = desty + src.height() - 1; \ - if (desty > cliprect.bottom() || destendy < cliprect.top()) \ - break; \ - \ - /* apply top clip */ \ - srcy = 0; \ - if (desty < cliprect.top()) \ - { \ - srcy = cliprect.top() - desty; \ - desty = cliprect.top(); \ - } \ - \ - /* apply bottom clip */ \ - if (destendy > cliprect.bottom()) \ - destendy = cliprect.bottom(); \ - \ - /* apply X flipping */ \ - if (flipx) \ - { \ - srcx = src.width() - 1 - srcx; \ - dx = -dx; \ - } \ - \ - /* apply Y flipping */ \ - if (flipy) \ - { \ - srcy = src.height() - 1 - srcy; \ - dy = -dy; \ - } \ - \ - /* compute how many blocks of 4 pixels we have */ \ - numblocks = (destendx + 1 - destx) / 4; \ - leftovers = (destendx + 1 - destx) - 4 * numblocks; \ - \ - /* compute the address of the first source pixel of the first row */ \ - srcdata = &src.pixt<PIXEL_TYPE>(srcy, srcx); \ - \ - /* non-flipped case */ \ - if (!flipx) \ - { \ - /* iterate over pixels in Y */ \ - for (cury = desty; cury <= destendy; cury++) \ - { \ - PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ - PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ - const PIXEL_TYPE *srcptr = srcdata; \ - srcdata += dy; \ - \ - /* iterate over unrolled blocks of 4 */ \ - for (curx = 0; curx < numblocks; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - PIXEL_OP(destptr[1], priptr[1], srcptr[1]); \ - PIXEL_OP(destptr[2], priptr[2], srcptr[2]); \ - PIXEL_OP(destptr[3], priptr[3], srcptr[3]); \ - \ - srcptr += 4; \ - destptr += 4; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ - } \ - \ - /* iterate over leftover pixels */ \ - for (curx = 0; curx < leftovers; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - srcptr++; \ - destptr++; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ - } \ - } \ - } \ - \ - /* flipped case */ \ - else \ - { \ - /* iterate over pixels in Y */ \ - for (cury = desty; cury <= destendy; cury++) \ - { \ - PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ - PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ - const PIXEL_TYPE *srcptr = srcdata; \ - srcdata += dy; \ - \ - /* iterate over unrolled blocks of 4 */ \ - for (curx = 0; curx < numblocks; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[ 0]); \ - PIXEL_OP(destptr[1], priptr[1], srcptr[-1]); \ - PIXEL_OP(destptr[2], priptr[2], srcptr[-2]); \ - PIXEL_OP(destptr[3], priptr[3], srcptr[-3]); \ - \ - srcptr -= 4; \ - destptr += 4; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ - } \ - \ - /* iterate over leftover pixels */ \ - for (curx = 0; curx < leftovers; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - srcptr--; \ - destptr++; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ - } \ - } \ - } \ - } while (0); \ - g_profiler.stop(); \ -} while (0) - - - -/*************************************************************************** - BASIC COPYROZBITMAP CORE -***************************************************************************/ - -/* - Assumed input parameters or local variables: - - bitmap_t &dest - the bitmap to copy to - bitmap_t &src - the bitmap to copy from (must be same bpp as dest) - const rectangle &cliprect - a clipping rectangle (assumed to be clipped to the size of 'dest') - s32 destx - the 16.16 source X position at destination pixel (0,0) - s32 desty - the 16.16 source Y position at destination pixel (0,0) - s32 incxx - the 16.16 amount to increment in source X for each destination X pixel - s32 incyx - the 16.16 amount to increment in source Y for each destination X pixel - s32 incxy - the 16.16 amount to increment in source X for each destination Y pixel - s32 incyy - the 16.16 amount to increment in source Y for each destination Y pixel - int wraparound - non-zero means wrap when hitting the edges of the source - bitmap_t &priority - the priority bitmap (even if PRIORITY_TYPE is NO_PRIORITY, at least needs a dummy) -*/ - -#define COPYROZBITMAP_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ -do { \ - u32 srcfixwidth, srcfixheight; \ - u32 numblocks, leftovers; \ - s32 curx, cury; \ - \ - g_profiler.start(PROFILER_COPYBITMAP); \ - \ - assert(dest.valid()); \ - assert(dest.valid()); \ - assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ - assert(dest.cliprect().contains(cliprect)); \ - assert(!wraparound || (src.width() & (src.width() - 1)) == 0); \ - assert(!wraparound || (src.height() & (src.height() - 1)) == 0); \ - \ - /* ignore empty/invalid cliprects */ \ - if (cliprect.empty()) \ - break; \ - \ - /* compute fixed-point 16.16 size of the source bitmap */ \ - srcfixwidth = src.width() << 16; \ - srcfixheight = src.height() << 16; \ - \ - /* advance the starting coordinates to the top-left of the cliprect */ \ - startx += cliprect.left() * incxx + cliprect.top() * incyx; \ - starty += cliprect.left() * incxy + cliprect.top() * incyy; \ - \ - /* compute how many blocks of 4 pixels we have */ \ - numblocks = cliprect.width() / 4; \ - leftovers = cliprect.width() - 4 * numblocks; \ - \ - /* if incxy and incyx are 0, then we aren't rotating, just zooming */ \ - if (incxy == 0 && incyx == 0) \ - { \ - /* zoom-only, non-wraparound case */ \ - if (!wraparound) \ - { \ - /* iterate over pixels in Y */ \ - for (cury = cliprect.top(); cury <= cliprect.bottom(); cury++) \ - { \ - PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.left()); \ - PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, cliprect.left()); \ - const PIXEL_TYPE *srcptr; \ - s32 srcx = startx; \ - s32 srcy = starty; \ - \ - starty += incyy; \ - \ - /* check srcy for the whole row at once */ \ - if ((u32)srcy < srcfixheight) \ - { \ - srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16); \ - \ - /* iterate over unrolled blocks of 4 */ \ - for (curx = 0; curx < numblocks; curx++) \ - { \ - if (u32(srcx) < srcfixwidth) \ - PIXEL_OP(destptr[0], priptr[0], srcptr[srcx >> 16]); \ - srcx += incxx; \ - \ - if (u32(srcx) < srcfixwidth) \ - PIXEL_OP(destptr[1], priptr[1], srcptr[srcx >> 16]); \ - srcx += incxx; \ - \ - if (u32(srcx) < srcfixwidth) \ - PIXEL_OP(destptr[2], priptr[2], srcptr[srcx >> 16]); \ - srcx += incxx; \ - \ - if (u32(srcx) < srcfixwidth) \ - PIXEL_OP(destptr[3], priptr[3], srcptr[srcx >> 16]); \ - srcx += incxx; \ - \ - destptr += 4; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ - } \ - \ - /* iterate over leftover pixels */ \ - for (curx = 0; curx < leftovers; curx++) \ - { \ - if (u32(srcx) < srcfixwidth) \ - PIXEL_OP(destptr[0], priptr[0], srcptr[srcx >> 16]); \ - srcx += incxx; \ - destptr++; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ - } \ - } \ - } \ - } \ - \ - /* zoom-only, wraparound case */ \ - else \ - { \ - /* convert srcfixwidth/height into a mask and apply */ \ - srcfixwidth--; \ - srcfixheight--; \ - startx &= srcfixwidth; \ - starty &= srcfixheight; \ - \ - /* iterate over pixels in Y */ \ - for (cury = cliprect.top(); cury <= cliprect.bottom(); cury++) \ - { \ - PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.left()); \ - PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, cliprect.left()); \ - const PIXEL_TYPE *srcptr = &src.pixt<PIXEL_TYPE>(starty >> 16); \ - s32 srcx = startx; \ - \ - starty = (starty + incyy) & srcfixheight; \ - \ - /* iterate over unrolled blocks of 4 */ \ - for (curx = 0; curx < numblocks; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[srcx >> 16]); \ - srcx = (srcx + incxx) & srcfixwidth; \ - \ - PIXEL_OP(destptr[1], priptr[1], srcptr[srcx >> 16]); \ - srcx = (srcx + incxx) & srcfixwidth; \ - \ - PIXEL_OP(destptr[2], priptr[2], srcptr[srcx >> 16]); \ - srcx = (srcx + incxx) & srcfixwidth; \ - \ - PIXEL_OP(destptr[3], priptr[3], srcptr[srcx >> 16]); \ - srcx = (srcx + incxx) & srcfixwidth; \ - \ - destptr += 4; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ - } \ - \ - /* iterate over leftover pixels */ \ - for (curx = 0; curx < leftovers; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[srcx >> 16]); \ - srcx = (srcx + incxx) & srcfixwidth; \ - destptr++; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ - } \ - } \ - } \ - } \ - \ - /* full rotation case */ \ - else \ - { \ - /* full rotation, non-wraparound case */ \ - if (!wraparound) \ - { \ - /* iterate over pixels in Y */ \ - for (cury = cliprect.top(); cury <= cliprect.bottom(); cury++) \ - { \ - PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.left()); \ - PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, cliprect.left()); \ - const PIXEL_TYPE *srcptr; \ - s32 srcx = startx; \ - s32 srcy = starty; \ - \ - startx += incyx; \ - starty += incyy; \ - \ - /* iterate over unrolled blocks of 4 */ \ - for (curx = 0; curx < numblocks; curx++) \ - { \ - if (u32(srcx) < srcfixwidth && (u32)srcy < srcfixheight) \ - { \ - srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - } \ - srcx += incxx; \ - srcy += incxy; \ - \ - if (u32(srcx) < srcfixwidth && u32(srcy) < srcfixheight) \ - { \ - srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ - PIXEL_OP(destptr[1], priptr[1], srcptr[0]); \ - } \ - srcx += incxx; \ - srcy += incxy; \ - \ - if (u32(srcx) < srcfixwidth && u32(srcy) < srcfixheight) \ - { \ - srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ - PIXEL_OP(destptr[2], priptr[2], srcptr[0]); \ - } \ - srcx += incxx; \ - srcy += incxy; \ - \ - if (u32(srcx) < srcfixwidth && u32(srcy) < srcfixheight) \ - { \ - srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ - PIXEL_OP(destptr[3], priptr[3], srcptr[0]); \ - } \ - srcx += incxx; \ - srcy += incxy; \ - \ - destptr += 4; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ - } \ - \ - /* iterate over leftover pixels */ \ - for (curx = 0; curx < leftovers; curx++) \ - { \ - if (u32(srcx) < srcfixwidth && u32(srcy) < srcfixheight) \ - { \ - srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - } \ - srcx += incxx; \ - srcy += incxy; \ - destptr++; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ - } \ - } \ - } \ - \ - /* zoom-only, wraparound case */ \ - else \ - { \ - /* convert srcfixwidth/height into a mask and apply */ \ - srcfixwidth--; \ - srcfixheight--; \ - startx &= srcfixwidth; \ - starty &= srcfixheight; \ - \ - /* iterate over pixels in Y */ \ - for (cury = cliprect.top(); cury <= cliprect.bottom(); cury++) \ - { \ - PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.left()); \ - PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, cliprect.left()); \ - const PIXEL_TYPE *srcptr; \ - s32 srcx = startx; \ - s32 srcy = starty; \ - \ - startx = (startx + incyx) & srcfixwidth; \ - starty = (starty + incyy) & srcfixheight; \ - \ - /* iterate over unrolled blocks of 4 */ \ - for (curx = 0; curx < numblocks; curx++) \ - { \ - srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - srcx = (srcx + incxx) & srcfixwidth; \ - srcy = (srcy + incxy) & srcfixheight; \ - \ - srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ - PIXEL_OP(destptr[1], priptr[1], srcptr[0]); \ - srcx = (srcx + incxx) & srcfixwidth; \ - srcy = (srcy + incxy) & srcfixheight; \ - \ - srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ - PIXEL_OP(destptr[2], priptr[2], srcptr[0]); \ - srcx = (srcx + incxx) & srcfixwidth; \ - srcy = (srcy + incxy) & srcfixheight; \ - \ - srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ - PIXEL_OP(destptr[3], priptr[3], srcptr[0]); \ - srcx = (srcx + incxx) & srcfixwidth; \ - srcy = (srcy + incxy) & srcfixheight; \ - \ - destptr += 4; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ - } \ - \ - /* iterate over leftover pixels */ \ - for (curx = 0; curx < leftovers; curx++) \ - { \ - srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - srcx = (srcx + incxx) & srcfixwidth; \ - srcy = (srcy + incxy) & srcfixheight; \ - destptr++; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ - } \ - } \ - } \ - } \ - g_profiler.stop(); \ -} while (0) - - - -/*************************************************************************** - BASIC DRAWSCANLINE CORE -***************************************************************************/ - -/* - Assumed input parameters or local variables: - - bitmap_t &bitmap - the bitmap to copy to - s32 destx - the X coordinate to copy to - s32 desty - the Y coordinate to copy to - s32 length - the total number of pixels to copy - const UINTx *srcptr - pointer to memory containing the source pixels - bitmap_t &priority - the priority bitmap (even if PRIORITY_TYPE is NO_PRIORITY, at least needs a dummy) -*/ - -#define DRAWSCANLINE_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ -do { \ - assert(bitmap.valid()); \ - assert(destx >= 0); \ - assert(destx + length <= bitmap.width()); \ - assert(desty >= 0); \ - assert(desty < bitmap.height()); \ - assert(srcptr != nullptr); \ - assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ - \ - { \ - PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, desty, destx); \ - PIXEL_TYPE *destptr = &bitmap.pixt<PIXEL_TYPE>(desty, destx); \ - \ - /* iterate over unrolled blocks of 4 */ \ - while (length >= 4) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - PIXEL_OP(destptr[1], priptr[1], srcptr[1]); \ - PIXEL_OP(destptr[2], priptr[2], srcptr[2]); \ - PIXEL_OP(destptr[3], priptr[3], srcptr[3]); \ - \ - length -= 4; \ - srcptr += 4; \ - destptr += 4; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ - } \ - \ - /* iterate over leftover pixels */ \ - while (length-- > 0) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - srcptr++; \ - destptr++; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ - } \ - } \ -} while (0) - - - -/*************************************************************************** - BASIC EXTRACTSCANLINE CORE -***************************************************************************/ - -/* - Assumed input parameters: - - bitmap_t &bitmap - the bitmap to extract from - s32 srcx - the X coordinate to begin extraction - s32 srcy - the Y coordinate to begin extraction - s32 length - the total number of pixels to extract - UINTx *destptr - pointer to memory to receive the extracted pixels -*/ - -#define EXTRACTSCANLINE_CORE(PIXEL_TYPE) \ -do { \ - assert(bitmap.valid()); \ - assert(srcx >= 0); \ - assert(srcx + length <= bitmap.width()); \ - assert(srcy >= 0); \ - assert(srcy < bitmap.height()); \ - assert(destptr != nullptr); \ - \ - { \ - const PIXEL_TYPE *srcptr = &bitmap.pixt<PIXEL_TYPE>(srcy, srcx); \ - \ - /* iterate over unrolled blocks of 4 */ \ - while (length >= 4) \ - { \ - destptr[0] = srcptr[0]; \ - destptr[1] = srcptr[1]; \ - destptr[2] = srcptr[2]; \ - destptr[3] = srcptr[3]; \ - length -= 4; \ - srcptr += 4; \ - destptr += 4; \ - } \ - \ - /* iterate over leftover pixels */ \ - while (length > 0) \ - { \ - destptr[0] = srcptr[0]; \ - length--; \ - srcptr++; \ - destptr++; \ - } \ - } \ -} while (0) - - -#endif /* __DRAWGFXM_H__ */ diff --git a/src/emu/drawgfxt.ipp b/src/emu/drawgfxt.ipp new file mode 100644 index 00000000000..eb4910ebf78 --- /dev/null +++ b/src/emu/drawgfxt.ipp @@ -0,0 +1,1911 @@ +// license:BSD-3-Clause +// copyright-holders:Nicola Salmoria, Aaron Giles +/********************************************************************* + + drawgfxt.ipp + + Template function implementing drawgfx core operations. Drivers + can use these if they need custom behavior not provided by the + existing drawgfx functions. + +*********************************************************************/ + +#pragma once + +#ifndef MAME_EMU_DRAWGFXT_IPP +#define MAME_EMU_DRAWGFXT_IPP + + +/*************************************************************************** + PIXEL OPERATIONS +***************************************************************************/ + +/*------------------------------------------------- + PIXEL_OP_COPY_OPAQUE - render all pixels + regardless of pen, copying directly +-------------------------------------------------*/ + +#define PIXEL_OP_COPY_OPAQUE(DEST, SOURCE) \ +do \ +{ \ + (DEST) = SOURCE; \ +} \ +while (0) +#define PIXEL_OP_COPY_OPAQUE_PRIORITY(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ + (DEST) = SOURCE; \ + (PRIORITY) = 31; \ +} \ +while (0) +#define PIXEL_OP_COPY_OPAQUE_PRIMASK(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + (DEST) = SOURCE; \ + (PRIORITY) = ((PRIORITY) & pmask) | pcode; \ +} \ +while (0) + +/*------------------------------------------------- + PIXEL_OP_COPY_TRANSPEN - render all pixels + except those matching 'transpen', copying + directly +-------------------------------------------------*/ + +#define PIXEL_OP_COPY_TRANSPEN(DEST, SOURCE) \ +do \ +{ \ + u32 srcdata = (SOURCE); \ + if (srcdata != trans_pen) \ + (DEST) = SOURCE; \ +} \ +while (0) +#define PIXEL_OP_COPY_TRANSPEN_PRIORITY(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + u32 srcdata = (SOURCE); \ + if (srcdata != trans_pen) \ + { \ + if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ + (DEST) = SOURCE; \ + (PRIORITY) = 31; \ + } \ +} \ +while (0) +#define PIXEL_OP_COPY_TRANSPEN_PRIMASK(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + u32 srcdata = (SOURCE); \ + if (srcdata != trans_pen) \ + { \ + (DEST) = SOURCE; \ + (PRIORITY) = ((PRIORITY) & pmask) | pcode; \ + } \ +} \ +while (0) + +/*------------------------------------------------- + PIXEL_OP_COPY_TRANSALPHA - render all pixels + except those with an alpha of zero, copying + directly +-------------------------------------------------*/ + +#define PIXEL_OP_COPY_TRANSALPHA(DEST, SOURCE) \ +do \ +{ \ + u32 srcdata = (SOURCE); \ + if ((srcdata & 0xff000000) != 0) \ + (DEST) = SOURCE; \ +} \ +while (0) +#define PIXEL_OP_COPY_TRANSALPHA_PRIORITY(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + u32 srcdata = (SOURCE); \ + if ((srcdata & 0xff000000) != 0) \ + { \ + if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ + (DEST) = SOURCE; \ + (PRIORITY) = 31; \ + } \ +} \ +while (0) +#define PIXEL_OP_COPY_TRANSALPHA_PRIMASK(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + u32 srcdata = (SOURCE); \ + if ((srcdata & 0xff000000) != 0) \ + { \ + (DEST) = SOURCE; \ + (PRIORITY) = ((PRIORITY) & pmask) | pcode; \ + } \ +} \ +while (0) + +/*------------------------------------------------- + PIXEL_OP_REMAP_OPAQUE - render all pixels + regardless of pen, mapping the pen via the + 'paldata' array +-------------------------------------------------*/ + +#define PIXEL_OP_REMAP_OPAQUE(DEST, SOURCE) \ +do \ +{ \ + (DEST) = paldata[SOURCE]; \ +} \ +while (0) +#define PIXEL_OP_REMAP_OPAQUE_PRIORITY(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ + (DEST) = paldata[SOURCE]; \ + (PRIORITY) = 31; \ +} \ +while (0) +#define PIXEL_OP_REMAP_OPAQUE_PRIMASK(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + (DEST) = paldata[SOURCE]; \ + (PRIORITY) = ((PRIORITY) & pmask) | pcode; \ +} \ +while (0) + +/*------------------------------------------------- + PIXEL_OP_REBASE_OPAQUE - render all pixels + regardless of pen, adding 'color' to the + pen value +-------------------------------------------------*/ + +#define PIXEL_OP_REBASE_OPAQUE(DEST, SOURCE) \ +do \ +{ \ + (DEST) = color + (SOURCE); \ +} \ +while (0) +#define PIXEL_OP_REBASE_OPAQUE_PRIORITY(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ + (DEST) = color + (SOURCE); \ + (PRIORITY) = 31; \ +} \ +while (0) + +/*------------------------------------------------- + PIXEL_OP_REMAP_TRANSPEN - render all pixels + except those matching 'trans_pen', mapping the + pen via the 'paldata' array +-------------------------------------------------*/ + +#define PIXEL_OP_REMAP_TRANSPEN(DEST, SOURCE) \ +do \ +{ \ + u32 srcdata = (SOURCE); \ + if (srcdata != trans_pen) \ + (DEST) = paldata[srcdata]; \ +} \ +while (0) +#define PIXEL_OP_REMAP_TRANSPEN_PRIORITY(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + u32 srcdata = (SOURCE); \ + if (srcdata != trans_pen) \ + { \ + if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ + (DEST) = paldata[srcdata]; \ + (PRIORITY) = 31; \ + } \ +} \ +while (0) + +/*------------------------------------------------- + PIXEL_OP_REBASE_TRANSPEN - render all pixels + except those matching 'transpen', adding + 'color' to the pen value +-------------------------------------------------*/ + +#define PIXEL_OP_REBASE_TRANSPEN(DEST, SOURCE) \ +do \ +{ \ + u32 srcdata = (SOURCE); \ + if (srcdata != trans_pen) \ + (DEST) = color + srcdata; \ +} \ +while (0) +#define PIXEL_OP_REBASE_TRANSPEN_PRIORITY(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + u32 srcdata = (SOURCE); \ + if (srcdata != trans_pen) \ + { \ + if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ + (DEST) = color + srcdata; \ + (PRIORITY) = 31; \ + } \ +} \ +while (0) + +/*------------------------------------------------- + PIXEL_OP_REMAP_TRANSMASK - render all pixels + except those matching 'trans_mask', mapping the + pen via the 'paldata' array +-------------------------------------------------*/ + +#define PIXEL_OP_REMAP_TRANSMASK(DEST, SOURCE) \ +do \ +{ \ + u32 srcdata = (SOURCE); \ + if (((trans_mask >> srcdata) & 1) == 0) \ + (DEST) = paldata[srcdata]; \ +} \ +while (0) +#define PIXEL_OP_REMAP_TRANSMASK_PRIORITY(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + u32 srcdata = (SOURCE); \ + if (((trans_mask >> srcdata) & 1) == 0) \ + { \ + if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ + (DEST) = paldata[srcdata]; \ + (PRIORITY) = 31; \ + } \ +} \ +while (0) + +/*------------------------------------------------- + PIXEL_OP_REBASE_TRANSMASK - render all pixels + except those matching 'trans_mask', adding + 'color' to the pen value +-------------------------------------------------*/ + +#define PIXEL_OP_REBASE_TRANSMASK(DEST, SOURCE) \ +do \ +{ \ + u32 srcdata = (SOURCE); \ + if (((trans_mask >> srcdata) & 1) == 0) \ + (DEST) = color + srcdata; \ +} \ +while (0) +#define PIXEL_OP_REBASE_TRANSMASK_PRIORITY(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + u32 srcdata = (SOURCE); \ + if (((trans_mask >> srcdata) & 1) == 0) \ + { \ + if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ + (DEST) = color + srcdata; \ + (PRIORITY) = 31; \ + } \ +} \ +while (0) + +/*------------------------------------------------- + PIXEL_OP_REBASE_TRANSTABLE - look up each pen in + 'pentable'; if the entry is DRAWMODE_NONE, + don't draw it; if the entry is DRAWMODE_SOURCE, + add 'color' to the pen value; if the entry is + DRAWMODE_SHADOW, generate a shadow of the + destination pixel using 'shadowtable' + + PIXEL_OP_REMAP_TRANSTABLE - look up each pen in + 'pentable'; if the entry is DRAWMODE_NONE, + don't draw it; if the entry is DRAWMODE_SOURCE, + look up the pen via the 'paldata' array; if the + entry is DRAWMODE_SHADOW, generate a shadow of + the destination pixel using 'shadowtable' +-------------------------------------------------*/ + +#define PIXEL_OP_REBASE_TRANSTABLE16(DEST, SOURCE) \ +do \ +{ \ + u32 srcdata = (SOURCE); \ + u32 entry = pentable[srcdata]; \ + if (entry != DRAWMODE_NONE) \ + { \ + if (entry == DRAWMODE_SOURCE) \ + (DEST) = color + srcdata; \ + else \ + (DEST) = shadowtable[DEST]; \ + } \ +} \ +while (0) +#define PIXEL_OP_REMAP_TRANSTABLE32(DEST, SOURCE) \ +do \ +{ \ + u32 srcdata = (SOURCE); \ + u32 entry = pentable[srcdata]; \ + if (entry != DRAWMODE_NONE) \ + { \ + if (entry == DRAWMODE_SOURCE) \ + (DEST) = paldata[srcdata]; \ + else \ + (DEST) = shadowtable[rgb_t(DEST).as_rgb15()]; \ + } \ +} \ +while (0) +#define PIXEL_OP_REBASE_TRANSTABLE16_PRIORITY(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + u32 srcdata = (SOURCE); \ + u32 entry = pentable[srcdata]; \ + if (entry != DRAWMODE_NONE) \ + { \ + u8 pridata = (PRIORITY); \ + if (entry == DRAWMODE_SOURCE) \ + { \ + if (((1 << (pridata & 0x1f)) & pmask) == 0) \ + (DEST) = color + srcdata; \ + (PRIORITY) = 31; \ + } \ + else if ((pridata & 0x80) == 0 && ((1 << (pridata & 0x1f)) & pmask) == 0) \ + { \ + (DEST) = shadowtable[DEST]; \ + (PRIORITY) = pridata | 0x80; \ + } \ + } \ +} \ +while (0) +#define PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + u32 srcdata = (SOURCE); \ + u32 entry = pentable[srcdata]; \ + if (entry != DRAWMODE_NONE) \ + { \ + u8 pridata = (PRIORITY); \ + if (entry == DRAWMODE_SOURCE) \ + { \ + if (((1 << (pridata & 0x1f)) & pmask) == 0) \ + (DEST) = paldata[srcdata]; \ + (PRIORITY) = 31; \ + } \ + else if ((pridata & 0x80) == 0 && ((1 << (pridata & 0x1f)) & pmask) == 0) \ + { \ + (DEST) = shadowtable[rgb_t(DEST).as_rgb15()]; \ + (PRIORITY) = pridata | 0x80; \ + } \ + } \ +} \ +while (0) + +/*------------------------------------------------- + PIXEL_OP_REMAP_TRANSPEN_ALPHA - render all + pixels except those matching 'transpen', + mapping the pen to via the 'paldata' array; + the resulting color is RGB alpha blended + against the destination using 'alpha' +-------------------------------------------------*/ + +#define PIXEL_OP_REMAP_TRANSPEN_ALPHA32(DEST, SOURCE) \ +do \ +{ \ + u32 srcdata = (SOURCE); \ + if (srcdata != trans_pen) \ + (DEST) = alpha_blend_r32((DEST), paldata[srcdata], alpha_val); \ +} \ +while (0) +#define PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + u32 srcdata = (SOURCE); \ + if (srcdata != trans_pen) \ + { \ + if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ + (DEST) = alpha_blend_r32((DEST), paldata[srcdata], alpha_val); \ + (PRIORITY) = 31; \ + } \ +} \ +while (0) + + +/*************************************************************************** + BASIC DRAWGFX CORE +***************************************************************************/ + +/* + Input parameters: + + bitmap_t &dest - the bitmap to render to + const rectangle &cliprect - a clipping rectangle (assumed to be clipped to the size of 'dest') + gfx_element *gfx - pointer to the gfx_element to render + u32 code - index of the entry within gfx_element + int flipx - non-zero means render right-to-left instead of left-to-right + int flipy - non-zero means render bottom-to-top instead of top-to-bottom + s32 destx - the top-left X coordinate to render to + s32 desty - the top-left Y coordinate to render to + bitmap_t &priority - the priority bitmap (if and only if priority is to be applied) +*/ + + +template <typename BitmapType, typename FunctionClass> +void gfx_element::drawgfx_core(BitmapType &dest, const rectangle &cliprect, u32 code, int flipx, int flipy, s32 destx, s32 desty, FunctionClass pixel_op) +{ + g_profiler.start(PROFILER_DRAWGFX); + do { + assert(dest.valid()); + assert(dest.cliprect().contains(cliprect)); + assert(code < elements()); + + // ignore empty/invalid cliprects + if (cliprect.empty()) + break; + + // compute final pixel in X and exit if we are entirely clipped + s32 destendx = destx + width() - 1; + if (destx > cliprect.right() || destendx < cliprect.left()) + break; + + // apply left clip + s32 srcx = 0; + if (destx < cliprect.left()) + { + srcx = cliprect.left() - destx; + destx = cliprect.left(); + } + + // apply right clip + if (destendx > cliprect.right()) + destendx = cliprect.right(); + + // compute final pixel in Y and exit if we are entirely clipped + s32 destendy = desty + height() - 1; + if (desty > cliprect.bottom() || destendy < cliprect.top()) + break; + + // apply top clip + s32 srcy = 0; + if (desty < cliprect.top()) + { + srcy = cliprect.top() - desty; + desty = cliprect.top(); + } + + // apply bottom clip + if (destendy > cliprect.bottom()) + destendy = cliprect.bottom(); + + // apply X flipping + if (flipx) + srcx = width() - 1 - srcx; + + // apply Y flipping + s32 dy = rowbytes(); + if (flipy) + { + srcy = height() - 1 - srcy; + dy = -dy; + } + + // fetch the source data + const u8 *srcdata = get_data(code); + + // compute how many blocks of 4 pixels we have + u32 numblocks = (destendx + 1 - destx) / 4; + u32 leftovers = (destendx + 1 - destx) - 4 * numblocks; + + // adjust srcdata to point to the first source pixel of the row + srcdata += srcy * rowbytes() + srcx; + + // non-flipped 8bpp case + if (!flipx) + { + // iterate over pixels in Y + for (s32 cury = desty; cury <= destendy; cury++) + { + auto *destptr = &dest.pix(cury, destx); + const u8 *srcptr = srcdata; + srcdata += dy; + + // iterate over unrolled blocks of 4 + for (s32 curx = 0; curx < numblocks; curx++) + { + pixel_op(destptr[0], srcptr[0]); + pixel_op(destptr[1], srcptr[1]); + pixel_op(destptr[2], srcptr[2]); + pixel_op(destptr[3], srcptr[3]); + + srcptr += 4; + destptr += 4; + } + + // iterate over leftover pixels + for (s32 curx = 0; curx < leftovers; curx++) + { + pixel_op(destptr[0], srcptr[0]); + srcptr++; + destptr++; + } + } + } + + // flipped 8bpp case + else + { + // iterate over pixels in Y + for (s32 cury = desty; cury <= destendy; cury++) + { + auto *destptr = &dest.pix(cury, destx); + const u8 *srcptr = srcdata; + srcdata += dy; + + // iterate over unrolled blocks of 4 + for (s32 curx = 0; curx < numblocks; curx++) + { + pixel_op(destptr[0], srcptr[ 0]); + pixel_op(destptr[1], srcptr[-1]); + pixel_op(destptr[2], srcptr[-2]); + pixel_op(destptr[3], srcptr[-3]); + + srcptr -= 4; + destptr += 4; + } + + // iterate over leftover pixels + for (s32 curx = 0; curx < leftovers; curx++) + { + pixel_op(destptr[0], srcptr[0]); + srcptr--; + destptr++; + } + } + } + } while (0); + g_profiler.stop(); +} + + +template <typename BitmapType, typename PriorityType, typename FunctionClass> +void gfx_element::drawgfx_core(BitmapType &dest, const rectangle &cliprect, u32 code, int flipx, int flipy, s32 destx, s32 desty, PriorityType &priority, FunctionClass pixel_op) +{ + g_profiler.start(PROFILER_DRAWGFX); + do { + assert(dest.valid()); + assert(priority.valid()); + assert(dest.cliprect().contains(cliprect)); + assert(code < elements()); + + // ignore empty/invalid cliprects + if (cliprect.empty()) + break; + + // compute final pixel in X and exit if we are entirely clipped + s32 destendx = destx + width() - 1; + if (destx > cliprect.right() || destendx < cliprect.left()) + break; + + // apply left clip + s32 srcx = 0; + if (destx < cliprect.left()) + { + srcx = cliprect.left() - destx; + destx = cliprect.left(); + } + + // apply right clip + if (destendx > cliprect.right()) + destendx = cliprect.right(); + + // compute final pixel in Y and exit if we are entirely clipped + s32 destendy = desty + height() - 1; + if (desty > cliprect.bottom() || destendy < cliprect.top()) + break; + + // apply top clip + s32 srcy = 0; + if (desty < cliprect.top()) + { + srcy = cliprect.top() - desty; + desty = cliprect.top(); + } + + // apply bottom clip + if (destendy > cliprect.bottom()) + destendy = cliprect.bottom(); + + // apply X flipping + if (flipx) + srcx = width() - 1 - srcx; + + // apply Y flipping + s32 dy = rowbytes(); + if (flipy) + { + srcy = height() - 1 - srcy; + dy = -dy; + } + + // fetch the source data + const u8 *srcdata = get_data(code); + + // compute how many blocks of 4 pixels we have + u32 numblocks = (destendx + 1 - destx) / 4; + u32 leftovers = (destendx + 1 - destx) - 4 * numblocks; + + // adjust srcdata to point to the first source pixel of the row + srcdata += srcy * rowbytes() + srcx; + + // non-flipped 8bpp case + if (!flipx) + { + // iterate over pixels in Y + for (s32 cury = desty; cury <= destendy; cury++) + { + auto *priptr = &priority.pix(cury, destx); + auto *destptr = &dest.pix(cury, destx); + const u8 *srcptr = srcdata; + srcdata += dy; + + // iterate over unrolled blocks of 4 + for (s32 curx = 0; curx < numblocks; curx++) + { + pixel_op(destptr[0], priptr[0], srcptr[0]); + pixel_op(destptr[1], priptr[1], srcptr[1]); + pixel_op(destptr[2], priptr[2], srcptr[2]); + pixel_op(destptr[3], priptr[3], srcptr[3]); + + srcptr += 4; + destptr += 4; + priptr += 4; + } + + // iterate over leftover pixels + for (s32 curx = 0; curx < leftovers; curx++) + { + pixel_op(destptr[0], priptr[0], srcptr[0]); + srcptr++; + destptr++; + priptr++; + } + } + } + + // flipped 8bpp case + else + { + // iterate over pixels in Y + for (s32 cury = desty; cury <= destendy; cury++) + { + auto *priptr = &priority.pix(cury, destx); + auto *destptr = &dest.pix(cury, destx); + const u8 *srcptr = srcdata; + srcdata += dy; + + // iterate over unrolled blocks of 4 + for (s32 curx = 0; curx < numblocks; curx++) + { + pixel_op(destptr[0], priptr[0], srcptr[ 0]); + pixel_op(destptr[1], priptr[1], srcptr[-1]); + pixel_op(destptr[2], priptr[2], srcptr[-2]); + pixel_op(destptr[3], priptr[3], srcptr[-3]); + + srcptr -= 4; + destptr += 4; + priptr += 4; + } + + // iterate over leftover pixels + for (s32 curx = 0; curx < leftovers; curx++) + { + pixel_op(destptr[0], priptr[0], srcptr[0]); + srcptr--; + destptr++; + priptr++; + } + } + } + } while (0); + g_profiler.stop(); +} + + + +/*************************************************************************** + BASIC DRAWGFXZOOM CORE +***************************************************************************/ + +/* + Input parameters: + + bitmap_t &dest - the bitmap to render to + const rectangle &cliprect - a clipping rectangle (assumed to be clipped to the size of 'dest') + gfx_element *gfx - pointer to the gfx_element to render + u32 code - index of the entry within gfx_element + int flipx - non-zero means render right-to-left instead of left-to-right + int flipy - non-zero means render bottom-to-top instead of top-to-bottom + s32 destx - the top-left X coordinate to render to + s32 desty - the top-left Y coordinate to render to + u32 scalex - the 16.16 scale factor in the X dimension + u32 scaley - the 16.16 scale factor in the Y dimension + bitmap_t &priority - the priority bitmap (if and only if priority is to be applied) +*/ + + +template <typename BitmapType, typename FunctionClass> +void gfx_element::drawgfxzoom_core(BitmapType &dest, const rectangle &cliprect, u32 code, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, FunctionClass pixel_op) +{ + g_profiler.start(PROFILER_DRAWGFX); + do { + assert(dest.valid()); + assert(dest.cliprect().contains(cliprect)); + + // ignore empty/invalid cliprects + if (cliprect.empty()) + break; + + // compute scaled size + u32 dstwidth = (scalex * width() + 0x8000) >> 16; + u32 dstheight = (scaley * height() + 0x8000) >> 16; + if (dstwidth < 1 || dstheight < 1) + break; + + // compute 16.16 source steps in dx and dy + s32 dx = (width() << 16) / dstwidth; + s32 dy = (height() << 16) / dstheight; + + // compute final pixel in X and exit if we are entirely clipped + s32 destendx = destx + dstwidth - 1; + if (destx > cliprect.right() || destendx < cliprect.left()) + break; + + // apply left clip + s32 srcx = 0; + if (destx < cliprect.left()) + { + srcx = (cliprect.left() - destx) * dx; + destx = cliprect.left(); + } + + // apply right clip + if (destendx > cliprect.right()) + destendx = cliprect.right(); + + // compute final pixel in Y and exit if we are entirely clipped + s32 destendy = desty + dstheight - 1; + if (desty > cliprect.bottom() || destendy < cliprect.top()) + { + g_profiler.stop(); + return; + } + + // apply top clip + s32 srcy = 0; + if (desty < cliprect.top()) + { + srcy = (cliprect.top() - desty) * dy; + desty = cliprect.top(); + } + + // apply bottom clip + if (destendy > cliprect.bottom()) + destendy = cliprect.bottom(); + + // apply X flipping + if (flipx) + { + srcx = (dstwidth - 1) * dx - srcx; + dx = -dx; + } + + // apply Y flipping + if (flipy) + { + srcy = (dstheight - 1) * dy - srcy; + dy = -dy; + } + + // fetch the source data + const u8 *srcdata = get_data(code); + + // compute how many blocks of 4 pixels we have + u32 numblocks = (destendx + 1 - destx) / 4; + u32 leftovers = (destendx + 1 - destx) - 4 * numblocks; + + // iterate over pixels in Y + for (s32 cury = desty; cury <= destendy; cury++) + { + auto *destptr = &dest.pix(cury, destx); + const u8 *srcptr = srcdata + (srcy >> 16) * rowbytes(); + s32 cursrcx = srcx; + srcy += dy; + + // iterate over unrolled blocks of 4 + for (s32 curx = 0; curx < numblocks; curx++) + { + pixel_op(destptr[0], srcptr[cursrcx >> 16]); + cursrcx += dx; + pixel_op(destptr[1], srcptr[cursrcx >> 16]); + cursrcx += dx; + pixel_op(destptr[2], srcptr[cursrcx >> 16]); + cursrcx += dx; + pixel_op(destptr[3], srcptr[cursrcx >> 16]); + cursrcx += dx; + + destptr += 4; + } + + // iterate over leftover pixels + for (s32 curx = 0; curx < leftovers; curx++) + { + pixel_op(destptr[0], srcptr[cursrcx >> 16]); + cursrcx += dx; + destptr++; + } + } + } while (0); + g_profiler.stop(); +} + + +template <typename BitmapType, typename PriorityType, typename FunctionClass> +void gfx_element::drawgfxzoom_core(BitmapType &dest, const rectangle &cliprect, u32 code, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, PriorityType &priority, FunctionClass pixel_op) +{ + g_profiler.start(PROFILER_DRAWGFX); + do { + assert(dest.valid()); + assert(priority.valid()); + assert(dest.cliprect().contains(cliprect)); + + // ignore empty/invalid cliprects + if (cliprect.empty()) + break; + + // compute scaled size + u32 dstwidth = (scalex * width() + 0x8000) >> 16; + u32 dstheight = (scaley * height() + 0x8000) >> 16; + if (dstwidth < 1 || dstheight < 1) + break; + + // compute 16.16 source steps in dx and dy + s32 dx = (width() << 16) / dstwidth; + s32 dy = (height() << 16) / dstheight; + + // compute final pixel in X and exit if we are entirely clipped + s32 destendx = destx + dstwidth - 1; + if (destx > cliprect.right() || destendx < cliprect.left()) + break; + + // apply left clip + s32 srcx = 0; + if (destx < cliprect.left()) + { + srcx = (cliprect.left() - destx) * dx; + destx = cliprect.left(); + } + + // apply right clip + if (destendx > cliprect.right()) + destendx = cliprect.right(); + + // compute final pixel in Y and exit if we are entirely clipped + s32 destendy = desty + dstheight - 1; + if (desty > cliprect.bottom() || destendy < cliprect.top()) + { + g_profiler.stop(); + return; + } + + // apply top clip + s32 srcy = 0; + if (desty < cliprect.top()) + { + srcy = (cliprect.top() - desty) * dy; + desty = cliprect.top(); + } + + // apply bottom clip + if (destendy > cliprect.bottom()) + destendy = cliprect.bottom(); + + // apply X flipping + if (flipx) + { + srcx = (dstwidth - 1) * dx - srcx; + dx = -dx; + } + + // apply Y flipping + if (flipy) + { + srcy = (dstheight - 1) * dy - srcy; + dy = -dy; + } + + // fetch the source data + const u8 *srcdata = get_data(code); + + // compute how many blocks of 4 pixels we have + u32 numblocks = (destendx + 1 - destx) / 4; + u32 leftovers = (destendx + 1 - destx) - 4 * numblocks; + + // iterate over pixels in Y + for (s32 cury = desty; cury <= destendy; cury++) + { + auto *priptr = &priority.pix(cury, destx); + auto *destptr = &dest.pix(cury, destx); + const u8 *srcptr = srcdata + (srcy >> 16) * rowbytes(); + s32 cursrcx = srcx; + srcy += dy; + + // iterate over unrolled blocks of 4 + for (s32 curx = 0; curx < numblocks; curx++) + { + pixel_op(destptr[0], priptr[0], srcptr[cursrcx >> 16]); + cursrcx += dx; + pixel_op(destptr[1], priptr[1], srcptr[cursrcx >> 16]); + cursrcx += dx; + pixel_op(destptr[2], priptr[2], srcptr[cursrcx >> 16]); + cursrcx += dx; + pixel_op(destptr[3], priptr[3], srcptr[cursrcx >> 16]); + cursrcx += dx; + + destptr += 4; + priptr += 4; + } + + // iterate over leftover pixels + for (s32 curx = 0; curx < leftovers; curx++) + { + pixel_op(destptr[0], priptr[0], srcptr[cursrcx >> 16]); + cursrcx += dx; + destptr++; + priptr++; + } + } + } while (0); + g_profiler.stop(); +} + + + +/*************************************************************************** + BASIC COPYBITMAP CORE +***************************************************************************/ + +/* + Input parameters: + + bitmap_t &dest - the bitmap to copy to + bitmap_t &src - the bitmap to copy from (must be same bpp as dest) + const rectangle &cliprect - a clipping rectangle (assumed to be clipped to the size of 'dest') + int flipx - non-zero means render right-to-left instead of left-to-right + int flipy - non-zero means render bottom-to-top instead of top-to-bottom + s32 destx - the top-left X coordinate to copy to + s32 desty - the top-left Y coordinate to copy to + bitmap_t &priority - the priority bitmap (if and only if priority is to be applied) +*/ + +template <typename BitmapType, typename FunctionClass> +void copybitmap_core(BitmapType &dest, const BitmapType &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, FunctionClass pixel_op) +{ + g_profiler.start(PROFILER_COPYBITMAP); + do { + assert(dest.valid()); + assert(src.valid()); + assert(dest.cliprect().contains(cliprect)); + + // ignore empty/invalid cliprects + if (cliprect.empty()) + break; + + // standard setup; dx counts bytes in X, dy counts pixels in Y + s32 dx = 1; + s32 dy = src.rowpixels(); + + // compute final pixel in X and exit if we are entirely clipped + s32 destendx = destx + src.width() - 1; + if (destx > cliprect.right() || destendx < cliprect.left()) + break; + + // apply left clip + s32 srcx = 0; + if (destx < cliprect.left()) + { + srcx = cliprect.left() - destx; + destx = cliprect.left(); + } + + // apply right clip + if (destendx > cliprect.right()) + destendx = cliprect.right(); + + // compute final pixel in Y and exit if we are entirely clipped + s32 destendy = desty + src.height() - 1; + if (desty > cliprect.bottom() || destendy < cliprect.top()) + break; + + // apply top clip + s32 srcy = 0; + if (desty < cliprect.top()) + { + srcy = cliprect.top() - desty; + desty = cliprect.top(); + } + + // apply bottom clip + if (destendy > cliprect.bottom()) + destendy = cliprect.bottom(); + + // apply X flipping + if (flipx) + { + srcx = src.width() - 1 - srcx; + dx = -dx; + } + + // apply Y flipping + if (flipy) + { + srcy = src.height() - 1 - srcy; + dy = -dy; + } + + // compute how many blocks of 4 pixels we have + u32 numblocks = (destendx + 1 - destx) / 4; + u32 leftovers = (destendx + 1 - destx) - 4 * numblocks; + + // compute the address of the first source pixel of the first row + const auto *srcdata = &src.pix(srcy, srcx); + + // non-flipped case + if (!flipx) + { + // iterate over pixels in Y + for (s32 cury = desty; cury <= destendy; cury++) + { + auto *destptr = &dest.pix(cury, destx); + const auto *srcptr = srcdata; + srcdata += dy; + + // iterate over unrolled blocks of 4 + for (s32 curx = 0; curx < numblocks; curx++) + { + pixel_op(destptr[0], srcptr[0]); + pixel_op(destptr[1], srcptr[1]); + pixel_op(destptr[2], srcptr[2]); + pixel_op(destptr[3], srcptr[3]); + + srcptr += 4; + destptr += 4; + } + + // iterate over leftover pixels + for (s32 curx = 0; curx < leftovers; curx++) + { + pixel_op(destptr[0], srcptr[0]); + srcptr++; + destptr++; + } + } + } + + // flipped case + else + { + // iterate over pixels in Y + for (s32 cury = desty; cury <= destendy; cury++) + { + auto *destptr = &dest.pix(cury, destx); + const auto *srcptr = srcdata; + srcdata += dy; + + // iterate over unrolled blocks of 4 + for (s32 curx = 0; curx < numblocks; curx++) + { + pixel_op(destptr[0], srcptr[ 0]); + pixel_op(destptr[1], srcptr[-1]); + pixel_op(destptr[2], srcptr[-2]); + pixel_op(destptr[3], srcptr[-3]); + + srcptr -= 4; + destptr += 4; + } + + // iterate over leftover pixels + for (s32 curx = 0; curx < leftovers; curx++) + { + pixel_op(destptr[0], srcptr[0]); + srcptr--; + destptr++; + } + } + } + } while (0); + g_profiler.stop(); +} + + +template <typename BitmapType, typename PriorityType, typename FunctionClass> +void copybitmap_core(BitmapType &dest, const BitmapType &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, PriorityType &priority, FunctionClass pixel_op) +{ + g_profiler.start(PROFILER_COPYBITMAP); + do { + assert(dest.valid()); + assert(src.valid()); + assert(priority.valid()); + assert(dest.cliprect().contains(cliprect)); + + // ignore empty/invalid cliprects + if (cliprect.empty()) + break; + + // standard setup; dx counts bytes in X, dy counts pixels in Y + s32 dx = 1; + s32 dy = src.rowpixels(); + + // compute final pixel in X and exit if we are entirely clipped + s32 destendx = destx + src.width() - 1; + if (destx > cliprect.right() || destendx < cliprect.left()) + break; + + // apply left clip + s32 srcx = 0; + if (destx < cliprect.left()) + { + srcx = cliprect.left() - destx; + destx = cliprect.left(); + } + + // apply right clip + if (destendx > cliprect.right()) + destendx = cliprect.right(); + + // compute final pixel in Y and exit if we are entirely clipped + s32 destendy = desty + src.height() - 1; + if (desty > cliprect.bottom() || destendy < cliprect.top()) + break; + + // apply top clip + s32 srcy = 0; + if (desty < cliprect.top()) + { + srcy = cliprect.top() - desty; + desty = cliprect.top(); + } + + // apply bottom clip + if (destendy > cliprect.bottom()) + destendy = cliprect.bottom(); + + // apply X flipping + if (flipx) + { + srcx = src.width() - 1 - srcx; + dx = -dx; + } + + // apply Y flipping + if (flipy) + { + srcy = src.height() - 1 - srcy; + dy = -dy; + } + + // compute how many blocks of 4 pixels we have + u32 numblocks = (destendx + 1 - destx) / 4; + u32 leftovers = (destendx + 1 - destx) - 4 * numblocks; + + // compute the address of the first source pixel of the first row + const auto *srcdata = &src.pix(srcy, srcx); + + // non-flipped case + if (!flipx) + { + // iterate over pixels in Y + for (s32 cury = desty; cury <= destendy; cury++) + { + auto *priptr = &priority.pix(cury, destx); + auto *destptr = &dest.pix(cury, destx); + const auto *srcptr = srcdata; + srcdata += dy; + + // iterate over unrolled blocks of 4 + for (s32 curx = 0; curx < numblocks; curx++) + { + pixel_op(destptr[0], priptr[0], srcptr[0]); + pixel_op(destptr[1], priptr[1], srcptr[1]); + pixel_op(destptr[2], priptr[2], srcptr[2]); + pixel_op(destptr[3], priptr[3], srcptr[3]); + + srcptr += 4; + destptr += 4; + priptr += 4; + } + + // iterate over leftover pixels + for (s32 curx = 0; curx < leftovers; curx++) + { + pixel_op(destptr[0], priptr[0], srcptr[0]); + srcptr++; + destptr++; + priptr++; + } + } + } + + // flipped case + else + { + // iterate over pixels in Y + for (s32 cury = desty; cury <= destendy; cury++) + { + auto *priptr = &priority.pix(cury, destx); + auto *destptr = &dest.pix(cury, destx); + const auto *srcptr = srcdata; + srcdata += dy; + + // iterate over unrolled blocks of 4 + for (s32 curx = 0; curx < numblocks; curx++) + { + pixel_op(destptr[0], priptr[0], srcptr[ 0]); + pixel_op(destptr[1], priptr[1], srcptr[-1]); + pixel_op(destptr[2], priptr[2], srcptr[-2]); + pixel_op(destptr[3], priptr[3], srcptr[-3]); + + srcptr -= 4; + destptr += 4; + priptr += 4; + } + + // iterate over leftover pixels + for (s32 curx = 0; curx < leftovers; curx++) + { + pixel_op(destptr[0], priptr[0], srcptr[0]); + srcptr--; + destptr++; + priptr++; + } + } + } + } while (0); + g_profiler.stop(); +} + + + +/*************************************************************************** + BASIC COPYROZBITMAP CORE +***************************************************************************/ + +/* + Input parameters: + + bitmap_t &dest - the bitmap to copy to + bitmap_t &src - the bitmap to copy from (must be same bpp as dest) + const rectangle &cliprect - a clipping rectangle (assumed to be clipped to the size of 'dest') + s32 destx - the 16.16 source X position at destination pixel (0,0) + s32 desty - the 16.16 source Y position at destination pixel (0,0) + s32 incxx - the 16.16 amount to increment in source X for each destination X pixel + s32 incyx - the 16.16 amount to increment in source Y for each destination X pixel + s32 incxy - the 16.16 amount to increment in source X for each destination Y pixel + s32 incyy - the 16.16 amount to increment in source Y for each destination Y pixel + int wraparound - non-zero means wrap when hitting the edges of the source + bitmap_t &priority - the priority bitmap (if and only if priority is to be applied) +*/ + +template <typename BitmapType, typename FunctionClass> +void copyrozbitmap_core(BitmapType &dest, const rectangle &cliprect, const BitmapType &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, FunctionClass pixel_op) +{ + g_profiler.start(PROFILER_COPYBITMAP); + + assert(dest.valid()); + assert(dest.valid()); + assert(dest.cliprect().contains(cliprect)); + assert(!wraparound || (src.width() & (src.width() - 1)) == 0); + assert(!wraparound || (src.height() & (src.height() - 1)) == 0); + + // ignore empty/invalid cliprects + if (cliprect.empty()) + { + g_profiler.stop(); + return; + } + + // compute fixed-point 16.16 size of the source bitmap + u32 srcfixwidth = src.width() << 16; + u32 srcfixheight = src.height() << 16; + + // advance the starting coordinates to the top-left of the cliprect + startx += cliprect.left() * incxx + cliprect.top() * incyx; + starty += cliprect.left() * incxy + cliprect.top() * incyy; + + // compute how many blocks of 4 pixels we have + u32 numblocks = cliprect.width() / 4; + u32 leftovers = cliprect.width() - 4 * numblocks; + + // if incxy and incyx are 0, then we aren't rotating, just zooming + if (incxy == 0 && incyx == 0) + { + // zoom-only, non-wraparound case + if (!wraparound) + { + // iterate over pixels in Y + for (s32 cury = cliprect.top(); cury <= cliprect.bottom(); cury++) + { + auto *destptr = &dest.pix(cury, cliprect.left()); + s32 srcx = startx; + s32 srcy = starty; + + starty += incyy; + + // check srcy for the whole row at once + if (u32(srcy) < srcfixheight) + { + const auto *srcptr = &src.pix(srcy >> 16); + + // iterate over unrolled blocks of 4 + for (s32 curx = 0; curx < numblocks; curx++) + { + if (u32(srcx) < srcfixwidth) + pixel_op(destptr[0], srcptr[srcx >> 16]); + srcx += incxx; + + if (u32(srcx) < srcfixwidth) + pixel_op(destptr[1], srcptr[srcx >> 16]); + srcx += incxx; + + if (u32(srcx) < srcfixwidth) + pixel_op(destptr[2], srcptr[srcx >> 16]); + srcx += incxx; + + if (u32(srcx) < srcfixwidth) + pixel_op(destptr[3], srcptr[srcx >> 16]); + srcx += incxx; + + destptr += 4; + } + + // iterate over leftover pixels + for (s32 curx = 0; curx < leftovers; curx++) + { + if (u32(srcx) < srcfixwidth) + pixel_op(destptr[0], srcptr[srcx >> 16]); + srcx += incxx; + destptr++; + } + } + } + } + + // zoom-only, wraparound case + else + { + // convert srcfixwidth/height into a mask and apply + srcfixwidth--; + srcfixheight--; + startx &= srcfixwidth; + starty &= srcfixheight; + + // iterate over pixels in Y + for (s32 cury = cliprect.top(); cury <= cliprect.bottom(); cury++) + { + auto *destptr = &dest.pix(cury, cliprect.left()); + const auto *srcptr = &src.pix(starty >> 16); + s32 srcx = startx; + + starty = (starty + incyy) & srcfixheight; + + // iterate over unrolled blocks of 4 + for (s32 curx = 0; curx < numblocks; curx++) + { + pixel_op(destptr[0], srcptr[srcx >> 16]); + srcx = (srcx + incxx) & srcfixwidth; + + pixel_op(destptr[1], srcptr[srcx >> 16]); + srcx = (srcx + incxx) & srcfixwidth; + + pixel_op(destptr[2], srcptr[srcx >> 16]); + srcx = (srcx + incxx) & srcfixwidth; + + pixel_op(destptr[3], srcptr[srcx >> 16]); + srcx = (srcx + incxx) & srcfixwidth; + + destptr += 4; + } + + // iterate over leftover pixels + for (s32 curx = 0; curx < leftovers; curx++) + { + pixel_op(destptr[0], srcptr[srcx >> 16]); + srcx = (srcx + incxx) & srcfixwidth; + destptr++; + } + } + } + } + + // full rotation case + else + { + // full rotation, non-wraparound case + if (!wraparound) + { + // iterate over pixels in Y + for (s32 cury = cliprect.top(); cury <= cliprect.bottom(); cury++) + { + auto *destptr = &dest.pix(cury, cliprect.left()); + s32 srcx = startx; + s32 srcy = starty; + + startx += incyx; + starty += incyy; + + // iterate over unrolled blocks of 4 + for (s32 curx = 0; curx < numblocks; curx++) + { + if (u32(srcx) < srcfixwidth && u32(srcy) < srcfixheight) + { + const auto *srcptr = &src.pix(srcy >> 16, srcx >> 16); + pixel_op(destptr[0], srcptr[0]); + } + srcx += incxx; + srcy += incxy; + + if (u32(srcx) < srcfixwidth && u32(srcy) < srcfixheight) + { + const auto *srcptr = &src.pix(srcy >> 16, srcx >> 16); + pixel_op(destptr[1], srcptr[0]); + } + srcx += incxx; + srcy += incxy; + + if (u32(srcx) < srcfixwidth && u32(srcy) < srcfixheight) + { + const auto *srcptr = &src.pix(srcy >> 16, srcx >> 16); + pixel_op(destptr[2], srcptr[0]); + } + srcx += incxx; + srcy += incxy; + + if (u32(srcx) < srcfixwidth && u32(srcy) < srcfixheight) + { + const auto *srcptr = &src.pix(srcy >> 16, srcx >> 16); + pixel_op(destptr[3], srcptr[0]); + } + srcx += incxx; + srcy += incxy; + + destptr += 4; + } + + // iterate over leftover pixels + for (s32 curx = 0; curx < leftovers; curx++) + { + if (u32(srcx) < srcfixwidth && u32(srcy) < srcfixheight) + { + const auto *srcptr = &src.pix(srcy >> 16, srcx >> 16); + pixel_op(destptr[0], srcptr[0]); + } + srcx += incxx; + srcy += incxy; + destptr++; + } + } + } + + // zoom-only, wraparound case + else + { + // convert srcfixwidth/height into a mask and apply + srcfixwidth--; + srcfixheight--; + startx &= srcfixwidth; + starty &= srcfixheight; + + // iterate over pixels in Y + for (s32 cury = cliprect.top(); cury <= cliprect.bottom(); cury++) + { + auto *destptr = &dest.pix(cury, cliprect.left()); + s32 srcx = startx; + s32 srcy = starty; + + startx = (startx + incyx) & srcfixwidth; + starty = (starty + incyy) & srcfixheight; + + // iterate over unrolled blocks of 4 + for (s32 curx = 0; curx < numblocks; curx++) + { + const auto *srcptr = &src.pix(srcy >> 16, srcx >> 16); + pixel_op(destptr[0], srcptr[0]); + srcx = (srcx + incxx) & srcfixwidth; + srcy = (srcy + incxy) & srcfixheight; + + srcptr = &src.pix(srcy >> 16, srcx >> 16); + pixel_op(destptr[1], srcptr[0]); + srcx = (srcx + incxx) & srcfixwidth; + srcy = (srcy + incxy) & srcfixheight; + + srcptr = &src.pix(srcy >> 16, srcx >> 16); + pixel_op(destptr[2], srcptr[0]); + srcx = (srcx + incxx) & srcfixwidth; + srcy = (srcy + incxy) & srcfixheight; + + srcptr = &src.pix(srcy >> 16, srcx >> 16); + pixel_op(destptr[3], srcptr[0]); + srcx = (srcx + incxx) & srcfixwidth; + srcy = (srcy + incxy) & srcfixheight; + + destptr += 4; + } + + // iterate over leftover pixels + for (s32 curx = 0; curx < leftovers; curx++) + { + const auto *srcptr = &src.pix(srcy >> 16, srcx >> 16); + pixel_op(destptr[0], srcptr[0]); + srcx = (srcx + incxx) & srcfixwidth; + srcy = (srcy + incxy) & srcfixheight; + destptr++; + } + } + } + } + g_profiler.stop(); +} + + +template <typename BitmapType, typename PriorityType, typename FunctionClass> +void copyrozbitmap_core(BitmapType &dest, const rectangle &cliprect, const BitmapType &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, PriorityType &priority, FunctionClass pixel_op) +{ + g_profiler.start(PROFILER_COPYBITMAP); + + assert(dest.valid()); + assert(dest.valid()); + assert(priority.valid()); + assert(dest.cliprect().contains(cliprect)); + assert(!wraparound || (src.width() & (src.width() - 1)) == 0); + assert(!wraparound || (src.height() & (src.height() - 1)) == 0); + + // ignore empty/invalid cliprects + if (cliprect.empty()) + { + g_profiler.stop(); + return; + } + + // compute fixed-point 16.16 size of the source bitmap + u32 srcfixwidth = src.width() << 16; + u32 srcfixheight = src.height() << 16; + + // advance the starting coordinates to the top-left of the cliprect + startx += cliprect.left() * incxx + cliprect.top() * incyx; + starty += cliprect.left() * incxy + cliprect.top() * incyy; + + // compute how many blocks of 4 pixels we have + u32 numblocks = cliprect.width() / 4; + u32 leftovers = cliprect.width() - 4 * numblocks; + + // if incxy and incyx are 0, then we aren't rotating, just zooming + if (incxy == 0 && incyx == 0) + { + // zoom-only, non-wraparound case + if (!wraparound) + { + // iterate over pixels in Y + for (s32 cury = cliprect.top(); cury <= cliprect.bottom(); cury++) + { + auto *priptr = &priority.pix(cury, cliprect.left()); + auto *destptr = &dest.pix(cury, cliprect.left()); + s32 srcx = startx; + s32 srcy = starty; + + starty += incyy; + + // check srcy for the whole row at once + if (u32(srcy) < srcfixheight) + { + const auto *srcptr = &src.pix(srcy >> 16); + + // iterate over unrolled blocks of 4 + for (s32 curx = 0; curx < numblocks; curx++) + { + if (u32(srcx) < srcfixwidth) + pixel_op(destptr[0], priptr[0], srcptr[srcx >> 16]); + srcx += incxx; + + if (u32(srcx) < srcfixwidth) + pixel_op(destptr[1], priptr[1], srcptr[srcx >> 16]); + srcx += incxx; + + if (u32(srcx) < srcfixwidth) + pixel_op(destptr[2], priptr[2], srcptr[srcx >> 16]); + srcx += incxx; + + if (u32(srcx) < srcfixwidth) + pixel_op(destptr[3], priptr[3], srcptr[srcx >> 16]); + srcx += incxx; + + destptr += 4; + priptr += 4; + } + + // iterate over leftover pixels + for (s32 curx = 0; curx < leftovers; curx++) + { + if (u32(srcx) < srcfixwidth) + pixel_op(destptr[0], priptr[0], srcptr[srcx >> 16]); + srcx += incxx; + destptr++; + priptr++; + } + } + } + } + + // zoom-only, wraparound case + else + { + // convert srcfixwidth/height into a mask and apply + srcfixwidth--; + srcfixheight--; + startx &= srcfixwidth; + starty &= srcfixheight; + + // iterate over pixels in Y + for (s32 cury = cliprect.top(); cury <= cliprect.bottom(); cury++) + { + auto *priptr = &priority.pix(cury, cliprect.left()); + auto *destptr = &dest.pix(cury, cliprect.left()); + const auto *srcptr = &src.pix(starty >> 16); + s32 srcx = startx; + + starty = (starty + incyy) & srcfixheight; + + // iterate over unrolled blocks of 4 + for (s32 curx = 0; curx < numblocks; curx++) + { + pixel_op(destptr[0], priptr[0], srcptr[srcx >> 16]); + srcx = (srcx + incxx) & srcfixwidth; + + pixel_op(destptr[1], priptr[1], srcptr[srcx >> 16]); + srcx = (srcx + incxx) & srcfixwidth; + + pixel_op(destptr[2], priptr[2], srcptr[srcx >> 16]); + srcx = (srcx + incxx) & srcfixwidth; + + pixel_op(destptr[3], priptr[3], srcptr[srcx >> 16]); + srcx = (srcx + incxx) & srcfixwidth; + + destptr += 4; + priptr += 4; + } + + // iterate over leftover pixels + for (s32 curx = 0; curx < leftovers; curx++) + { + pixel_op(destptr[0], priptr[0], srcptr[srcx >> 16]); + srcx = (srcx + incxx) & srcfixwidth; + destptr++; + priptr++; + } + } + } + } + + // full rotation case + else + { + // full rotation, non-wraparound case + if (!wraparound) + { + // iterate over pixels in Y + for (s32 cury = cliprect.top(); cury <= cliprect.bottom(); cury++) + { + auto *priptr = &priority.pix(cury, cliprect.left()); + auto *destptr = &dest.pix(cury, cliprect.left()); + s32 srcx = startx; + s32 srcy = starty; + + startx += incyx; + starty += incyy; + + // iterate over unrolled blocks of 4 + for (s32 curx = 0; curx < numblocks; curx++) + { + if (u32(srcx) < srcfixwidth && u32(srcy) < srcfixheight) + { + const auto *srcptr = &src.pix(srcy >> 16, srcx >> 16); + pixel_op(destptr[0], priptr[0], srcptr[0]); + } + srcx += incxx; + srcy += incxy; + + if (u32(srcx) < srcfixwidth && u32(srcy) < srcfixheight) + { + const auto *srcptr = &src.pix(srcy >> 16, srcx >> 16); + pixel_op(destptr[1], priptr[1], srcptr[0]); + } + srcx += incxx; + srcy += incxy; + + if (u32(srcx) < srcfixwidth && u32(srcy) < srcfixheight) + { + const auto *srcptr = &src.pix(srcy >> 16, srcx >> 16); + pixel_op(destptr[2], priptr[2], srcptr[0]); + } + srcx += incxx; + srcy += incxy; + + if (u32(srcx) < srcfixwidth && u32(srcy) < srcfixheight) + { + const auto *srcptr = &src.pix(srcy >> 16, srcx >> 16); + pixel_op(destptr[3], priptr[3], srcptr[0]); + } + srcx += incxx; + srcy += incxy; + + destptr += 4; + priptr += 4; + } + + // iterate over leftover pixels + for (s32 curx = 0; curx < leftovers; curx++) + { + if (u32(srcx) < srcfixwidth && u32(srcy) < srcfixheight) + { + const auto *srcptr = &src.pix(srcy >> 16, srcx >> 16); + pixel_op(destptr[0], priptr[0], srcptr[0]); + } + srcx += incxx; + srcy += incxy; + destptr++; + priptr++; + } + } + } + + // zoom-only, wraparound case + else + { + // convert srcfixwidth/height into a mask and apply + srcfixwidth--; + srcfixheight--; + startx &= srcfixwidth; + starty &= srcfixheight; + + // iterate over pixels in Y + for (s32 cury = cliprect.top(); cury <= cliprect.bottom(); cury++) + { + auto *priptr = &priority.pix(cury, cliprect.left()); + auto *destptr = &dest.pix(cury, cliprect.left()); + s32 srcx = startx; + s32 srcy = starty; + + startx = (startx + incyx) & srcfixwidth; + starty = (starty + incyy) & srcfixheight; + + // iterate over unrolled blocks of 4 + for (s32 curx = 0; curx < numblocks; curx++) + { + const auto *srcptr = &src.pix(srcy >> 16, srcx >> 16); + pixel_op(destptr[0], priptr[0], srcptr[0]); + srcx = (srcx + incxx) & srcfixwidth; + srcy = (srcy + incxy) & srcfixheight; + + srcptr = &src.pix(srcy >> 16, srcx >> 16); + pixel_op(destptr[1], priptr[1], srcptr[0]); + srcx = (srcx + incxx) & srcfixwidth; + srcy = (srcy + incxy) & srcfixheight; + + srcptr = &src.pix(srcy >> 16, srcx >> 16); + pixel_op(destptr[2], priptr[2], srcptr[0]); + srcx = (srcx + incxx) & srcfixwidth; + srcy = (srcy + incxy) & srcfixheight; + + srcptr = &src.pix(srcy >> 16, srcx >> 16); + pixel_op(destptr[3], priptr[3], srcptr[0]); + srcx = (srcx + incxx) & srcfixwidth; + srcy = (srcy + incxy) & srcfixheight; + + destptr += 4; + priptr += 4; + } + + // iterate over leftover pixels + for (s32 curx = 0; curx < leftovers; curx++) + { + const auto *srcptr = &src.pix(srcy >> 16, srcx >> 16); + pixel_op(destptr[0], priptr[0], srcptr[0]); + srcx = (srcx + incxx) & srcfixwidth; + srcy = (srcy + incxy) & srcfixheight; + destptr++; + priptr++; + } + } + } + } + g_profiler.stop(); +} + + + +/*************************************************************************** + BASIC DRAWSCANLINE CORE +***************************************************************************/ + +/* + Input parameters: + + bitmap_t &bitmap - the bitmap to copy to + s32 destx - the X coordinate to copy to + s32 desty - the Y coordinate to copy to + s32 length - the total number of pixels to copy + const UINTx *srcptr - pointer to memory containing the source pixels + bitmap_t &priority - the priority bitmap (if and only if priority is to be applied) +*/ + +template <typename BitmapType, typename SourceType, typename FunctionClass> +void drawscanline_core(BitmapType &bitmap, s32 destx, s32 desty, s32 length, const SourceType *srcptr, FunctionClass pixel_op) +{ + assert(bitmap.valid()); + assert(destx >= 0); + assert(destx + length <= bitmap.width()); + assert(desty >= 0); + assert(desty < bitmap.height()); + assert(srcptr != nullptr); + + auto *destptr = &bitmap.pix(desty, destx); + + // iterate over unrolled blocks of 4 + while (length >= 4) + { + pixel_op(destptr[0], srcptr[0]); + pixel_op(destptr[1], srcptr[1]); + pixel_op(destptr[2], srcptr[2]); + pixel_op(destptr[3], srcptr[3]); + + length -= 4; + srcptr += 4; + destptr += 4; + } + + // iterate over leftover pixels + while (length-- > 0) + { + pixel_op(destptr[0], srcptr[0]); + srcptr++; + destptr++; + } +} + + +template <typename BitmapType, typename SourceType, typename PriorityType, typename FunctionClass> +void drawscanline_core(BitmapType &bitmap, s32 destx, s32 desty, s32 length, const SourceType *srcptr, PriorityType &priority, FunctionClass pixel_op) +{ + assert(bitmap.valid()); + assert(destx >= 0); + assert(destx + length <= bitmap.width()); + assert(desty >= 0); + assert(desty < bitmap.height()); + assert(srcptr != nullptr); + assert(priority.valid()); + + auto *priptr = &priority.pix(desty, destx); + auto *destptr = &bitmap.pix(desty, destx); + + // iterate over unrolled blocks of 4 + while (length >= 4) + { + pixel_op(destptr[0], priptr[0], srcptr[0]); + pixel_op(destptr[1], priptr[1], srcptr[1]); + pixel_op(destptr[2], priptr[2], srcptr[2]); + pixel_op(destptr[3], priptr[3], srcptr[3]); + + length -= 4; + srcptr += 4; + destptr += 4; + priptr += 4; + + // iterate over leftover pixels + while (length-- > 0) + { + pixel_op(destptr[0], priptr[0], srcptr[0]); + srcptr++; + destptr++; + priptr++; + } + } +} + + +#endif // MAME_EMU_DRAWGFXT_IPP diff --git a/src/emu/video.cpp b/src/emu/video.cpp index 03a251d3171..e253afcfc4a 100644 --- a/src/emu/video.cpp +++ b/src/emu/video.cpp @@ -808,7 +808,7 @@ int video_manager::effective_frameskip() const inline bool video_manager::effective_throttle() const { // if we're paused, or if the UI is active, we always throttle - if (machine().paused()) //|| machine().ui().is_menu_active()) + if (machine().paused() && !machine().options().update_in_pause()) //|| machine().ui().is_menu_active()) return true; // if we're fast forwarding, we don't throttle diff --git a/src/lib/util/bitmap.cpp b/src/lib/util/bitmap.cpp index a0a1e92f4d9..87cf8a27b76 100644 --- a/src/lib/util/bitmap.cpp +++ b/src/lib/util/bitmap.cpp @@ -41,6 +41,42 @@ inline void bitmap_t::compute_base(int xslop, int yslop) } +//------------------------------------------------- +// valid_format - return true if the bitmap format +// is valid and agrees with the BPP +//------------------------------------------------- + +inline bool bitmap_t::valid_format() const +{ + switch (m_format) + { + // invalid format + case BITMAP_FORMAT_INVALID: + return false; + + // 8bpp formats + case BITMAP_FORMAT_IND8: + return m_bpp == 8; + + // 16bpp formats + case BITMAP_FORMAT_IND16: + case BITMAP_FORMAT_YUY16: + return m_bpp == 16; + + // 32bpp formats + case BITMAP_FORMAT_IND32: + case BITMAP_FORMAT_RGB32: + case BITMAP_FORMAT_ARGB32: + return m_bpp == 32; + + // 64bpp formats + case BITMAP_FORMAT_IND64: + return m_bpp == 64; + } + + return false; +} + //************************************************************************** // BITMAP ALLOCATION/CONFIGURATION @@ -84,6 +120,8 @@ bitmap_t::bitmap_t(bitmap_format format, uint8_t bpp, int width, int height, int , m_bpp(bpp) , m_palette(nullptr) { + assert(valid_format()); + // allocate intializes all other fields allocate(width, height, xslop, yslop); } @@ -113,6 +151,7 @@ bitmap_t::bitmap_t(bitmap_format format, uint8_t bpp, void *base, int width, int , m_palette(nullptr) , m_cliprect(0, width - 1, 0, height - 1) { + assert(valid_format()); } /** diff --git a/src/lib/util/bitmap.h b/src/lib/util/bitmap.h index efb18f7e456..ed6a5382a61 100644 --- a/src/lib/util/bitmap.h +++ b/src/lib/util/bitmap.h @@ -31,8 +31,7 @@ enum bitmap_format BITMAP_FORMAT_IND64, // 64bpp indexed BITMAP_FORMAT_RGB32, // 32bpp 8-8-8 RGB BITMAP_FORMAT_ARGB32, // 32bpp 8-8-8-8 ARGB - BITMAP_FORMAT_YUY16, // 16bpp 8-8 Y/Cb, Y/Cr in sequence - BITMAP_FORMAT_LAST + BITMAP_FORMAT_YUY16 // 16bpp 8-8 Y/Cb, Y/Cr in sequence }; @@ -161,8 +160,8 @@ public: } // pixel access - template<typename _PixelType> - _PixelType &pixt(int32_t y, int32_t x = 0) const { return *(reinterpret_cast<_PixelType *>(m_base) + y * m_rowpixels + x); } + template<typename PixelType> + PixelType &pixt(int32_t y, int32_t x = 0) const { return *(reinterpret_cast<PixelType *>(m_base) + y * m_rowpixels + x); } void *raw_pixptr(int32_t y, int32_t x = 0) const { return reinterpret_cast<uint8_t *>(m_base) + (y * m_rowpixels + x) * m_bpp / 8; } protected: @@ -174,6 +173,7 @@ private: // internal helpers int32_t compute_rowpixels(int width, int xslop); void compute_base(int xslop, int yslop); + bool valid_format() const; // internal state std::unique_ptr<uint8_t []> m_alloc; // pointer to allocated pixel memory @@ -189,111 +189,47 @@ private: }; -// ======================> bitmap8_t, bitmap16_t, bitmap32_t, bitmap64_t +// ======================> bitmap_specific, bitmap8_t, bitmap16_t, bitmap32_t, bitmap64_t -// 8bpp bitmaps -class bitmap8_t : public bitmap_t +template<typename PixelType> +class bitmap_specific : public bitmap_t { -private: - // private helpers - bool valid_format(bitmap_format format) const { return (format == BITMAP_FORMAT_IND8); } + static constexpr int PixelBits = 8 * sizeof(PixelType); protected: // construction/destruction -- subclasses only - bitmap8_t(bitmap8_t &&) = default; - bitmap8_t(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, 8, width, height, xslop, yslop) { } - bitmap8_t(bitmap_format format, uint8_t *base, int width, int height, int rowpixels) : bitmap_t(format, 8, base, width, height, rowpixels) { assert(valid_format(format)); } - bitmap8_t(bitmap_format format, bitmap8_t &source, const rectangle &subrect) : bitmap_t(format, 8, source, subrect) { } + bitmap_specific(bitmap_specific<PixelType> &&) = default; + bitmap_specific(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, PixelBits, width, height, xslop, yslop) { } + bitmap_specific(bitmap_format format, PixelType *base, int width, int height, int rowpixels) : bitmap_t(format, PixelBits, base, width, height, rowpixels) { } + bitmap_specific(bitmap_format format, bitmap_specific<PixelType> &source, const rectangle &subrect) : bitmap_t(format, PixelBits, source, subrect) { } - bitmap8_t &operator=(bitmap8_t &&) = default; + bitmap_specific<PixelType> &operator=(bitmap_specific<PixelType> &&) = default; public: - // getters - uint8_t bpp() const { return 8; } - - // pixel accessors - typedef uint8_t pixel_t; - pixel_t &pix(int32_t y, int32_t x = 0) const { return pixt<pixel_t>(y, x); } - pixel_t &pix8(int32_t y, int32_t x = 0) const { return pixt<pixel_t>(y, x); } -}; + using pixel_t = PixelType; -// 16bpp bitmaps -class bitmap16_t : public bitmap_t -{ -private: - // private helpers - bool valid_format(bitmap_format format) const { return (format == BITMAP_FORMAT_IND16 || format == BITMAP_FORMAT_YUY16); } - -protected: - // construction/destruction -- subclasses only - bitmap16_t(bitmap16_t &&) = default; - bitmap16_t(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, 16, width, height, xslop, yslop) { assert(valid_format(format)); } - bitmap16_t(bitmap_format format, uint16_t *base, int width, int height, int rowpixels) : bitmap_t(format, 16, base, width, height, rowpixels) { assert(valid_format(format)); } - bitmap16_t(bitmap_format format, bitmap16_t &source, const rectangle &subrect) : bitmap_t(format, 16, source, subrect) { } - - bitmap16_t &operator=(bitmap16_t &&) = default; - -public: // getters - uint8_t bpp() const { return 16; } + uint8_t bpp() const { return PixelBits; } // pixel accessors - typedef uint16_t pixel_t; - pixel_t &pix(int32_t y, int32_t x = 0) const { return pixt<pixel_t>(y, x); } - pixel_t &pix16(int32_t y, int32_t x = 0) const { return pixt<pixel_t>(y, x); } + PixelType &pix(int32_t y, int32_t x = 0) const { return pixt<PixelType>(y, x); } + PixelType &pix8(int32_t y, int32_t x = 0) const { static_assert(PixelBits == 8, "must be 8bpp"); return pixt<PixelType>(y, x); } + PixelType &pix16(int32_t y, int32_t x = 0) const { static_assert(PixelBits == 16, "must be 16bpp"); return pixt<PixelType>(y, x); } + PixelType &pix32(int32_t y, int32_t x = 0) const { static_assert(PixelBits == 32, "must be 32bpp"); return pixt<PixelType>(y, x); } + PixelType &pix64(int32_t y, int32_t x = 0) const { static_assert(PixelBits == 64, "must be 64bpp"); return pixt<PixelType>(y, x); } }; -// 32bpp bitmaps -class bitmap32_t : public bitmap_t -{ -private: - // private helpers - bool valid_format(bitmap_format format) const { return (format == BITMAP_FORMAT_IND32 || format == BITMAP_FORMAT_RGB32 || format == BITMAP_FORMAT_ARGB32); } - -protected: - // construction/destruction -- subclasses only - bitmap32_t(bitmap32_t &&) = default; - bitmap32_t(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, 32, width, height, xslop, yslop) { assert(valid_format(format)); } - bitmap32_t(bitmap_format format, uint32_t *base, int width, int height, int rowpixels) : bitmap_t(format, 32, base, width, height, rowpixels) { assert(valid_format(format)); } - bitmap32_t(bitmap_format format, bitmap32_t &source, const rectangle &subrect) : bitmap_t(format, 32, source, subrect) { } - - bitmap32_t &operator=(bitmap32_t &&) = default; +// 8bpp bitmaps +using bitmap8_t = bitmap_specific<uint8_t>; -public: - // getters - uint8_t bpp() const { return 32; } +// 16bpp bitmaps +using bitmap16_t = bitmap_specific<uint16_t>; - // pixel accessors - typedef uint32_t pixel_t; - pixel_t &pix(int32_t y, int32_t x = 0) const { return pixt<pixel_t>(y, x); } - pixel_t &pix32(int32_t y, int32_t x = 0) const { return pixt<pixel_t>(y, x); } -}; +// 32bpp bitmaps +using bitmap32_t = bitmap_specific<uint32_t>; // 64bpp bitmaps -class bitmap64_t : public bitmap_t -{ -private: - // private helpers - bool valid_format(bitmap_format format) const { return (format == BITMAP_FORMAT_IND64); } - -protected: - // construction/destruction -- subclasses only - bitmap64_t(bitmap64_t &&) = default; - bitmap64_t(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, 64, width, height, xslop, yslop) { assert(valid_format(format)); } - bitmap64_t(bitmap_format format, uint64_t *base, int width, int height, int rowpixels) : bitmap_t(format, 64, base, width, height, rowpixels) { assert(valid_format(format)); } - bitmap64_t(bitmap_format format, bitmap64_t &source, const rectangle &subrect) : bitmap_t(format, 64, source, subrect) { } - - bitmap64_t &operator=(bitmap64_t &&) = default; - -public: - // getters - uint8_t bpp() const { return 64; } - - // pixel accessors - typedef uint64_t pixel_t; - pixel_t &pix(int32_t y, int32_t x = 0) const { return pixt<pixel_t>(y, x); } - pixel_t &pix64(int32_t y, int32_t x = 0) const { return pixt<pixel_t>(y, x); } -}; +using bitmap64_t = bitmap_specific<uint64_t>; // ======================> bitmap_ind8, bitmap_ind16, bitmap_ind32, bitmap_ind64 diff --git a/src/mame/drivers/at.cpp b/src/mame/drivers/at.cpp index 84c25dc8fd9..78efdf3e29c 100644 --- a/src/mame/drivers/at.cpp +++ b/src/mame/drivers/at.cpp @@ -899,7 +899,7 @@ ROM_START( ibm5170 ) ROMX_LOAD( "6181028.u27", 0x10000, 0x8000, CRC(f6573f2a) SHA1(3e52cfa6a6a62b4e8576f4fe076c858c220e6c1a), ROM_SKIP(1) | ROM_BIOS(0)) /* T 6181028 8506AAA // TMM23256P-5878 // (C)IBM CORP 1981,-1984 */ ROMX_LOAD( "6181029.u47", 0x10001, 0x8000, CRC(7075fbb2) SHA1(a7b885cfd38710c9bc509da1e3ba9b543a2760be), ROM_SKIP(1) | ROM_BIOS(0)) /* T 6181029 8506AAA // TMM23256P-5879 // (C)IBM CORP 1981,-1984 */ - ROM_SYSTEM_BIOS( 1, "rev2", "IBM PC/AT 5170 06/10/85") /* Another verifaction of these crcs would be nice */ + ROM_SYSTEM_BIOS( 1, "rev2", "IBM PC/AT 5170 06/10/85") /* Another verification of these crcs would be nice */ ROMX_LOAD( "6480090.u27", 0x10000, 0x8000, CRC(99703aa9) SHA1(18022e93a0412c8477e58f8c61a87718a0b9ab0e), ROM_SKIP(1) | ROM_BIOS(1)) ROMX_LOAD( "6480091.u47", 0x10001, 0x8000, CRC(013ef44b) SHA1(bfa15d2180a1902cb6d38c6eed3740f5617afd16), ROM_SKIP(1) | ROM_BIOS(1)) @@ -1492,26 +1492,28 @@ ROM_START( at ) ROM_SYSTEM_BIOS(24, "ami_ft", "AMI Flying Triumph") /* (BIOS release date:: 12-06-1986) */ ROMX_LOAD( "286_access_methods_rom2_32k.bin", 0x10000, 0x8000, CRC(749c65af) SHA1(7c6e9e217afe020b7b36785549fdbfb89de8f872), ROM_SKIP(1) | ROM_BIOS(24) ) ROMX_LOAD( "286_access_methods_rom4_32k.bin", 0x10001, 0x8000, CRC(0f15581a) SHA1(2a22635f30388ca371f0f1f31652cfa647bb322d), ROM_SKIP(1) | ROM_BIOS(24) ) - // 25: 286 board with Headland GC101A-PC; GC102-PC chipset and Phoenix BIOS 2493119, ISA8: 2, ISA16: 5 - ROM_SYSTEM_BIOS(25, "head_ph_1", "Headland/Phoenix #1") // Phoenix 80286 ROM BIOS PLUS Version 3.10.21 ((BIOS release date:: 15-01-1988) - ROMX_LOAD( "286-headland-lo_32k.bin", 0x10000, 0x8000, CRC(21b68bed) SHA1(1e4acda50b12ad463c169ba615805f5dcf257b18), ROM_SKIP(1) | ROM_BIOS(25) ) - ROMX_LOAD( "286-headland-hi_32k.bin", 0x10001, 0x8000, CRC(04c8ab12) SHA1(b46c14528aca15464e4050b423c2f621a4313a85), ROM_SKIP(1) | ROM_BIOS(25) ) - // 26: MS-0010-2 - Phoenix ROM BIOS Version 3.06 - ROM_SYSTEM_BIOS(26, "ms-0010-2", "MS-0010-2") /* (BIOS release date:: 19-01-1987) (ISA8: 3, ISA16: 5) */ - ROMX_LOAD( "286-ms0010-2-lo_32k.bin", 0x10000, 0x8000, CRC(2c381474) SHA1(94b9825d412ea39d67857102a0375852b349fcd6), ROM_SKIP(1) | ROM_BIOS(26) ) - ROMX_LOAD( "286-ms0010-2-hi_32k.bin", 0x10001, 0x8000, CRC(4fdb8c64) SHA1(c2e7f88f0ac97ee5eed0c97864b7f1810e99ea26), ROM_SKIP(1) | ROM_BIOS(26) ) - // 27: CMP enterprise CO.LTD. Phoenix 80286 ROM BIOS Version 3.00 - ROM_SYSTEM_BIOS(27, "cmpa286", "CMP A286") /* (Chipset Acer (ALi) M1207-12) (BIOS release date:: 01-09-1986) (ISA8: 2, ISA16: 6) */ - ROMX_LOAD( "286-a286-even_16k.bin", 0x18000, 0x4000, CRC(30809487) SHA1(413de43ca7e1930cdf3c006718d8baf743a9ff1e), ROM_SKIP(1) | ROM_BIOS(27) ) - ROMX_LOAD( "286-a286-odd_16k.bin", 0x18001, 0x4000, CRC(3a11aacf) SHA1(23185531ae10912b974048d3607b563e55d3fa96), ROM_SKIP(1) | ROM_BIOS(27) ) - // 28: AL-6410 (found online, no markings on the board itself), Chipset: Chips P82A204, P82A203, P82A205, P82C201, P82C202 - ROM_SYSTEM_BIOS(28, "al6410", "AL-6410") /* (BIOS-String: D286-1103-110387-K0) (BIOS release date:: 03-11-1987) (ISA8: 2, ISA16: 6) */ - ROMX_LOAD( "al-6410_ami_bios_low.bin", 0x10000, 0x8000, CRC(50c4e121) SHA1(5f9c27aabdc6bb810e90bced2053b7c21c4994dd), ROM_SKIP(1) | ROM_BIOS(28) ) - ROMX_LOAD( "al-6410_ami_bios_high.bin", 0x10001, 0x8000, CRC(a44be083) SHA1(99f73d7ceb315eb3770c94d90228f8859cadc610), ROM_SKIP(1) | ROM_BIOS(28) ) - // 29: AT SYSTEM 6M/8M/10M - Chipset: Chips P82A205; P82C201; P82A203; P82A204 - ROM_SYSTEM_BIOS(29, "at6m8m10m", "AT SYSTEM 6M/8M/10M") /* (BIOS release date:: 04-02-1987) */ - ROMX_LOAD( "286-at system 6m8m10m-l_32k.bin", 0x10000, 0x8000, CRC(37e0e1c1) SHA1(f5cd17658554a73bb86c5c8e630dac3e34b38e51), ROM_SKIP(1) | ROM_BIOS(29) ) - ROMX_LOAD( "286-at system 6m8m10m-r_32k.bin", 0x10001, 0x8000, CRC(c672efff) SHA1(7224bb6b4d25ef34bc0aa9d7c450baf9b47fd917), ROM_SKIP(1) | ROM_BIOS(29) ) + // 25: MS-0010-2 - Phoenix ROM BIOS Version 3.06 + ROM_SYSTEM_BIOS(25, "ms-0010-2", "MS-0010-2") /* (BIOS release date:: 19-01-1987) (ISA8: 3, ISA16: 5) */ + ROMX_LOAD( "286-ms0010-2-lo_32k.bin", 0x10000, 0x8000, CRC(2c381474) SHA1(94b9825d412ea39d67857102a0375852b349fcd6), ROM_SKIP(1) | ROM_BIOS(25) ) + ROMX_LOAD( "286-ms0010-2-hi_32k.bin", 0x10001, 0x8000, CRC(4fdb8c64) SHA1(c2e7f88f0ac97ee5eed0c97864b7f1810e99ea26), ROM_SKIP(1) | ROM_BIOS(25) ) + // ***** Motherboards using the original Chips CS8220 chipset: P82C202, P82C201, P82A203, P82A204, P82A205 + // 26: AL-6410 (found online, no markings on the board itself), Chipset: Chips P82A204, P82A203, P82A205, P82C201, P82C202 + ROM_SYSTEM_BIOS(26, "al6410", "AL-6410") /* (BIOS-String: D286-1103-110387-K0) (BIOS release date:: 03-11-1987) (ISA8: 2, ISA16: 6) */ + ROMX_LOAD( "al-6410_ami_bios_low.bin", 0x10000, 0x8000, CRC(50c4e121) SHA1(5f9c27aabdc6bb810e90bced2053b7c21c4994dd), ROM_SKIP(1) | ROM_BIOS(26) ) + ROMX_LOAD( "al-6410_ami_bios_high.bin", 0x10001, 0x8000, CRC(a44be083) SHA1(99f73d7ceb315eb3770c94d90228f8859cadc610), ROM_SKIP(1) | ROM_BIOS(14) ) + // 27: AT SYSTEM 6M/8M/10M - Chipset: Chips P82A205; P82C201; P82A203; P82A204 - ISA8:2, ISA16: 6 + ROM_SYSTEM_BIOS(27, "at6m8m10m", "AT SYSTEM 6M/8M/10M") // (BIOS release date:: 04-02-1987) - OSC: 20.000000MHz - MQ-14.3 - 12.000 + ROMX_LOAD( "286-at system 6m8m10m-l_32k.bin", 0x10000, 0x8000, CRC(37e0e1c1) SHA1(f5cd17658554a73bb86c5c8e630dac3e34b38e51), ROM_SKIP(1) | ROM_BIOS(27) ) + ROMX_LOAD( "286-at system 6m8m10m-r_32k.bin", 0x10001, 0x8000, CRC(c672efff) SHA1(7224bb6b4d25ef34bc0aa9d7c450baf9b47fd917), ROM_SKIP(1) | ROM_BIOS(27) ) + // 28: CDTEK - BIOS-String: DSUN-1202-042088-K0 286-BIOS AMI for CDTEK - ISA8:2, ISA16:6 - Chipset ICs plus SN76LS612N, RTC MC146818P + ROM_SYSTEM_BIOS(28, "cdtekchips", "CDTEK 286") // ISA8:2, ISA16: 6 - OSC: 12.000, 14.31818, 16000.00KHz + ROMX_LOAD( "286-cdtek2-even_32k.bin", 0x10000, 0x8000, CRC(94867e8d) SHA1(12e61cc8b875b57324c93276c9f6093f2bd0e277), ROM_SKIP(1) | ROM_BIOS(28) ) + ROMX_LOAD( "286-cdtek2-odd_32k.bin", 0x10001, 0x8000, CRC(153ed3bd) SHA1(10b711e0f0d79e0b6d181f24fe66544d2d72a310), ROM_SKIP(1) | ROM_BIOS(28) ) + // 29: This board looks identical to #2 but has different chips fitted: SN76LS612N = Zymos HCT612, Chips P82A204 = TACT80204FN, P82A203 = STK-5134, P82A205 = STK-5135, + // P82C201 = STK-5132, P82C202 = STK-5133 - BIOS-String: Phoenix 80286 ROM BIOS Version 3.06 + ROM_SYSTEM_BIOS(29, "286tact", "286 TACT") // OSC: 20.0000MHz, 14.31818 - 24.000MHz + ROMX_LOAD( "286-tact-320548-1_32k.bin", 0x10000, 0x8000, CRC(0b528d19) SHA1(15f5a94d89461655c0f74681bbae5745db009ac2), ROM_SKIP(1) | ROM_BIOS(29) ) + ROMX_LOAD( "286-tact-320548-2_32k.bin", 0x10001, 0x8000, CRC(418aa2d0) SHA1(b6af0b8aa595d8f8de6c0fc851bf1c226dcc7ca7), ROM_SKIP(1) | ROM_BIOS(29) ) ROM_END ROM_START( atvga ) @@ -1567,6 +1569,23 @@ ROM_START( atvga ) ROM_SYSTEM_BIOS(13, "bravo", "AST Bravo/286") // fails with keyboard controller test, probably expects specific kbdc rom ROMX_LOAD( "107000-704.bin", 0x10000, 0x8000, CRC(94faf87e) SHA1(abaafa6c2ae9b9fba95b244dcbcc1c752ac6c0a0),ROM_SKIP(1) | ROM_BIOS(13) ) ROMX_LOAD( "107000-705.bin", 0x10001, 0x8000, CRC(e1263c1e) SHA1(b564f1043ef45ecbdf4f06bb500150ad992c2931),ROM_SKIP(1) | ROM_BIOS(13) ) + // ***** Motherboards using the original Chips CS8220 chipset: P82C202, P82C201, P82A203, P82A204, P82A205 + // 14: same as BIOS '26' in VGA + ROM_SYSTEM_BIOS(14, "al6410", "AL-6410") + ROMX_LOAD( "al-6410_ami_bios_low.bin", 0x10000, 0x8000, CRC(50c4e121) SHA1(5f9c27aabdc6bb810e90bced2053b7c21c4994dd), ROM_SKIP(1) | ROM_BIOS(14) ) + ROMX_LOAD( "al-6410_ami_bios_high.bin", 0x10001, 0x8000, CRC(a44be083) SHA1(99f73d7ceb315eb3770c94d90228f8859cadc610), ROM_SKIP(1) | ROM_BIOS(14) ) + // 15: same as BIOS '27' in VGA + ROM_SYSTEM_BIOS(15, "at6m8m10m", "AT SYSTEM 6M/8M/10M") + ROMX_LOAD( "286-at system 6m8m10m-l_32k.bin", 0x10000, 0x8000, CRC(37e0e1c1) SHA1(f5cd17658554a73bb86c5c8e630dac3e34b38e51), ROM_SKIP(1) | ROM_BIOS(15) ) + ROMX_LOAD( "286-at system 6m8m10m-r_32k.bin", 0x10001, 0x8000, CRC(c672efff) SHA1(7224bb6b4d25ef34bc0aa9d7c450baf9b47fd917), ROM_SKIP(1) | ROM_BIOS(15) ) + // 16: same as BIOS '28' in VGA + ROM_SYSTEM_BIOS(16, "cdtekchips", "CDTEK 286") + ROMX_LOAD( "286-cdtek2-even_32k.bin", 0x10000, 0x8000, CRC(94867e8d) SHA1(12e61cc8b875b57324c93276c9f6093f2bd0e277), ROM_SKIP(1) | ROM_BIOS(16) ) + ROMX_LOAD( "286-cdtek2-odd_32k.bin", 0x10001, 0x8000, CRC(153ed3bd) SHA1(10b711e0f0d79e0b6d181f24fe66544d2d72a310), ROM_SKIP(1) | ROM_BIOS(16) ) + // 17: same as BIOS '29' in VGA + ROM_SYSTEM_BIOS(17, "286tact", "286 TACT") + ROMX_LOAD( "286-tact-320548-1_32k.bin", 0x10000, 0x8000, CRC(0b528d19) SHA1(15f5a94d89461655c0f74681bbae5745db009ac2), ROM_SKIP(1) | ROM_BIOS(17) ) + ROMX_LOAD( "286-tact-320548-2_32k.bin", 0x10001, 0x8000, CRC(418aa2d0) SHA1(b6af0b8aa595d8f8de6c0fc851bf1c226dcc7ca7), ROM_SKIP(1) | ROM_BIOS(17) ) ROM_END // Chips & Technologies CS8221 NEAT chipset: P82C211 + P82C212 + P82C215 + P82C206 @@ -1588,6 +1607,18 @@ ROM_START( neat ) ROM_SYSTEM_BIOS(3, "ptm1233c", "DTK PTM-1233C") ROMX_LOAD( "286-dtk ptm-1233c-low_32k.bin", 0x10000, 0x8000, CRC(8909164c) SHA1(51978929a690746c1956ca6b1f0412777dc5d35b), ROM_SKIP(1) | ROM_BIOS(3) ) ROMX_LOAD( "286-dtk ptm-1233c-high_32k.bin", 0x10001, 0x8000, CRC(9105968c) SHA1(737d4df8040655315a648fed8a8d574f39e7dc35), ROM_SKIP(1) | ROM_BIOS(3) ) + // 4: 286-NEAT - BIOS-String: ENET-1131-040990-K0 - NEAT V3.2 6-18-90 - ISA8: 3, ISA16: 5 + ROM_SYSTEM_BIOS(4, "286neat", "286-NEAT") + ROMX_LOAD( "286-neat_neat012-l-verify.bin", 0x10000, 0x8000, CRC(591d226c) SHA1(7f42797ead8213022192bb2bbbe2de7f6796ac6f), ROM_SKIP(1) | ROM_BIOS(4) ) + ROMX_LOAD( "286-neat_neat012-h-verify.bin", 0x10001, 0x8000, CRC(0198e2e4) SHA1(10ced383b6dc00c2e98b7bed0782f59a9c266625), ROM_SKIP(1) | ROM_BIOS(4) ) + // 5: AUVA VIP BAM/16-11 - BIOS-String: Phoenix 80286 ROM BIOS PLUS Version 3.10 20 - ISA8:1, ISA16: 5, Memory Slot: 1 + ROM_SYSTEM_BIOS(5, "bam1611", "VIP BAM/16-11") // OSC: 18.432 - 14.318 - 32.000MHz + ROMX_LOAD( "286-vip bam-6-11 m215100-lo_32k.bin", 0x10000, 0x8000, CRC(b51b8bc1) SHA1(a7ebbced98aca32a7f0cdf80d1b832dfeb92d5e7), ROM_SKIP(1) | ROM_BIOS(5) ) + ROMX_LOAD( "286-vip bam-6-11 m215100-hi_32k.bin", 0x10001, 0x8000, CRC(46ddd5a6) SHA1(fd4267af298c7f70e062a7c4e023caf852bbf082), ROM_SKIP(1) | ROM_BIOS(5) ) + // 6: CP-805 - BIOS-String: ENET-1138-030390-K0 + ROM_SYSTEM_BIOS(6, "cp805", "CP-805") + ROMX_LOAD( "286-chips ami78384 even.bin", 0x10000, 0x8000, CRC(5280fee0) SHA1(25051ad6bbccddc0738861b614dbafbca5c3bff5), ROM_SKIP(1) | ROM_BIOS(6) ) + ROMX_LOAD( "286-chips ami78384 odd.bin", 0x10001, 0x8000, CRC(24526bf3) SHA1(8f8b46fe2e708fa53d0eeb44a16924cd878bdd33), ROM_SKIP(1) | ROM_BIOS(6) ) ROM_END @@ -1595,6 +1626,14 @@ ROM_END // 80286 motherboard //************************************************************************** +// Olivetti M203 motherboard - complains about "Timer Sync Error" +// on board Paradise PVGA1A VGA chip - Chipset: 2 TACT chips, one VLSI chip - one 16bit ISA "slot" in pin strip form intended for an expansion module +ROM_START( olim203 ) + ROM_REGION(0x20000, "bios", 0) + ROMX_LOAD( "286-olivetti-m203-low.bin", 0x00000, 0x10000, CRC(d683dc20) SHA1(04271529139724d7a091490658b186b59a83676f), ROM_SKIP(1) ) + ROMX_LOAD( "286-olivetti-m203-high.bin", 0x00001, 0x10000, CRC(c7324ecf) SHA1(fa5ee92c21e54ec711d01b211760521a71ef424d), ROM_SKIP(1) ) +ROM_END + // Snobol Mini 286 - BIOS-String: DGS2-1402-101090-K0 // Chipset: GST GOLD GS62C101 and GS62C102 ROM_START( snomi286 ) @@ -1621,16 +1660,6 @@ ROM_START( sarcpc ) ROM_LOAD( "sarcrev12.bin", 0x10000, 0x10000, CRC(1c5e3f2d) SHA1(1fcc8b1b9d9383467223dd41e420f9352beca654) ) ROM_END -// Toptek 286 Turbo (board name somewhat uncertain; 5x 8-bit ISA, 3x 16-bit ISA, 2 banks of onboard RAM + 2 banks expansion RAM) -// VLSI VL82C100 + VL82C101B + VL82C102A + VL82C103A + VL82C104; MC146818 or HM6818P RTC; unidentified keyboard controller -ROM_START( toptek286 ) - ROM_REGION(0x20000, "bios", 0) - // BIOS-String: D286-1295-091589-K0 - // Original BIOS64 dump split into even and odd bytes based on available PCB info - ROM_LOAD16_BYTE( "toptek_vlsi_even.bin", 0x10000, 0x8000, CRC(f35465e8) SHA1(c85afc2168e355120c63b68d5c11fce7770fe1b7) ) - ROM_LOAD16_BYTE( "toptek_vlsi_odd.bin", 0x10001, 0x8000, CRC(b7272729) SHA1(686c976b9b7989862846a79d00f1f9116f03bc17) ) -ROM_END - // Everex EV-1806 (6 16-bit ISA, 1 8-bit ISA) // Everex IC-00121-0 + IC-00122-0; CHIPS P82C206; Intel 8272A(?); 146818A RTC ROM_START( ev1806 ) @@ -1652,30 +1681,12 @@ ROM_START( ev1815 ) ROMX_LOAD( "award_v3.03gs_ev1815_odd.bin", 0x10001, 0x8000, CRC(5bcd9421) SHA1(f32e5a39da593c6982f964fb05b0802d54c3de45), ROM_SKIP(1) | ROM_BIOS(1) ) ROM_END -// KT216WB5-HI Rev.2 (1 8-bit ISA, 5 16-bit ISA) -// Winbond W83C201P + W83C202AP + W83C203AP + W83C204P + W83C205AP; MC146818AP RTC; JETkey keyboard BIOS -ROM_START( kt216wb5 ) - ROM_REGION(0x20000, "bios", 0) - // BIOS-String: D286-1149-083090-K0 - WIN 286 BIOS - ROMX_LOAD( "kt216wb5_even.bin", 0x10000, 0x8000, CRC(6b5509c0) SHA1(73b303b90cc0cd23b7e13362019193c938a2e502), ROM_SKIP(1) ) - ROMX_LOAD( "kt216wb5_odd.bin", 0x10001, 0x8000, CRC(af541ada) SHA1(26d2617dbe8c15f1b0d4782375bcb291a7923703), ROM_SKIP(1) ) -ROM_END - -// LM-103S (1 8-bit ISA, 6 16-bit ISA, 4 memory slots) -// Headland Technology G2 chipset: HT101A + 2x HT102; HM6818P RTC; AMI keyboard BIOS -ROM_START( lm103s ) - ROM_REGION(0x20000, "bios", 0) - // BIOS-String: D286-1234-121589-K0 - ROMX_LOAD( "ami_lm103-s_lo.bin", 0x10000, 0x8000, CRC(a24be20b) SHA1(ffc5faf6d773154bf2f037556d2e381e81a28a58), ROM_SKIP(1) ) - ROMX_LOAD( "ami_lm103-s_hi.bin", 0x10001, 0x8000, CRC(7b63e60c) SHA1(da78b95b12051b6d4701a412fdc5e7874595c188), ROM_SKIP(1) ) -ROM_END - // MAT286 REV.D (5 16-bit ISA, 1 8-bit ISA, 2 memory slots) // Headland Technology HT12P-16/A; HM6818P RTC; JETkey keyboard BIOS; unmarked 40-pin DIP ROM_START( mat286 ) ROM_REGION(0x20000, "bios", 0) - // BIOS-String: DH12-1112-061390-K0 - HT-12 286 BIOS + // BIOS-String: DH12-1112-061390-K0 - HT-12 286 BIOS - Board is also used in Polish Optimus 286 computer with a special Hercules character ROM (also available) // Files separated from single BIOS64 dump (PCB photo shows split ROMs are used) ROMX_LOAD( "9221fkf_imp23256_ami-l.bin", 0x10000, 0x08000, CRC(55deb5c2) SHA1(19ce1a7cc985b5895c585e39211475de2e3b0dd1), ROM_SKIP(1) ) ROMX_LOAD( "9221gjf_imp23256_ami-h.bin", 0x10001, 0x08000, CRC(04a2cec4) SHA1(564d37a8b2c0f4d0e23cd1e280a09d47c9945da8), ROM_SKIP(1) ) @@ -1709,15 +1720,122 @@ ROM_START ( mkp286 ) ROMX_LOAD( "286-morse_kp286_hi.bin", 0x10001, 0x8000, CRC(a5f640e0) SHA1(7bbb7fce54079005cb691816d2301a3eda475a82), ROM_SKIP(1) ) ROM_END -// Motherboards using the 5 chip VLSI chipset -// MG Products (Japanese) - Chipset: VLSI VL82C102A; VLSI VL82C101B; VLSI VL82C104; VLSI VL82C103A; VLSI VL82C100; (VLSI 8908BT; 8906BT; 8852BT; 8907BT; 8906BT) -// BIOS: AMI 286 BIOS+ - BIOS-String: D286-9987-092588-K0 - ISA8: 2, ISA16: 8 -// ROM_SYSTEM_BIOS(27, "286vlsij", "Japanese 286 VLSI") /* (BIOS release date:: 25-09-1988) (ISA8: 3, ISA16: 5) */ +// WYSEpc 286 - motherboard: WY-2200-01 - continuous ticks from the speaker +ROM_START( wy220001 ) + ROM_REGION(0x20000, "bios", 0) + ROMX_LOAD( "wyse_tech_rev.a_250325-02_27128-15.bin", 0x18000, 0x4000, CRC(010f1c4d) SHA1(712d6ca4e4bdbc6b105c8691d612407edcfd9cf7), ROM_SKIP(1)) + ROMX_LOAD( "wyse_tech_rev.a_250326-02_27128-15.bin", 0x18001, 0x4000, CRC(37fcd62b) SHA1(ada0e232387c8ba7067168f50f8b7a89eb824c44), ROM_SKIP(1)) +ROM_END + + +// ***** Motherboards using the Acer (ALi) M1207 chipset + +// CMP enterprise CO.LTD. Phoenix 80286 ROM BIOS Version 3.00 +// ROM_SYSTEM_BIOS(26, "cmpa286", "CMP A286") /* (Chipset Acer (ALi) M1207-12) (BIOS release date:: 01-09-1986) (ISA8: 2, ISA16: 6) */ +ROM_START ( cmpa286 ) + ROM_REGION(0x20000, "bios", 0) + ROMX_LOAD( "286-a286-even_16k.bin", 0x18000, 0x4000, CRC(30809487) SHA1(413de43ca7e1930cdf3c006718d8baf743a9ff1e), ROM_SKIP(1) ) + ROMX_LOAD( "286-a286-odd_16k.bin", 0x18001, 0x4000, CRC(3a11aacf) SHA1(23185531ae10912b974048d3607b563e55d3fa96), ROM_SKIP(1) ) +ROM_END + +// AUVA VIP-M21502A BAM16-A0 - BIOS-String: DAR2-1105-061390-K0 - 286-BIOS AMI for AUVA 286, 02/08/1991 - ISA8:2, ISA16:5 +ROM_START( bam16a0 ) + ROM_REGION(0x20000, "bios", 0) + ROMX_LOAD( "286-vip-m21502a-lo_32k.bin", 0x10000, 0x8000, CRC(413692db) SHA1(54bf664526b137cabf974c1fc659493e76243a88), ROM_SKIP(1) ) + ROMX_LOAD( "286-vip-m21502a-hi_32k.bin", 0x10001, 0x8000, CRC(5db9db04) SHA1(8085384b943454a708be3104b47f6793d0040ab1), ROM_SKIP(1) ) +ROM_END + + + +// ***** Motherboards using the Chips SCAT 82C235 chipset + +// Biostar MB-1212C - ISA8:2, ISA16:5 +ROM_START ( mb1212c ) + // 0: BIOS-String: ESC2-1223-083090-K2 - 286 BIOS AMI for MB-1212C version 1.1 + ROM_REGION(0x20000, "bios", 0) + ROM_SYSTEM_BIOS(0, "mb1212_1", "mb1212_1") + ROMX_LOAD( "biostar mb-1212c.bin", 0x10000, 0x10000, CRC(153a783a) SHA1(acad4a3ffe93d3884dcb743c32d6317a132cda7b), ROM_BIOS(0) ) + // 1: CHIPS SCAT BIOS Version 125D - MB-1212C + ROM_SYSTEM_BIOS(1, "mb1212_2", "mb1212_2") + ROMX_LOAD( "mb-1212c.bin", 0x10000, 0x10000, CRC(4675530a) SHA1(c34b1c67ac29695e565363f484e17ab5f8ddaad5), ROM_BIOS(1) ) +ROM_END + + +// ***** Motherboards using the Headland G2 chipset + +// LM-103S (1 8-bit ISA, 6 16-bit ISA, 4 memory slots) +// Headland Technology G2 chipset: HT101A + 2x HT102; HM6818P RTC; AMI keyboard BIOS +ROM_START( lm103s ) + ROM_REGION(0x20000, "bios", 0) + // BIOS-String: D286-1234-121589-K0 + ROMX_LOAD( "ami_lm103-s_lo.bin", 0x10000, 0x8000, CRC(a24be20b) SHA1(ffc5faf6d773154bf2f037556d2e381e81a28a58), ROM_SKIP(1) ) + ROMX_LOAD( "ami_lm103-s_hi.bin", 0x10001, 0x8000, CRC(7b63e60c) SHA1(da78b95b12051b6d4701a412fdc5e7874595c188), ROM_SKIP(1) ) +ROM_END + +// CDTEK board with Headland G2 chipset - ISA8:1, ISA16:5 +ROM_START ( cdtekg2 ) // BIOS-String: D286-1435-040990-K0 - Board is used in Polish California Access 286 with a special Hercules character ROM (also available) + ROM_REGION(0x20000, "bios", 0) + ROMX_LOAD( "286_cdtek headland-l_32k.bin", 0x10000, 0x8000, CRC(341fe2a3) SHA1(f8e10aea477c2b3c92b28a7e0fd0adf8ade22b9e), ROM_SKIP(1) ) + ROMX_LOAD( "286_cdtek headland-h_32k.bin", 0x10001, 0x8000, CRC(bd6fd54f) SHA1(72500ebe4041fbe635562bf55c5d3635257e38f1), ROM_SKIP(1) ) +ROM_END + +// Octek board with Headland G2 chipset - ISA8:2, ISA16:6 +//BIOS-String: 286 Modular BIOS Version 3.03 - O.O.A.L. +ROM_START ( octekg2 ) // BIOS-String: D286-1435-040990-K0 + ROM_REGION(0x20000, "bios", 0) + ROMX_LOAD( "286-octek-g2_u44_32k.bin", 0x10000, 0x8000, CRC(05892a08) SHA1(e12795524d87c422b0b5d660b36139592893e9c6), ROM_SKIP(1) ) + ROMX_LOAD( "286-octek-g2_u45_32k.bin", 0x10001, 0x8000, CRC(2f81de14) SHA1(952d9e35a6f8ea74eb8b4bf7ea80d7c358474cb8), ROM_SKIP(1) ) +ROM_END + + +ROM_START( headg2 ) + ROM_REGION( 0x20000, "bios", 0) + // 0: 286 board with Headland GC101A-PC; GC102-PC chipset and Phoenix BIOS 2493119, ISA8: 2, ISA16: 5 + ROM_SYSTEM_BIOS(0, "head_ph_1", "Headland/Phoenix #1") // Phoenix 80286 ROM BIOS PLUS Version 3.10.21 ((BIOS release date:: 15-01-1988) + ROMX_LOAD( "286-headland-lo_32k.bin", 0x10000, 0x8000, CRC(21b68bed) SHA1(1e4acda50b12ad463c169ba615805f5dcf257b18), ROM_SKIP(1) | ROM_BIOS(0) ) + ROMX_LOAD( "286-headland-hi_32k.bin", 0x10001, 0x8000, CRC(04c8ab12) SHA1(b46c14528aca15464e4050b423c2f621a4313a85), ROM_SKIP(1) | ROM_BIOS(0) ) + // 1: BIOS-String: 286 Modular BIOS Version 3.03HL - ISA16: 5 + ROM_SYSTEM_BIOS(1, "head4530", "Headland 4530") + ROMX_LOAD( "286-headland 4530-high_32k.bin", 0x10001, 0x8000, CRC(f84c0e75) SHA1(42dc068d1cd5105cd576b023e2ccfe0f0646d4e3), ROM_SKIP(1) | ROM_BIOS(1) ) + ROMX_LOAD( "286-headland 4530-low_32k.bin", 0x10000, 0x8000, CRC(0856dde8) SHA1(cee5d6002c405df984f3c7fa83c4f3e034f1e586), ROM_SKIP(1) | ROM_BIOS(1) ) +ROM_END + + +// ***** Motherboards using the 5 chip Winbond chipset W83C201P + W83C202AP + W83C203AP + W83C204P + W83C205AP + +// KT216WB5-HI Rev.2 (1 8-bit ISA, 5 16-bit ISA) +// Winbond W83C201P + W83C202AP + W83C203AP + W83C204P + W83C205AP; MC146818AP RTC; JETkey keyboard BIOS +ROM_START( kt216wb5 ) + ROM_REGION(0x20000, "bios", 0) + // BIOS-String: D286-1149-083090-K0 - WIN 286 BIOS + ROMX_LOAD( "kt216wb5_even.bin", 0x10000, 0x8000, CRC(6b5509c0) SHA1(73b303b90cc0cd23b7e13362019193c938a2e502), ROM_SKIP(1) ) + ROMX_LOAD( "kt216wb5_odd.bin", 0x10001, 0x8000, CRC(af541ada) SHA1(26d2617dbe8c15f1b0d4782375bcb291a7923703), ROM_SKIP(1) ) +ROM_END + +// KMA-202F-12R - ISA16:7 - BIOS-String: 286 Modular BIOS Version 3.11 +// Winbond W83C201P + W83C202AP + W83C203AP + W83C204P + W83C205AP; DS12887+ RTC; AWARD keyboard BIOS +ROM_START( kma202f ) + ROM_REGION(0x20000, "bios", 0) + ROMX_LOAD( "286_lo.bin", 0x10000, 0x8000, CRC(0ce69691) SHA1(6904ac54f30f2244058653aaa623804dd02b4332), ROM_SKIP(1) ) + ROMX_LOAD( "286_hi.bin", 0x10001, 0x8000, CRC(1330b6f2) SHA1(691bb4a51ce3d9a026ee33c3fd02fc4e13b4a184), ROM_SKIP(1) ) +ROM_END + + +// ***** Motherboards using the 5 chip VLSI chipset + ROM_START( vlsi5 ) ROM_REGION(0x20000, "bios", 0) - ROMX_LOAD( "286-vlsi_japan-2-even_32k.bin", 0x10000, 0x8000, CRC(e3e64cbc) SHA1(5259e3c8686f2239a5fb0dc38aa80380ef9ec5fa), ROM_SKIP(1) ) - ROMX_LOAD( "286-vlsi_japan-2-odd_32k.bin", 0x10001, 0x8000, CRC(aa533f39) SHA1(d88c7d4029a283b94b99e2017d29fbf9eb9105b1), ROM_SKIP(1) ) + // 0: MG Products (Japanese) - Chipset: VLSI VL82C102A; VLSI VL82C101B; VLSI VL82C104; VLSI VL82C103A; VLSI VL82C100; (VLSI 8908BT; 8906BT; 8852BT; 8907BT; 8906BT) + // BIOS: AMI 286 BIOS+ - BIOS-String: D286-9987-092588-K0 - ISA8: 2, ISA16: 8 + // (BIOS release date:: 25-09-1988) (ISA8: 3, ISA16: 5) + ROM_SYSTEM_BIOS(0, "286vlsij", "Japanese 286 VLSI") + ROMX_LOAD( "286-vlsi_japan-2-even_32k.bin", 0x10000, 0x8000, CRC(e3e64cbc) SHA1(5259e3c8686f2239a5fb0dc38aa80380ef9ec5fa), ROM_SKIP(1) | ROM_BIOS(0) ) + ROMX_LOAD( "286-vlsi_japan-2-odd_32k.bin", 0x10001, 0x8000, CRC(aa533f39) SHA1(d88c7d4029a283b94b99e2017d29fbf9eb9105b1), ROM_SKIP(1) | ROM_BIOS(0) ) + // 1: BIOS-String: D286-1223-121589-K0 - 286-BIOS AMI for MBVLSI-168 - ISA8: 3, ISA16: 5 + ROM_SYSTEM_BIOS(1, "mbvlsi168", "MBVLSI-168") + ROMX_LOAD( "286-vlsi-002350-041_32k.bin", 0x10000, 0x8000, CRC(0e0e2bc9) SHA1(0af05b15ea8141ece84fb4420e6a21720f01c7a6), ROM_SKIP(1) | ROM_BIOS(1) ) + ROMX_LOAD( "286-vlsi-002350-042_32k.bin", 0x10001, 0x8000, CRC(5ef7b91d) SHA1(d57c7f4c8d28708f128c5f0b1251d5943c7cdf76), ROM_SKIP(1) | ROM_BIOS(1) ) ROM_END // Uniron U3911-V3 - Chipset as above - BIOS-String: Phoenix 80286 ROM BIOS PLUS Version 3.10 00 - P/N 891012 - 80286 @@ -1727,6 +1845,16 @@ ROM_START( u3911v3 ) ROMX_LOAD( "286-uniron-u14_32k.bin", 0x10000, 0x8000, CRC(d2e9c52a) SHA1(ff6726b527b0bebed50c053a698e1b61aada3043), ROM_SKIP(1) ) ROM_END +// Toptek 286 Turbo (board name somewhat uncertain; 5x 8-bit ISA, 3x 16-bit ISA, 2 banks of onboard RAM + 2 banks expansion RAM) +// VLSI VL82C100 + VL82C101B + VL82C102A + VL82C103A + VL82C104; MC146818 or HM6818P RTC; unidentified keyboard controller +ROM_START( toptek286 ) + ROM_REGION(0x20000, "bios", 0) + // BIOS-String: D286-1295-091589-K0 + // Original BIOS64 dump split into even and odd bytes based on available PCB info + ROM_LOAD16_BYTE( "toptek_vlsi_even.bin", 0x10000, 0x8000, CRC(f35465e8) SHA1(c85afc2168e355120c63b68d5c11fce7770fe1b7) ) + ROM_LOAD16_BYTE( "toptek_vlsi_odd.bin", 0x10001, 0x8000, CRC(b7272729) SHA1(686c976b9b7989862846a79d00f1f9116f03bc17) ) +ROM_END + // ***** Motherboards using the 5 chip SUNTAC chipset @@ -1773,16 +1901,21 @@ ROM_START( mba009) ROM_END - // ***** Motherboards using the Headland HT12/A chipset -// Octek Fox II - Chipset: Headland HT12/A - BIOS String: -ROM_START( o286foxii) +// Octek Fox II - Chipset: Headland HT12/A - BIOS String: DH1X-6069-113090-K0 - HT-1X 286 BIOS +ROM_START( o286foxii ) ROM_REGION(0x20000, "bios", 0) ROMX_LOAD( "286-fox2-even_32k.bin", 0x10000, 0x8000, CRC(54dc119f) SHA1(4bc543beef0d2201fa20eac90a0a6ca38ebf0dbf), ROM_SKIP(1)) ROMX_LOAD( "286-fox2-odd_32k.bin", 0x10001, 0x8000, CRC(e5db7775) SHA1(2bd0572b9f7c76eff51375b551586ca8484e2a74), ROM_SKIP(1)) ROM_END +// BI-025C HT12 286 - Chipset: Headland HT12/A - BIOS-String: DH12-1103-061390-K0 - ISA8: 2, ISA16: 5 +ROM_START( bi025c ) + ROM_REGION(0x20000, "bios", 0) + ROMX_LOAD( "bi-025c-ht12_even.bin", 0x10000, 0x8000, CRC(7ea7e088) SHA1(e245b3ecce39e85cacb17abf60d2cee000d1750d), ROM_SKIP(1)) + ROMX_LOAD( "bi-025c-ht12_odd.bin", 0x10001, 0x8000, CRC(f18b3eef) SHA1(e14d4b3ea0234613e60512cf79e5580c9ce7f3f6), ROM_SKIP(1)) +ROM_END ROM_START( ht12a ) ROM_REGION(0x20000, "bios", 0) @@ -1922,6 +2055,7 @@ ROM_END // 80286 Notebook/Laptop/Portable //************************************************************************** + // Compaq Portable II // Chips: Intel D8742, SN76LS612N, 2x NEC D8237AC-5, 2xIntel P8259A-2, MC146818AP, Intel P8254 // Enhanced Color Graphics board: Chips P82C431, P82C434A @@ -1997,7 +2131,7 @@ ROM_START( at386sx ) // 1: BIOS-String: 30-0400-428027-00101111-070791-SCMPSX-0 / VLSI SCAMP 386SX 16/20/25MHz ROM_SYSTEM_BIOS(1, "scamp", "VLSI SCAMPSX") ROMX_LOAD( "ami_386sx_vlsi_scamp_070791.bin", 0x10000, 0x10000, CRC(082d071c) SHA1(69af9a951f138146036b3c9ac3761cc6589b6cf5), ROM_BIOS(1)) - // 2: NCR 386 CPU card + // 2: NCR 386 CPU card - Chipset: TACT82301PB, TACT82302PB, TACT82303PB ROM_SYSTEM_BIOS(2, "ncr386sx", "NCR 386sx card") // Upgrade card for e.g. NCR PC-8 - Setup Version 2.7.1 ROMX_LOAD( "ncr_386sx_u12-19_7.3.bin", 0x10001, 0x8000, CRC(9e4c9a2a) SHA1(0a45d9f04f03b7ae39734916af7786bc52e5e917), ROM_SKIP(1) | ROM_BIOS(2)) ROMX_LOAD( "ncr_386sx_u46-17_7.3.bin", 0x10000, 0x8000, CRC(73ad83a2) SHA1(bf6704fb4a0da37251f192cea3af2bc8cc2e9cdb), ROM_SKIP(1) | ROM_BIOS(2)) @@ -2029,11 +2163,11 @@ ROM_START( at386 ) ROM_SYSTEM_BIOS(2, "amicg", "AMI CG") ROMX_LOAD( "amicg.1", 0x10000, 0x10000,CRC(8408965a) SHA1(9893d3ac851e01b06a68a67d3721df36ca2c96f5), ROM_BIOS(2)) // 3: - ROM_SYSTEM_BIOS(3, "msi386", "MSI 386") // MSI 386 mainboard, initializes graphics card, then hangs + ROM_SYSTEM_BIOS(3, "msi386", "MSI 386") // MSI 386 mainboard, initializes graphics card, then hangs - Chipset: Chips P82A304, P82A303, P82A302C, 2xP82B305, P82C301C, P82A306A, ROMX_LOAD( "ami_386_msi_02297_even.bin", 0x10000, 0x8000, CRC(768590a0) SHA1(90c5203d78591a093fd4f54ceb8d9827f1e64f39), ROM_SKIP(1) | ROM_BIOS(3) ) ROMX_LOAD( "ami_386_msi_02297_odd.bin", 0x10001, 0x8000, CRC(7b1360dc) SHA1(552ccda9f90826621e88d9abdc47306b9c2b2b15), ROM_SKIP(1) | ROM_BIOS(3) ) // 4: BIOS-String: 20-0200-DF1121-00101111-102591-SYM_386B-0 / 386DX/SX (S1A.P) - ROM_SYSTEM_BIOS(4, "386sc2c", "386-SC-2C") + ROM_SYSTEM_BIOS(4, "386sc2c", "386-SC-2C") // Chipset: SYMPHONY SL82C362, SL82C461, SL82C465 ROMX_LOAD("386-sc-2c_ami_za492668.bin", 0x10000, 0x10000, CRC(b408eeb7) SHA1(cf1974492119e1aae623fa366d5760343e827e52), ROM_BIOS(4) ) // 5: BIOS-String: EC&T-1332-040990-K0 ROM_SYSTEM_BIOS(5, "cs8230", "CS8230") @@ -2043,14 +2177,14 @@ ROM_START( at386 ) ROMX_LOAD( "ami2939e.rom", 0x10000, 0x8000, CRC(65cbbd32) SHA1(d7d26b496f8e86f01722ad9f171a68f9fcdc477c), ROM_SKIP(1) | ROM_BIOS(6) ) ROMX_LOAD( "ami2939o.rom", 0x10001, 0x8000, CRC(8db6e739) SHA1(cdd47709d6036fad4be40c15bff41752d831d4b8), ROM_SKIP(1) | ROM_BIOS(6) ) // 7: NCR 386 slot CPU - Upgrade card for e.g. NCR PC-8 - set graphics card to CGA to see a "Timer One Error" message - ROM_SYSTEM_BIOS(7, "ncr386", "NCR 386 CPU card") + ROM_SYSTEM_BIOS(7, "ncr386", "NCR 386 CPU card") // Chipset: SN76LS612PN, 2xAM9517A-5JC, NCR 006-3500402PT M472018 8650A ROMX_LOAD( "ncr_386_card_04152_u44_ver5.0.bin", 0x10000, 0x10000, CRC(80e44318) SHA1(54e1d4d646a577c53c65b2292b383ed6d91b65b2), ROM_BIOS(7)) // ROM_LOAD ("ncr_386_card_keyboard_04181_u27_ver5.6.bin", 0x0000, 0x800, CRC(6c9004e7) SHA1(0fe77f47ff77333d1ff9bfcf8d6d92193ab1f208)) // 8: BIOS-String: Phoenix 80386 ROM BIOS PLUS Version 1.10 22 ROM_SYSTEM_BIOS(8, "cbm386", "Commodore 386") ROMX_LOAD( "cbm-386-bios-lo-v1.022e-8100.bin", 0x10000, 0x8000, CRC(a054a1b8) SHA1(d952b02cc10534325c1c5aaa8b6dfb77bc20a179), ROM_SKIP(1) | ROM_BIOS(8)) ROMX_LOAD( "cbm-386-bios-hi-v1.022e-d100.bin", 0x10001, 0x8000, CRC(b9541f3d) SHA1(e37c704521e85b07369d21b0521f4d1871c318dd), ROM_SKIP(1) | ROM_BIOS(8)) - // 9: flashing "K/B controller incorrect" + // 9: flashing "K/B controller incorrect" - Chipset: ALi M1217-40 ROM_SYSTEM_BIOS(9, "gmb386sat", "GMB-386SAT_V1.0") ROMX_LOAD( "gmb-386sat_v1.0.bin", 0x10000, 0x10000, CRC(59ecc773) SHA1(f2007fce76b3a91f51bfb5f43c1539d5ae06d35f), ROM_BIOS(9)) // 10: BIOS-String: X0-0100-000000-00101111-060692-RC2018A-0 / Ver 1.4b / Texas Instruments 486 DLC [S3Q] @@ -2258,46 +2392,46 @@ ROM_START( at486 ) // 5: BIOS-String: 04/08/96-VT82C486A-214L2000-00 / Version 3.27GN1 ROM_SYSTEM_BIOS(5, "ficgacv", "FIC 486-GAC-V 3.27GN1") /* includes CL-GD542X VGA BIOS 1.41 */ ROMX_LOAD( "327gn1.awd", 0x00000, 0x20000, CRC(017614d4) SHA1(2228c28f21a7e78033d24319449297936465b164), ROM_BIOS(5)) - // 6: BIOS-String: 05/06/94-VT82C486A-214L2000-00 / Version 3.15GN - ROM_SYSTEM_BIOS(6, "ficgiovp", "FIC 486-GIO-VP 3.15GN") + // 6: BIOS-String: 05/06/94-VT82C486A-214L2000-00 / Version 3.15GN - ISA16:4, ISA/VL: 2 + ROM_SYSTEM_BIOS(6, "ficgiovp", "FIC 486-GIO-VP 3.15GN") // Chipset: VIP VT82C486A, Promise PDC20230C, one further VIA, one other unreadable ROMX_LOAD( "giovp315.rom", 0x10000, 0x10000, CRC(e102c3f5) SHA1(f15a7e9311cc17afe86da0b369607768b030ddec), ROM_BIOS(6)) - // 7: BIOS-String: 11/20/94-VT82C486A-214L2000-00 / Version 3.06G (11/25/94) - ROM_SYSTEM_BIOS(7, "ficgiovt", "FIC 486-GIO-VT 3.06G") /* 1994-11-20 */ + // 7: BIOS-String: 11/20/94-VT82C486A-214L2000-00 / Version 3.06G (11/25/94) - OSC: 24.0L3P - ISA16:3, ISA/VL: 2 + ROM_SYSTEM_BIOS(7, "ficgiovt", "FIC 486-GIO-VT 3.06G") // 1994-11-20 - Chipset: Winbond W83757AF, W83758P, VIA VT82C486A, VT8255N, VT82C482 ROMX_LOAD( "306gcd00.awd", 0x10000, 0x10000, CRC(75f3ded4) SHA1(999d4b58204e0b0f33262d0613c855b528bf9597), ROM_BIOS(7)) - // 8: BIOS-String: 07/06/VT82C486A-214L2000-00 / Version 3.26G - ROM_SYSTEM_BIOS(8, "ficgiovt2_326", "FIC 486-GIO-VT2 3.26G") + // 8: BIOS-String: 07/06/VT82C486A-214L2000-00 / Version 3.26G - ISA8: 1, ISA16: 3, ISA/VL: 2 + ROM_SYSTEM_BIOS(8, "ficgiovt2_326", "FIC 486-GIO-VT2 3.26G") // Chipset: Winbond W83758P, Winbond W83757AF, VIA VT82C482, VT82C486A, VT82C461 ROMX_LOAD( "326g1c00.awd", 0x10000, 0x10000, CRC(2e729ab5) SHA1(b713f97fa0e0b62856dab917f417f5b21020b354), ROM_BIOS(8)) // 9: BIOS-String: 06/19/95-VT82C486A-214L2000-00 / Version VBS1.08H 486-GIO-VT2 - ROM_SYSTEM_BIOS(9, "486_gio_vt2","VBS1.08H 486-GVT-2") + ROM_SYSTEM_BIOS(9, "486_gio_vt2","VBS1.08H 486-GVT-2") // Chipset: VIA VT82C486A, VT82C482 - ISA16: 4, ISA/VL: 2 ROMX_LOAD( "award_486_gio_vt2.bin", 0x10000, 0x10000, CRC(58d7c7f9) SHA1(097f15ec2bd672cb3f1763298ca802c7ff26021f), ROM_BIOS(9)) // Vobis version, Highscreen boot logo // 10: BIOS-String: 07/17/97-VT82C486A-214L2000-00 / Version 3.276 ROM_SYSTEM_BIOS(10, "ficgiovt2_3276", "FIC 486-GIO-VT2 3.276") ROMX_LOAD( "32760000.bin", 0x10000, 0x10000, CRC(ad179128) SHA1(595f67ba4a1c8eb5e118d75bf657fff3803dcf4f), ROM_BIOS(10)) - // 11: BIOS-String: 11/02/94-VT82C486A-214L2000-00 Version 3.07G - ROM_SYSTEM_BIOS(11, "ficgvt2", "FIC 486-GVT-2 3.07G") + // 11: BIOS-String: 11/02/94-VT82C486A-214L2000-00 Version 3.07G - ISA8: 1, ISA16: 4, ISA/VL: 2 + ROM_SYSTEM_BIOS(11, "ficgvt2", "FIC 486-GVT-2 3.07G") // Chipset: VIA VT82C486A, VT82C482, VIA VT8255N ROMX_LOAD( "3073.bin", 0x10000, 0x10000, CRC(a6723863) SHA1(ee93a2f1ec84a3d67e267d0a490029f9165f1533), ROM_BIOS(11)) - // 12: BIOS-String: 06/27/95-VT82C505-2A4L4000-00 / Version 5.15S + // 12: BIOS-String: 06/27/95-VT82C505-2A4L4000-00 / Version 5.15S - Chipset: S3 Trio64, FDC 37665GT, VT82C496G, VT82C406MV ROM_SYSTEM_BIOS(12, "ficgpak2", "FIC 486-PAK-2 5.15S") /* includes Phoenix S3 TRIO64 Enhanced VGA BIOS 1.4-01 */ ROMX_LOAD( "515sbd8a.awd", 0x00000, 0x20000, CRC(778247e1) SHA1(07d8f0f2464abf507be1e8dfa06cd88737782411), ROM_BIOS(12)) - // 13 - ROM_SYSTEM_BIOS(13, "ficpio3g7", "FIC 486-PIO-3 1.15G705") /* pnp */ + // 13: runs into Award BootBlock BIOS - Chipset: VIA VT82C505, VT82C416, VT82C496G, Winbond W83787F + ROM_SYSTEM_BIOS(13, "ficpio3g7", "FIC 486-PIO-3 1.15G705") // pnp - ISA16: 4, PCI: 3 ROMX_LOAD( "115g705.awd", 0x00000, 0x20000, CRC(ddb1544a) SHA1(d165c9ecdc9397789abddfe0fef69fdf954fa41b), ROM_BIOS(13)) - // 14 + // 14 runs into Award BootBlock BIOS ROM_SYSTEM_BIOS(14, "ficpio3g1", "FIC 486-PIO-3 1.15G105") /* non-pnp */ ROMX_LOAD( "115g105.awd", 0x00000, 0x20000, CRC(b327eb83) SHA1(9e1ff53e07ca035d8d43951bac345fec7131678d), ROM_BIOS(14)) - // 15 + // 15 runs into Award BootBlock BIOS ROM_SYSTEM_BIOS(15, "ficpos", "FIC 486-POS") ROMX_LOAD( "116di6b7.bin", 0x00000, 0x20000, CRC(d1d84616) SHA1(2f2b27ce100cf784260d8e155b48db8cfbc63285), ROM_BIOS(15)) - // 16: BIOS-String: 06/27/95-VT82C505-2A4L4000-00 / Version 5.15 - ROM_SYSTEM_BIOS(16, "ficpvt", "FIC 486-PVT 5.15") + // 16: BIOS-String: 06/27/95-VT82C505-2A4L4000-00 / Version 5.15 / Chipset: VIA VT82C496G PC/AT + ROM_SYSTEM_BIOS(16, "ficpvt", "FIC 486-PVT 5.15") // ISA16: 6, ISA/VL: 2 ROMX_LOAD( "5150eef3.awd", 0x00000, 0x20000, CRC(eb35785d) SHA1(1e601bc8da73f22f11effe9cdf5a84d52576142b), ROM_BIOS(16)) // 17: BIOS-String: 10/05/95-VT82C505-2A4L4000-00 / Version 5.162W2(PCTIO) - ROM_SYSTEM_BIOS(17, "ficpvtio", "FIC 486-PVT-IO 5.162W2") + ROM_SYSTEM_BIOS(17, "ficpvtio", "FIC 486-PVT-IO 5.162W2") // Chipset: VT82C406MV, VT82C496G, W83777/83787F, W83758P ROMX_LOAD( "5162cf37.awd", 0x00000, 0x20000, CRC(378d813d) SHA1(aa674eff5b972b31924941534c3c988f6f78dc93), ROM_BIOS(17)) // 18: BIOS-String: 40-0401-428003-00101111-111192-OP495SLC-0 / PX486DX33/50P3 IVN 1.0 25/06/1993 - ROM_SYSTEM_BIOS(18, "qdi", "QDI PX486DX33/50P3") + ROM_SYSTEM_BIOS(18, "qdi", "QDI PX486DX33/50P3") // OPTi-SLC (82C495SLC & 82C206) - ISA8: 1, ISA16: 3, ISA/VL: 3 ROMX_LOAD( "qdi_px486.u23", 0x10000, 0x10000, CRC(c80ecfb6) SHA1(34cc9ef68ff719cd0771297bf184efa83a805f3e), ROM_BIOS(18)) - // 19: BIOS-String: 40-00AG-001247-00101111-060692-SIS3486-0 / AV4 ISA/VL-BUS SYSTEM BIOS + // 19: BIOS-String: 40-00AG-001247-00101111-060692-SIS3486-0 / AV4 ISA/VL-BUS SYSTEM BIOS / Chipset: SIS 85C460ATQ ROM_SYSTEM_BIOS(19, "ava4529j", "AVA4529J") // this is a board with two VLB slots ROMX_LOAD("amibios_486dx_isa_bios_aa4025963.bin", 0x10000, 0x10000, CRC(65558d9e) SHA1(2e2840665d069112a2c7169afec687ad03449295), ROM_BIOS(19)) ROM_END @@ -2568,6 +2702,7 @@ COMP( 1995, aa486s, ibm5170, 0, at486, 0, at_state, init_at COMP( 1994, a486sv1, ibm5170, 0, at486, 0, at_state, init_at, "Asus", "VL/EISA-486SV1", MACHINE_NOT_WORKING ) COMP( 1994, a486sv2g, ibm5170, 0, at486, 0, at_state, init_at, "Asus", "VL/I-486SV2G", MACHINE_NOT_WORKING ) COMP( 199?, mb8433uud, ibm5170, 0, at486, 0, at_state, init_at, "Biostar", "MB8433-UUD-A", MACHINE_NOT_WORKING ) // lands in Award BootBlock BIOS +COMP( 199?, mb1212c, ibm5170, 0, atvga, 0, at_state, init_at, "Biostar", "MB-1212C", MACHINE_NOT_WORKING ) COMP( 1990, c386sx16, ibm5170, 0, at386sx, 0, at_state, init_at, "Commodore Business Machines", "386SX-16", MACHINE_NOT_WORKING ) COMP( 199?, dt386, ibm5170, 0, at386, 0, at_state, init_at, "Commodore Business Machines", "DT386", MACHINE_NOT_WORKING ) COMP( 199?, dt486, ibm5170, 0, at486, 0, at_state, init_at, "Commodore Business Machines", "DT486", MACHINE_NOT_WORKING ) @@ -2588,12 +2723,19 @@ COMP( 1994, ficvipio, ibm5170, 0, at486, 0, at_state, init_at COMP( 199?, ficvipio2, ibm5170, 0, at486, 0, at_state, init_at, "First International Computer", "486-VIP-IO2", MACHINE_NOT_WORKING ) COMP( 199?, hot409, ibm5170, 0, at486, 0, at_state, init_at, "Shuttle Computer International", "HOT-409", MACHINE_NOT_WORKING ) COMP( 198?, aubam12s2, ibm5170, 0, atvga, 0, at_state, init_at, "AUVA COMPUTER, INC.", "BAM/12-S2", MACHINE_NOT_WORKING ) +COMP( 198?, wy220001, ibm5170, 0, ibm5162, 0, at_state, init_at, "Wyse", "WYSEpc 286", MACHINE_NOT_WORKING ) COMP( 198?, mkp286, ibm5170, 0, atvga, 0, at_state, init_at, "Morse", "KP-286", MACHINE_NOT_WORKING ) COMP( 198?, pccm205, ibm5170, 0, atvga, 0, at_state, init_at, "PC-Chips", "M205", MACHINE_NOT_WORKING ) COMP( 199?, pccm321, ibm5170, 0, at386, 0, at_state, init_at, "PC-Chips", "M321", MACHINE_NOT_WORKING ) COMP( 199?, pccm326, ibm5170, 0, at386, 0, at_state, init_at, "PC-Chips", "M326", MACHINE_NOT_WORKING ) COMP( 199?, pccm919, ibm5170, 0, at486, 0, at_state, init_at, "PC-Chips", "M919", MACHINE_NOT_WORKING ) COMP( 198?, snomi286, ibm5170, 0, atvga, 0, at_state, init_at, "Snobol", "Mini 286", MACHINE_NOT_WORKING ) +COMP( 198?, cmpa286, ibm5170, 0, atvga, 0, at_state, init_at, "CMP enterprise CO.LTD.", "286 motherboard", MACHINE_NOT_WORKING ) +COMP( 198?, bam16a0, ibm5170, 0, atvga, 0, at_state, init_at, "AUVA", "VIP-M21502A BAM16-A0", MACHINE_NOT_WORKING ) +COMP( 199?, olim203, ibm5170, 0, atvga, 0, at_state, init_at, "Olivetti", "M203 motherboard", MACHINE_NOT_WORKING ) +COMP( 199?, cdtekg2, ibm5170, 0, atvga, 0, at_state, init_at, "CDTEK", "286 motherboard with Headland G2 chipset", MACHINE_NOT_WORKING ) +COMP( 199?, octekg2, ibm5170, 0, atvga, 0, at_state, init_at, "Octek", "286 mainboard with Headland G2 chipset", MACHINE_NOT_WORKING ) +COMP( 199?, headg2, ibm5170, 0, atvga, 0, at_state, init_at, "<unknown>", "286 motherboards with Headland G2 chipset", MACHINE_NOT_WORKING ) COMP( 199?, sy019hi, ibm5170, 0, at386, 0, at_state, init_at, "Soyo", "SY-019H and SY-019I", MACHINE_NOT_WORKING ) COMP( 199?, suntac5, ibm5170, 0, at386, 0, at_state, init_at, "<unknown>", "286 motherboards with 5-chip SUNTAC chipset", MACHINE_NOT_WORKING ) COMP( 198?, vlsi5, ibm5170, 0, atvga, 0, at_state, init_at, "<unknown>", "286 motherboards with 5-chip VLSI chipset", MACHINE_NOT_WORKING ) @@ -2606,6 +2748,8 @@ COMP( 1992, mbc28, ibm5170, 0, at386sx, 0, at_state, init_at COMP( 199?, sarcpc, ibm5170, 0, ibm5162, 0, at_state, init_at, "<unknown>", "80286 Standard System (SARC RC2015 chipset)", MACHINE_NOT_WORKING ) COMP( 199?, sm38640f, ibm5170, 0, at386, 0, at_state, init_at, "<unknown>", "SM 386-40F (Forex chipset)", MACHINE_NOT_WORKING ) COMP( 199?, 4nd04a, ibm5170, 0, at386, 0, at_state, init_at, "<unknown>", "386-4N-D04A (UMC chipset)", MACHINE_NOT_WORKING ) +COMP( 199?, bi025c, ibm5170, 0, atvga, 0, at_state, init_at, "<unknown>", "BI-025C HT-12 286 (HT12/A chipset)", MACHINE_NOT_WORKING ) +COMP( 199?, kma202f, ibm5170, 0, atvga, 0, at_state, init_at, "<unknown>", "KMA-202F-12R (Winbond chipset)", MACHINE_NOT_WORKING ) COMP( 1986, pcd2, ibm5170, 0, ibm5170, 0, at_state, init_at, "Siemens", "PCD-2", MACHINE_NOT_WORKING ) COMP( 199?, pcd3nsx, ibm5170, 0, at386sx, 0, at_state, init_at, "Siemens-Nixdorf", "PCD-3Nsx Notebook Computer", MACHINE_NOT_WORKING ) COMP( 199?, pcd4x, ibm5170, 0, at486, 0, at_state, init_at, "Siemens-Nixdorf", "PCD-4H, PCD-4M", MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/karnov.cpp b/src/mame/drivers/karnov.cpp index 6e1a68bda52..31b9a48dd19 100644 --- a/src/mame/drivers/karnov.cpp +++ b/src/mame/drivers/karnov.cpp @@ -1004,8 +1004,8 @@ ROM_START( karnov ) ROM_LOAD( "dn19-5", 0x58000, 0x08000, CRC(8fd4fa40) SHA1(1870fb0c5c64fbc53a10115f0f3c7624cf2465db) ) ROM_REGION( 0x0800, "proms", 0 ) - ROM_LOAD( "karnprom_21.k8", 0x0000, 0x0400, CRC(aab0bb93) SHA1(545707fbb1007fca1fe297c5fce61e485e7084fc) ) - ROM_LOAD( "karnprom_20.l6", 0x0400, 0x0400, CRC(02f78ffb) SHA1(cb4dd8b0ce3c404195321b17e10f51352f506958) ) + ROM_LOAD( "dn-21.k8", 0x0000, 0x0400, CRC(aab0bb93) SHA1(545707fbb1007fca1fe297c5fce61e485e7084fc) ) /* MB7132E BPROM */ + ROM_LOAD( "dn-20.l6", 0x0400, 0x0400, CRC(02f78ffb) SHA1(cb4dd8b0ce3c404195321b17e10f51352f506958) ) /* MB7122E BPROM */ ROM_END ROM_START( karnova ) @@ -1043,8 +1043,8 @@ ROM_START( karnova ) ROM_LOAD( "dn19-5", 0x58000, 0x08000, CRC(8fd4fa40) SHA1(1870fb0c5c64fbc53a10115f0f3c7624cf2465db) ) ROM_REGION( 0x0800, "proms", 0 ) - ROM_LOAD( "karnprom_21.k8", 0x0000, 0x0400, CRC(aab0bb93) SHA1(545707fbb1007fca1fe297c5fce61e485e7084fc) ) - ROM_LOAD( "karnprom_20.l6", 0x0400, 0x0400, CRC(02f78ffb) SHA1(cb4dd8b0ce3c404195321b17e10f51352f506958) ) + ROM_LOAD( "dn-21.k8", 0x0000, 0x0400, CRC(aab0bb93) SHA1(545707fbb1007fca1fe297c5fce61e485e7084fc) ) /* MB7132E BPROM */ + ROM_LOAD( "dn-20.l6", 0x0400, 0x0400, CRC(02f78ffb) SHA1(cb4dd8b0ce3c404195321b17e10f51352f506958) ) /* MB7122E BPROM */ ROM_END ROM_START( karnovj ) @@ -1082,8 +1082,8 @@ ROM_START( karnovj ) ROM_LOAD( "kar19", 0x58000, 0x08000, CRC(7bc174bb) SHA1(d8bc320169fc3a9cdd3f271ea523fb0486abae2c) ) ROM_REGION( 0x0800, "proms", 0 ) - ROM_LOAD( "karnprom_21.k8", 0x0000, 0x0400, CRC(aab0bb93) SHA1(545707fbb1007fca1fe297c5fce61e485e7084fc) ) - ROM_LOAD( "karnprom_20.l6", 0x0400, 0x0400, CRC(02f78ffb) SHA1(cb4dd8b0ce3c404195321b17e10f51352f506958) ) + ROM_LOAD( "dn-21.k8", 0x0000, 0x0400, CRC(aab0bb93) SHA1(545707fbb1007fca1fe297c5fce61e485e7084fc) ) /* MB7132E BPROM */ + ROM_LOAD( "dn-20.l6", 0x0400, 0x0400, CRC(02f78ffb) SHA1(cb4dd8b0ce3c404195321b17e10f51352f506958) ) /* MB7122E BPROM */ ROM_END ROM_START( karnovjbl ) @@ -1127,47 +1127,47 @@ ROM_START( karnovjbl ) ROM_LOAD( "24.bin", 0x58000, 0x08000, CRC(7bc174bb) SHA1(d8bc320169fc3a9cdd3f271ea523fb0486abae2c) ) ROM_REGION( 0x0800, "proms", 0 ) // not dumped for this set - ROM_LOAD( "karnprom.21", 0x0000, 0x0400, CRC(aab0bb93) SHA1(545707fbb1007fca1fe297c5fce61e485e7084fc) ) - ROM_LOAD( "karnprom.20", 0x0400, 0x0400, CRC(02f78ffb) SHA1(cb4dd8b0ce3c404195321b17e10f51352f506958) ) + ROM_LOAD( "dn-21.k8", 0x0000, 0x0400, CRC(aab0bb93) SHA1(545707fbb1007fca1fe297c5fce61e485e7084fc) ) /* MB7132E BPROM */ + ROM_LOAD( "dn-20.l6", 0x0400, 0x0400, CRC(02f78ffb) SHA1(cb4dd8b0ce3c404195321b17e10f51352f506958) ) /* MB7122E BPROM */ ROM_END ROM_START( wndrplnt ) ROM_REGION( 0x60000, "maincpu", 0 ) /* 6*64k for 68000 code */ - ROM_LOAD16_BYTE( "ea08.bin", 0x00000, 0x10000, CRC(b0578a14) SHA1(a420d1e8f80405161c86a123610ddf17c7ff07ff) ) - ROM_LOAD16_BYTE( "ea11.bin", 0x00001, 0x10000, CRC(271edc6c) SHA1(6aa411fa4a3613018e7d971c5675f54d5765904d) ) - ROM_LOAD16_BYTE( "ea07.bin", 0x20000, 0x10000, CRC(7095a7d5) SHA1(a7ee88cad03690a72a52b8ea2310416aa53febdd) ) - ROM_LOAD16_BYTE( "ea10.bin", 0x20001, 0x10000, CRC(81a96475) SHA1(2d2e647ed7867b1a7f0dc24544e241e4b1c9fa92) ) - ROM_LOAD16_BYTE( "ea06.bin", 0x40000, 0x10000, CRC(5951add3) SHA1(394552c29a6266becbdb36c3bd65fc1f56701d11) ) - ROM_LOAD16_BYTE( "ea09.bin", 0x40001, 0x10000, CRC(c4b3cb1e) SHA1(006becbcdbbb3e666382e59e8fa5a5ebe06e5724) ) + ROM_LOAD16_BYTE( "ea08.j16", 0x00000, 0x10000, CRC(b0578a14) SHA1(a420d1e8f80405161c86a123610ddf17c7ff07ff) ) + ROM_LOAD16_BYTE( "ea11.j19", 0x00001, 0x10000, CRC(271edc6c) SHA1(6aa411fa4a3613018e7d971c5675f54d5765904d) ) + ROM_LOAD16_BYTE( "ea07.j14", 0x20000, 0x10000, CRC(7095a7d5) SHA1(a7ee88cad03690a72a52b8ea2310416aa53febdd) ) + ROM_LOAD16_BYTE( "ea10.j18", 0x20001, 0x10000, CRC(81a96475) SHA1(2d2e647ed7867b1a7f0dc24544e241e4b1c9fa92) ) + ROM_LOAD16_BYTE( "ea06.j13", 0x40000, 0x10000, CRC(5951add3) SHA1(394552c29a6266becbdb36c3bd65fc1f56701d11) ) + ROM_LOAD16_BYTE( "ea09.j17", 0x40001, 0x10000, CRC(c4b3cb1e) SHA1(006becbcdbbb3e666382e59e8fa5a5ebe06e5724) ) ROM_REGION( 0x10000, "audiocpu", 0 ) /* 6502 Sound CPU */ - ROM_LOAD( "ea05.bin", 0x8000, 0x8000, CRC(8dbb6231) SHA1(342faa020448ce916e820b3df18d44191983f7a6) ) + ROM_LOAD( "ea05.f3", 0x8000, 0x8000, CRC(8dbb6231) SHA1(342faa020448ce916e820b3df18d44191983f7a6) ) ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 MCU */ - ROM_LOAD( "wndrplnt_i8751", 0x0000, 0x1000, NO_DUMP ) + ROM_LOAD( "wndrplnt_i8751.k13", 0x0000, 0x1000, NO_DUMP ) ROM_REGION( 0x08000, "gfx1", 0 ) - ROM_LOAD( "ea00.bin", 0x00000, 0x08000, CRC(9f3cac4c) SHA1(af8a275ff531029dbada3c820c9f660fef383100) ) /* Characters */ + ROM_LOAD( "ea00.c5", 0x00000, 0x08000, CRC(9f3cac4c) SHA1(af8a275ff531029dbada3c820c9f660fef383100) ) /* Characters */ ROM_REGION( 0x40000, "gfx2", 0 ) - ROM_LOAD( "ea04.bin", 0x00000, 0x10000, CRC(7d701344) SHA1(4efaa73a4b2534078ee25111a2f5143c7c7e846f) ) /* Backgrounds */ - ROM_LOAD( "ea01.bin", 0x10000, 0x10000, CRC(18df55fb) SHA1(406ea47365ff8372bb2588c97c438ea02aa17538) ) - ROM_LOAD( "ea03.bin", 0x20000, 0x10000, CRC(922ef050) SHA1(e33aea6df2e1a14bd371ed0a2b172f58edcc0e8e) ) - ROM_LOAD( "ea02.bin", 0x30000, 0x10000, CRC(700fde70) SHA1(9b5b59aaffac091622329dc6ebedb24806b69964) ) + ROM_LOAD( "ea04.d18", 0x00000, 0x10000, CRC(7d701344) SHA1(4efaa73a4b2534078ee25111a2f5143c7c7e846f) ) /* Backgrounds */ + ROM_LOAD( "ea01.c18", 0x10000, 0x10000, CRC(18df55fb) SHA1(406ea47365ff8372bb2588c97c438ea02aa17538) ) + ROM_LOAD( "ea03.d15", 0x20000, 0x10000, CRC(922ef050) SHA1(e33aea6df2e1a14bd371ed0a2b172f58edcc0e8e) ) + ROM_LOAD( "ea02.c18", 0x30000, 0x10000, CRC(700fde70) SHA1(9b5b59aaffac091622329dc6ebedb24806b69964) ) ROM_REGION( 0x80000, "gfx3", 0 ) - ROM_LOAD( "ea12.bin", 0x00000, 0x10000, CRC(a6d4e99d) SHA1(a85dbb23d05d1e386d8a66f505fa9dfcc554327b) ) /* Sprites - 2 sets of 4, interleaved here */ - ROM_LOAD( "ea14.bin", 0x10000, 0x10000, CRC(915ffdc9) SHA1(b65cdc8ee953494f2b69e06cd6c97ee142d83c3e) ) - ROM_LOAD( "ea13.bin", 0x20000, 0x10000, CRC(cd839f3a) SHA1(7eae3a1e080b7db22968d556e80b620cb07976b0) ) - ROM_LOAD( "ea15.bin", 0x30000, 0x10000, CRC(a1f14f16) SHA1(5beb2b8967aa34271f734865704c6bab07d76a8c) ) + ROM_LOAD( "ea12.f8", 0x00000, 0x10000, CRC(a6d4e99d) SHA1(a85dbb23d05d1e386d8a66f505fa9dfcc554327b) ) /* Sprites - 2 sets of 4, interleaved here */ + ROM_LOAD( "ea14.f9", 0x10000, 0x10000, CRC(915ffdc9) SHA1(b65cdc8ee953494f2b69e06cd6c97ee142d83c3e) ) + ROM_LOAD( "ea13.f13", 0x20000, 0x10000, CRC(cd839f3a) SHA1(7eae3a1e080b7db22968d556e80b620cb07976b0) ) + ROM_LOAD( "ea15.f15", 0x30000, 0x10000, CRC(a1f14f16) SHA1(5beb2b8967aa34271f734865704c6bab07d76a8c) ) ROM_LOAD( "ea16.bin", 0x40000, 0x10000, CRC(7a1d8a9c) SHA1(2b924a7e5a2490a7144b981155f2503d3737875d) ) ROM_LOAD( "ea17.bin", 0x50000, 0x10000, CRC(21a3223d) SHA1(7754ed9cbe4eed94b49130af6108e919be18e5b3) ) ROM_LOAD( "ea18.bin", 0x60000, 0x10000, CRC(3fb2cec7) SHA1(7231bb728f1009186d41e177402e84b63f25a44f) ) ROM_LOAD( "ea19.bin", 0x70000, 0x10000, CRC(87cf03b5) SHA1(29bc25642be1dd7e25f13e96dae90572f7a09d21) ) ROM_REGION( 0x0800, "proms", 0 ) - ROM_LOAD( "ea21.prm", 0x0000, 0x0400, CRC(c8beab49) SHA1(970c2bad3cbf2d7fc313997ae0fe11dd04383b40) ) - ROM_LOAD( "ea20.prm", 0x0400, 0x0400, CRC(619f9d1e) SHA1(17fe49b6c9ce17be4a03e3400229e3ef4998a46f) ) + ROM_LOAD( "ea-21.k8", 0x0000, 0x0400, CRC(c8beab49) SHA1(970c2bad3cbf2d7fc313997ae0fe11dd04383b40) ) /* MB7132E BPROM */ + ROM_LOAD( "ea-20.l6", 0x0400, 0x0400, CRC(619f9d1e) SHA1(17fe49b6c9ce17be4a03e3400229e3ef4998a46f) ) /* MB7122E BPROM */ ROM_END ROM_START( chelnov ) @@ -1201,8 +1201,8 @@ ROM_START( chelnov ) ROM_LOAD( "ee15-.f15", 0x30000, 0x10000, CRC(81e3e68b) SHA1(1059c70b8bfe09c212a19767cfe23efa22afc196) ) ROM_REGION( 0x0800, "proms", 0 ) - ROM_LOAD( "ee-17.k8", 0x0000, 0x0400, CRC(b1db6586) SHA1(a7ecfcb4cf0f7450900820b3dfad8813efedfbea) ) /* different from the Japanese set - need to verify */ - ROM_LOAD( "ee-16.l6", 0x0400, 0x0400, CRC(41816132) SHA1(89a1194bd8bf39f13419df685e489440bdb05676) ) + ROM_LOAD( "ee-17.k8", 0x0000, 0x0400, CRC(b1db6586) SHA1(a7ecfcb4cf0f7450900820b3dfad8813efedfbea) ) /* MB7132E BPROM */ + ROM_LOAD( "ee-16.l6", 0x0400, 0x0400, CRC(41816132) SHA1(89a1194bd8bf39f13419df685e489440bdb05676) ) /* MB7122E BPROM */ ROM_END ROM_START( chelnovu ) @@ -1236,8 +1236,8 @@ ROM_START( chelnovu ) ROM_LOAD( "ee15-.f15", 0x30000, 0x10000, CRC(81e3e68b) SHA1(1059c70b8bfe09c212a19767cfe23efa22afc196) ) ROM_REGION( 0x0800, "proms", 0 ) - ROM_LOAD( "ee-17.k8", 0x0000, 0x0400, CRC(b1db6586) SHA1(a7ecfcb4cf0f7450900820b3dfad8813efedfbea) ) /* different from the Japanese set - need to verify */ - ROM_LOAD( "ee-16.l6", 0x0400, 0x0400, CRC(41816132) SHA1(89a1194bd8bf39f13419df685e489440bdb05676) ) + ROM_LOAD( "ee-17.k8", 0x0000, 0x0400, CRC(b1db6586) SHA1(a7ecfcb4cf0f7450900820b3dfad8813efedfbea) ) /* MB7132E BPROM */ + ROM_LOAD( "ee-16.l6", 0x0400, 0x0400, CRC(41816132) SHA1(89a1194bd8bf39f13419df685e489440bdb05676) ) /* MB7122E BPROM */ ROM_END ROM_START( chelnovj ) /* at least 1 PCB found with all labels as 'EPR-EExx' like Sega labels */ @@ -1271,8 +1271,8 @@ ROM_START( chelnovj ) /* at least 1 PCB found with all labels as 'EPR-EExx' like ROM_LOAD( "ee15-.f15", 0x30000, 0x10000, CRC(81e3e68b) SHA1(1059c70b8bfe09c212a19767cfe23efa22afc196) ) ROM_REGION( 0x0800, "proms", 0 ) - ROM_LOAD( "ee-17.k8", 0x0000, 0x0400, CRC(309c49d8) SHA1(7220002f6ef97514b4e6f61706fc16061120dafa) ) /* different from the other sets - need to verify */ - ROM_LOAD( "ee-16.l6", 0x0400, 0x0400, CRC(41816132) SHA1(89a1194bd8bf39f13419df685e489440bdb05676) ) + ROM_LOAD( "ee-17.k8", 0x0000, 0x0400, CRC(b1db6586) SHA1(a7ecfcb4cf0f7450900820b3dfad8813efedfbea) ) /* MB7132E BPROM */ + ROM_LOAD( "ee-16.l6", 0x0400, 0x0400, CRC(41816132) SHA1(89a1194bd8bf39f13419df685e489440bdb05676) ) /* MB7122E BPROM */ ROM_END // bootleg of chelnovj, only interesting because it uses a SCM8031HCCN40 instead of the usual 8051 for protection @@ -1312,8 +1312,8 @@ ROM_START( chelnovjbl ) // code is the same as the regular chelnovj set ROM_LOAD( "ee15-.f15", 0x30000, 0x10000, CRC(81e3e68b) SHA1(1059c70b8bfe09c212a19767cfe23efa22afc196) ) ROM_REGION( 0x0800, "proms", 0 ) - ROM_LOAD( "ee-17.k8", 0x0000, 0x0400, CRC(309c49d8) SHA1(7220002f6ef97514b4e6f61706fc16061120dafa) ) /* different from the parent set; - might be bad (comment from chelnovj, not dumped here) */ - ROM_LOAD( "ee-16.l6", 0x0400, 0x0400, CRC(41816132) SHA1(89a1194bd8bf39f13419df685e489440bdb05676) ) + ROM_LOAD( "ee-17.k8", 0x0000, 0x0400, CRC(b1db6586) SHA1(a7ecfcb4cf0f7450900820b3dfad8813efedfbea) ) /* MB7132E BPROM */ + ROM_LOAD( "ee-16.l6", 0x0400, 0x0400, CRC(41816132) SHA1(89a1194bd8bf39f13419df685e489440bdb05676) ) /* MB7122E BPROM */ ROM_END /* @@ -1364,7 +1364,7 @@ ROM_START( chelnovjbla ) ROM_LOAD( "ee15-.f15", 0x30000, 0x10000, CRC(81e3e68b) SHA1(1059c70b8bfe09c212a19767cfe23efa22afc196) ) ROM_REGION( 0x0800, "proms", 0 ) - ROM_LOAD( "ee-17.k8", 0x0000, 0x0400, CRC(309c49d8) SHA1(7220002f6ef97514b4e6f61706fc16061120dafa) ) /* different from the parent set; - might be bad (comment from chelnovj, not dumped here) */ + ROM_LOAD( "ee-17.k8", 0x0000, 0x0400, CRC(b1db6586) SHA1(a7ecfcb4cf0f7450900820b3dfad8813efedfbea) ) /* not dumped here, taken from parent */ ROM_LOAD( "ee-16.l6", 0x0400, 0x0400, CRC(41816132) SHA1(89a1194bd8bf39f13419df685e489440bdb05676) ) ROM_END diff --git a/src/mame/drivers/pc.cpp b/src/mame/drivers/pc.cpp index c916d4055e9..b9d188eddcc 100644 --- a/src/mame/drivers/pc.cpp +++ b/src/mame/drivers/pc.cpp @@ -70,7 +70,7 @@ public: void juko16(machine_config &config); void hyo88t(machine_config &config); void kyoxt(machine_config &config); - + void init_bondwell(); DECLARE_INPUT_CHANGED_MEMBER(pc_turbo_callback); @@ -486,6 +486,22 @@ ROM_START( eagle1600 ) ROM_LOAD("eagle 1600 video char gen u301.bin", 0x00000, 0x1000, CRC(1a7e552f) SHA1(749058783eec9d96a70dc5fdbfccb56196f889dc)) ROM_END +/*************************************************************** Eagle PC-2 *** + +Links: http://www.digibarn.com/collections/systems/eagle-pc/index.html , https://www.atarimagazines.com/creative/v10n2/28_Eagle_PC2.php http://www.old-computers.com/museum/computer.asp?st=1&c=529 +Form Factor: Desktop + +Error message: Cannot read boot sector +******************************************************************************/ + +ROM_START( eaglepc2 ) + ROM_REGION16_LE(0x10000,"bios", 0) + ROM_LOAD("eagle_pc-2_bios_2.812_1986_u1101.bin", 0xe000, 0x2000, CRC(cd0fc034) SHA1(883cb4808c565f2582873a51cc637ab25b457f88)) + + ROM_REGION(0x8000,"gfx1", 0) + ROM_LOAD("eagle_pc-2_cga_char_rom_u401.bin", 0x00000, 0x1000, CRC(e85da08d) SHA1(176a7027bd14cc7efbb5cec5c2ac89ba002912d0)) + +ROM_END /********************************************************** Eagle PC Spirit *** @@ -1291,6 +1307,48 @@ ROM_START( nixpc01 ) ROM_LOAD( "nx01.bin", 0xc000, 0x4000, CRC(b0a75d1f) SHA1(7c2890eced917969968fc2e7491cda90a9734e03)) ROM_END +/******************************************************Leading Edge Model M *** + +aka the Sperry PC, the "Sperry HT - 4.71 Bios" that can be found online is identical to the v.4.71 below +E-TD10 - TOD Error +acording to http://www.o3one.org/hwdocs/bios_doc/dosref22.html this machine had AT-like RTC services +The "M" stood for a Mitsubishi made machine, the "Leading Edge Model D" was made by Daewoo +Works with the "siemens" config, so instead of duplicating it until more is known we'll use that. + +******************************************************************************/ + +ROM_START( ledgmodm ) + ROM_REGION(0x10000, "bios", 0) + ROM_SYSTEM_BIOS(0, "v330", "Version 3.30") + ROMX_LOAD( "leading_edge-model_m-version_3.30.bin", 0xc000, 0x4000, CRC(386dd187) SHA1(848ccdc8209c24478a4f75dd941760c43d3bc732), ROM_BIOS(0) ) + ROM_SYSTEM_BIOS(1, "v471", "Version 4.71") + ROMX_LOAD( "leading_edge-model_m-version_4.71.bin", 0xc000, 0x4000, CRC(0d5d8bee) SHA1(6c35adf6a8da149e420b5aa8dd0e18e02488cfa0), ROM_BIOS(1) ) +ROM_END + +/************************************** CCI Micromint MPX-16 PC Motherboard *** + +Circuit Cellar Project +The ROMs are marked "Micromint MPX16 5/8 PC/Term 3/1/84" +hangs on boot, maybe they are waiting for a serial connection + +******************************************************************************/ + +ROM_START( mpx16 ) + ROM_REGION16_LE(0x10000,"bios", 0) + ROM_LOAD("mpx16u84.bin", 0xe000, 0x1000, CRC(8a557a25) SHA1(90f8112c094cc0ac44c2d5d43fbb577333dfc165)) + ROM_LOAD("mpx16u85.bin", 0xf000, 0x1000, CRC(42097571) SHA1(2acaca033242e35e512b30b2233da02bde561cc3)) +ROM_END + +/*************************************************** Vendex HeadStart Plus *** + +Samsung manufactured - Chipset: Faraday FE2010A - "Keyboard Error or no keyboard present" +On-board: FDC + +******************************************************************************/ +ROM_START( hstrtpls ) + ROM_REGION(0x10000,"bios", 0) + ROM_LOAD("bios.bin", 0xc000, 0x04000, CRC(19d705f8) SHA1(5e607fec6b533bc59d8d804e399bb9d438d6999d)) +ROM_END /*************************************************************************** @@ -1333,3 +1391,7 @@ COMP( 198?, juko16, ibm5150, 0, juko16, pccga, pc_state, COMP( 198?, hyo88t, ibm5150, 0, pccga, pccga, pc_state, empty_init, "Hyosung", "Topstar 88T", MACHINE_NOT_WORKING ) COMP( 198?, kyoxt, ibm5150, 0, pccga, pccga, pc_state, empty_init, "Kyocera", "XT", MACHINE_NOT_WORKING ) COMP( 198?, kaypropc, ibm5150, 0, pccga, pccga, pc_state, empty_init, "Kaypro Corporation", "PC", MACHINE_NOT_WORKING ) +COMP( 198?, ledgmodm, ibm5150, 0, siemens, pccga, pc_state, empty_init, "Leading Edge", "Model M", MACHINE_NOT_WORKING ) +COMP( 198?, eaglepc2, ibm5150, 0, pccga, pccga, pc_state, empty_init, "Eagle", "PC-2", MACHINE_NOT_WORKING ) +COMP( 198?, mpx16, ibm5150, 0, pccga, pccga, pc_state, empty_init, "Micromint", "MPX-16", MACHINE_NOT_WORKING ) +COMP( 198?, hstrtpls, ibm5150, 0, pccga, pccga, pc_state, empty_init, "Vendex", "HeadStart Plus", MACHINE_NOT_WORKING ) diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 614b871ccac..b1d850496c6 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -2453,6 +2453,7 @@ pcd4x // Siemens-Nixdorf PCD-4H and other 486 desktops pcd4nl // 1995 Siemens-Nixdorf PCD-4NL 486 subnotebook pcd4nd // 1993 Siemens-Nixdorf 486 notebook ct386sx // +wy220001 // WYSEpc cxsxd // ec1842 // ec1849 // @@ -2464,6 +2465,15 @@ ficvipio // FIC 486-VIP-IO ficvipio2 // FIC 486-VIP-IO2 ftsserv // 1991 Apricot FTs (Scorpion) aubam12s2 // AUVA COMPUTER, INC. BAM/12-S2 motherboard (286) +bi025c // BI-025C HT 12 286 motherboard (286) +kma202f // KMA-202F-12R motherboard (286) +cdtekg2 // CDTEK motherboard with Headland G2 chipset (286) +octekg2 // Octek motherboard with Headland G2 chipset (286) +olim203 // Olivetti 286 motherboard +headg2 // 286 motherboards with Headland G2 chipset +mb1212c // Biostar MB-1212C motherboard (286) +bam16a0 // VIP-M21502A BAM16-A0 motherboard (286) +cmpa286 // CMP enterprise CO.LTD. motherboard (286) suntac5 // 286 motherboards using the 5-chip SUNTAC chipset ht12a // 286 motherboards using the Headland HT12/A chipset vlsi5 // 286 motherboards using the 5-chip VLSI chipset @@ -31645,6 +31655,10 @@ sicpc1605 // Siemens Sicomp PC16-05 ssam88s // sx16 // Sanyo SX-16 zdsupers // +ledgmodm // Leading Edge Model M +eaglepc2 // Eagle PC-2 +mpx16 // Ciarcia's Circuit Cellar Micromint MPX-16 +hstrtpls // Vendex HeadStart Plus @source:pc100.cpp pc100 // diff --git a/src/mame/video/733_asr.cpp b/src/mame/video/733_asr.cpp index 80995c2f415..bd88c43416f 100644 --- a/src/mame/video/733_asr.cpp +++ b/src/mame/video/733_asr.cpp @@ -28,6 +28,8 @@ #include "emu.h" #include "733_asr.h" +#include <algorithm> + enum { /*ASROutQueueSize = 32,*/ @@ -201,9 +203,11 @@ void asr733_device::linefeed() { uint8_t buf[asr_window_width]; + assert(asr_window_offset_x + asr_window_width <= m_bitmap->width()); + assert(asr_window_offset_y + asr_window_height <= m_bitmap->height()); for (int y=asr_window_offset_y; y<asr_window_offset_y+asr_window_height-asr_scroll_step; y++) { - extract_scanline8(*m_bitmap, asr_window_offset_x, y+asr_scroll_step, asr_window_width, buf); + std::copy_n(&m_bitmap->pix16(y+asr_scroll_step, asr_window_offset_x), asr_window_width, buf); draw_scanline8(*m_bitmap, asr_window_offset_x, y, asr_window_width, buf, palette().pens()); } diff --git a/src/mame/video/apexc.cpp b/src/mame/video/apexc.cpp index 174a665a4f4..095763b9c40 100644 --- a/src/mame/video/apexc.cpp +++ b/src/mame/video/apexc.cpp @@ -11,6 +11,8 @@ #include "emu.h" #include "includes/apexc.h" +#include <algorithm> + const rgb_t apexc_state::palette_table[] = { rgb_t::white(), @@ -128,9 +130,11 @@ void apexc_state::teletyper_linefeed() { uint8_t buf[teletyper_window_width]; + assert(teletyper_window_offset_x + teletyper_window_width <= m_bitmap->width()); + assert(teletyper_window_offset_y + teletyper_window_height <= m_bitmap->height()); for (int y = teletyper_window_offset_y; y < teletyper_window_offset_y + teletyper_window_height - teletyper_scroll_step; y++) { - extract_scanline8(*m_bitmap, teletyper_window_offset_x, y+teletyper_scroll_step, teletyper_window_width, buf); + std::copy_n(&m_bitmap->pix16(y+teletyper_scroll_step, teletyper_window_offset_x), teletyper_window_width, buf); draw_scanline8(*m_bitmap, teletyper_window_offset_x, y, teletyper_window_width, buf, m_palette->pens()); } diff --git a/src/mame/video/pdp1.cpp b/src/mame/video/pdp1.cpp index 0a4597fd3be..f04aa496d83 100644 --- a/src/mame/video/pdp1.cpp +++ b/src/mame/video/pdp1.cpp @@ -17,12 +17,13 @@ Based on earlier work by Chris Salomon */ -#include <math.h> - #include "emu.h" #include "cpu/pdp1/pdp1.h" #include "includes/pdp1.h" +#include <math.h> +#include <algorithm> + @@ -357,9 +358,11 @@ void pdp1_state::pdp1_typewriter_linefeed() uint8_t buf[typewriter_window_width]; int y; + assert(typewriter_window_width <= m_typewriter_bitmap.width()); + assert(typewriter_window_height <= m_typewriter_bitmap.height()); for (y=0; y<typewriter_window_height-typewriter_scroll_step; y++) { - extract_scanline8(m_typewriter_bitmap, 0, y+typewriter_scroll_step, typewriter_window_width, buf); + std::copy_n(&m_typewriter_bitmap.pix16(y+typewriter_scroll_step, 0), typewriter_window_width, buf); draw_scanline8(m_typewriter_bitmap, 0, y, typewriter_window_width, buf, m_palette->pens()); } diff --git a/src/mame/video/psikyosh.cpp b/src/mame/video/psikyosh.cpp index 18c7aee1b7a..7b97e5b98e2 100644 --- a/src/mame/video/psikyosh.cpp +++ b/src/mame/video/psikyosh.cpp @@ -65,16 +65,18 @@ The only viable way to do this is to have one tilemap per bank (0x0a-0x20), and */ #include "emu.h" -#include "drawgfxm.h" +#include "drawgfxt.ipp" #include "includes/psikyosh.h" +#include <algorithm> + static constexpr u32 BG_TRANSPEN = 0x00ff00ff; // used for representing transparency in temporary bitmaps //#define DEBUG_KEYS //#define DEBUG_MESSAGE // take ARGB pixel with stored alpha and blend in to RGB32 bitmap -#define PIXEL_OP_COPY_TRANSPEN_ARGBRENDER32(DEST, PRIORITY, SOURCE) \ +#define PIXEL_OP_COPY_TRANSPEN_ARGBRENDER32(DEST, SOURCE) \ do \ { \ const rgb_t srcdata = (SOURCE); \ @@ -83,7 +85,7 @@ do } \ while (0) // take RGB pixel with separate alpha and blend in to RGB32 bitmap -#define PIXEL_OP_COPY_TRANSPEN_ALPHARENDER32(DEST, PRIORITY, SOURCE) \ +#define PIXEL_OP_COPY_TRANSPEN_ALPHARENDER32(DEST, SOURCE) \ do \ { \ const u32 srcdata = (SOURCE); \ @@ -92,7 +94,7 @@ do } \ while (0) // take ARGB pixel with stored alpha and copy in to RGB32 bitmap, scipping BG_TRANSPEN -#define PIXEL_OP_COPY_TRANSPEN_RENDER32(DEST, PRIORITY, SOURCE) \ +#define PIXEL_OP_COPY_TRANSPEN_RENDER32(DEST, SOURCE) \ do \ { \ const u32 srcdata = (SOURCE); \ @@ -169,10 +171,7 @@ static inline void pixop_transparent_alphatable(u8 source, u32 *dest, const pen_ -------------------------------------------------*/ void psikyosh_state::draw_scanline32_alpha(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u32 *srcptr, int alpha) { - DECLARE_NO_PRIORITY; - u32 const transpen = BG_TRANSPEN; - - DRAWSCANLINE_CORE(u32, PIXEL_OP_COPY_TRANSPEN_ALPHARENDER32, NO_PRIORITY); + drawscanline_core(bitmap, destx, desty, length, srcptr, [alpha, transpen = BG_TRANSPEN](u32 &destp, const u32 &srcp) { PIXEL_OP_COPY_TRANSPEN_ALPHARENDER32(destp, srcp); }); } /*------------------------------------------------- @@ -181,10 +180,7 @@ void psikyosh_state::draw_scanline32_alpha(bitmap_rgb32 &bitmap, s32 destx, s32 -------------------------------------------------*/ void psikyosh_state::draw_scanline32_argb(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u32 *srcptr) { - DECLARE_NO_PRIORITY; - u32 const transpen = BG_TRANSPEN; - - DRAWSCANLINE_CORE(u32, PIXEL_OP_COPY_TRANSPEN_ARGBRENDER32, NO_PRIORITY); + drawscanline_core(bitmap, destx, desty, length, srcptr, [transpen = BG_TRANSPEN](u32 &destp, const u32 &srcp) { PIXEL_OP_COPY_TRANSPEN_ARGBRENDER32(destp, srcp); }); } /*------------------------------------------------- @@ -193,10 +189,7 @@ void psikyosh_state::draw_scanline32_argb(bitmap_rgb32 &bitmap, s32 destx, s32 d -------------------------------------------------*/ void psikyosh_state::draw_scanline32_transpen(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u32 *srcptr) { - DECLARE_NO_PRIORITY; - u32 const transpen = BG_TRANSPEN; - - DRAWSCANLINE_CORE(u32, PIXEL_OP_COPY_TRANSPEN_RENDER32, NO_PRIORITY); + drawscanline_core(bitmap, destx, desty, length, srcptr, [transpen = BG_TRANSPEN](u32 &destp, const u32 &srcp) { PIXEL_OP_COPY_TRANSPEN_RENDER32(destp, srcp); }); } @@ -340,7 +333,7 @@ void psikyosh_state::draw_bglayerscroll(u8 const layer, bitmap_rgb32 &bitmap, co if ((tilebank >= 0x0a) && (tilebank <= 0x1f)) /* 20 banks of 0x800 bytes. filter garbage. */ { - s16 const tilemap_scanline = (scanline - scrolly + 0x400) & (height - 1); + u16 const tilemap_scanline = (scanline - scrolly + 0x400) & (height - 1); // render reelvant tiles to temp bitmap, assume bank changes infrequently/never. render alpha as per-pen cache_bitmap(tilemap_scanline, gfx, size, tilebank, alpha, last_bank); @@ -349,7 +342,7 @@ void psikyosh_state::draw_bglayerscroll(u8 const layer, bitmap_rgb32 &bitmap, co g_profiler.start(PROFILER_USER2); u32 tilemap_line[32 * 16]; u32 scr_line[64 * 8]; - extract_scanline32(m_bg_bitmap, 0, tilemap_scanline, 0x200, tilemap_line); + std::copy_n(&m_bg_bitmap.pix32(tilemap_scanline, 0), 0x200, tilemap_line); g_profiler.stop(); /* slow bit, needs optimising. apply scrollx and zoomx by assembling scanline from row */ diff --git a/src/mame/video/suna8.cpp b/src/mame/video/suna8.cpp index c12dbeb9d85..f1e4cd650b2 100644 --- a/src/mame/video/suna8.cpp +++ b/src/mame/video/suna8.cpp @@ -29,7 +29,7 @@ #include "emu.h" #include "includes/suna8.h" -#include "drawgfxm.h" +#include "drawgfxt.ipp" /*************************************************************************** For Debug: there's no tilemap, just sprites. @@ -188,19 +188,6 @@ do } \ while (0) -class mygfx_element : public gfx_element -{ -public: - void prio_mask_transpen(bitmap_ind16 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - bitmap_ind8 &priority, uint32_t trans_pen) - { - color = colorbase() + granularity() * (color % colors()); - code %= elements(); - DRAWGFX_CORE(uint16_t, PIXEL_OP_REBASE_TRANSPEN_PRIORITY_MASK, uint8_t); - } -}; - /*************************************************************************** [ Sprites Format ] @@ -434,8 +421,13 @@ void suna8_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, cons int color = (((attr >> 2) & 0xf) ^ colorbank) + 0x10 * m_palettebank; // player2 in hardhea2 and sparkman if (read_mask) - ((mygfx_element*)(m_gfxdecode->gfx(which)))->prio_mask_transpen(bitmap, cliprect, - code, color, tile_flipx, tile_flipy, sx, sy, screen.priority(), 0xf); + { + gfx_element *mygfx = m_gfxdecode->gfx(which); + color = mygfx->colorbase() + mygfx->granularity() * (color % mygfx->colors()); + mygfx->drawgfx_core(bitmap, cliprect, code % mygfx->elements(), + tile_flipx, tile_flipy, sx, sy, screen.priority(), + [color, trans_pen = 0xf](uint16_t &destp, uint8_t &pri, const uint8_t &srcp) { PIXEL_OP_REBASE_TRANSPEN_PRIORITY_MASK(destp, pri, srcp); }); + } else m_gfxdecode->gfx(which)->transpen(bitmap, cliprect, code, color, tile_flipx, tile_flipy, sx, sy, 0xf); diff --git a/src/mame/video/tc0080vco.cpp b/src/mame/video/tc0080vco.cpp index fcc725abd69..e935ed2264c 100644 --- a/src/mame/video/tc0080vco.cpp +++ b/src/mame/video/tc0080vco.cpp @@ -64,7 +64,7 @@ this seems to be the only zoom feature actually used in the games. #include "tc0080vco.h" #include "video/taito_helper.h" -#include "drawgfxm.h" +#include "drawgfxt.ipp" #include "screen.h" @@ -710,25 +710,7 @@ void tc0080vco_device::bg1_tilemap_draw(screen_device &screen, bitmap_ind16 &bit sy = (( 0x3fe - m_scroll_ram[layer + 3]) << 16) - (max_y + min_y) * (zy - 0x10000); } - { - bitmap_ind16 &dest = bitmap; - bitmap_ind16 &src = srcbitmap; - s32 startx = sx; - s32 starty = sy; - s32 incxx = zx; - s32 incxy = 0; - s32 incyx = 0; - s32 incyy = zy; - int wraparound = 0; - u8 privalue = priority; - u8 primask = pmask; - bitmap_ind8 &priority = screen.priority(); - - if (dest.bpp() == 16) - COPYROZBITMAP_CORE(u16, PIXEL_OP_COPY_TRANS0_SET_PRIORITY, u8); - else - COPYROZBITMAP_CORE(u32, PIXEL_OP_COPY_TRANS0_SET_PRIORITY, u8); - } + copyrozbitmap_core(bitmap, cliprect, srcbitmap, sx, sy, zx, 0, 0, zy, 0, screen.priority(), [privalue = priority, primask = pmask](u16 &destp, u8 &pri, const u16 &srcp) { PIXEL_OP_COPY_TRANS0_SET_PRIORITY(destp, pri, srcp); }); } } diff --git a/src/mame/video/tx0.cpp b/src/mame/video/tx0.cpp index 1c02e8636d4..1e7c5c0a147 100644 --- a/src/mame/video/tx0.cpp +++ b/src/mame/video/tx0.cpp @@ -12,6 +12,8 @@ #include "includes/tx0.h" #include "video/crt.h" +#include <algorithm> + @@ -346,9 +348,11 @@ void tx0_state::tx0_typewriter_linefeed() uint8_t buf[typewriter_window_width]; int y; + assert(typewriter_window_width <= m_typewriter_bitmap.width()); + assert(typewriter_window_height <= m_typewriter_bitmap.height()); for (y=0; y<typewriter_window_height-typewriter_scroll_step; y++) { - extract_scanline8(m_typewriter_bitmap, 0, y+typewriter_scroll_step, typewriter_window_width, buf); + std::copy_n(&m_typewriter_bitmap.pix16(y+typewriter_scroll_step, 0), typewriter_window_width, buf); draw_scanline8(m_typewriter_bitmap, 0, y, typewriter_window_width, buf, m_palette->pens()); } diff --git a/src/osd/mac/windowcontroller.mm b/src/osd/mac/windowcontroller.mm index 396fbc49238..aa09e96b0d5 100644 --- a/src/osd/mac/windowcontroller.mm +++ b/src/osd/mac/windowcontroller.mm @@ -102,20 +102,30 @@ void *CreateMAMEWindow(char *title, int x, int y, int w, int h, bool isFullscree NSWindow *window = [NSWindow alloc]; MAMEWindowController *controller = [MAMEWindowController alloc]; + /* To avoid event handling issues like SDL has, we run MAME in + a separate NSThread. This means all UI calls from MAME + must be delegated over to the main thread because the + Cocoa UI stuff is not thread-safe */ dispatch_sync(dispatch_get_main_queue(), ^{ [window initWithContentRect:bounds styleMask:style backing:NSBackingStoreBuffered defer:NO]; [controller initWithWindow:window]; - }); - if (isFullscreen) - { - [controller goFullscreen]; - } - - [window makeKeyAndOrderFront:nil]; + NSString *nstitle = [[NSString alloc] initWithUTF8String:title]; + [window setTitle:nstitle]; + [nstitle release]; + + if (isFullscreen) + { + [controller goFullscreen]; + } + else + { + [window makeKeyAndOrderFront:nil]; + } + }); return (void *)controller; } diff --git a/src/osd/modules/lib/osdobj_common.cpp b/src/osd/modules/lib/osdobj_common.cpp index 9609ab81f4e..51474b810b0 100644 --- a/src/osd/modules/lib/osdobj_common.cpp +++ b/src/osd/modules/lib/osdobj_common.cpp @@ -16,7 +16,7 @@ const options_entry osd_options::s_option_entries[] = { { nullptr, nullptr, OPTION_HEADER, "OSD KEYBOARD MAPPING OPTIONS" }, -#if defined(SDLMAME_MACOSX) || defined(OSD_SDL) +#if defined(SDLMAME_MACOSX) || defined(OSD_MAC) { OSDOPTION_UIMODEKEY, "DEL", OPTION_STRING, "key to enable/disable MAME controls when emulated system has keyboard inputs" }, #else { OSDOPTION_UIMODEKEY, "SCRLOCK", OPTION_STRING, "key to enable/disable MAME controls when emulated system has keyboard inputs" }, |