home *** CD-ROM | disk | FTP | other *** search
- /* InitMem.c : Initialize Spectrum memory.
- *
- * Copyright 1996 Rui Fernando Ferreira Ribeiro.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
- /*
- * EmuZ80 v1.0
- * (c) 1996 Rui Fernando Ferreira Ribeiro
- *
- * -------------------------------------------------------
- *
- * INITEM.C : initialize z80 subsystem
- *
- */
-
- #include <windows.h>
- #include <string.h>
- #include <process.h>
- #include <stdlib.h>
- #include "env.h"
-
- char szROMPath[260];
-
- void init_emul(HINSTANCE hInst)
- {
- USHORT i = 0;
- WORD kernel;
-
-
- /* Open Z80 emulation with 64Kb of RAM */
- Init_Z80Emu((char *)NULL);
-
- /* init RAM with random values -- just to remember the good old
- days
- */
- srand(NULL);
- for(i=0x4000; i<0xFFFE; i++)
- writebyte(i, rand()/256);
-
- /* Find WSpecem directory (it isn't the default if the programmed was called with a double-
- click in a associated icon
- */
- GetModuleFileName(hInst, szROMPath, sizeof(szROMPath));
-
- i = strlen(szROMPath);
- while(szROMPath[i] != '\\')
- i--;
- szROMPath[i] = '\0'; /* Directory name */
-
- strcat(szROMPath, "\\spectrum.rom" );
-
- /* open rom file --- spectrum.rom */
- if(open_sna((LPSTR)szROMPath))
- {
- Panic("Couldn't open file spectrum.rom!");
- /* cleans screen address */
- for(i=0x4000; i<0xFFFE; i++)
- writebyte(i, 0);
- }
- }
-
- /* EOF: InitMem.c */
-