trunk/src/mame/drivers/sstrangr.c
| r248594 | r248595 | |
| 13 | 13 | #include "sstrangr.lh" |
| 14 | 14 | |
| 15 | 15 | |
| 16 | | #define NUM_PENS (8) |
| 17 | | |
| 18 | 16 | class sstrangr_state : public driver_device |
| 19 | 17 | { |
| 20 | 18 | public: |
| 21 | 19 | sstrangr_state(const machine_config &mconfig, device_type type, const char *tag) |
| 22 | 20 | : driver_device(mconfig, type, tag), |
| 23 | 21 | m_maincpu(*this, "maincpu"), |
| 22 | m_palette(*this, "palette"), |
| 24 | 23 | m_ram(*this, "ram") { } |
| 25 | 24 | |
| 26 | 25 | required_device<cpu_device> m_maincpu; |
| 27 | | |
| 26 | optional_device<palette_device> m_palette; |
| 28 | 27 | required_shared_ptr<UINT8> m_ram; |
| 29 | 28 | |
| 30 | 29 | UINT8 m_flip_screen; |
| r248594 | r248595 | |
| 86 | 85 | return 0; |
| 87 | 86 | } |
| 88 | 87 | |
| 89 | | |
| 90 | | static void get_pens(pen_t *pens) |
| 91 | | { |
| 92 | | offs_t i; |
| 93 | | |
| 94 | | for (i = 0; i < NUM_PENS; i++) |
| 95 | | { |
| 96 | | pens[i] = rgb_t(pal1bit(i >> 0), pal1bit(i >> 2), pal1bit(i >> 1)); |
| 97 | | } |
| 98 | | } |
| 99 | | |
| 100 | | |
| 101 | 88 | UINT32 sstrangr_state::screen_update_sstrngr2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 102 | 89 | { |
| 103 | | pen_t pens[NUM_PENS]; |
| 104 | | offs_t offs; |
| 105 | | UINT8 *color_map_base; |
| 90 | UINT8 *color_map_base = &memregion("proms")->base()[m_flip_screen ? 0x0000 : 0x0200]; |
| 106 | 91 | |
| 107 | | get_pens(pens); |
| 108 | | |
| 109 | | color_map_base = &memregion("proms")->base()[m_flip_screen ? 0x0000 : 0x0200]; |
| 110 | | |
| 111 | | for (offs = 0; offs < 0x2000; offs++) |
| 92 | for (offs_t offs = 0; offs < 0x2000; offs++) |
| 112 | 93 | { |
| 113 | | int i; |
| 114 | | |
| 115 | 94 | UINT8 y = offs >> 5; |
| 116 | 95 | UINT8 x = offs << 3; |
| 117 | 96 | |
| r248594 | r248595 | |
| 120 | 99 | UINT8 data = m_ram[offs]; |
| 121 | 100 | UINT8 fore_color = color_map_base[color_address] & 0x07; |
| 122 | 101 | |
| 123 | | for (i = 0; i < 8; i++) |
| 102 | for (int i = 0; i < 8; i++) |
| 124 | 103 | { |
| 125 | 104 | UINT8 color; |
| 126 | 105 | |
| r248594 | r248595 | |
| 135 | 114 | data = data >> 1; |
| 136 | 115 | } |
| 137 | 116 | |
| 138 | | bitmap.pix32(y, x) = pens[color]; |
| 117 | bitmap.pix32(y, x) = m_palette->pen_color(color); |
| 139 | 118 | |
| 140 | 119 | x = x + 1; |
| 141 | 120 | } |
| r248594 | r248595 | |
| 282 | 261 | MCFG_SCREEN_MODIFY("screen") |
| 283 | 262 | MCFG_SCREEN_UPDATE_DRIVER(sstrangr_state, screen_update_sstrngr2) |
| 284 | 263 | |
| 264 | MCFG_PALETTE_ADD_3BIT_RBG("palette") |
| 285 | 265 | MACHINE_CONFIG_END |
| 286 | 266 | |
| 287 | 267 | |