Reorganize patch files, add Visual Studio support for bins

This commit is contained in:
InvisibleUp 2020-05-25 15:34:29 -04:00
parent 306347d6c2
commit 66eee49f73
37 changed files with 593 additions and 621 deletions

3
.gitignore vendored
View File

@ -6,4 +6,5 @@ bld
*.ROM
*.kdev4
*.pdb
build/
build/
.vs/*

View File

@ -36,9 +36,12 @@ add_library(
hw_disk OBJECT
src/HW/DISK/IWMEMDEV.c
src/HW/DISK/SONYEMDV.c
src/PATCHES/SONYDRV.c
)
target_include_directories(hw_disk PRIVATE src/ cfg/)
target_include_directories(hw_disk PRIVATE src/ cfg/ rsrc/)
target_include_directories(hw_disk PRIVATE src/HW/DISK/)
configure_file(rsrc/SONYDRV.bin SONYDRV.bin COPYONLY)
configure_file(rsrc/SONYICO.bin SONYICO.bin COPYONLY)
add_library(
hw_kbrd OBJECT
@ -90,6 +93,7 @@ target_include_directories(hw_scc PRIVATE src/HW/SCC/)
add_library(
hw_screen OBJECT
src/HW/SCREEN/SCRNEMDV.c
src/PATCHES/SCRNHACK.c
)
target_include_directories(hw_screen PRIVATE src/ cfg/)
target_include_directories(hw_screen PRIVATE src/HW/SCREEN/)
@ -170,13 +174,13 @@ add_library(
src/UI/WIN32/OSGLUWIN.c
src/UI/WIN32/SOUND.c
src/UI/WIN32/TIMEDATE.c
src/UI/WIN32/main.rc
rsrc/WIN32/main.rc
)
target_include_directories(ui_win32 PRIVATE cfg/ src/)
target_include_directories(ui_win32 PRIVATE cfg/ src/ rsrc/)
target_include_directories(ui_win32 PRIVATE src/UI/ src/UI/WIN32/)
configure_file(src/UI/WIN32/ICONAPPW.ico ICONAPPW.ico COPYONLY)
configure_file(src/UI/WIN32/ICONDSKW.ico ICONDSKW.ico COPYONLY)
configure_file(src/UI/WIN32/ICONROMW.ico ICONROMW.ico COPYONLY)
configure_file(rsrc/WIN32/ICONAPPW.ico ICONAPPW.ico COPYONLY)
configure_file(rsrc/WIN32/ICONDSKW.ico ICONDSKW.ico COPYONLY)
configure_file(rsrc/WIN32/ICONROMW.ico ICONROMW.ico COPYONLY)
target_link_libraries(ui_win32 PUBLIC winmm ole32 uuid)
#add_library(
@ -200,7 +204,6 @@ target_include_directories(microvmac PRIVATE cfg/ src/)
set_target_properties(microvmac PROPERTIES C_STANDARD 99 C_STANDARD_REQUIRED True)
#target_link_libraries(microvmac INTERFACE tgt_macplus) # temporary
target_link_libraries(microvmac PRIVATE incbin ui_win32)
configure_file(src/PATCHES/SONY.bin SONY.bin COPYONLY)
# temporary, because "INTERFACE" isn't working how I expect it to
target_link_libraries(

View File

@ -1,49 +0,0 @@
# Makefile
# Currently only builds Mac Plus emulator for Windows x64 or Linux X11
CC := gcc
CCFLAGS := -O2 -Wall -Wmissing-prototypes -Wno-uninitialized -Wundef -Wstrict-prototypes -Icfg/ -Isrc/
.PHONY: linux windows clean
SrcFiles := \
src/PROGMAIN.c \
src/GLOBGLUE.c \
src/HW/M68K/M68KITAB.c \
src/HW/M68K/MINEM68K.c \
src/HW/VIA/VIAEMDEV.c \
src/HW/DISK/IWMEMDEV.c \
src/HW/SCC/SCCEMDEV.c \
src/HW/RTC/RTCEMDEV.c \
src/PATCHES/ROMEMDEV.c \
src/HW/SCSI/SCSIEMDV.c \
src/HW/DISK/SONYEMDV.c \
src/HW/SCREEN/SCRNEMDV.c \
src/HW/MOUSE/MOUSEMDV.c \
src/HW/KBRD/KBRDEMDV.c \
src/HW/SOUND/SNDEMDEV.c \
src/UTIL/DATE2SEC.c \
src/UI/COMOSGLU.c \
src/UI/CONTROLM.c \
Win32Files := \
src/UI/WIN32/OSGLUWIN.c \
src/UI/WIN32/INTLKBRD.c \
src/UI/WIN32/DBGLOG.c \
src/UI/WIN32/KEYBOARD.c \
src/UI/WIN32/SOUND.c \
src/UI/WIN32/TIMEDATE.c \
windows :
mkdir -p "bld/"
windres -i "src/UI/WIN32/main.rc" --input-format=rc -o "bld/main.res" -O coff --include-dir "src/"
$(CC) -o "microvmac.exe" $(SrcFiles) $(Win32Files) \
"bld/main.res" $(CCFLAGS) -mwindows -lwinmm -lole32 -luuid
linux :
mkdir -p "bld/"
$(CC) -o "microvmac.exe" $(SrcFiles) "src/UI/UNIX/OSGLUXWN.c" $(CCFLAGS) -lX11 -ldl
clean :
rm -r "bld/"
rm "microvmac.exe"

View File

@ -10,7 +10,7 @@
#ifndef EMCONFIG_H
#define EMCONFIG_H
//#define CurEmMd kEmMd_Plus
#define CurEmMd kEmMd_Plus
#define MaxATTListN 32
#define IncludeExtnPbufs 1

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

BIN
rsrc/SONYICO.bin Normal file

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
rsrc/WIN32/main.aps Normal file

Binary file not shown.

33
rsrc/WIN32/main.rc Normal file
View File

@ -0,0 +1,33 @@
//LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// Icons
ICO_APP ICON DISCARDABLE "ICONAPPW.ico"
ICO_DSK ICON DISCARDABLE "ICONDSKW.ico"
ICO_ROM ICON DISCARDABLE "ICONROMW.ico"
// Binary data
SONY_DRV RCDATA "SONYDRV.bin"
SONY_ICO RCDATA "SONYICO.bin"
// Version information
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,37,0,0
PRODUCTVERSION 0,37,0,0
FILESUBTYPE 0
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "InvisibleUp\0"
VALUE "Comments", ""
VALUE "FileDescription", "A 68k Macintosh emulator\0"
VALUE "FileVersion", "v0.37.0\0"
VALUE "InternalName", "microvmac\0"
VALUE "LegalCopyright", "©1996-2020 various contributors. Licensed under the GPL v2.\0"
VALUE "OriginalFilename", "microvmac.exe\0"
VALUE "ProductName", "micro vMac\0"
VALUE "ProductVersion", "v0.37.0\0"
END
END
END

View File

@ -19,6 +19,7 @@
#include "CNFGRAPI.h"
#include "EMCONFIG.h"
#include "SYSDEPNS.h"
#define kEmMd_Twig43 0
#define kEmMd_Twiggy 1

View File

@ -25,174 +25,13 @@
Support for "Twiggy" Mac by Mathew Hybler.
*/
#ifndef AllFiles
#include "EMCONFIG.h"
#include "SYSDEPNS.h"
#include "GLOBGLUE.h"
#include "UI/MYOSGLUE.h"
#include "UTIL/ENDIANAC.h"
#include "EMCONFIG.h"
#include "GLOBGLUE.h"
#endif
#include "incbin/incbin.h"
#include "PATCHES/ROMEMDEV.h"
// Temporarily disable due to CMake errors
/*#define UseSonyPatch \
((CurEmMd <= kEmMd_Classic) || (CurEmMd == kEmMd_II) \
|| (CurEmMd == kEmMd_IIx))*/
#ifndef UseLargeScreenHack
#define UseLargeScreenHack 0
#endif
#if UseSonyPatch
/*
Replacement for .Sony driver
68k machine code, compiled from mydriver.a
*/
INCBIN(SonyDriver, "SONY.bin");
#endif
#if UseSonyPatch
LOCALVAR const uint8_t disk_icon[] = {
0x7F, 0xFF, 0xFF, 0xF0,
0x81, 0x00, 0x01, 0x08,
0x81, 0x00, 0x71, 0x04,
0x81, 0x00, 0x89, 0x02,
0x81, 0x00, 0x89, 0x01,
0x81, 0x00, 0x89, 0x01,
0x81, 0x00, 0x89, 0x01,
0x81, 0x00, 0x89, 0x01,
0x81, 0x00, 0x89, 0x01,
0x81, 0x00, 0x71, 0x01,
0x81, 0x00, 0x01, 0x01,
0x80, 0xFF, 0xFE, 0x01,
0x80, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x01,
0x83, 0xFF, 0xFF, 0xC1,
0x84, 0x00, 0x00, 0x21,
0x84, 0x00, 0x00, 0x21,
0x84, 0x00, 0x00, 0x21,
0x84, 0x00, 0x00, 0x21,
0x84, 0x00, 0x00, 0x21,
0x84, 0x06, 0x30, 0x21,
0x84, 0x06, 0x60, 0x21,
0x84, 0x06, 0xC0, 0x21,
0x84, 0x07, 0x80, 0x21,
0x84, 0x07, 0x00, 0x21,
0x84, 0x06, 0x00, 0x21,
0x84, 0x00, 0x00, 0x21,
0x84, 0x00, 0x00, 0x21,
0x84, 0x00, 0x00, 0x21,
0x7F, 0xFF, 0xFF, 0xFE,
/* mask */
0x3F, 0xFF, 0xFF, 0xF0,
0x7F, 0xFF, 0xFF, 0xF0,
0xFF, 0xFF, 0xFF, 0xFC,
0xFF, 0xFF, 0xFF, 0xFC,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0x7F, 0xFF, 0xFF, 0xFC,
0x3F, 0xFF, 0xFF, 0xFC,
/* empty pascal string */
0x00, 0x00,
};
#endif
#if CurEmMd <= kEmMd_Twig43
#define Sony_DriverBase 0x1836
#elif CurEmMd <= kEmMd_Twiggy
#define Sony_DriverBase 0x16E4
#elif CurEmMd <= kEmMd_128K
#define Sony_DriverBase 0x1690
#elif CurEmMd <= kEmMd_Plus
#define Sony_DriverBase 0x17D30
#elif CurEmMd <= kEmMd_Classic
#define Sony_DriverBase 0x34680
#elif (CurEmMd == kEmMd_II) || (CurEmMd == kEmMd_IIx)
#define Sony_DriverBase 0x2D72C
#endif
#define kVidMem_Base 0x00540000
#if UseSonyPatch
LOCALPROC Sony_Install(void)
{
uint8_t * pto = Sony_DriverBase + ROM;
MoveBytes((anyp)gSonyDriverData, (anyp)pto, gSonyDriverSize);
#if CurEmMd <= kEmMd_Twiggy
do_put_mem_long(pto + 0x14, 0x4469736B);
/* 'Disk' instead of 'Sony' */
#if CurEmMd <= kEmMd_Twig43
do_put_mem_word(pto + 0xEA, 0x0C8A);
#else
do_put_mem_word(pto + 0xEA, 0x0B74);
#endif
#endif
pto += gSonyDriverSize;
do_put_mem_word(pto, kcom_callcheck);
pto += 2;
do_put_mem_word(pto, kExtnSony);
pto += 2;
do_put_mem_long(pto, kExtn_Block_Base); /* pokeaddr */
pto += 4;
disk_icon_addr = (pto - ROM) + kROM_Base;
MoveBytes((anyp)disk_icon, (anyp)pto, sizeof(disk_icon));
pto += sizeof(disk_icon);
#if UseLargeScreenHack
{
uint8_t * patchp = pto;
#include "PATCHES/SCRNHACK.h"
}
#endif
(void) pto; /* avoid warning about unused */
}
#endif
#ifndef DisableRomCheck
#define DisableRomCheck 1
#endif
#ifndef DisableRamTest
#define DisableRamTest 1
#endif
#ifdef CurAltHappyMac
#include "HPMCHACK.h"
#endif
@ -266,9 +105,8 @@ GLOBALFUNC bool ROM_Init(void)
/* do_put_mem_word(862 + ROM, 0x4E71); */ /* shorten set memory */
#if UseSonyPatch
Sony_Install();
#endif
//ScreenHack_Install(); in above fcn temporarily
#ifdef ln2mtb
ROMscrambleForMTB();

