Skip to content

Commit

Permalink
Allocating genesis
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioMartin86 committed Apr 8, 2024
1 parent 5b55633 commit 7703290
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
12 changes: 6 additions & 6 deletions core/genesis.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
#include "shared.h"

external_t ext;
uint8 boot_rom[0x800]; /* Genesis BOOT ROM */
uint8 work_ram[0x10000]; /* 68K RAM */
uint8 zram[0x2000]; /* Z80 RAM */
uint8* boot_rom; /* Genesis BOOT ROM */
uint8* work_ram; /* 68K RAM */
uint8* zram; /* Z80 RAM */
uint32 zbank; /* Z80 bank window address */
uint8 zstate; /* Z80 bus state (d0 = /RESET, d1 = BUSREQ, d2 = WAIT) */
uint8 pico_current; /* PICO current page */
Expand Down Expand Up @@ -248,8 +248,8 @@ void gen_reset(int hard_reset)
m68k.cycles = ((lines_per_frame - 192 + 159 - (27 * vdp_pal)) * MCYCLES_PER_LINE) + 1004;

/* clear RAM (on real hardware, RAM values are random / undetermined on Power ON) */
memset(work_ram, 0x00, sizeof (work_ram));
memset(zram, 0x00, sizeof (zram));
memset(work_ram, 0x00, 0x10000);
memset(zram, 0x00, 0x2000);
}
else
{
Expand Down Expand Up @@ -339,7 +339,7 @@ void gen_reset(int hard_reset)
if ((system_hw == SYSTEM_MARKIII) || ((system_hw & SYSTEM_SMS) && (region_code == REGION_JAPAN_NTSC)))
{
/* some korean games rely on RAM to be initialized with values different from $00 or $ff */
memset(work_ram, 0xf0, sizeof(work_ram));
memset(work_ram, 0xf0, 0x10000);
}

/* reset cartridge hardware */
Expand Down
6 changes: 3 additions & 3 deletions core/genesis.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ typedef union

/* Global variables */
extern external_t ext;
extern uint8 boot_rom[0x800];
extern uint8 work_ram[0x10000];
extern uint8 zram[0x2000];
extern uint8* boot_rom;
extern uint8* work_ram;
extern uint8* zram;
extern uint32 zbank;
extern uint8 zstate;
extern uint8 pico_current;
Expand Down
6 changes: 6 additions & 0 deletions testbed/new/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,12 @@ void initialize ()
SZHVC_add = (UINT8* ) calloc(sizeof(UINT8), 2*256*256);
SZHVC_sub = (UINT8* ) calloc(sizeof(UINT8), 2*256*256);

// genesis.h

boot_rom = (uint8*) calloc(sizeof(uint8), 0x800);
work_ram = (uint8*) calloc(sizeof(uint8), 0x10000);
zram = (uint8*) calloc(sizeof(uint8), 0x2000);

/* set default config */
set_config_defaults();

Expand Down

0 comments on commit 7703290

Please sign in to comment.