// insert cool lenghty disclaimer here // memory.c: ROM+RAM operations #include #include #include #include "config.h" #include "uart.h" #include "fpga.h" #include "crc16.h" #include "ff.h" #include "fileops.h" char* hex = "0123456789ABCDEF"; uint32_t load_rom(char* filename) { // TODO Mapper, Mirroring, Bankselect // snes_rom_properties_t romprops; set_avr_bank(0); AVR_ADDR_RESET(); SET_AVR_READ(); UINT bytes_read; DWORD filesize; file_open(filename, FA_READ); filesize = file_handle.fsize; if(file_res) return 0; // snes_rom_id(&romprops, &file_handle); for(;;) { bytes_read = file_read(); if (file_res || !bytes_read) break; for(int j=0; j>28)&0xf]); uart_putc(hex[(crc>>24)&0xf]); uart_putc(hex[(crc>>20)&0xf]); uart_putc(hex[(crc>>16)&0xf]); */ uart_putc(hex[(crc>>12)&0xf]); uart_putc(hex[(crc>>8)&0xf]); uart_putc(hex[(crc>>4)&0xf]); uart_putc(hex[(crc)&0xf]); uart_putcrlf(); return crc; }