- small fixes for NetBSD and AmigaOS

This commit is contained in:
cebix 2000-07-22 16:00:36 +00:00
parent 006472eb44
commit 6fa6776184
11 changed files with 85 additions and 19 deletions

View File

@ -4,7 +4,7 @@
CC = gcc
CXX = c++
CXXFLAGS = -g -O1 -noixemul -m68020 -msmall-code -Wno-multichar
CPPFLAGS = -I../include -I.
CPPFLAGS = -I../include -I../native_cpu -I.
DEFS =
LDFLAGS = -noixemul
LIBS = /gg/lib/libnix/swapstack.o

View File

@ -183,7 +183,7 @@ _ExceptionHandlerAsm
pea 1$
move.w _EmulatedSR,d0
move.w d0,-(sp)
or.w #$0100,d0 ;Set interrupt level in SR
or.w #$2100,d0 ;Set interrupt level in SR
move.w d0,_EmulatedSR
move.l $64.w,a0 ;Jump to MacOS interrupt handler
jmp (a0)

View File

@ -610,7 +610,7 @@ void __saveds IllInstrHandler(trap_regs *r)
EmulatedSR |= 0x0700;
// Call opcode routine
EmulOp(*(uint16 *)(r->pc), (M68kRegisters *)r);
EmulOp(opcode, (M68kRegisters *)r);
r->pc += 2;
// Restore interrupts

View File

@ -30,20 +30,20 @@
#include "user_strings_amiga.h"
// Are the Mac and the host address space the same?
// Mac and host address space are the same
#define REAL_ADDRESSING 1
// Are we using a 68k emulator or the real thing?
// Using 68k natively
#define EMULATED_68K 0
// Is the Mac ROM write protected?
// Mac ROM is not write protected
#define ROM_IS_WRITE_PROTECTED 0
// ExtFS is supported
#define SUPPORTS_EXTFS 1
// mon is not supported
#define ENABLE_MON 0
#undef ENABLE_MON
// Data types
typedef unsigned char uint8;

View File

@ -214,7 +214,7 @@ void BasiliskII::StartEmulator(void)
char str[256];
#if REAL_ADDRESSING
// Open memory mess driver and remap low memory
// Open sheep driver and remap low memory
sheep_fd = open("/dev/sheep", 0);
if (sheep_fd < 0) {
sprintf(str, GetString(STR_NO_SHEEP_DRIVER_ERR), strerror(sheep_fd), sheep_fd);

View File

@ -36,17 +36,17 @@
#define WORDS_BIGENDIAN 1
#endif
// Are we using a 68k emulator or the real thing?
// Using 68k emulator
#define EMULATED_68K 1
// Is the Mac ROM write protected?
// Mac ROM is write protected
#define ROM_IS_WRITE_PROTECTED 1
// ExtFS is supported
#define SUPPORTS_EXTFS 1
// mon is not supported
#define ENABLE_MON 0
#undef ENABLE_MON
// Time data type for Time Manager emulation
typedef bigtime_t tm_time_t;

View File

@ -42,7 +42,7 @@
#include "extfs.h"
#include "emul_op.h"
#if ENABLE_MON
#ifdef ENABLE_MON
#include "mon.h"
#endif
@ -68,7 +68,7 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
r->d[0], r->d[1], r->d[2], r->d[3], r->d[4], r->d[5], r->d[6], r->d[7],
r->a[0], r->a[1], r->a[2], r->a[3], r->a[4], r->a[5], r->a[6], r->a[7],
r->sr);
#if ENABLE_MON
#ifdef ENABLE_MON
char *arg[2] = {"rmon", NULL};
mon(1, arg);
#endif
@ -196,8 +196,8 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
break;
case M68K_EMUL_OP_FIX_BOOTSTACK: // Set boot stack to 3/4 of RAM (7.5)
D(bug("Fix boot stack\n"));
r->a[1] = RAMBaseMac + RAMSize * 3 / 4;
D(bug("Fix boot stack %08x\n", r->a[1]));
break;
case M68K_EMUL_OP_FIX_MEMSIZE: { // Set correct logical and physical memory size
@ -510,7 +510,7 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
r->d[0], r->d[1], r->d[2], r->d[3], r->d[4], r->d[5], r->d[6], r->d[7],
r->a[0], r->a[1], r->a[2], r->a[3], r->a[4], r->a[5], r->a[6], r->a[7],
r->sr);
#if ENABLE_MON
#ifdef ENABLE_MON
char *arg[2] = {"rmon", NULL};
mon(1, arg);
#endif

