Merge pull request #93 from davidgfnet/master

More cleanups (mostly whitespace and unused stuff)
This commit is contained in:
Autechre 2021-02-15 22:30:27 +01:00 committed by GitHub
commit 300d0c0028
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 431 additions and 465 deletions

View File

@ -311,9 +311,9 @@ u16 palette_ram_converted[512];
u16 io_registers[1024 * 16]; u16 io_registers[1024 * 16];
u8 ewram[1024 * 256 * 2]; u8 ewram[1024 * 256 * 2];
u8 iwram[1024 * 32 * 2]; u8 iwram[1024 * 32 * 2];
u8 vram[1024 * 96 * 2]; u8 vram[1024 * 96];
u8 bios_rom[1024 * 32]; u8 bios_rom[1024 * 16 * 2];
u32 bios_read_protect; u32 bios_read_protect;
// Up to 128kb, store SRAM, flash ROM, or EEPROM here. // Up to 128kb, store SRAM, flash ROM, or EEPROM here.
@ -3144,16 +3144,6 @@ cpu_alert_type dma_transfer(dma_transfer_type *dma)
memory_map_##type[map_offset + 3] = vram + (0x8000 * 2); \ memory_map_##type[map_offset + 3] = vram + (0x8000 * 2); \
} \ } \
#define map_vram_firstpage(type) \
for(map_offset = 0x6000000 / 0x8000; map_offset < (0x7000000 / 0x8000); \
map_offset += 4) \
{ \
memory_map_##type[map_offset] = vram; \
memory_map_##type[map_offset + 1] = NULL; \
memory_map_##type[map_offset + 2] = NULL; \
memory_map_##type[map_offset + 3] = NULL; \
} \
// Picks a page to evict // Picks a page to evict
u32 page_time = 0; u32 page_time = 0;
@ -3331,6 +3321,7 @@ void init_memory(void)
// This is because VRAM cannot be efficiently made incontiguous, and still allow // This is because VRAM cannot be efficiently made incontiguous, and still allow
// the renderer to work as efficiently. It would, at the very least, require a // the renderer to work as efficiently. It would, at the very least, require a
// lot of hacking of the renderer which I'm not prepared to do. // lot of hacking of the renderer which I'm not prepared to do.
// TODO(davidgfnet): add SMC VRAM detection
// However, it IS possible to directly map the first page no matter what because // However, it IS possible to directly map the first page no matter what because
// there's 32kb of blank stuff sitting beneath it. // there's 32kb of blank stuff sitting beneath it.

View File

@ -196,16 +196,16 @@ extern u32 gbc_sound_update;
extern u32 gbc_sound_wave_update; extern u32 gbc_sound_wave_update;
extern dma_transfer_type dma[4]; extern dma_transfer_type dma[4];
extern u32 bios_read_protect;
extern u16 palette_ram[512]; extern u16 palette_ram[512];
extern u16 oam_ram[512]; extern u16 oam_ram[512];
extern u16 palette_ram_converted[512]; extern u16 palette_ram_converted[512];
extern u16 io_registers[1024 * 16]; extern u16 io_registers[1024 * 16];
extern u8 vram[1024 * 96];
// Double buffer used for SMC detection
extern u8 bios_rom[1024 * 16 * 2];
extern u8 ewram[1024 * 256 * 2]; extern u8 ewram[1024 * 256 * 2];
extern u8 iwram[1024 * 32 * 2]; extern u8 iwram[1024 * 32 * 2];
extern u8 vram[1024 * 96 * 2];
extern u8 bios_rom[1024 * 32];
extern u32 bios_read_protect;
extern u8 *memory_map_read[8 * 1024]; extern u8 *memory_map_read[8 * 1024];
extern u32 *reg; extern u32 *reg;

View File

@ -2807,31 +2807,6 @@ ext_store_u32a_jtable:
.long ext_store_ignore # 0x0D EEPROM (nothing will write this) .long ext_store_ignore # 0x0D EEPROM (nothing will write this)
.long ext_store_ignore # 0x0E Flash ROM/SRAM .long ext_store_ignore # 0x0E Flash ROM/SRAM
ext_aligned_store32:
srl $1, $4, 24 # $1 = address >> 24
sltu $2, $1, 16 # check if the value is out of range
beq $2, $0, ext_store_ignore
sll $1, $1, 2 # make address word indexed (delay)
lui $2, %hi(ext_store_u32a_jtable)
addu $2, $2, $1
# $2 = ext_store_u32a_jtable[address >> 24]
lw $2, %lo(ext_store_u32a_jtable)($2)
jr $2 # jump to table location
nop
#execute_aligned_store32:
srl $2, $4, 28 # check if the address is out of range
bne $2, $0, ext_aligned_store32 # if it is, perform an extended load
srl $1, $4, 15 # $1 = page number of address
sll $1, $1, 2 # adjust to word index
addu $1, $1, $16 # $1 = memory_map_write[address >> 15]
lw $1, 256($1)
beq $1, $0, ext_aligned_store32 # if it's NULL perform an extended write
andi $2, $4, 0x7FFF # $2 = low 15bits of address (delay slot)
addu $1, $1, $2 # add the memory map offset
jr $ra # return
sw $5, ($1) # write the value
smc_write: smc_write:
save_registers save_registers
jal flush_translation_cache_ram # flush translation cache jal flush_translation_cache_ram # flush translation cache