Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

committed

View gist:5232006
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475
[PATCH] ie15: new driver: 15IE-00-013 serial terminal
 
 
diff --git a/src/emu/cpu/cpu.mak b/src/emu/cpu/cpu.mak
index 2b6715d..78d29be 100644
--- a/src/emu/cpu/cpu.mak
+++ b/src/emu/cpu/cpu.mak
@@ -613,6 +613,17 @@ $(CPUOBJ)/e132xs/e132xs.o: $(CPUSRC)/e132xs/e132xs.c \
#-------------------------------------------------
+# 15IE-00-013 CPU ("Microprogrammed Control Device")
+#-------------------------------------------------
+
+ifneq ($(filter IE15,$(CPUS)),)
+OBJDIRS += $(CPUOBJ)/ie15
+CPUOBJS += $(CPUOBJ)/ie15/ie15.o
+DASMOBJS += $(CPUOBJ)/ie15/ie15dasm.o
+endif
+
+
+#-------------------------------------------------
# Intel 4004
#-------------------------------------------------
@@ -2095,4 +2106,11 @@ endif
$(CPUOBJ)/scudsp/scudspdasm.o: CPUOBJS += $(CPUOBJ)/scudsp/scudspdasm.c
+#-------------------------------------------------
+# Electronika 15IE-00-013
+#-------------------------------------------------
+ifneq ($(filter IE15,$(CPUS)),)
+OBJDIRS += $(CPUOBJ)/ie15
+DASMOBJS += $(CPUOBJ)/ie15/ie15dasm.o
+endif
diff --git a/src/emu/cpu/ie15/ie15.c b/src/emu/cpu/ie15/ie15.c
new file mode 100644
index 0000000..e7aa9db
--- /dev/null
+++ b/src/emu/cpu/ie15/ie15.c
@@ -0,0 +1,467 @@
+#include "emu.h"
+#include "debugger.h"
+#include "ie15.h"
+
+//**************************************************************************
+// MACROS
+//**************************************************************************
+
+#define SKIP_OP(x) do { \
+ x = rop() & 0xf0; \
+ if (x == 0x10 || x == 0x20 || x == 0x30) \
+ m_PC.w.l = m_PC.w.l + 1; \
+ } while(0)
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+// device type definition
+const device_type IE15 = &device_creator<ie15_device>;
+
+//**************************************************************************
+// DEVICE INTERFACE
+//**************************************************************************
+
+//-------------------------------------------------
+// ie15_device - constructor
+//-------------------------------------------------
+ie15_device::ie15_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : cpu_device(mconfig, IE15, "ie15", tag, owner, clock),
+ m_program_config("program", ENDIANNESS_LITTLE, 8, 14),
+ m_io_config("io", ENDIANNESS_LITTLE, 8, 8),
+ m_program(0),
+ m_direct(0)
+{
+ // set our instruction counter
+ m_icountptr = &m_icount;
+};
+
+//-------------------------------------------------
+// device_start - start up the device
+//-------------------------------------------------
+
+void ie15_device::device_start()
+{
+ // find address spaces
+ m_program = &space(AS_PROGRAM);
+ m_direct = &m_program->direct();
+ m_io = &space(AS_IO);
+
+ // save state
+ save_item(NAME(m_PC));
+ save_item(NAME(m_A));
+ save_item(NAME(m_CF));
+ save_item(NAME(m_ZF));
+ save_item(NAME(m_RF));
+ // XXX save registers
+
+ // register our state for the debugger
+ state_add(IE15_PC, "PC", m_PC.w.l).mask(0x0fff);
+ state_add(STATE_GENPC, "GENPC", m_PC.w.l).mask(0x0fff).noshow();
+ state_add(STATE_GENFLAGS,"GENFLAGS", m_flags).mask(0x0f).callimport().callexport().noshow().formatstr("%4s");
+ state_add(IE15_A, "A", m_A);
+
+ astring tempstring;
+ for (int ireg = 0; ireg < 32; ireg++)
+ state_add(IE15_R0 + ireg, tempstring.format("R%d", ireg), m_REGS[ireg]);
+}
+
+//-------------------------------------------------
+// device_reset - reset the device
+//-------------------------------------------------
+
+void ie15_device::device_reset()
+{
+ m_CF = m_ZF = m_RF = 0;
+ m_A = 0;
+ m_PC.d = 0;
+ memset(m_REGS,0,sizeof(m_REGS));
+}
+
+//-------------------------------------------------
+// memory_space_config - return the configuration
+// of the specified address space, or NULL if
+// the space doesn't exist
+//-------------------------------------------------
+
+const address_space_config *ie15_device::memory_space_config(address_spacenum spacenum) const
+{
+ return (spacenum == AS_PROGRAM) ? &m_program_config :
+ (spacenum == AS_IO) ? &m_io_config :
+ NULL;
+}
+
+//-------------------------------------------------
+// state_import - import state into the device,
+// after it has been set
+//-------------------------------------------------
+
+void ie15_device::state_import(const device_state_entry &entry)
+{
+ switch (entry.index())
+ {
+ case STATE_GENFLAGS:
+ m_CF = (m_flags >> 3) & 1;
+ m_ZF = (m_flags >> 2) & 1;
+ m_RF = (m_flags >> 1) & 1;
+ break;
+ }
+}
+
+//-------------------------------------------------
+// state_export - export state from the device,
+// to a known location where it can be read
+//-------------------------------------------------
+
+void ie15_device::state_export(const device_state_entry &entry)
+{
+ switch (entry.index())
+ {
+ case STATE_GENFLAGS:
+ m_flags = (m_CF ? 0x08 : 0x00) |
+ (m_ZF ? 0x04 : 0x00) |
+ (m_RF ? 0x02 : 0x00);
+ break;
+ }
+}
+
+//-------------------------------------------------
+// state_string_export - export state as a string
+// for the debugger
+//-------------------------------------------------
+
+void ie15_device::state_string_export(const device_state_entry &entry, astring &string)
+{
+ switch (entry.index())
+ {
+ case STATE_GENFLAGS:
+ string.printf("%c%c%c",
+ m_CF ? 'C':'.',
+ m_ZF ? 'Z':'.',
+ m_RF ? 'R':'.');
+ break;
+ }
+}
+
+//-------------------------------------------------
+// disasm_min_opcode_bytes - return the length
+// of the shortest instruction, in bytes
+//-------------------------------------------------
+
+UINT32 ie15_device::disasm_min_opcode_bytes() const
+{
+ return 1;
+}
+
+//-------------------------------------------------
+// disasm_max_opcode_bytes - return the length
+// of the longest instruction, in bytes
+//-------------------------------------------------
+
+UINT32 ie15_device::disasm_max_opcode_bytes() const
+{
+ return 2;
+}
+
+//-------------------------------------------------
+// disasm_disassemble - call the disassembly
+// helper function
+//-------------------------------------------------
+
+offs_t ie15_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options)
+{
+ extern CPU_DISASSEMBLE( ie15 );
+ return CPU_DISASSEMBLE_NAME(ie15)(NULL, buffer, pc, oprom, opram, 0);
+}
+
+//**************************************************************************
+// EXECUTION
+//**************************************************************************
+
+//-------------------------------------------------
+// execute_min_cycles - return minimum number of
+// cycles it takes for one instruction to execute
+//-------------------------------------------------
+
+UINT32 ie15_device::execute_min_cycles() const
+{
+ return 1;
+}
+
+//-------------------------------------------------
+// execute_max_cycles - return maximum number of
+// cycles it takes for one instruction to execute
+//-------------------------------------------------
+
+UINT32 ie15_device::execute_max_cycles() const
+{
+ return 1;
+}
+
+//-------------------------------------------------
+// execute_run - execute until our icount expires
+//-------------------------------------------------
+
+void ie15_device::execute_run()
+{
+ do
+ {
+ debugger_instruction_hook(this, m_PC.d);
+ execute_one(rop());
+ } while (m_icount > 0);
+}
+
+inline void ie15_device::illegal(UINT8 opcode)
+{
+ if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
+ {
+ logerror("IE15 illegal instruction %04X $%02X\n", m_PC.w.l, opcode);
+ }
+}
+
+// XXX verify that m_ZF and m_CF are set and handled right
+// XXX 'ota' apparently writes the ALU buffer register, not accumulator
+// XXX what if ldc was at 0x_ff?
+inline void ie15_device::execute_one(int opcode)
+{
+ UINT16 tmp;
+
+ m_icount -= 1;
+
+ switch (opcode & 0xf0)
+ {
+ case 0x00: // add
+ tmp = m_A + get_reg_lo(opcode & 15);
+ m_A = tmp & 255;
+ update_flags(m_A);
+ m_CF = BIT(tmp, 8);
+ break;
+ case 0x10: // jmp
+ m_PC.w.l = get_addr(opcode);
+// m_CF = 0;
+ break;
+ case 0x20: // ldc
+ set_reg(opcode & 15, arg() | (m_PC.w.l & 0xf00));
+ m_PC.w.l = m_PC.w.l + 1;
+// m_CF = 0;
+ break;
+ case 0x40: // dsr
+ tmp = get_reg_lo(opcode & 15) - 1;
+// m_CF = BIT(tmp, 8);
+ tmp &= 255;
+ set_reg(opcode & 15, tmp);
+ update_flags(tmp);
+ if (m_ZF) {
+ SKIP_OP(tmp);
+ }
+ break;
+ case 0x30:
+ switch (opcode)
+ {
+ case 0x30: // lca
+ m_A = arg();
+ update_flags(m_A);
+ m_PC.w.l = m_PC.w.l + 1;
+ break;
+ case 0x33: // ral
+ tmp = m_A;
+ m_A = (m_A << 1) | BIT(tmp,7);
+ update_flags(m_A);
+ break;
+ case 0x35: // rar
+ tmp = m_A;
+ m_A = (m_A >> 1) | (BIT(tmp,0) ? 0x80 : 0x00);
+ update_flags(m_A);
+ break;
+ default:
+ illegal(opcode);
+ break;
+ };
+ break;
+ case 0x50:
+ switch (opcode)
+ {
+ case 0x51: // inc
+ case 0x50: // isn
+ case 0x58: // ise
+ tmp = m_A + 1;
+ m_A = tmp & 255;
+ update_flags(m_A);
+ m_CF = BIT(tmp, 8);
+ if (opcode == 0x50 && m_ZF)
+ SKIP_OP(tmp);
+ if (opcode == 0x58 && !m_ZF)
+ SKIP_OP(tmp);
+ break;
+ case 0x5b: // dec
+ case 0x52: // dsn
+ case 0x5a: // dse
+ tmp = m_A - 1;
+ m_A = tmp & 255;
+ update_flags(m_A);
+ m_CF = BIT(tmp, 8);
+ if (opcode == 0x52 && m_ZF)
+ SKIP_OP(tmp);
+ if (opcode == 0x5a && !m_ZF)
+ SKIP_OP(tmp);
+ break;
+ case 0x5d: // com
+ m_A ^= 255;
+ update_flags(m_A);
+ break;
+ case 0x5f: // clr
+ m_A = 0;
+ update_flags(m_A);
+ break;
+ default:
+ illegal(opcode);
+ break;
+ };
+ break;
+ case 0x70: // jmi
+// m_CF = 0;
+ m_PC.w.l = get_reg(opcode & 15);
+ break;
+ case 0x60: // lla
+ // special case -- port 7
+ if (opcode == 0x67)
+ m_A = 255;
+ else
+ m_A = m_io->read_byte(opcode & 15);
+ update_flags(m_A);
+ break;
+ case 0xf0: // ota
+ // special case -- ports 016, 017
+ if (opcode == 0xfe)
+ m_RF = 1;
+ else if (opcode == 0xff)
+ m_RF = 0;
+ else
+ m_io->write_byte(opcode & 15, m_A);
+// m_CF = 0;
+ break;
+ case 0xc0: // cfl, sfl
+ switch (opcode)
+ {
+ // special case -- accessing control flag 05 resets CF
+ case 0xc5:
+ case 0xcd:
+ m_CF = 0;
+ break;
+ default:
+ m_io->write_byte(020 | (opcode & 7), BIT(opcode, 3));
+ break;
+ }
+ break;
+ case 0x80: // sfc, skp, sfs, nop
+ tmp = opcode & 7;
+ switch (tmp)
+ {
+ case 5:
+ tmp = BIT(m_A, 7);
+ break;
+ case 6:
+ tmp = m_CF;
+ break;
+ case 7:
+ tmp = 0;
+ break;
+ default:
+ tmp = m_io->read_byte(020 | tmp);
+ break;
+
+ }
+ if (!BIT(opcode, 3) && !tmp)
+ SKIP_OP(tmp);
+ if (BIT(opcode, 3) && tmp)
+ SKIP_OP(tmp);
+ break;
+ case 0xb0: // cs
+// m_CF = 0;
+ if (m_A == get_reg_lo(opcode & 15)) {
+ m_ZF = 1;
+ SKIP_OP(tmp);
+ }
+ break;
+ case 0x90: // and
+ m_A &= get_reg_lo(opcode & 15);
+ update_flags(m_A);
+ break;
+ case 0xa0: // xor
+ m_A ^= get_reg_lo(opcode & 15);
+ update_flags(m_A);
+ break;
+ case 0xd0: // lda
+ m_A = get_reg_lo(opcode & 15);
+ update_flags(m_A);
+ break;
+ case 0xe0: // sta
+ set_reg(opcode & 15, m_A | (m_PC.w.l & 0xf00));
+// m_CF = 0;
+ break;
+ default:
+ illegal(opcode);
+ break;
+ }
+}
+
+/***************************************************************************
+ INLINE FUNCTIONS
+***************************************************************************/
+
+inline UINT8 ie15_device::rop()
+{
+ UINT8 retVal = m_direct->read_decrypted_byte(m_PC.w.l);
+ m_PC.w.l = (m_PC.w.l + 1) & 0x0fff;
+ return retVal;
+}
+
+inline UINT8 ie15_device::arg()
+{
+ UINT8 retVal = m_direct->read_raw_byte(m_PC.w.l);
+ return retVal;
+}
+
+inline UINT8 ie15_device::get_reg_lo(UINT8 reg)
+{
+ UINT16 tmp = m_RF ? m_REGS[16 + reg] : m_REGS[reg];
+ return tmp & 255;
+}
+
+inline UINT16 ie15_device::get_reg(UINT8 reg)
+{
+ return m_RF ? m_REGS[16 + reg] : m_REGS[reg];
+}
+
+inline void ie15_device::set_reg(UINT8 reg, UINT16 val)
+{
+ (m_RF ? m_REGS[16 + reg] : m_REGS[reg]) = val;
+
+}
+
+inline void ie15_device::update_flags(UINT8 val)
+{
+ m_ZF = (val == 0xff) ? 1 : 0;
+}
+
+inline UINT8 ie15_device::do_condition(UINT8 val)
+{
+ UINT8 v = (val >> 5) & 1;
+ UINT8 cond = 0;
+ switch((val>> 3) & 0x03) {
+ case 0 :
+ if (m_CF==v) cond = 1;
+ break;
+ case 1 :
+ if (m_ZF==v) cond = 1;
+ break;
+ }
+ return cond;
+}
+
+inline UINT16 ie15_device::get_addr(UINT8 val)
+{
+ UINT8 lo = arg();
+ return ((val & 0x0f) << 8) + lo + 1;
+}
diff --git a/src/emu/cpu/ie15/ie15.h b/src/emu/cpu/ie15/ie15.h
new file mode 100644
index 0000000..2f9616f
--- /dev/null
+++ b/src/emu/cpu/ie15/ie15.h
@@ -0,0 +1,90 @@
+#ifndef __IE15_H__
+#define __IE15_H__
+
+//**************************************************************************
+// ENUMERATIONS
+//**************************************************************************
+
+enum
+{
+ IE15_PC,
+ IE15_A,
+ IE15_R0, IE15_R1, IE15_R2, IE15_R3, IE15_R4, IE15_R5, IE15_R6, IE15_R7,
+ IE15_R8, IE15_R9, IE15_R10, IE15_R11, IE15_R12, IE15_R13, IE15_R14, IE15_R15,
+ IE15_R16, IE15_R17, IE15_R18, IE15_R19, IE15_R20, IE15_R21, IE15_R22, IE15_R23,
+ IE15_R24, IE15_R25, IE15_R26, IE15_R27, IE15_R28, IE15_R29, IE15_R30, IE15_R31,
+
+ IE15_GENPC = STATE_GENPC,
+ IE15_GENPCBASE = STATE_GENPCBASE
+};
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+class ie15_device;
+
+class ie15_device : public cpu_device
+{
+public:
+ // construction/destruction
+ ie15_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_execute_interface overrides
+ virtual UINT32 execute_min_cycles() const;
+ virtual UINT32 execute_max_cycles() const;
+ virtual void execute_run();
+
+ // device_memory_interface overrides
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
+
+ // device_state_interface overrides
+ virtual void state_import(const device_state_entry &entry);
+ virtual void state_export(const device_state_entry &entry);
+ virtual void state_string_export(const device_state_entry &entry, astring &string);
+
+ // device_disasm_interface overrides
+ virtual UINT32 disasm_min_opcode_bytes() const;
+ virtual UINT32 disasm_max_opcode_bytes() const;
+ virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
+
+ virtual void execute_one(int opcode);
+
+ UINT8 rop();
+ UINT8 get_reg_lo(UINT8 reg);
+ UINT16 get_reg(UINT8 reg);
+ void set_reg(UINT8 reg, UINT16 val);
+ UINT8 arg();
+ void update_flags(UINT8 val);
+ UINT8 do_condition(UINT8 val);
+ UINT16 get_addr(UINT8 val);
+ void illegal(UINT8 opcode);
+
+ int m_icount;
+
+ // configuration
+ const address_space_config m_program_config;
+ const address_space_config m_io_config;
+
+ UINT8 m_A;
+ PAIR m_PC;
+ UINT16 m_REGS[32]; // General registers (2 pages of 16)
+ UINT8 m_CF; // Carry flag
+ UINT8 m_ZF; // Zero flag
+ UINT8 m_RF; // Current register page
+ UINT8 m_flags; // temporary I/O only
+
+ address_space *m_program;
+ address_space *m_io;
+ direct_read_data *m_direct;
+};
+
+// device type definition
+extern const device_type IE15;
+
+#endif
diff --git a/src/emu/cpu/ie15/ie15dasm.c b/src/emu/cpu/ie15/ie15dasm.c
new file mode 100644
index 0000000..7c2da4a
--- /dev/null
+++ b/src/emu/cpu/ie15/ie15dasm.c
@@ -0,0 +1,124 @@
+#include "emu.h"
+
+#define OP(A) oprom[(A) - PC]
+#define ARG(A) opram[(A) - PC]
+
+CPU_DISASSEMBLE( ie15 )
+{
+ UINT32 flags = 0;
+ UINT8 op;
+ unsigned PC = pc;
+
+ op = OP(pc++);
+ switch (op & 0xf0)
+ {
+ case 0x00:
+ sprintf (buffer,"add r%d", op & 0x0f);
+ break;
+ case 0x10:
+ sprintf (buffer,"jmp $%04x", (((op & 0x0f) << 8) | ARG(pc)) + 1);
+ pc+=1;
+ break;
+ case 0x20:
+ sprintf (buffer,"ldc r%d, #$%02x", (op & 0x0f), ARG(pc));
+ pc+=1;
+ break;
+ case 0x30: switch (op)
+ {
+ case 0x30:
+ sprintf (buffer,"lca #$%02x", ARG(pc));
+ pc+=1;
+ break;
+ case 0x33:
+ sprintf (buffer,"ral");
+ break;
+ case 0x35:
+ sprintf (buffer,"rar");
+ break;
+ default:
+ sprintf (buffer,"illegal");
+ break;
+ };
+ break;
+ case 0x40:
+ sprintf (buffer,"dsr r%d", op & 0x0f);
+ break;
+ case 0x50: switch (op)
+ {
+ case 0x50:
+ sprintf (buffer,"isn");
+ break;
+ case 0x51:
+ sprintf (buffer,"inc");
+ break;
+ case 0x52:
+ sprintf (buffer,"dsn");
+ break;
+ case 0x58:
+ sprintf (buffer,"ise");
+ break;
+ case 0x5a:
+ sprintf (buffer,"dse");
+ break;
+ case 0x5b:
+ sprintf (buffer,"dec");
+ break;
+ case 0x5d:
+ sprintf (buffer,"com");
+ break;
+ case 0x5f:
+ sprintf (buffer,"clr");
+ break;
+ default:
+ sprintf (buffer,"illegal");
+ break;
+ };
+ break;
+ case 0x60:
+ sprintf (buffer,"lla #$%02x", op & 0x0f);
+ break;
+ case 0x70:
+ sprintf (buffer,"jmi r%d", op & 0x0f);
+ break;
+ case 0x80: switch (op)
+ {
+ case 0x80: case 0x81: case 0x82: case 0x83:
+ case 0x84: case 0x85: case 0x86:
+ sprintf (buffer,"sfc #%d", op & 0x07);
+ break;
+ case 0x87:
+ sprintf (buffer,"skp");
+ break;
+ case 0x88: case 0x89: case 0x8a: case 0x8b:
+ case 0x8c: case 0x8d: case 0x8e:
+ sprintf (buffer,"sfs #%d", op & 0x07);
+ break;
+ case 0x8f:
+ sprintf (buffer,"nop");
+ break;
+ };
+ break;
+ case 0x90:
+ sprintf (buffer,"and r%d", op & 0x0f);
+ break;
+ case 0xa0:
+ sprintf (buffer,"xor r%d", op & 0x0f);
+ break;
+ case 0xb0:
+ sprintf (buffer,"cs r%d", op & 0x0f);
+ break;
+ case 0xc0:
+ sprintf (buffer,"%s #%d", BIT(op, 3) ? "sfl" : "cfl", op & 0x07);
+ break;
+ case 0xd0:
+ sprintf (buffer,"lda r%d", op & 0x0f);
+ break;
+ case 0xe0:
+ sprintf (buffer,"sta r%d", op & 0x0f);
+ break;
+ case 0xf0:
+ sprintf (buffer,"ota #$%02x", op & 0x0f);
+ break;
+ }
+ return (pc - PC) | flags | DASMFLAG_SUPPORTED;
+}
diff --git a/src/emu/drivers/xtal.h b/src/emu/drivers/xtal.h
index 00201b6..965293a 100644
--- a/src/emu/drivers/xtal.h
+++ b/src/emu/drivers/xtal.h
@@ -173,6 +173,7 @@ enum
XTAL_28_63636MHz = 28636363, /* Later Leland games and Atari GT, Amiga NTSC, Raiden2 h/w (8x NTSC subcarrier)*/
XTAL_30MHz = 30000000, /* Impera Magic Card */
XTAL_30_4761MHz = 30476100, /* Taito JC */
+ XTAL_30_8MHz = 30800000, /* 15IE-00-013 */
XTAL_32MHz = 32000000,
XTAL_32_22MHz = 32220000, /* Typically used on 90's Data East PCBs */
XTAL_32_5304MHz = 32530400, /* Seta 2 */
diff --git a/src/mess/drivers/ie15.c b/src/mess/drivers/ie15.c
new file mode 100644
index 0000000..fa46e39
--- /dev/null
+++ b/src/mess/drivers/ie15.c
@@ -0,0 +1,666 @@
+/***************************************************************************
+
+ 15IE-00-013 Terminal
+
+ board images : http://asvcorp.ru/darch/hardware/pdp/fryazin-display/index.html
+
+ 29/06/2012 Skeleton driver.
+
+ A serial (RS232 or current loop) green-screen terminal, mostly VT52 compatible
+ (no Hold Screen mode and no graphics character set, but has Cyrillic characters).
+ The top line is a status line.
+
+****************************************************************************/
+
+#include "emu.h"
+#include "cpu/ie15/ie15.h"
+#include "imagedev/bitbngr.h"
+#include "machine/keyboard.h"
+#include "sound/beep.h"
+
+#define SCREEN_PAGE (80*48)
+
+#define IE_1 0x80
+#define IE_KB_ACK 1
+
+#define IE15_TOTAL_HORZ 1000
+#define IE15_TOTAL_VERT 28*11
+
+#define IE15_DISP_HORZ 800
+#define IE15_DISP_VERT 25*11
+
+#define IE15_HORZ_START 100
+#define IE15_VERT_START 2*11
+
+#define VERBOSE_DBG 1 /* general debug messages */
+
+#define DBG_LOG(N,M,A) \
+ do { \
+ if(VERBOSE_DBG>=N) \
+ { \
+ if( M ) \
+ logerror("%11.6f at %s: %-24s",machine().time().as_double(),machine().describe_context(),(char*)M ); \
+ logerror A; \
+ } \
+ } while (0)
+
+#if VERBOSE_DBG > 0
+#define LOOPBACK (m_io_keyboard->read() & 0x20)
+#else
+#define LOOPBACK (0)
+#endif
+
+#define BITBANGER_TAG "bitbanger"
+
+class ie15_state : public driver_device
+{
+public:
+ ie15_state(const machine_config &mconfig, device_type type, const char *tag)
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
+ , m_beeper(*this, "beeper")
+ , m_bitbanger(*this, BITBANGER_TAG)
+ , m_io_keyboard(*this, KEYBOARD_TAG)
+ { }
+
+ virtual void machine_reset();
+ virtual void video_start();
+ virtual void palette_init();
+ UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ UINT32 screen_update_hle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ TIMER_DEVICE_CALLBACK_MEMBER(scanline_callback);
+ DECLARE_WRITE8_MEMBER(kbd_put);
+ static const bitbanger_config ie15_bitbanger_config;
+ TIMER_CALLBACK_MEMBER(serial_tx_callback);
+ emu_timer *m_serial_tx_timer;
+
+ DECLARE_WRITE8_MEMBER( mem_w );
+ DECLARE_READ8_MEMBER( mem_r );
+ DECLARE_WRITE8_MEMBER( mem_addr_lo_w );
+ DECLARE_WRITE8_MEMBER( mem_addr_hi_w );
+ DECLARE_WRITE8_MEMBER( mem_addr_inc_w );
+ DECLARE_WRITE8_MEMBER( mem_addr_dec_w );
+ DECLARE_READ8_MEMBER( flag_r );
+ DECLARE_WRITE8_MEMBER( flag_w );
+ DECLARE_WRITE8_MEMBER( beep_w );
+ DECLARE_READ8_MEMBER( kb_r );
+ DECLARE_READ8_MEMBER( kb_ready_r );
+ DECLARE_READ8_MEMBER( kb_s_red_r );
+ DECLARE_READ8_MEMBER( kb_s_sdv_r );
+ DECLARE_READ8_MEMBER( kb_s_dk_r );
+ DECLARE_READ8_MEMBER( kb_s_dupl_r );
+ DECLARE_READ8_MEMBER( kb_s_lin_r );
+ DECLARE_WRITE8_MEMBER( kb_ready_w );
+ DECLARE_READ8_MEMBER( serial_tx_ready_r );
+ DECLARE_WRITE8_MEMBER( serial_w );
+ DECLARE_READ8_MEMBER( serial_rx_ready_r );
+ DECLARE_READ8_MEMBER( serial_r );
+#if 0
+ DECLARE_WRITE8_MEMBER( serial_speed_w );
+#endif
+
+private:
+ TIMER_CALLBACK_MEMBER(ie15_beepoff);
+ UINT32 draw_scanline(UINT16 *p, UINT16 offset, UINT8 scanline, UINT8 y);
+ bitmap_ind16 m_tmpbmp;
+
+ const UINT8 *m_p_chargen;
+ UINT8 *m_p_videoram;
+ UINT8 m_beep;
+ UINT8 m_cursor;
+ UINT8 m_kb_data;
+ UINT8 m_kb_flag;
+ UINT8 m_kb_flag0;
+ UINT8 m_latch;
+ UINT8 m_ruslat;
+ UINT8 m_serial_rx_bits;
+ UINT8 m_serial_rx_buffer;
+ UINT8 m_serial_rx_data;
+ UINT8 m_serial_tx_bits;
+ UINT8 m_serial_tx_data;
+ UINT8 m_statusline;
+ UINT8 m_video;
+ UINT32 m_videoptr;
+ UINT32 m_videoptr_2;
+
+ static void bitbanger_callback(running_machine &machine, UINT8 bit);
+ DECLARE_WRITE_LINE_MEMBER( serial_rx_callback );
+
+protected:
+ required_device<cpu_device> m_maincpu;
+ required_device<beep_device> m_beeper;
+ required_device<bitbanger_device> m_bitbanger;
+ required_ioport m_io_keyboard;
+};
+
+READ8_MEMBER( ie15_state::mem_r ) {
+ UINT8 ret;
+
+ ret = m_p_videoram[m_videoptr];
+ if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0 && m_videoptr >= SCREEN_PAGE)
+ {
+ DBG_LOG(2,"memory",("R @ %03x == %02x\n", m_videoptr, ret));
+ }
+ m_videoptr++;
+ m_videoptr &= 0xfff;
+ m_latch = 0;
+ return ret;
+}
+
+WRITE8_MEMBER( ie15_state::mem_w ) {
+ if ((m_latch ^= 1) == 0) {
+ if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0 && m_videoptr >= SCREEN_PAGE)
+ {
+ DBG_LOG(2,"memory",("W @ %03x <- %02x\n", m_videoptr, data));
+ }
+ m_p_videoram[m_videoptr++] = data;
+ m_videoptr &= 0xfff;
+ }
+}
+
+WRITE8_MEMBER( ie15_state::mem_addr_inc_w ) {
+ if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
+ {
+ DBG_LOG(2,"memory",("++ %03x\n", m_videoptr));
+ }
+ m_videoptr++;
+ m_videoptr &= 0xfff;
+ if (m_video)
+ m_videoptr_2 = m_videoptr;
+}
+
+WRITE8_MEMBER( ie15_state::mem_addr_dec_w ) {
+ if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
+ {
+ DBG_LOG(2,"memory",("-- %03x\n", m_videoptr));
+ }
+ m_videoptr--;
+ m_videoptr &= 0xfff;
+ if (m_video)
+ m_videoptr_2 = m_videoptr;
+}
+
+WRITE8_MEMBER( ie15_state::mem_addr_lo_w ) {
+ UINT16 tmp = m_videoptr;
+
+ tmp &= 0xff0;
+ tmp |= ((data >> 4) & 0xf);
+ if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
+ {
+ DBG_LOG(2,"memory",("lo %03x <- %02x = %03x\n", m_videoptr, data, tmp));
+ }
+ m_videoptr = tmp;
+ if (m_video)
+ m_videoptr_2 = tmp;
+}
+
+WRITE8_MEMBER( ie15_state::mem_addr_hi_w ) {
+ UINT16 tmp = m_videoptr;
+
+ tmp &= 0xf;
+ tmp |= (data << 4);
+ if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
+ {
+ DBG_LOG(2,"memory",("hi %03x <- %02x = %03x\n", m_videoptr, data, tmp));
+ }
+ m_videoptr = tmp;
+ if (m_video)
+ m_videoptr_2 = tmp;
+}
+
+TIMER_CALLBACK_MEMBER(ie15_state::ie15_beepoff)
+{
+ machine().device<beep_device>("beeper")->set_state(0);
+}
+
+WRITE8_MEMBER( ie15_state::beep_w ) {
+ UINT16 length = (m_beep&128)?150:400;
+
+ if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
+ {
+ DBG_LOG(1,"beep",("(%s)\n", m_beep?"short":"long"));
+ }
+ machine().scheduler().timer_set(attotime::from_msec(length), timer_expired_delegate(FUNC(ie15_state::ie15_beepoff),this));
+ machine().device<beep_device>("beeper")->set_state(1);
+}
+
+// active high
+READ8_MEMBER( ie15_state::kb_r ) {
+ DBG_LOG(2,"keyboard",("R %02X '%c'\n", m_kb_data, m_kb_data < 0x20?' ':m_kb_data));
+ return m_kb_data;
+}
+
+// active low
+READ8_MEMBER( ie15_state::kb_ready_r ) {
+ m_kb_flag &= IE_1;
+ if (m_kb_flag != m_kb_flag0) {
+ DBG_LOG(2,"keyboard",("? %c\n", m_kb_flag?'n':'y'));
+ m_kb_flag0 = m_kb_flag;
+ }
+ return m_kb_flag;
+}
+
+// active low
+WRITE8_MEMBER( ie15_state::kb_ready_w ) {
+ DBG_LOG(2,"keyboard",("clear ready\n"));
+ m_kb_flag = IE_1 | IE_KB_ACK;
+}
+
+
+// active high; active = interpret controls, inactive = display controls
+READ8_MEMBER( ie15_state::kb_s_red_r ) {
+ return m_io_keyboard->read() & 0x01 ? IE_1 : 0;
+}
+
+// active high; active = setup mode
+READ8_MEMBER( ie15_state::kb_s_sdv_r ) {
+ return m_io_keyboard->read() & 0x02 ? IE_1 : 0;
+}
+
+// active high, XXX stub
+READ8_MEMBER( ie15_state::kb_s_dk_r ) {
+ return 0;
+}
+
+// active low; active = full duplex, inactive = half duplex
+READ8_MEMBER( ie15_state::kb_s_dupl_r ) {
+ return m_io_keyboard->read() & 0x08 ? IE_1 : 0;
+}
+
+// active high; active = on-line, inactive = local editing
+READ8_MEMBER( ie15_state::kb_s_lin_r ) {
+ return m_io_keyboard->read() & 0x10 ? IE_1 : 0;
+}
+
+// active low
+READ8_MEMBER( ie15_state::serial_rx_ready_r ) {
+ if (LOOPBACK)
+ return m_serial_tx_data ? 0 : IE_1;
+ else
+ return m_serial_rx_data ? 0 : IE_1;
+}
+
+// not called unless data is ready
+READ8_MEMBER( ie15_state::serial_r ) {
+ UINT8 tmp;
+
+ if (LOOPBACK) {
+ tmp = m_serial_tx_data;
+ m_serial_tx_data = 0;
+ } else {
+ tmp = m_serial_rx_data;
+ m_serial_rx_data = 0;
+ }
+ DBG_LOG(2,"serial",("R %02X '%c'\n", tmp, tmp < 0x20?' ':tmp));
+ return tmp;
+}
+
+/*
+ m_serial_rx_buffer incoming bits.
+ m_serial_rx_bits number of bits in _buffer.
+ m_serial_rx_data complete byte, ready to be read by host, or 0 if no data.
+*/
+
+WRITE_LINE_MEMBER( ie15_state::serial_rx_callback )
+{
+ UINT8 tmp = m_serial_rx_bits;
+
+ switch (m_serial_rx_bits) {
+ // wait for start bit (0)
+ case 10:
+ m_serial_rx_bits = 0;
+ case 0:
+ if (!state) {
+ m_serial_rx_bits++;
+ m_serial_rx_buffer = 0;
+ }
+ break;
+ // stuff incoming bits into byte buffer
+ case 1: case 2: case 3: case 4:
+ case 5: case 6: case 7: case 8:
+ m_serial_rx_buffer |= state << (m_serial_rx_bits-1);
+ m_serial_rx_bits++;
+ break;
+ // expecting stop bit (1)
+ case 9:
+ if (state && !m_serial_rx_data) {
+ m_serial_rx_data = m_serial_rx_buffer;
+ m_serial_rx_bits++;
+ } else
+ m_serial_rx_bits = 0;
+ break;
+ default:
+ // overflow
+ break;
+ }
+ DBG_LOG(2,"serial",("r %d bits %02d->%02d buffer %02X data %02X\n",
+ state, tmp, m_serial_rx_bits, m_serial_rx_buffer, m_serial_rx_data));
+}
+
+const bitbanger_config ie15_state::ie15_bitbanger_config =
+{
+ DEVCB_DRIVER_LINE_MEMBER(ie15_state, serial_rx_callback), /* callback */
+ BITBANGER_PRINTER, /* default mode */
+ BITBANGER_9600, /* default output baud */
+ BITBANGER_0PERCENT /* default fine tune adjustment */
+};
+
+// active high
+READ8_MEMBER( ie15_state::serial_tx_ready_r ) {
+ return m_serial_tx_data ? 0 : IE_1;
+}
+
+WRITE8_MEMBER( ie15_state::serial_w ) {
+ DBG_LOG(2,"serial",("W %02X '%c'\n", data, data < 0x20?' ':data));
+ if (LOOPBACK) {
+ if (!m_serial_tx_data)
+ m_serial_tx_data = data;
+ } else {
+ /* 1 start bit */
+ m_bitbanger->output(0);
+ /* 8 data bits, 1 stop bit, no parity */
+ m_serial_tx_bits = 8;
+ m_serial_tx_data = data;
+ m_serial_tx_timer->adjust(attotime::from_hz(9600));
+ }
+}
+
+TIMER_CALLBACK_MEMBER(ie15_state::serial_tx_callback) {
+ if (!m_serial_tx_bits) {
+ m_bitbanger->output(1);
+ m_serial_tx_data = 0;
+ } else {
+ m_bitbanger->output(BIT(m_serial_tx_data, 8-(m_serial_tx_bits--)));
+ m_serial_tx_timer->adjust(attotime::from_hz(9600));
+ }
+}
+
+READ8_MEMBER( ie15_state::flag_r ) {
+ UINT8 ret = 0;
+
+ switch (offset)
+ {
+ case 0: // hsync pulse (not hblank)
+ ret = machine().primary_screen->hpos() < IE15_HORZ_START;
+ break;
+ case 1: // marker scanline
+ ret = (machine().primary_screen->vpos() % 11) > 7;
+ break;
+ case 2: // vblank
+ ret = !machine().primary_screen->vblank();
+ break;
+ case 4:
+ ret = m_ruslat;
+ break;
+ default:
+ break;
+ }
+ if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0 && ret)
+ {
+ DBG_LOG(2,"flag",("read %d: %d\n", offset, ret));
+ }
+ return ret;
+}
+
+WRITE8_MEMBER( ie15_state::flag_w ) {
+ switch (offset)
+ {
+ case 0:
+ m_video = data;
+ break;
+ case 1:
+ m_cursor = data;
+ break;
+ case 2:
+ m_beep = data;
+ break;
+ case 3:
+ m_statusline = data;
+ break;
+ case 4:
+ m_ruslat = data;
+ break;
+ default:
+ break;
+ }
+ if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
+ {
+ DBG_LOG(2,"flag",("%sset %d\n", data?"":"re", offset));
+ }
+}
+
+static ADDRESS_MAP_START(ie15_mem, AS_PROGRAM, 8, ie15_state)
+ ADDRESS_MAP_UNMAP_HIGH
+ AM_RANGE( 0x0000, 0x0fff ) AM_ROM
+ADDRESS_MAP_END
+
+static ADDRESS_MAP_START(ie15_io, AS_IO, 8, ie15_state)
+ ADDRESS_MAP_UNMAP_HIGH
+ AM_RANGE(000, 000) AM_READ(mem_r) AM_WRITE(mem_w) // 00h W: memory request, R: memory data [6.1.2.2]
+ AM_RANGE(001, 001) AM_READ(serial_rx_ready_r) AM_WRITENOP // 01h W: memory latch [6.1.2.2]
+ AM_RANGE(002, 002) AM_WRITE(mem_addr_hi_w) // 02h W: memory address high [6.1.2.2]
+ AM_RANGE(003, 003) AM_WRITE(mem_addr_lo_w) // 03h W: memory address low [6.1.2.2]
+ AM_RANGE(004, 004) AM_WRITE(mem_addr_inc_w) // 04h W: memory address counter + [6.1.2.2]
+ AM_RANGE(005, 005) AM_WRITE(mem_addr_dec_w) // 05h W: memory address counter - [6.1.2.2]
+ AM_RANGE(006, 006) AM_READ(serial_r) AM_WRITE(serial_w) // 06h W: serial port data [6.1.5.4]
+// port 7 is handled in cpu core
+ AM_RANGE(010, 010) AM_READ(serial_tx_ready_r) AM_WRITE(beep_w) // 08h W: speaker control [6.1.5.4]
+ AM_RANGE(011, 011) AM_READ(kb_r) // 09h R: keyboard data [6.1.5.2]
+ AM_RANGE(012, 012) AM_READ(kb_s_red_r) // 0Ah I: keyboard mode "RED" [6.1.5.2]
+ AM_RANGE(013, 013) AM_READ(kb_ready_r) // 0Bh R: keyboard data ready [6.1.5.2]
+ AM_RANGE(014, 014) AM_READ(kb_s_sdv_r) AM_WRITENOP // 0Ch W: serial port speed [6.1.3.1], R: keyboard mode "SDV" [6.1.5.2]
+ AM_RANGE(015, 015) AM_READ(kb_s_dk_r) AM_WRITE(kb_ready_w) // 0Dh I: keyboard mode "DK" [6.1.5.2]
+ AM_RANGE(016, 016) AM_READ(kb_s_dupl_r) // 0Eh I: keyboard mode "DUPL" [6.1.5.2]
+ AM_RANGE(017, 017) AM_READ(kb_s_lin_r) // 0Fh I: keyboard mode "LIN" [6.1.5.2]
+// simulation of flag registers
+ AM_RANGE(020, 027) AM_READ(flag_r) AM_WRITE(flag_w)
+ADDRESS_MAP_END
+
+/* Input ports */
+static INPUT_PORTS_START( ie15 )
+ PORT_START("keyboard")
+ PORT_DIPNAME(0x01, 0x00, "RED mode")
+ PORT_DIPSETTING(0x00, "Off" )
+ PORT_DIPSETTING(0x01, "On" )
+ PORT_DIPNAME(0x02, 0x00, "SDV mode (Setup)")
+ PORT_DIPSETTING(0x00, "Off" )
+ PORT_DIPSETTING(0x02, "On" )
+ PORT_DIPNAME(0x08, 0x00, "DUPL mode")
+ PORT_DIPSETTING(0x00, "Off" )
+ PORT_DIPSETTING(0x08, "On" )
+ PORT_DIPNAME(0x10, 0x00, "LIN mode")
+ PORT_DIPSETTING(0x00, "Off" )
+ PORT_DIPSETTING(0x10, "On" )
+ PORT_DIPNAME(0x20, 0x00, "digital loopback")
+ PORT_DIPSETTING(0x00, "Off" )
+ PORT_DIPSETTING(0x20, "On" )
+INPUT_PORTS_END
+
+WRITE8_MEMBER( ie15_state::kbd_put )
+{
+ DBG_LOG(2,"keyboard",("W %02X<-%02X '%c' %c\n", m_kb_data, data, data < 0x20?' ':data, m_kb_flag?'n':'y'));
+ if (m_kb_flag == IE_1) {
+ m_kb_data = data;
+ m_kb_flag = 0;
+ }
+}
+
+static ASCII_KEYBOARD_INTERFACE( keyboard_intf )
+{
+ DEVCB_DRIVER_MEMBER(ie15_state, kbd_put)
+};
+
+
+void ie15_state::machine_reset()
+{
+ m_ruslat = m_beep = m_statusline = m_cursor = m_video = m_kb_data = m_kb_flag0 = 0;
+ m_serial_tx_data = m_serial_tx_bits = m_serial_rx_buffer = m_serial_rx_data = m_serial_rx_bits = 0;
+ m_kb_flag = IE_1;
+
+ machine().device<beep_device>("beeper")->set_frequency(2400);
+ machine().device<beep_device>("beeper")->set_state(0);
+
+ m_serial_tx_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ie15_state::serial_tx_callback),this));
+}
+
+void ie15_state::video_start()
+{
+ m_p_chargen = machine().root_device().memregion("chargen")->base();
+ m_p_videoram = memregion("video")->base();
+ m_videoptr = m_videoptr_2 = m_latch = 0;
+
+ m_tmpbmp.allocate(IE15_DISP_HORZ, IE15_DISP_VERT);
+}
+
+UINT32 ie15_state::draw_scanline(UINT16 *p, UINT16 offset, UINT8 scanline, UINT8 y)
+{
+ UINT8 gfx,fg,bg,ra,blink,red;
+ UINT16 x,chr;
+
+ bg = 0; fg = 1; ra = scanline % 8;
+ blink = (machine().primary_screen->frame_number() % 10) >= 5;
+ red = m_io_keyboard->read() & 0x01;
+
+ DBG_LOG(2,"draw_scanline",
+ ("addr %03x row %d-%d video %d\n", offset, y, scanline, m_video));
+
+ for (x = offset; x < offset + 80; x++)
+ {
+ if (m_video) {
+ chr = m_p_videoram[x] << 3;
+ gfx = m_p_chargen[chr | ra];
+
+ /*
+ Cursor is a character with only 3 scan lines, and is
+ not shown if flag 1 is not active on this scan line.
+ It always blinks if shown.
+
+ Control characters blink if RED mode is on and they
+ are not on status line; else they are blanked out.
+ */
+
+ if (scanline > 7 && (!m_cursor || blink))
+ gfx = 0;
+ if (chr < (0x20<<3))
+ if (!y || !red || blink)
+ gfx = 0;
+ else
+ gfx = m_p_chargen[chr | 0x200 | ra];
+
+ /* Display a scanline of a character */
+ *p++ = BIT(gfx, 7) ? fg : bg;
+ *p++ = BIT(gfx, 6) ? fg : bg;
+ *p++ = BIT(gfx, 5) ? fg : bg;
+ *p++ = BIT(gfx, 4) ? fg : bg;
+ *p++ = BIT(gfx, 3) ? fg : bg;
+ *p++ = BIT(gfx, 2) ? fg : bg;
+ *p++ = BIT(gfx, 1) ? fg : bg;
+ *p++ = bg;
+ *p++ = bg;
+ *p++ = bg;
+ } else {
+ *p++ = bg;
+ *p++ = bg;
+ *p++ = bg;
+ *p++ = bg;
+ *p++ = bg;
+ *p++ = bg;
+ *p++ = bg;
+ *p++ = bg;
+ *p++ = bg;
+ *p++ = bg;
+ }
+ }
+ return 0;
+}
+
+TIMER_DEVICE_CALLBACK_MEMBER(ie15_state::scanline_callback)
+{
+ UINT16 y = machine().primary_screen->vpos();
+ DBG_LOG(2,"scanline",
+ ("addr %03x frame %lld x %04d y %03d\n", m_videoptr_2, machine().primary_screen->frame_number(), machine().primary_screen->hpos(), y));
+ if (y>=IE15_VERT_START) {
+ y -= IE15_VERT_START;
+ if (y < IE15_DISP_VERT) {
+ draw_scanline(&m_tmpbmp.pix16(y), m_videoptr_2, y%11, y/11);
+ }
+ }
+}
+
+UINT32 ie15_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ copybitmap( bitmap, m_tmpbmp, 0, 0, IE15_HORZ_START, IE15_VERT_START, cliprect );
+ return 0;
+}
+
+
+/* F4 Character Displayer */
+static const gfx_layout ie15_charlayout =
+{
+ 7, 8, /* 7x8 pixels in 10x11 cell */
+ 256, /* 256 characters */
+ 1, /* 1 bits per pixel */
+ { 0 }, /* no bitplanes */
+ /* x offsets */
+ { 0, 1, 2, 3, 4, 5, 6 },
+ /* y offsets */
+ { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
+ 8*8 /* every char takes 8 bytes */
+};
+
+static GFXDECODE_START( ie15 )
+ GFXDECODE_ENTRY( "chargen", 0x0000, ie15_charlayout, 0, 1 )
+GFXDECODE_END
+
+void ie15_state::palette_init()
+{
+ palette_set_color(machine(), 0, RGB_BLACK); // black
+ palette_set_color_rgb(machine(), 1, 0x00, 0xc0, 0x00); // green
+}
+
+static MACHINE_CONFIG_START( ie15, ie15_state )
+ /* Basic machine hardware */
+ MCFG_CPU_ADD("maincpu", IE15, XTAL_30_8MHz / 10)
+ MCFG_CPU_PROGRAM_MAP(ie15_mem)
+ MCFG_CPU_IO_MAP(ie15_io)
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("scantimer", ie15_state, scanline_callback, attotime::from_hz(50*28*11))
+ MCFG_TIMER_START_DELAY(attotime::from_hz(XTAL_30_8MHz/(2*IE15_HORZ_START)))
+
+ /* Video hardware */
+ MCFG_SCREEN_ADD("screen", RASTER)
+ MCFG_SCREEN_UPDATE_DRIVER(ie15_state, screen_update)
+ MCFG_SCREEN_RAW_PARAMS(XTAL_30_8MHz/2,IE15_TOTAL_HORZ,IE15_HORZ_START,
+ IE15_HORZ_START+IE15_DISP_HORZ,IE15_TOTAL_VERT,IE15_VERT_START,
+ IE15_VERT_START+IE15_DISP_VERT);
+ MCFG_GFXDECODE(ie15)
+ MCFG_PALETTE_LENGTH(2)
+
+ /* Devices */
+ MCFG_ASCII_KEYBOARD_ADD(KEYBOARD_TAG, keyboard_intf)
+ MCFG_BITBANGER_ADD(BITBANGER_TAG, ie15_state::ie15_bitbanger_config)
+
+ MCFG_SPEAKER_STANDARD_MONO("mono")
+ MCFG_SOUND_ADD("beeper", BEEP, 0)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.15)
+MACHINE_CONFIG_END
+
+
+/* ROM definition */
+ROM_START( ie15 )
+ ROM_REGION( 0x1000, "maincpu", ROMREGION_ERASE00 )
+ ROM_DEFAULT_BIOS("5chip")
+ ROM_SYSTEM_BIOS(0, "5chip", "5-chip firmware (newer)")
+ ROMX_LOAD( "dump1.bin", 0x0000, 0x1000, CRC(14b82284) SHA1(5ac4159fbb1c3b81445605e26cd97a713ae12b5f),ROM_BIOS(1) )
+ ROM_SYSTEM_BIOS(1, "6chip", "6-chip firmware (older)")
+ ROMX_LOAD( "dump5.bin", 0x0000, 0x1000, CRC(01f2e065) SHA1(2b72dc0594e38a528400cd25aed0c47e0c432895),ROM_BIOS(2) )
+
+ ROM_REGION( 0x1000, "video", ROMREGION_ERASE00 )
+
+ ROM_REGION( 0x0800, "chargen", ROMREGION_ERASE00 )
+ ROM_LOAD( "chargen-15ie.bin", 0x0000, 0x0800, CRC(ed16bf6b) SHA1(6af9fb75f5375943d5c0ce9ed408e0fb4621b17e) )
+ROM_END
+
+/* Driver */
+
+/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */
+COMP( 1980, ie15, 0, 0, ie15, ie15, driver_device, 0, "USSR", "15IE-00-013", 0)
diff --git a/src/mess/mess.lst b/src/mess/mess.lst
index dbfa9f4..5471e08 100644
--- a/src/mess/mess.lst
+++ b/src/mess/mess.lst
@@ -2194,6 +2194,7 @@ hpz80unk
itt3030
vax785
ms0515
+ie15
alphasma
altos5
merlin
diff --git a/src/mess/mess.mak b/src/mess/mess.mak
index 45fe893..e47b949 100644
--- a/src/mess/mess.mak
+++ b/src/mess/mess.mak
@@ -124,6 +124,7 @@ CPUS += HD61700
CPUS += LC8670
CPUS += ES5510
CPUS += SCUDSP
+CPUS += IE15
#-------------------------------------------------
# specify available sound cores; some of these are
@@ -2112,6 +2113,7 @@ $(MESSOBJ)/skeleton.a: \
$(MESS_DRIVERS)/horizon.o \
$(MESS_DRIVERS)/hpz80unk.o \
$(MESS_DRIVERS)/ht68k.o \
+ $(MESS_DRIVERS)/ie15.o \
$(MESS_DRIVERS)/if800.o \
$(MESS_DRIVERS)/indiana.o \
$(MESS_DRIVERS)/itt3030.o \
diff --git a/src/tools/unidasm.c b/src/tools/unidasm.c
index f16a214..3f2c0ab 100644
--- a/src/tools/unidasm.c
+++ b/src/tools/unidasm.c
@@ -134,6 +134,7 @@ CPU_DISASSEMBLE( i80c51 );
CPU_DISASSEMBLE( i80c52 );
CPU_DISASSEMBLE( i860 );
CPU_DISASSEMBLE( i960 );
+CPU_DISASSEMBLE( ie15 );
CPU_DISASSEMBLE( jaguardsp );
CPU_DISASSEMBLE( jaguargpu );
CPU_DISASSEMBLE( konami );
@@ -276,6 +277,7 @@ static const dasm_table_entry dasm_table[] =
{ "i80c52", _8bit, 0, CPU_DISASSEMBLE_NAME(i80c52) },
{ "i860", _64le, 0, CPU_DISASSEMBLE_NAME(i860) },
{ "i960", _32le, 0, CPU_DISASSEMBLE_NAME(i960) },
+ { "ie15", _8bit, 0, CPU_DISASSEMBLE_NAME(ie15) },
{ "jaguardsp", _16be, 0, CPU_DISASSEMBLE_NAME(jaguardsp) },
{ "jaguargpu", _16be, 0, CPU_DISASSEMBLE_NAME(jaguargpu) },
{ "konami", _8bit, 0, CPU_DISASSEMBLE_NAME(konami) },
--
1.8.1.5
 