View File

@ -17,6 +17,21 @@
#ifndef ROMEMDEV_H
#define ROMEMDEV_H
#ifndef UseLargeScreenHack
#define UseLargeScreenHack 0
#endif
#ifndef DisableRomCheck
#define DisableRomCheck 1
#endif
#ifndef DisableRamTest
#define DisableRamTest 1
#endif
#define kVidMem_Base 0x00540000
EXPORTFUNC bool ROM_Init(void);
#endif

411
src/PATCHES/SCRNHACK.c Normal file
View File

@ -0,0 +1,411 @@
/*
PATCHES/SCRNHACK.h
Copyright (C) 2007 Paul C. Pratt
You can redistribute this file and/or modify it under the terms
of version 2 of the GNU General Public License as published by
the Free Software Foundation. You should have received a copy
of the license along with this file; see the file COPYING.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
license for more details.
*/
/*
SCReeN Hack
Patch ROM to support other screen sizes.
*/
#include "EMCONFIG.h"
#include "SYSDEPNS.h"
#include "UI/MYOSGLUE.h"
#include "UTIL/ENDIANAC.h"
#include "EMCONFIG.h"
#include "GLOBGLUE.h"
#include "incbin/incbin.h"
#include "PATCHES/ROMEMDEV.h"
void ScreenHack_Install(uint8_t *pto)
{
uint8_t * patchp = pto;
if (!UseLargeScreenHack) {return; }
#if CurEmMd <= kEmMd_128K
do_put_mem_long(112 + ROM, kVidMem_Base);
do_put_mem_long(260 + ROM, kVidMem_Base);
do_put_mem_long(292 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 + 9) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 24))
/ 8);
/* sad mac, error code */
do_put_mem_word(330 + ROM, vMacScreenWidth / 8);
do_put_mem_word(342 + ROM, vMacScreenWidth / 8);
do_put_mem_word(350 + ROM, vMacScreenWidth / 4 * 3 - 1);
/* sad mac, blink pixels */
do_put_mem_word(358 + ROM, vMacScreenWidth - 4);
do_put_mem_word(456 + ROM,
(vMacScreenHeight * vMacScreenWidth / 32) - 1 + 32);
/* screen setup, main */
{
pto = 862 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x21FC); /* MOVE.L */
patchp += 2;
do_put_mem_long(patchp, kVidMem_Base); /* kVidMem_Base */
patchp += 4;
do_put_mem_word(patchp, 0x0824); /* (ScrnBase) */
patchp += 2;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
}
do_put_mem_word(892 + ROM, vMacScreenHeight - 1);
do_put_mem_word(894 + ROM, vMacScreenWidth - 1);
/* blink floppy, disk icon */
do_put_mem_long(1388 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 25) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 16))
/ 8);
/* blink floppy, question mark */
do_put_mem_long(1406 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 10) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 8))
/ 8);
/* blink floppy and sadmac, position */
do_put_mem_word(1966 + ROM, vMacScreenWidth / 8 - 4);
do_put_mem_word(1982 + ROM, vMacScreenWidth / 8);
/* sad mac, mac icon */
do_put_mem_long(2008 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 25) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 16))
/ 8);
/* sad mac, frown */
do_put_mem_long(2020 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 19) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 8))
/ 8);
do_put_mem_word(2052 + ROM, vMacScreenWidth / 8 - 2);
/* cursor handling */
#if vMacScreenWidth >= 1024
pto = 3448 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x41F8); /* Lea.L (CrsrSave),A0 */
patchp += 2;
do_put_mem_word(patchp, 0x088C);
patchp += 2;
do_put_mem_word(patchp, 0x203C); /* MOVE.L #$x,D0 */
patchp += 2;
do_put_mem_long(patchp, (vMacScreenWidth / 8));
patchp += 4;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
#else
do_put_mem_word(3452 + ROM, 0x7000 + (vMacScreenWidth / 8));
#endif
do_put_mem_word(3572 + ROM, vMacScreenWidth - 32);
do_put_mem_word(3578 + ROM, vMacScreenWidth - 32);
do_put_mem_word(3610 + ROM, vMacScreenHeight - 16);
do_put_mem_word(3616 + ROM, vMacScreenHeight);
#if vMacScreenWidth >= 1024
pto = 3646 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x2A3C); /* MOVE.L #$x,D5 */
patchp += 2;
do_put_mem_long(patchp, (vMacScreenWidth / 8));
patchp += 4;
do_put_mem_word(patchp, 0xC2C5); /* MulU D5,D1 */
patchp += 2;
do_put_mem_word(patchp, 0xD3C1); /* AddA.L D1,A1 */
patchp += 2;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
#else
do_put_mem_word(3646 + ROM, 0x7A00 + (vMacScreenWidth / 8));
#endif
/* set up screen bitmap */
do_put_mem_word(3832 + ROM, vMacScreenHeight);
do_put_mem_word(3838 + ROM, vMacScreenWidth);
/* do_put_mem_word(7810 + ROM, vMacScreenHeight); */
#elif CurEmMd <= kEmMd_Plus
do_put_mem_long(138 + ROM, kVidMem_Base);
do_put_mem_long(326 + ROM, kVidMem_Base);
do_put_mem_long(356 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 + 9) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 24))
/ 8);
/* sad mac, error code */
do_put_mem_word(392 + ROM, vMacScreenWidth / 8);
do_put_mem_word(404 + ROM, vMacScreenWidth / 8);
do_put_mem_word(412 + ROM, vMacScreenWidth / 4 * 3 - 1);
/* sad mac, blink pixels */
do_put_mem_long(420 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 + 17) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 8))
/ 8);
do_put_mem_word(494 + ROM,
(vMacScreenHeight * vMacScreenWidth / 32) - 1);
/* screen setup, main */
{
pto = 1132 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x21FC); /* MOVE.L */
patchp += 2;
do_put_mem_long(patchp, kVidMem_Base); /* kVidMem_Base */
patchp += 4;
do_put_mem_word(patchp, 0x0824); /* (ScrnBase) */
patchp += 2;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
}
do_put_mem_word(1140 + ROM, vMacScreenWidth / 8);
do_put_mem_word(1172 + ROM, vMacScreenHeight);
do_put_mem_word(1176 + ROM, vMacScreenWidth);
/* blink floppy, disk icon */
do_put_mem_long(2016 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 25) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 16))
/ 8);
/* blink floppy, question mark */
do_put_mem_long(2034 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 10) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 8))
/ 8);
do_put_mem_word(2574 + ROM, vMacScreenHeight);
do_put_mem_word(2576 + ROM, vMacScreenWidth);
/* blink floppy and sadmac, position */
do_put_mem_word(3810 + ROM, vMacScreenWidth / 8 - 4);
do_put_mem_word(3826 + ROM, vMacScreenWidth / 8);
/* sad mac, mac icon */
do_put_mem_long(3852 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 25) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 16))
/ 8);
/* sad mac, frown */
do_put_mem_long(3864 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 19) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 8))
/ 8);
do_put_mem_word(3894 + ROM, vMacScreenWidth / 8 - 2);
/* cursor handling */
#if vMacScreenWidth >= 1024
pto = 7372 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x41F8); /* Lea.L (CrsrSave), A0 */
patchp += 2;
do_put_mem_word(patchp, 0x088C);
patchp += 2;
do_put_mem_word(patchp, 0x203C); /* MOVE.L #$x, D0 */
patchp += 2;
do_put_mem_long(patchp, (vMacScreenWidth / 8));
patchp += 4;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
#else
do_put_mem_word(7376 + ROM, 0x7000 + (vMacScreenWidth / 8));
#endif
do_put_mem_word(7496 + ROM, vMacScreenWidth - 32);
do_put_mem_word(7502 + ROM, vMacScreenWidth - 32);
do_put_mem_word(7534 + ROM, vMacScreenHeight - 16);
do_put_mem_word(7540 + ROM, vMacScreenHeight);
#if vMacScreenWidth >= 1024
pto = 7570 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x2A3C); /* MOVE.L #$x,D5 */
patchp += 2;
do_put_mem_long(patchp, (vMacScreenWidth / 8));
patchp += 4;
do_put_mem_word(patchp, 0xC2C5); /* MulU D5,D1 */
patchp += 2;
do_put_mem_word(patchp, 0xD3C1); /* AddA.L D1,A1 */
patchp += 2;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
#else
do_put_mem_word(7570 + ROM, 0x7A00 + (vMacScreenWidth / 8));
#endif
/* set up screen bitmap */
do_put_mem_word(7784 + ROM, vMacScreenHeight);
do_put_mem_word(7790 + ROM, vMacScreenWidth);
do_put_mem_word(7810 + ROM, vMacScreenHeight);
#if 0
/*
Haven't got these working. Alert outlines ok, but
not contents. Perhaps global position of contents
stored in system resource file.
*/
/* perhaps switch disk alert */
do_put_mem_word(10936 + ROM, vMacScreenHeight / 2 - 91);
do_put_mem_word(10938 + ROM, vMacScreenWidth / 2 - 136);
do_put_mem_word(10944 + ROM, vMacScreenHeight / 2 - 19);
do_put_mem_word(10946 + ROM, vMacScreenWidth / 2 + 149);
do_put_mem_word(11008 + ROM, ?);
do_put_mem_word(11010 + ROM, ?);
/* DSAlertRect */
do_put_mem_word(4952 + ROM, vMacScreenHeight / 2 - 107);
do_put_mem_word(4954 + ROM, vMacScreenWidth / 2 - 236);
do_put_mem_word(4958 + ROM, vMacScreenHeight / 2 + 19);
do_put_mem_word(4960 + ROM, vMacScreenWidth / 2 + 236);
do_put_mem_word(5212 + ROM, vMacScreenHeight / 2 - 101);
do_put_mem_word(5214 + ROM, vMacScreenWidth / 2 - 218);
#endif
#elif CurEmMd <= kEmMd_Classic
/* screen setup, main */
{
pto = 1482 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x21FC); /* MOVE.L */
patchp += 2;
do_put_mem_long(patchp, kVidMem_Base); /* kVidMem_Base */
patchp += 4;
do_put_mem_word(patchp, 0x0824); /* (ScrnBase) */
patchp += 2;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
}
do_put_mem_word(1490 + ROM, vMacScreenWidth / 8);
do_put_mem_word(1546 + ROM, vMacScreenHeight);
do_put_mem_word(1550 + ROM, vMacScreenWidth);
do_put_mem_word(2252 + ROM, vMacScreenHeight);
do_put_mem_word(2254 + ROM, vMacScreenWidth);
/* blink floppy, disk icon */
do_put_mem_long(3916 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 25) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 16))
/ 8);
/* blink floppy, question mark */
do_put_mem_long(3934 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 10) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 8))
/ 8);
do_put_mem_long(4258 + ROM, kVidMem_Base);
do_put_mem_word(4264 + ROM, vMacScreenHeight);
do_put_mem_word(4268 + ROM, vMacScreenWidth);
do_put_mem_word(4272 + ROM, vMacScreenWidth / 8);
do_put_mem_long(4276 + ROM, vMacScreenNumBytes);
/* sad mac, mac icon */
do_put_mem_long(4490 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 25) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 16))
/ 8);
/* sad mac, frown */
do_put_mem_long(4504 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 19) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 8))
/ 8);
do_put_mem_word(4528 + ROM, vMacScreenWidth / 8);
/* blink floppy and sadmac, position */
do_put_mem_word(4568 + ROM, vMacScreenWidth / 8);
do_put_mem_word(4586 + ROM, vMacScreenWidth / 8);
/* cursor handling */
#if vMacScreenWidth >= 1024
pto = 101886 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x41F8); /* Lea.L (CrsrSave),A0 */
patchp += 2;
do_put_mem_word(patchp, 0x088C);
patchp += 2;
do_put_mem_word(patchp, 0x203C); /* MOVE.L #$x,D0 */
patchp += 2;
do_put_mem_long(patchp, (vMacScreenWidth / 8));
patchp += 4;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
#else
do_put_mem_word(101890 + ROM, 0x7000 + (vMacScreenWidth / 8));
#endif
do_put_mem_word(102010 + ROM, vMacScreenWidth - 32);
do_put_mem_word(102016 + ROM, vMacScreenWidth - 32);
do_put_mem_word(102048 + ROM, vMacScreenHeight - 16);
do_put_mem_word(102054 + ROM, vMacScreenHeight);
#if vMacScreenWidth >= 1024
pto = 102084 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x2A3C); /* MOVE.L #$x, D5 */
patchp += 2;
do_put_mem_long(patchp, (vMacScreenWidth / 8));
patchp += 4;
do_put_mem_word(patchp, 0xC2C5); /* MulU D5, D1 */
patchp += 2;
do_put_mem_word(patchp, 0xD3C1); /* AddA.L D1, A1 */
patchp += 2;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
#else
do_put_mem_word(102084 + ROM, 0x7A00 + (vMacScreenWidth / 8));
#endif
/* set up screen bitmap */
do_put_mem_word(102298 + ROM, vMacScreenHeight);
do_put_mem_word(102304 + ROM, vMacScreenWidth);
do_put_mem_word(102324 + ROM, vMacScreenHeight);
#endif
}

