branches/kale/src/mess/includes/spectrum.h
| r244606 | r244607 | |
| 179 | 179 | UINT32 screen_update_tc2048(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 180 | 180 | UINT32 screen_update_ts2068(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 181 | 181 | void screen_eof_spectrum(screen_device &screen, bool state); |
| 182 | void screen_eof_timex(screen_device &screen, bool state); |
| 182 | 183 | INTERRUPT_GEN_MEMBER(spec_interrupt); |
| 183 | 184 | DECLARE_DEVICE_IMAGE_LOAD_MEMBER( spectrum_cart ); |
| 184 | 185 | |
| r244606 | r244607 | |
| 189 | 190 | |
| 190 | 191 | unsigned int m_previous_border_x, m_previous_border_y; |
| 191 | 192 | bitmap_ind16 m_border_bitmap; |
| 193 | unsigned int m_previous_screen_x, m_previous_screen_y; |
| 194 | bitmap_ind16 m_screen_bitmap; |
| 192 | 195 | |
| 193 | 196 | DECLARE_FLOPPY_FORMATS( floppy_formats ); |
| 194 | 197 | void spectrum_128_update_memory(); |
| r244606 | r244607 | |
| 233 | 236 | optional_ioport m_io_plus4; |
| 234 | 237 | |
| 235 | 238 | void spectrum_UpdateBorderBitmap(); |
| 236 | | inline unsigned char get_display_color (unsigned char color, int invert); |
| 239 | void spectrum_UpdateScreenBitmap(); |
| 240 | inline unsigned char get_display_color(unsigned char color, int invert); |
| 237 | 241 | inline void spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); |
| 238 | 242 | void ts2068_hires_scanline(bitmap_ind16 &bitmap, int y, int borderlines); |
| 239 | 243 | void ts2068_64col_scanline(bitmap_ind16 &bitmap, int y, int borderlines, unsigned short inkcolor); |
branches/kale/src/mess/video/spectrum.c
| r244606 | r244607 | |
| 25 | 25 | m_frame_number = 0; |
| 26 | 26 | m_flash_invert = 0; |
| 27 | 27 | |
| 28 | | m_previous_border_x = 0; m_previous_border_y = 0; |
| 28 | m_previous_border_x = 0; |
| 29 | m_previous_border_y = 0; |
| 29 | 30 | machine().first_screen()->register_screen_bitmap(m_border_bitmap); |
| 31 | m_previous_screen_x = 0; |
| 32 | m_previous_screen_y = 0; |
| 33 | machine().first_screen()->register_screen_bitmap(m_screen_bitmap); |
| 30 | 34 | |
| 31 | 35 | m_screen_location = m_video_ram; |
| 32 | 36 | } |
| r244606 | r244607 | |
| 37 | 41 | m_frame_number = 0; |
| 38 | 42 | m_flash_invert = 0; |
| 39 | 43 | |
| 40 | | m_previous_border_x = 0; m_previous_border_y = 0; |
| 44 | m_previous_border_x = 0; |
| 45 | m_previous_border_y = 0; |
| 41 | 46 | machine().first_screen()->register_screen_bitmap(m_border_bitmap); |
| 47 | m_previous_screen_x = 0; |
| 48 | m_previous_screen_y = 0; |
| 49 | machine().first_screen()->register_screen_bitmap(m_screen_bitmap); |
| 42 | 50 | |
| 43 | 51 | m_screen_location = m_ram->pointer() + (5 << 14); |
| 44 | 52 | } |
| r244606 | r244607 | |
| 61 | 69 | if (state) |
| 62 | 70 | { |
| 63 | 71 | spectrum_UpdateBorderBitmap(); |
| 72 | spectrum_UpdateScreenBitmap(); |
| 64 | 73 | |
| 65 | 74 | m_frame_number++; |
| 66 | 75 | |
| r244606 | r244607 | |
| 104 | 113 | |
| 105 | 114 | UINT32 spectrum_state::screen_update_spectrum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 106 | 115 | { |
| 116 | static const rectangle rect(SPEC_LEFT_BORDER, SPEC_LEFT_BORDER + SPEC_DISPLAY_XSIZE - 1, SPEC_TOP_BORDER, SPEC_TOP_BORDER + SPEC_DISPLAY_YSIZE - 1); |
| 117 | |
| 107 | 118 | if (m_border_bitmap.valid()) |
| 108 | 119 | copyscrollbitmap(bitmap, m_border_bitmap, 0, 0, 0, 0, cliprect); |
| 109 | 120 | |
| 121 | spectrum_UpdateScreenBitmap(); |
| 122 | if (m_screen_bitmap.valid()) |
| 123 | copyscrollbitmap(bitmap, m_screen_bitmap, 0, 0, 0, 0, rect); |
| 124 | |
| 110 | 125 | #if 0 |
| 111 | 126 | // note, don't update borders in here, this can time travel w/regards to other timers and may end up giving you |
| 112 | 127 | // screen positions earlier than the last write handler gave you |
| r244606 | r244607 | |
| 181 | 196 | palette.set_pen_colors(0, spectrum_palette, ARRAY_LENGTH(spectrum_palette)); |
| 182 | 197 | } |
| 183 | 198 | |
| 184 | | |
| 185 | | /* The code below is just a per-pixel 'partial update' for the border */ |
| 186 | | |
| 187 | | void spectrum_state::spectrum_UpdateBorderBitmap() |
| 199 | void spectrum_state::spectrum_UpdateScreenBitmap() |
| 188 | 200 | { |
| 189 | 201 | unsigned int x = machine().first_screen()->hpos(); |
| 190 | 202 | unsigned int y = machine().first_screen()->vpos(); |
| 191 | | int width = m_border_bitmap.width(); |
| 192 | | int height = m_border_bitmap.height(); |
| 203 | int width = m_screen_bitmap.width(); |
| 204 | int height = m_screen_bitmap.height(); |
| 193 | 205 | |
| 194 | 206 | |
| 195 | | if (m_border_bitmap.valid()) |
| 207 | if (m_screen_bitmap.valid()) |
| 196 | 208 | { |
| 197 | | UINT16 border = m_port_fe_data & 0x07; |
| 209 | //printf("update screen from %d,%d to %d,%d\n", m_previous_screen_x, m_previous_screen_y, x, y); |
| 198 | 210 | |
| 199 | | //printf("update border from %d,%d to %d,%d\n", m_previous_border_x, m_previous_border_y, x, y); |
| 200 | | |
| 201 | 211 | do |
| 202 | 212 | { |
| 203 | | UINT16 scrx = m_previous_border_x - SPEC_LEFT_BORDER; |
| 204 | | UINT16 scry = m_previous_border_y - SPEC_TOP_BORDER; |
| 213 | UINT16 scrx = m_previous_screen_x - SPEC_LEFT_BORDER; |
| 214 | UINT16 scry = m_previous_screen_y - SPEC_TOP_BORDER; |
| 205 | 215 | |
| 206 | 216 | if (scrx < SPEC_DISPLAY_XSIZE && scry < SPEC_DISPLAY_YSIZE) |
| 207 | 217 | { |
| 208 | 218 | // this can/must be optimised |
| 209 | 219 | if ((scrx & 7) == 0) { |
| 210 | | UINT16 *bm = &m_border_bitmap.pix16(m_previous_border_y, m_previous_border_x); |
| 220 | UINT16 *bm = &m_screen_bitmap.pix16(m_previous_screen_y, m_previous_screen_x); |
| 211 | 221 | UINT8 attr = *(m_screen_location + ((scry & 0xF8) << 2) + (scrx >> 3) + 0x1800); |
| 212 | 222 | UINT8 scr = *(m_screen_location + ((scry & 7) << 8) + ((scry & 0x38) << 2) + ((scry & 0xC0) << 5) + (scrx >> 3)); |
| 213 | 223 | UINT16 ink = (attr & 0x07) + ((attr >> 3) & 0x08); |
| r244606 | r244607 | |
| 219 | 229 | for (UINT8 b = 0x80; b != 0; b >>= 1) |
| 220 | 230 | *bm++ = (scr & b) ? ink : pap; |
| 221 | 231 | } |
| 222 | | } else |
| 223 | | m_border_bitmap.pix16(m_previous_border_y, m_previous_border_x) = border; |
| 232 | } |
| 224 | 233 | |
| 234 | m_previous_screen_x += 1; |
| 235 | |
| 236 | if (m_previous_screen_x >= width) |
| 237 | { |
| 238 | m_previous_screen_x = 0; |
| 239 | m_previous_screen_y += 1; |
| 240 | |
| 241 | if (m_previous_screen_y >= height) |
| 242 | { |
| 243 | m_previous_screen_y = 0; |
| 244 | } |
| 245 | } |
| 246 | } while (!((m_previous_screen_x == x) && (m_previous_screen_y == y))); |
| 247 | |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | /* The code below is just a per-pixel 'partial update' for the border */ |
| 252 | |
| 253 | void spectrum_state::spectrum_UpdateBorderBitmap() |
| 254 | { |
| 255 | unsigned int x = machine().first_screen()->hpos(); |
| 256 | unsigned int y = machine().first_screen()->vpos(); |
| 257 | int width = m_border_bitmap.width(); |
| 258 | int height = m_border_bitmap.height(); |
| 259 | |
| 260 | |
| 261 | if (m_border_bitmap.valid()) |
| 262 | { |
| 263 | UINT16 border = m_port_fe_data & 0x07; |
| 264 | |
| 265 | //printf("update border from %d,%d to %d,%d\n", m_previous_border_x, m_previous_border_y, x, y); |
| 266 | |
| 267 | do |
| 268 | { |
| 269 | m_border_bitmap.pix16(m_previous_border_y, m_previous_border_x) = border; |
| 270 | |
| 225 | 271 | m_previous_border_x += 1; |
| 226 | 272 | |
| 227 | 273 | if (m_previous_border_x >= width) |