Class: Z80
- Inherits:
-
Object
- Object
- Z80
- Defined in:
- lib/z80/version.rb,
ext/z80/z80.c
Defined Under Namespace
Modules: Option, Request, Resume
Constant Summary collapse
- VERSION =
'0.3.2'- MAXIMUM_CYCLES =
ULL2NUM(Z80_MAXIMUM_CYCLES )
- MAXIMUM_CYCLES_PER_STEP =
UINT2NUM(Z80_MAXIMUM_CYCLES_PER_STEP)
- MINIMUM_CYCLES_PER_STEP =
UINT2NUM(Z80_MINIMUM_CYCLES_PER_STEP)
- HOOK =
UINT2NUM(Z80_HOOK )
- SF =
UINT2NUM(Z80_SF)
- ZF =
UINT2NUM(Z80_ZF)
- YF =
UINT2NUM(Z80_YF)
- HF =
UINT2NUM(Z80_HF)
- XF =
UINT2NUM(Z80_XF)
- PF =
UINT2NUM(Z80_PF)
- NF =
UINT2NUM(Z80_NF)
- CF =
UINT2NUM(Z80_CF)
Instance Method Summary collapse
- #execute(cycles) ⇒ Object
- #full_r ⇒ Object
- #in_cycle ⇒ Object
- #instant_reset ⇒ Object
- #int(state) ⇒ Object
- #nmi ⇒ Object
- #out_cycle ⇒ Object
- #power ⇒ Object
- #print ⇒ Object
- #refresh_address ⇒ Object
- #run(cycles) ⇒ Object
- #terminate ⇒ Object
- #to_h(*args) ⇒ Object (also: #state)
Instance Method Details
#execute(cycles) ⇒ Object
440 441 442 443 444 |
# File 'ext/z80/z80.c', line 440 static VALUE Z80__execute(VALUE self, VALUE cycles) { GET_Z80; return SIZET2NUM(z80_execute(z80, NUM2SIZET(cycles))); } |
#full_r ⇒ Object
462 463 464 465 466 |
# File 'ext/z80/z80.c', line 462 static VALUE Z80__full_r(VALUE self) { GET_Z80; return UINT2NUM(z80_r(z80)); } |
#in_cycle ⇒ Object
476 477 478 479 480 |
# File 'ext/z80/z80.c', line 476 static VALUE Z80__in_cycle(VALUE self) { GET_Z80; return UINT2NUM(z80_in_cycle(z80)); } |
#instant_reset ⇒ Object
416 417 418 419 420 421 |
# File 'ext/z80/z80.c', line 416 static VALUE Z80__instant_reset(VALUE self) { GET_Z80; z80_instant_reset(z80); return self; } |
#int(state) ⇒ Object
424 425 426 427 428 429 |
# File 'ext/z80/z80.c', line 424 static VALUE Z80__int(VALUE self, VALUE state) { GET_Z80; z80_int(z80, RB_TEST(state)); return self; } |
#nmi ⇒ Object
432 433 434 435 436 437 |
# File 'ext/z80/z80.c', line 432 static VALUE Z80__nmi(VALUE self) { GET_Z80; z80_nmi(z80); return self; } |
#out_cycle ⇒ Object
483 484 485 486 487 |
# File 'ext/z80/z80.c', line 483 static VALUE Z80__out_cycle(VALUE self) { GET_Z80; return UINT2NUM(z80_out_cycle(z80)); } |
#power ⇒ Object
#print ⇒ Object
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 |
# File 'ext/z80/z80.c', line 568 static VALUE Z80__print(VALUE self) { zuint8 f; GET_Z80; f = Z80_F(*z80); /* PC 0000 AF 0000 AF' 0000 IX 0000 SP 0000 BC 0000 BC' 0000 IY 0000 IR 0000 DE 0000 DE' 0000 XY 0000 WZ 0000 HL 0000 HL' 0000 Q 00 S Z Y H X P N C IFF1 0 IM 0 EI 1 - - 1 - - 1 - - IFF2 0 R7 0 RI 1 /INT high RS 00 data 00 00 00 00 /HALT high RQ 00 data 00 00 00 00*/ printf( "PC %04" PRIX16 " AF %04" PRIX16 " AF' %04" PRIX16 " IX %04" PRIX16 "\n" "SP %04" PRIX16 " BC %04" PRIX16 " BC' %04" PRIX16 " IY %04" PRIX16 "\n" "IR %02" PRIX8 "%02" PRIX8 " DE %04" PRIX16 " DE' %04" PRIX16 " XY %04" PRIX16 "\n" "WZ %04" PRIX16 " HL %04" PRIX16 " HL' %04" PRIX16 " Q %02" PRIX8 "\n" "S Z Y H X P N C" " IFF1 %" PRIu8 " IM %" PRIu8 " EI %" PRIu8 "\n" "%c %c %c %c %c %c %c %c IFF2 %" PRIu8 " R7 %" PRIu8 " RI %" PRIu8 "\n", Z80_PC(*z80), Z80_AF(*z80), Z80_AF_(*z80), Z80_IX(*z80), Z80_SP(*z80), Z80_BC(*z80), Z80_BC_(*z80), Z80_IY(*z80), z80->i, z80->r, Z80_DE(*z80), Z80_DE_(*z80), Z80_IX(*z80), Z80_MEMPTR(*z80), Z80_HL(*z80), Z80_HL_(*z80), z80->q, z80->iff1, z80->im, '\0', one_hyphen[!(f & Z80_SF)], one_hyphen[!(f & Z80_ZF)], one_hyphen[!(f & Z80_YF)], one_hyphen[!(f & Z80_HF)], one_hyphen[!(f & Z80_XF)], one_hyphen[!(f & Z80_PF)], one_hyphen[!(f & Z80_NF)], one_hyphen[!(f & Z80_CF)], z80->iff2, z80->r7 >> 7, '\0'); return Qnil; } |
#refresh_address ⇒ Object
469 470 471 472 473 |
# File 'ext/z80/z80.c', line 469 static VALUE Z80__refresh_address(VALUE self) { GET_Z80; return UINT2NUM(z80_refresh_address(z80)); } |
#run(cycles) ⇒ Object
447 448 449 450 451 |
# File 'ext/z80/z80.c', line 447 static VALUE Z80__run(VALUE self, VALUE cycles) { GET_Z80; return SIZET2NUM(z80_run(z80, NUM2SIZET(cycles))); } |
#terminate ⇒ Object
454 455 456 457 458 459 |
# File 'ext/z80/z80.c', line 454 static VALUE Z80__terminate(VALUE self) { GET_Z80; z80_break(z80); return self; } |
#to_h(*args) ⇒ Object Also known as: state
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 |
# File 'ext/z80/z80.c', line 523 static VALUE Z80__to_h(int argc, VALUE *argv, VALUE self) { Z80 *z80; VALUE hash; VALUE kv[(Z_ARRAY_SIZE(uint16_members) + Z_ARRAY_SIZE(uint8_members)) * 2]; int i, j, uint8_member_count; if (argc > 1) rb_raise( rb_eArgError, "wrong number of arguments (given %d, expected 0 or 1)", argc); TypedData_Get_Struct(self, Z80, &z80_data_type, z80); hash = rb_hash_new(); uint8_member_count = Z_ARRAY_SIZE(uint8_members) - ((argc && RB_TEST(argv[0])) << 2); /* 4 or 0 */ for (i = j = 0; j < Z_ARRAY_SIZE(uint16_members);) { kv[i++] = rb_id2sym(rb_intern(uint16_members[j].name)); kv[i++] = UINT2NUM(*(zuint16 *)(void *)((char *)z80 + uint16_members[j++].offset)); } for (j = 0; j < uint8_member_count;) { kv[i++] = rb_id2sym(rb_intern(uint8_members[j].name)); kv[i++] = UINT2NUM(*((zuint8 *)z80 + uint8_members[j++].offset)); } while (j < Z_ARRAY_SIZE(uint8_members)) { kv[i++] = rb_id2sym(rb_intern(uint8_members[j].name)); kv[i++] = *((zuint8 *)z80 + uint8_members[j++].offset) ? Qtrue : Qfalse; } rb_hash_bulk_insert_into_st_table(Z_ARRAY_SIZE(kv), kv, hash); return hash; } |