#define VUEAPI #include /***************************************************************************** * Constants * *****************************************************************************/ /* Memory access type sizes */ static const int TYPE_SIZES[] = { 1, 1, 2, 2, 4 }; /***************************************************************************** * Component Includes * *****************************************************************************/ #include "bus.c" /***************************************************************************** * Library Functions * *****************************************************************************/ /* Prepare an emulation state context for use */ void vueInitialize(VUE *vue) { vue->rom = NULL; vue->sram = NULL; } /* Perform a read operation */ vbool vueRead(VUE *vue, uint32_t address, uint8_t *data, uint32_t length) { uint32_t count; /* Bytes to read in one iteration */ /* Error checking */ if ( vue == NULL || data == NULL || length > 0x01000000 ) return VUE_FALSE; /* Perform the operation */ for (; length > 0; address += count, length -= count, data += count) { /* Determine the maximum number of bytes to process at once */ count = 0x01000000 - (address & 0x00FFFFFF); if (count > length) count = length; /* Process by component */ switch (address >> 24 & 7) { /* case 7: ROM, etc */ } }; return VUE_TRUE; } /* Specify a new ROM buffer */ vbool vueSetROM(VUE *vue, uint8_t *rom, uint32_t size) { /* Error checking */ if ( vue == NULL || rom == NULL || size < 1024 || size > 0x01000000 || (size & (size - 1)) != 0 ) return VUE_FALSE; /* Accept the new ROM buffer */ vue->rom = rom; vue->rom_size = size; return VUE_TRUE; }