Mercurial > repos > blastem
comparison blastem.c @ 290:171f97e70d85
Implement writes from Z80 to YM-2612
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 06 May 2013 00:54:58 -0700 |
parents | 1cc0850ab6bc |
children | e5e8b48ad157 |
comparison
equal
deleted
inserted
replaced
289:1cc0850ab6bc | 290:171f97e70d85 |
---|---|
697 printf("Word read of unknown IO location: %X\n", location); | 697 printf("Word read of unknown IO location: %X\n", location); |
698 } | 698 } |
699 } | 699 } |
700 } | 700 } |
701 return context; | 701 return context; |
702 } | |
703 | |
704 z80_context * z80_write_ym(uint16_t location, z80_context * context, uint8_t value) | |
705 { | |
706 genesis_context * gen = context->system; | |
707 ym_run(gen->ym, (context->current_cycle * MCLKS_PER_Z80) / MCLKS_PER_68K); | |
708 if (location & 1) { | |
709 ym_data_write(gen->ym, value); | |
710 } else if (location & 2) { | |
711 ym_address_write_part2(gen->ym, value); | |
712 } else { | |
713 ym_address_write_part1(gen->ym, value); | |
714 } | |
715 return context; | |
716 } | |
717 | |
718 uint8_t z80_read_ym(uint16_t location, z80_context * context) | |
719 { | |
720 genesis_context * gen = context->system; | |
721 ym_run(gen->ym, (context->current_cycle * MCLKS_PER_Z80) / MCLKS_PER_68K); | |
722 return ym_read_status(gen->ym); | |
702 } | 723 } |
703 | 724 |
704 typedef struct bp_def { | 725 typedef struct bp_def { |
705 struct bp_def * next; | 726 struct bp_def * next; |
706 uint32_t address; | 727 uint32_t address; |
1013 | 1034 |
1014 z80_context z_context; | 1035 z80_context z_context; |
1015 x86_z80_options z_opts; | 1036 x86_z80_options z_opts; |
1016 init_x86_z80_opts(&z_opts); | 1037 init_x86_z80_opts(&z_opts); |
1017 init_z80_context(&z_context, &z_opts); | 1038 init_z80_context(&z_context, &z_opts); |
1018 z_context.next_context = &v_context; | 1039 |
1040 genesis_context gen; | |
1041 | |
1042 z_context.system = &gen; | |
1019 z_context.mem_pointers[0] = z80_ram; | 1043 z_context.mem_pointers[0] = z80_ram; |
1020 z_context.sync_cycle = z_context.target_cycle = MCLKS_PER_FRAME/MCLKS_PER_Z80; | 1044 z_context.sync_cycle = z_context.target_cycle = MCLKS_PER_FRAME/MCLKS_PER_Z80; |
1021 z_context.int_cycle = CYCLE_NEVER; | 1045 z_context.int_cycle = CYCLE_NEVER; |
1022 z_context.mem_pointers[1] = z_context.mem_pointers[2] = (uint8_t *)cart; | 1046 z_context.mem_pointers[1] = z_context.mem_pointers[2] = (uint8_t *)cart; |
1023 | 1047 |
1024 genesis_context gen; | |
1025 gen.z80 = &z_context; | 1048 gen.z80 = &z_context; |
1026 gen.vdp = &v_context; | 1049 gen.vdp = &v_context; |
1027 gen.ym = &y_context; | 1050 gen.ym = &y_context; |
1028 | 1051 |
1029 init_run_cpu(&gen, debug, address_log); | 1052 init_run_cpu(&gen, debug, address_log); |