mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-20 15:31:22 +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)
|
||||
uint32 ROMSize; // Size of ROM
|
||||
|
||||
uint32 MacsBugFlags = 0xbff;
|
||||
|
||||
|
||||
// CPU and FPU type, addressing mode
|
||||
int CPUType;
|
||||
@ -245,18 +243,13 @@ int main(void)
|
||||
RAMSize = 1024*1024;
|
||||
}
|
||||
RAMBaseHost = (uint8 *)AllocVec(RAMSize + 0x100000, MEMF_PUBLIC);
|
||||
// if (RAMBaseHost == NULL) {
|
||||
// ErrorAlert(GetString(STR_NO_MEM_ERR));
|
||||
// QuitEmulator();
|
||||
// }
|
||||
if (RAMBaseHost == NULL)
|
||||
{
|
||||
if (RAMBaseHost == NULL) {
|
||||
uint32 newRAMSize = AvailMem(MEMF_LARGEST) - 0x100000;
|
||||
char xText[120];
|
||||
|
||||
sprintf(xText, GetString(STR_NOT_ENOUGH_MEM_WARN), RAMSize, newRAMSize);
|
||||
|
||||
if (1 != ChoiceAlert(xText, "Use", "Quit"))
|
||||
if (ChoiceAlert(xText, "Use", "Quit") != 1)
|
||||
QuitEmulator();
|
||||
|
||||
RAMSize = newRAMSize;
|
||||
@ -265,7 +258,7 @@ int main(void)
|
||||
ErrorAlert(GetString(STR_NO_MEM_ERR));
|
||||
QuitEmulator();
|
||||
}
|
||||
}
|
||||
}
|
||||
RAMBaseMac = (uint32)RAMBaseHost;
|
||||
D(bug("Mac RAM starts at %08lx\n", RAMBaseHost));
|
||||
ROMBaseHost = RAMBaseHost + RAMSize;
|
||||
@ -332,7 +325,7 @@ int main(void)
|
||||
// Set task priority to -1 so we don't use all processing time
|
||||
SetTaskPri(MainTask, -1);
|
||||
|
||||
WriteMacInt32(MacsBugFlags, 0);
|
||||
WriteMacInt32(0xbff, 0); // MacsBugFlags
|
||||
|
||||
// Swap stack to Mac RAM area
|
||||
stack_swap.stk_Lower = RAMBaseHost;
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <libraries/asl.h>
|
||||
#include <libraries/gtlayout.h>
|
||||
#include <libraries/Picasso96.h>
|
||||
#include <cybergraphx/cybergraphics.h> // jl
|
||||
#include <cybergraphx/cybergraphics.h>
|
||||
#include <graphics/displayinfo.h>
|
||||
#include <devices/ahi.h>
|
||||
#include <proto/exec.h>
|
||||
@ -38,7 +38,7 @@
|
||||
#include <proto/graphics.h>
|
||||
#include <proto/asl.h>
|
||||
#include <proto/Picasso96.h>
|
||||
#include <proto/cybergraphics.h> // jl
|
||||
#include <proto/cybergraphics.h>
|
||||
#include <proto/ahi.h>
|
||||
|
||||
#include "sysdeps.h"
|
||||
@ -533,7 +533,7 @@ quit:
|
||||
FreeAslRequest(dev_request);
|
||||
FreeAslRequest(file_request);
|
||||
|
||||
// Delete Menus jl
|
||||
// Delete Menus
|
||||
LT_DisposeMenu(menu);
|
||||
|
||||
// Delete handle
|
||||
@ -1271,24 +1271,21 @@ static void screen_mode_req(struct Window *win, struct LayoutHandle *h)
|
||||
|
||||
ULONG id;
|
||||
|
||||
if (CyberGfxBase)
|
||||
{
|
||||
UWORD ModelArray[] = { PIXFMT_LUT8, PIXFMT_RGB15, PIXFMT_ARGB32, 0, ~0 };
|
||||
|
||||
id = (ULONG) CModeRequestTags(NULL,
|
||||
CYBRMREQ_MinDepth, 8,
|
||||
CYBRMREQ_CModelArray, (ULONG) ModelArray,
|
||||
TAG_END
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Try P96 first, because it also provides a (fake) cybergraphics.library
|
||||
if (P96Base) {
|
||||
id = p96RequestModeIDTags(
|
||||
P96MA_MinDepth, 8,
|
||||
P96MA_FormatsAllowed, RGBFF_CLUT | RGBFF_R5G5B5 | RGBFF_A8R8G8B8,
|
||||
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);
|
||||
|
||||
if (id != INVALID_ID) {
|
||||
@ -1469,13 +1466,11 @@ static void parse_serial_prefs(void)
|
||||
ether_unit = 0;
|
||||
|
||||
const char *str = PrefsFindString("ether");
|
||||
if (str)
|
||||
{
|
||||
if (str) {
|
||||
const char *FirstSlash = strchr(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"
|
||||
const char *lp = str;
|
||||
char *dp = ether_dev;
|
||||
@ -1487,12 +1482,10 @@ static void parse_serial_prefs(void)
|
||||
sscanf(LastSlash, "/%ld", ðer_unit);
|
||||
|
||||
// printf("dev=<%s> unit=%d\n", ether_dev, ether_unit);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
sscanf(str, "%[^/]/%ld", ether_dev, ðer_unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set serial preference item
|
||||
|
@ -655,14 +655,13 @@ static __saveds void periodic_func(void)
|
||||
case IDCMP_RAWKEY:
|
||||
if (qualifier & IEQUALIFIER_REPEAT) // Keyboard repeat is done by MacOS
|
||||
break;
|
||||
if ((IEQUALIFIER_LALT | IEQUALIFIER_LSHIFT | IEQUALIFIER_CONTROL) ==
|
||||
(qualifier & (IEQUALIFIER_LALT | IEQUALIFIER_LSHIFT | IEQUALIFIER_CONTROL))
|
||||
&& 0x5f == code)
|
||||
{
|
||||
if ((qualifier & (IEQUALIFIER_LALT | IEQUALIFIER_LSHIFT | IEQUALIFIER_CONTROL)) ==
|
||||
(IEQUALIFIER_LALT | IEQUALIFIER_LSHIFT | IEQUALIFIER_CONTROL))
|
||||
&& code == 0x5f) {
|
||||
SetInterruptFlag(INTFLAG_NMI);
|
||||
TriggerInterrupt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (code & IECODE_UP_PREFIX)
|
||||
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 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))
|
||||
|
||||
// Emulator identification codes (4 and 2 characters)
|
||||
|
Loading…
Reference in New Issue
Block a user