Merge pull request #212 from rickyzhang82/pr-fix-sdl2-for-system-6

Patch SDL2 for System 6 24bit ROM
This commit is contained in:
asvitkine 2020-07-05 19:41:46 -04:00 committed by GitHub
commit 6d522db16c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 244 additions and 202 deletions

View File

@ -980,6 +980,19 @@ void driver_base::set_video_mode(int flags)
void driver_base::init()
{
set_video_mode(display_type == DISPLAY_SCREEN ? SDL_WINDOW_FULLSCREEN : 0);
// 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();
}
int aligned_height = (VIDEO_MODE_Y + 15) & ~15;
#ifdef ENABLE_VOSF

View File

@ -672,8 +672,6 @@ 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();
@ -737,6 +735,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;

View File

@ -473,6 +473,34 @@ 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;
/*
* 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/
*
*/
void REGPARAM2 fram24_lput(uaecptr addr, uae_u32 l)
{
uaecptr page_off = addr & 0xffff;