Mercurial > repos > blastem
comparison vdp.c @ 1428:2540c05520f2
New savestates are working. New config file option for selecting format states will be saved in. Mostly complete, needs a little more work before release
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 09 Aug 2017 23:26:51 -0700 |
parents | 4e5797b3935a |
children | 030b40139de9 |
comparison
equal
deleted
inserted
replaced
1427:4e5797b3935a | 1428:2540c05520f2 |
---|---|
772 #define VSRAM_DIRTY_BITS 0xF800 | 772 #define VSRAM_DIRTY_BITS 0xF800 |
773 | 773 |
774 //rough estimate of slot number at which border display starts | 774 //rough estimate of slot number at which border display starts |
775 #define BG_START_SLOT 6 | 775 #define BG_START_SLOT 6 |
776 | 776 |
777 void write_cram(vdp_context * context, uint16_t address, uint16_t value) | 777 void write_cram_internal(vdp_context * context, uint16_t addr, uint16_t value) |
778 { | 778 { |
779 uint16_t addr; | |
780 if (context->regs[REG_MODE_2] & BIT_MODE_5) { | |
781 addr = (address/2) & (CRAM_SIZE-1); | |
782 } else { | |
783 addr = address & 0x1F; | |
784 value = (value << 1 & 0xE) | (value << 2 & 0xE0) | (value & 0xE00); | |
785 } | |
786 context->cram[addr] = value; | 779 context->cram[addr] = value; |
787 context->colors[addr] = color_map[value & CRAM_BITS]; | 780 context->colors[addr] = color_map[value & CRAM_BITS]; |
788 context->colors[addr + CRAM_SIZE] = color_map[(value & CRAM_BITS) | FBUF_SHADOW]; | 781 context->colors[addr + CRAM_SIZE] = color_map[(value & CRAM_BITS) | FBUF_SHADOW]; |
789 context->colors[addr + CRAM_SIZE*2] = color_map[(value & CRAM_BITS) | FBUF_HILIGHT]; | 782 context->colors[addr + CRAM_SIZE*2] = color_map[(value & CRAM_BITS) | FBUF_HILIGHT]; |
790 context->colors[addr + CRAM_SIZE*3] = color_map[(value & CRAM_BITS) | FBUF_MODE4]; | 783 context->colors[addr + CRAM_SIZE*3] = color_map[(value & CRAM_BITS) | FBUF_MODE4]; |
784 } | |
785 | |
786 static void write_cram(vdp_context * context, uint16_t address, uint16_t value) | |
787 { | |
788 uint16_t addr; | |
789 if (context->regs[REG_MODE_2] & BIT_MODE_5) { | |
790 addr = (address/2) & (CRAM_SIZE-1); | |
791 } else { | |
792 addr = address & 0x1F; | |
793 value = (value << 1 & 0xE) | (value << 2 & 0xE0) | (value & 0xE00); | |
794 } | |
795 write_cram_internal(context, addr, value); | |
791 | 796 |
792 if (context->hslot >= BG_START_SLOT && ( | 797 if (context->hslot >= BG_START_SLOT && ( |
793 context->vcounter < context->inactive_start + context->border_bot | 798 context->vcounter < context->inactive_start + context->border_bot |
794 || context->vcounter > 0x200 - context->border_top | 799 || context->vcounter > 0x200 - context->border_top |
795 )) { | 800 )) { |