View File

@ -1,397 +1,3 @@
/*
PATCHES/SCRNHACK.h
#include <stdint.h>
Copyright (C) 2007 Paul C. Pratt
You can redistribute this file and/or modify it under the terms
of version 2 of the GNU General Public License as published by
the Free Software Foundation. You should have received a copy
of the license along with this file; see the file COPYING.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
license for more details.
*/
/*
SCReeN Hack
Patch ROM to support other screen sizes.
*/
#if CurEmMd <= kEmMd_128K
do_put_mem_long(112 + ROM, kVidMem_Base);
do_put_mem_long(260 + ROM, kVidMem_Base);
do_put_mem_long(292 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 + 9) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 24))
/ 8);
/* sad mac, error code */
do_put_mem_word(330 + ROM, vMacScreenWidth / 8);
do_put_mem_word(342 + ROM, vMacScreenWidth / 8);
do_put_mem_word(350 + ROM, vMacScreenWidth / 4 * 3 - 1);
/* sad mac, blink pixels */
do_put_mem_word(358 + ROM, vMacScreenWidth - 4);
do_put_mem_word(456 + ROM,
(vMacScreenHeight * vMacScreenWidth / 32) - 1 + 32);
/* screen setup, main */
{
pto = 862 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x21FC); /* MOVE.L */
patchp += 2;
do_put_mem_long(patchp, kVidMem_Base); /* kVidMem_Base */
patchp += 4;
do_put_mem_word(patchp, 0x0824); /* (ScrnBase) */
patchp += 2;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
}
do_put_mem_word(892 + ROM, vMacScreenHeight - 1);
do_put_mem_word(894 + ROM, vMacScreenWidth - 1);
/* blink floppy, disk icon */
do_put_mem_long(1388 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 25) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 16))
/ 8);
/* blink floppy, question mark */
do_put_mem_long(1406 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 10) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 8))
/ 8);
/* blink floppy and sadmac, position */
do_put_mem_word(1966 + ROM, vMacScreenWidth / 8 - 4);
do_put_mem_word(1982 + ROM, vMacScreenWidth / 8);
/* sad mac, mac icon */
do_put_mem_long(2008 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 25) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 16))
/ 8);
/* sad mac, frown */
do_put_mem_long(2020 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 19) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 8))
/ 8);
do_put_mem_word(2052 + ROM, vMacScreenWidth / 8 - 2);
/* cursor handling */
#if vMacScreenWidth >= 1024
pto = 3448 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x41F8); /* Lea.L (CrsrSave),A0 */
patchp += 2;
do_put_mem_word(patchp, 0x088C);
patchp += 2;
do_put_mem_word(patchp, 0x203C); /* MOVE.L #$x,D0 */
patchp += 2;
do_put_mem_long(patchp, (vMacScreenWidth / 8));
patchp += 4;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
#else
do_put_mem_word(3452 + ROM, 0x7000 + (vMacScreenWidth / 8));
#endif
do_put_mem_word(3572 + ROM, vMacScreenWidth - 32);
do_put_mem_word(3578 + ROM, vMacScreenWidth - 32);
do_put_mem_word(3610 + ROM, vMacScreenHeight - 16);
do_put_mem_word(3616 + ROM, vMacScreenHeight);
#if vMacScreenWidth >= 1024
pto = 3646 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x2A3C); /* MOVE.L #$x,D5 */
patchp += 2;
do_put_mem_long(patchp, (vMacScreenWidth / 8));
patchp += 4;
do_put_mem_word(patchp, 0xC2C5); /* MulU D5,D1 */
patchp += 2;
do_put_mem_word(patchp, 0xD3C1); /* AddA.L D1,A1 */
patchp += 2;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
#else
do_put_mem_word(3646 + ROM, 0x7A00 + (vMacScreenWidth / 8));
#endif
/* set up screen bitmap */
do_put_mem_word(3832 + ROM, vMacScreenHeight);
do_put_mem_word(3838 + ROM, vMacScreenWidth);
/* do_put_mem_word(7810 + ROM, vMacScreenHeight); */
#elif CurEmMd <= kEmMd_Plus
do_put_mem_long(138 + ROM, kVidMem_Base);
do_put_mem_long(326 + ROM, kVidMem_Base);
do_put_mem_long(356 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 + 9) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 24))
/ 8);
/* sad mac, error code */
do_put_mem_word(392 + ROM, vMacScreenWidth / 8);
do_put_mem_word(404 + ROM, vMacScreenWidth / 8);
do_put_mem_word(412 + ROM, vMacScreenWidth / 4 * 3 - 1);
/* sad mac, blink pixels */
do_put_mem_long(420 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 + 17) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 8))
/ 8);
do_put_mem_word(494 + ROM,
(vMacScreenHeight * vMacScreenWidth / 32) - 1);
/* screen setup, main */
{
pto = 1132 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x21FC); /* MOVE.L */
patchp += 2;
do_put_mem_long(patchp, kVidMem_Base); /* kVidMem_Base */
patchp += 4;
do_put_mem_word(patchp, 0x0824); /* (ScrnBase) */
patchp += 2;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
}
do_put_mem_word(1140 + ROM, vMacScreenWidth / 8);
do_put_mem_word(1172 + ROM, vMacScreenHeight);
do_put_mem_word(1176 + ROM, vMacScreenWidth);
/* blink floppy, disk icon */
do_put_mem_long(2016 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 25) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 16))
/ 8);
/* blink floppy, question mark */
do_put_mem_long(2034 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 10) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 8))
/ 8);
do_put_mem_word(2574 + ROM, vMacScreenHeight);
do_put_mem_word(2576 + ROM, vMacScreenWidth);
/* blink floppy and sadmac, position */
do_put_mem_word(3810 + ROM, vMacScreenWidth / 8 - 4);
do_put_mem_word(3826 + ROM, vMacScreenWidth / 8);
/* sad mac, mac icon */
do_put_mem_long(3852 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 25) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 16))
/ 8);
/* sad mac, frown */
do_put_mem_long(3864 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 19) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 8))
/ 8);
do_put_mem_word(3894 + ROM, vMacScreenWidth / 8 - 2);
/* cursor handling */
#if vMacScreenWidth >= 1024
pto = 7372 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x41F8); /* Lea.L (CrsrSave), A0 */
patchp += 2;
do_put_mem_word(patchp, 0x088C);
patchp += 2;
do_put_mem_word(patchp, 0x203C); /* MOVE.L #$x, D0 */
patchp += 2;
do_put_mem_long(patchp, (vMacScreenWidth / 8));
patchp += 4;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
#else
do_put_mem_word(7376 + ROM, 0x7000 + (vMacScreenWidth / 8));
#endif
do_put_mem_word(7496 + ROM, vMacScreenWidth - 32);
do_put_mem_word(7502 + ROM, vMacScreenWidth - 32);
do_put_mem_word(7534 + ROM, vMacScreenHeight - 16);
do_put_mem_word(7540 + ROM, vMacScreenHeight);
#if vMacScreenWidth >= 1024
pto = 7570 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x2A3C); /* MOVE.L #$x,D5 */
patchp += 2;
do_put_mem_long(patchp, (vMacScreenWidth / 8));
patchp += 4;
do_put_mem_word(patchp, 0xC2C5); /* MulU D5,D1 */
patchp += 2;
do_put_mem_word(patchp, 0xD3C1); /* AddA.L D1,A1 */
patchp += 2;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
#else
do_put_mem_word(7570 + ROM, 0x7A00 + (vMacScreenWidth / 8));
#endif
/* set up screen bitmap */
do_put_mem_word(7784 + ROM, vMacScreenHeight);
do_put_mem_word(7790 + ROM, vMacScreenWidth);
do_put_mem_word(7810 + ROM, vMacScreenHeight);
#if 0
/*
Haven't got these working. Alert outlines ok, but
not contents. Perhaps global position of contents
stored in system resource file.
*/
/* perhaps switch disk alert */
do_put_mem_word(10936 + ROM, vMacScreenHeight / 2 - 91);
do_put_mem_word(10938 + ROM, vMacScreenWidth / 2 - 136);
do_put_mem_word(10944 + ROM, vMacScreenHeight / 2 - 19);
do_put_mem_word(10946 + ROM, vMacScreenWidth / 2 + 149);
do_put_mem_word(11008 + ROM, ?);
do_put_mem_word(11010 + ROM, ?);
/* DSAlertRect */
do_put_mem_word(4952 + ROM, vMacScreenHeight / 2 - 107);
do_put_mem_word(4954 + ROM, vMacScreenWidth / 2 - 236);
do_put_mem_word(4958 + ROM, vMacScreenHeight / 2 + 19);
do_put_mem_word(4960 + ROM, vMacScreenWidth / 2 + 236);
do_put_mem_word(5212 + ROM, vMacScreenHeight / 2 - 101);
do_put_mem_word(5214 + ROM, vMacScreenWidth / 2 - 218);
#endif
#elif CurEmMd <= kEmMd_Classic
/* screen setup, main */
{
pto = 1482 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x21FC); /* MOVE.L */
patchp += 2;
do_put_mem_long(patchp, kVidMem_Base); /* kVidMem_Base */
patchp += 4;
do_put_mem_word(patchp, 0x0824); /* (ScrnBase) */
patchp += 2;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
}
do_put_mem_word(1490 + ROM, vMacScreenWidth / 8);
do_put_mem_word(1546 + ROM, vMacScreenHeight);
do_put_mem_word(1550 + ROM, vMacScreenWidth);
do_put_mem_word(2252 + ROM, vMacScreenHeight);
do_put_mem_word(2254 + ROM, vMacScreenWidth);
/* blink floppy, disk icon */
do_put_mem_long(3916 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 25) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 16))
/ 8);
/* blink floppy, question mark */
do_put_mem_long(3934 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 10) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 8))
/ 8);
do_put_mem_long(4258 + ROM, kVidMem_Base);
do_put_mem_word(4264 + ROM, vMacScreenHeight);
do_put_mem_word(4268 + ROM, vMacScreenWidth);
do_put_mem_word(4272 + ROM, vMacScreenWidth / 8);
do_put_mem_long(4276 + ROM, vMacScreenNumBytes);
/* sad mac, mac icon */
do_put_mem_long(4490 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 25) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 16))
/ 8);
/* sad mac, frown */
do_put_mem_long(4504 + ROM, kVidMem_Base
+ (((vMacScreenHeight / 4) * 2 - 19) * vMacScreenWidth
+ (vMacScreenWidth / 2 - 8))
/ 8);
do_put_mem_word(4528 + ROM, vMacScreenWidth / 8);
/* blink floppy and sadmac, position */
do_put_mem_word(4568 + ROM, vMacScreenWidth / 8);
do_put_mem_word(4586 + ROM, vMacScreenWidth / 8);
/* cursor handling */
#if vMacScreenWidth >= 1024
pto = 101886 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x41F8); /* Lea.L (CrsrSave),A0 */
patchp += 2;
do_put_mem_word(patchp, 0x088C);
patchp += 2;
do_put_mem_word(patchp, 0x203C); /* MOVE.L #$x,D0 */
patchp += 2;
do_put_mem_long(patchp, (vMacScreenWidth / 8));
patchp += 4;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
#else
do_put_mem_word(101890 + ROM, 0x7000 + (vMacScreenWidth / 8));
#endif
do_put_mem_word(102010 + ROM, vMacScreenWidth - 32);
do_put_mem_word(102016 + ROM, vMacScreenWidth - 32);
do_put_mem_word(102048 + ROM, vMacScreenHeight - 16);
do_put_mem_word(102054 + ROM, vMacScreenHeight);
#if vMacScreenWidth >= 1024
pto = 102084 + ROM;
do_put_mem_word(pto, 0x4EB9); /* JSR */
pto += 2;
do_put_mem_long(pto, kROM_Base + (patchp - ROM));
pto += 4;
do_put_mem_word(patchp, 0x2A3C); /* MOVE.L #$x, D5 */
patchp += 2;
do_put_mem_long(patchp, (vMacScreenWidth / 8));
patchp += 4;
do_put_mem_word(patchp, 0xC2C5); /* MulU D5, D1 */
patchp += 2;
do_put_mem_word(patchp, 0xD3C1); /* AddA.L D1, A1 */
patchp += 2;
do_put_mem_word(patchp, 0x4E75); /* RTS */
patchp += 2;
#else
do_put_mem_word(102084 + ROM, 0x7A00 + (vMacScreenWidth / 8));
#endif
/* set up screen bitmap */
do_put_mem_word(102298 + ROM, vMacScreenHeight);
do_put_mem_word(102304 + ROM, vMacScreenWidth);
do_put_mem_word(102324 + ROM, vMacScreenHeight);
#endif
void ScreenHack_Install(uint8_t *pto);