View gist:5232006
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
[PATCH] bitbanger: hack for ie15
 
 
diff --git a/src/emu/imagedev/bitbngr.c b/src/emu/imagedev/bitbngr.c
index 1d509a9..9a6692d 100644
--- a/src/emu/imagedev/bitbngr.c
+++ b/src/emu/imagedev/bitbngr.c
@@ -408,13 +408,15 @@ void bitbanger_device::timer_input(void)
if(m_input_buffer_size == 0)
{
/* no more data, wait and try again */
- m_idle_delay = min(m_idle_delay + attotime::from_msec(100), attotime::from_seconds(1));
+// m_idle_delay = min(m_idle_delay + attotime::from_msec(100), attotime::from_seconds(1));
m_input_timer->adjust(m_idle_delay);
+ /*
if( m_mode == BITBANGER_MODEM )
set_input_line(1);
else
set_input_line(0);
+ */
return;
}
else
@@ -440,11 +442,11 @@ void bitbanger_device::set_input_line(UINT8 line)
line = line ? ASSERT_LINE : CLEAR_LINE;
/* only act when the state changes */
- if (m_current_input != line)
+ // if (m_current_input != line)
{
m_current_input = line;
- m_input_func(line ? ASSERT_LINE : CLEAR_LINE);
}
+ m_input_func(line /*? ASSERT_LINE : CLEAR_LINE*/);
}
--
1.8.1.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.