src/emu/video/sed1330.c
| r0 | r11080 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | Seiko-Epson SED1330 LCD Controller 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 "sed1330.h" |
| 12 | |
| 13 | |
| 14 | |
| 15 | //************************************************************************** |
| 16 | // MACROS / CONSTANTS |
| 17 | //************************************************************************** |
| 18 | |
| 19 | #define LOG 0 |
| 20 | |
| 21 | |
| 22 | #define INSTRUCTION_SYSTEM_SET 0x40 |
| 23 | #define INSTRUCTION_SLEEP_IN 0x53 // unimplemented |
| 24 | #define INSTRUCTION_DISP_ON 0x59 |
| 25 | #define INSTRUCTION_DISP_OFF 0x58 |
| 26 | #define INSTRUCTION_SCROLL 0x44 |
| 27 | #define INSTRUCTION_CSRFORM 0x5d |
| 28 | #define INSTRUCTION_CGRAM_ADR 0x5c |
| 29 | #define INSTRUCTION_CSRDIR_RIGHT 0x4c |
| 30 | #define INSTRUCTION_CSRDIR_LEFT 0x4d |
| 31 | #define INSTRUCTION_CSRDIR_UP 0x4e |
| 32 | #define INSTRUCTION_CSRDIR_DOWN 0x4f |
| 33 | #define INSTRUCTION_HDOT_SCR 0x5a |
| 34 | #define INSTRUCTION_OVLAY 0x5b |
| 35 | #define INSTRUCTION_CSRW 0x46 |
| 36 | #define INSTRUCTION_CSRR 0x47 // unimplemented |
| 37 | #define INSTRUCTION_MWRITE 0x42 |
| 38 | #define INSTRUCTION_MREAD 0x43 // unimplemented |
| 39 | |
| 40 | |
| 41 | #define CSRDIR_RIGHT 0x00 |
| 42 | #define CSRDIR_LEFT 0x01 |
| 43 | #define CSRDIR_UP 0x02 |
| 44 | #define CSRDIR_DOWN 0x03 |
| 45 | |
| 46 | |
| 47 | #define MX_OR 0x00 |
| 48 | #define MX_XOR 0x01 // unimplemented |
| 49 | #define MX_AND 0x02 // unimplemented |
| 50 | #define MX_PRIORITY_OR 0x03 // unimplemented |
| 51 | |
| 52 | |
| 53 | #define FC_OFF 0x00 |
| 54 | #define FC_SOLID 0x01 // unimplemented |
| 55 | #define FC_FLASH_32 0x02 // unimplemented |
| 56 | #define FC_FLASH_64 0x03 // unimplemented |
| 57 | |
| 58 | |
| 59 | |
| 60 | //************************************************************************** |
| 61 | // GLOBAL VARIABLES |
| 62 | //************************************************************************** |
| 63 | |
| 64 | // devices |
| 65 | const device_type SED1330 = sed1330_device_config::static_alloc_device_config; |
| 66 | |
| 67 | |
| 68 | // default address map |
| 69 | static ADDRESS_MAP_START( sed1330, AS_0, 8 ) |
| 70 | AM_RANGE(0x0000, 0xffff) AM_RAM |
| 71 | ADDRESS_MAP_END |
| 72 | |
| 73 | |
| 74 | // internal character generator ROM |
| 75 | ROM_START( sed1330 ) |
| 76 | ROM_REGION( 0x5c0, "gfx1", 0 ) // internal chargen ROM |
| 77 | ROM_LOAD( "sed1330.bin", 0x000, 0x5c0, NO_DUMP ) |
| 78 | ROM_END |
| 79 | |
| 80 | |
| 81 | |
| 82 | //************************************************************************** |
| 83 | // DEVICE CONFIGURATION |
| 84 | //************************************************************************** |
| 85 | |
| 86 | //------------------------------------------------- |
| 87 | // sed1330_device_config - constructor |
| 88 | //------------------------------------------------- |
| 89 | |
| 90 | sed1330_device_config::sed1330_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 91 | : device_config(mconfig, static_alloc_device_config, "Seiko-Epson SED1330", tag, owner, clock), |
| 92 | device_config_memory_interface(mconfig, *this), |
| 93 | m_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, NULL, *ADDRESS_MAP_NAME(sed1330)) |
| 94 | { |
| 95 | m_shortname = "sed1330"; |
| 96 | } |
| 97 | |
| 98 | |
| 99 | //------------------------------------------------- |
| 100 | // static_alloc_device_config - allocate a new |
| 101 | // configuration object |
| 102 | //------------------------------------------------- |
| 103 | |
| 104 | device_config *sed1330_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) |
| 105 | { |
| 106 | return global_alloc(sed1330_device_config(mconfig, tag, owner, clock)); |
| 107 | } |
| 108 | |
| 109 | |
| 110 | //------------------------------------------------- |
| 111 | // alloc_device - allocate a new device object |
| 112 | //------------------------------------------------- |
| 113 | |
| 114 | device_t *sed1330_device_config::alloc_device(running_machine &machine) const |
| 115 | { |
| 116 | return auto_alloc(machine, sed1330_device(machine, *this)); |
| 117 | } |
| 118 | |
| 119 | |
| 120 | //------------------------------------------------- |
| 121 | // memory_space_config - return a description of |
| 122 | // any address spaces owned by this device |
| 123 | //------------------------------------------------- |
| 124 | |
| 125 | const address_space_config *sed1330_device_config::memory_space_config(address_spacenum spacenum) const |
| 126 | { |
| 127 | return (spacenum == AS_0) ? &m_space_config : NULL; |
| 128 | } |
| 129 | |
| 130 | |
| 131 | //------------------------------------------------- |
| 132 | // rom_region - device-specific ROM region |
| 133 | //------------------------------------------------- |
| 134 | |
| 135 | const rom_entry *sed1330_device_config::device_rom_region() const |
| 136 | { |
| 137 | return ROM_NAME( sed1330 ); |
| 138 | } |
| 139 | |
| 140 | |
| 141 | //------------------------------------------------- |
| 142 | // device_config_complete - perform any |
| 143 | // operations now that the configuration is |
| 144 | // complete |
| 145 | //------------------------------------------------- |
| 146 | |
| 147 | void sed1330_device_config::device_config_complete() |
| 148 | { |
| 149 | // inherit a copy of the static data |
| 150 | const sed1330_interface *intf = reinterpret_cast<const sed1330_interface *>(static_config()); |
| 151 | if (intf != NULL) |
| 152 | *static_cast<sed1330_interface *>(this) = *intf; |
| 153 | |
| 154 | // or initialize to defaults if none provided |
| 155 | else |
| 156 | { |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | |
| 161 | |
| 162 | //************************************************************************** |
| 163 | // INLINE HELPERS |
| 164 | //************************************************************************** |
| 165 | |
| 166 | //------------------------------------------------- |
| 167 | // readbyte - read a byte at the given address |
| 168 | //------------------------------------------------- |
| 169 | |
| 170 | inline UINT8 sed1330_device::readbyte(offs_t address) |
| 171 | { |
| 172 | return space()->read_byte(address); |
| 173 | } |
| 174 | |
| 175 | |
| 176 | //------------------------------------------------- |
| 177 | // writebyte - write a byte at the given address |
| 178 | //------------------------------------------------- |
| 179 | |
| 180 | inline void sed1330_device::writebyte(offs_t address, UINT8 data) |
| 181 | { |
| 182 | space()->write_byte(address, data); |
| 183 | } |
| 184 | |
| 185 | |
| 186 | //------------------------------------------------- |
| 187 | // increment_csr - increment cursor address |
| 188 | //------------------------------------------------- |
| 189 | |
| 190 | inline void sed1330_device::increment_csr() |
| 191 | { |
| 192 | switch (m_cd) |
| 193 | { |
| 194 | case CSRDIR_RIGHT: |
| 195 | m_csr++; |
| 196 | break; |
| 197 | |
| 198 | case CSRDIR_LEFT: |
| 199 | m_csr--; |
| 200 | break; |
| 201 | |
| 202 | case CSRDIR_UP: |
| 203 | m_csr -= m_ap; |
| 204 | break; |
| 205 | |
| 206 | case CSRDIR_DOWN: |
| 207 | m_csr += m_ap; |
| 208 | break; |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | |
| 213 | |
| 214 | //************************************************************************** |
| 215 | // LIVE DEVICE |
| 216 | //************************************************************************** |
| 217 | |
| 218 | //------------------------------------------------- |
| 219 | // sed1330_device - constructor |
| 220 | //------------------------------------------------- |
| 221 | |
| 222 | sed1330_device::sed1330_device(running_machine &_machine, const sed1330_device_config &config) |
| 223 | : device_t(_machine, config), |
| 224 | device_memory_interface(_machine, config, *this), |
| 225 | m_bf(0), |
| 226 | m_config(config) |
| 227 | { |
| 228 | } |
| 229 | |
| 230 | |
| 231 | //------------------------------------------------- |
| 232 | // device_start - device-specific startup |
| 233 | //------------------------------------------------- |
| 234 | |
| 235 | void sed1330_device::device_start() |
| 236 | { |
| 237 | // register for state saving |
| 238 | save_item(NAME(m_bf)); |
| 239 | save_item(NAME(m_ir)); |
| 240 | save_item(NAME(m_dor)); |
| 241 | save_item(NAME(m_pbc)); |
| 242 | save_item(NAME(m_d)); |
| 243 | save_item(NAME(m_sleep)); |
| 244 | save_item(NAME(m_sag)); |
| 245 | save_item(NAME(m_m0)); |
| 246 | save_item(NAME(m_m1)); |
| 247 | save_item(NAME(m_m2)); |
| 248 | save_item(NAME(m_ws)); |
| 249 | save_item(NAME(m_iv)); |
| 250 | save_item(NAME(m_wf)); |
| 251 | save_item(NAME(m_fx)); |
| 252 | save_item(NAME(m_fy)); |
| 253 | save_item(NAME(m_cr)); |
| 254 | save_item(NAME(m_tcr)); |
| 255 | save_item(NAME(m_lf)); |
| 256 | save_item(NAME(m_ap)); |
| 257 | save_item(NAME(m_sad1)); |
| 258 | save_item(NAME(m_sad2)); |
| 259 | save_item(NAME(m_sad3)); |
| 260 | save_item(NAME(m_sad4)); |
| 261 | save_item(NAME(m_sl1)); |
| 262 | save_item(NAME(m_sl2)); |
| 263 | save_item(NAME(m_hdotscr)); |
| 264 | save_item(NAME(m_csr)); |
| 265 | save_item(NAME(m_cd)); |
| 266 | save_item(NAME(m_crx)); |
| 267 | save_item(NAME(m_cry)); |
| 268 | save_item(NAME(m_cm)); |
| 269 | save_item(NAME(m_fc)); |
| 270 | save_item(NAME(m_fp)); |
| 271 | save_item(NAME(m_mx)); |
| 272 | save_item(NAME(m_dm)); |
| 273 | save_item(NAME(m_ov)); |
| 274 | } |
| 275 | |
| 276 | |
| 277 | //------------------------------------------------- |
| 278 | // device_reset - device-specific reset |
| 279 | //------------------------------------------------- |
| 280 | |
| 281 | void sed1330_device::device_reset() |
| 282 | { |
| 283 | } |
| 284 | |
| 285 | |
| 286 | //------------------------------------------------- |
| 287 | // status_r - |
| 288 | //------------------------------------------------- |
| 289 | |
| 290 | READ8_MEMBER( sed1330_device::status_r ) |
| 291 | { |
| 292 | if (LOG) logerror("SED1330 '%s' Status Read: %s\n", tag(), m_bf ? "busy" : "ready"); |
| 293 | |
| 294 | return m_bf << 6; |
| 295 | } |
| 296 | |
| 297 | |
| 298 | //------------------------------------------------- |
| 299 | // command_w - |
| 300 | //------------------------------------------------- |
| 301 | |
| 302 | WRITE8_MEMBER( sed1330_device::command_w ) |
| 303 | { |
| 304 | m_ir = data; |
| 305 | m_pbc = 0; |
| 306 | |
| 307 | switch (m_ir) |
| 308 | { |
| 309 | #if 0 |
| 310 | case INSTRUCTION_SLEEP_IN: |
| 311 | break; |
| 312 | #endif |
| 313 | case INSTRUCTION_CSRDIR_RIGHT: |
| 314 | case INSTRUCTION_CSRDIR_LEFT: |
| 315 | case INSTRUCTION_CSRDIR_UP: |
| 316 | case INSTRUCTION_CSRDIR_DOWN: |
| 317 | m_cd = data & 0x03; |
| 318 | |
| 319 | if (LOG) |
| 320 | { |
| 321 | switch (m_cd) |
| 322 | { |
| 323 | case CSRDIR_RIGHT: logerror("SED1330 '%s' Cursor Direction: Right\n", tag()); break; |
| 324 | case CSRDIR_LEFT: logerror("SED1330 '%s' Cursor Direction: Left\n", tag()); break; |
| 325 | case CSRDIR_UP: logerror("SED1330 '%s' Cursor Direction: Up\n", tag()); break; |
| 326 | case CSRDIR_DOWN: logerror("SED1330 '%s' Cursor Direction: Down\n", tag()); break; |
| 327 | } |
| 328 | } |
| 329 | break; |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | |
| 334 | //------------------------------------------------- |
| 335 | // data_r - |
| 336 | //------------------------------------------------- |
| 337 | |
| 338 | READ8_MEMBER( sed1330_device::data_r ) |
| 339 | { |
| 340 | UINT8 data = readbyte(m_csr); |
| 341 | |
| 342 | if (LOG) logerror("SED1330 '%s' Memory Read %02x from %04x\n", tag(), data, m_csr); |
| 343 | |
| 344 | increment_csr(); |
| 345 | |
| 346 | return data; |
| 347 | } |
| 348 | |
| 349 | |
| 350 | //------------------------------------------------- |
| 351 | // data_w - |
| 352 | //------------------------------------------------- |
| 353 | |
| 354 | WRITE8_MEMBER( sed1330_device::data_w ) |
| 355 | { |
| 356 | switch (m_ir) |
| 357 | { |
| 358 | case INSTRUCTION_SYSTEM_SET: |
| 359 | switch (m_pbc) |
| 360 | { |
| 361 | case 0: |
| 362 | m_m0 = BIT(data, 0); |
| 363 | m_m1 = BIT(data, 1); |
| 364 | m_m2 = BIT(data, 2); |
| 365 | m_ws = BIT(data, 3); |
| 366 | m_iv = BIT(data, 5); |
| 367 | |
| 368 | if (LOG) |
| 369 | { |
| 370 | logerror("SED1330 '%s' %s CG ROM\n", tag(), BIT(data, 0) ? "External" : "Internal"); |
| 371 | logerror("SED1330 '%s' D6 Correction: %s\n", tag(), BIT(data, 1) ? "enabled" : "disabled"); |
| 372 | logerror("SED1330 '%s' Character Height: %u\n", tag(), BIT(data, 2) ? 16 : 8); |
| 373 | logerror("SED1330 '%s' %s Panel Drive\n", tag(), BIT(data, 3) ? "Dual" : "Single"); |
| 374 | logerror("SED1330 '%s' Screen Top-Line Correction: %s\n", tag(), BIT(data, 5) ? "disabled" : "enabled"); |
| 375 | } |
| 376 | break; |
| 377 | |
| 378 | case 1: |
| 379 | m_fx = (data & 0x07) + 1; |
| 380 | m_wf = BIT(data, 7); |
| 381 | |
| 382 | if (LOG) |
| 383 | { |
| 384 | logerror("SED1330 '%s' Horizontal Character Size: %u\n", tag(), m_fx); |
| 385 | logerror("SED1330 '%s' %s AC Drive\n", tag(), BIT(data, 7) ? "2-frame" : "16-line"); |
| 386 | } |
| 387 | break; |
| 388 | |
| 389 | case 2: |
| 390 | m_fy = (data & 0x0f) + 1; |
| 391 | if (LOG) logerror("SED1330 '%s' Vertical Character Size: %u\n", tag(), m_fy); |
| 392 | break; |
| 393 | |
| 394 | case 3: |
| 395 | m_cr = data + 1; |
| 396 | if (LOG) logerror("SED1330 '%s' Visible Characters Per Line: %u\n", tag(), m_cr); |
| 397 | break; |
| 398 | |
| 399 | case 4: |
| 400 | m_tcr = data + 1; |
| 401 | if (LOG) logerror("SED1330 '%s' Total Characters Per Line: %u\n", tag(), m_tcr); |
| 402 | break; |
| 403 | |
| 404 | case 5: |
| 405 | m_lf = data + 1; |
| 406 | if (LOG) logerror("SED1330 '%s' Frame Height: %u\n", tag(), m_lf); |
| 407 | break; |
| 408 | |
| 409 | case 6: |
| 410 | m_ap = (m_ap & 0xff00) | data; |
| 411 | break; |
| 412 | |
| 413 | case 7: |
| 414 | m_ap = (data << 8) | (m_ap & 0xff); |
| 415 | if (LOG) logerror("SED1330 '%s' Virtual Screen Width: %u\n", tag(), m_ap); |
| 416 | break; |
| 417 | |
| 418 | default: |
| 419 | logerror("SED1330 '%s' Invalid parameter byte %02x\n", tag(), data); |
| 420 | } |
| 421 | break; |
| 422 | |
| 423 | case INSTRUCTION_DISP_ON: |
| 424 | case INSTRUCTION_DISP_OFF: |
| 425 | m_d = BIT(data, 0); |
| 426 | m_fc = data & 0x03; |
| 427 | m_fp = data >> 2; |
| 428 | if (LOG) |
| 429 | { |
| 430 | logerror("SED1330 '%s' Display: %s\n", tag(), BIT(data, 0) ? "enabled" : "disabled"); |
| 431 | |
| 432 | switch (m_fc) |
| 433 | { |
| 434 | case FC_OFF: logerror("SED1330 '%s' Cursor: disabled\n", tag()); break; |
| 435 | case FC_SOLID: logerror("SED1330 '%s' Cursor: solid\n", tag()); break; |
| 436 | case FC_FLASH_32: logerror("SED1330 '%s' Cursor: fFR/32\n", tag()); break; |
| 437 | case FC_FLASH_64: logerror("SED1330 '%s' Cursor: fFR/64\n", tag()); break; |
| 438 | } |
| 439 | |
| 440 | switch (m_fp & 0x03) |
| 441 | { |
| 442 | case FC_OFF: logerror("SED1330 '%s' Display Page 1: disabled\n", tag()); break; |
| 443 | case FC_SOLID: logerror("SED1330 '%s' Display Page 1: enabled\n", tag()); break; |
| 444 | case FC_FLASH_32: logerror("SED1330 '%s' Display Page 1: flash fFR/32\n", tag()); break; |
| 445 | case FC_FLASH_64: logerror("SED1330 '%s' Display Page 1: flash fFR/64\n", tag()); break; |
| 446 | } |
| 447 | |
| 448 | switch ((m_fp >> 2) & 0x03) |
| 449 | { |
| 450 | case FC_OFF: logerror("SED1330 '%s' Display Page 2/4: disabled\n", tag()); break; |
| 451 | case FC_SOLID: logerror("SED1330 '%s' Display Page 2/4: enabled\n", tag()); break; |
| 452 | case FC_FLASH_32: logerror("SED1330 '%s' Display Page 2/4: flash fFR/32\n", tag()); break; |
| 453 | case FC_FLASH_64: logerror("SED1330 '%s' Display Page 2/4: flash fFR/64\n", tag()); break; |
| 454 | } |
| 455 | |
| 456 | switch ((m_fp >> 4) & 0x03) |
| 457 | { |
| 458 | case FC_OFF: logerror("SED1330 '%s' Display Page 3: disabled\n", tag()); break; |
| 459 | case FC_SOLID: logerror("SED1330 '%s' Display Page 3: enabled\n", tag()); break; |
| 460 | case FC_FLASH_32: logerror("SED1330 '%s' Display Page 3: flash fFR/32\n", tag()); break; |
| 461 | case FC_FLASH_64: logerror("SED1330 '%s' Display Page 3: flash fFR/64\n", tag()); break; |
| 462 | } |
| 463 | } |
| 464 | break; |
| 465 | |
| 466 | case INSTRUCTION_SCROLL: |
| 467 | switch (m_pbc) |
| 468 | { |
| 469 | case 0: |
| 470 | m_sad1 = (m_sad1 & 0xff00) | data; |
| 471 | break; |
| 472 | |
| 473 | case 1: |
| 474 | m_sad1 = (data << 8) | (m_sad1 & 0xff); |
| 475 | if (LOG) logerror("SED1330 '%s' Display Page 1 Start Address: %04x\n", tag(), m_sad1); |
| 476 | break; |
| 477 | |
| 478 | case 2: |
| 479 | m_sl1 = data + 1; |
| 480 | if (LOG) logerror("SED1330 '%s' Display Block 1 Screen Lines: %u\n", tag(), m_sl1); |
| 481 | break; |
| 482 | |
| 483 | case 3: |
| 484 | m_sad2 = (m_sad2 & 0xff00) | data; |
| 485 | break; |
| 486 | |
| 487 | case 4: |
| 488 | m_sad2 = (data << 8) | (m_sad2 & 0xff); |
| 489 | if (LOG) logerror("SED1330 '%s' Display Page 2 Start Address: %04x\n", tag(), m_sad2); |
| 490 | break; |
| 491 | |
| 492 | case 5: |
| 493 | m_sl2 = data + 1; |
| 494 | if (LOG) logerror("SED1330 '%s' Display Block 2 Screen Lines: %u\n", tag(), m_sl2); |
| 495 | break; |
| 496 | |
| 497 | case 6: |
| 498 | m_sad3 = (m_sad3 & 0xff00) | data; |
| 499 | break; |
| 500 | |
| 501 | case 7: |
| 502 | m_sad3 = (data << 8) | (m_sad3 & 0xff); |
| 503 | if (LOG) logerror("SED1330 '%s' Display Page 3 Start Address: %04x\n", tag(), m_sad3); |
| 504 | break; |
| 505 | |
| 506 | case 8: |
| 507 | m_sad4 = (m_sad4 & 0xff00) | data; |
| 508 | break; |
| 509 | |
| 510 | case 9: |
| 511 | m_sad4 = (data << 8) | (m_sad4 & 0xff); |
| 512 | if (LOG) logerror("SED1330 '%s' Display Page 4 Start Address: %04x\n", tag(), m_sad4); |
| 513 | break; |
| 514 | |
| 515 | default: |
| 516 | logerror("SED1330 '%s' Invalid parameter byte %02x\n", tag(), data); |
| 517 | } |
| 518 | break; |
| 519 | |
| 520 | case INSTRUCTION_CSRFORM: |
| 521 | switch (m_pbc) |
| 522 | { |
| 523 | case 0: |
| 524 | m_crx = (data & 0x0f) + 1; |
| 525 | if (LOG) logerror("SED1330 '%s' Horizontal Cursor Size: %u\n", tag(), m_crx); |
| 526 | break; |
| 527 | |
| 528 | case 1: |
| 529 | m_cry = (data & 0x0f) + 1; |
| 530 | m_cm = BIT(data, 7); |
| 531 | if (LOG) |
| 532 | { |
| 533 | logerror("SED1330 '%s' Vertical Cursor Location: %u\n", tag(), m_cry); |
| 534 | logerror("SED1330 '%s' Cursor Shape: %s\n", tag(), BIT(data, 7) ? "Block" : "Underscore"); |
| 535 | } |
| 536 | break; |
| 537 | |
| 538 | default: |
| 539 | logerror("SED1330 '%s' Invalid parameter byte %02x\n", tag(), data); |
| 540 | } |
| 541 | break; |
| 542 | |
| 543 | case INSTRUCTION_CGRAM_ADR: |
| 544 | switch (m_pbc) |
| 545 | { |
| 546 | case 0: |
| 547 | m_sag = (m_sag & 0xff00) | data; |
| 548 | break; |
| 549 | |
| 550 | case 1: |
| 551 | m_sag = (data << 8) | (m_sag & 0xff); |
| 552 | if (LOG) logerror("SED1330 '%s' Character Generator RAM Start Address: %04x\n", tag(), m_sag); |
| 553 | break; |
| 554 | |
| 555 | default: |
| 556 | logerror("SED1330 '%s' Invalid parameter byte %02x\n", tag(), data); |
| 557 | } |
| 558 | break; |
| 559 | |
| 560 | case INSTRUCTION_HDOT_SCR: |
| 561 | m_hdotscr = data & 0x07; |
| 562 | if (LOG) logerror("SED1330 '%s' Horizontal Dot Scroll: %u\n", tag(), m_hdotscr); |
| 563 | break; |
| 564 | |
| 565 | case INSTRUCTION_OVLAY: |
| 566 | m_mx = data & 0x03; |
| 567 | m_dm = (data >> 2) & 0x03; |
| 568 | m_ov = BIT(data, 4); |
| 569 | |
| 570 | if (LOG) |
| 571 | { |
| 572 | switch (m_mx) |
| 573 | { |
| 574 | case MX_OR: logerror("SED1330 '%s' Display Composition Method: OR\n", tag()); break; |
| 575 | case MX_XOR: logerror("SED1330 '%s' Display Composition Method: Exclusive-OR\n", tag()); break; |
| 576 | case MX_AND: logerror("SED1330 '%s' Display Composition Method: AND\n", tag()); break; |
| 577 | case MX_PRIORITY_OR: logerror("SED1330 '%s' Display Composition Method: Priority-OR\n", tag()); break; |
| 578 | } |
| 579 | |
| 580 | logerror("SED1330 '%s' Display Page 1 Mode: %s\n", tag(), BIT(data, 2) ? "Graphics" : "Text"); |
| 581 | logerror("SED1330 '%s' Display Page 3 Mode: %s\n", tag(), BIT(data, 3) ? "Graphics" : "Text"); |
| 582 | logerror("SED1330 '%s' Display Composition Layers: %u\n", tag(), BIT(data, 4) ? 3 : 2); |
| 583 | } |
| 584 | break; |
| 585 | |
| 586 | case INSTRUCTION_CSRW: |
| 587 | switch (m_pbc) |
| 588 | { |
| 589 | case 0: |
| 590 | m_csr = (m_csr & 0xff00) | data; |
| 591 | break; |
| 592 | |
| 593 | case 1: |
| 594 | m_csr = (data << 8) | (m_csr & 0xff); |
| 595 | if (LOG) logerror("SED1330 '%s' Cursor Address %04x\n", tag(), m_csr); |
| 596 | break; |
| 597 | |
| 598 | default: |
| 599 | logerror("SED1330 '%s' Invalid parameter byte %02x\n", tag(), data); |
| 600 | } |
| 601 | break; |
| 602 | #if 0 |
| 603 | case INSTRUCTION_CSRR: |
| 604 | break; |
| 605 | #endif |
| 606 | case INSTRUCTION_MWRITE: |
| 607 | if (LOG) logerror("SED1330 '%s' Memory Write %02x to %04x (row %u col %u line %u)\n", tag(), data, m_csr, m_csr/80/8, m_csr%80, m_csr/80); |
| 608 | |
| 609 | writebyte(m_csr, data); |
| 610 | |
| 611 | increment_csr(); |
| 612 | break; |
| 613 | #if 0 |
| 614 | case INSTRUCTION_MREAD: |
| 615 | break; |
| 616 | #endif |
| 617 | default: |
| 618 | logerror("SED1330 '%s' Unsupported instruction %02x\n", tag(), m_ir); |
| 619 | } |
| 620 | |
| 621 | m_pbc++; |
| 622 | } |
| 623 | |
| 624 | |
| 625 | //------------------------------------------------- |
| 626 | // draw_text_scanline - |
| 627 | //------------------------------------------------- |
| 628 | |
| 629 | void sed1330_device::draw_text_scanline(bitmap_t *bitmap, const rectangle *cliprect, int y, UINT16 va) |
| 630 | { |
| 631 | int sx, x; |
| 632 | |
| 633 | for (sx = 0; sx < m_cr; sx++) |
| 634 | { |
| 635 | if ((va + sx) == m_csr) |
| 636 | { |
| 637 | if (m_fc == FC_OFF) continue; |
| 638 | |
| 639 | if (m_cm) |
| 640 | { |
| 641 | // block cursor |
| 642 | if (y % m_fy < m_cry) |
| 643 | { |
| 644 | for (x = 0; x < m_crx; x++) |
| 645 | { |
| 646 | *BITMAP_ADDR16(bitmap, y, (sx * m_fx) + x) = 1; |
| 647 | } |
| 648 | } |
| 649 | } |
| 650 | else |
| 651 | { |
| 652 | // underscore cursor |
| 653 | if (y % m_fy == m_cry) |
| 654 | { |
| 655 | for (x = 0; x < m_crx; x++) |
| 656 | { |
| 657 | *BITMAP_ADDR16(bitmap, y, (sx * m_fx) + x) = 1; |
| 658 | } |
| 659 | } |
| 660 | } |
| 661 | } |
| 662 | } |
| 663 | } |
| 664 | |
| 665 | |
| 666 | //------------------------------------------------- |
| 667 | // draw_graphics_scanline - |
| 668 | //------------------------------------------------- |
| 669 | |
| 670 | void sed1330_device::draw_graphics_scanline(bitmap_t *bitmap, const rectangle *cliprect, int y, UINT16 va) |
| 671 | { |
| 672 | int sx, x; |
| 673 | |
| 674 | for (sx = 0; sx < m_cr; sx++) |
| 675 | { |
| 676 | UINT8 data = readbyte(va++); |
| 677 | |
| 678 | for (x = 0; x < m_fx; x++) |
| 679 | { |
| 680 | *BITMAP_ADDR16(bitmap, y, (sx * m_fx) + x) = BIT(data, 7); |
| 681 | data <<= 1; |
| 682 | } |
| 683 | } |
| 684 | } |
| 685 | |
| 686 | |
| 687 | //------------------------------------------------- |
| 688 | // update_graphics - |
| 689 | //------------------------------------------------- |
| 690 | |
| 691 | void sed1330_device::update_graphics(bitmap_t *bitmap, const rectangle *cliprect) |
| 692 | { |
| 693 | } |
| 694 | |
| 695 | |
| 696 | //------------------------------------------------- |
| 697 | // update_text - |
| 698 | //------------------------------------------------- |
| 699 | |
| 700 | void sed1330_device::update_text(bitmap_t *bitmap, const rectangle *cliprect) |
| 701 | { |
| 702 | int y; |
| 703 | |
| 704 | if (m_ws) |
| 705 | { |
| 706 | for (y = 0; y < m_sl1; y++) |
| 707 | { |
| 708 | UINT16 sad1 = m_sad1 + ((y / m_fy) * m_ap); |
| 709 | UINT16 sad2 = m_sad2 + (y * m_ap); |
| 710 | UINT16 sad3 = m_sad3 + ((y / m_fy) * m_ap); |
| 711 | UINT16 sad4 = m_sad4 + (y * m_ap); |
| 712 | |
| 713 | // draw graphics display page 2 scanline |
| 714 | draw_graphics_scanline(bitmap, cliprect, y, sad2); |
| 715 | |
| 716 | // draw text display page 1 scanline |
| 717 | draw_text_scanline(bitmap, cliprect, y, sad1); |
| 718 | |
| 719 | // draw graphics display page 4 scanline |
| 720 | draw_graphics_scanline(bitmap, cliprect, y + m_sl1, sad4); |
| 721 | |
| 722 | // draw text display page 3 scanline |
| 723 | draw_text_scanline(bitmap, cliprect, y + m_sl1, sad3); |
| 724 | } |
| 725 | } |
| 726 | } |
| 727 | |
| 728 | |
| 729 | //------------------------------------------------- |
| 730 | // update_screen - |
| 731 | //------------------------------------------------- |
| 732 | |
| 733 | void sed1330_device::update_screen(bitmap_t *bitmap, const rectangle *cliprect) |
| 734 | { |
| 735 | if (m_d) |
| 736 | { |
| 737 | if (m_dm) |
| 738 | { |
| 739 | update_graphics(bitmap, cliprect); |
| 740 | } |
| 741 | else |
| 742 | { |
| 743 | update_text(bitmap, cliprect); |
| 744 | } |
| 745 | } |
| 746 | } |
src/emu/video/sed1330.h
| r0 | r11080 | |
| 1 | /********************************************************************** |
| 2 | |
| 3 | Seiko-Epson SED1330 LCD Controller emulation |
| 4 | |
| 5 | Copyright MESS Team. |
| 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | |
| 8 | **********************************************************************/ |
| 9 | |
| 10 | #pragma once |
| 11 | |
| 12 | #ifndef __SED1330__ |
| 13 | #define __SED1330__ |
| 14 | |
| 15 | #include "emu.h" |
| 16 | |
| 17 | |
| 18 | |
| 19 | //************************************************************************** |
| 20 | // INTERFACE CONFIGURATION MACROS |
| 21 | //************************************************************************** |
| 22 | |
| 23 | #define MCFG_SED1330_ADD(_tag, _clock, _config) \ |
| 24 | MCFG_DEVICE_ADD(_tag, SED1330, _clock) \ |
| 25 | MCFG_DEVICE_CONFIG(_config) |
| 26 | |
| 27 | |
| 28 | #define SED1330_INTERFACE(name) \ |
| 29 | const sed1330_interface (name) = |
| 30 | |
| 31 | |
| 32 | |
| 33 | //************************************************************************** |
| 34 | // TYPE DEFINITIONS |
| 35 | //************************************************************************** |
| 36 | |
| 37 | // ======================> sed1330_interface |
| 38 | |
| 39 | struct sed1330_interface |
| 40 | { |
| 41 | const char *screen_tag; |
| 42 | }; |
| 43 | |
| 44 | |
| 45 | |
| 46 | // ======================> sed1330_device_config |
| 47 | |
| 48 | class sed1330_device_config : public device_config, |
| 49 | public device_config_memory_interface, |
| 50 | public sed1330_interface |
| 51 | { |
| 52 | friend class sed1330_device; |
| 53 | |
| 54 | // construction/destruction |
| 55 | sed1330_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 56 | |
| 57 | public: |
| 58 | // allocators |
| 59 | static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); |
| 60 | virtual device_t *alloc_device(running_machine &machine) const; |
| 61 | |
| 62 | protected: |
| 63 | // device_config overrides |
| 64 | virtual void device_config_complete(); |
| 65 | |
| 66 | // optional information overrides |
| 67 | virtual const rom_entry *device_rom_region() const; |
| 68 | |
| 69 | // device_config_memory_interface overrides |
| 70 | virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; |
| 71 | |
| 72 | // address space configurations |
| 73 | const address_space_config m_space_config; |
| 74 | }; |
| 75 | |
| 76 | |
| 77 | |
| 78 | // ======================> sed1330_device |
| 79 | |
| 80 | class sed1330_device : public device_t, |
| 81 | public device_memory_interface |
| 82 | { |
| 83 | friend class sed1330_device_config; |
| 84 | |
| 85 | // construction/destruction |
| 86 | sed1330_device(running_machine &_machine, const sed1330_device_config &_config); |
| 87 | |
| 88 | public: |
| 89 | DECLARE_READ8_MEMBER( status_r ); |
| 90 | DECLARE_WRITE8_MEMBER( command_w ); |
| 91 | |
| 92 | DECLARE_READ8_MEMBER( data_r ); |
| 93 | DECLARE_WRITE8_MEMBER( data_w ); |
| 94 | |
| 95 | void update_screen(bitmap_t *bitmap, const rectangle *cliprect); |
| 96 | |
| 97 | protected: |
| 98 | // device-level overrides |
| 99 | virtual void device_start(); |
| 100 | virtual void device_reset(); |
| 101 | |
| 102 | inline UINT8 readbyte(offs_t address); |
| 103 | inline void writebyte(offs_t address, UINT8 m_data); |
| 104 | inline void increment_csr(); |
| 105 | |
| 106 | void draw_text_scanline(bitmap_t *bitmap, const rectangle *cliprect, int y, UINT16 va); |
| 107 | void draw_graphics_scanline(bitmap_t *bitmap, const rectangle *cliprect, int y, UINT16 va); |
| 108 | void update_graphics(bitmap_t *bitmap, const rectangle *cliprect); |
| 109 | void update_text(bitmap_t *bitmap, const rectangle *cliprect); |
| 110 | |
| 111 | private: |
| 112 | int m_bf; // busy flag |
| 113 | |
| 114 | UINT8 m_ir; // instruction register |
| 115 | UINT8 m_dor; // data output register |
| 116 | int m_pbc; // parameter byte counter |
| 117 | |
| 118 | int m_d; // display enabled |
| 119 | int m_sleep; // sleep mode |
| 120 | |
| 121 | UINT16 m_sag; // character generator RAM start address |
| 122 | int m_m0; // character generator ROM (0=internal, 1=external) |
| 123 | int m_m1; // character generator RAM D6 correction (0=no, 1=yes) |
| 124 | int m_m2; // height of character bitmaps (0=8, 1=16 pixels) |
| 125 | int m_ws; // LCD drive method (0=single, 1=dual panel) |
| 126 | int m_iv; // screen origin compensation for inverse display (0=yes, 1=no) |
| 127 | int m_wf; // AC frame drive waveform period (0=16-line, 1=2-frame) |
| 128 | |
| 129 | int m_fx; // character width in pixels |
| 130 | int m_fy; // character height in pixels |
| 131 | int m_cr; // visible line width in characters |
| 132 | int m_tcr; // total line width in characters (including horizontal blanking) |
| 133 | int m_lf; // frame height in lines |
| 134 | UINT16 m_ap; // virtual screen line width in characters |
| 135 | |
| 136 | UINT16 m_sad1; // display page 1 start address |
| 137 | UINT16 m_sad2; // display page 2 start address |
| 138 | UINT16 m_sad3; // display page 3 start address |
| 139 | UINT16 m_sad4; // display page 4 start address |
| 140 | int m_sl1; // display block 1 height in lines |
| 141 | int m_sl2; // display block 2 height in lines |
| 142 | int m_hdotscr; // horizontal dot scroll in pixels |
| 143 | int m_fp; // display page flash control |
| 144 | |
| 145 | UINT16 m_csr; // cursor address register |
| 146 | int m_cd; // cursor increment direction |
| 147 | int m_crx; // cursor width |
| 148 | int m_cry; // cursor height or location |
| 149 | int m_cm; // cursor shape (0=underscore, 1=block) |
| 150 | int m_fc; // cursor flash control |
| 151 | |
| 152 | int m_mx; // screen layer composition method |
| 153 | int m_dm; // display mode for pages 1, 3 |
| 154 | int m_ov; // graphics mode layer composition |
| 155 | |
| 156 | // devices |
| 157 | screen_device *m_screen; |
| 158 | |
| 159 | const sed1330_device_config &m_config; |
| 160 | }; |
| 161 | |
| 162 | |
| 163 | // device type definition |
| 164 | extern const device_type SED1330; |
| 165 | |
| 166 | |
| 167 | |
| 168 | #endif |
src/mess/video/sed1330.c
| r11079 | r11080 | |
| 1 | | /********************************************************************** |
| 2 | | |
| 3 | | Seiko-Epson SED1330 LCD Controller emulation |
| 4 | | |
| 5 | | Copyright MESS Team. |
| 6 | | Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | | |
| 8 | | **********************************************************************/ |
| 9 | | |
| 10 | | /* |
| 11 | | |
| 12 | | TODO: |
| 13 | | |
| 14 | | - reset behavior |
| 15 | | - busy flag timing |
| 16 | | - cursor flashing |
| 17 | | - display page flashing |
| 18 | | - internal chargen ROM |
| 19 | | - horizontal dot scroll |
| 20 | | - XOR/AND/Priority-OR compositions |
| 21 | | - text mode character display |
| 22 | | - single panel text mode |
| 23 | | - single/dual panel graphics mode |
| 24 | | |
| 25 | | */ |
| 26 | | |
| 27 | | #include "emu.h" |
| 28 | | #include "sed1330.h" |
| 29 | | |
| 30 | | /*************************************************************************** |
| 31 | | PARAMETERS |
| 32 | | ***************************************************************************/ |
| 33 | | |
| 34 | | #define LOG 0 |
| 35 | | |
| 36 | | #define SED1330_INSTRUCTION_SYSTEM_SET 0x40 |
| 37 | | #define SED1330_INSTRUCTION_SLEEP_IN 0x53 /* unimplemented */ |
| 38 | | #define SED1330_INSTRUCTION_DISP_ON 0x59 |
| 39 | | #define SED1330_INSTRUCTION_DISP_OFF 0x58 |
| 40 | | #define SED1330_INSTRUCTION_SCROLL 0x44 |
| 41 | | #define SED1330_INSTRUCTION_CSRFORM 0x5d |
| 42 | | #define SED1330_INSTRUCTION_CGRAM_ADR 0x5c |
| 43 | | #define SED1330_INSTRUCTION_CSRDIR_RIGHT 0x4c |
| 44 | | #define SED1330_INSTRUCTION_CSRDIR_LEFT 0x4d |
| 45 | | #define SED1330_INSTRUCTION_CSRDIR_UP 0x4e |
| 46 | | #define SED1330_INSTRUCTION_CSRDIR_DOWN 0x4f |
| 47 | | #define SED1330_INSTRUCTION_HDOT_SCR 0x5a |
| 48 | | #define SED1330_INSTRUCTION_OVLAY 0x5b |
| 49 | | #define SED1330_INSTRUCTION_CSRW 0x46 |
| 50 | | #define SED1330_INSTRUCTION_CSRR 0x47 /* unimplemented */ |
| 51 | | #define SED1330_INSTRUCTION_MWRITE 0x42 |
| 52 | | #define SED1330_INSTRUCTION_MREAD 0x43 /* unimplemented */ |
| 53 | | |
| 54 | | #define SED1330_CSRDIR_RIGHT 0x00 |
| 55 | | #define SED1330_CSRDIR_LEFT 0x01 |
| 56 | | #define SED1330_CSRDIR_UP 0x02 |
| 57 | | #define SED1330_CSRDIR_DOWN 0x03 |
| 58 | | |
| 59 | | #define SED1330_MX_OR 0x00 |
| 60 | | #define SED1330_MX_XOR 0x01 /* unimplemented */ |
| 61 | | #define SED1330_MX_AND 0x02 /* unimplemented */ |
| 62 | | #define SED1330_MX_PRIORITY_OR 0x03 /* unimplemented */ |
| 63 | | |
| 64 | | #define SED1330_FC_OFF 0x00 |
| 65 | | #define SED1330_FC_SOLID 0x01 /* unimplemented */ |
| 66 | | #define SED1330_FC_FLASH_32 0x02 /* unimplemented */ |
| 67 | | #define SED1330_FC_FLASH_64 0x03 /* unimplemented */ |
| 68 | | |
| 69 | | /*************************************************************************** |
| 70 | | TYPE DEFINITIONS |
| 71 | | ***************************************************************************/ |
| 72 | | |
| 73 | | typedef struct _sed1330_t sed1330_t; |
| 74 | | struct _sed1330_t |
| 75 | | { |
| 76 | | devcb_resolved_read8 in_vd_func; |
| 77 | | devcb_resolved_write8 out_vd_func; |
| 78 | | |
| 79 | | int bf; /* busy flag */ |
| 80 | | |
| 81 | | UINT8 ir; /* instruction register */ |
| 82 | | UINT8 dor; /* data output register */ |
| 83 | | int pbc; /* parameter byte counter */ |
| 84 | | |
| 85 | | int d; /* display enabled */ |
| 86 | | int sleep; /* sleep mode */ |
| 87 | | |
| 88 | | UINT16 sag; /* character generator RAM start address */ |
| 89 | | int m0; /* character generator ROM (0=internal, 1=external) */ |
| 90 | | int m1; /* character generator RAM D6 correction (0=no, 1=yes) */ |
| 91 | | int m2; /* height of character bitmaps (0=8, 1=16 pixels) */ |
| 92 | | int ws; /* LCD drive method (0=single, 1=dual panel) */ |
| 93 | | int iv; /* screen origin compensation for inverse display (0=yes, 1=no) */ |
| 94 | | int wf; /* AC frame drive waveform period (0=16-line, 1=2-frame) */ |
| 95 | | |
| 96 | | int fx; /* character width in pixels */ |
| 97 | | int fy; /* character height in pixels */ |
| 98 | | int cr; /* visible line width in characters */ |
| 99 | | int tcr; /* total line width in characters (including horizontal blanking) */ |
| 100 | | int lf; /* frame height in lines */ |
| 101 | | UINT16 ap; /* virtual screen line width in characters */ |
| 102 | | |
| 103 | | UINT16 sad1; /* display page 1 start address */ |
| 104 | | UINT16 sad2; /* display page 2 start address */ |
| 105 | | UINT16 sad3; /* display page 3 start address */ |
| 106 | | UINT16 sad4; /* display page 4 start address */ |
| 107 | | int sl1; /* display block 1 height in lines */ |
| 108 | | int sl2; /* display block 2 height in lines */ |
| 109 | | int hdotscr; /* horizontal dot scroll in pixels */ |
| 110 | | int fp; /* display page flash control */ |
| 111 | | |
| 112 | | UINT16 csr; /* cursor address register */ |
| 113 | | int cd; /* cursor increment direction */ |
| 114 | | int crx; /* cursor width */ |
| 115 | | int cry; /* cursor height or location */ |
| 116 | | int cm; /* cursor shape (0=underscore, 1=block) */ |
| 117 | | int fc; /* cursor flash control */ |
| 118 | | |
| 119 | | int mx; /* screen layer composition method */ |
| 120 | | int dm; /* display mode for pages 1, 3 */ |
| 121 | | int ov; /* graphics mode layer composition */ |
| 122 | | |
| 123 | | /* devices */ |
| 124 | | screen_device *screen; |
| 125 | | }; |
| 126 | | |
| 127 | | /*************************************************************************** |
| 128 | | INLINE FUNCTIONS |
| 129 | | ***************************************************************************/ |
| 130 | | |
| 131 | | INLINE sed1330_t *get_safe_token(device_t *device) |
| 132 | | { |
| 133 | | assert(device != NULL); |
| 134 | | assert((device->type() == SED1330)); |
| 135 | | |
| 136 | | return (sed1330_t *)downcast<legacy_device_base *>(device)->token(); |
| 137 | | } |
| 138 | | |
| 139 | | INLINE const sed1330_interface *get_interface(device_t *device) |
| 140 | | { |
| 141 | | assert(device != NULL); |
| 142 | | assert((device->type() == SED1330)); |
| 143 | | |
| 144 | | return (const sed1330_interface *) device->baseconfig().static_config(); |
| 145 | | } |
| 146 | | |
| 147 | | INLINE void increment_csr(sed1330_t *sed1330) |
| 148 | | { |
| 149 | | switch (sed1330->cd) |
| 150 | | { |
| 151 | | case SED1330_CSRDIR_RIGHT: |
| 152 | | sed1330->csr++; |
| 153 | | break; |
| 154 | | |
| 155 | | case SED1330_CSRDIR_LEFT: |
| 156 | | sed1330->csr--; |
| 157 | | break; |
| 158 | | |
| 159 | | case SED1330_CSRDIR_UP: |
| 160 | | sed1330->csr -= sed1330->ap; |
| 161 | | break; |
| 162 | | |
| 163 | | case SED1330_CSRDIR_DOWN: |
| 164 | | sed1330->csr += sed1330->ap; |
| 165 | | break; |
| 166 | | } |
| 167 | | } |
| 168 | | |
| 169 | | /*************************************************************************** |
| 170 | | IMPLEMENTATION |
| 171 | | ***************************************************************************/ |
| 172 | | |
| 173 | | /*------------------------------------------------- |
| 174 | | sed1330_status_r - status read |
| 175 | | -------------------------------------------------*/ |
| 176 | | |
| 177 | | READ8_DEVICE_HANDLER( sed1330_status_r ) |
| 178 | | { |
| 179 | | sed1330_t *sed1330 = get_safe_token(device); |
| 180 | | |
| 181 | | if (LOG) logerror("SED1330 '%s' Status Read: %s\n", device->tag(), sed1330->bf ? "busy" : "ready"); |
| 182 | | |
| 183 | | return sed1330->bf << 6; |
| 184 | | } |
| 185 | | |
| 186 | | /*------------------------------------------------- |
| 187 | | sed1330_control_w - control write |
| 188 | | -------------------------------------------------*/ |
| 189 | | |
| 190 | | WRITE8_DEVICE_HANDLER( sed1330_command_w ) |
| 191 | | { |
| 192 | | sed1330_t *sed1330 = get_safe_token(device); |
| 193 | | |
| 194 | | sed1330->ir = data; |
| 195 | | sed1330->pbc = 0; |
| 196 | | |
| 197 | | switch (sed1330->ir) |
| 198 | | { |
| 199 | | #if 0 |
| 200 | | case SED1330_INSTRUCTION_SLEEP_IN: |
| 201 | | break; |
| 202 | | #endif |
| 203 | | case SED1330_INSTRUCTION_CSRDIR_RIGHT: |
| 204 | | case SED1330_INSTRUCTION_CSRDIR_LEFT: |
| 205 | | case SED1330_INSTRUCTION_CSRDIR_UP: |
| 206 | | case SED1330_INSTRUCTION_CSRDIR_DOWN: |
| 207 | | sed1330->cd = data & 0x03; |
| 208 | | |
| 209 | | if (LOG) |
| 210 | | { |
| 211 | | switch (sed1330->cd) |
| 212 | | { |
| 213 | | case SED1330_CSRDIR_RIGHT: logerror("SED1330 '%s' Cursor Direction: Right\n", device->tag()); break; |
| 214 | | case SED1330_CSRDIR_LEFT: logerror("SED1330 '%s' Cursor Direction: Left\n", device->tag()); break; |
| 215 | | case SED1330_CSRDIR_UP: logerror("SED1330 '%s' Cursor Direction: Up\n", device->tag()); break; |
| 216 | | case SED1330_CSRDIR_DOWN: logerror("SED1330 '%s' Cursor Direction: Down\n", device->tag()); break; |
| 217 | | } |
| 218 | | } |
| 219 | | break; |
| 220 | | } |
| 221 | | } |
| 222 | | |
| 223 | | /*------------------------------------------------- |
| 224 | | sed1330_data_r - data read |
| 225 | | -------------------------------------------------*/ |
| 226 | | |
| 227 | | READ8_DEVICE_HANDLER( sed1330_data_r ) |
| 228 | | { |
| 229 | | sed1330_t *sed1330 = get_safe_token(device); |
| 230 | | |
| 231 | | UINT8 data = devcb_call_read8(&sed1330->in_vd_func, sed1330->csr); |
| 232 | | |
| 233 | | if (LOG) logerror("SED1330 '%s' Memory Read %02x from %04x\n", device->tag(), data, sed1330->csr); |
| 234 | | |
| 235 | | increment_csr(sed1330); |
| 236 | | |
| 237 | | return data; |
| 238 | | } |
| 239 | | |
| 240 | | /*------------------------------------------------- |
| 241 | | sed1330_data_w - data write |
| 242 | | -------------------------------------------------*/ |
| 243 | | |
| 244 | | WRITE8_DEVICE_HANDLER( sed1330_data_w ) |
| 245 | | { |
| 246 | | sed1330_t *sed1330 = get_safe_token(device); |
| 247 | | |
| 248 | | switch (sed1330->ir) |
| 249 | | { |
| 250 | | case SED1330_INSTRUCTION_SYSTEM_SET: |
| 251 | | switch (sed1330->pbc) |
| 252 | | { |
| 253 | | case 0: |
| 254 | | sed1330->m0 = BIT(data, 0); |
| 255 | | sed1330->m1 = BIT(data, 1); |
| 256 | | sed1330->m2 = BIT(data, 2); |
| 257 | | sed1330->ws = BIT(data, 3); |
| 258 | | sed1330->iv = BIT(data, 5); |
| 259 | | |
| 260 | | if (LOG) |
| 261 | | { |
| 262 | | logerror("SED1330 '%s' %s CG ROM\n", device->tag(), BIT(data, 0) ? "External" : "Internal"); |
| 263 | | logerror("SED1330 '%s' D6 Correction: %s\n", device->tag(), BIT(data, 1) ? "enabled" : "disabled"); |
| 264 | | logerror("SED1330 '%s' Character Height: %u\n", device->tag(), BIT(data, 2) ? 16 : 8); |
| 265 | | logerror("SED1330 '%s' %s Panel Drive\n", device->tag(), BIT(data, 3) ? "Dual" : "Single"); |
| 266 | | logerror("SED1330 '%s' Screen Top-Line Correction: %s\n", device->tag(), BIT(data, 5) ? "disabled" : "enabled"); |
| 267 | | } |
| 268 | | break; |
| 269 | | |
| 270 | | case 1: |
| 271 | | sed1330->fx = (data & 0x07) + 1; |
| 272 | | sed1330->wf = BIT(data, 7); |
| 273 | | |
| 274 | | if (LOG) |
| 275 | | { |
| 276 | | logerror("SED1330 '%s' Horizontal Character Size: %u\n", device->tag(), sed1330->fx); |
| 277 | | logerror("SED1330 '%s' %s AC Drive\n", device->tag(), BIT(data, 7) ? "2-frame" : "16-line"); |
| 278 | | } |
| 279 | | break; |
| 280 | | |
| 281 | | case 2: |
| 282 | | sed1330->fy = (data & 0x0f) + 1; |
| 283 | | if (LOG) logerror("SED1330 '%s' Vertical Character Size: %u\n", device->tag(), sed1330->fy); |
| 284 | | break; |
| 285 | | |
| 286 | | case 3: |
| 287 | | sed1330->cr = data + 1; |
| 288 | | if (LOG) logerror("SED1330 '%s' Visible Characters Per Line: %u\n", device->tag(), sed1330->cr); |
| 289 | | break; |
| 290 | | |
| 291 | | case 4: |
| 292 | | sed1330->tcr = data + 1; |
| 293 | | if (LOG) logerror("SED1330 '%s' Total Characters Per Line: %u\n", device->tag(), sed1330->tcr); |
| 294 | | break; |
| 295 | | |
| 296 | | case 5: |
| 297 | | sed1330->lf = data + 1; |
| 298 | | if (LOG) logerror("SED1330 '%s' Frame Height: %u\n", device->tag(), sed1330->lf); |
| 299 | | break; |
| 300 | | |
| 301 | | case 6: |
| 302 | | sed1330->ap = (sed1330->ap & 0xff00) | data; |
| 303 | | break; |
| 304 | | |
| 305 | | case 7: |
| 306 | | sed1330->ap = (data << 8) | (sed1330->ap & 0xff); |
| 307 | | if (LOG) logerror("SED1330 '%s' Virtual Screen Width: %u\n", device->tag(), sed1330->ap); |
| 308 | | break; |
| 309 | | |
| 310 | | default: |
| 311 | | logerror("SED1330 '%s' Invalid parameter byte %02x\n", device->tag(), data); |
| 312 | | } |
| 313 | | break; |
| 314 | | |
| 315 | | case SED1330_INSTRUCTION_DISP_ON: |
| 316 | | case SED1330_INSTRUCTION_DISP_OFF: |
| 317 | | sed1330->d = BIT(data, 0); |
| 318 | | sed1330->fc = data & 0x03; |
| 319 | | sed1330->fp = data >> 2; |
| 320 | | if (LOG) |
| 321 | | { |
| 322 | | logerror("SED1330 '%s' Display: %s\n", device->tag(), BIT(data, 0) ? "enabled" : "disabled"); |
| 323 | | |
| 324 | | switch (sed1330->fc) |
| 325 | | { |
| 326 | | case SED1330_FC_OFF: logerror("SED1330 '%s' Cursor: disabled\n", device->tag()); break; |
| 327 | | case SED1330_FC_SOLID: logerror("SED1330 '%s' Cursor: solid\n", device->tag()); break; |
| 328 | | case SED1330_FC_FLASH_32: logerror("SED1330 '%s' Cursor: fFR/32\n", device->tag()); break; |
| 329 | | case SED1330_FC_FLASH_64: logerror("SED1330 '%s' Cursor: fFR/64\n", device->tag()); break; |
| 330 | | } |
| 331 | | |
| 332 | | switch (sed1330->fp & 0x03) |
| 333 | | { |
| 334 | | case SED1330_FC_OFF: logerror("SED1330 '%s' Display Page 1: disabled\n", device->tag()); break; |
| 335 | | case SED1330_FC_SOLID: logerror("SED1330 '%s' Display Page 1: enabled\n", device->tag()); break; |
| 336 | | case SED1330_FC_FLASH_32: logerror("SED1330 '%s' Display Page 1: flash fFR/32\n", device->tag()); break; |
| 337 | | case SED1330_FC_FLASH_64: logerror("SED1330 '%s' Display Page 1: flash fFR/64\n", device->tag()); break; |
| 338 | | } |
| 339 | | |
| 340 | | switch ((sed1330->fp >> 2) & 0x03) |
| 341 | | { |
| 342 | | case SED1330_FC_OFF: logerror("SED1330 '%s' Display Page 2/4: disabled\n", device->tag()); break; |
| 343 | | case SED1330_FC_SOLID: logerror("SED1330 '%s' Display Page 2/4: enabled\n", device->tag()); break; |
| 344 | | case SED1330_FC_FLASH_32: logerror("SED1330 '%s' Display Page 2/4: flash fFR/32\n", device->tag()); break; |
| 345 | | case SED1330_FC_FLASH_64: logerror("SED1330 '%s' Display Page 2/4: flash fFR/64\n", device->tag()); break; |
| 346 | | } |
| 347 | | |
| 348 | | switch ((sed1330->fp >> 4) & 0x03) |
| 349 | | { |
| 350 | | case SED1330_FC_OFF: logerror("SED1330 '%s' Display Page 3: disabled\n", device->tag()); break; |
| 351 | | case SED1330_FC_SOLID: logerror("SED1330 '%s' Display Page 3: enabled\n", device->tag()); break; |
| 352 | | case SED1330_FC_FLASH_32: logerror("SED1330 '%s' Display Page 3: flash fFR/32\n", device->tag()); break; |
| 353 | | case SED1330_FC_FLASH_64: logerror("SED1330 '%s' Display Page 3: flash fFR/64\n", device->tag()); break; |
| 354 | | } |
| 355 | | } |
| 356 | | break; |
| 357 | | |
| 358 | | case SED1330_INSTRUCTION_SCROLL: |
| 359 | | switch (sed1330->pbc) |
| 360 | | { |
| 361 | | case 0: |
| 362 | | sed1330->sad1 = (sed1330->sad1 & 0xff00) | data; |
| 363 | | break; |
| 364 | | |
| 365 | | case 1: |
| 366 | | sed1330->sad1 = (data << 8) | (sed1330->sad1 & 0xff); |
| 367 | | if (LOG) logerror("SED1330 '%s' Display Page 1 Start Address: %04x\n", device->tag(), sed1330->sad1); |
| 368 | | break; |
| 369 | | |
| 370 | | case 2: |
| 371 | | sed1330->sl1 = data + 1; |
| 372 | | if (LOG) logerror("SED1330 '%s' Display Block 1 Screen Lines: %u\n", device->tag(), sed1330->sl1); |
| 373 | | break; |
| 374 | | |
| 375 | | case 3: |
| 376 | | sed1330->sad2 = (sed1330->sad2 & 0xff00) | data; |
| 377 | | break; |
| 378 | | |
| 379 | | case 4: |
| 380 | | sed1330->sad2 = (data << 8) | (sed1330->sad2 & 0xff); |
| 381 | | if (LOG) logerror("SED1330 '%s' Display Page 2 Start Address: %04x\n", device->tag(), sed1330->sad2); |
| 382 | | break; |
| 383 | | |
| 384 | | case 5: |
| 385 | | sed1330->sl2 = data + 1; |
| 386 | | if (LOG) logerror("SED1330 '%s' Display Block 2 Screen Lines: %u\n", device->tag(), sed1330->sl2); |
| 387 | | break; |
| 388 | | |
| 389 | | case 6: |
| 390 | | sed1330->sad3 = (sed1330->sad3 & 0xff00) | data; |
| 391 | | break; |
| 392 | | |
| 393 | | case 7: |
| 394 | | sed1330->sad3 = (data << 8) | (sed1330->sad3 & 0xff); |
| 395 | | if (LOG) logerror("SED1330 '%s' Display Page 3 Start Address: %04x\n", device->tag(), sed1330->sad3); |
| 396 | | break; |
| 397 | | |
| 398 | | case 8: |
| 399 | | sed1330->sad4 = (sed1330->sad4 & 0xff00) | data; |
| 400 | | break; |
| 401 | | |
| 402 | | case 9: |
| 403 | | sed1330->sad4 = (data << 8) | (sed1330->sad4 & 0xff); |
| 404 | | if (LOG) logerror("SED1330 '%s' Display Page 4 Start Address: %04x\n", device->tag(), sed1330->sad4); |
| 405 | | break; |
| 406 | | |
| 407 | | default: |
| 408 | | logerror("SED1330 '%s' Invalid parameter byte %02x\n", device->tag(), data); |
| 409 | | } |
| 410 | | break; |
| 411 | | |
| 412 | | case SED1330_INSTRUCTION_CSRFORM: |
| 413 | | switch (sed1330->pbc) |
| 414 | | { |
| 415 | | case 0: |
| 416 | | sed1330->crx = (data & 0x0f) + 1; |
| 417 | | if (LOG) logerror("SED1330 '%s' Horizontal Cursor Size: %u\n", device->tag(), sed1330->crx); |
| 418 | | break; |
| 419 | | |
| 420 | | case 1: |
| 421 | | sed1330->cry = (data & 0x0f) + 1; |
| 422 | | sed1330->cm = BIT(data, 7); |
| 423 | | if (LOG) |
| 424 | | { |
| 425 | | logerror("SED1330 '%s' Vertical Cursor Location: %u\n", device->tag(), sed1330->cry); |
| 426 | | logerror("SED1330 '%s' Cursor Shape: %s\n", device->tag(), BIT(data, 7) ? "Block" : "Underscore"); |
| 427 | | } |
| 428 | | break; |
| 429 | | |
| 430 | | default: |
| 431 | | logerror("SED1330 '%s' Invalid parameter byte %02x\n", device->tag(), data); |
| 432 | | } |
| 433 | | break; |
| 434 | | |
| 435 | | case SED1330_INSTRUCTION_CGRAM_ADR: |
| 436 | | switch (sed1330->pbc) |
| 437 | | { |
| 438 | | case 0: |
| 439 | | sed1330->sag = (sed1330->sag & 0xff00) | data; |
| 440 | | break; |
| 441 | | |
| 442 | | case 1: |
| 443 | | sed1330->sag = (data << 8) | (sed1330->sag & 0xff); |
| 444 | | if (LOG) logerror("SED1330 '%s' Character Generator RAM Start Address: %04x\n", device->tag(), sed1330->sag); |
| 445 | | break; |
| 446 | | |
| 447 | | default: |
| 448 | | logerror("SED1330 '%s' Invalid parameter byte %02x\n", device->tag(), data); |
| 449 | | } |
| 450 | | break; |
| 451 | | |
| 452 | | case SED1330_INSTRUCTION_HDOT_SCR: |
| 453 | | sed1330->hdotscr = data & 0x07; |
| 454 | | if (LOG) logerror("SED1330 '%s' Horizontal Dot Scroll: %u\n", device->tag(), sed1330->hdotscr); |
| 455 | | break; |
| 456 | | |
| 457 | | case SED1330_INSTRUCTION_OVLAY: |
| 458 | | sed1330->mx = data & 0x03; |
| 459 | | sed1330->dm = (data >> 2) & 0x03; |
| 460 | | sed1330->ov = BIT(data, 4); |
| 461 | | |
| 462 | | if (LOG) |
| 463 | | { |
| 464 | | switch (sed1330->mx) |
| 465 | | { |
| 466 | | case SED1330_MX_OR: logerror("SED1330 '%s' Display Composition Method: OR\n", device->tag()); break; |
| 467 | | case SED1330_MX_XOR: logerror("SED1330 '%s' Display Composition Method: Exclusive-OR\n", device->tag()); break; |
| 468 | | case SED1330_MX_AND: logerror("SED1330 '%s' Display Composition Method: AND\n", device->tag()); break; |
| 469 | | case SED1330_MX_PRIORITY_OR: logerror("SED1330 '%s' Display Composition Method: Priority-OR\n", device->tag()); break; |
| 470 | | } |
| 471 | | |
| 472 | | logerror("SED1330 '%s' Display Page 1 Mode: %s\n", device->tag(), BIT(data, 2) ? "Graphics" : "Text"); |
| 473 | | logerror("SED1330 '%s' Display Page 3 Mode: %s\n", device->tag(), BIT(data, 3) ? "Graphics" : "Text"); |
| 474 | | logerror("SED1330 '%s' Display Composition Layers: %u\n", device->tag(), BIT(data, 4) ? 3 : 2); |
| 475 | | } |
| 476 | | break; |
| 477 | | |
| 478 | | case SED1330_INSTRUCTION_CSRW: |
| 479 | | switch (sed1330->pbc) |
| 480 | | { |
| 481 | | case 0: |
| 482 | | sed1330->csr = (sed1330->csr & 0xff00) | data; |
| 483 | | break; |
| 484 | | |
| 485 | | case 1: |
| 486 | | sed1330->csr = (data << 8) | (sed1330->csr & 0xff); |
| 487 | | if (LOG) logerror("SED1330 '%s' Cursor Address %04x\n", device->tag(), sed1330->csr); |
| 488 | | break; |
| 489 | | |
| 490 | | default: |
| 491 | | logerror("SED1330 '%s' Invalid parameter byte %02x\n", device->tag(), data); |
| 492 | | } |
| 493 | | break; |
| 494 | | #if 0 |
| 495 | | case SED1330_INSTRUCTION_CSRR: |
| 496 | | break; |
| 497 | | #endif |
| 498 | | case SED1330_INSTRUCTION_MWRITE: |
| 499 | | if (LOG) logerror("SED1330 '%s' Memory Write %02x to %04x (row %u col %u line %u)\n", device->tag(), data, sed1330->csr, sed1330->csr/80/8, sed1330->csr%80, sed1330->csr/80); |
| 500 | | |
| 501 | | devcb_call_write8(&sed1330->out_vd_func, sed1330->csr, data); |
| 502 | | |
| 503 | | increment_csr(sed1330); |
| 504 | | break; |
| 505 | | #if 0 |
| 506 | | case SED1330_INSTRUCTION_MREAD: |
| 507 | | break; |
| 508 | | #endif |
| 509 | | default: |
| 510 | | logerror("SED1330 '%s' Unsupported instruction %02x\n", device->tag(), sed1330->ir); |
| 511 | | } |
| 512 | | |
| 513 | | sed1330->pbc++; |
| 514 | | } |
| 515 | | |
| 516 | | /*------------------------------------------------- |
| 517 | | draw_text_scanline - draw one scanline |
| 518 | | (currently this only draws the text cursor) |
| 519 | | -------------------------------------------------*/ |
| 520 | | |
| 521 | | static void draw_text_scanline(sed1330_t *sed1330, bitmap_t *bitmap, const rectangle *cliprect, int y, UINT16 va) |
| 522 | | { |
| 523 | | int sx, x; |
| 524 | | |
| 525 | | for (sx = 0; sx < sed1330->cr; sx++) |
| 526 | | { |
| 527 | | if ((va + sx) == sed1330->csr) |
| 528 | | { |
| 529 | | if (sed1330->fc == SED1330_FC_OFF) continue; |
| 530 | | |
| 531 | | if (sed1330->cm) |
| 532 | | { |
| 533 | | /* block cursor */ |
| 534 | | if (y % sed1330->fy < sed1330->cry) |
| 535 | | { |
| 536 | | for (x = 0; x < sed1330->crx; x++) |
| 537 | | { |
| 538 | | *BITMAP_ADDR16(bitmap, y, (sx * sed1330->fx) + x) = 1; |
| 539 | | } |
| 540 | | } |
| 541 | | } |
| 542 | | else |
| 543 | | { |
| 544 | | /* underscore cursor */ |
| 545 | | if (y % sed1330->fy == sed1330->cry) |
| 546 | | { |
| 547 | | for (x = 0; x < sed1330->crx; x++) |
| 548 | | { |
| 549 | | *BITMAP_ADDR16(bitmap, y, (sx * sed1330->fx) + x) = 1; |
| 550 | | } |
| 551 | | } |
| 552 | | } |
| 553 | | } |
| 554 | | } |
| 555 | | } |
| 556 | | |
| 557 | | /*------------------------------------------------- |
| 558 | | draw_graphics_scanline - draw one scanline |
| 559 | | -------------------------------------------------*/ |
| 560 | | |
| 561 | | static void draw_graphics_scanline(sed1330_t *sed1330, bitmap_t *bitmap, const rectangle *cliprect, int y, UINT16 va) |
| 562 | | { |
| 563 | | int sx, x; |
| 564 | | |
| 565 | | for (sx = 0; sx < sed1330->cr; sx++) |
| 566 | | { |
| 567 | | UINT8 data = devcb_call_read8(&sed1330->in_vd_func, va++); |
| 568 | | |
| 569 | | for (x = 0; x < sed1330->fx; x++) |
| 570 | | { |
| 571 | | *BITMAP_ADDR16(bitmap, y, (sx * sed1330->fx) + x) = BIT(data, 7); |
| 572 | | data <<= 1; |
| 573 | | } |
| 574 | | } |
| 575 | | } |
| 576 | | |
| 577 | | /*------------------------------------------------- |
| 578 | | update_graphics - draw graphics mode screen |
| 579 | | -------------------------------------------------*/ |
| 580 | | |
| 581 | | static void update_graphics(sed1330_t *sed1330, bitmap_t *bitmap, const rectangle *cliprect) |
| 582 | | { |
| 583 | | } |
| 584 | | |
| 585 | | /*------------------------------------------------- |
| 586 | | update_text - draw text mode screen |
| 587 | | -------------------------------------------------*/ |
| 588 | | |
| 589 | | static void update_text(sed1330_t *sed1330, bitmap_t *bitmap, const rectangle *cliprect) |
| 590 | | { |
| 591 | | int y; |
| 592 | | |
| 593 | | if (sed1330->ws) |
| 594 | | { |
| 595 | | for (y = 0; y < sed1330->sl1; y++) |
| 596 | | { |
| 597 | | UINT16 sad1 = sed1330->sad1 + ((y / sed1330->fy) * sed1330->ap); |
| 598 | | UINT16 sad2 = sed1330->sad2 + (y * sed1330->ap); |
| 599 | | UINT16 sad3 = sed1330->sad3 + ((y / sed1330->fy) * sed1330->ap); |
| 600 | | UINT16 sad4 = sed1330->sad4 + (y * sed1330->ap); |
| 601 | | |
| 602 | | /* draw graphics display page 2 scanline */ |
| 603 | | draw_graphics_scanline(sed1330, bitmap, cliprect, y, sad2); |
| 604 | | |
| 605 | | /* draw text display page 1 scanline */ |
| 606 | | draw_text_scanline(sed1330, bitmap, cliprect, y, sad1); |
| 607 | | |
| 608 | | /* draw graphics display page 4 scanline */ |
| 609 | | draw_graphics_scanline(sed1330, bitmap, cliprect, y + sed1330->sl1, sad4); |
| 610 | | |
| 611 | | /* draw text display page 3 scanline */ |
| 612 | | draw_text_scanline(sed1330, bitmap, cliprect, y + sed1330->sl1, sad3); |
| 613 | | } |
| 614 | | } |
| 615 | | } |
| 616 | | |
| 617 | | /*------------------------------------------------- |
| 618 | | sed1330_update - update screen |
| 619 | | -------------------------------------------------*/ |
| 620 | | |
| 621 | | void sed1330_update(device_t *device, bitmap_t *bitmap, const rectangle *cliprect) |
| 622 | | { |
| 623 | | sed1330_t *sed1330 = get_safe_token(device); |
| 624 | | |
| 625 | | if (sed1330->d) |
| 626 | | { |
| 627 | | if (sed1330->dm) |
| 628 | | { |
| 629 | | update_graphics(sed1330, bitmap, cliprect); |
| 630 | | } |
| 631 | | else |
| 632 | | { |
| 633 | | update_text(sed1330, bitmap, cliprect); |
| 634 | | } |
| 635 | | } |
| 636 | | } |
| 637 | | |
| 638 | | /*------------------------------------------------- |
| 639 | | DEVICE_START( sed1330 ) |
| 640 | | -------------------------------------------------*/ |
| 641 | | |
| 642 | | static DEVICE_START( sed1330 ) |
| 643 | | { |
| 644 | | sed1330_t *sed1330 = get_safe_token(device); |
| 645 | | const sed1330_interface *intf = get_interface(device); |
| 646 | | |
| 647 | | /* resolve callbacks */ |
| 648 | | devcb_resolve_read8(&sed1330->in_vd_func, &intf->in_vd_func, device); |
| 649 | | devcb_resolve_write8(&sed1330->out_vd_func, &intf->out_vd_func, device); |
| 650 | | |
| 651 | | /* get the screen device */ |
| 652 | | sed1330->screen = device->machine().device<screen_device>(intf->screen_tag); |
| 653 | | assert(sed1330->screen != NULL); |
| 654 | | |
| 655 | | /* register for state saving */ |
| 656 | | device->save_item(NAME(sed1330->bf)); |
| 657 | | device->save_item(NAME(sed1330->ir)); |
| 658 | | device->save_item(NAME(sed1330->dor)); |
| 659 | | device->save_item(NAME(sed1330->pbc)); |
| 660 | | device->save_item(NAME(sed1330->d)); |
| 661 | | device->save_item(NAME(sed1330->sleep)); |
| 662 | | device->save_item(NAME(sed1330->sag)); |
| 663 | | device->save_item(NAME(sed1330->m0)); |
| 664 | | device->save_item(NAME(sed1330->m1)); |
| 665 | | device->save_item(NAME(sed1330->m2)); |
| 666 | | device->save_item(NAME(sed1330->ws)); |
| 667 | | device->save_item(NAME(sed1330->iv)); |
| 668 | | device->save_item(NAME(sed1330->wf)); |
| 669 | | device->save_item(NAME(sed1330->fx)); |
| 670 | | device->save_item(NAME(sed1330->fy)); |
| 671 | | device->save_item(NAME(sed1330->cr)); |
| 672 | | device->save_item(NAME(sed1330->tcr)); |
| 673 | | device->save_item(NAME(sed1330->lf)); |
| 674 | | device->save_item(NAME(sed1330->ap)); |
| 675 | | device->save_item(NAME(sed1330->sad1)); |
| 676 | | device->save_item(NAME(sed1330->sad2)); |
| 677 | | device->save_item(NAME(sed1330->sad3)); |
| 678 | | device->save_item(NAME(sed1330->sad4)); |
| 679 | | device->save_item(NAME(sed1330->sl1)); |
| 680 | | device->save_item(NAME(sed1330->sl2)); |
| 681 | | device->save_item(NAME(sed1330->hdotscr)); |
| 682 | | device->save_item(NAME(sed1330->csr)); |
| 683 | | device->save_item(NAME(sed1330->cd)); |
| 684 | | device->save_item(NAME(sed1330->crx)); |
| 685 | | device->save_item(NAME(sed1330->cry)); |
| 686 | | device->save_item(NAME(sed1330->cm)); |
| 687 | | device->save_item(NAME(sed1330->fc)); |
| 688 | | device->save_item(NAME(sed1330->fp)); |
| 689 | | device->save_item(NAME(sed1330->mx)); |
| 690 | | device->save_item(NAME(sed1330->dm)); |
| 691 | | device->save_item(NAME(sed1330->ov)); |
| 692 | | } |
| 693 | | |
| 694 | | /*------------------------------------------------- |
| 695 | | DEVICE_RESET( sed1330 ) |
| 696 | | -------------------------------------------------*/ |
| 697 | | |
| 698 | | static DEVICE_RESET( sed1330 ) |
| 699 | | { |
| 700 | | // sed1330_t *sed1330 = get_safe_token(device); |
| 701 | | |
| 702 | | } |
| 703 | | |
| 704 | | /*------------------------------------------------- |
| 705 | | DEVICE_GET_INFO( sed1330 ) |
| 706 | | -------------------------------------------------*/ |
| 707 | | |
| 708 | | DEVICE_GET_INFO( sed1330 ) |
| 709 | | { |
| 710 | | switch (state) |
| 711 | | { |
| 712 | | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 713 | | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(sed1330_t); break; |
| 714 | | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 715 | | |
| 716 | | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 717 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(sed1330); break; |
| 718 | | case DEVINFO_FCT_STOP: /* Nothing */ break; |
| 719 | | case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(sed1330); break; |
| 720 | | |
| 721 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 722 | | case DEVINFO_STR_NAME: strcpy(info->s, "Seiko-Epson SED1330"); break; |
| 723 | | case DEVINFO_STR_FAMILY: strcpy(info->s, "Seiko-Epson SED1330"); break; |
| 724 | | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 725 | | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 726 | | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright MESS Team"); break; |
| 727 | | } |
| 728 | | } |
| 729 | | |
| 730 | | DEFINE_LEGACY_DEVICE(SED1330, sed1330); |