mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-02-18 12:30:33 +00:00
- some cleanups in the AmigaOS code
This commit is contained in:
parent
2bebaceabc
commit
d4a1463279
@ -75,8 +75,6 @@ uint32 ROMBaseMac; // ROM base (Mac address space)
|
|||||||
uint8 *ROMBaseHost; // ROM base (host address space)
|
uint8 *ROMBaseHost; // ROM base (host address space)
|
||||||
uint32 ROMSize; // Size of ROM
|
uint32 ROMSize; // Size of ROM
|
||||||
|
|
||||||
uint32 MacsBugFlags = 0xbff;
|
|
||||||
|
|
||||||
|
|
||||||
// CPU and FPU type, addressing mode
|
// CPU and FPU type, addressing mode
|
||||||
int CPUType;
|
int CPUType;
|
||||||
@ -245,18 +243,13 @@ int main(void)
|
|||||||
RAMSize = 1024*1024;
|
RAMSize = 1024*1024;
|
||||||
}
|
}
|
||||||
RAMBaseHost = (uint8 *)AllocVec(RAMSize + 0x100000, MEMF_PUBLIC);
|
RAMBaseHost = (uint8 *)AllocVec(RAMSize + 0x100000, MEMF_PUBLIC);
|
||||||
// if (RAMBaseHost == NULL) {
|
if (RAMBaseHost == NULL) {
|
||||||
// ErrorAlert(GetString(STR_NO_MEM_ERR));
|
|
||||||
// QuitEmulator();
|
|
||||||
// }
|
|
||||||
if (RAMBaseHost == NULL)
|
|
||||||
{
|
|
||||||
uint32 newRAMSize = AvailMem(MEMF_LARGEST) - 0x100000;
|
uint32 newRAMSize = AvailMem(MEMF_LARGEST) - 0x100000;
|
||||||
char xText[120];
|
char xText[120];
|
||||||
|
|
||||||
sprintf(xText, GetString(STR_NOT_ENOUGH_MEM_WARN), RAMSize, newRAMSize);
|
sprintf(xText, GetString(STR_NOT_ENOUGH_MEM_WARN), RAMSize, newRAMSize);
|
||||||
|
|
||||||
if (1 != ChoiceAlert(xText, "Use", "Quit"))
|
if (ChoiceAlert(xText, "Use", "Quit") != 1)
|
||||||
QuitEmulator();
|
QuitEmulator();
|
||||||
|
|
||||||
RAMSize = newRAMSize;
|
RAMSize = newRAMSize;
|
||||||
@ -265,7 +258,7 @@ int main(void)
|
|||||||
ErrorAlert(GetString(STR_NO_MEM_ERR));
|
ErrorAlert(GetString(STR_NO_MEM_ERR));
|
||||||
QuitEmulator();
|
QuitEmulator();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RAMBaseMac = (uint32)RAMBaseHost;
|
RAMBaseMac = (uint32)RAMBaseHost;
|
||||||
D(bug("Mac RAM starts at %08lx\n", RAMBaseHost));
|
D(bug("Mac RAM starts at %08lx\n", RAMBaseHost));
|
||||||
ROMBaseHost = RAMBaseHost + RAMSize;
|
ROMBaseHost = RAMBaseHost + RAMSize;
|
||||||
@ -332,7 +325,7 @@ int main(void)
|
|||||||
// Set task priority to -1 so we don't use all processing time
|
// Set task priority to -1 so we don't use all processing time
|
||||||
SetTaskPri(MainTask, -1);
|
SetTaskPri(MainTask, -1);
|
||||||
|
|
||||||
WriteMacInt32(MacsBugFlags, 0);
|
WriteMacInt32(0xbff, 0); // MacsBugFlags
|
||||||
|
|
||||||
// Swap stack to Mac RAM area
|
// Swap stack to Mac RAM area
|
||||||
stack_swap.stk_Lower = RAMBaseHost;
|
stack_swap.stk_Lower = RAMBaseHost;
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include <libraries/asl.h>
|
#include <libraries/asl.h>
|
||||||
#include <libraries/gtlayout.h>
|
#include <libraries/gtlayout.h>
|
||||||
#include <libraries/Picasso96.h>
|
#include <libraries/Picasso96.h>
|
||||||
#include <cybergraphx/cybergraphics.h> // jl
|
#include <cybergraphx/cybergraphics.h>
|
||||||
#include <graphics/displayinfo.h>
|
#include <graphics/displayinfo.h>
|
||||||
#include <devices/ahi.h>
|
#include <devices/ahi.h>
|
||||||
#include <proto/exec.h>
|
#include <proto/exec.h>
|
||||||
@ -38,7 +38,7 @@
|
|||||||
#include <proto/graphics.h>
|
#include <proto/graphics.h>
|
||||||
#include <proto/asl.h>
|
#include <proto/asl.h>
|
||||||
#include <proto/Picasso96.h>
|
#include <proto/Picasso96.h>
|
||||||
#include <proto/cybergraphics.h> // jl
|
#include <proto/cybergraphics.h>
|
||||||
#include <proto/ahi.h>
|
#include <proto/ahi.h>
|
||||||
|
|
||||||
#include "sysdeps.h"
|
#include "sysdeps.h"
|
||||||
@ -533,7 +533,7 @@ quit:
|
|||||||
FreeAslRequest(dev_request);
|
FreeAslRequest(dev_request);
|
||||||
FreeAslRequest(file_request);
|
FreeAslRequest(file_request);
|
||||||
|
|
||||||
// Delete Menus jl
|
// Delete Menus
|
||||||
LT_DisposeMenu(menu);
|
LT_DisposeMenu(menu);
|
||||||
|
|
||||||
// Delete handle
|
// Delete handle
|
||||||
@ -1271,24 +1271,21 @@ static void screen_mode_req(struct Window *win, struct LayoutHandle *h)
|
|||||||
|
|
||||||
ULONG id;
|
ULONG id;
|
||||||
|
|
||||||
if (CyberGfxBase)
|
// Try P96 first, because it also provides a (fake) cybergraphics.library
|
||||||
{
|
if (P96Base) {
|
||||||
UWORD ModelArray[] = { PIXFMT_LUT8, PIXFMT_RGB15, PIXFMT_ARGB32, 0, ~0 };
|
|
||||||
|
|
||||||
id = (ULONG) CModeRequestTags(NULL,
|
|
||||||
CYBRMREQ_MinDepth, 8,
|
|
||||||
CYBRMREQ_CModelArray, (ULONG) ModelArray,
|
|
||||||
TAG_END
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
id = p96RequestModeIDTags(
|
id = p96RequestModeIDTags(
|
||||||
P96MA_MinDepth, 8,
|
P96MA_MinDepth, 8,
|
||||||
P96MA_FormatsAllowed, RGBFF_CLUT | RGBFF_R5G5B5 | RGBFF_A8R8G8B8,
|
P96MA_FormatsAllowed, RGBFF_CLUT | RGBFF_R5G5B5 | RGBFF_A8R8G8B8,
|
||||||
TAG_END
|
TAG_END
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
|
UWORD ModelArray[] = { PIXFMT_LUT8, PIXFMT_RGB15, PIXFMT_ARGB32, 0, ~0 };
|
||||||
|
id = (ULONG) CModeRequestTags(NULL,
|
||||||
|
CYBRMREQ_MinDepth, 8,
|
||||||
|
CYBRMREQ_CModelArray, (ULONG) ModelArray,
|
||||||
|
TAG_END
|
||||||
|
);
|
||||||
|
}
|
||||||
LT_UnlockWindow(win);
|
LT_UnlockWindow(win);
|
||||||
|
|
||||||
if (id != INVALID_ID) {
|
if (id != INVALID_ID) {
|
||||||
@ -1469,13 +1466,11 @@ static void parse_serial_prefs(void)
|
|||||||
ether_unit = 0;
|
ether_unit = 0;
|
||||||
|
|
||||||
const char *str = PrefsFindString("ether");
|
const char *str = PrefsFindString("ether");
|
||||||
if (str)
|
if (str) {
|
||||||
{
|
|
||||||
const char *FirstSlash = strchr(str, '/');
|
const char *FirstSlash = strchr(str, '/');
|
||||||
const char *LastSlash = strrchr(str, '/');
|
const char *LastSlash = strrchr(str, '/');
|
||||||
|
|
||||||
if (FirstSlash && FirstSlash && FirstSlash != LastSlash)
|
if (FirstSlash && FirstSlash && FirstSlash != LastSlash) {
|
||||||
{
|
|
||||||
// Device name contains path, i.e. "Networks/xyzzy.device"
|
// Device name contains path, i.e. "Networks/xyzzy.device"
|
||||||
const char *lp = str;
|
const char *lp = str;
|
||||||
char *dp = ether_dev;
|
char *dp = ether_dev;
|
||||||
@ -1487,12 +1482,10 @@ static void parse_serial_prefs(void)
|
|||||||
sscanf(LastSlash, "/%ld", ðer_unit);
|
sscanf(LastSlash, "/%ld", ðer_unit);
|
||||||
|
|
||||||
// printf("dev=<%s> unit=%d\n", ether_dev, ether_unit);
|
// printf("dev=<%s> unit=%d\n", ether_dev, ether_unit);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
sscanf(str, "%[^/]/%ld", ether_dev, ðer_unit);
|
sscanf(str, "%[^/]/%ld", ether_dev, ðer_unit);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set serial preference item
|
// Set serial preference item
|
||||||
|
@ -655,14 +655,13 @@ static __saveds void periodic_func(void)
|
|||||||
case IDCMP_RAWKEY:
|
case IDCMP_RAWKEY:
|
||||||
if (qualifier & IEQUALIFIER_REPEAT) // Keyboard repeat is done by MacOS
|
if (qualifier & IEQUALIFIER_REPEAT) // Keyboard repeat is done by MacOS
|
||||||
break;
|
break;
|
||||||
if ((IEQUALIFIER_LALT | IEQUALIFIER_LSHIFT | IEQUALIFIER_CONTROL) ==
|
if ((qualifier & (IEQUALIFIER_LALT | IEQUALIFIER_LSHIFT | IEQUALIFIER_CONTROL)) ==
|
||||||
(qualifier & (IEQUALIFIER_LALT | IEQUALIFIER_LSHIFT | IEQUALIFIER_CONTROL))
|
(IEQUALIFIER_LALT | IEQUALIFIER_LSHIFT | IEQUALIFIER_CONTROL))
|
||||||
&& 0x5f == code)
|
&& code == 0x5f) {
|
||||||
{
|
|
||||||
SetInterruptFlag(INTFLAG_NMI);
|
SetInterruptFlag(INTFLAG_NMI);
|
||||||
TriggerInterrupt();
|
TriggerInterrupt();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code & IECODE_UP_PREFIX)
|
if (code & IECODE_UP_PREFIX)
|
||||||
ADBKeyUp(keycode2mac[code & 0x7f]);
|
ADBKeyUp(keycode2mac[code & 0x7f]);
|
||||||
|
@ -265,7 +265,7 @@ extern void MountVolume(void *fh); // Mount volume with given file handle (s
|
|||||||
extern void FileDiskLayout(loff_t size, uint8 *data, loff_t &start_byte, loff_t &real_size); // Calculate disk image file layout given file size and first 256 data bytes
|
extern void FileDiskLayout(loff_t size, uint8 *data, loff_t &start_byte, loff_t &real_size); // Calculate disk image file layout given file size and first 256 data bytes
|
||||||
extern uint32 DebugUtil(uint32 Selector); // DebugUtil() Replacement
|
extern uint32 DebugUtil(uint32 Selector); // DebugUtil() Replacement
|
||||||
|
|
||||||
// Construct four-character-code from string
|
// Construct four-character-code
|
||||||
#define FOURCC(a,b,c,d) (((uint32)(a) << 24) | ((uint32)(b) << 16) | ((uint32)(c) << 8) | (uint32)(d))
|
#define FOURCC(a,b,c,d) (((uint32)(a) << 24) | ((uint32)(b) << 16) | ((uint32)(c) << 8) | (uint32)(d))
|
||||||
|
|
||||||
// Emulator identification codes (4 and 2 characters)
|
// Emulator identification codes (4 and 2 characters)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user