Merge remote-tracking branch 'cebix/master' into kanjitalk755/master
This commit is contained in:
commit
0c8529eca1
|
@ -1,3 +1,3 @@
|
|||
/* Localized versions of Info.plist keys */
|
||||
|
||||
NSHumanReadableCopyright = "Copyright © 1997-2017 Christian Bauer et al. Freely distributable under the terms of the GNU GPL.";
|
||||
NSHumanReadableCopyright = "Copyright © 1997-2020 Christian Bauer et al. Freely distributable under the terms of the GNU GPL.";
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<key>CFBundleExecutable</key>
|
||||
<string>BasiliskII</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>Basilisk II version 1.0, Copyright © 1997-2017 Christian Bauer et al. SDL2 port</string>
|
||||
<string>Basilisk II version 1.0, Copyright © 1997-2020 Christian Bauer et al. SDL2 port</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>BasiliskII.icns</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
|
|
|
@ -246,17 +246,16 @@ static void make_rsrc_path(const char *src, char *dest)
|
|||
add_path_component(dest, "..namedfork/rsrc");
|
||||
}
|
||||
|
||||
static int open_rsrc(const char *path, int flag)
|
||||
{
|
||||
static int open_rsrc(const char *path, int flag){
|
||||
char rsrc_path[MAX_PATH_LENGTH];
|
||||
make_rsrc_path(path, rsrc_path);
|
||||
|
||||
int fd = open(rsrc_path, flag);
|
||||
if (fd < 0 && flag == O_WRONLY) fd = open(rsrc_path, O_WRONLY | O_CREAT); // for APFS
|
||||
if (fd < 0 && flag == O_WRONLY)
|
||||
fd = open(rsrc_path, O_WRONLY | O_CREAT); // for APFS
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get/set finder info for file/directory specified by full path
|
||||
*/
|
||||
|
|
|
@ -36,7 +36,6 @@ void NSAutoReleasePool_wrap(void (*fn)(void))
|
|||
}
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2,0,0)
|
||||
|
||||
void disable_SDL2_macosx_menu_bar_keyboard_shortcuts() {
|
||||
for (NSMenuItem * menu_item in [NSApp mainMenu].itemArray) {
|
||||
if (menu_item.hasSubmenu) {
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
* - Backport hw cursor acceleration to Basilisk II?
|
||||
* - Factor out code
|
||||
*/
|
||||
|
||||
#include "sysdeps.h"
|
||||
|
||||
#include <SDL.h>
|
||||
|
@ -94,6 +93,9 @@ const char KEYCODE_FILE_NAME[] = "BasiliskII_keycodes";
|
|||
const char KEYCODE_FILE_NAME[] = DATADIR "/keycodes";
|
||||
#endif
|
||||
|
||||
// Mac Screen Width and Height
|
||||
uint32 MacScreenWidth;
|
||||
uint32 MacScreenHeight;
|
||||
|
||||
// Global variables
|
||||
static uint32 frame_skip; // Prefs items
|
||||
|
@ -171,7 +173,6 @@ static int redraw_func(void *arg);
|
|||
// From sys_unix.cpp
|
||||
extern void SysMountFirstFloppy(void);
|
||||
|
||||
|
||||
/*
|
||||
* SDL surface locking glue
|
||||
*/
|
||||
|
@ -204,18 +205,7 @@ extern void SysMountFirstFloppy(void);
|
|||
|
||||
static void *vm_acquire_framebuffer(uint32 size)
|
||||
{
|
||||
// always try to reallocate framebuffer at the same address
|
||||
static void *fb = VM_MAP_FAILED;
|
||||
if (fb != VM_MAP_FAILED) {
|
||||
if (vm_acquire_fixed(fb, size) < 0) {
|
||||
#ifndef SHEEPSHAVER
|
||||
printf("FATAL: Could not reallocate framebuffer at previous address\n");
|
||||
#endif
|
||||
fb = VM_MAP_FAILED;
|
||||
}
|
||||
}
|
||||
if (fb == VM_MAP_FAILED)
|
||||
fb = vm_acquire(size, VM_MAP_DEFAULT | VM_MAP_32BIT);
|
||||
void *fb = vm_acquire(size, VM_MAP_DEFAULT | VM_MAP_32BIT);
|
||||
return fb;
|
||||
}
|
||||
|
||||
|
@ -506,7 +496,11 @@ static void set_mac_frame_buffer(SDL_monitor_desc &monitor, int depth)
|
|||
else if (depth == VIDEO_DEPTH_32BIT)
|
||||
layout = (screen_depth == 24) ? FLAYOUT_HOST_888 : FLAYOUT_DIRECT;
|
||||
MacFrameLayout = layout;
|
||||
monitor.set_mac_frame_base(MacFrameBaseMac);
|
||||
|
||||
if (TwentyFourBitAddressing)
|
||||
monitor.set_mac_frame_base(MacFrameBaseMac24Bit);
|
||||
else
|
||||
monitor.set_mac_frame_base(MacFrameBaseMac);
|
||||
|
||||
// Set variables used by UAE memory banking
|
||||
const VIDEO_MODE &mode = monitor.get_current_mode();
|
||||
|
@ -656,6 +650,10 @@ void driver_base::set_video_mode(int flags)
|
|||
#ifdef ENABLE_VOSF
|
||||
the_host_buffer = (uint8 *)s->pixels;
|
||||
#endif
|
||||
// set Mac screen global variabls
|
||||
MacScreenWidth = VIDEO_MODE_X;
|
||||
MacScreenHeight = VIDEO_MODE_Y;
|
||||
D(bug("Set Mac Screen Width: %d, Mac Screen Height: %d\n", MacScreenWidth, MacScreenHeight));
|
||||
}
|
||||
|
||||
void driver_base::init()
|
||||
|
@ -668,6 +666,10 @@ void driver_base::init()
|
|||
// Allocate memory for frame buffer (SIZE is extended to page-boundary)
|
||||
the_buffer_size = page_extend((aligned_height + 2) * s->pitch);
|
||||
the_buffer = (uint8 *)vm_acquire_framebuffer(the_buffer_size);
|
||||
if (VM_MAP_FAILED == the_buffer) {
|
||||
perror("Failed to allocate frame buffer for guest OS.");
|
||||
abort();
|
||||
}
|
||||
the_buffer_copy = (uint8 *)malloc(the_buffer_size);
|
||||
D(bug("the_buffer = %p, the_buffer_copy = %p, the_host_buffer = %p\n", the_buffer, the_buffer_copy, the_host_buffer));
|
||||
|
||||
|
@ -692,6 +694,10 @@ void driver_base::init()
|
|||
the_buffer_size = (aligned_height + 2) * s->pitch;
|
||||
the_buffer_copy = (uint8 *)calloc(1, the_buffer_size);
|
||||
the_buffer = (uint8 *)vm_acquire_framebuffer(the_buffer_size);
|
||||
if (VM_MAP_FAILED == the_buffer) {
|
||||
perror("Failed to allocate frame buffer for guest OS.");
|
||||
abort();
|
||||
}
|
||||
D(bug("the_buffer = %p, the_buffer_copy = %p\n", the_buffer, the_buffer_copy));
|
||||
}
|
||||
|
||||
|
@ -998,16 +1004,13 @@ bool VideoInit(bool classic)
|
|||
// Get screen mode from preferences
|
||||
migrate_screen_prefs();
|
||||
const char *mode_str = NULL;
|
||||
if (classic_mode)
|
||||
mode_str = "win/512/342";
|
||||
else
|
||||
mode_str = PrefsFindString("screen");
|
||||
mode_str = PrefsFindString("screen");
|
||||
|
||||
// Determine display type and default dimensions
|
||||
int default_width, default_height;
|
||||
if (classic) {
|
||||
default_width = 512;
|
||||
default_height = 384;
|
||||
default_height = 342;
|
||||
}
|
||||
else {
|
||||
default_width = 640;
|
||||
|
@ -1029,6 +1032,11 @@ bool VideoInit(bool classic)
|
|||
else if (default_height > sdl_display_height())
|
||||
default_height = sdl_display_height();
|
||||
|
||||
// for classic Mac, make sure the display width is divisible by 8
|
||||
if (classic) {
|
||||
default_width = (default_width / 8) * 8;
|
||||
}
|
||||
|
||||
// Mac screen depth follows X depth
|
||||
screen_depth = SDL_GetVideoInfo()->vfmt->BitsPerPixel;
|
||||
int default_depth;
|
||||
|
@ -1084,7 +1092,7 @@ bool VideoInit(bool classic)
|
|||
// Construct list of supported modes
|
||||
if (display_type == DISPLAY_WINDOW) {
|
||||
if (classic)
|
||||
add_mode(display_type, 512, 342, 0x80, 64, VIDEO_DEPTH_1BIT);
|
||||
add_mode(display_type, default_width, default_height, 0x80, default_width/8, VIDEO_DEPTH_1BIT);
|
||||
else {
|
||||
for (int i = 0; video_modes[i].w != 0; i++) {
|
||||
const int w = video_modes[i].w;
|
||||
|
@ -1941,7 +1949,7 @@ static void update_display_static(driver_base *drv)
|
|||
|
||||
// Check for first column from left and first column from right that have changed
|
||||
if (high) {
|
||||
if (VIDEO_MODE_DEPTH < VIDEO_DEPTH_8BIT) {
|
||||
if ((int)VIDEO_MODE_DEPTH < VIDEO_DEPTH_8BIT) {
|
||||
const int src_bytes_per_row = bytes_per_row;
|
||||
const int dst_bytes_per_row = drv->s->pitch;
|
||||
const int pixels_per_byte = VIDEO_MODE_X / src_bytes_per_row;
|
||||
|
@ -2337,4 +2345,4 @@ void video_set_dirty_area(int x, int y, int w, int h)
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // ends: SDL version check
|
||||
#endif // ends: SDL version check
|
||||
|
|
|
@ -99,6 +99,9 @@ const char KEYCODE_FILE_NAME[] = DATADIR "/keycodes";
|
|||
const char KEYCODE_FILE_NAME2[] = DATADIR "/BasiliskII_keycodes";
|
||||
#endif
|
||||
|
||||
// Mac Screen Width and Height
|
||||
uint32 MacScreenWidth;
|
||||
uint32 MacScreenHeight;
|
||||
|
||||
// Global variables
|
||||
static uint32 frame_skip; // Prefs items
|
||||
|
@ -183,7 +186,6 @@ static uint16 last_gamma_blue[256];
|
|||
static void VideoRefreshInit(void);
|
||||
static void (*video_refresh)(void);
|
||||
|
||||
|
||||
// Prototypes
|
||||
static int redraw_func(void *arg);
|
||||
static int present_sdl_video();
|
||||
|
@ -193,7 +195,6 @@ static bool is_fullscreen(SDL_Window *);
|
|||
// From sys_unix.cpp
|
||||
extern void SysMountFirstFloppy(void);
|
||||
|
||||
|
||||
/*
|
||||
* SDL surface locking glue
|
||||
*/
|
||||
|
@ -224,8 +225,7 @@ extern void SysMountFirstFloppy(void);
|
|||
* Framebuffer allocation routines
|
||||
*/
|
||||
|
||||
static void *vm_acquire_framebuffer(uint32 size)
|
||||
{
|
||||
static void *vm_acquire_framebuffer(uint32 size){
|
||||
#ifdef HAVE_MACH_VM
|
||||
return vm_acquire_reserved(size);
|
||||
#else
|
||||
|
@ -245,8 +245,7 @@ static void *vm_acquire_framebuffer(uint32 size)
|
|||
#endif
|
||||
}
|
||||
|
||||
static inline void vm_release_framebuffer(void *fb, uint32 size)
|
||||
{
|
||||
static inline void vm_release_framebuffer(void *fb, uint32 size){
|
||||
#ifndef HAVE_MACH_VM
|
||||
vm_release(fb, size);
|
||||
#endif
|
||||
|
@ -528,7 +527,11 @@ static void set_mac_frame_buffer(SDL_monitor_desc &monitor, int depth, bool nati
|
|||
MacFrameLayout = layout;
|
||||
else
|
||||
MacFrameLayout = FLAYOUT_DIRECT;
|
||||
monitor.set_mac_frame_base(MacFrameBaseMac);
|
||||
|
||||
if (TwentyFourBitAddressing)
|
||||
monitor.set_mac_frame_base(MacFrameBaseMac24Bit);
|
||||
else
|
||||
monitor.set_mac_frame_base(MacFrameBaseMac);
|
||||
|
||||
// Set variables used by UAE memory banking
|
||||
const VIDEO_MODE &mode = monitor.get_current_mode();
|
||||
|
@ -714,21 +717,19 @@ static void shutdown_sdl_video()
|
|||
delete_sdl_video_window();
|
||||
}
|
||||
|
||||
static int get_mag_rate()
|
||||
{
|
||||
static int get_mag_rate(){
|
||||
int m = PrefsFindInt32("mag_rate");
|
||||
return m < 1 ? 1 : m > 4 ? 4 : m;
|
||||
}
|
||||
|
||||
static SDL_Surface * init_sdl_video(int width, int height, int bpp, Uint32 flags)
|
||||
{
|
||||
static SDL_Surface * init_sdl_video(int width, int height, int bpp, Uint32 flags){
|
||||
if (guest_surface) {
|
||||
delete_sdl_video_surfaces();
|
||||
}
|
||||
|
||||
int window_width = width;
|
||||
int window_height = height;
|
||||
Uint32 window_flags = SDL_WINDOW_ALLOW_HIGHDPI;
|
||||
Uint32 window_flags = SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_RESIZABLE;
|
||||
const int window_flags_to_monitor = SDL_WINDOW_FULLSCREEN;
|
||||
|
||||
if (flags & SDL_WINDOW_FULLSCREEN) {
|
||||
|
@ -884,11 +885,14 @@ static SDL_Surface * init_sdl_video(int width, int height, int bpp, Uint32 flags
|
|||
|
||||
SDL_RenderSetIntegerScale(sdl_renderer, PrefsFindBool("scale_integer") ? SDL_TRUE : SDL_FALSE);
|
||||
|
||||
return guest_surface;
|
||||
// set Mac screen global variabls
|
||||
MacScreenWidth = width;
|
||||
MacScreenHeight = height;
|
||||
D(bug("Set Mac Screen Width: %d, Mac Screen Height: %d\n", MacScreenWidth, MacScreenHeight));
|
||||
return guest_surface;
|
||||
}
|
||||
|
||||
static int present_sdl_video()
|
||||
{
|
||||
static int present_sdl_video(){
|
||||
if (SDL_RectEmpty(&sdl_update_video_rect)) return 0;
|
||||
|
||||
if (!sdl_renderer || !sdl_texture || !guest_surface) {
|
||||
|
@ -960,8 +964,7 @@ static int present_sdl_video()
|
|||
return 0;
|
||||
}
|
||||
|
||||
void update_sdl_video(SDL_Surface *s, int numrects, SDL_Rect *rects)
|
||||
{
|
||||
void update_sdl_video(SDL_Surface *s, int numrects, SDL_Rect *rects){
|
||||
// TODO: make sure SDL_Renderer resources get displayed, if and when
|
||||
// MacsBug is running (and VideoInterrupt() might not get called)
|
||||
|
||||
|
@ -972,8 +975,7 @@ void update_sdl_video(SDL_Surface *s, int numrects, SDL_Rect *rects)
|
|||
SDL_UnlockMutex(sdl_update_video_mutex);
|
||||
}
|
||||
|
||||
void update_sdl_video(SDL_Surface *s, Sint32 x, Sint32 y, Sint32 w, Sint32 h)
|
||||
{
|
||||
void update_sdl_video(SDL_Surface *s, Sint32 x, Sint32 y, Sint32 w, Sint32 h){
|
||||
SDL_Rect temp = {x, y, w, h};
|
||||
update_sdl_video(s, 1, &temp);
|
||||
}
|
||||
|
@ -1006,8 +1008,7 @@ static SDL_Cursor *MagCursor(bool hot) {
|
|||
}
|
||||
#endif
|
||||
|
||||
void driver_base::set_video_mode(int flags)
|
||||
{
|
||||
void driver_base::set_video_mode(int flags){
|
||||
int depth = sdl_depth_of_video_depth(VIDEO_MODE_DEPTH);
|
||||
if ((s = init_sdl_video(VIDEO_MODE_X, VIDEO_MODE_Y, depth, flags)) == NULL)
|
||||
return;
|
||||
|
@ -1016,9 +1017,24 @@ void driver_base::set_video_mode(int flags)
|
|||
#endif
|
||||
}
|
||||
|
||||
void driver_base::init()
|
||||
{
|
||||
void driver_base::init(){
|
||||
set_video_mode(display_type == DISPLAY_SCREEN ? SDL_WINDOW_FULLSCREEN : 0);
|
||||
|
||||
#ifndef SHEEPSHAVER
|
||||
// manually set palette for 24bit ROM
|
||||
// 24 bit ROM Macintosh is BW screen. It doesn't setup palette by the ROM.
|
||||
if (TwentyFourBitAddressing && !sdl_palette) {
|
||||
const int nColor = 256;
|
||||
sdl_palette = SDL_AllocPalette(nColor);
|
||||
SDL_Color *p = sdl_palette->colors;
|
||||
for (int i = 0; i < nColor; i++) {
|
||||
p->r = p->g = p->b = i;
|
||||
p++;
|
||||
}
|
||||
update_palette();
|
||||
}
|
||||
#endif
|
||||
|
||||
int aligned_height = (VIDEO_MODE_Y + 15) & ~15;
|
||||
|
||||
#ifdef ENABLE_VOSF
|
||||
|
@ -1027,6 +1043,10 @@ void driver_base::init()
|
|||
the_buffer_size = page_extend((aligned_height + 2) * s->pitch);
|
||||
the_buffer = (uint8 *)vm_acquire_framebuffer(the_buffer_size);
|
||||
the_buffer_copy = (uint8 *)malloc(the_buffer_size);
|
||||
if (VM_MAP_FAILED == the_buffer) {
|
||||
perror("Failed to allocate frame buffer for guest OS.");
|
||||
abort();
|
||||
}
|
||||
D(bug("the_buffer = %p, the_buffer_copy = %p, the_host_buffer = %p\n", the_buffer, the_buffer_copy, the_host_buffer));
|
||||
|
||||
// Check whether we can initialize the VOSF subsystem and it's profitable
|
||||
|
@ -1039,7 +1059,7 @@ void driver_base::init()
|
|||
printf("VOSF acceleration is not profitable on this platform, disabling it\n");
|
||||
use_vosf = false;
|
||||
}
|
||||
if (!use_vosf) {
|
||||
if (!use_vosf) {
|
||||
free(the_buffer_copy);
|
||||
vm_release(the_buffer, the_buffer_size);
|
||||
the_host_buffer = NULL;
|
||||
|
@ -1050,6 +1070,10 @@ void driver_base::init()
|
|||
the_buffer_size = (aligned_height + 2) * s->pitch;
|
||||
the_buffer_copy = (uint8 *)calloc(1, the_buffer_size);
|
||||
the_buffer = (uint8 *)vm_acquire_framebuffer(the_buffer_size);
|
||||
if (VM_MAP_FAILED == the_buffer) {
|
||||
perror("Failed to allocate frame buffer for guest OS.");
|
||||
abort();
|
||||
}
|
||||
D(bug("the_buffer = %p, the_buffer_copy = %p\n", the_buffer, the_buffer_copy));
|
||||
}
|
||||
|
||||
|
@ -1112,8 +1136,7 @@ void driver_base::adapt_to_video_mode() {
|
|||
init_ok = true;
|
||||
}
|
||||
|
||||
driver_base::~driver_base()
|
||||
{
|
||||
driver_base::~driver_base(){
|
||||
ungrab_mouse();
|
||||
restore_mouse_accel();
|
||||
|
||||
|
@ -1356,12 +1379,10 @@ bool SDL_monitor_desc::video_open(void)
|
|||
}
|
||||
|
||||
#ifdef SHEEPSHAVER
|
||||
bool VideoInit(void)
|
||||
{
|
||||
bool VideoInit(void){
|
||||
const bool classic = false;
|
||||
#else
|
||||
bool VideoInit(bool classic)
|
||||
{
|
||||
bool VideoInit(bool classic){
|
||||
#endif
|
||||
classic_mode = classic;
|
||||
|
||||
|
@ -1399,7 +1420,7 @@ bool VideoInit(bool classic)
|
|||
int default_width, default_height;
|
||||
if (classic) {
|
||||
default_width = 512;
|
||||
default_height = 384;
|
||||
default_height = 342;
|
||||
}
|
||||
else {
|
||||
default_width = 640;
|
||||
|
@ -1421,6 +1442,10 @@ bool VideoInit(bool classic)
|
|||
else if (default_height > sdl_display_height())
|
||||
default_height = sdl_display_height();
|
||||
|
||||
// for classic Mac, make sure the display width is divisible by 8
|
||||
if (classic) {
|
||||
default_width = (default_width / 8) * 8;
|
||||
}
|
||||
// Mac screen depth follows X depth
|
||||
screen_depth = 32;
|
||||
SDL_DisplayMode desktop_mode;
|
||||
|
@ -1480,7 +1505,7 @@ bool VideoInit(bool classic)
|
|||
// Construct list of supported modes
|
||||
if (display_type == DISPLAY_WINDOW) {
|
||||
if (classic)
|
||||
add_mode(display_type, 512, 342, 0x80, 64, VIDEO_DEPTH_1BIT);
|
||||
add_mode(display_type, default_width, default_height, 0x80, default_width/8, VIDEO_DEPTH_1BIT);
|
||||
else {
|
||||
for (int i = 0; video_modes[i].w != 0; i++) {
|
||||
const int w = video_modes[i].w;
|
||||
|
@ -1572,8 +1597,7 @@ bool VideoInit(bool classic)
|
|||
*/
|
||||
|
||||
// Close display
|
||||
void SDL_monitor_desc::video_close(void)
|
||||
{
|
||||
void SDL_monitor_desc::video_close(void){
|
||||
D(bug("video_close()\n"));
|
||||
|
||||
#ifdef WIN32
|
||||
|
@ -1616,13 +1640,11 @@ void VideoExit(void)
|
|||
SDL_DestroyMutex(sdl_events_lock);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Close down full-screen mode (if bringing up error alerts is unsafe while in full-screen mode)
|
||||
*/
|
||||
|
||||
void VideoQuitFullScreen(void)
|
||||
{
|
||||
void VideoQuitFullScreen(void){
|
||||
D(bug("VideoQuitFullScreen()\n"));
|
||||
quit_full_screen = true;
|
||||
}
|
||||
|
@ -1647,8 +1669,7 @@ static void ApplyGammaRamp() {
|
|||
}
|
||||
}
|
||||
|
||||
static void do_toggle_fullscreen(void)
|
||||
{
|
||||
static void do_toggle_fullscreen(void){
|
||||
#ifndef USE_CPU_EMUL_SERVICES
|
||||
// pause redraw thread
|
||||
thread_stop_ack = false;
|
||||
|
@ -1770,14 +1791,12 @@ void VideoInterrupt(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Set palette
|
||||
*/
|
||||
|
||||
#ifdef SHEEPSHAVER
|
||||
void video_set_palette(void)
|
||||
{
|
||||
void video_set_palette(void){
|
||||
monitor_desc * monitor = VideoMonitors[0];
|
||||
int n_colors = palette_size(monitor->get_current_mode().viAppleMode);
|
||||
uint8 pal[256 * 3];
|
||||
|
@ -1789,8 +1808,7 @@ void video_set_palette(void)
|
|||
monitor->set_palette(pal, n_colors);
|
||||
}
|
||||
|
||||
void video_set_gamma(int n_colors)
|
||||
{
|
||||
void video_set_gamma(int n_colors){
|
||||
monitor_desc * monitor = VideoMonitors[0];
|
||||
uint8 gamma[256 * 3];
|
||||
for (int c = 0; c < n_colors; c++) {
|
||||
|
@ -1802,9 +1820,7 @@ void video_set_gamma(int n_colors)
|
|||
}
|
||||
#endif
|
||||
|
||||
void SDL_monitor_desc::set_palette(uint8 *pal, int num_in)
|
||||
{
|
||||
|
||||
void SDL_monitor_desc::set_palette(uint8 *pal, int num_in){
|
||||
const VIDEO_MODE &mode = get_current_mode();
|
||||
|
||||
LOCK_PALETTE;
|
||||
|
@ -1850,8 +1866,7 @@ void SDL_monitor_desc::set_palette(uint8 *pal, int num_in)
|
|||
UNLOCK_PALETTE;
|
||||
}
|
||||
|
||||
void SDL_monitor_desc::set_gamma(uint8 *gamma, int num_in)
|
||||
{
|
||||
void SDL_monitor_desc::set_gamma(uint8 *gamma, int num_in){
|
||||
// handle the gamma ramp
|
||||
|
||||
if (gamma[0] == 127 && gamma[num_in*3-1] == 127) // solid grey
|
||||
|
@ -1891,23 +1906,20 @@ void SDL_monitor_desc::set_gamma(uint8 *gamma, int num_in)
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Switch video mode
|
||||
*/
|
||||
|
||||
#ifdef SHEEPSHAVER
|
||||
int16 video_mode_change(VidLocals *csSave, uint32 ParamPtr)
|
||||
{
|
||||
int16 video_mode_change(VidLocals *csSave, uint32 ParamPtr){
|
||||
/* return if no mode change */
|
||||
if ((csSave->saveData == ReadMacInt32(ParamPtr + csData)) &&
|
||||
(csSave->saveMode == ReadMacInt16(ParamPtr + csMode))) return noErr;
|
||||
(csSave->saveMode == ReadMacInt16(ParamPtr + csMode))) return noErr;
|
||||
|
||||
/* first find video mode in table */
|
||||
for (int i=0; VModes[i].viType != DIS_INVALID; i++) {
|
||||
if ((ReadMacInt16(ParamPtr + csMode) == VModes[i].viAppleMode) &&
|
||||
(ReadMacInt32(ParamPtr + csData) == VModes[i].viAppleID)) {
|
||||
(ReadMacInt32(ParamPtr + csData) == VModes[i].viAppleID)) {
|
||||
csSave->saveMode = ReadMacInt16(ParamPtr + csMode);
|
||||
csSave->saveData = ReadMacInt32(ParamPtr + csData);
|
||||
csSave->savePage = ReadMacInt16(ParamPtr + csPage);
|
||||
|
@ -1938,10 +1950,9 @@ int16 video_mode_change(VidLocals *csSave, uint32 ParamPtr)
|
|||
#endif
|
||||
|
||||
static bool is_cursor_in_mac_screen() {
|
||||
|
||||
int windowX, windowY;
|
||||
int cursorX, cursorY;
|
||||
int deltaX, deltaY;
|
||||
int windowX, windowY;
|
||||
int cursorX, cursorY;
|
||||
int deltaX, deltaY;
|
||||
bool out;
|
||||
|
||||
// TODO figure out a check for full screen mode
|
||||
|
@ -1969,8 +1980,7 @@ static bool is_cursor_in_mac_screen() {
|
|||
return false;
|
||||
}
|
||||
|
||||
void SDL_monitor_desc::switch_to_current_mode(void)
|
||||
{
|
||||
void SDL_monitor_desc::switch_to_current_mode(void){
|
||||
// Close and reopen display
|
||||
LOCK_EVENTS;
|
||||
video_close();
|
||||
|
@ -1983,26 +1993,22 @@ void SDL_monitor_desc::switch_to_current_mode(void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Can we set the MacOS cursor image into the window?
|
||||
*/
|
||||
|
||||
#ifdef SHEEPSHAVER
|
||||
bool video_can_change_cursor(void)
|
||||
{
|
||||
bool video_can_change_cursor(void){
|
||||
return PrefsFindBool("hardcursor") && (display_type == DISPLAY_WINDOW || PrefsFindBool("scale_integer"));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Set cursor image for window
|
||||
*/
|
||||
|
||||
#ifdef SHEEPSHAVER
|
||||
void video_set_cursor(void)
|
||||
{
|
||||
void video_set_cursor(void){
|
||||
// Set new cursor image if it was changed
|
||||
if (sdl_cursor) {
|
||||
SDL_FreeCursor(sdl_cursor);
|
||||
|
@ -2039,13 +2045,11 @@ void video_set_cursor(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Keyboard-related utilify functions
|
||||
*/
|
||||
|
||||
static bool is_hotkey_down(SDL_Keysym const & ks)
|
||||
{
|
||||
static bool is_hotkey_down(SDL_Keysym const & ks){
|
||||
int hotkey = PrefsFindInt32("hotkey");
|
||||
if (!hotkey) hotkey = 1;
|
||||
return (ctrl_down || (ks.mod & KMOD_CTRL) || !(hotkey & 1)) &&
|
||||
|
@ -2053,7 +2057,7 @@ static bool is_hotkey_down(SDL_Keysym const & ks)
|
|||
(cmd_down || (ks.mod & KMOD_GUI) || !(hotkey & 4));
|
||||
}
|
||||
|
||||
static bool swap_opt_cmd() {
|
||||
static bool swap_opt_cmd(){
|
||||
static bool f, c;
|
||||
if (!f) {
|
||||
f = true;
|
||||
|
@ -2067,8 +2071,7 @@ static bool swap_opt_cmd() {
|
|||
* and CODE_HOTKEY if the key was recognized as a hotkey
|
||||
*/
|
||||
|
||||
static int kc_decode(SDL_Keysym const & ks, bool key_down)
|
||||
{
|
||||
static int kc_decode(SDL_Keysym const & ks, bool key_down){
|
||||
switch (ks.sym) {
|
||||
case SDLK_a: return 0x00;
|
||||
case SDLK_b: return 0x0b;
|
||||
|
@ -2227,8 +2230,7 @@ enum {
|
|||
// This function is called by SDL, whenever it generates an SDL_Event. It has
|
||||
// the ability to process events, and optionally, to prevent them from being
|
||||
// added to SDL's event queue (and retrieve-able via SDL_PeepEvents(), etc.)
|
||||
static int SDLCALL on_sdl_event_generated(void *userdata, SDL_Event * event)
|
||||
{
|
||||
static int SDLCALL on_sdl_event_generated(void *userdata, SDL_Event * event){
|
||||
switch (event->type) {
|
||||
case SDL_KEYUP: {
|
||||
SDL_Keysym const & ks = event->key.keysym;
|
||||
|
@ -2277,8 +2279,7 @@ static int SDLCALL on_sdl_event_generated(void *userdata, SDL_Event * event)
|
|||
}
|
||||
|
||||
|
||||
static void handle_events(void)
|
||||
{
|
||||
static void handle_events(void){
|
||||
SDL_Event events[10];
|
||||
const int n_max_events = sizeof(events) / sizeof(events[0]);
|
||||
int n_events;
|
||||
|
@ -2403,7 +2404,6 @@ static void handle_events(void)
|
|||
case SDL_WINDOWEVENT_RESTORED:
|
||||
force_complete_window_refresh();
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -2419,14 +2419,12 @@ static void handle_events(void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Window display update
|
||||
*/
|
||||
|
||||
// Static display update (fixed frame rate, but incremental)
|
||||
static void update_display_static(driver_base *drv)
|
||||
{
|
||||
static void update_display_static(driver_base *drv){
|
||||
// Incremental update code
|
||||
int wide = 0, high = 0;
|
||||
uint32 x1, x2, y1, y2;
|
||||
|
@ -2831,14 +2829,12 @@ static int redraw_func(void *arg)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Record dirty area from NQD
|
||||
*/
|
||||
|
||||
#ifdef SHEEPSHAVER
|
||||
void video_set_dirty_area(int x, int y, int w, int h)
|
||||
{
|
||||
void video_set_dirty_area(int x, int y, int w, int h){
|
||||
#ifdef ENABLE_VOSF
|
||||
const VIDEO_MODE &mode = drv->mode;
|
||||
const unsigned screen_width = VIDEO_MODE_X;
|
||||
|
@ -2855,4 +2851,4 @@ void video_set_dirty_area(int x, int y, int w, int h)
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // ends: SDL version check
|
||||
#endif // ends: SDL version check
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/param.h>
|
||||
#include <linux/../scsi/sg.h> // workaround for broken RedHat 6.0 /usr/include/scsi
|
||||
#include <scsi/sg.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
|
|
@ -89,6 +89,11 @@ AC_ARG_WITH(bincue,
|
|||
AC_ARG_WITH(libvhd,
|
||||
AS_HELP_STRING([--with-libvhd], [Enable VHD disk images]))
|
||||
|
||||
AC_ARG_WITH(vdeplug,
|
||||
AS_HELP_STRING([--with-vdeplug], [Enable VDE virtual network support]),
|
||||
[],
|
||||
[with_vdeplug=yes])
|
||||
|
||||
|
||||
dnl Cross Compiling results in 'guesses' being made about the target system. These defaults are oftetimes incorrect.
|
||||
dnl The following Environment variables allow you to configure the default guess value for each option in the configure script.
|
||||
|
@ -474,7 +479,7 @@ if [[ "x$WANT_GTK" = "xgtk" ]]; then
|
|||
dnl somehow, <gnome-i18n.h> would redefine gettext() to nothing if
|
||||
dnl ENABLE_NLS is not set, thusly conflicting with C++ <string> which
|
||||
dnl includes <libintl.h>
|
||||
AM_GNU_GETTEXT
|
||||
AM_GNU_GETTEXT([external])
|
||||
B2_PATH_GNOMEUI([
|
||||
AC_DEFINE(HAVE_GNOMEUI, 1, [Define if libgnomeui is available.])
|
||||
GUI_CFLAGS="$GUI_CFLAGS $GNOMEUI_CFLAGS"
|
||||
|
@ -589,7 +594,8 @@ dnl Check for headers and functions related to pty support (sshpty.c)
|
|||
dnl From openssh-3.2.2p1 configure.ac
|
||||
|
||||
AC_CHECK_HEADERS(strings.h login.h sys/bsdtty.h sys/stat.h util.h pty.h)
|
||||
AC_CHECK_FUNCS(_getpty vhangup strlcpy)
|
||||
AC_SEARCH_LIBS([openpty], [util bsd])
|
||||
AC_CHECK_FUNCS(_getpty openpty vhangup strlcpy)
|
||||
|
||||
case "$host" in
|
||||
*-*-hpux10.26)
|
||||
|
@ -822,6 +828,13 @@ if [[ -n "$CAN_SLIRP" ]]; then
|
|||
fi
|
||||
AC_SUBST(SLIRP_SRCS)
|
||||
|
||||
dnl Is libvdeplug available?
|
||||
have_vdeplug=no
|
||||
AS_IF([test "x$with_vdeplug" = "xyes"], [
|
||||
have_vdeplug=yes
|
||||
AC_CHECK_LIB(vdeplug, vde_close, [], [have_vdeplug=no])
|
||||
])
|
||||
|
||||
if [[ "x$WANT_MACOSX_GUI" = "xyes" ]]; then
|
||||
CPPFLAGS="$CPPFLAGS -I../MacOSX"
|
||||
LIBS="$LIBS -framework CoreAudio -framework AudioUnit -framework AudioToolbox"
|
||||
|
@ -1408,6 +1421,11 @@ fi
|
|||
AC_TRANSLATE_DEFINE(HAVE_LINKER_SCRIPT, "$ac_cv_linker_script_works",
|
||||
[Define if there is a linker script to relocate the executable above 0x70000000.])
|
||||
|
||||
dnl override the addressing mode test order for Darwin
|
||||
if [[ "x$OS_TYPE" = "xdarwin" ]]; then
|
||||
ADDRESSING_TEST_ORDER="banks"
|
||||
fi
|
||||
|
||||
dnl Determine the addressing mode to use
|
||||
if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
|
||||
ADDRESSING_MODE="real"
|
||||
|
@ -1892,6 +1910,7 @@ echo SDL support ............................ : $SDL_SUPPORT
|
|||
echo SDL major-version ...................... : $WANT_SDL_VERSION_MAJOR
|
||||
echo BINCUE support ......................... : $have_bincue
|
||||
echo LIBVHD support ......................... : $have_libvhd
|
||||
echo VDE support ............................ : $have_vdeplug
|
||||
echo XFree86 DGA support .................... : $WANT_XF86_DGA
|
||||
echo XFree86 VidMode support ................ : $WANT_XF86_VIDMODE
|
||||
echo fbdev DGA support ...................... : $WANT_FBDEV_DGA
|
||||
|
|
|
@ -85,6 +85,12 @@
|
|||
#include "ctl.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBVDEPLUG
|
||||
extern "C" {
|
||||
#include <libvdeplug.h>
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "cpu_emulation.h"
|
||||
#include "main.h"
|
||||
#include "macos_util.h"
|
||||
|
@ -110,6 +116,7 @@ enum {
|
|||
NET_IF_ETHERTAP,
|
||||
NET_IF_TUNTAP,
|
||||
NET_IF_SLIRP,
|
||||
NET_IF_VDE,
|
||||
NET_IF_ETHERHELPER
|
||||
};
|
||||
|
||||
|
@ -139,6 +146,9 @@ static pthread_t slirp_thread; // Slirp reception thread
|
|||
static bool slirp_thread_active = false; // Flag: Slirp reception threadinstalled
|
||||
static int slirp_output_fd = -1; // fd of slirp output pipe
|
||||
static int slirp_input_fds[2] = { -1, -1 }; // fds of slirp input pipe
|
||||
#ifdef HAVE_LIBVDEPLUG
|
||||
static VDECONN *vde_conn;
|
||||
#endif
|
||||
#ifdef SHEEPSHAVER
|
||||
static bool net_open = false; // Flag: initialization succeeded, network device open
|
||||
static uint8 ether_addr[6]; // Our Ethernet address
|
||||
|
@ -277,22 +287,36 @@ bool ether_init(void)
|
|||
|
||||
// Determine Ethernet device type
|
||||
net_if_type = -1;
|
||||
if (strncmp(name, "tap", 3) == 0)
|
||||
if (strncmp(name, "tap", 3) == 0) {
|
||||
net_if_type = NET_IF_ETHERTAP;
|
||||
printf("selected Ethernet device type tap\n");
|
||||
}
|
||||
#if ENABLE_TUNTAP
|
||||
else if (strcmp(name, "tun") == 0)
|
||||
else if (strcmp(name, "tun") == 0) {
|
||||
net_if_type = NET_IF_TUNTAP;
|
||||
printf("selected Ethernet device type tun\n");
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_SLIRP
|
||||
else if (strcmp(name, "slirp") == 0)
|
||||
else if (strcmp(name, "slirp") == 0) {
|
||||
net_if_type = NET_IF_SLIRP;
|
||||
printf("selected Ethernet device type slirp\n");
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_LIBVDEPLUG
|
||||
else if (strcmp(name, "vde") == 0) {
|
||||
net_if_type = NET_IF_VDE;
|
||||
printf("selected Ethernet device type VDE\n");
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_MACOSX_ETHERHELPER
|
||||
else if (strncmp(name, "etherhelper", 10) == 0)
|
||||
net_if_type = NET_IF_ETHERHELPER;
|
||||
#endif
|
||||
else
|
||||
else {
|
||||
net_if_type = NET_IF_SHEEPNET;
|
||||
printf("selected Ethernet device type sheep_net\n");
|
||||
}
|
||||
|
||||
// Don't raise SIGPIPE, let errno be set to EPIPE
|
||||
struct sigaction sigpipe_sa;
|
||||
|
@ -361,7 +385,35 @@ bool ether_init(void)
|
|||
|
||||
#endif
|
||||
}
|
||||
if (net_if_type != NET_IF_SLIRP) {
|
||||
|
||||
#ifdef HAVE_LIBVDEPLUG
|
||||
//vde switch information
|
||||
int port = 0;
|
||||
char *init_group = NULL;
|
||||
mode_t mode = 0700;
|
||||
|
||||
struct vde_open_args args = {
|
||||
.port = port,
|
||||
.group = init_group,
|
||||
.mode = mode,
|
||||
};
|
||||
|
||||
if (net_if_type == NET_IF_VDE) {
|
||||
/* calling vde open to open the vde connection to the vde switch */
|
||||
vde_conn = vde_open(vde_sock, (char *)"macemu", &args);
|
||||
|
||||
if (!vde_conn) {
|
||||
D(bug("VDE open failed\n"));
|
||||
return -1;
|
||||
} else {
|
||||
/* for select/poll when this fd receive data, there are
|
||||
* packets to recv(call vde_recv) */
|
||||
fd = vde_datafd(vde_conn);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (net_if_type != NET_IF_SLIRP && net_if_type != NET_IF_VDE) {
|
||||
fd = open(dev_name, O_RDWR);
|
||||
if (fd < 0) {
|
||||
sprintf(str, GetString(STR_NO_SHEEP_NET_DRIVER_WARN), dev_name, strerror(errno));
|
||||
|
@ -447,6 +499,15 @@ bool ether_init(void)
|
|||
ether_addr[3] = 0x12;
|
||||
ether_addr[4] = 0x34;
|
||||
ether_addr[5] = 0x56;
|
||||
#endif
|
||||
#ifdef HAVE_LIBVDEPLUG
|
||||
} else if (net_if_type == NET_IF_VDE) {
|
||||
ether_addr[0] = 0x52;
|
||||
ether_addr[1] = 0x54;
|
||||
ether_addr[2] = 0x00;
|
||||
ether_addr[3] = 0x12;
|
||||
ether_addr[4] = 0x34;
|
||||
ether_addr[5] = 0x56;
|
||||
#endif
|
||||
} else
|
||||
ioctl(fd, SIOCGIFADDR, ether_addr);
|
||||
|
@ -513,6 +574,11 @@ void ether_exit(void)
|
|||
if (slirp_output_fd > 0)
|
||||
close(slirp_output_fd);
|
||||
|
||||
#ifdef HAVE_LIBVDEPLUG
|
||||
// Close vde_connection
|
||||
if (net_if_type == NET_IF_VDE)
|
||||
vde_close(vde_conn);
|
||||
#endif
|
||||
#if STATISTICS
|
||||
// Show statistics
|
||||
printf("%ld messages put on write queue\n", num_wput);
|
||||
|
@ -811,6 +877,25 @@ static int16 ether_do_write(uint32 arg)
|
|||
return noErr;
|
||||
} else
|
||||
#endif
|
||||
#ifdef HAVE_LIBVDEPLUG
|
||||
if (net_if_type == NET_IF_VDE) {
|
||||
if (fd == -1) { // which means vde service is not running
|
||||
D(bug("WARNING: Couldn't transmit VDE packet\n"));
|
||||
return excessCollsns;
|
||||
}
|
||||
|
||||
if (vde_conn == NULL) {
|
||||
D(bug("WARNING: vde_conn is NULL\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
do {
|
||||
len = vde_send(vde_conn, packet, sizeof(packet), 0);
|
||||
} while (len < 0);
|
||||
|
||||
return noErr;
|
||||
} else
|
||||
#endif
|
||||
#ifdef ENABLE_MACOSX_ETHERHELPER
|
||||
if (net_if_type == NET_IF_ETHERHELPER) {
|
||||
unsigned short pkt_len;
|
||||
|
@ -1019,13 +1104,20 @@ void ether_do_interrupt(void)
|
|||
} else
|
||||
#endif
|
||||
{
|
||||
|
||||
// Read packet from sheep_net device
|
||||
#if defined(__linux__)
|
||||
length = read(fd, Mac2HostAddr(packet), net_if_type == NET_IF_ETHERTAP ? 1516 : 1514);
|
||||
#else
|
||||
length = read(fd, Mac2HostAddr(packet), 1514);
|
||||
#ifdef HAVE_LIBVDEPLUG
|
||||
if (net_if_type == NET_IF_VDE) {
|
||||
length = vde_recv(vde_conn, Mac2HostAddr(packet), 1514, 0);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
// Read packet from sheep_net device
|
||||
#if defined(__linux__)
|
||||
length = read(fd, Mac2HostAddr(packet), net_if_type == NET_IF_ETHERTAP ? 1516 : 1514);
|
||||
#else
|
||||
length = read(fd, Mac2HostAddr(packet), 1514);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (length < 14)
|
||||
break;
|
||||
|
||||
|
|
|
@ -211,6 +211,8 @@ static void sigill_handler(int sig, int code, struct sigcontext *scp);
|
|||
extern "C" void EmulOpTrampoline(void);
|
||||
#endif
|
||||
|
||||
// vde switch variable
|
||||
char* vde_sock;
|
||||
|
||||
/*
|
||||
* Ersatz functions
|
||||
|
@ -378,7 +380,8 @@ static void usage(const char *prg_name)
|
|||
" --display STRING\n X display to use\n"
|
||||
" --break ADDRESS\n set ROM breakpoint in hexadecimal\n"
|
||||
" --loadbreak FILE\n load breakpoint from FILE\n"
|
||||
" --rominfo\n dump ROM information\n", prg_name
|
||||
" --rominfo\n dump ROM information\n"
|
||||
" --switch SWITCH_PATH\n vde_switch address\n", prg_name
|
||||
);
|
||||
LoadPrefs(NULL); // read the prefs file so PrefsPrintUsage() will print the correct default values
|
||||
PrefsPrintUsage();
|
||||
|
@ -443,19 +446,27 @@ int main(int argc, char **argv)
|
|||
} else if (strcmp(argv[i], "--rominfo") == 0) {
|
||||
argv[i] = NULL;
|
||||
PrintROMInfo = true;
|
||||
} else if (strcmp(argv[i], "--switch") == 0) {
|
||||
argv[i] = NULL;
|
||||
if (argv[++i] == NULL) {
|
||||
printf("switch address not defined\n");
|
||||
usage(argv[0]);
|
||||
}
|
||||
vde_sock = argv[i];
|
||||
argv[i] = NULL;
|
||||
}
|
||||
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
// Mac OS X likes to pass in various options of its own, when launching an app.
|
||||
// Attempt to ignore these.
|
||||
if (argv[i]) {
|
||||
const char * mac_psn_prefix = "-psn_";
|
||||
if (strcmp(argv[i], "-NSDocumentRevisionsDebugMode") == 0) {
|
||||
argv[i] = NULL;
|
||||
} else if (strncmp(mac_psn_prefix, argv[i], strlen(mac_psn_prefix)) == 0) {
|
||||
argv[i] = NULL;
|
||||
}
|
||||
}
|
||||
if (argv[i]) {
|
||||
const char * mac_psn_prefix = "-psn_";
|
||||
if (strcmp(argv[i], "-NSDocumentRevisionsDebugMode") == 0) {
|
||||
argv[i] = NULL;
|
||||
} else if (strncmp(mac_psn_prefix, argv[i], strlen(mac_psn_prefix)) == 0) {
|
||||
argv[i] = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -665,9 +676,7 @@ int main(int argc, char **argv)
|
|||
RAMBaseMac = Host2MacAddr(RAMBaseHost);
|
||||
ROMBaseMac = Host2MacAddr(ROMBaseHost);
|
||||
#endif
|
||||
D(bug("Mac RAM starts at %p (%08x)\n", RAMBaseHost, RAMBaseMac));
|
||||
D(bug("Mac ROM starts at %p (%08x)\n", ROMBaseHost, ROMBaseMac));
|
||||
|
||||
|
||||
#if __MACOSX__
|
||||
extern void set_current_directory();
|
||||
set_current_directory();
|
||||
|
@ -730,6 +739,9 @@ int main(int argc, char **argv)
|
|||
QuitEmulator();
|
||||
D(bug("Initialization complete\n"));
|
||||
|
||||
D(bug("Mac RAM starts at %p (%08x)\n", RAMBaseHost, RAMBaseMac));
|
||||
D(bug("Mac ROM starts at %p (%08x)\n", ROMBaseHost, ROMBaseMac));
|
||||
|
||||
#if !EMULATED_68K
|
||||
// (Virtual) supervisor mode, disable interrupts
|
||||
EmulatedSR = 0x2700;
|
||||
|
|
|
@ -84,6 +84,9 @@ const char KEYCODE_FILE_NAME[] = DATADIR "/keycodes";
|
|||
static const int win_eventmask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | EnterWindowMask | ExposureMask | StructureNotifyMask;
|
||||
static const int dga_eventmask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask;
|
||||
|
||||
// Mac Screen Width and Height
|
||||
uint32 MacScreenWidth;
|
||||
uint32 MacScreenHeight;
|
||||
|
||||
// Global variables
|
||||
static int32 frame_skip; // Prefs items
|
||||
|
@ -416,7 +419,10 @@ static void set_mac_frame_buffer(X11_monitor_desc &monitor, video_depth depth, b
|
|||
MacFrameLayout = layout;
|
||||
else
|
||||
MacFrameLayout = FLAYOUT_DIRECT;
|
||||
monitor.set_mac_frame_base(MacFrameBaseMac);
|
||||
if (TwentyFourBitAddressing)
|
||||
monitor.set_mac_frame_base(MacFrameBaseMac24Bit);
|
||||
else
|
||||
monitor.set_mac_frame_base(MacFrameBaseMac);
|
||||
|
||||
// Set variables used by UAE memory banking
|
||||
const video_mode &mode = monitor.get_current_mode();
|
||||
|
@ -1466,6 +1472,10 @@ bool X11_monitor_desc::video_open(void)
|
|||
{
|
||||
D(bug("video_open()\n"));
|
||||
const video_mode &mode = get_current_mode();
|
||||
// set Mac screen global variabls
|
||||
MacScreenWidth = VIDEO_MODE_X;
|
||||
MacScreenHeight = VIDEO_MODE_Y;
|
||||
D(bug("Set Mac Screen Width: %d, Mac Screen Height: %d\n", MacScreenWidth, MacScreenHeight));
|
||||
|
||||
// Find best available X visual
|
||||
if (!find_visual_for_depth(mode.depth)) {
|
||||
|
@ -1682,13 +1692,17 @@ bool VideoInit(bool classic)
|
|||
|
||||
// Get screen mode from preferences
|
||||
const char *mode_str;
|
||||
if (classic_mode)
|
||||
mode_str = "win/512/342";
|
||||
else
|
||||
mode_str = PrefsFindString("screen");
|
||||
mode_str = PrefsFindString("screen");
|
||||
|
||||
// Determine display type and default dimensions
|
||||
int default_width = 512, default_height = 384;
|
||||
int default_width, default_height;
|
||||
if (classic) {
|
||||
default_width = 512;
|
||||
default_height = 342;
|
||||
} else {
|
||||
default_width = 640;
|
||||
default_height = 480;
|
||||
}
|
||||
display_type = DISPLAY_WINDOW;
|
||||
if (mode_str) {
|
||||
if (sscanf(mode_str, "win/%d/%d", &default_width, &default_height) == 2) {
|
||||
|
@ -1713,6 +1727,11 @@ bool VideoInit(bool classic)
|
|||
else if (default_height > DisplayHeight(x_display, screen))
|
||||
default_height = DisplayHeight(x_display, screen);
|
||||
|
||||
// for classic Mac, make sure the display width is divisible by 8
|
||||
if (classic) {
|
||||
default_width = (default_width / 8) * 8;
|
||||
}
|
||||
|
||||
// Mac screen depth follows X depth
|
||||
video_depth default_depth = VDEPTH_1BIT;
|
||||
switch (DefaultDepth(x_display, screen)) {
|
||||
|
@ -1730,7 +1749,7 @@ bool VideoInit(bool classic)
|
|||
// Construct list of supported modes
|
||||
if (display_type == DISPLAY_WINDOW) {
|
||||
if (classic)
|
||||
add_mode(512, 342, 0x80, 64, VDEPTH_1BIT);
|
||||
add_mode(default_width, default_height, 0x80, default_width/8, VDEPTH_1BIT);
|
||||
else {
|
||||
for (unsigned d=VDEPTH_1BIT; d<=VDEPTH_32BIT; d++) {
|
||||
if (find_visual_for_depth(video_depth(d)))
|
||||
|
|
|
@ -74,6 +74,9 @@ extern uint32 InterruptFlags; // Currently pending interrupts
|
|||
extern void SetInterruptFlag(uint32 flag); // Set/clear interrupt flags
|
||||
extern void ClearInterruptFlag(uint32 flag);
|
||||
|
||||
// vde switch variable
|
||||
extern char* vde_sock;
|
||||
|
||||
// Array length
|
||||
#if __cplusplus >= 201103L || (_MSC_VER >= 1900 && defined __cplusplus)
|
||||
template <typename T, size_t size>
|
||||
|
|
|
@ -188,7 +188,36 @@ enum {
|
|||
STR_RAMSIZE_FMT,
|
||||
STR_MODELID_CTRL,
|
||||
STR_MODELID_5_LAB,
|
||||
STR_MODELID_7_LAB,
|
||||
STR_MODELID_12_LAB,
|
||||
STR_MODELID_13_LAB,
|
||||
STR_MODELID_14_LAB,
|
||||
STR_MODELID_15_LAB,
|
||||
STR_MODELID_16_LAB,
|
||||
STR_MODELID_19_LAB,
|
||||
STR_MODELID_20_LAB,
|
||||
STR_MODELID_21_LAB,
|
||||
STR_MODELID_24_LAB,
|
||||
STR_MODELID_29_LAB,
|
||||
STR_MODELID_30_LAB,
|
||||
STR_MODELID_31_LAB,
|
||||
STR_MODELID_38_LAB,
|
||||
STR_MODELID_39_LAB,
|
||||
STR_MODELID_42_LAB,
|
||||
STR_MODELID_43_LAB,
|
||||
STR_MODELID_46_LAB,
|
||||
STR_MODELID_47_LAB,
|
||||
STR_MODELID_50_LAB,
|
||||
STR_MODELID_54_LAB,
|
||||
STR_MODELID_56_LAB,
|
||||
STR_MODELID_72_LAB,
|
||||
STR_MODELID_74_LAB,
|
||||
STR_MODELID_82_LAB,
|
||||
STR_MODELID_83_LAB,
|
||||
STR_MODELID_86_LAB,
|
||||
STR_MODELID_87_LAB,
|
||||
STR_MODELID_92_LAB,
|
||||
STR_MODELID_93_LAB,
|
||||
STR_CPU_CTRL,
|
||||
STR_CPU_68020_LAB,
|
||||
STR_CPU_68020_FPU_LAB,
|
||||
|
|
|
@ -258,7 +258,10 @@ public:
|
|||
|
||||
// Vector of pointers to available monitor descriptions, filled by VideoInit()
|
||||
extern vector<monitor_desc *> VideoMonitors;
|
||||
|
||||
// Guest OS Screen Width
|
||||
extern uint32 MacScreenWidth;
|
||||
// Guest OS Screen Height
|
||||
extern uint32 MacScreenHeight;
|
||||
|
||||
extern int16 VideoDriverOpen(uint32 pb, uint32 dce);
|
||||
extern int16 VideoDriverControl(uint32 pb, uint32 dce);
|
||||
|
|
|
@ -1008,6 +1008,178 @@ static bool patch_rom_classic(void)
|
|||
*wp++ = htons(M68K_EMUL_OP_IRQ);
|
||||
*wp++ = htons(0x4a80); // tst.l d0
|
||||
*wp = htons(0x67f4); // beq 0x402be2
|
||||
|
||||
|
||||
// Patch the guest screen for an arbitary resolution
|
||||
// We are going to steal the abandoned ROM space that runs RAM test
|
||||
// for patching ROM.
|
||||
|
||||
// a stateful variable to keep track of the stolen location
|
||||
// of the patched code in guest memory.
|
||||
uint32 patchCodeBaseMac;
|
||||
// a stateful word pointer pointing to the patch code in host memory.
|
||||
uint16* patchwp;
|
||||
// a stateful long pointer pointing to the patch code in host memory.
|
||||
uint32* patchlp;
|
||||
// a statless long pointer
|
||||
uint32* lp;
|
||||
|
||||
// start to patch P_mInitVideoGlobal route
|
||||
wp = (uint16 *)(ROMBaseHost + 0x5ca);
|
||||
*wp++ = htons(0x4eb9); /* JSR */
|
||||
lp = (uint32 *)wp;
|
||||
|
||||
// we steal P_mRamTest routine space
|
||||
const uint32 patchCodeOffset = 0x1d3e;
|
||||
patchCodeBaseMac = ROMBaseMac + patchCodeOffset;
|
||||
uint8* patchCodeBaseHost = ROMBaseHost + patchCodeOffset;
|
||||
// we JSR to this Mac address
|
||||
*lp++ = htonl(patchCodeBaseMac);
|
||||
wp = (uint16 *)lp;
|
||||
|
||||
// the host address for the patch
|
||||
patchwp = (uint16 *)(patchCodeBaseHost);
|
||||
// MOVE.L $MacFrameBaseMac24Bit, ($ScrnBase)
|
||||
*patchwp++ = htons(0x21fc); /* MOVE.L */
|
||||
patchCodeBaseMac += 2;
|
||||
|
||||
patchlp = (uint32 *)patchwp;
|
||||
*patchlp++ = htonl(MacFrameBaseMac24Bit);
|
||||
patchCodeBaseMac += 4;
|
||||
|
||||
patchwp = (uint16 *)patchlp;
|
||||
*patchwp++ = htons(0x0824); /* (ScrnBase) */
|
||||
patchCodeBaseMac += 2;
|
||||
|
||||
*patchwp++ = htons(0x4e75); /* RTS */
|
||||
patchCodeBaseMac += 2;
|
||||
// keep in sync
|
||||
patchlp = (uint32 *)patchwp;
|
||||
|
||||
// continue to patch P_mInitVideoGlobal routine
|
||||
wp = (uint16 *)(ROMBaseHost + 0x5d2);
|
||||
*wp = htons(MacScreenWidth / 8);
|
||||
wp = (uint16 *)(ROMBaseHost + 0x60a);
|
||||
*wp = htons(MacScreenHeight);
|
||||
wp = (uint16 *)(ROMBaseHost + 0x60e);
|
||||
*wp = htons(MacScreenWidth);
|
||||
|
||||
wp = (uint16 *)(ROMBaseHost + 0x8cc);
|
||||
*wp = htons(MacScreenHeight);
|
||||
wp = (uint16 *)(ROMBaseHost + 0x8ce);
|
||||
*wp = htons(MacScreenWidth);
|
||||
|
||||
// blink floppy, disk icon
|
||||
lp = (uint32 *)(ROMBaseHost + 0xf4c);
|
||||
*lp = htonl(MacFrameBaseMac24Bit + (((MacScreenHeight / 4) * 2 - 25) * MacScreenWidth + (MacScreenWidth / 2 - 16)) / 8);
|
||||
// blink floppy, question mark
|
||||
lp = (uint32 *)(ROMBaseHost + 0xf5e);
|
||||
*lp = htonl(MacFrameBaseMac24Bit + (((MacScreenHeight / 4) * 2 - 10) * MacScreenWidth + (MacScreenWidth / 2 - 8)) / 8);
|
||||
|
||||
lp = (uint32 *)(ROMBaseHost + 0x10a2);
|
||||
*lp = htonl(MacFrameBaseMac24Bit);
|
||||
wp = (uint16 *)(ROMBaseHost + 0x10a8);
|
||||
*wp = htons(MacScreenHeight);
|
||||
wp = (uint16 *)(ROMBaseHost + 0x10ac);
|
||||
*wp = htons(MacScreenWidth);
|
||||
wp = (uint16 *)(ROMBaseHost + 0x10b0);
|
||||
*wp = htons(MacScreenWidth / 8);
|
||||
lp = (uint32 *)(ROMBaseHost + 0x10b4);
|
||||
// # of bytes in screen
|
||||
*lp = htonl(MacScreenWidth * MacScreenHeight / 8);
|
||||
|
||||
// sad mac, mac icon
|
||||
lp = (uint32 *)(ROMBaseHost + 0x118a);
|
||||
*lp = htonl(MacFrameBaseMac24Bit + (((MacScreenHeight / 4) * 2 - 25) * MacScreenWidth + (MacScreenWidth / 2 - 16)) / 8);
|
||||
// sad mac, frown
|
||||
lp = (uint32 *)(ROMBaseHost + 0x1198);
|
||||
*lp = htonl(MacFrameBaseMac24Bit + (((MacScreenHeight / 4) * 2 - 19) * MacScreenWidth + (MacScreenWidth / 2 - 8)) / 8);
|
||||
wp = (uint16 *)(ROMBaseHost + 0x11b0);
|
||||
*wp = htons(MacScreenWidth / 8);
|
||||
|
||||
// blink floppy and sadmac, position
|
||||
wp = (uint16 *)(ROMBaseHost + 0x11d8);
|
||||
*wp = htons(MacScreenWidth / 8);
|
||||
wp = (uint16 *)(ROMBaseHost + 0x11ea);
|
||||
*wp = htons(MacScreenWidth / 8);
|
||||
|
||||
// cursor handling
|
||||
if (MacScreenWidth >= 1024) {
|
||||
// start to patch P_HideCursor routine
|
||||
wp = (uint16 *)(ROMBaseHost + 0x18dfe);
|
||||
*wp++ = htons(0x4eb9); /* JSR */
|
||||
lp = (uint32 *)wp;
|
||||
*lp++ = htonl(patchCodeBaseMac);
|
||||
wp = (uint16 *)lp;
|
||||
|
||||
*patchwp++ = htons(0x41f8); /* Lea.L (CrsrSave),A0 */
|
||||
patchCodeBaseMac += 2;
|
||||
*patchwp++ = htons(0x088c);
|
||||
patchCodeBaseMac += 2;
|
||||
|
||||
*patchwp++ = htons(0x203c); /* MOVE.L #$x,D0 */
|
||||
patchCodeBaseMac += 2;
|
||||
patchlp = (uint32 *)patchwp;
|
||||
*patchlp++ = htonl(MacScreenWidth / 8);
|
||||
patchCodeBaseMac += 4;
|
||||
patchwp = (uint16 *)patchlp;
|
||||
|
||||
*patchwp++ = htons(0x4e75); /* RTS */
|
||||
patchCodeBaseMac += 2;
|
||||
patchlp = (uint32 *)patchwp; // keep in sync
|
||||
} else {
|
||||
// P_HideCursor
|
||||
wp = (uint16 *)(ROMBaseHost + 0x18e02);
|
||||
*wp = htons(0x7000 + (MacScreenWidth / 8));
|
||||
} // end if (MacScreenWidth >= 1024)
|
||||
|
||||
wp = (uint16 *)(ROMBaseHost + 0x18e7a);
|
||||
*wp = htons(MacScreenWidth - 32);
|
||||
wp = (uint16 *)(ROMBaseHost + 0x18e80);
|
||||
*wp = htons(MacScreenWidth - 32);
|
||||
wp = (uint16 *)(ROMBaseHost + 0x18ea0);
|
||||
*wp = htons(MacScreenHeight - 16);
|
||||
wp = (uint16 *)(ROMBaseHost + 0x18ea6);
|
||||
*wp = htons(MacScreenHeight);
|
||||
|
||||
if (MacScreenWidth >= 1024) {
|
||||
// start to patch P_ShowCursor routine
|
||||
wp = (uint16 *)(ROMBaseHost + 0x18ec4);
|
||||
*wp++ = htons(0x4eb9); /* JSR */
|
||||
lp = (uint32 *)wp;
|
||||
*lp++ = htonl(patchCodeBaseMac);
|
||||
wp = (uint16 *)lp;
|
||||
|
||||
*patchwp++ = htons(0x2a3c); /* MOVE.L #$x, D5 */
|
||||
patchCodeBaseMac += 2;
|
||||
patchlp = (uint32 *)patchwp;
|
||||
*patchlp++ = htonl(MacScreenWidth / 8);
|
||||
patchCodeBaseMac += 4;
|
||||
patchwp = (uint16 *)patchlp;
|
||||
|
||||
*patchwp++ = htons(0xc2c5); /* MulU D5, D1 */
|
||||
patchCodeBaseMac += 2;
|
||||
|
||||
*patchwp++ = htons(0xd3c1); /* AddA.L D1, A1 */
|
||||
patchCodeBaseMac += 2;
|
||||
|
||||
*patchwp++ = htons(0x4e75); /* RTS */
|
||||
patchCodeBaseMac += 2;
|
||||
// keep in sync
|
||||
patchlp = (uint32 *)patchwp;
|
||||
} else {
|
||||
wp = (uint16 *)(ROMBaseHost + 0x18ec4);
|
||||
*wp = htons(0x7A00 + (MacScreenWidth / 8));
|
||||
}// end if (MacScreenWidth >= 1024)
|
||||
|
||||
// set up screen bitmap
|
||||
wp = (uint16 *)(ROMBaseHost + 0x18f9a);
|
||||
*wp = htons(MacScreenHeight);
|
||||
wp = (uint16 *)(ROMBaseHost + 0x18fa0);
|
||||
*wp = htons(MacScreenWidth);
|
||||
wp = (uint16 *)(ROMBaseHost + 0x18fb4);
|
||||
*wp = htons(MacScreenHeight);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,10 @@ extern uint32 ROMBaseMac; // ROM base (Mac address space)
|
|||
extern uint8 *ROMBaseHost; // ROM base (host address space)
|
||||
extern uint32 ROMSize; // Size of ROM
|
||||
|
||||
// For 24 Bit ROM, we maps the guest OS frame buffer address above 4MiB RAM
|
||||
// and ROM but less than 16 MiB.
|
||||
const uint32 MacFrameBaseMac24Bit = 0x00500000;
|
||||
|
||||
#if !REAL_ADDRESSING && !DIRECT_ADDRESSING
|
||||
// If we are not using real or direct addressing, the Mac frame buffer gets
|
||||
// mapped to this location. The memory must be allocated by VideoInit().
|
||||
|
|
|
@ -53,27 +53,27 @@ addrbank mem_banks[65536];
|
|||
#ifdef NO_INLINE_MEMORY_ACCESS
|
||||
uae_u32 longget (uaecptr addr)
|
||||
{
|
||||
return call_mem_get_func (get_mem_bank (addr).lget, addr);
|
||||
return call_mem_get_func (get_mem_bank (addr).lget, addr);
|
||||
}
|
||||
uae_u32 wordget (uaecptr addr)
|
||||
{
|
||||
return call_mem_get_func (get_mem_bank (addr).wget, addr);
|
||||
return call_mem_get_func (get_mem_bank (addr).wget, addr);
|
||||
}
|
||||
uae_u32 byteget (uaecptr addr)
|
||||
{
|
||||
return call_mem_get_func (get_mem_bank (addr).bget, addr);
|
||||
return call_mem_get_func (get_mem_bank (addr).bget, addr);
|
||||
}
|
||||
void longput (uaecptr addr, uae_u32 l)
|
||||
{
|
||||
call_mem_put_func (get_mem_bank (addr).lput, addr, l);
|
||||
call_mem_put_func (get_mem_bank (addr).lput, addr, l);
|
||||
}
|
||||
void wordput (uaecptr addr, uae_u32 w)
|
||||
{
|
||||
call_mem_put_func (get_mem_bank (addr).wput, addr, w);
|
||||
call_mem_put_func (get_mem_bank (addr).wput, addr, w);
|
||||
}
|
||||
void byteput (uaecptr addr, uae_u32 b)
|
||||
{
|
||||
call_mem_put_func (get_mem_bank (addr).bput, addr, b);
|
||||
call_mem_put_func (get_mem_bank (addr).bput, addr, b);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -88,42 +88,42 @@ static void REGPARAM2 dummy_bput (uaecptr, uae_u32) REGPARAM;
|
|||
|
||||
uae_u32 REGPARAM2 dummy_lget (uaecptr addr)
|
||||
{
|
||||
if (illegal_mem)
|
||||
write_log ("Illegal lget at %08x\n", addr);
|
||||
if (illegal_mem)
|
||||
write_log ("Illegal lget at %08x\n", addr);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uae_u32 REGPARAM2 dummy_wget (uaecptr addr)
|
||||
{
|
||||
if (illegal_mem)
|
||||
write_log ("Illegal wget at %08x\n", addr);
|
||||
if (illegal_mem)
|
||||
write_log ("Illegal wget at %08x\n", addr);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uae_u32 REGPARAM2 dummy_bget (uaecptr addr)
|
||||
{
|
||||
if (illegal_mem)
|
||||
write_log ("Illegal bget at %08x\n", addr);
|
||||
if (illegal_mem)
|
||||
write_log ("Illegal bget at %08x\n", addr);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void REGPARAM2 dummy_lput (uaecptr addr, uae_u32 l)
|
||||
{
|
||||
if (illegal_mem)
|
||||
write_log ("Illegal lput at %08x\n", addr);
|
||||
if (illegal_mem)
|
||||
write_log ("Illegal lput at %08x\n", addr);
|
||||
}
|
||||
void REGPARAM2 dummy_wput (uaecptr addr, uae_u32 w)
|
||||
{
|
||||
if (illegal_mem)
|
||||
write_log ("Illegal wput at %08x\n", addr);
|
||||
if (illegal_mem)
|
||||
write_log ("Illegal wput at %08x\n", addr);
|
||||
}
|
||||
void REGPARAM2 dummy_bput (uaecptr addr, uae_u32 b)
|
||||
{
|
||||
if (illegal_mem)
|
||||
write_log ("Illegal bput at %08x\n", addr);
|
||||
if (illegal_mem)
|
||||
write_log ("Illegal bput at %08x\n", addr);
|
||||
}
|
||||
|
||||
/* Mac RAM (32 bit addressing) */
|
||||
|
@ -140,35 +140,35 @@ static uintptr RAMBaseDiff; // RAMBaseHost - RAMBaseMac
|
|||
|
||||
uae_u32 REGPARAM2 ram_lget(uaecptr addr)
|
||||
{
|
||||
uae_u32 *m;
|
||||
m = (uae_u32 *)(RAMBaseDiff + addr);
|
||||
return do_get_mem_long(m);
|
||||
uae_u32 *m;
|
||||
m = (uae_u32 *)(RAMBaseDiff + addr);
|
||||
return do_get_mem_long(m);
|
||||
}
|
||||
|
||||
uae_u32 REGPARAM2 ram_wget(uaecptr addr)
|
||||
{
|
||||
uae_u16 *m;
|
||||
m = (uae_u16 *)(RAMBaseDiff + addr);
|
||||
return do_get_mem_word(m);
|
||||
uae_u16 *m;
|
||||
m = (uae_u16 *)(RAMBaseDiff + addr);
|
||||
return do_get_mem_word(m);
|
||||
}
|
||||
|
||||
uae_u32 REGPARAM2 ram_bget(uaecptr addr)
|
||||
{
|
||||
return (uae_u32)*(uae_u8 *)(RAMBaseDiff + addr);
|
||||
return (uae_u32)*(uae_u8 *)(RAMBaseDiff + addr);
|
||||
}
|
||||
|
||||
void REGPARAM2 ram_lput(uaecptr addr, uae_u32 l)
|
||||
{
|
||||
uae_u32 *m;
|
||||
m = (uae_u32 *)(RAMBaseDiff + addr);
|
||||
do_put_mem_long(m, l);
|
||||
uae_u32 *m;
|
||||
m = (uae_u32 *)(RAMBaseDiff + addr);
|
||||
do_put_mem_long(m, l);
|
||||
}
|
||||
|
||||
void REGPARAM2 ram_wput(uaecptr addr, uae_u32 w)
|
||||
{
|
||||
uae_u16 *m;
|
||||
m = (uae_u16 *)(RAMBaseDiff + addr);
|
||||
do_put_mem_word(m, w);
|
||||
uae_u16 *m;
|
||||
m = (uae_u16 *)(RAMBaseDiff + addr);
|
||||
do_put_mem_word(m, w);
|
||||
}
|
||||
|
||||
void REGPARAM2 ram_bput(uaecptr addr, uae_u32 b)
|
||||
|
@ -178,7 +178,7 @@ void REGPARAM2 ram_bput(uaecptr addr, uae_u32 b)
|
|||
|
||||
uae_u8 *REGPARAM2 ram_xlate(uaecptr addr)
|
||||
{
|
||||
return (uae_u8 *)(RAMBaseDiff + addr);
|
||||
return (uae_u8 *)(RAMBaseDiff + addr);
|
||||
}
|
||||
|
||||
/* Mac RAM (24 bit addressing) */
|
||||
|
@ -193,35 +193,35 @@ static uae_u8 *REGPARAM2 ram24_xlate(uaecptr addr) REGPARAM;
|
|||
|
||||
uae_u32 REGPARAM2 ram24_lget(uaecptr addr)
|
||||
{
|
||||
uae_u32 *m;
|
||||
m = (uae_u32 *)(RAMBaseDiff + (addr & 0xffffff));
|
||||
return do_get_mem_long(m);
|
||||
uae_u32 *m;
|
||||
m = (uae_u32 *)(RAMBaseDiff + (addr & 0xffffff));
|
||||
return do_get_mem_long(m);
|
||||
}
|
||||
|
||||
uae_u32 REGPARAM2 ram24_wget(uaecptr addr)
|
||||
{
|
||||
uae_u16 *m;
|
||||
m = (uae_u16 *)(RAMBaseDiff + (addr & 0xffffff));
|
||||
return do_get_mem_word(m);
|
||||
uae_u16 *m;
|
||||
m = (uae_u16 *)(RAMBaseDiff + (addr & 0xffffff));
|
||||
return do_get_mem_word(m);
|
||||
}
|
||||
|
||||
uae_u32 REGPARAM2 ram24_bget(uaecptr addr)
|
||||
{
|
||||
return (uae_u32)*(uae_u8 *)(RAMBaseDiff + (addr & 0xffffff));
|
||||
return (uae_u32)*(uae_u8 *)(RAMBaseDiff + (addr & 0xffffff));
|
||||
}
|
||||
|
||||
void REGPARAM2 ram24_lput(uaecptr addr, uae_u32 l)
|
||||
{
|
||||
uae_u32 *m;
|
||||
m = (uae_u32 *)(RAMBaseDiff + (addr & 0xffffff));
|
||||
do_put_mem_long(m, l);
|
||||
uae_u32 *m;
|
||||
m = (uae_u32 *)(RAMBaseDiff + (addr & 0xffffff));
|
||||
do_put_mem_long(m, l);
|
||||
}
|
||||
|
||||
void REGPARAM2 ram24_wput(uaecptr addr, uae_u32 w)
|
||||
{
|
||||
uae_u16 *m;
|
||||
m = (uae_u16 *)(RAMBaseDiff + (addr & 0xffffff));
|
||||
do_put_mem_word(m, w);
|
||||
uae_u16 *m;
|
||||
m = (uae_u16 *)(RAMBaseDiff + (addr & 0xffffff));
|
||||
do_put_mem_word(m, w);
|
||||
}
|
||||
|
||||
void REGPARAM2 ram24_bput(uaecptr addr, uae_u32 b)
|
||||
|
@ -231,7 +231,7 @@ void REGPARAM2 ram24_bput(uaecptr addr, uae_u32 b)
|
|||
|
||||
uae_u8 *REGPARAM2 ram24_xlate(uaecptr addr)
|
||||
{
|
||||
return (uae_u8 *)(RAMBaseDiff + (addr & 0xffffff));
|
||||
return (uae_u8 *)(RAMBaseDiff + (addr & 0xffffff));
|
||||
}
|
||||
|
||||
/* Mac ROM (32 bit addressing) */
|
||||
|
@ -248,44 +248,44 @@ static uintptr ROMBaseDiff; // ROMBaseHost - ROMBaseMac
|
|||
|
||||
uae_u32 REGPARAM2 rom_lget(uaecptr addr)
|
||||
{
|
||||
uae_u32 *m;
|
||||
m = (uae_u32 *)(ROMBaseDiff + addr);
|
||||
return do_get_mem_long(m);
|
||||
uae_u32 *m;
|
||||
m = (uae_u32 *)(ROMBaseDiff + addr);
|
||||
return do_get_mem_long(m);
|
||||
}
|
||||
|
||||
uae_u32 REGPARAM2 rom_wget(uaecptr addr)
|
||||
{
|
||||
uae_u16 *m;
|
||||
m = (uae_u16 *)(ROMBaseDiff + addr);
|
||||
return do_get_mem_word(m);
|
||||
uae_u16 *m;
|
||||
m = (uae_u16 *)(ROMBaseDiff + addr);
|
||||
return do_get_mem_word(m);
|
||||
}
|
||||
|
||||
uae_u32 REGPARAM2 rom_bget(uaecptr addr)
|
||||
{
|
||||
return (uae_u32)*(uae_u8 *)(ROMBaseDiff + addr);
|
||||
return (uae_u32)*(uae_u8 *)(ROMBaseDiff + addr);
|
||||
}
|
||||
|
||||
void REGPARAM2 rom_lput(uaecptr addr, uae_u32 b)
|
||||
{
|
||||
if (illegal_mem)
|
||||
write_log ("Illegal ROM lput at %08x\n", addr);
|
||||
if (illegal_mem)
|
||||
write_log ("Illegal ROM lput at %08x\n", addr);
|
||||
}
|
||||
|
||||
void REGPARAM2 rom_wput(uaecptr addr, uae_u32 b)
|
||||
{
|
||||
if (illegal_mem)
|
||||
write_log ("Illegal ROM wput at %08x\n", addr);
|
||||
if (illegal_mem)
|
||||
write_log ("Illegal ROM wput at %08x\n", addr);
|
||||
}
|
||||
|
||||
void REGPARAM2 rom_bput(uaecptr addr, uae_u32 b)
|
||||
{
|
||||
if (illegal_mem)
|
||||
write_log ("Illegal ROM bput at %08x\n", addr);
|
||||
if (illegal_mem)
|
||||
write_log ("Illegal ROM bput at %08x\n", addr);
|
||||
}
|
||||
|
||||
uae_u8 *REGPARAM2 rom_xlate(uaecptr addr)
|
||||
{
|
||||
return (uae_u8 *)(ROMBaseDiff + addr);
|
||||
return (uae_u8 *)(ROMBaseDiff + addr);
|
||||
}
|
||||
|
||||
/* Mac ROM (24 bit addressing) */
|
||||
|
@ -297,26 +297,26 @@ static uae_u8 *REGPARAM2 rom24_xlate(uaecptr addr) REGPARAM;
|
|||
|
||||
uae_u32 REGPARAM2 rom24_lget(uaecptr addr)
|
||||
{
|
||||
uae_u32 *m;
|
||||
m = (uae_u32 *)(ROMBaseDiff + (addr & 0xffffff));
|
||||
return do_get_mem_long(m);
|
||||
uae_u32 *m;
|
||||
m = (uae_u32 *)(ROMBaseDiff + (addr & 0xffffff));
|
||||
return do_get_mem_long(m);
|
||||
}
|
||||
|
||||
uae_u32 REGPARAM2 rom24_wget(uaecptr addr)
|
||||
{
|
||||
uae_u16 *m;
|
||||
m = (uae_u16 *)(ROMBaseDiff + (addr & 0xffffff));
|
||||
return do_get_mem_word(m);
|
||||
uae_u16 *m;
|
||||
m = (uae_u16 *)(ROMBaseDiff + (addr & 0xffffff));
|
||||
return do_get_mem_word(m);
|
||||
}
|
||||
|
||||
uae_u32 REGPARAM2 rom24_bget(uaecptr addr)
|
||||
{
|
||||
return (uae_u32)*(uae_u8 *)(ROMBaseDiff + (addr & 0xffffff));
|
||||
return (uae_u32)*(uae_u8 *)(ROMBaseDiff + (addr & 0xffffff));
|
||||
}
|
||||
|
||||
uae_u8 *REGPARAM2 rom24_xlate(uaecptr addr)
|
||||
{
|
||||
return (uae_u8 *)(ROMBaseDiff + (addr & 0xffffff));
|
||||
return (uae_u8 *)(ROMBaseDiff + (addr & 0xffffff));
|
||||
}
|
||||
|
||||
/* Frame buffer */
|
||||
|
@ -347,238 +347,264 @@ static uintptr FrameBaseDiff; // MacFrameBaseHost - MacFrameBaseMac
|
|||
|
||||
uae_u32 REGPARAM2 frame_direct_lget(uaecptr addr)
|
||||
{
|
||||
uae_u32 *m;
|
||||
m = (uae_u32 *)(FrameBaseDiff + addr);
|
||||
return do_get_mem_long(m);
|
||||
uae_u32 *m;
|
||||
m = (uae_u32 *)(FrameBaseDiff + addr);
|
||||
return do_get_mem_long(m);
|
||||
}
|
||||
|
||||
uae_u32 REGPARAM2 frame_direct_wget(uaecptr addr)
|
||||
{
|
||||
uae_u16 *m;
|
||||
m = (uae_u16 *)(FrameBaseDiff + addr);
|
||||
return do_get_mem_word(m);
|
||||
uae_u16 *m;
|
||||
m = (uae_u16 *)(FrameBaseDiff + addr);
|
||||
return do_get_mem_word(m);
|
||||
}
|
||||
|
||||
uae_u32 REGPARAM2 frame_direct_bget(uaecptr addr)
|
||||
{
|
||||
return (uae_u32)*(uae_u8 *)(FrameBaseDiff + addr);
|
||||
return (uae_u32)*(uae_u8 *)(FrameBaseDiff + addr);
|
||||
}
|
||||
|
||||
void REGPARAM2 frame_direct_lput(uaecptr addr, uae_u32 l)
|
||||
{
|
||||
uae_u32 *m;
|
||||
m = (uae_u32 *)(FrameBaseDiff + addr);
|
||||
do_put_mem_long(m, l);
|
||||
uae_u32 *m;
|
||||
m = (uae_u32 *)(FrameBaseDiff + addr);
|
||||
do_put_mem_long(m, l);
|
||||
}
|
||||
|
||||
void REGPARAM2 frame_direct_wput(uaecptr addr, uae_u32 w)
|
||||
{
|
||||
uae_u16 *m;
|
||||
m = (uae_u16 *)(FrameBaseDiff + addr);
|
||||
do_put_mem_word(m, w);
|
||||
uae_u16 *m;
|
||||
m = (uae_u16 *)(FrameBaseDiff + addr);
|
||||
do_put_mem_word(m, w);
|
||||
}
|
||||
|
||||
void REGPARAM2 frame_direct_bput(uaecptr addr, uae_u32 b)
|
||||
{
|
||||
*(uae_u8 *)(FrameBaseDiff + addr) = b;
|
||||
*(uae_u8 *)(FrameBaseDiff + addr) = b;
|
||||
}
|
||||
|
||||
uae_u32 REGPARAM2 frame_host_555_lget(uaecptr addr)
|
||||
{
|
||||
uae_u32 *m, l;
|
||||
m = (uae_u32 *)(FrameBaseDiff + addr);
|
||||
l = *m;
|
||||
uae_u32 *m, l;
|
||||
m = (uae_u32 *)(FrameBaseDiff + addr);
|
||||
l = *m;
|
||||
return swap_words(l);
|
||||
}
|
||||
|
||||
uae_u32 REGPARAM2 frame_host_555_wget(uaecptr addr)
|
||||
{
|
||||
uae_u16 *m;
|
||||
m = (uae_u16 *)(FrameBaseDiff + addr);
|
||||
return *m;
|
||||
uae_u16 *m;
|
||||
m = (uae_u16 *)(FrameBaseDiff + addr);
|
||||
return *m;
|
||||
}
|
||||
|
||||
void REGPARAM2 frame_host_555_lput(uaecptr addr, uae_u32 l)
|
||||
{
|
||||
uae_u32 *m;
|
||||
m = (uae_u32 *)(FrameBaseDiff + addr);
|
||||
*m = swap_words(l);
|
||||
uae_u32 *m;
|
||||
m = (uae_u32 *)(FrameBaseDiff + addr);
|
||||
*m = swap_words(l);
|
||||
}
|
||||
|
||||
void REGPARAM2 frame_host_555_wput(uaecptr addr, uae_u32 w)
|
||||
{
|
||||
uae_u16 *m;
|
||||
m = (uae_u16 *)(FrameBaseDiff + addr);
|
||||
*m = w;
|
||||
uae_u16 *m;
|
||||
m = (uae_u16 *)(FrameBaseDiff + addr);
|
||||
*m = w;
|
||||
}
|
||||
|
||||
uae_u32 REGPARAM2 frame_host_565_lget(uaecptr addr)
|
||||
{
|
||||
uae_u32 *m, l;
|
||||
m = (uae_u32 *)(FrameBaseDiff + addr);
|
||||
l = *m;
|
||||
l = (l & 0x001f001f) | ((l >> 1) & 0x7fe07fe0);
|
||||
return swap_words(l);
|
||||
uae_u32 *m, l;
|
||||
m = (uae_u32 *)(FrameBaseDiff + addr);
|
||||
l = *m;
|
||||
l = (l & 0x001f001f) | ((l >> 1) & 0x7fe07fe0);
|
||||
return swap_words(l);
|
||||
}
|
||||
|
||||
uae_u32 REGPARAM2 frame_host_565_wget(uaecptr addr)
|
||||
{
|
||||
uae_u16 *m, w;
|
||||
m = (uae_u16 *)(FrameBaseDiff + addr);
|
||||
w = *m;
|
||||
return (w & 0x1f) | ((w >> 1) & 0x7fe0);
|
||||
uae_u16 *m, w;
|
||||
m = (uae_u16 *)(FrameBaseDiff + addr);
|
||||
w = *m;
|
||||
return (w & 0x1f) | ((w >> 1) & 0x7fe0);
|
||||
}
|
||||
|
||||
void REGPARAM2 frame_host_565_lput(uaecptr addr, uae_u32 l)
|
||||
{
|
||||
uae_u32 *m;
|
||||
m = (uae_u32 *)(FrameBaseDiff + addr);
|
||||
l = (l & 0x001f001f) | ((l << 1) & 0xffc0ffc0);
|
||||
*m = swap_words(l);
|
||||
uae_u32 *m;
|
||||
m = (uae_u32 *)(FrameBaseDiff + addr);
|
||||
l = (l & 0x001f001f) | ((l << 1) & 0xffc0ffc0);
|
||||
*m = swap_words(l);
|
||||
}
|
||||
|
||||
void REGPARAM2 frame_host_565_wput(uaecptr addr, uae_u32 w)
|
||||
{
|
||||
uae_u16 *m;
|
||||
m = (uae_u16 *)(FrameBaseDiff + addr);
|
||||
*m = (w & 0x1f) | ((w << 1) & 0xffc0);
|
||||
uae_u16 *m;
|
||||
m = (uae_u16 *)(FrameBaseDiff + addr);
|
||||
*m = (w & 0x1f) | ((w << 1) & 0xffc0);
|
||||
}
|
||||
|
||||
uae_u32 REGPARAM2 frame_host_888_lget(uaecptr addr)
|
||||
{
|
||||
uae_u32 *m, l;
|
||||
m = (uae_u32 *)(FrameBaseDiff + addr);
|
||||
return *m;
|
||||
uae_u32 *m, l;
|
||||
m = (uae_u32 *)(FrameBaseDiff + addr);
|
||||
return *m;
|
||||
}
|
||||
|
||||
void REGPARAM2 frame_host_888_lput(uaecptr addr, uae_u32 l)
|
||||
{
|
||||
uae_u32 *m;
|
||||
m = (uae_u32 *)(MacFrameBaseHost + addr - MacFrameBaseMac);
|
||||
*m = l;
|
||||
uae_u32 *m;
|
||||
m = (uae_u32 *)(MacFrameBaseHost + addr - MacFrameBaseMac);
|
||||
*m = l;
|
||||
}
|
||||
|
||||
uae_u8 *REGPARAM2 frame_xlate(uaecptr addr)
|
||||
{
|
||||
return (uae_u8 *)(FrameBaseDiff + addr);
|
||||
return (uae_u8 *)(FrameBaseDiff + addr);
|
||||
}
|
||||
|
||||
/* Mac framebuffer RAM (24 bit addressing)
|
||||
/* Mac framebuffer RAM (24 bit addressing) */
|
||||
static uae_u32 REGPARAM2 frame24_lget(uaecptr) REGPARAM;
|
||||
static uae_u32 REGPARAM2 frame24_wget(uaecptr) REGPARAM;
|
||||
static uae_u32 REGPARAM2 frame24_bget(uaecptr) REGPARAM;
|
||||
static void REGPARAM2 frame24_lput(uaecptr, uae_u32) REGPARAM;
|
||||
static void REGPARAM2 frame24_wput(uaecptr, uae_u32) REGPARAM;
|
||||
static void REGPARAM2 frame24_bput(uaecptr, uae_u32) REGPARAM;
|
||||
|
||||
/*
|
||||
* Q: Why the magic number 0xa700 and 0xfc80?
|
||||
*
|
||||
* A: The M68K CPU used by the earlier Macintosh models such as
|
||||
* Macintosh 128K or Macintosh SE, its address space is limited
|
||||
* to 2^24 = 16MiB. The RAM limits to 4MiB.
|
||||
*
|
||||
* With 512x342 1 bit per pixel screen, the size of the frame buffer
|
||||
* is 0x5580 bytes.
|
||||
*
|
||||
* In Macintosh 128K [1], the frame buffer address is mapped from
|
||||
* 0x1A700 to 0x1FC7F.
|
||||
*
|
||||
* In Macintosh SE [2], the frame buffer address is mapped from
|
||||
* 0x3FA700 to 0x3FFC7F.
|
||||
*
|
||||
* The frame24_xxx memory banks mapping used the magic number to
|
||||
* retrieve the offset. The memory write operation does twice:
|
||||
* one for the guest OS and another for the host OS (the write operation
|
||||
* above MacFrameBaseHost).
|
||||
*
|
||||
*
|
||||
* See:
|
||||
* [1] The Apple Macintosh Computer. http://www.1000bit.it/support/articoli/apple/mac128.pdf
|
||||
* [2] Capturing Mac SE's video from PDS. http://synack.net/~bbraun/sevideo/
|
||||
*
|
||||
* This works by duplicating appropriate writes to the 32-bit
|
||||
* address-space framebuffer.
|
||||
*/
|
||||
|
||||
static void REGPARAM2 fram24_lput(uaecptr, uae_u32) REGPARAM;
|
||||
static void REGPARAM2 fram24_wput(uaecptr, uae_u32) REGPARAM;
|
||||
static void REGPARAM2 fram24_bput(uaecptr, uae_u32) REGPARAM;
|
||||
|
||||
void REGPARAM2 fram24_lput(uaecptr addr, uae_u32 l)
|
||||
uae_u32 REGPARAM2 frame24_lget(uaecptr addr)
|
||||
{
|
||||
uaecptr page_off = addr & 0xffff;
|
||||
if (0xa700 <= page_off && page_off < 0xfc80) {
|
||||
uae_u32 *fm;
|
||||
fm = (uae_u32 *)(MacFrameBaseHost + page_off - 0xa700);
|
||||
do_put_mem_long(fm, l);
|
||||
}
|
||||
|
||||
uae_u32 *m;
|
||||
m = (uae_u32 *)(RAMBaseDiff + (addr & 0xffffff));
|
||||
do_put_mem_long(m, l);
|
||||
uae_u32 *m;
|
||||
m = (uae_u32 *)(FrameBaseDiff + (addr & 0xffffff));
|
||||
return do_get_mem_long(m);
|
||||
}
|
||||
|
||||
void REGPARAM2 fram24_wput(uaecptr addr, uae_u32 w)
|
||||
uae_u32 REGPARAM2 frame24_wget(uaecptr addr)
|
||||
{
|
||||
uaecptr page_off = addr & 0xffff;
|
||||
if (0xa700 <= page_off && page_off < 0xfc80) {
|
||||
uae_u16 *fm;
|
||||
fm = (uae_u16 *)(MacFrameBaseHost + page_off - 0xa700);
|
||||
do_put_mem_word(fm, w);
|
||||
}
|
||||
|
||||
uae_u16 *m;
|
||||
m = (uae_u16 *)(RAMBaseDiff + (addr & 0xffffff));
|
||||
do_put_mem_word(m, w);
|
||||
uae_u16 *m;
|
||||
m = (uae_u16 *)(FrameBaseDiff + (addr & 0xffffff));
|
||||
return do_get_mem_word(m);
|
||||
}
|
||||
|
||||
void REGPARAM2 fram24_bput(uaecptr addr, uae_u32 b)
|
||||
uae_u32 REGPARAM2 frame24_bget(uaecptr addr)
|
||||
{
|
||||
uaecptr page_off = addr & 0xffff;
|
||||
if (0xa700 <= page_off && page_off < 0xfc80) {
|
||||
*(uae_u8 *)(MacFrameBaseHost + page_off - 0xa700) = b;
|
||||
}
|
||||
return (uae_u32)*(uae_u8 *)(FrameBaseDiff + (addr & 0xffffff));
|
||||
}
|
||||
|
||||
*(uae_u8 *)(RAMBaseDiff + (addr & 0xffffff)) = b;
|
||||
void REGPARAM2 frame24_lput(uaecptr addr, uae_u32 l)
|
||||
{
|
||||
uae_u32 *m;
|
||||
m = (uae_u32 *)(FrameBaseDiff + (addr & 0xffffffff));
|
||||
do_put_mem_long(m, l);
|
||||
}
|
||||
|
||||
void REGPARAM2 frame24_wput(uaecptr addr, uae_u32 w)
|
||||
{
|
||||
uae_u16 *m;
|
||||
m = (uae_u16 *)(FrameBaseDiff + (addr & 0xffffffff));
|
||||
do_put_mem_word(m, w);
|
||||
}
|
||||
|
||||
void REGPARAM2 frame24_bput(uaecptr addr, uae_u32 b)
|
||||
{
|
||||
*(uae_u8 *)(FrameBaseDiff + (addr & 0xffffffff)) = b;
|
||||
}
|
||||
|
||||
/* Default memory access functions */
|
||||
|
||||
uae_u8 *REGPARAM2 default_xlate (uaecptr a)
|
||||
{
|
||||
write_log("Your Mac program just did something terribly stupid\n");
|
||||
return NULL;
|
||||
write_log("Your Mac program just did something terribly stupid\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Address banks */
|
||||
|
||||
addrbank dummy_bank = {
|
||||
dummy_lget, dummy_wget, dummy_bget,
|
||||
dummy_lput, dummy_wput, dummy_bput,
|
||||
default_xlate
|
||||
dummy_lget, dummy_wget, dummy_bget,
|
||||
dummy_lput, dummy_wput, dummy_bput,
|
||||
default_xlate
|
||||
};
|
||||
|
||||
addrbank ram_bank = {
|
||||
ram_lget, ram_wget, ram_bget,
|
||||
ram_lput, ram_wput, ram_bput,
|
||||
ram_xlate
|
||||
ram_lget, ram_wget, ram_bget,
|
||||
ram_lput, ram_wput, ram_bput,
|
||||
ram_xlate
|
||||
};
|
||||
|
||||
addrbank ram24_bank = {
|
||||
ram24_lget, ram24_wget, ram24_bget,
|
||||
ram24_lput, ram24_wput, ram24_bput,
|
||||
ram24_xlate
|
||||
ram24_lget, ram24_wget, ram24_bget,
|
||||
ram24_lput, ram24_wput, ram24_bput,
|
||||
ram24_xlate
|
||||
};
|
||||
|
||||
addrbank rom_bank = {
|
||||
rom_lget, rom_wget, rom_bget,
|
||||
rom_lput, rom_wput, rom_bput,
|
||||
rom_xlate
|
||||
rom_lget, rom_wget, rom_bget,
|
||||
rom_lput, rom_wput, rom_bput,
|
||||
rom_xlate
|
||||
};
|
||||
|
||||
addrbank rom24_bank = {
|
||||
rom24_lget, rom24_wget, rom24_bget,
|
||||
rom_lput, rom_wput, rom_bput,
|
||||
rom24_xlate
|
||||
rom24_lget, rom24_wget, rom24_bget,
|
||||
rom_lput, rom_wput, rom_bput,
|
||||
rom24_xlate
|
||||
};
|
||||
|
||||
addrbank frame_direct_bank = {
|
||||
frame_direct_lget, frame_direct_wget, frame_direct_bget,
|
||||
frame_direct_lput, frame_direct_wput, frame_direct_bput,
|
||||
frame_xlate
|
||||
frame_direct_lget, frame_direct_wget, frame_direct_bget,
|
||||
frame_direct_lput, frame_direct_wput, frame_direct_bput,
|
||||
frame_xlate
|
||||
};
|
||||
|
||||
addrbank frame_host_555_bank = {
|
||||
frame_host_555_lget, frame_host_555_wget, frame_direct_bget,
|
||||
frame_host_555_lput, frame_host_555_wput, frame_direct_bput,
|
||||
frame_xlate
|
||||
frame_host_555_lget, frame_host_555_wget, frame_direct_bget,
|
||||
frame_host_555_lput, frame_host_555_wput, frame_direct_bput,
|
||||
frame_xlate
|
||||
};
|
||||
|
||||
addrbank frame_host_565_bank = {
|
||||
frame_host_565_lget, frame_host_565_wget, frame_direct_bget,
|
||||
frame_host_565_lput, frame_host_565_wput, frame_direct_bput,
|
||||
frame_xlate
|
||||
frame_host_565_lget, frame_host_565_wget, frame_direct_bget,
|
||||
frame_host_565_lput, frame_host_565_wput, frame_direct_bput,
|
||||
frame_xlate
|
||||
};
|
||||
|
||||
addrbank frame_host_888_bank = {
|
||||
frame_host_888_lget, frame_direct_wget, frame_direct_bget,
|
||||
frame_host_888_lput, frame_direct_wput, frame_direct_bput,
|
||||
frame_xlate
|
||||
frame_host_888_lget, frame_direct_wget, frame_direct_bget,
|
||||
frame_host_888_lput, frame_direct_wput, frame_direct_bput,
|
||||
frame_xlate
|
||||
};
|
||||
|
||||
addrbank fram24_bank = {
|
||||
ram24_lget, ram24_wget, ram24_bget,
|
||||
fram24_lput, fram24_wput, fram24_bput,
|
||||
ram24_xlate
|
||||
addrbank frame24_bank = {
|
||||
frame24_lget, frame24_wget, frame24_bget,
|
||||
frame24_lput, frame24_wput, frame24_bput,
|
||||
default_xlate
|
||||
};
|
||||
|
||||
void memory_init(void)
|
||||
|
@ -591,7 +617,10 @@ void memory_init(void)
|
|||
|
||||
RAMBaseDiff = (uintptr)RAMBaseHost - (uintptr)RAMBaseMac;
|
||||
ROMBaseDiff = (uintptr)ROMBaseHost - (uintptr)ROMBaseMac;
|
||||
FrameBaseDiff = (uintptr)MacFrameBaseHost - (uintptr)MacFrameBaseMac;
|
||||
if (TwentyFourBitAddressing)
|
||||
FrameBaseDiff = (uintptr)MacFrameBaseHost - (uintptr)MacFrameBaseMac24Bit;
|
||||
else
|
||||
FrameBaseDiff = (uintptr)MacFrameBaseHost - (uintptr)MacFrameBaseMac;
|
||||
|
||||
// Map RAM, ROM and display
|
||||
if (TwentyFourBitAddressing) {
|
||||
|
@ -599,43 +628,43 @@ void memory_init(void)
|
|||
map_banks(&rom24_bank, ROMBaseMac >> 16, ROMSize >> 16);
|
||||
|
||||
// Map frame buffer at end of RAM.
|
||||
map_banks(&fram24_bank, ((RAMBaseMac + ram_size) >> 16) - 1, 1);
|
||||
map_banks(&frame24_bank, MacFrameBaseMac24Bit >> 16, (MacFrameSize >> 16) + 1);
|
||||
} else {
|
||||
map_banks(&ram_bank, RAMBaseMac >> 16, ram_size >> 16);
|
||||
map_banks(&rom_bank, ROMBaseMac >> 16, ROMSize >> 16);
|
||||
|
||||
// Map frame buffer
|
||||
// Map frame buffer
|
||||
switch (MacFrameLayout) {
|
||||
case FLAYOUT_DIRECT:
|
||||
map_banks(&frame_direct_bank, MacFrameBaseMac >> 16, (MacFrameSize >> 16) + 1);
|
||||
break;
|
||||
case FLAYOUT_HOST_555:
|
||||
map_banks(&frame_host_555_bank, MacFrameBaseMac >> 16, (MacFrameSize >> 16) + 1);
|
||||
break;
|
||||
case FLAYOUT_HOST_565:
|
||||
map_banks(&frame_host_565_bank, MacFrameBaseMac >> 16, (MacFrameSize >> 16) + 1);
|
||||
break;
|
||||
case FLAYOUT_HOST_888:
|
||||
map_banks(&frame_host_888_bank, MacFrameBaseMac >> 16, (MacFrameSize >> 16) + 1);
|
||||
break;
|
||||
case FLAYOUT_DIRECT:
|
||||
map_banks(&frame_direct_bank, MacFrameBaseMac >> 16, (MacFrameSize >> 16) + 1);
|
||||
break;
|
||||
case FLAYOUT_HOST_555:
|
||||
map_banks(&frame_host_555_bank, MacFrameBaseMac >> 16, (MacFrameSize >> 16) + 1);
|
||||
break;
|
||||
case FLAYOUT_HOST_565:
|
||||
map_banks(&frame_host_565_bank, MacFrameBaseMac >> 16, (MacFrameSize >> 16) + 1);
|
||||
break;
|
||||
case FLAYOUT_HOST_888:
|
||||
map_banks(&frame_host_888_bank, MacFrameBaseMac >> 16, (MacFrameSize >> 16) + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void map_banks(addrbank *bank, int start, int size)
|
||||
{
|
||||
int bnr;
|
||||
unsigned long int hioffs = 0, endhioffs = 0x100;
|
||||
int bnr;
|
||||
unsigned long int hioffs = 0, endhioffs = 0x100;
|
||||
|
||||
if (start >= 0x100) {
|
||||
for (bnr = start; bnr < start + size; bnr++)
|
||||
put_mem_bank (bnr << 16, bank);
|
||||
return;
|
||||
}
|
||||
if (TwentyFourBitAddressing) endhioffs = 0x10000;
|
||||
for (hioffs = 0; hioffs < endhioffs; hioffs += 0x100)
|
||||
for (bnr = start; bnr < start+size; bnr++)
|
||||
put_mem_bank((bnr + hioffs) << 16, bank);
|
||||
if (start >= 0x100) {
|
||||
for (bnr = start; bnr < start + size; bnr++)
|
||||
put_mem_bank (bnr << 16, bank);
|
||||
return;
|
||||
}
|
||||
if (TwentyFourBitAddressing) endhioffs = 0x10000;
|
||||
for (hioffs = 0; hioffs < endhioffs; hioffs += 0x100)
|
||||
for (bnr = start; bnr < start+size; bnr++)
|
||||
put_mem_bank((bnr + hioffs) << 16, bank);
|
||||
}
|
||||
|
||||
#endif /* !REAL_ADDRESSING && !DIRECT_ADDRESSING */
|
||||
|
|
|
@ -203,7 +203,36 @@ user_string_def common_strings[] = {
|
|||
{STR_RAMSIZE_FMT, "%ld MB"},
|
||||
{STR_MODELID_CTRL, "Mac Model ID"},
|
||||
{STR_MODELID_5_LAB, "Mac IIci (MacOS 7.x)"},
|
||||
{STR_MODELID_7_LAB, "Mac IIfx (MacOS 7.x)"},
|
||||
{STR_MODELID_12_LAB, "Mac IIsi (MacOS 7.x"},
|
||||
{STR_MODELID_13_LAB, "Mac LC (MacOS 7.x"},
|
||||
{STR_MODELID_14_LAB, "Quadra 900 (MacOS 8.x)"},
|
||||
{STR_MODELID_15_LAB, "PowerBook 170 (MacOS 7.x)"},
|
||||
{STR_MODELID_16_LAB, "Quadra 700 (MacOS 8.x)"},
|
||||
{STR_MODELID_19_LAB, "PowerBook 140 (MacOS 7.x)"},
|
||||
{STR_MODELID_20_LAB, "Quadra 950 (MacOS 8.x)"},
|
||||
{STR_MODELID_21_LAB, "Mac LC III-Performa 450 (MacOS 7.x)"},
|
||||
{STR_MODELID_24_LAB, "Centris 650 (MacOS 8.x)"},
|
||||
{STR_MODELID_29_LAB, "Quadra 800 (MacOS 8.x)"},
|
||||
{STR_MODELID_30_LAB, "Quadra 650 (MacOS 8.x)"},
|
||||
{STR_MODELID_31_LAB, "Mac LC II (MacOS 7.x)"},
|
||||
{STR_MODELID_38_LAB, "Mac IIvi (MacOS 7.x)"},
|
||||
{STR_MODELID_39_LAB, "Performa 600 (MacOS 7.x)"},
|
||||
{STR_MODELID_42_LAB, "Mac IIvx (MacOS 7.x)"},
|
||||
{STR_MODELID_43_LAB, "Color Classic (MacOS 7.x)"},
|
||||
{STR_MODELID_46_LAB, "Centris 610 (MacOS 8.x)"},
|
||||
{STR_MODELID_47_LAB, "Quadra 610 (MacOS 8.x)"},
|
||||
{STR_MODELID_50_LAB, "Mac LC 520 (MacOS 7.x)"},
|
||||
{STR_MODELID_54_LAB, "Centris-Quadra 660AV (MacOS 8.x)"},
|
||||
{STR_MODELID_56_LAB, "Performa 46x (MacOS 7.x)"},
|
||||
{STR_MODELID_72_LAB, "Quadra 840AV (MacOS 8.x)"},
|
||||
{STR_MODELID_74_LAB, "Mac LC-Performa 550 (MacOS 7.x)"},
|
||||
{STR_MODELID_82_LAB, "Mac TV (MacOS 7.x)"},
|
||||
{STR_MODELID_83_LAB, "Mac LC 475-Performa 47x (MacOS 8.x)"},
|
||||
{STR_MODELID_86_LAB, "Mac LC 575-Performa 57x (MacOS 8.x)"},
|
||||
{STR_MODELID_87_LAB, "Quadra 605 (MacOS 8.x)"},
|
||||
{STR_MODELID_92_LAB, "Mac LC-Performa-Quadra 630 (MacOS 8.x)"},
|
||||
{STR_MODELID_93_LAB, "Mac LC 580 (MacOS 8.x)"},
|
||||
{STR_CPU_CTRL, "CPU Type"},
|
||||
{STR_CPU_68020_LAB, "68020"},
|
||||
{STR_CPU_68020_FPU_LAB, "68020 with FPU"},
|
||||
|
@ -212,7 +241,6 @@ user_string_def common_strings[] = {
|
|||
{STR_CPU_68040_LAB, "68040"},
|
||||
{STR_ROM_FILE_CTRL, "ROM File"},
|
||||
{STR_IDLEWAIT_CTRL, "Don't Use CPU When Idle"},
|
||||
|
||||
{STR_JIT_PANE_TITLE, "JIT Compiler"},
|
||||
{STR_JIT_CTRL, "Enable JIT Compiler"},
|
||||
{STR_JIT_FPU_CTRL, "Compile FPU Instructions"},
|
||||
|
|
|
@ -498,7 +498,8 @@ esac
|
|||
dnl Check for headers and functions related to pty support (sshpty.c)
|
||||
dnl From openssh-3.2.2p1 configure.ac
|
||||
AC_CHECK_HEADERS(strings.h login.h sys/bsdtty.h sys/stat.h util.h pty.h)
|
||||
AC_CHECK_FUNCS(_getpty vhangup strlcpy)
|
||||
AC_SEARCH_LIBS([openpty], [util bsd])
|
||||
AC_CHECK_FUNCS(_getpty openpty vhangup strlcpy)
|
||||
|
||||
case "$host" in
|
||||
*-*-hpux10.26)
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
#! /bin/sh
|
||||
# Run this to generate all the initial makefiles, etc.
|
||||
# This was lifted from the Gimp, and adapted slightly by
|
||||
# Christian Bauer.
|
||||
|
||||
DIE=0
|
||||
|
||||
PROG="cxmon"
|
||||
|
||||
# Check how echo works in this /bin/sh
|
||||
case `echo -n` in
|
||||
-n) _echo_n= _echo_c='\c';;
|
||||
*) _echo_n=-n _echo_c=;;
|
||||
esac
|
||||
|
||||
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have autoconf installed to compile $PROG."
|
||||
echo "Download the appropriate package for your distribution,"
|
||||
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
(aclocal --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "**Error**: Missing aclocal. The version of automake"
|
||||
echo "installed doesn't appear recent enough."
|
||||
echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
|
||||
echo "(or a newer version if it is available)"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
if test "$DIE" -eq 1; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
aclocalinclude="$ACLOCAL_FLAGS"; \
|
||||
(echo $_echo_n " + Running aclocal: $_echo_c"; \
|
||||
aclocal $aclocalinclude; \
|
||||
echo "done.") && \
|
||||
(echo $_echo_n " + Running autoheader: $_echo_c"; \
|
||||
autoheader; \
|
||||
echo "done.") && \
|
||||
(echo $_echo_n " + Running autoconf: $_echo_c"; \
|
||||
autoconf; \
|
||||
echo "done.")
|
||||
|
||||
rm -f config.cache
|
||||
|
||||
if [ x"$NO_CONFIGURE" = "x" ]; then
|
||||
echo " + Running 'configure $@':"
|
||||
if [ -z "$*" ]; then
|
||||
echo " ** If you wish to pass arguments to ./configure, please"
|
||||
echo " ** specify them on the command line."
|
||||
fi
|
||||
./configure "$@"
|
||||
fi
|
|
@ -31,7 +31,8 @@ dnl Checks for libraries.
|
|||
AC_SEARCH_LIBS([tgetent], [ncurses termcap termlib terminfo Hcurses curses], [], [
|
||||
AC_MSG_ERROR([unable to find the tgetent() function])
|
||||
])
|
||||
AC_SEARCH_LIBS([readline], [readline], [], [
|
||||
AC_SEARCH_LIBS([readline], [readline], [
|
||||
AC_DEFINE([HAVE_LIBREADLINE], 1, [Define if you have the Readline library])], [
|
||||
AC_MSG_ERROR([unable to find the readline() function])
|
||||
])
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ static bool open_stdio(const char *title)
|
|||
#endif
|
||||
|
||||
// Main program
|
||||
int main(int argc, char **argv)
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
#ifdef __BEOS__
|
||||
// Launched from Tracker? Then open terminal window
|
||||
|
|
Loading…
Reference in New Issue