src/mess/audio/mos7360.c
| r0 | r15841 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | MOS 7360/8360 Text Edit Device (TED) emulation |
| 4 | |
| 5 | Copyright MESS Team. |
| 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | |
| 8 | **********************************************************************/ |
| 9 | |
| 10 | #include "emu.h" |
| 11 | #include "mos7360.h" |
| 12 | |
| 13 | |
| 14 | |
| 15 | //************************************************************************** |
| 16 | // MACROS / CONSTANTS |
| 17 | //************************************************************************** |
| 18 | |
| 19 | #define LOG 0 |
| 20 | |
| 21 | |
| 22 | #define VERBOSE_LEVEL 0 |
| 23 | #define DBG_LOG(N,M,A) \ |
| 24 | do { \ |
| 25 | if(VERBOSE_LEVEL >= N) \ |
| 26 | { \ |
| 27 | if( M ) \ |
| 28 | logerror("%11.6f: %-24s", machine().time().as_double(), (char*) M ); \ |
| 29 | logerror A; \ |
| 30 | } \ |
| 31 | } while(0) |
| 32 | |
| 33 | |
| 34 | #define VREFRESHINLINES 28 |
| 35 | |
| 36 | #define TIMER1HELPER (m_reg[0] | (m_reg[1] << 8)) |
| 37 | #define TIMER2HELPER (m_reg[2] | (m_reg[3] << 8)) |
| 38 | #define TIMER3HELPER (m_reg[4] | (m_reg[5] << 8)) |
| 39 | #define TIMER1 (TIMER1HELPER ? TIMER1HELPER : 0x10000) |
| 40 | #define TIMER2 (TIMER2HELPER ? TIMER2HELPER : 0x10000) |
| 41 | #define TIMER3 (TIMER3HELPER ? TIMER3HELPER : 0x10000) |
| 42 | |
| 43 | #define TED7360_YPOS 40 |
| 44 | #define RASTERLINE_2_C16(a) ((a + m_lines - TED7360_YPOS - 5) % m_lines) |
| 45 | #define C16_2_RASTERLINE(a) ((a + TED7360_YPOS + 5) % m_lines) |
| 46 | #define XPOS 8 |
| 47 | #define YPOS 8 |
| 48 | |
| 49 | #define SCREENON (m_reg[6] & 0x10) |
| 50 | #define TEST (m_reg[6] & 0x80) |
| 51 | #define VERTICALPOS (m_reg[6] & 0x07) |
| 52 | #define HORICONTALPOS (m_reg[7] & 0x07) |
| 53 | #define ECMON (m_reg[6] & 0x40) |
| 54 | #define HIRESON (m_reg[6] & 0x20) |
| 55 | #define MULTICOLORON (m_reg[7] & 0x10) |
| 56 | #define REVERSEON (!(m_reg[7] & 0x80)) |
| 57 | |
| 58 | /* hardware inverts character when bit 7 set (character taken &0x7f) */ |
| 59 | /* instead of fetching character with higher number! */ |
| 60 | #define LINES25 (m_reg[6] & 0x08) /* else 24 Lines */ |
| 61 | #define LINES (LINES25 ? 25 : 24) |
| 62 | #define YSIZE (LINES * 8) |
| 63 | #define COLUMNS40 (m_reg[7] & 0x08) /* else 38 Columns */ |
| 64 | #define COLUMNS (COLUMNS40 ? 40 : 38) |
| 65 | #define XSIZE (COLUMNS * 8) |
| 66 | |
| 67 | #define INROM (m_reg[0x12] & 0x04) |
| 68 | #define CHARGENADDR (REVERSEON && !HIRESON && !MULTICOLORON ? ((m_reg[0x13] & 0xfc) << 8) : ((m_reg[0x13] & 0xf8) << 8)) |
| 69 | #define BITMAPADDR ((m_reg[0x12] & 0x38) << 10) |
| 70 | #define VIDEOADDR ((m_reg[0x14] & 0xf8) << 8) |
| 71 | |
| 72 | #define RASTERLINE (((m_reg[0xa] & 0x01) << 8) | m_reg[0xb]) |
| 73 | #define CURSOR1POS (m_reg[0xd] | ((m_reg[0xc] & 0x03) << 8)) |
| 74 | #define CURSOR2POS (m_reg[0x1b] | ((m_reg[0x1a] & 0x03) << 8)) |
| 75 | #define CURSORRATE ((m_reg[0x1f] & 0x7c) >> 2) |
| 76 | |
| 77 | #define BACKGROUNDCOLOR (m_reg[0x15] & 0x7f) |
| 78 | #define FOREGROUNDCOLOR (m_reg[0x16] & 0x7f) |
| 79 | #define MULTICOLOR1 (m_reg[0x17] & 0x7f) |
| 80 | #define MULTICOLOR2 (m_reg[0x18] & 0x7f) |
| 81 | #define FRAMECOLOR (m_reg[0x19] & 0x7f) |
| 82 | |
| 83 | #define TED7360_CLOCK (m_clock / 4) |
| 84 | #define TED7360_VRETRACERATE ((m_clock == TED7360PAL_CLOCK) ? TED7360PAL_VRETRACERATE : TED7360NTSC_VRETRACERATE) |
| 85 | #define TED7360_LINES ((m_clock == TED7360PAL_CLOCK) ? TED7360PAL_LINES : TED7360NTSC_LINES) |
| 86 | |
| 87 | static attotime TEDTIME_IN_CYCLES(int cycles) |
| 88 | { |
| 89 | double d = (double)(cycles) / clock(); |
| 90 | return attotime::from_double(d); |
| 91 | } |
| 92 | |
| 93 | static int TEDTIME_TO_CYCLES(attotime t) |
| 94 | { |
| 95 | double d = t.as_double(); |
| 96 | return (int)(d * clock()); |
| 97 | } |
| 98 | |
| 99 | static const UINT8 PALETTE[] = |
| 100 | { |
| 101 | /* black, white, red, cyan */ |
| 102 | /* purple, green, blue, yellow */ |
| 103 | /* orange, light orange, pink, light cyan, */ |
| 104 | /* light violett, light green, light blue, light yellow */ |
| 105 | /* these 16 colors are 8 times here in different luminance (dark..light) */ |
| 106 | /* taken from digitized tv screenshot */ |
| 107 | 0x06, 0x01, 0x03, 0x2b, 0x2b, 0x2b, 0x67, 0x0e, 0x0f, 0x00, 0x3f, 0x42, |
| 108 | 0x57, 0x00, 0x6d, 0x00, 0x4e, 0x00, 0x19, 0x1c, 0x94, 0x38, 0x38, 0x00, |
| 109 | 0x56, 0x20, 0x00, 0x4b, 0x28, 0x00, 0x16, 0x48, 0x00, 0x69, 0x07, 0x2f, |
| 110 | 0x00, 0x46, 0x26, 0x06, 0x2a, 0x80, 0x2a, 0x14, 0x9b, 0x0b, 0x49, 0x00, |
| 111 | |
| 112 | 0x00, 0x03, 0x02, 0x3d, 0x3d, 0x3d, 0x75, 0x1e, 0x20, 0x00, 0x50, 0x4f, |
| 113 | 0x6a, 0x10, 0x78, 0x04, 0x5c, 0x00, 0x2a, 0x2a, 0xa3, 0x4c, 0x47, 0x00, |
| 114 | 0x69, 0x2f, 0x00, 0x59, 0x38, 0x00, 0x26, 0x56, 0x00, 0x75, 0x15, 0x41, |
| 115 | 0x00, 0x58, 0x3d, 0x15, 0x3d, 0x8f, 0x39, 0x22, 0xae, 0x19, 0x59, 0x00, |
| 116 | |
| 117 | 0x00, 0x03, 0x04, 0x42, 0x42, 0x42, 0x7b, 0x28, 0x20, 0x02, 0x56, 0x59, |
| 118 | 0x6f, 0x1a, 0x82, 0x0a, 0x65, 0x09, 0x30, 0x34, 0xa7, 0x50, 0x51, 0x00, |
| 119 | 0x6e, 0x36, 0x00, 0x65, 0x40, 0x00, 0x2c, 0x5c, 0x00, 0x7d, 0x1e, 0x45, |
| 120 | 0x01, 0x61, 0x45, 0x1c, 0x45, 0x99, 0x42, 0x2d, 0xad, 0x1d, 0x62, 0x00, |
| 121 | |
| 122 | 0x05, 0x00, 0x02, 0x56, 0x55, 0x5a, 0x90, 0x3c, 0x3b, 0x17, 0x6d, 0x72, |
| 123 | 0x87, 0x2d, 0x99, 0x1f, 0x7b, 0x15, 0x46, 0x49, 0xc1, 0x66, 0x63, 0x00, |
| 124 | 0x84, 0x4c, 0x0d, 0x73, 0x55, 0x00, 0x40, 0x72, 0x00, 0x91, 0x33, 0x5e, |
| 125 | 0x19, 0x74, 0x5c, 0x32, 0x59, 0xae, 0x59, 0x3f, 0xc3, 0x32, 0x76, 0x00, |
| 126 | |
| 127 | 0x02, 0x01, 0x06, 0x84, 0x7e, 0x85, 0xbb, 0x67, 0x68, 0x45, 0x96, 0x96, |
| 128 | 0xaf, 0x58, 0xc3, 0x4a, 0xa7, 0x3e, 0x73, 0x73, 0xec, 0x92, 0x8d, 0x11, |
| 129 | 0xaf, 0x78, 0x32, 0xa1, 0x80, 0x20, 0x6c, 0x9e, 0x12, 0xba, 0x5f, 0x89, |
| 130 | 0x46, 0x9f, 0x83, 0x61, 0x85, 0xdd, 0x84, 0x6c, 0xef, 0x5d, 0xa3, 0x29, |
| 131 | |
| 132 | 0x02, 0x00, 0x0a, 0xb2, 0xac, 0xb3, 0xe9, 0x92, 0x92, 0x6c, 0xc3, 0xc1, |
| 133 | 0xd9, 0x86, 0xf0, 0x79, 0xd1, 0x76, 0x9d, 0xa1, 0xff, 0xbd, 0xbe, 0x40, |
| 134 | 0xdc, 0xa2, 0x61, 0xd1, 0xa9, 0x4c, 0x93, 0xc8, 0x3d, 0xe9, 0x8a, 0xb1, |
| 135 | 0x6f, 0xcd, 0xab, 0x8a, 0xb4, 0xff, 0xb2, 0x9a, 0xff, 0x88, 0xcb, 0x59, |
| 136 | |
| 137 | 0x02, 0x00, 0x0a, 0xc7, 0xca, 0xc9, 0xff, 0xac, 0xac, 0x85, 0xd8, 0xe0, |
| 138 | 0xf3, 0x9c, 0xff, 0x92, 0xea, 0x8a, 0xb7, 0xba, 0xff, 0xd6, 0xd3, 0x5b, |
| 139 | 0xf3, 0xbe, 0x79, 0xe6, 0xc5, 0x65, 0xb0, 0xe0, 0x57, 0xff, 0xa4, 0xcf, |
| 140 | 0x89, 0xe5, 0xc8, 0xa4, 0xca, 0xff, 0xca, 0xb3, 0xff, 0xa2, 0xe5, 0x7a, |
| 141 | |
| 142 | 0x01, 0x01, 0x01, 0xff, 0xff, 0xff, 0xff, 0xf6, 0xf2, 0xd1, 0xff, 0xff, |
| 143 | 0xff, 0xe9, 0xff, 0xdb, 0xff, 0xd3, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xa3, |
| 144 | 0xff, 0xff, 0xc1, 0xff, 0xff, 0xb2, 0xfc, 0xff, 0xa2, 0xff, 0xee, 0xff, |
| 145 | 0xd1, 0xff, 0xff, 0xeb, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xed, 0xff, 0xbc |
| 146 | }; |
| 147 | |
| 148 | |
| 149 | #define NOISE_BUFFER_SIZE_SEC 5 |
| 150 | |
| 151 | #define TONE_ON (!(m_reg[0x11] & 0x80)) /* or tone update!? */ |
| 152 | #define TONE1_ON ((m_reg[0x11] & 0x10)) |
| 153 | #define TONE1_VALUE (m_reg[0x0e] | ((m_reg[0x12] & 3) << 8)) |
| 154 | #define TONE2_ON ((m_reg[0x11] & 0x20)) |
| 155 | #define TONE2_VALUE (m_reg[0x0f] | ((m_reg[0x10] & 3) << 8)) |
| 156 | #define VOLUME (m_reg[0x11] & 0x0f) |
| 157 | #define NOISE_ON (m_reg[0x11] & 0x40) |
| 158 | |
| 159 | /* |
| 160 | * pal 111860.781 |
| 161 | * ntsc 111840.45 |
| 162 | */ |
| 163 | #define TONE_FREQUENCY(reg) ((TED7360_CLOCK >> 3) / (1024 - reg)) |
| 164 | #define TONE_FREQUENCY_MIN (TONE_FREQUENCY(0)) |
| 165 | #define NOISE_FREQUENCY (TED7360_CLOCK / 8 / (1024 - TONE2_VALUE)) |
| 166 | #define NOISE_FREQUENCY_MAX (TED7360_CLOCK / 8) |
| 167 | |
| 168 | |
| 169 | //************************************************************************** |
| 170 | // GLOBAL VARIABLES |
| 171 | //************************************************************************** |
| 172 | |
| 173 | // device type definition |
| 174 | const device_type MOS7360 = &device_creator<mos7360_device>; |
| 175 | |
| 176 | |
| 177 | |
| 178 | //************************************************************************** |
| 179 | // INLINE HELPERS |
| 180 | //************************************************************************** |
| 181 | |
| 182 | inline void mos7360_device::set_interrupt(int mask) |
| 183 | { |
| 184 | /* kernel itself polls for timer 2 shot (interrupt disabled!) when cassette loading */ |
| 185 | m_reg[9] |= mask; |
| 186 | if ((m_reg[0xa] & m_reg[9] & 0x5e)) |
| 187 | { |
| 188 | if (!(m_reg[9] & 0x80)) |
| 189 | { |
| 190 | //DBG_LOG(1, "ted7360", ("irq start %.2x\n", mask)); |
| 191 | m_reg[9] |= 0x80; |
| 192 | m_out_irq_func(ASSERT_LINE); |
| 193 | } |
| 194 | } |
| 195 | m_reg[9] |= mask; |
| 196 | } |
| 197 | |
| 198 | inline void mos7360_device::clear_interrupt(int mask) |
| 199 | { |
| 200 | m_reg[9] &= ~mask; |
| 201 | if ((m_reg[9] & 0x80) && !(m_reg[9] & m_reg[0xa] & 0x5e)) |
| 202 | { |
| 203 | DBG_LOG(1, "ted7360", ("irq end %.2x\n", mask)); |
| 204 | m_reg[9] &= ~0x80; |
| 205 | m_out_irq_func(CLEAR_LINE); |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | inline int mos7360_device::rastercolumn() |
| 210 | { |
| 211 | return (int) ((machine().time().as_double() - m_rastertime) * TED7360_VRETRACERATE * m_lines * 57 * 8 + 0.5); |
| 212 | } |
| 213 | |
| 214 | |
| 215 | |
| 216 | //************************************************************************** |
| 217 | // LIVE DEVICE |
| 218 | //************************************************************************** |
| 219 | |
| 220 | //------------------------------------------------- |
| 221 | // mos7360_device - constructor |
| 222 | //------------------------------------------------- |
| 223 | |
| 224 | mos7360_device::mos7360_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 225 | : device_t(mconfig, MOS7360, "MOS7360", tag, owner, clock), |
| 226 | device_sound_interface(mconfig, *this), |
| 227 | m_stream(NULL) |
| 228 | { |
| 229 | } |
| 230 | |
| 231 | |
| 232 | //------------------------------------------------- |
| 233 | // device_config_complete - perform any |
| 234 | // operations now that the configuration is |
| 235 | // complete |
| 236 | //------------------------------------------------- |
| 237 | |
| 238 | void mos7360_device::device_config_complete() |
| 239 | { |
| 240 | // inherit a copy of the static data |
| 241 | const mos7360_interface *intf = reinterpret_cast<const mos7360_interface *>(static_config()); |
| 242 | if (intf != NULL) |
| 243 | *static_cast<mos7360_interface *>(this) = *intf; |
| 244 | |
| 245 | // or initialize to defaults if none provided |
| 246 | else |
| 247 | { |
| 248 | memset(&m_out_irq_cb, 0, sizeof(m_out_irq_cb)); |
| 249 | memset(&m_in_ram_cb, 0, sizeof(m_in_ram_cb)); |
| 250 | memset(&m_in_rom_cb, 0, sizeof(m_in_rom_cb)); |
| 251 | memset(&m_in_k_cb, 0, sizeof(m_in_k_cb)); |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | |
| 256 | //------------------------------------------------- |
| 257 | // device_start - device-specific startup |
| 258 | //------------------------------------------------- |
| 259 | |
| 260 | void mos7360_device::device_start() |
| 261 | { |
| 262 | // get the screen device |
| 263 | m_screen = machine().device<screen_device>(m_screen_tag); |
| 264 | assert(m_screen != NULL); |
| 265 | |
| 266 | // get the CPU device |
| 267 | m_cpu = machine().device<cpu_device>(m_cpu_tag); |
| 268 | assert(m_cpu != NULL); |
| 269 | |
| 270 | // resolve callbacks |
| 271 | m_out_irq_func.resolve(m_out_irq_cb, *this); |
| 272 | m_in_ram_func.resolve(m_in_ram_cb, *this); |
| 273 | m_in_rom_func.resolve(m_in_rom_cb, *this); |
| 274 | m_in_k_func.resolve(m_in_k_cb, *this); |
| 275 | |
| 276 | // allocate timers |
| 277 | m_timer1 = timer_alloc(TIMER_ID_1); |
| 278 | m_timer2 = timer_alloc(TIMER_ID_2); |
| 279 | m_timer3 = timer_alloc(TIMER_ID_3); |
| 280 | |
| 281 | // initialize palette |
| 282 | initialize_palette(); |
| 283 | |
| 284 | // allocate screen bitmap |
| 285 | m_screen->register_screen_bitmap(m_bitmap); |
| 286 | |
| 287 | // create sound stream |
| 288 | m_stream = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate()); |
| 289 | |
| 290 | // buffer for fastest played sample for 5 second so we have enough data for min 5 second |
| 291 | m_noisesize = NOISE_FREQUENCY_MAX * NOISE_BUFFER_SIZE_SEC; |
| 292 | m_noise = auto_alloc_array(machine(), UINT8, m_noisesize); |
| 293 | |
| 294 | { |
| 295 | int noiseshift = 0x7ffff8; |
| 296 | UINT8 data; |
| 297 | |
| 298 | for (int i = 0; i < m_noisesize; i++) |
| 299 | { |
| 300 | data = 0; |
| 301 | if (noiseshift & 0x400000) |
| 302 | data |= 0x80; |
| 303 | if (noiseshift & 0x100000) |
| 304 | data |= 0x40; |
| 305 | if (noiseshift & 0x010000) |
| 306 | data |= 0x20; |
| 307 | if (noiseshift & 0x002000) |
| 308 | data |= 0x10; |
| 309 | if (noiseshift & 0x000800) |
| 310 | data |= 0x08; |
| 311 | if (noiseshift & 0x000080) |
| 312 | data |= 0x04; |
| 313 | if (noiseshift & 0x000010) |
| 314 | data |= 0x02; |
| 315 | if (noiseshift & 0x000004) |
| 316 | data |= 0x01; |
| 317 | m_noise[i] = data; |
| 318 | if (((noiseshift & 0x400000) == 0) != ((noiseshift & 0x002000) == 0)) |
| 319 | noiseshift = (noiseshift << 1) | 1; |
| 320 | else |
| 321 | noiseshift <<= 1; |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | // register for state saving |
| 326 | //save_item(NAME()); |
| 327 | } |
| 328 | |
| 329 | |
| 330 | //------------------------------------------------- |
| 331 | // device_reset - device-specific reset |
| 332 | //------------------------------------------------- |
| 333 | |
| 334 | void mos7360_device::device_reset() |
| 335 | { |
| 336 | memset(m_reg, 0, ARRAY_LENGTH(m_reg)); |
| 337 | |
| 338 | m_rom = 1; // FIXME: at start should be RAM or ROM? old c16 code set it to ROM at init: is it correct? |
| 339 | |
| 340 | m_lines = TED7360_LINES; |
| 341 | m_chargenaddr = m_bitmapaddr = m_videoaddr = 0; |
| 342 | m_timer1_active = m_timer2_active = m_timer3_active = 0; |
| 343 | m_cursor1 = 0; |
| 344 | |
| 345 | m_rasterline = 0; |
| 346 | m_lastline = 0; |
| 347 | |
| 348 | m_rastertime = 0.0; |
| 349 | |
| 350 | m_frame_count = 0; |
| 351 | |
| 352 | m_x_begin = 0; |
| 353 | m_x_end = 0; |
| 354 | m_y_begin = 0; |
| 355 | m_y_end = 0; |
| 356 | |
| 357 | memset(m_c16_bitmap, 0, ARRAY_LENGTH(m_c16_bitmap)); |
| 358 | memset(m_bitmapmulti, 0, ARRAY_LENGTH(m_bitmapmulti)); |
| 359 | memset(m_mono, 0, ARRAY_LENGTH(m_mono)); |
| 360 | memset(m_monoinversed, 0, ARRAY_LENGTH(m_monoinversed)); |
| 361 | memset(m_multi, 0, ARRAY_LENGTH(m_multi)); |
| 362 | memset(m_ecmcolor, 0, ARRAY_LENGTH(m_ecmcolor)); |
| 363 | memset(m_colors, 0, ARRAY_LENGTH(m_colors)); |
| 364 | |
| 365 | m_tone1pos = 0; |
| 366 | m_tone2pos = 0; |
| 367 | m_tone1samples = 1; |
| 368 | m_tone2samples = 1; |
| 369 | m_noisepos = 0; |
| 370 | m_noisesamples = 1; |
| 371 | } |
| 372 | |
| 373 | |
| 374 | //------------------------------------------------- |
| 375 | // device_timer - handler timer events |
| 376 | //------------------------------------------------- |
| 377 | |
| 378 | void mos7360_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 379 | { |
| 380 | switch (id) |
| 381 | { |
| 382 | case TIMER_ID_1: |
| 383 | // proved by digisound of several intros like eoroidpro |
| 384 | m_timer1->adjust(TEDTIME_IN_CYCLES(TIMER1), 1); |
| 385 | m_timer1_active = 1; |
| 386 | set_interrupt(0x08); |
| 387 | break; |
| 388 | |
| 389 | case TIMER_ID_2: |
| 390 | m_timer2->adjust(TEDTIME_IN_CYCLES(0x10000), 2); |
| 391 | m_timer2_active = 1; |
| 392 | set_interrupt(0x10); |
| 393 | break; |
| 394 | |
| 395 | case TIMER_ID_3: |
| 396 | m_timer3->adjust(TEDTIME_IN_CYCLES(0x10000), 3); |
| 397 | m_timer3_active = 1; |
| 398 | set_interrupt(0x40); |
| 399 | break; |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | |
| 404 | //------------------------------------------------- |
| 405 | // initialize_palette - initialize palette |
| 406 | //------------------------------------------------- |
| 407 | |
| 408 | void mos7360_device::initialize_palette() |
| 409 | { |
| 410 | int i; |
| 411 | |
| 412 | for (i = 0; i < sizeof(PALETTE) / 3; i++) |
| 413 | palette_set_color_rgb(machine(), i, PALETTE[i * 3], PALETTE[i * 3 + 1], PALETTE[i * 3 + 2]); |
| 414 | } |
| 415 | |
| 416 | |
| 417 | //------------------------------------------------- |
| 418 | // sound_stream_update - handle update requests for |
| 419 | // our sound stream |
| 420 | //------------------------------------------------- |
| 421 | |
| 422 | void mos7360_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) |
| 423 | { |
| 424 | int i, v, a; |
| 425 | stream_sample_t *buffer = outputs[0]; |
| 426 | |
| 427 | for (i = 0; i < samples; i++) |
| 428 | { |
| 429 | v = 0; |
| 430 | |
| 431 | if (TONE1_ON) |
| 432 | { |
| 433 | if (m_tone1pos <= m_tone1samples / 2 || !TONE_ON) |
| 434 | v += 0x2ff; // depends on the volume between sound and noise |
| 435 | |
| 436 | m_tone1pos++; |
| 437 | |
| 438 | if (m_tone1pos > m_tone1samples) |
| 439 | m_tone1pos = 0; |
| 440 | } |
| 441 | |
| 442 | if (TONE2_ON || NOISE_ON ) |
| 443 | { |
| 444 | if (TONE2_ON) |
| 445 | { /*higher priority ?! */ |
| 446 | if (m_tone2pos <= m_tone2samples / 2 || !TONE_ON) |
| 447 | v += 0x2ff; |
| 448 | |
| 449 | m_tone2pos++; |
| 450 | |
| 451 | if (m_tone2pos > m_tone2samples) |
| 452 | m_tone2pos = 0; |
| 453 | } |
| 454 | else |
| 455 | { |
| 456 | v += m_noise[(int) ((double) m_noisepos * m_noisesize / m_noisesamples)]; |
| 457 | m_noisepos++; |
| 458 | |
| 459 | if ((double) m_noisepos / m_noisesamples >= 1.0) |
| 460 | m_noisepos = 0; |
| 461 | } |
| 462 | } |
| 463 | |
| 464 | a = VOLUME; |
| 465 | if (a > 8) |
| 466 | a = 8; |
| 467 | |
| 468 | v = v * a; |
| 469 | |
| 470 | buffer[i] = v; |
| 471 | } |
| 472 | } |
| 473 | |
| 474 | |
| 475 | void mos7360_device::draw_character(int ybegin, int yend, int ch, int yoff, int xoff, UINT16 *color) |
| 476 | { |
| 477 | int y, code; |
| 478 | |
| 479 | for (y = ybegin; y <= yend; y++) |
| 480 | { |
| 481 | if (INROM) |
| 482 | code = m_in_rom_func(m_chargenaddr + ch * 8 + y); |
| 483 | else |
| 484 | code = m_in_ram_func(m_chargenaddr + ch * 8 + y); |
| 485 | |
| 486 | m_bitmap.pix16(y + yoff, 0 + xoff) = color[code >> 7]; |
| 487 | m_bitmap.pix16(y + yoff, 1 + xoff) = color[(code >> 6) & 1]; |
| 488 | m_bitmap.pix16(y + yoff, 2 + xoff) = color[(code >> 5) & 1]; |
| 489 | m_bitmap.pix16(y + yoff, 3 + xoff) = color[(code >> 4) & 1]; |
| 490 | m_bitmap.pix16(y + yoff, 4 + xoff) = color[(code >> 3) & 1]; |
| 491 | m_bitmap.pix16(y + yoff, 5 + xoff) = color[(code >> 2) & 1]; |
| 492 | m_bitmap.pix16(y + yoff, 6 + xoff) = color[(code >> 1) & 1]; |
| 493 | m_bitmap.pix16(y + yoff, 7 + xoff) = color[code & 1]; |
| 494 | } |
| 495 | } |
| 496 | |
| 497 | void mos7360_device::draw_character_multi(int ybegin, int yend, int ch, int yoff, int xoff) |
| 498 | { |
| 499 | int y, code; |
| 500 | |
| 501 | for (y = ybegin; y <= yend; y++) |
| 502 | { |
| 503 | if (INROM) |
| 504 | code = m_in_rom_func(m_chargenaddr + ch * 8 + y); |
| 505 | else |
| 506 | code = m_in_ram_func(m_chargenaddr + ch * 8 + y); |
| 507 | |
| 508 | m_bitmap.pix16(y + yoff, 0 + xoff) = |
| 509 | m_bitmap.pix16(y + yoff, 1 + xoff) = m_multi[code >> 6]; |
| 510 | m_bitmap.pix16(y + yoff, 2 + xoff) = |
| 511 | m_bitmap.pix16(y + yoff, 3 + xoff) = m_multi[(code >> 4) & 3]; |
| 512 | m_bitmap.pix16(y + yoff, 4 + xoff) = |
| 513 | m_bitmap.pix16(y + yoff, 5 + xoff) = m_multi[(code >> 2) & 3]; |
| 514 | m_bitmap.pix16(y + yoff, 6 + xoff) = |
| 515 | m_bitmap.pix16(y + yoff, 7 + xoff) = m_multi[code & 3]; |
| 516 | } |
| 517 | } |
| 518 | |
| 519 | void mos7360_device::draw_bitmap(int ybegin, int yend, int ch, int yoff, int xoff) |
| 520 | { |
| 521 | int y, code; |
| 522 | |
| 523 | for (y = ybegin; y <= yend; y++) |
| 524 | { |
| 525 | code = m_in_ram_func(m_bitmapaddr + ch * 8 + y); |
| 526 | m_bitmap.pix16(y + yoff, 0 + xoff) = m_c16_bitmap[code >> 7]; |
| 527 | m_bitmap.pix16(y + yoff, 1 + xoff) = m_c16_bitmap[(code >> 6) & 1]; |
| 528 | m_bitmap.pix16(y + yoff, 2 + xoff) = m_c16_bitmap[(code >> 5) & 1]; |
| 529 | m_bitmap.pix16(y + yoff, 3 + xoff) = m_c16_bitmap[(code >> 4) & 1]; |
| 530 | m_bitmap.pix16(y + yoff, 4 + xoff) = m_c16_bitmap[(code >> 3) & 1]; |
| 531 | m_bitmap.pix16(y + yoff, 5 + xoff) = m_c16_bitmap[(code >> 2) & 1]; |
| 532 | m_bitmap.pix16(y + yoff, 6 + xoff) = m_c16_bitmap[(code >> 1) & 1]; |
| 533 | m_bitmap.pix16(y + yoff, 7 + xoff) = m_c16_bitmap[code & 1]; |
| 534 | } |
| 535 | } |
| 536 | |
| 537 | void mos7360_device::draw_bitmap_multi(int ybegin, int yend, int ch, int yoff, int xoff) |
| 538 | { |
| 539 | int y, code; |
| 540 | |
| 541 | for (y = ybegin; y <= yend; y++) |
| 542 | { |
| 543 | code = m_in_ram_func(m_bitmapaddr + ch * 8 + y); |
| 544 | |
| 545 | m_bitmap.pix16(y + yoff, 0 + xoff) = |
| 546 | m_bitmap.pix16(y + yoff, 1 + xoff) = m_bitmapmulti[code >> 6]; |
| 547 | m_bitmap.pix16(y + yoff, 2 + xoff) = |
| 548 | m_bitmap.pix16(y + yoff, 3 + xoff) = m_bitmapmulti[(code >> 4) & 3]; |
| 549 | m_bitmap.pix16(y + yoff, 4 + xoff) = |
| 550 | m_bitmap.pix16(y + yoff, 5 + xoff) = m_bitmapmulti[(code >> 2) & 3]; |
| 551 | m_bitmap.pix16(y + yoff, 6 + xoff) = |
| 552 | m_bitmap.pix16(y + yoff, 7 + xoff) = m_bitmapmulti[code & 3]; |
| 553 | } |
| 554 | } |
| 555 | |
| 556 | #ifndef memset16 |
| 557 | static void *memset16 (void *dest, int value, size_t size) |
| 558 | { |
| 559 | register int i; |
| 560 | |
| 561 | for (i = 0; i < size; i++) |
| 562 | ((short *) dest)[i] = value; |
| 563 | return dest; |
| 564 | } |
| 565 | #endif |
| 566 | |
| 567 | void mos7360_device::draw_cursor(int ybegin, int yend, int yoff, int xoff, int color) |
| 568 | { |
| 569 | int y; |
| 570 | |
| 571 | for (y = ybegin; y <= yend; y++) |
| 572 | { |
| 573 | memset16(&m_bitmap.pix16(yoff + y, xoff), color, 8); |
| 574 | } |
| 575 | } |
| 576 | |
| 577 | void mos7360_device::drawlines(int first, int last) |
| 578 | { |
| 579 | int line, vline, end; |
| 580 | int attr, ch, c1, c2, ecm; |
| 581 | int offs, yoff, xoff, ybegin, yend, xbegin, xend; |
| 582 | int i; |
| 583 | |
| 584 | m_lastline = last; |
| 585 | |
| 586 | /* top part of display not rastered */ |
| 587 | first -= TED7360_YPOS; |
| 588 | last -= TED7360_YPOS; |
| 589 | if ((first >= last) || (last <= 0)) |
| 590 | return; |
| 591 | if (first < 0) |
| 592 | first = 0; |
| 593 | |
| 594 | if (!SCREENON) |
| 595 | { |
| 596 | for (line = first; (line < last) && (line < m_bitmap.height()); line++) |
| 597 | memset16(&m_bitmap.pix16(line), 0, m_bitmap.width()); |
| 598 | return; |
| 599 | } |
| 600 | |
| 601 | if (COLUMNS40) |
| 602 | xbegin = XPOS, xend = xbegin + 320; |
| 603 | else |
| 604 | xbegin = XPOS + 7, xend = xbegin + 304; |
| 605 | |
| 606 | if (last < m_y_begin) |
| 607 | end = last; |
| 608 | else |
| 609 | end = m_y_begin + YPOS; |
| 610 | { |
| 611 | for (line = first; line < end; line++) |
| 612 | memset16(&m_bitmap.pix16(line), FRAMECOLOR, m_bitmap.width()); |
| 613 | } |
| 614 | if (LINES25) |
| 615 | vline = line - m_y_begin - YPOS; |
| 616 | else |
| 617 | vline = line - m_y_begin - YPOS + 8 - VERTICALPOS; |
| 618 | |
| 619 | if (last < m_y_end + YPOS) |
| 620 | end = last; |
| 621 | else |
| 622 | end = m_y_end + YPOS; |
| 623 | |
| 624 | for (; line < end; vline = (vline + 8) & ~7, line = line + 1 + yend - ybegin) |
| 625 | { |
| 626 | offs = (vline >> 3) * 40; |
| 627 | ybegin = vline & 7; |
| 628 | yoff = line - ybegin; |
| 629 | yend = (yoff + 7 < end) ? 7 : (end - yoff - 1); |
| 630 | /* rendering 39 characters */ |
| 631 | /* left and right borders are overwritten later */ |
| 632 | |
| 633 | for (xoff = m_x_begin + XPOS; xoff < m_x_end + XPOS; xoff += 8, offs++) |
| 634 | { |
| 635 | if (HIRESON) |
| 636 | { |
| 637 | ch = m_in_ram_func((m_videoaddr | 0x400) + offs); |
| 638 | attr = m_in_ram_func(m_videoaddr + offs); |
| 639 | c1 = ((ch >> 4) & 0xf) | (attr << 4); |
| 640 | c2 = (ch & 0xf) | (attr & 0x70); |
| 641 | m_bitmapmulti[1] = m_c16_bitmap[1] = c1 & 0x7f; |
| 642 | m_bitmapmulti[2] = m_c16_bitmap[0] = c2 & 0x7f; |
| 643 | if (MULTICOLORON) |
| 644 | { |
| 645 | draw_bitmap_multi(ybegin, yend, offs, yoff, xoff); |
| 646 | } |
| 647 | else |
| 648 | { |
| 649 | draw_bitmap(ybegin, yend, offs, yoff, xoff); |
| 650 | } |
| 651 | } |
| 652 | else |
| 653 | { |
| 654 | ch = m_in_ram_func((m_videoaddr | 0x400) + offs); |
| 655 | attr = m_in_ram_func(m_videoaddr + offs); |
| 656 | // levente harsfalvi's docu says cursor off in ecm and multicolor |
| 657 | if (ECMON) |
| 658 | { |
| 659 | // hardware reverse off |
| 660 | ecm = ch >> 6; |
| 661 | m_ecmcolor[0] = m_colors[ecm]; |
| 662 | m_ecmcolor[1] = attr & 0x7f; |
| 663 | draw_character(ybegin, yend, ch & ~0xc0, yoff, xoff, m_ecmcolor); |
| 664 | } |
| 665 | else if (MULTICOLORON) |
| 666 | { |
| 667 | // hardware reverse off |
| 668 | if (attr & 8) |
| 669 | { |
| 670 | m_multi[3] = attr & 0x77; |
| 671 | draw_character_multi(ybegin, yend, ch, yoff, xoff); |
| 672 | } |
| 673 | else |
| 674 | { |
| 675 | m_mono[1] = attr & 0x7f; |
| 676 | draw_character(ybegin, yend, ch, yoff, xoff, m_mono); |
| 677 | } |
| 678 | } |
| 679 | else if (m_cursor1 && (offs == CURSOR1POS)) |
| 680 | { |
| 681 | draw_cursor(ybegin, yend, yoff, xoff, attr & 0x7f); |
| 682 | } |
| 683 | else if (REVERSEON && (ch & 0x80)) |
| 684 | { |
| 685 | m_monoinversed[0] = attr & 0x7f; |
| 686 | if (m_cursor1 && (attr & 0x80)) |
| 687 | draw_cursor(ybegin, yend, yoff, xoff, m_monoinversed[0]); |
| 688 | else |
| 689 | draw_character(ybegin, yend, ch & ~0x80, yoff, xoff, m_monoinversed); |
| 690 | } |
| 691 | else |
| 692 | { |
| 693 | m_mono[1] = attr & 0x7f; |
| 694 | if (m_cursor1 && (attr & 0x80)) |
| 695 | draw_cursor(ybegin, yend, yoff, xoff, m_mono[0]); |
| 696 | else |
| 697 | draw_character(ybegin, yend, ch, yoff, xoff, m_mono); |
| 698 | } |
| 699 | } |
| 700 | } |
| 701 | |
| 702 | for (i = ybegin; i <= yend; i++) |
| 703 | { |
| 704 | memset16(&m_bitmap.pix16(yoff + i), FRAMECOLOR, xbegin); |
| 705 | memset16(&m_bitmap.pix16(yoff + i, xend), FRAMECOLOR, m_bitmap.width() - xend); |
| 706 | } |
| 707 | } |
| 708 | |
| 709 | if (last < m_bitmap.height()) |
| 710 | end = last; |
| 711 | else |
| 712 | end = m_bitmap.height(); |
| 713 | |
| 714 | for (; line < end; line++) |
| 715 | { |
| 716 | memset16(&m_bitmap.pix16(line), FRAMECOLOR, m_bitmap.width()); |
| 717 | } |
| 718 | } |
| 719 | |
| 720 | void mos7360_device::soundport_w(int offset, int data) |
| 721 | { |
| 722 | // int old = m_reg[offset]; |
| 723 | m_stream->update(); |
| 724 | |
| 725 | switch (offset) |
| 726 | { |
| 727 | case 0x0e: |
| 728 | case 0x12: |
| 729 | if (offset == 0x12) |
| 730 | m_reg[offset] = (m_reg[offset] & ~3) | (data & 3); |
| 731 | else |
| 732 | m_reg[offset] = data; |
| 733 | |
| 734 | m_tone1samples = machine().sample_rate() / TONE_FREQUENCY (TONE1_VALUE); |
| 735 | DBG_LOG(1, "ted7360", ("tone1 %d %d sample:%d\n", TONE1_VALUE, TONE_FREQUENCY(TONE1_VALUE), m_tone1samples)); |
| 736 | break; |
| 737 | |
| 738 | case 0xf: |
| 739 | case 0x10: |
| 740 | m_reg[offset] = data; |
| 741 | |
| 742 | m_tone2samples = machine().sample_rate() / TONE_FREQUENCY (TONE2_VALUE); |
| 743 | DBG_LOG (1, "ted7360", ("tone2 %d %d sample:%d\n", TONE2_VALUE, TONE_FREQUENCY(TONE2_VALUE), m_tone2samples)); |
| 744 | |
| 745 | m_noisesamples = (int) ((double) NOISE_FREQUENCY_MAX * machine().sample_rate() * NOISE_BUFFER_SIZE_SEC / NOISE_FREQUENCY); |
| 746 | DBG_LOG (1, "ted7360", ("noise %d sample:%d\n", NOISE_FREQUENCY, m_noisesamples)); |
| 747 | |
| 748 | if (!NOISE_ON || ((double) m_noisepos / m_noisesamples >= 1.0)) |
| 749 | m_noisepos = 0; |
| 750 | break; |
| 751 | |
| 752 | case 0x11: |
| 753 | m_reg[offset] = data; |
| 754 | DBG_LOG(1, "ted7360", ("%s volume %d, %s %s %s\n", TONE_ON?"on":"off", |
| 755 | VOLUME, TONE1_ON?"tone1":"", TONE2_ON?"tone2":"", NOISE_ON?"noise":"")); |
| 756 | |
| 757 | if (!TONE_ON||!TONE1_ON) m_tone1pos = 0; |
| 758 | if (!TONE_ON||!TONE2_ON) m_tone2pos = 0; |
| 759 | if (!TONE_ON||!NOISE_ON) m_noisepos = 0; |
| 760 | break; |
| 761 | } |
| 762 | } |
| 763 | |
| 764 | |
| 765 | //------------------------------------------------- |
| 766 | // read - register read |
| 767 | //------------------------------------------------- |
| 768 | |
| 769 | READ8_MEMBER( mos7360_device::read ) |
| 770 | { |
| 771 | int val = 0; |
| 772 | |
| 773 | switch (offset) |
| 774 | { |
| 775 | case 0: |
| 776 | if (m_timer1) |
| 777 | val = TEDTIME_TO_CYCLES(m_timer1->remaining()) & 0xff; |
| 778 | else |
| 779 | val = m_reg[offset]; |
| 780 | break; |
| 781 | case 1: |
| 782 | if (m_timer1) |
| 783 | val = TEDTIME_TO_CYCLES(m_timer1->remaining()) >> 8; |
| 784 | else |
| 785 | val = m_reg[offset]; |
| 786 | break; |
| 787 | case 2: |
| 788 | if (m_timer2) |
| 789 | val = TEDTIME_TO_CYCLES(m_timer2->remaining()) & 0xff; |
| 790 | else |
| 791 | val = m_reg[offset]; |
| 792 | break; |
| 793 | case 3: |
| 794 | if (m_timer2) |
| 795 | val = TEDTIME_TO_CYCLES(m_timer2->remaining()) >> 8; |
| 796 | else |
| 797 | val = m_reg[offset]; |
| 798 | break; |
| 799 | case 4: |
| 800 | if (m_timer3) |
| 801 | val = TEDTIME_TO_CYCLES(m_timer3->remaining()) & 0xff; |
| 802 | else |
| 803 | val = m_reg[offset]; |
| 804 | break; |
| 805 | case 5: |
| 806 | if (m_timer3) |
| 807 | val = TEDTIME_TO_CYCLES(m_timer3->remaining()) >> 8; |
| 808 | else |
| 809 | val = m_reg[offset]; |
| 810 | break; |
| 811 | case 7: |
| 812 | val = (m_reg[offset] & ~0x40); |
| 813 | if (m_clock == TED7360NTSC_CLOCK) |
| 814 | val |= 0x40; |
| 815 | break; |
| 816 | case 9: |
| 817 | val = m_reg[offset] | 1; |
| 818 | break; |
| 819 | case 0xa: |
| 820 | val = m_reg[offset]; |
| 821 | break; |
| 822 | case 0xb: |
| 823 | val = m_reg[offset]; |
| 824 | break; |
| 825 | case 0x0c: |
| 826 | val = m_reg[offset] |= 0xfc; |
| 827 | break; |
| 828 | case 0x13: |
| 829 | val = m_reg[offset] & ~1; |
| 830 | if (m_rom) |
| 831 | val |= 1; |
| 832 | break; |
| 833 | case 0x1c: /*rasterline */ |
| 834 | drawlines(m_lastline, m_rasterline); |
| 835 | val = ((RASTERLINE_2_C16(m_rasterline) & 0x100) >> 8) | 0xfe; /* expected by matrix */ |
| 836 | break; |
| 837 | case 0x1d: /*rasterline */ |
| 838 | drawlines(m_lastline, m_rasterline); |
| 839 | val = RASTERLINE_2_C16(m_rasterline) & 0xff; |
| 840 | break; |
| 841 | case 0x1e: /*rastercolumn */ |
| 842 | val = rastercolumn() / 2; /* pengo >=0x99 */ |
| 843 | break; |
| 844 | case 0x1f: |
| 845 | val = ((m_rasterline & 7) << 4) | (m_reg[offset] & 0x0f); |
| 846 | DBG_LOG(1, "port_w", ("read from cursorblink %.2x\n", val)); |
| 847 | break; |
| 848 | default: |
| 849 | val = m_reg[offset]; |
| 850 | break; |
| 851 | } |
| 852 | |
| 853 | if ((offset != 8) && (offset >= 6) && (offset != 0x1c) && (offset != 0x1d) && (offset != 9) && ((offset < 0x15) || (offset > 0x19))) |
| 854 | { |
| 855 | DBG_LOG(1, "port_r", ("%.2x:%.2x\n", offset, val)); |
| 856 | } |
| 857 | |
| 858 | return val; |
| 859 | } |
| 860 | |
| 861 | |
| 862 | //------------------------------------------------- |
| 863 | // write - register write |
| 864 | //------------------------------------------------- |
| 865 | |
| 866 | WRITE8_MEMBER( mos7360_device::write ) |
| 867 | { |
| 868 | int old; |
| 869 | |
| 870 | if ((offset != 8) && ((offset < 0x15) || (offset > 0x19))) |
| 871 | { |
| 872 | DBG_LOG(1, "port_w", ("%.2x:%.2x\n", offset, data)); |
| 873 | } |
| 874 | |
| 875 | switch (offset) |
| 876 | { |
| 877 | case 0xe: |
| 878 | case 0xf: |
| 879 | case 0x10: |
| 880 | case 0x11: |
| 881 | case 0x12: |
| 882 | soundport_w(offset, data); |
| 883 | break; |
| 884 | } |
| 885 | switch (offset) |
| 886 | { |
| 887 | case 0: /* stop timer 1 */ |
| 888 | m_reg[offset] = data; |
| 889 | |
| 890 | if (m_timer1_active) |
| 891 | { |
| 892 | m_reg[1] = TEDTIME_TO_CYCLES(m_timer1->remaining()) >> 8; |
| 893 | m_timer1->reset(); |
| 894 | m_timer1_active = 0; |
| 895 | } |
| 896 | break; |
| 897 | case 1: /* start timer 1 */ |
| 898 | m_reg[offset] = data; |
| 899 | m_timer1->adjust(TEDTIME_IN_CYCLES(TIMER1), 1); |
| 900 | m_timer1_active = 1; |
| 901 | break; |
| 902 | case 2: /* stop timer 2 */ |
| 903 | m_reg[offset] = data; |
| 904 | if (m_timer2_active) |
| 905 | { |
| 906 | m_reg[3] = TEDTIME_TO_CYCLES(m_timer2->remaining()) >> 8; |
| 907 | m_timer2->reset(); |
| 908 | m_timer2_active = 0; |
| 909 | } |
| 910 | break; |
| 911 | case 3: /* start timer 2 */ |
| 912 | m_reg[offset] = data; |
| 913 | m_timer2->adjust(TEDTIME_IN_CYCLES(TIMER2), 2); |
| 914 | m_timer2_active = 1; |
| 915 | break; |
| 916 | case 4: /* stop timer 3 */ |
| 917 | m_reg[offset] = data; |
| 918 | if (m_timer3_active) |
| 919 | { |
| 920 | m_reg[5] = TEDTIME_TO_CYCLES(m_timer3->remaining()) >> 8; |
| 921 | m_timer3->reset(); |
| 922 | m_timer3_active = 0; |
| 923 | } |
| 924 | break; |
| 925 | case 5: /* start timer 3 */ |
| 926 | m_reg[offset] = data; |
| 927 | m_timer3->adjust(TEDTIME_IN_CYCLES(TIMER3), 3); |
| 928 | m_timer3_active = 1; |
| 929 | break; |
| 930 | case 6: |
| 931 | if (m_reg[offset] != data) |
| 932 | { |
| 933 | drawlines(m_lastline, m_rasterline); |
| 934 | m_reg[offset] = data; |
| 935 | if (LINES25) |
| 936 | { |
| 937 | m_y_begin = 0; |
| 938 | m_y_end = m_y_begin + 200; |
| 939 | } |
| 940 | else |
| 941 | { |
| 942 | m_y_begin = 4; |
| 943 | m_y_end = m_y_begin + 192; |
| 944 | } |
| 945 | m_chargenaddr = CHARGENADDR; |
| 946 | } |
| 947 | break; |
| 948 | case 7: |
| 949 | if (m_reg[offset] != data) |
| 950 | { |
| 951 | drawlines(m_lastline, m_rasterline); |
| 952 | m_reg[offset] = data; |
| 953 | if (COLUMNS40) |
| 954 | { |
| 955 | m_x_begin = 0; |
| 956 | m_x_end = m_x_begin + 320; |
| 957 | } |
| 958 | else |
| 959 | { |
| 960 | m_x_begin = HORICONTALPOS; |
| 961 | m_x_end = m_x_begin + 320; |
| 962 | } |
| 963 | DBG_LOG(3, "port_w", ("%s %s\n", data & 0x40 ? "ntsc" : "pal", data & 0x20 ? "hori freeze" : "")); |
| 964 | m_chargenaddr = CHARGENADDR; |
| 965 | } |
| 966 | break; |
| 967 | case 8: |
| 968 | m_reg[offset] = m_in_k_func(data); |
| 969 | break; |
| 970 | case 9: |
| 971 | if (data & 0x08) |
| 972 | clear_interrupt(8); |
| 973 | if (data & 0x10) |
| 974 | clear_interrupt(0x10); |
| 975 | if (data & 0x40) |
| 976 | clear_interrupt(0x40); |
| 977 | if (data & 0x02) |
| 978 | clear_interrupt(2); |
| 979 | break; |
| 980 | case 0xa: |
| 981 | old = data; |
| 982 | m_reg[offset] = data | 0xa0; |
| 983 | #if 0 |
| 984 | m_reg[9] = (m_reg[9] & 0xa1) | (m_reg[9] & data & 0x5e); |
| 985 | if (m_reg[9] & 0x80) |
| 986 | clear_interrupt(0); |
| 987 | #endif |
| 988 | if ((data ^ old) & 1) |
| 989 | { |
| 990 | /* DBG_LOG(1,"set rasterline hi",("soll:%d\n",RASTERLINE)); */ |
| 991 | } |
| 992 | break; |
| 993 | case 0xb: |
| 994 | if (data != m_reg[offset]) |
| 995 | { |
| 996 | drawlines(m_lastline, m_rasterline); |
| 997 | m_reg[offset] = data; |
| 998 | /* DBG_LOG(1,"set rasterline lo",("soll:%d\n",RASTERLINE)); */ |
| 999 | } |
| 1000 | break; |
| 1001 | case 0xc: |
| 1002 | case 0xd: |
| 1003 | if (m_reg[offset] != data) |
| 1004 | { |
| 1005 | drawlines(m_lastline, m_rasterline); |
| 1006 | m_reg[offset] = data; |
| 1007 | } |
| 1008 | break; |
| 1009 | case 0x12: |
| 1010 | if (m_reg[offset] != data) |
| 1011 | { |
| 1012 | drawlines(m_lastline, m_rasterline); |
| 1013 | m_reg[offset] = data; |
| 1014 | m_bitmapaddr = BITMAPADDR; |
| 1015 | m_chargenaddr = CHARGENADDR; |
| 1016 | DBG_LOG(3, "port_w", ("bitmap %.4x %s\n", BITMAPADDR, INROM ? "rom" : "ram")); |
| 1017 | } |
| 1018 | break; |
| 1019 | case 0x13: |
| 1020 | if (m_reg[offset] != data) |
| 1021 | { |
| 1022 | drawlines(m_lastline, m_rasterline); |
| 1023 | m_reg[offset] = data; |
| 1024 | m_chargenaddr = CHARGENADDR; |
| 1025 | DBG_LOG(3, "port_w", ("chargen %.4x %s %d\n", CHARGENADDR, data & 2 ? "" : "doubleclock", data & 1)); |
| 1026 | } |
| 1027 | break; |
| 1028 | case 0x14: |
| 1029 | if (m_reg[offset] != data) |
| 1030 | { |
| 1031 | drawlines(m_lastline, m_rasterline); |
| 1032 | m_reg[offset] = data; |
| 1033 | m_videoaddr = VIDEOADDR; |
| 1034 | DBG_LOG(3, "port_w", ("videoram %.4x\n", VIDEOADDR)); |
| 1035 | } |
| 1036 | break; |
| 1037 | case 0x15: /* backgroundcolor */ |
| 1038 | if (m_reg[offset] != data) |
| 1039 | { |
| 1040 | drawlines(m_lastline, m_rasterline); |
| 1041 | m_reg[offset] = data; |
| 1042 | m_monoinversed[1] = m_mono[0] = m_bitmapmulti[0] = m_multi[0] = m_colors[0] = BACKGROUNDCOLOR; |
| 1043 | } |
| 1044 | break; |
| 1045 | case 0x16: /* foregroundcolor */ |
| 1046 | if (m_reg[offset] != data) |
| 1047 | { |
| 1048 | drawlines(m_lastline, m_rasterline); |
| 1049 | m_reg[offset] = data; |
| 1050 | m_bitmapmulti[3] = m_multi[1] = m_colors[1] = FOREGROUNDCOLOR; |
| 1051 | } |
| 1052 | break; |
| 1053 | case 0x17: /* multicolor 1 */ |
| 1054 | if (m_reg[offset] != data) |
| 1055 | { |
| 1056 | drawlines(m_lastline, m_rasterline); |
| 1057 | m_reg[offset] = data; |
| 1058 | m_multi[2] = m_colors[2] = MULTICOLOR1; |
| 1059 | } |
| 1060 | break; |
| 1061 | case 0x18: /* multicolor 2 */ |
| 1062 | if (m_reg[offset] != data) |
| 1063 | { |
| 1064 | drawlines(m_lastline, m_rasterline); |
| 1065 | m_reg[offset] = data; |
| 1066 | m_colors[3] = MULTICOLOR2; |
| 1067 | } |
| 1068 | break; |
| 1069 | case 0x19: /* framecolor */ |
| 1070 | if (m_reg[offset] != data) |
| 1071 | { |
| 1072 | drawlines(m_lastline, m_rasterline); |
| 1073 | m_reg[offset] = data; |
| 1074 | m_colors[4] = FRAMECOLOR; |
| 1075 | } |
| 1076 | break; |
| 1077 | case 0x1c: |
| 1078 | m_reg[offset] = data; /*? */ |
| 1079 | DBG_LOG(1, "port_w", ("write to rasterline high %.2x\n", |
| 1080 | data)); |
| 1081 | break; |
| 1082 | case 0x1f: |
| 1083 | m_reg[offset] = data; |
| 1084 | DBG_LOG(1, "port_w", ("write to cursorblink %.2x\n", data)); |
| 1085 | break; |
| 1086 | default: |
| 1087 | m_reg[offset] = data; |
| 1088 | break; |
| 1089 | } |
| 1090 | } |
| 1091 | |
| 1092 | |
| 1093 | //------------------------------------------------- |
| 1094 | // update_screen - update screen |
| 1095 | //------------------------------------------------- |
| 1096 | |
| 1097 | UINT32 mos7360_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1098 | { |
| 1099 | copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); |
| 1100 | |
| 1101 | return 0; |
| 1102 | } |
| 1103 | |
| 1104 | WRITE_LINE_MEMBER( mos7360_device::rom_switch_w ) |
| 1105 | { |
| 1106 | m_rom = state; |
| 1107 | } |
| 1108 | |
| 1109 | READ_LINE_MEMBER( mos7360_device::rom_switch_r ) |
| 1110 | { |
| 1111 | return m_rom; |
| 1112 | } |
| 1113 | |
| 1114 | void mos7360_device::frame_interrupt_gen() |
| 1115 | { |
| 1116 | if ((m_reg[0x1f] & 0xf) >= 0x0f) |
| 1117 | { |
| 1118 | /* if (m_frame_count >= CURSORRATE) */ |
| 1119 | m_cursor1 ^= 1; |
| 1120 | m_reg[0x1f] &= ~0xf; |
| 1121 | m_frame_count = 0; |
| 1122 | } |
| 1123 | else |
| 1124 | m_reg[0x1f]++; |
| 1125 | } |
| 1126 | |
| 1127 | void mos7360_device::raster_interrupt_gen() |
| 1128 | { |
| 1129 | m_rasterline++; |
| 1130 | m_rastertime = machine().time().as_double(); |
| 1131 | if (m_rasterline >= m_lines) |
| 1132 | { |
| 1133 | m_rasterline = 0; |
| 1134 | drawlines(m_lastline, TED7360_LINES); |
| 1135 | m_lastline = 0; |
| 1136 | } |
| 1137 | |
| 1138 | if (m_rasterline == C16_2_RASTERLINE(RASTERLINE)) |
| 1139 | { |
| 1140 | drawlines(m_lastline, m_rasterline); |
| 1141 | set_interrupt(2); |
| 1142 | } |
| 1143 | } |
src/mess/drivers/plus4.c
| r15840 | r15841 | |
| 2 | 2 | |
| 3 | 3 | TODO: |
| 4 | 4 | |
| 5 | | - diag264p: HIGH RAM BAD $FF40-7F DEVICE, bad kernal R5 |
| 5 | - cassette |
| 6 | 6 | - c1551 won't load anything |
| 7 | | - JiffyDOS boots to monitor |
| 8 | 7 | - clean up keyboard handling |
| 9 | 8 | - clean up TED |
| 10 | 9 | - dump PLA |
| 11 | 10 | - T6721 speech chip |
| 11 | - floating bus read (should return the previous byte read by TED) |
| 12 | 12 | - SID card (http://solder.dyndns.info/cgi-bin/showdir.pl?dir=files/commodore/plus4/hardware/SID-Card) |
| 13 | 13 | |
| 14 | 14 | */ |
| r15840 | r15841 | |
| 152 | 152 | *cs0 = 0; |
| 153 | 153 | *cs1 = 1; |
| 154 | 154 | } |
| 155 | | else if ((offset >= 0xc000 && offset < 0xfd00) || (offset >= 0xff40)) |
| 155 | else if ((offset >= 0xc000 && offset < 0xfd00) || (offset >= 0xff20)) |
| 156 | 156 | { |
| 157 | 157 | *cs0 = 1; |
| 158 | 158 | *cs1 = 0; |
| r15840 | r15841 | |
| 176 | 176 | { |
| 177 | 177 | data = t6721_speech_r(m_t6721, offset & 0x03); |
| 178 | 178 | } |
| 179 | | else if (!user && m_spi_user) |
| 179 | else if (!user) |
| 180 | 180 | { |
| 181 | | data = m_spi_user->read(space, 0); |
| 181 | if (m_spi_user) |
| 182 | { |
| 183 | data = m_spi_user->read(space, 0); |
| 184 | } |
| 185 | else |
| 186 | { |
| 187 | data |= ((m_cassette->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_STOPPED) << 2; |
| 188 | } |
| 182 | 189 | } |
| 183 | 190 | else if (!_6551 && m_acia) |
| 184 | 191 | { |
| r15840 | r15841 | |
| 245 | 252 | } |
| 246 | 253 | else if (offset >= 0xff00 && offset < 0xff20) |
| 247 | 254 | { |
| 248 | | data = ted7360_port_r(m_ted, offset & 0x1f); |
| 255 | data = m_ted->read(space, offset & 0x1f); |
| 249 | 256 | } |
| 250 | | else if (offset < 0xfd00 || offset > 0xff40) |
| 257 | else if (offset < 0xfd00 || offset >= 0xff20) |
| 251 | 258 | { |
| 252 | 259 | data = m_ram->pointer()[offset & m_ram->mask()]; |
| 253 | 260 | } |
| r15840 | r15841 | |
| 309 | 316 | } |
| 310 | 317 | else if (offset >= 0xff00 && offset < 0xff20) |
| 311 | 318 | { |
| 312 | | ted7360_port_w(m_ted, offset & 0x1f, data); |
| 319 | m_ted->write(space, offset & 0x1f, data); |
| 313 | 320 | } |
| 314 | 321 | else if (offset == 0xff3e) |
| 315 | 322 | { |
| 316 | 323 | m_rom_en = 1; |
| 317 | 324 | |
| 318 | | ted7360_rom_switch_w(m_ted, m_rom_en); |
| 325 | m_ted->rom_switch_w(m_rom_en); |
| 319 | 326 | } |
| 320 | 327 | else if (offset == 0xff3f) |
| 321 | 328 | { |
| 322 | 329 | m_rom_en = 0; |
| 323 | 330 | |
| 324 | | ted7360_rom_switch_w(m_ted, m_rom_en); |
| 331 | m_ted->rom_switch_w(m_rom_en); |
| 325 | 332 | } |
| 326 | | else if (offset < 0xfd00 || offset > 0xff40) |
| 333 | else if (offset < 0xfd00 || offset >= 0xff20) |
| 327 | 334 | { |
| 328 | 335 | m_ram->pointer()[offset & m_ram->mask()] = data; |
| 329 | 336 | } |
| r15840 | r15841 | |
| 441 | 448 | 4 CST RD |
| 442 | 449 | 5 |
| 443 | 450 | 6 IEC CLK IN |
| 451 | 7 IEC DATA IN, CST SENSE (Plus/4) |
| 452 | |
| 453 | */ |
| 454 | |
| 455 | UINT8 data = 0x2f; |
| 456 | |
| 457 | data |= (m_cassette->input() > +0.0) << 4; |
| 458 | |
| 459 | data |= m_iec->clk_r() << 6; |
| 460 | data |= (m_iec->data_r() || ((m_cassette->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_STOPPED)) << 7; |
| 461 | |
| 462 | return data; |
| 463 | } |
| 464 | |
| 465 | READ8_MEMBER( plus4_state::c16_cpu_r ) |
| 466 | { |
| 467 | /* |
| 468 | |
| 469 | bit description |
| 470 | |
| 471 | 0 |
| 472 | 1 |
| 473 | 2 |
| 474 | 3 |
| 475 | 4 CST RD |
| 476 | 5 |
| 477 | 6 IEC CLK IN |
| 444 | 478 | 7 IEC DATA IN |
| 445 | 479 | |
| 446 | 480 | */ |
| r15840 | r15841 | |
| 462 | 496 | bit description |
| 463 | 497 | |
| 464 | 498 | 0 IEC DATA |
| 465 | | 1 IEC CLK |
| 499 | 1 IEC CLK, CST WR |
| 466 | 500 | 2 IEC ATN |
| 467 | 501 | 3 CST MTR |
| 468 | 502 | 4 |
| r15840 | r15841 | |
| 472 | 506 | |
| 473 | 507 | */ |
| 474 | 508 | |
| 509 | // serial bus |
| 475 | 510 | m_iec->data_w(!BIT(data, 0)); |
| 476 | 511 | m_iec->clk_w(!BIT(data, 1)); |
| 477 | 512 | m_iec->atn_w(!BIT(data, 2)); |
| 478 | 513 | |
| 479 | | m_cassette->change_state(BIT(data, 7) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); |
| 480 | | |
| 514 | // cassette write |
| 481 | 515 | m_cassette->output(!BIT(data, 1) ? -(0x5a9e >> 1) : +(0x5a9e >> 1)); |
| 516 | |
| 517 | // cassette motor |
| 518 | m_cassette->change_state(BIT(data, 3) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); |
| 482 | 519 | } |
| 483 | 520 | |
| 484 | 521 | static const m6502_interface cpu_intf = |
| r15840 | r15841 | |
| 489 | 526 | DEVCB_DRIVER_MEMBER(plus4_state, cpu_w) |
| 490 | 527 | }; |
| 491 | 528 | |
| 529 | static const m6502_interface c16_cpu_intf = |
| 530 | { |
| 531 | NULL, |
| 532 | NULL, |
| 533 | DEVCB_DRIVER_MEMBER(plus4_state, c16_cpu_r), |
| 534 | DEVCB_DRIVER_MEMBER(plus4_state, cpu_w) |
| 535 | }; |
| 492 | 536 | |
| 493 | 537 | //------------------------------------------------- |
| 494 | 538 | // ted7360_interface ted_intf |
| 495 | 539 | //------------------------------------------------- |
| 496 | 540 | |
| 497 | | static const unsigned char ted7360_palette[] = |
| 498 | | { |
| 499 | | /* black, white, red, cyan */ |
| 500 | | /* purple, green, blue, yellow */ |
| 501 | | /* orange, light orange, pink, light cyan, */ |
| 502 | | /* light violett, light green, light blue, light yellow */ |
| 503 | | /* these 16 colors are 8 times here in different luminance (dark..light) */ |
| 504 | | /* taken from digitized tv screenshot */ |
| 505 | | 0x06, 0x01, 0x03, 0x2b, 0x2b, 0x2b, 0x67, 0x0e, 0x0f, 0x00, 0x3f, 0x42, |
| 506 | | 0x57, 0x00, 0x6d, 0x00, 0x4e, 0x00, 0x19, 0x1c, 0x94, 0x38, 0x38, 0x00, |
| 507 | | 0x56, 0x20, 0x00, 0x4b, 0x28, 0x00, 0x16, 0x48, 0x00, 0x69, 0x07, 0x2f, |
| 508 | | 0x00, 0x46, 0x26, 0x06, 0x2a, 0x80, 0x2a, 0x14, 0x9b, 0x0b, 0x49, 0x00, |
| 509 | | |
| 510 | | 0x00, 0x03, 0x02, 0x3d, 0x3d, 0x3d, 0x75, 0x1e, 0x20, 0x00, 0x50, 0x4f, |
| 511 | | 0x6a, 0x10, 0x78, 0x04, 0x5c, 0x00, 0x2a, 0x2a, 0xa3, 0x4c, 0x47, 0x00, |
| 512 | | 0x69, 0x2f, 0x00, 0x59, 0x38, 0x00, 0x26, 0x56, 0x00, 0x75, 0x15, 0x41, |
| 513 | | 0x00, 0x58, 0x3d, 0x15, 0x3d, 0x8f, 0x39, 0x22, 0xae, 0x19, 0x59, 0x00, |
| 514 | | |
| 515 | | 0x00, 0x03, 0x04, 0x42, 0x42, 0x42, 0x7b, 0x28, 0x20, 0x02, 0x56, 0x59, |
| 516 | | 0x6f, 0x1a, 0x82, 0x0a, 0x65, 0x09, 0x30, 0x34, 0xa7, 0x50, 0x51, 0x00, |
| 517 | | 0x6e, 0x36, 0x00, 0x65, 0x40, 0x00, 0x2c, 0x5c, 0x00, 0x7d, 0x1e, 0x45, |
| 518 | | 0x01, 0x61, 0x45, 0x1c, 0x45, 0x99, 0x42, 0x2d, 0xad, 0x1d, 0x62, 0x00, |
| 519 | | |
| 520 | | 0x05, 0x00, 0x02, 0x56, 0x55, 0x5a, 0x90, 0x3c, 0x3b, 0x17, 0x6d, 0x72, |
| 521 | | 0x87, 0x2d, 0x99, 0x1f, 0x7b, 0x15, 0x46, 0x49, 0xc1, 0x66, 0x63, 0x00, |
| 522 | | 0x84, 0x4c, 0x0d, 0x73, 0x55, 0x00, 0x40, 0x72, 0x00, 0x91, 0x33, 0x5e, |
| 523 | | 0x19, 0x74, 0x5c, 0x32, 0x59, 0xae, 0x59, 0x3f, 0xc3, 0x32, 0x76, 0x00, |
| 524 | | |
| 525 | | 0x02, 0x01, 0x06, 0x84, 0x7e, 0x85, 0xbb, 0x67, 0x68, 0x45, 0x96, 0x96, |
| 526 | | 0xaf, 0x58, 0xc3, 0x4a, 0xa7, 0x3e, 0x73, 0x73, 0xec, 0x92, 0x8d, 0x11, |
| 527 | | 0xaf, 0x78, 0x32, 0xa1, 0x80, 0x20, 0x6c, 0x9e, 0x12, 0xba, 0x5f, 0x89, |
| 528 | | 0x46, 0x9f, 0x83, 0x61, 0x85, 0xdd, 0x84, 0x6c, 0xef, 0x5d, 0xa3, 0x29, |
| 529 | | |
| 530 | | 0x02, 0x00, 0x0a, 0xb2, 0xac, 0xb3, 0xe9, 0x92, 0x92, 0x6c, 0xc3, 0xc1, |
| 531 | | 0xd9, 0x86, 0xf0, 0x79, 0xd1, 0x76, 0x9d, 0xa1, 0xff, 0xbd, 0xbe, 0x40, |
| 532 | | 0xdc, 0xa2, 0x61, 0xd1, 0xa9, 0x4c, 0x93, 0xc8, 0x3d, 0xe9, 0x8a, 0xb1, |
| 533 | | 0x6f, 0xcd, 0xab, 0x8a, 0xb4, 0xff, 0xb2, 0x9a, 0xff, 0x88, 0xcb, 0x59, |
| 534 | | |
| 535 | | 0x02, 0x00, 0x0a, 0xc7, 0xca, 0xc9, 0xff, 0xac, 0xac, 0x85, 0xd8, 0xe0, |
| 536 | | 0xf3, 0x9c, 0xff, 0x92, 0xea, 0x8a, 0xb7, 0xba, 0xff, 0xd6, 0xd3, 0x5b, |
| 537 | | 0xf3, 0xbe, 0x79, 0xe6, 0xc5, 0x65, 0xb0, 0xe0, 0x57, 0xff, 0xa4, 0xcf, |
| 538 | | 0x89, 0xe5, 0xc8, 0xa4, 0xca, 0xff, 0xca, 0xb3, 0xff, 0xa2, 0xe5, 0x7a, |
| 539 | | |
| 540 | | 0x01, 0x01, 0x01, 0xff, 0xff, 0xff, 0xff, 0xf6, 0xf2, 0xd1, 0xff, 0xff, |
| 541 | | 0xff, 0xe9, 0xff, 0xdb, 0xff, 0xd3, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xa3, |
| 542 | | 0xff, 0xff, 0xc1, 0xff, 0xff, 0xb2, 0xfc, 0xff, 0xa2, 0xff, 0xee, 0xff, |
| 543 | | 0xd1, 0xff, 0xff, 0xeb, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xed, 0xff, 0xbc |
| 544 | | }; |
| 545 | | |
| 546 | | static PALETTE_INIT( plus4 ) |
| 547 | | { |
| 548 | | int i; |
| 549 | | |
| 550 | | for (i = 0; i < sizeof(ted7360_palette) / 3; i++) |
| 551 | | palette_set_color_rgb(machine, i, ted7360_palette[i * 3], ted7360_palette[i * 3 + 1], ted7360_palette[i * 3 + 2]); |
| 552 | | } |
| 553 | | |
| 554 | | UINT32 plus4_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 555 | | { |
| 556 | | ted7360_video_update(m_ted, bitmap, cliprect); |
| 557 | | |
| 558 | | return 0; |
| 559 | | } |
| 560 | | |
| 561 | 541 | static INTERRUPT_GEN( c16_raster_interrupt ) |
| 562 | 542 | { |
| 563 | 543 | plus4_state *state = device->machine().driver_data<plus4_state>(); |
| 564 | 544 | |
| 565 | | ted7360_raster_interrupt_gen(state->m_ted); |
| 545 | state->m_ted->raster_interrupt_gen(); |
| 566 | 546 | } |
| 567 | 547 | |
| 568 | 548 | static INTERRUPT_GEN( c16_frame_interrupt ) |
| r15840 | r15841 | |
| 623 | 603 | state->m_keyline[9] = value; |
| 624 | 604 | } |
| 625 | 605 | |
| 626 | | ted7360_frame_interrupt_gen(state->m_ted); |
| 606 | state->m_ted->frame_interrupt_gen(); |
| 627 | 607 | } |
| 628 | 608 | |
| 629 | | static int c16_dma_read( running_machine &machine, int offset ) |
| 609 | WRITE_LINE_MEMBER( plus4_state::ted_irq_w ) |
| 630 | 610 | { |
| 631 | | plus4_state *state = machine.driver_data<plus4_state>(); |
| 632 | | address_space *space = state->m_maincpu->space(AS_PROGRAM); |
| 611 | m_ted_irq = state; |
| 633 | 612 | |
| 634 | | int phi0 = 1, mux = 0, ras = 1, ba = 0; |
| 635 | | int speech, phi2, user, _6551, addr_clk, keyport, kernal, cs0, cs1; |
| 636 | | |
| 637 | | state->bankswitch(offset, phi0, mux, ras, &speech, &phi2, &user, &_6551, &addr_clk, &keyport, &kernal, &cs0, &cs1); |
| 638 | | |
| 639 | | return state->read_memory(*space, offset, ba, speech, phi2, user, _6551, addr_clk, keyport, kernal, 1, 1); |
| 613 | check_interrupts(); |
| 640 | 614 | } |
| 641 | 615 | |
| 642 | | static int c16_dma_read_rom( running_machine &machine, int offset ) |
| 616 | READ8_MEMBER( plus4_state::ted_ram_r ) |
| 643 | 617 | { |
| 644 | | plus4_state *state = machine.driver_data<plus4_state>(); |
| 645 | | address_space *space = state->m_maincpu->space(AS_PROGRAM); |
| 646 | | |
| 647 | 618 | int phi0 = 1, mux = 0, ras = 1, ba = 0; |
| 648 | 619 | int speech, phi2, user, _6551, addr_clk, keyport, kernal, cs0, cs1; |
| 649 | 620 | |
| 650 | | state->bankswitch(offset, phi0, mux, ras, &speech, &phi2, &user, &_6551, &addr_clk, &keyport, &kernal, &cs0, &cs1); |
| 621 | bankswitch(offset, phi0, mux, ras, &speech, &phi2, &user, &_6551, &addr_clk, &keyport, &kernal, &cs0, &cs1); |
| 651 | 622 | |
| 652 | | return state->read_memory(*space, offset, ba, speech, phi2, user, _6551, addr_clk, keyport, kernal, cs0, cs1); |
| 623 | return read_memory(space, offset, ba, speech, phi2, user, _6551, addr_clk, keyport, kernal, 1, 1); |
| 653 | 624 | } |
| 654 | 625 | |
| 655 | | static void c16_interrupt( running_machine &machine, int level ) |
| 626 | READ8_MEMBER( plus4_state::ted_rom_r ) |
| 656 | 627 | { |
| 657 | | plus4_state *state = machine.driver_data<plus4_state>(); |
| 628 | int phi0 = 1, mux = 0, ras = 1, ba = 0; |
| 629 | int speech, phi2, user, _6551, addr_clk, keyport, kernal, cs0, cs1; |
| 658 | 630 | |
| 659 | | state->m_ted_irq = level; |
| 631 | bankswitch(offset, phi0, mux, ras, &speech, &phi2, &user, &_6551, &addr_clk, &keyport, &kernal, &cs0, &cs1); |
| 660 | 632 | |
| 661 | | state->check_interrupts(); |
| 633 | return read_memory(space, offset, ba, speech, phi2, user, _6551, addr_clk, keyport, kernal, cs0, cs1); |
| 662 | 634 | } |
| 663 | 635 | |
| 664 | | static UINT8 c16_read_keyboard( running_machine &machine, int databus ) |
| 636 | READ8_MEMBER( plus4_state::ted_k_r ) |
| 665 | 637 | { |
| 666 | | plus4_state *state = machine.driver_data<plus4_state>(); |
| 667 | | |
| 668 | 638 | UINT8 value = 0xff; |
| 669 | 639 | int i; |
| 670 | 640 | |
| 671 | 641 | for (i = 0; i < 8; i++) |
| 672 | 642 | { |
| 673 | | if (!BIT(state->m_port6529, i)) |
| 674 | | value &= state->m_keyline[i]; |
| 643 | if (!BIT(m_port6529, i)) |
| 644 | value &= m_keyline[i]; |
| 675 | 645 | } |
| 676 | 646 | |
| 677 | 647 | /* looks like joy 0 needs dataline2 low |
| 678 | 648 | * and joy 1 needs dataline1 low |
| 679 | 649 | * write to 0xff08 (value on databus) reloads latches */ |
| 680 | | if (!BIT(databus, 2)) |
| 681 | | value &= state->m_keyline[8]; |
| 650 | if (!BIT(offset, 2)) |
| 651 | value &= m_keyline[8]; |
| 682 | 652 | |
| 683 | | if (!BIT(databus, 1)) |
| 684 | | value &= state->m_keyline[9]; |
| 653 | if (!BIT(offset, 1)) |
| 654 | value &= m_keyline[9]; |
| 685 | 655 | |
| 686 | 656 | return value; |
| 687 | 657 | } |
| 688 | 658 | |
| 689 | | static const ted7360_interface ntsc_ted_intf = |
| 659 | static MOS7360_INTERFACE( ted_intf ) |
| 690 | 660 | { |
| 691 | 661 | SCREEN_TAG, |
| 692 | | TED7360_NTSC, |
| 693 | | c16_dma_read, |
| 694 | | c16_dma_read_rom, |
| 695 | | c16_interrupt, |
| 696 | | c16_read_keyboard |
| 662 | MOS7501_TAG, |
| 663 | DEVCB_DRIVER_LINE_MEMBER(plus4_state, ted_irq_w), |
| 664 | DEVCB_DRIVER_MEMBER(plus4_state, ted_ram_r), |
| 665 | DEVCB_DRIVER_MEMBER(plus4_state, ted_rom_r), |
| 666 | DEVCB_DRIVER_MEMBER(plus4_state, ted_k_r) |
| 697 | 667 | }; |
| 698 | 668 | |
| 699 | | static const ted7360_interface pal_ted_intf = |
| 700 | | { |
| 701 | | SCREEN_TAG, |
| 702 | | TED7360_PAL, |
| 703 | | c16_dma_read, |
| 704 | | c16_dma_read_rom, |
| 705 | | c16_interrupt, |
| 706 | | c16_read_keyboard |
| 707 | | }; |
| 708 | 669 | |
| 709 | | |
| 710 | 670 | //------------------------------------------------- |
| 711 | 671 | // MOS6529_INTERFACE( spi_user_intf ) |
| 712 | 672 | //------------------------------------------------- |
| 713 | 673 | |
| 714 | | READ8_MEMBER( plus4_state::spi_user_r ) |
| 715 | | { |
| 716 | | /* |
| 717 | | |
| 718 | | bit description |
| 719 | | |
| 720 | | 0 USER PORT B |
| 721 | | 1 |
| 722 | | 2 USER PORT 4, CASS SENSE |
| 723 | | 3 USER PORT 5 |
| 724 | | 4 USER PORT 6 |
| 725 | | 5 USER PORT 7 |
| 726 | | 6 USER PORT J |
| 727 | | 7 USER PORT F |
| 728 | | |
| 729 | | */ |
| 730 | | |
| 731 | | UINT8 data = m_user->p_r() & 0xfe; |
| 732 | | |
| 733 | | // cassette sense |
| 734 | | data &= ~0x04; |
| 735 | | data |= ((m_cassette->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_STOPPED) << 2; |
| 736 | | |
| 737 | | return data; |
| 738 | | } |
| 739 | | |
| 740 | | WRITE8_MEMBER( plus4_state::spi_user_w ) |
| 741 | | { |
| 742 | | /* |
| 743 | | |
| 744 | | bit description |
| 745 | | |
| 746 | | 0 USER PORT B |
| 747 | | 1 |
| 748 | | 2 USER PORT 4, CASS SENSE |
| 749 | | 3 USER PORT 5 |
| 750 | | 4 USER PORT 6 |
| 751 | | 5 USER PORT 7 |
| 752 | | 6 USER PORT J |
| 753 | | 7 USER PORT F |
| 754 | | |
| 755 | | */ |
| 756 | | |
| 757 | | // cassette sense |
| 758 | | data &= ~0x04; |
| 759 | | data |= ((m_cassette->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_STOPPED) << 2; |
| 760 | | |
| 761 | | m_user->p_w(data & 0xfe); |
| 762 | | } |
| 763 | | |
| 764 | 674 | static MOS6529_INTERFACE( spi_user_intf ) |
| 765 | 675 | { |
| 766 | | DEVCB_DRIVER_MEMBER(plus4_state, spi_user_r), |
| 767 | | DEVCB_DRIVER_MEMBER(plus4_state, spi_user_w) |
| 676 | DEVCB_DEVICE_MEMBER(PLUS4_USER_PORT_TAG, plus4_user_port_device, p_r), |
| 677 | DEVCB_DEVICE_MEMBER(PLUS4_USER_PORT_TAG, plus4_user_port_device, p_w) |
| 768 | 678 | }; |
| 769 | 679 | |
| 770 | 680 | |
| r15840 | r15841 | |
| 940 | 850 | |
| 941 | 851 | m_iec->reset(); |
| 942 | 852 | |
| 853 | if (m_acia) |
| 854 | { |
| 855 | m_acia->reset(); |
| 856 | } |
| 857 | |
| 858 | m_exp->reset(); |
| 859 | |
| 860 | if (m_user) |
| 861 | { |
| 862 | m_user->reset(); |
| 863 | } |
| 864 | |
| 943 | 865 | m_addr = 0; |
| 944 | 866 | m_rom_en = 1; |
| 945 | 867 | |
| r15840 | r15841 | |
| 968 | 890 | MCFG_CPU_PERIODIC_INT(c16_raster_interrupt, TED7360_HRETRACERATE) |
| 969 | 891 | MCFG_QUANTUM_TIME(attotime::from_hz(60)) |
| 970 | 892 | |
| 971 | | // video hardware |
| 972 | | MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 973 | | MCFG_SCREEN_REFRESH_RATE(TED7360PAL_VRETRACERATE) |
| 974 | | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 975 | | MCFG_SCREEN_SIZE(336, 216) |
| 976 | | MCFG_SCREEN_VISIBLE_AREA(0, 336 - 1, 0, 216 - 1) |
| 977 | | MCFG_SCREEN_UPDATE_DRIVER(plus4_state, screen_update) |
| 978 | | |
| 979 | | MCFG_PALETTE_LENGTH(ARRAY_LENGTH(ted7360_palette) / 3) |
| 980 | | MCFG_PALETTE_INIT(plus4) |
| 981 | | |
| 982 | | // sound hardware |
| 893 | // video and sound hardware |
| 983 | 894 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 984 | | MCFG_TED7360_ADD(MOS7360_TAG, ntsc_ted_intf) |
| 895 | MCFG_MOS7360_ADD(MOS7360_TAG, SCREEN_TAG, XTAL_14_31818MHz/4, ted_intf) |
| 985 | 896 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 986 | 897 | |
| 987 | 898 | // devices |
| r15840 | r15841 | |
| 1018 | 929 | MCFG_CPU_PERIODIC_INT(c16_raster_interrupt, TED7360_HRETRACERATE) |
| 1019 | 930 | MCFG_QUANTUM_TIME(attotime::from_hz(60)) |
| 1020 | 931 | |
| 1021 | | // video hardware |
| 1022 | | MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 1023 | | MCFG_SCREEN_REFRESH_RATE(TED7360PAL_VRETRACERATE) |
| 1024 | | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 1025 | | MCFG_SCREEN_SIZE(336, 216) |
| 1026 | | MCFG_SCREEN_VISIBLE_AREA(0, 336 - 1, 0, 216 - 1) |
| 1027 | | MCFG_SCREEN_UPDATE_DRIVER(plus4_state, screen_update) |
| 1028 | | |
| 1029 | | MCFG_PALETTE_LENGTH(ARRAY_LENGTH(ted7360_palette) / 3) |
| 1030 | | MCFG_PALETTE_INIT(plus4) |
| 1031 | | |
| 1032 | | // sound hardware |
| 932 | // video and sound hardware |
| 1033 | 933 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 1034 | | MCFG_TED7360_ADD(MOS7360_TAG, pal_ted_intf) |
| 934 | MCFG_MOS7360_ADD(MOS7360_TAG, SCREEN_TAG, XTAL_17_73447MHz/5, ted_intf) |
| 1035 | 935 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 1036 | 936 | |
| 1037 | 937 | // devices |
| r15840 | r15841 | |
| 1059 | 959 | // MACHINE_CONFIG( c16 ) |
| 1060 | 960 | //------------------------------------------------- |
| 1061 | 961 | |
| 1062 | | static MACHINE_CONFIG_START( c16, plus4_state ) |
| 1063 | | // basic machine hardware |
| 1064 | | MCFG_CPU_ADD(MOS7501_TAG, M7501, XTAL_17_73447MHz/20) |
| 1065 | | MCFG_CPU_PROGRAM_MAP(plus4_mem) |
| 1066 | | MCFG_CPU_CONFIG(cpu_intf) |
| 1067 | | MCFG_CPU_VBLANK_INT(SCREEN_TAG, c16_frame_interrupt) |
| 1068 | | MCFG_CPU_PERIODIC_INT(c16_raster_interrupt, TED7360_HRETRACERATE) |
| 1069 | | MCFG_QUANTUM_TIME(attotime::from_hz(60)) |
| 962 | static MACHINE_CONFIG_DERIVED( c16, pal ) |
| 963 | MCFG_DEVICE_REMOVE(MOS6551_TAG) |
| 964 | MCFG_DEVICE_REMOVE(MOS6529_USER_TAG) |
| 965 | MCFG_DEVICE_REMOVE(PLUS4_USER_PORT_TAG) |
| 1070 | 966 | |
| 1071 | | // video hardware |
| 1072 | | MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 1073 | | MCFG_SCREEN_REFRESH_RATE(TED7360PAL_VRETRACERATE) |
| 1074 | | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 1075 | | MCFG_SCREEN_SIZE(336, 216) |
| 1076 | | MCFG_SCREEN_VISIBLE_AREA(0, 336 - 1, 0, 216 - 1) |
| 1077 | | MCFG_SCREEN_UPDATE_DRIVER(plus4_state, screen_update) |
| 967 | MCFG_DEVICE_MODIFY(CBM_IEC_TAG) |
| 968 | MCFG_DEVICE_CONFIG(c16_iec_intf) |
| 1078 | 969 | |
| 1079 | | MCFG_PALETTE_LENGTH(ARRAY_LENGTH(ted7360_palette) / 3) |
| 1080 | | MCFG_PALETTE_INIT(plus4) |
| 1081 | | |
| 1082 | | // sound hardware |
| 1083 | | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 1084 | | MCFG_TED7360_ADD(MOS7360_TAG, pal_ted_intf) |
| 1085 | | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 1086 | | |
| 1087 | | // devices |
| 1088 | | MCFG_PLS100_ADD(PLA_TAG) |
| 1089 | | MCFG_MOS6529_ADD(MOS6529_KB_TAG, spi_kb_intf) |
| 1090 | | MCFG_QUICKLOAD_ADD("quickload", cbm_c16, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) |
| 1091 | | MCFG_CASSETTE_ADD( CASSETTE_TAG, cbm_cassette_interface ) |
| 1092 | | MCFG_CBM_IEC_ADD(c16_iec_intf, NULL) |
| 1093 | | MCFG_PLUS4_EXPANSION_SLOT_ADD(PLUS4_EXPANSION_SLOT_TAG, XTAL_17_73447MHz/20, expansion_intf, plus4_expansion_cards, NULL, NULL) |
| 1094 | | |
| 1095 | | // internal ram |
| 1096 | | MCFG_RAM_ADD(RAM_TAG) |
| 970 | MCFG_DEVICE_MODIFY(RAM_TAG) |
| 1097 | 971 | MCFG_RAM_DEFAULT_SIZE("16K") |
| 1098 | | |
| 1099 | | // software list |
| 1100 | | MCFG_SOFTWARE_LIST_ADD("cart_list", "plus4_cart") |
| 1101 | | MCFG_SOFTWARE_LIST_ADD("disk_list", "plus4_flop") |
| 972 | MCFG_RAM_EXTRA_OPTIONS("64K") |
| 1102 | 973 | MACHINE_CONFIG_END |
| 1103 | 974 | |
| 1104 | 975 | |
| r15840 | r15841 | |
| 1106 | 977 | // MACHINE_CONFIG( c232 ) |
| 1107 | 978 | //------------------------------------------------- |
| 1108 | 979 | |
| 1109 | | static MACHINE_CONFIG_START( c232, plus4_state ) |
| 1110 | | // basic machine hardware |
| 1111 | | MCFG_CPU_ADD(MOS7501_TAG, M7501, XTAL_14_31818MHz/16) |
| 1112 | | MCFG_CPU_PROGRAM_MAP(plus4_mem) |
| 1113 | | MCFG_CPU_CONFIG(cpu_intf) |
| 1114 | | MCFG_CPU_VBLANK_INT(SCREEN_TAG, c16_frame_interrupt) |
| 1115 | | MCFG_CPU_PERIODIC_INT(c16_raster_interrupt, TED7360_HRETRACERATE) |
| 1116 | | MCFG_QUANTUM_TIME(attotime::from_hz(60)) |
| 1117 | | |
| 1118 | | // video hardware |
| 1119 | | MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) |
| 1120 | | MCFG_SCREEN_REFRESH_RATE(TED7360PAL_VRETRACERATE) |
| 1121 | | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 1122 | | MCFG_SCREEN_SIZE(336, 216) |
| 1123 | | MCFG_SCREEN_VISIBLE_AREA(0, 336 - 1, 0, 216 - 1) |
| 1124 | | MCFG_SCREEN_UPDATE_DRIVER(plus4_state, screen_update) |
| 1125 | | |
| 1126 | | MCFG_PALETTE_LENGTH(ARRAY_LENGTH(ted7360_palette) / 3) |
| 1127 | | MCFG_PALETTE_INIT(plus4) |
| 1128 | | |
| 1129 | | // sound hardware |
| 1130 | | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 1131 | | MCFG_TED7360_ADD(MOS7360_TAG, ntsc_ted_intf) |
| 1132 | | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 1133 | | |
| 1134 | | // devices |
| 1135 | | MCFG_PLS100_ADD(PLA_TAG) |
| 1136 | | MCFG_MOS6529_ADD(MOS6529_KB_TAG, spi_kb_intf) |
| 1137 | | MCFG_QUICKLOAD_ADD("quickload", cbm_c16, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS) |
| 1138 | | MCFG_CASSETTE_ADD( CASSETTE_TAG, cbm_cassette_interface ) |
| 1139 | | MCFG_CBM_IEC_ADD(c16_iec_intf, NULL) |
| 1140 | | MCFG_PLUS4_EXPANSION_SLOT_ADD(PLUS4_EXPANSION_SLOT_TAG, XTAL_14_31818MHz/16, expansion_intf, plus4_expansion_cards, NULL, NULL) |
| 1141 | | |
| 1142 | | // internal ram |
| 1143 | | MCFG_RAM_ADD(RAM_TAG) |
| 980 | static MACHINE_CONFIG_DERIVED( c232, c16 ) |
| 981 | MCFG_DEVICE_MODIFY(RAM_TAG) |
| 1144 | 982 | MCFG_RAM_DEFAULT_SIZE("32K") |
| 1145 | | |
| 1146 | | // software list |
| 1147 | | MCFG_SOFTWARE_LIST_ADD("cart_list", "plus4_cart") |
| 1148 | | MCFG_SOFTWARE_LIST_ADD("disk_list", "plus4_flop") |
| 1149 | 983 | MACHINE_CONFIG_END |
| 1150 | 984 | |
| 1151 | 985 | |
| r15840 | r15841 | |
| 1186 | 1020 | |
| 1187 | 1021 | ROM_START( plus4n ) |
| 1188 | 1022 | ROM_REGION( 0x8000, "kernal", 0 ) |
| 1189 | | ROM_LOAD( "318006-01.u23", 0x0000, 0x4000, CRC(74eaae87) SHA1(161c96b4ad20f3a4f2321808e37a5ded26a135dd) ) |
| 1190 | | |
| 1191 | 1023 | ROM_DEFAULT_BIOS("r5") |
| 1192 | | ROM_SYSTEM_BIOS( 0, "r4", "rev. 4" ) |
| 1024 | ROM_SYSTEM_BIOS( 0, "r4", "Revision 4" ) |
| 1193 | 1025 | ROMX_LOAD( "318005-04.u24", 0x4000, 0x4000, CRC(799a633d) SHA1(5df52c693387c0e2b5d682613a3b5a65477311cf), ROM_BIOS(1) ) |
| 1194 | | ROM_SYSTEM_BIOS( 1, "r5", "rev. 5" ) |
| 1026 | ROM_SYSTEM_BIOS( 1, "r5", "Revision 5" ) |
| 1195 | 1027 | ROMX_LOAD( "318005-05.u24", 0x4000, 0x4000, CRC(70295038) SHA1(a3d9e5be091b98de39a046ab167fb7632d053682), ROM_BIOS(2) ) |
| 1196 | 1028 | ROM_SYSTEM_BIOS( 2, "jiffydos", "JiffyDOS v6.01" ) |
| 1197 | | ROMX_LOAD( "jiffydos plus4.u24", 0x0000, 0x8000, CRC(818d3f45) SHA1(9bc1b1c3da9ca642deae717905f990d8e36e6c3b), ROM_BIOS(3) ) |
| 1029 | ROMX_LOAD( "jiffydos plus4.u24", 0x0000, 0x8000, CRC(818d3f45) SHA1(9bc1b1c3da9ca642deae717905f990d8e36e6c3b), ROM_BIOS(3) ) // first half contains R5 kernal |
| 1198 | 1030 | |
| 1031 | ROM_LOAD( "318006-01.u23", 0x0000, 0x4000, CRC(74eaae87) SHA1(161c96b4ad20f3a4f2321808e37a5ded26a135dd) ) |
| 1032 | |
| 1199 | 1033 | ROM_REGION( 0x8000, "function", 0 ) |
| 1200 | 1034 | ROM_LOAD( "317053-01.u25", 0x0000, 0x4000, CRC(4fd1d8cb) SHA1(3b69f6e7cb4c18bb08e203fb18b7dabfa853390f) ) |
| 1201 | 1035 | ROM_LOAD( "317054-01.u26", 0x4000, 0x4000, CRC(109de2fc) SHA1(0ad7ac2db7da692d972e586ca0dfd747d82c7693) ) |
| r15840 | r15841 | |
| 1209 | 1043 | // ROM( plus4p ) |
| 1210 | 1044 | //------------------------------------------------- |
| 1211 | 1045 | |
| 1212 | | #define rom_plus4p rom_plus4n |
| 1046 | ROM_START( plus4p ) |
| 1047 | ROM_REGION( 0x8000, "kernal", 0 ) |
| 1048 | ROM_LOAD( "318006-01.u23", 0x0000, 0x4000, CRC(74eaae87) SHA1(161c96b4ad20f3a4f2321808e37a5ded26a135dd) ) |
| 1213 | 1049 | |
| 1050 | ROM_DEFAULT_BIOS("r5") |
| 1051 | ROM_SYSTEM_BIOS( 0, "r3", "Revision 3" ) |
| 1052 | ROMX_LOAD( "318004-03.u4", 0x4000, 0x4000, CRC(77bab934) SHA1(97814dab9d757fe5a3a61d357a9a81da588a9783), ROM_BIOS(1) ) |
| 1053 | ROM_SYSTEM_BIOS( 1, "r4", "Revision 4" ) |
| 1054 | ROMX_LOAD( "318004-04.u4", 0x4000, 0x4000, CRC(be54ed79) SHA1(514ad3c29d01a2c0a3b143d9c1d4143b1912b793), ROM_BIOS(2) ) |
| 1055 | ROM_SYSTEM_BIOS( 2, "r5", "Revision 5" ) |
| 1056 | ROMX_LOAD( "318004-05.u4", 0x4000, 0x4000, CRC(71c07bd4) SHA1(7c7e07f016391174a557e790c4ef1cbe33512cdb), ROM_BIOS(3) ) |
| 1214 | 1057 | |
| 1058 | ROM_REGION( 0x8000, "function", 0 ) |
| 1059 | ROM_LOAD( "317053-01.u25", 0x0000, 0x4000, CRC(4fd1d8cb) SHA1(3b69f6e7cb4c18bb08e203fb18b7dabfa853390f) ) |
| 1060 | ROM_LOAD( "317054-01.u26", 0x4000, 0x4000, CRC(109de2fc) SHA1(0ad7ac2db7da692d972e586ca0dfd747d82c7693) ) |
| 1061 | |
| 1062 | ROM_REGION( 0xf5, PLA_TAG, 0 ) |
| 1063 | ROM_LOAD( "251641-02.u19", 0x00, 0xf5, NO_DUMP ) |
| 1064 | ROM_END |
| 1065 | |
| 1066 | |
| 1215 | 1067 | //------------------------------------------------- |
| 1216 | 1068 | // ROM( c16 ) |
| 1217 | 1069 | //------------------------------------------------- |
| r15840 | r15841 | |
| 1221 | 1073 | ROM_LOAD( "318006-01.u3", 0x0000, 0x4000, CRC(74eaae87) SHA1(161c96b4ad20f3a4f2321808e37a5ded26a135dd) ) |
| 1222 | 1074 | |
| 1223 | 1075 | ROM_DEFAULT_BIOS("r5") |
| 1224 | | ROM_SYSTEM_BIOS( 0, "r3", "rev. 3" ) |
| 1076 | ROM_SYSTEM_BIOS( 0, "r3", "Revision 3" ) |
| 1225 | 1077 | ROMX_LOAD( "318004-03.u4", 0x4000, 0x4000, CRC(77bab934) SHA1(97814dab9d757fe5a3a61d357a9a81da588a9783), ROM_BIOS(1) ) |
| 1226 | | ROM_SYSTEM_BIOS( 1, "r4", "rev. 4" ) |
| 1078 | ROM_SYSTEM_BIOS( 1, "r4", "Revision 4" ) |
| 1227 | 1079 | ROMX_LOAD( "318004-04.u4", 0x4000, 0x4000, CRC(be54ed79) SHA1(514ad3c29d01a2c0a3b143d9c1d4143b1912b793), ROM_BIOS(2) ) |
| 1228 | | ROM_SYSTEM_BIOS( 2, "r5", "rev. 5" ) |
| 1080 | ROM_SYSTEM_BIOS( 2, "r5", "Revision 5" ) |
| 1229 | 1081 | ROMX_LOAD( "318004-05.u4", 0x4000, 0x4000, CRC(71c07bd4) SHA1(7c7e07f016391174a557e790c4ef1cbe33512cdb), ROM_BIOS(3) ) |
| 1230 | 1082 | |
| 1231 | 1083 | ROM_REGION( 0xf5, PLA_TAG, 0 ) |
| r15840 | r15841 | |
| 1242 | 1094 | ROM_LOAD( "318006-01.u3", 0x0000, 0x4000, CRC(74eaae87) SHA1(161c96b4ad20f3a4f2321808e37a5ded26a135dd) ) |
| 1243 | 1095 | |
| 1244 | 1096 | ROM_DEFAULT_BIOS("r5") |
| 1245 | | ROM_SYSTEM_BIOS( 0, "r3", "rev. 3" ) |
| 1097 | ROM_SYSTEM_BIOS( 0, "r3", "Revision 3" ) |
| 1246 | 1098 | ROMX_LOAD( "318004-03.u4", 0x4000, 0x4000, CRC(77bab934) SHA1(97814dab9d757fe5a3a61d357a9a81da588a9783), ROM_BIOS(1) ) |
| 1247 | | ROM_SYSTEM_BIOS( 1, "r4", "rev. 4" ) |
| 1099 | ROM_SYSTEM_BIOS( 1, "r4", "Revision 4" ) |
| 1248 | 1100 | ROMX_LOAD( "318004-04.u4", 0x4000, 0x4000, CRC(be54ed79) SHA1(514ad3c29d01a2c0a3b143d9c1d4143b1912b793), ROM_BIOS(2) ) |
| 1249 | | ROM_SYSTEM_BIOS( 2, "r5", "rev. 5" ) |
| 1101 | ROM_SYSTEM_BIOS( 2, "r5", "Revision 5" ) |
| 1250 | 1102 | ROMX_LOAD( "318004-05.u4", 0x4000, 0x4000, CRC(71c07bd4) SHA1(7c7e07f016391174a557e790c4ef1cbe33512cdb), ROM_BIOS(3) ) |
| 1251 | 1103 | |
| 1252 | 1104 | ROM_REGION( 0xf5, PLA_TAG, 0 ) |
| r15840 | r15841 | |
| 1261 | 1113 | ROM_START( c16h ) |
| 1262 | 1114 | ROM_REGION( 0x8000, "kernal", 0 ) |
| 1263 | 1115 | ROM_LOAD( "318006-01.u3", 0x0000, 0x4000, CRC(74eaae87) SHA1(161c96b4ad20f3a4f2321808e37a5ded26a135dd) ) |
| 1264 | | ROM_LOAD( "hungary.u4", 0x4000, 0x4000, CRC(775f60c5) SHA1(20cf3c4bf6c54ef09799af41887218933f2e27ee) ) |
| 1116 | |
| 1117 | ROM_DEFAULT_BIOS("r2") |
| 1118 | ROM_SYSTEM_BIOS( 0, "r1", "Revision 1" ) |
| 1119 | ROMX_LOAD( "318030-01.u4", 0x4000, 0x4000, NO_DUMP, ROM_BIOS(1) ) |
| 1120 | ROM_SYSTEM_BIOS( 1, "r2", "Revision 2" ) |
| 1121 | ROMX_LOAD( "318030-02.u4", 0x4000, 0x4000, CRC(775f60c5) SHA1(20cf3c4bf6c54ef09799af41887218933f2e27ee), ROM_BIOS(2) ) |
| 1265 | 1122 | |
| 1266 | 1123 | ROM_REGION( 0xf5, PLA_TAG, 0 ) |
| 1267 | 1124 | ROM_LOAD( "251641-02.u16", 0x00, 0xf5, NO_DUMP ) |