View File

@ -54,6 +54,7 @@ extern void VideoExit(void);
extern void VideoQuitFullScreen(void);
extern void VideoInterrupt(void);
extern void VideoRefresh(void);
extern void video_set_palette(uint8 *pal);

View File

@ -0,0 +1,65 @@
/*
* cpu_emulation.h - Definitions for Basilisk II CPU emulation module (native 68k version)
*
* Basilisk II (C) 1997-2000 Christian Bauer
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef CPU_EMULATION_H
#define CPU_EMULATION_H
/*
* Memory system
*/
// RAM and ROM pointers (allocated and set by main_*.cpp)
extern uint32 RAMBaseMac; // RAM base (Mac address space), does not include Low Mem when != 0
extern uint8 *RAMBaseHost; // RAM base (host address space)
extern uint32 RAMSize; // Size of RAM
extern uint32 ROMBaseMac; // ROM base (Mac address space)
extern uint8 *ROMBaseHost; // ROM base (host address space)
extern uint32 ROMSize; // Size of ROM
// Mac memory access functions
static inline uint32 ReadMacInt32(uint32 addr) {return *(uint32 *)addr;}
static inline uint32 ReadMacInt16(uint32 addr) {return *(uint16 *)addr;}
static inline uint32 ReadMacInt8(uint32 addr) {return *(uint8 *)addr;}
static inline void WriteMacInt32(uint32 addr, uint32 l) {*(uint32 *)addr = l;}
static inline void WriteMacInt16(uint32 addr, uint32 w) {*(uint16 *)addr = w;}
static inline void WriteMacInt8(uint32 addr, uint32 b) {*(uint8 *)addr = b;}
static inline uint8 *Mac2HostAddr(uint32 addr) {return (uint8 *)addr;}
static inline void *Mac_memset(uint32 addr, int c, size_t n) {return memset(Mac2HostAddr(addr), c, n);}
static inline void *Mac2Host_memcpy(void *dest, uint32 src, size_t n) {return memcpy(dest, Mac2HostAddr(src), n);}
static inline void *Host2Mac_memcpy(uint32 dest, const void *src, size_t n) {return memcpy(Mac2HostAddr(dest), src, n);}
static inline void *Mac2Mac_memcpy(uint32 dest, uint32 src, size_t n) {return memcpy(Mac2HostAddr(dest), Mac2HostAddr(src), n);}
/*
* 680x0 emulation
*/
// 680x0 emulation functions
struct M68kRegisters;
extern void Start680x0(void); // Reset and start 680x0
extern "C" void Execute68k(uint32 addr, M68kRegisters *r); // Execute 68k code from EMUL_OP routine
extern "C" void Execute68kTrap(uint16 trap, M68kRegisters *r); // Execute MacOS 68k trap from EMUL_OP routine
// Interrupt functions
extern void TriggerInterrupt(void); // Trigger interrupt (InterruptFlag must be set first)
#endif

View File

@ -693,7 +693,7 @@ static const uint8 adbop_patch[] = { // Call ADBOp() completion procedure
void InstallDrivers(uint32 pb)
{
D(bug("InstallDrivers\n"));
D(bug("InstallDrivers, pb %08x\n", pb));
M68kRegisters r;
// Install Microseconds() replacement routine
@ -1215,7 +1215,7 @@ static bool patch_rom_32(void)
#endif
#if !ROM_IS_WRITE_PROTECTED
#if defined(AMIGA)
#if defined(AMIGA) || defined(__NetBSD__)
// Set fake handle at 0x0000 to scratch memory area (so broken Mac programs won't write into Mac ROM)
extern uint32 ScratchMem;
wp = (uint16 *)(ROMBaseHost + 0xccaa);

View File

@ -89,7 +89,7 @@ void CheckLoad(uint32 type, int16 id, uint8 *p, uint32 size)
if (base) {
p16 = (uint16 *)(p + base);
#if defined(AMIGA)
#if defined(AMIGA) || defined(__NetBSD__)
// Set 0x0000 to scratch memory area
extern uint32 ScratchMem;
*p16++ = htons(0x207c); // move.l #ScratchMem,a0
@ -113,7 +113,7 @@ void CheckLoad(uint32 type, int16 id, uint8 *p, uint32 size)
if (base) {
p16 = (uint16 *)(p + base);
#if defined(AMIGA)
#if defined(AMIGA) || defined(__NetBSD__)
// Set 0x0000 to scratch memory area
extern uint32 ScratchMem;
*p16++ = htons(0x207c); // move.l #ScratchMem,a0