Mercurial > repos > blastem
comparison blastem.c @ 616:649db9397fa1
Add support for Z80 access to VDP via bank area
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 29 Dec 2014 00:41:36 -0800 |
parents | cf73b72c6d1e |
children | f822d9216968 |
comparison
equal
deleted
inserted
replaced
615:edd2c446694b | 616:649db9397fa1 |
---|---|
730 | 730 |
731 uint8_t z80_read_bank(uint32_t location, void * vcontext) | 731 uint8_t z80_read_bank(uint32_t location, void * vcontext) |
732 { | 732 { |
733 z80_context * context = vcontext; | 733 z80_context * context = vcontext; |
734 uint32_t address = context->bank_reg << 15 | location; | 734 uint32_t address = context->bank_reg << 15 | location; |
735 fprintf(stderr, "Unhandled read by Z80 from address %X through banked memory area\n", address); | 735 if (address >= 0xC00000 && address < 0xE00000) { |
736 return z80_vdp_port_read(location & 0xFF, context); | |
737 } else { | |
738 fprintf(stderr, "Unhandled read by Z80 from address %X through banked memory area\n", address); | |
739 } | |
736 return 0; | 740 return 0; |
737 } | 741 } |
738 | 742 |
739 void *z80_write_bank(uint32_t location, void * vcontext, uint8_t value) | 743 void *z80_write_bank(uint32_t location, void * vcontext, uint8_t value) |
740 { | 744 { |
741 z80_context * context = vcontext; | 745 z80_context * context = vcontext; |
742 uint32_t address = context->bank_reg << 15 | location; | 746 uint32_t address = context->bank_reg << 15 | location; |
743 if (address >= 0xE00000) { | 747 if (address >= 0xE00000) { |
744 address &= 0xFFFF; | 748 address &= 0xFFFF; |
745 ((uint8_t *)ram)[address ^ 1] = value; | 749 ((uint8_t *)ram)[address ^ 1] = value; |
750 } else if (address >= 0xC00000) { | |
751 z80_vdp_port_write(location & 0xFF, context, value); | |
746 } else { | 752 } else { |
747 fprintf(stderr, "Unhandled write by Z80 to address %X through banked memory area\n", address); | 753 fprintf(stderr, "Unhandled write by Z80 to address %X through banked memory area\n", address); |
748 } | 754 } |
749 return context; | 755 return context; |
750 } | 756 } |