95
src/PATCHES/SONYDRV.c Normal file
View File

@ -0,0 +1,95 @@
/*
Replacement for .Sony driver
68k machine code, compiled from mydriver.a
Included in the resource file for WIN32 builds
*/
#include <stdint.h>
#ifdef _WINDOWS
#include <windows.h>
#endif
#include "incbin/incbin.h"
#include "EMCONFIG.h"
#include "GLOBGLUE.h"
#include "UTIL/ENDIANAC.h"
#include "UI/MYOSGLUE.h"
#include "PATCHES/SONYDRV.h"
#include "PATCHES/SCRNHACK.h"
// Include binaries
#ifndef _WINDOWS
INCBIN(SonyDriver, "SONYDRV.bin");
INCBIN(SonyIcon, "SONYICO.bin");
#endif
void Sony_LoadDriver(uint8_t *pto, int *size)
{
#if defined(gSonyDriverData)
memcpy(pto, gSonyDriverData, gSonyDriverSize);
*size = gSonyDriverSize;
#elif defined(_WINDOWS)
HRSRC hDrvInfo = FindResource(NULL, "SONY_DRV", RT_RCDATA);
HGLOBAL hDrv = LoadResource(NULL, hDrvInfo);
DWORD sDrv = SizeofResource(NULL, hDrvInfo);
void *pDrv = LockResource(hDrv);
memcpy(pto, pDrv, sDrv);
*size = sDrv;
#else
#error("Unsupported platform/compiler")
#endif
}
void Sony_LoadIcon(uint8_t *pto)
{
disk_icon_addr = (pto - ROM) + kROM_Base;
#if defined(gSonyIconData)
memcpy(pto, gSonyIcon, gSonyIconSize;
pto += sizeof(gSonyIconSize);
#elif defined(_WINDOWS)
HRSRC hIcoInfo = FindResource(NULL, "SONY_ICO", RT_RCDATA);
HGLOBAL hIco = LoadResource(NULL, hIcoInfo);
DWORD sIco = SizeofResource(NULL, hIcoInfo);
void *pIco = LockResource(hIco);
memcpy(pto, pIco, sIco);
pto += sizeof(sIco);
#else
#error("Unsupported platform/compiler")
#endif
}
void Sony_TwiggyPatch(uint8_t *pto)
{
if (CurEmMd == kEmMd_Twiggy || CurEmMd == kEmMd_Twig43) {
/* 'Disk' instead of 'Sony' */
do_put_mem_long(pto + 0x14, 0x4469736B);
if (CurEmMd == kEmMd_Twig43) {
do_put_mem_word(pto + 0xEA, 0x0C8A);
} else {
do_put_mem_word(pto + 0xEA, 0x0B74);
}
}
}
void Sony_CallPatch(uint8_t *pto, int drvSize)
{
pto += drvSize;
do_put_mem_word(pto, kcom_callcheck);
pto += 2;
do_put_mem_word(pto, kExtnSony);
pto += 2;
do_put_mem_long(pto, kExtn_Block_Base); /* pokeaddr */
pto += 4;
}
void Sony_Install(void)
{
uint8_t * pto = Sony_DriverBase + ROM;
int drvSize = 0;
if (!UseSonyPatch) { return; }
Sony_LoadDriver(pto, &drvSize);
Sony_TwiggyPatch(pto);
Sony_CallPatch(pto, drvSize);
Sony_LoadIcon(pto);
// yeah this sucks but it's so awful and intertwined that i have no choice
ScreenHack_Install(pto);
}

19
src/PATCHES/SONYDRV.h Normal file
View File

@ -0,0 +1,19 @@
#define UseSonyPatch \
((CurEmMd <= kEmMd_Classic) || (CurEmMd == kEmMd_II) \
|| (CurEmMd == kEmMd_IIx))
#if CurEmMd <= kEmMd_Twig43
#define Sony_DriverBase 0x1836
#elif CurEmMd <= kEmMd_Twiggy
#define Sony_DriverBase 0x16E4
#elif CurEmMd <= kEmMd_128K
#define Sony_DriverBase 0x1690
#elif CurEmMd <= kEmMd_Plus
#define Sony_DriverBase 0x17D30
#elif CurEmMd <= kEmMd_Classic
#define Sony_DriverBase 0x34680
#elif (CurEmMd == kEmMd_II) || (CurEmMd == kEmMd_IIx)
#define Sony_DriverBase 0x2D72C
#endif
void Sony_Install();

View File

@ -871,7 +871,7 @@ GLOBALVAR char *SavedLongMsg = nullpr;
#if WantAbnormalReports
GLOBALVAR uint16_t SavedIDMsg = 0;
#endif
GLOBALVAR bool SavedFatalMsg = nullpr;
GLOBALVAR bool SavedFatalMsg = false;
GLOBALPROC MacMsg(char *briefMsg, char *longMsg, bool fatal)
{

View File

@ -1 +0,0 @@
256 ICON DISCARDABLE "ICONAPPW.ico"