got the old GUI compiling with Retro68

can't load a ROM because Standard File isn't loaded?
This commit is contained in:
Matt Laux 2019-04-17 02:36:49 -05:00
parent 5ebfc9c338
commit 1bd3dc8e28
4 changed files with 25 additions and 13 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ emu
*.img
vMac*
.vscode
build

6
CMakeLists.txt Normal file
View File

@ -0,0 +1,6 @@
add_application(Emulator
src/old/emulator.c
src/old/mem_model.c
src/old/z80.c
resources.r
)

View File

@ -8,6 +8,11 @@
#include <Windows.h>
#include <Quickdraw.h>
#include <StandardFile.h>
#include <Dialogs.h>
#include <Menus.h>
#include <ToolUtils.h>
#include <Devices.h>
#include <Memory.h>
#include "gb_types.h"
#include "z80.h"
@ -66,7 +71,7 @@ bool LoadRom(FSSpec *fp)
if(theState.rom != NULL) {
// unload existing ROM
DisposPtr((char *) theState.rom);
free((char *) theState.rom);
theState.romLength = 0;
}
@ -77,7 +82,7 @@ bool LoadRom(FSSpec *fp)
}
GetEOF(fileNo, (long *) &theState.romLength);
theState.rom = (unsigned char *) NewPtr(theState.romLength);
theState.rom = (unsigned char *) malloc(theState.romLength);
if(theState.rom == NULL) {
Alert(ALRT_NOT_ENOUGH_RAM, NULL);
return false;
@ -117,7 +122,7 @@ void ShowAboutBox(void)
while(!GetNextEvent(mDownMask, &e));
while(WaitMouseUp());
DisposDialog(dp);
DisposeDialog(dp);
}
// -- EVENT FUNCTIONS --
@ -202,4 +207,4 @@ int main(int argc, char *argv[])
}
return 0;
}
}

View File

@ -69,10 +69,10 @@ z80_state *z80_create(void)
{
z80_state *state;
state = (z80_state *) NewPtr(sizeof(z80_state));
state = (z80_state *) malloc(sizeof(z80_state));
state->regs = (z80_regs *) NewPtr(sizeof(z80_regs));
state->ram = (u8 *) NewPtr(GB_RAM_SIZE);
state->regs = (z80_regs *) malloc(sizeof(z80_regs));
state->ram = (u8 *) malloc(GB_RAM_SIZE);
state->regs->pc = 0;
return state;
@ -80,9 +80,9 @@ z80_state *z80_create(void)
void z80_destroy(z80_state *state)
{
DisposPtr((char *) state->regs);
DisposPtr((char *) state->ram);
DisposPtr((char *) state);
free((char *) state->regs);
free((char *) state->ram);
free((char *) state);
}
void z80_dump_regs(z80_state *state)
@ -100,8 +100,8 @@ void z80_dump_regs(z80_state *state)
line3[0] = strlen(line3);
line4[0] = strlen(line4);
ParamText((void *) line1, (void *) line2, (void *) line3, (void *) line4);
Alert(129, NULL);
//ParamText((void *) line1, (void *) line2, (void *) line3, (void *) line4);
//Alert(129, NULL);
}
#define load(dst, src) ((dst) = (src))
@ -300,4 +300,4 @@ void z80_run(z80_state *state)
}
}
}
}