├── .gitignore ├── .gitlab-ci.yml ├── .gitmodules ├── Makefile ├── Makefile.common ├── README ├── jni ├── Android.mk ├── Application.mk └── readme_android.txt ├── libretro ├── MACkeymap.h ├── include │ ├── features_cpu.h │ ├── retro_common_api.h │ ├── retro_video.h │ └── retroscreen.h ├── libretro-core.c ├── libretro-core.h ├── link.T ├── nukleargui │ ├── app.c │ ├── c64menu.i │ ├── filebrowser.c │ ├── filebrowser.i │ ├── gui.i │ ├── nuklear │ │ ├── Readme.md │ │ ├── calculator.c │ │ ├── node_editor.c │ │ ├── nuklear.h │ │ ├── overview.c │ │ └── style.c │ ├── retro │ │ ├── RSDL_wrapper.h │ │ ├── SDL_gfxPrimitives.c │ │ ├── SDL_gfxPrimitives.h │ │ ├── font2.i │ │ ├── nuklear_retro_soft.h │ │ └── retro_surface.c │ └── vkboard.i ├── retrostubs.c └── vkbd.i ├── link.T └── minivmac ├── COPYING.txt ├── README.txt ├── cfg ├── CNFGGLOB.h ├── CNFGRAPI.h ├── EMCONFIG.h ├── SOUNDGLU.h └── STRCONST.h ├── extras ├── mydriver │ ├── disk │ │ ├── README.txt │ │ └── mydriver.a │ └── video │ │ └── firmware.a └── trans.txt ├── setup ├── BLDUTIL3.i ├── BLDUTIL4.i ├── CMDARGT1.i ├── CNFGDLFT.i ├── CNFGOPTS.i ├── CONFIGUR.i ├── COREDEFS.i ├── DFFILDEF.i ├── GNBLDOPT.i ├── SPBASDEF.i ├── SPBLDOPT.i ├── SPCNFGAP.i ├── SPCNFGGL.i ├── SPFILDEF.i ├── SPOTHRCF.i ├── STRUTILS.i ├── USFILDEF.i ├── WRBGCFLS.i ├── WRCCCFLS.i ├── WRCNFGAP.i ├── WRCNFGGL.i ├── WRDMCFLS.i ├── WRDVCFLS.i ├── WRLCCFLS.i ├── WRMACRES.i ├── WRMPLIST.i ├── WRMPWFLS.i ├── WRMSCFLS.i ├── WRMVCFLS.i ├── WRMW8FLS.i ├── WRPLCFLS.i ├── WRSNCFLS.i ├── WRTEXTFL.i ├── WRXCDFLS.i └── tool.c └── src ├── ACTVCODE.h ├── ADBEMDEV.c ├── ADBEMDEV.h ├── ADBSHARE.h ├── ALTKEYSM.h ├── ASCEMDEV.c ├── ASCEMDEV.h ├── BPFILTER.h ├── COMOSGLU.h ├── CONTROLM.h ├── DATE2SEC.h ├── DISAM68K.c ├── DISAM68K.h ├── ENDIANAC.h ├── FPCPEMDV.h ├── FPMATHEM.h ├── GLOBGLUE.c ├── GLOBGLUE.h ├── HPMCHACK.h ├── ICONAPPM.r ├── ICONAPPO.icns ├── ICONAPPW.ico ├── ICONDSKM.r ├── ICONDSKO.icns ├── ICONDSKW.ico ├── ICONROMM.r ├── ICONROMO.icns ├── ICONROMW.ico ├── INTLCHAR.h ├── IWMEMDEV.c ├── IWMEMDEV.h ├── KBRDEMDV.c ├── KBRDEMDV.h ├── M68KITAB.c ├── M68KITAB.h ├── MINEM68K.c ├── MINEM68K.h ├── MOUSEMDV.c ├── MOUSEMDV.h ├── MYOSGLUE.h ├── OSGLUCCO.m ├── OSGLUERETRO.c ├── OSGLUGTK.c ├── OSGLUMAC.c ├── OSGLUNDS.c ├── OSGLUOSX.c ├── OSGLUSD2.c ├── OSGLUSDL.c ├── OSGLUWIN.c ├── OSGLUXWN.c ├── PBUFSTDC.h ├── PMUEMDEV.c ├── PMUEMDEV.h ├── PROGMAIN.c ├── PROGMAIN.h ├── ROMEMDEV.c ├── ROMEMDEV.h ├── RTCEMDEV.c ├── RTCEMDEV.h ├── SCCEMDEV.c ├── SCCEMDEV.h ├── SCRNEMDV.c ├── SCRNEMDV.h ├── SCRNHACK.h ├── SCRNMAPR.h ├── SCRNTRNS.h ├── SCSIEMDV.c ├── SCSIEMDV.h ├── SGLUALSA.h ├── SGLUDDSP.h ├── SNDEMDEV.c ├── SNDEMDEV.h ├── SONYEMDV.c ├── SONYEMDV.h ├── STRCNCAT.h ├── STRCNCZE.h ├── STRCNDUT.h ├── STRCNENG.h ├── STRCNFRE.h ├── STRCNGER.h ├── STRCNITA.h ├── STRCNPOL.h ├── STRCNPTB.h ├── STRCNSPA.h ├── STRCNSRL.h ├── SYSDEPNS.h ├── VIA2EMDV.c ├── VIA2EMDV.h ├── VIAEMDEV.c ├── VIAEMDEV.h ├── VIDEMDEV.c ├── VIDEMDEV.h └── main.r /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.exe 3 | *.dll 4 | *.so 5 | *.dsk 6 | *.ROM 7 | 8 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "libretro-common"] 2 | path = libretro-common 3 | url = https://github.com/libretro/libretro-common 4 | -------------------------------------------------------------------------------- /Makefile.common: -------------------------------------------------------------------------------- 1 | GUI := $(CORE_DIR)/libretro/nukleargui 2 | 3 | INCFLAGS := \ 4 | -I$(CORE_DIR)/minivmac/src \ 5 | -I$(CORE_DIR)/minivmac/cfg \ 6 | -I$(CORE_DIR)/libretro \ 7 | -I$(CORE_DIR)/libretro/include \ 8 | -I$(CORE_DIR)/libretro-common/include \ 9 | -I$(GUI) \ 10 | -I$(GUI)/nuklear \ 11 | -I$(GUI)/retro 12 | 13 | SOURCES_C := \ 14 | $(CORE_DIR)/minivmac/src/MINEM68K.c \ 15 | $(CORE_DIR)/minivmac/src/GLOBGLUE.c \ 16 | $(CORE_DIR)/minivmac/src/M68KITAB.c \ 17 | $(CORE_DIR)/minivmac/src/VIAEMDEV.c \ 18 | $(CORE_DIR)/minivmac/src/VIA2EMDV.c \ 19 | $(CORE_DIR)/minivmac/src/IWMEMDEV.c \ 20 | $(CORE_DIR)/minivmac/src/SCCEMDEV.c \ 21 | $(CORE_DIR)/minivmac/src/RTCEMDEV.c \ 22 | $(CORE_DIR)/minivmac/src/ROMEMDEV.c \ 23 | $(CORE_DIR)/minivmac/src/SCSIEMDV.c \ 24 | $(CORE_DIR)/minivmac/src/SONYEMDV.c \ 25 | $(CORE_DIR)/minivmac/src/SCRNEMDV.c \ 26 | $(CORE_DIR)/minivmac/src/VIDEMDEV.c \ 27 | $(CORE_DIR)/minivmac/src/ADBEMDEV.c \ 28 | $(CORE_DIR)/minivmac/src/ASCEMDEV.c \ 29 | $(CORE_DIR)/minivmac/src/MOUSEMDV.c \ 30 | $(CORE_DIR)/minivmac/src/PROGMAIN.c \ 31 | $(CORE_DIR)/minivmac/src/OSGLUERETRO.c \ 32 | $(CORE_DIR)/libretro/libretro-core.c \ 33 | $(CORE_DIR)/libretro/retrostubs.c \ 34 | $(GUI)/retro/SDL_gfxPrimitives.c \ 35 | $(GUI)/retro/retro_surface.c \ 36 | $(GUI)/app.c 37 | 38 | ifneq ($(STATIC_LINKING), 1) 39 | SOURCES_C += \ 40 | $(CORE_DIR)/libretro-common/compat/compat_posix_string.c \ 41 | $(CORE_DIR)/libretro-common/compat/compat_snprintf.c \ 42 | $(CORE_DIR)/libretro-common/compat/compat_strl.c \ 43 | $(CORE_DIR)/libretro-common/compat/fopen_utf8.c \ 44 | $(CORE_DIR)/libretro-common/encodings/encoding_utf.c \ 45 | $(CORE_DIR)/libretro-common/file/file_path.c \ 46 | $(CORE_DIR)/libretro-common/file/retro_dirent.c \ 47 | $(CORE_DIR)/libretro-common/time/rtime.c \ 48 | $(CORE_DIR)/libretro-common/streams/file_stream.c \ 49 | $(CORE_DIR)/libretro-common/string/stdstring.c \ 50 | $(CORE_DIR)/libretro-common/vfs/vfs_implementation.c 51 | 52 | endif 53 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | minivmac (MnvM_b36) Libretro port 2 | 3 | 4 | MnvM_b36 is the build system for Mini vMac, 5 | a miniature Macintosh emulator. 6 | 7 | Further information may be found at 8 | "https://www.gryphel.com/c/minivmac/". 9 | 10 | ----------------------------------------------------------- 11 | 12 | It's a quick hack. 13 | At this time , works the basis but buggy on linux /android. 14 | 15 | Default Control : 16 | 17 | L2 Show/Hide statut 18 | R2 19 | L Show/Hide vkbd . 20 | R Change Mouse speed 1 to 6 . (for gui and emu) 21 | SEL Toggle Mouse/Joy mode . 22 | STR Toggle Num Joy . 23 | A Fire/Mouse btn A / Valid key in vkbd 24 | B Mouse btn B 25 | X Switch Shift ON/OFF 26 | Y MiniVmac Disk Filebrowser 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | CORE_DIR := $(LOCAL_PATH)/.. 6 | EMU := $(CORE_DIR)/minivmac/src 7 | CFG := $(CORE_DIR)/minivmac/cfg 8 | 9 | LOCAL_MODULE := retro 10 | LOCAL_CFLAGS := 11 | 12 | ifeq ($(TARGET_ARCH),arm) 13 | LOCAL_CFLAGS += -DANDROID_ARM 14 | endif 15 | 16 | ifeq ($(TARGET_ARCH),x86) 17 | LOCAL_CFLAGS += -DANDROID_X86 18 | endif 19 | 20 | ifeq ($(TARGET_ARCH),mips) 21 | LOCAL_CFLAGS += -DANDROID_MIPS -D__mips__ -D__MIPSEL__ 22 | endif 23 | 24 | include $(CORE_DIR)/Makefile.common 25 | 26 | BUILD_APP = $(CORE_SRCS) 27 | 28 | LOCAL_SRC_FILES := $(SOURCES_CXX) $(SOURCES_C) 29 | 30 | LOCAL_CFLAGS += $(INCFLAGS) \ 31 | -DMAC2=1 \ 32 | -DAND \ 33 | -std=gnu99 \ 34 | -O3 \ 35 | -finline-functions \ 36 | -funroll-loops \ 37 | -fsigned-char \ 38 | -Wno-strict-prototypes \ 39 | -ffast-math \ 40 | -fomit-frame-pointer \ 41 | -fno-strength-reduce \ 42 | -fno-builtin \ 43 | -D__LIBRETRO__ -DFRONTEND_SUPPORTS_RGB565 \ 44 | -finline-functions -s \ 45 | 46 | 47 | LOCAL_LDLIBS := -shared -Wl,--version-script=../libretro/link.T 48 | 49 | include $(BUILD_SHARED_LIBRARY) 50 | -------------------------------------------------------------------------------- /jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := all 2 | -------------------------------------------------------------------------------- /jni/readme_android.txt: -------------------------------------------------------------------------------- 1 | 2 | Mini Vmac 3.3.2 LIBRETRO DEBUG VERSION 3 | 4 | 5 | the Android version is experimental and still buggy . 6 | 7 | 8 | 9 | Compile: 10 | 11 | Go to jni directory, and type ndk-build . 12 | 13 | 14 | Setup: 15 | 16 | - First , create a folder on /mnt/sdcard/vmac/ . 17 | - Put a MacIIx.ROM and some DSK/IMG files in this folder. 18 | 19 | 20 | Usage: 21 | 22 | Launch retroarch , select a startup dsk , and mini vmac sould boot. 23 | 24 | 25 | Knows Bugs: 26 | 27 | - Everything not working well, It's a debug release , so expect to more bug. 28 | -------------------------------------------------------------------------------- /libretro/MACkeymap.h: -------------------------------------------------------------------------------- 1 | 2 | /* scancode key to MAC scan code mapping table */ 3 | const char 4 | SDLKeyToMACScanCode[512] = 5 | { 6 | /* ST, PC Code */ 7 | -1, /* 0 */ -1, /* 1 */ -1, /* 2 */ -1, /* 3 */ -1, /* 4 */ -1, /* 5 */ -1, /* 6 */ -1, /* 7 */ 8 | 0x33, /* SDLK_BACKSPACE=8 */ 9 | 0x30, /* SDLK_TAB=9 */ 10 | -1, /* 10 */ -1, /* 11 */ 11 | 0x47, /* SDLK_CLEAR = 12 */ 12 | 0x24, /* SDLK_RETURN = 13 */ 13 | -1, /* 14 */ -1, /* 15 */ -1, /* 16 */ -1, /* 17 */ -1, /* 18 */ 14 | 0x71, /* SDLK_PAUSE = 19 */ 15 | -1, /* 20 */ -1, /* 21 */ -1, /* 22 */ -1, /* 23 */ -1, /* 24 */ -1, /* 25 */ -1, /* 26 */ 16 | 0x35, /* SDLK_ESCAPE = 27 */ 17 | -1, /* 28 */ -1, /* 29 */ -1, /* 30 */ -1, /* 31 */ 18 | 0x31, /* SDLK_SPACE = 32 */ 19 | -1, /* SDLK_EXCLAIM = 33 */ 20 | -1, /* SDLK_QUOTEDBL = 34 */ 21 | -1, /* SDLK_HASH = 35 */ 22 | -1, /* SDLK_DOLLAR = 36 */ 23 | -1, /* 37 */ 24 | -1, /* SDLK_AMPERSAND = 38 */ 25 | 0x27, /* SDLK_QUOTE = 39 */ 26 | 0x21, /* SDLK_LEFTPAREN = 40 */ 27 | 0x1E, /* SDLK_RIGHTPAREN = 41 */ 28 | -1, /* SDLK_ASTERISK = 42 */ 29 | 0x51, /* SDLK_PLUS = 43 */ 30 | 0x2B, /* SDLK_COMMA = 44 */ 31 | 0x1B, /* SDLK_MINUS = 45 */ 32 | 0x2F, /* SDLK_PERIOD = 46 */ 33 | 0x2C, /* SDLK_SLASH = 47 */ 34 | 0x1D, /* SDLK_0 = 48 */ 35 | 0x12, /* SDLK_1 = 49 */ 36 | 0x13, /* SDLK_2 = 50 */ 37 | 0x14, /* SDLK_3 = 51 */ 38 | 0x15, /* SDLK_4 = 52 */ 39 | 0x17, /* SDLK_5 = 53 */ 40 | 0x16, /* SDLK_6 = 54 */ 41 | 0x1A, /* SDLK_7 = 55 */ 42 | 0x1C, /* SDLK_8 = 56 */ 43 | 0x19, /* SDLK_9 = 57 */ 44 | 0x2B, /* SDLK_COLON = 58 */ 45 | 0x29, /* SDLK_SEMICOLON = 59 */ 46 | -1, /* SDLK_LESS = 60 */ 47 | 0x18, /* SDLK_EQUALS = 61 */ 48 | -1, /* SDLK_GREATER = 62 */ 49 | -1, /* SDLK_QUESTION = 63 */ 50 | -1, /* SDLK_AT = 64 */ 51 | -1, /* 65 */ /* Skip uppercase letters */ 52 | -1, /* 66 */ -1, /* 67 */ -1, /* 68 */ -1, /* 69 */ -1, /* 70 */ -1, /* 71 */ -1, /* 72 */ -1, /* 73 */ -1, /* 74 */ 53 | -1, /* 75 */ -1, /* 76 */ -1, /* 77 */ -1, /* 78 */ -1, /* 79 */ -1, /* 80 */ -1, /* 81 */ -1, /* 82 */ -1, /* 83 */ 54 | -1, /* 84 */ -1, /* 85 */ -1, /* 86 */ -1, /* 87 */ -1, /* 88 */ -1, /* 89 */ -1, /* 90 */ 55 | 0x21, /* SDLK_LEFTBRACKET = 91 */ 56 | 0x2A, /* SDLK_BACKSLASH = 92 */ /* Might be 0x60 for UK keyboards */ 57 | 0x1E, /* SDLK_RIGHTBRACKET = 93 */ 58 | -1, /* SDLK_CARET = 94 */ 59 | -1, /* SDLK_UNDERSCORE = 95 */ 60 | -1, /* SDLK_BACKQUOTE = 96 */ 61 | /*A*/0x00, 62 | /*B*/0x0B, 63 | /*C*/0x08, 64 | /*D*/0x02, 65 | /*E*/0x0E, 66 | /*F*/0x03, 67 | /*G*/0x05, 68 | /*H*/0x04, 69 | /*I*/0x22, 70 | /*J*/0x26, 71 | /*K*/0x28, 72 | /*L*/0x25, 73 | /*M*/0x2E, 74 | /*N*/0x2D, 75 | /*O*/0x1F, 76 | /*P*/0x23, 77 | /*Q*/0x0C, 78 | /*R*/0x0F, 79 | /*S*/0x01, 80 | /*T*/0x11, 81 | /*U*/0x20, 82 | /*V*/0x09, 83 | /*W*/0x0D, 84 | /*X*/0x07, 85 | /*Y*/0x10, 86 | /*Z*/0x06, 87 | -1, /* 123 */ -1, /* 124 */ -1, /* 125 */ -1, /* 126 */ 88 | 0x75, /* SDLK_DELETE = 127 */ 89 | /* End of ASCII mapped keysyms */ 90 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 128-143*/ 91 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 144-159*/ 92 | 0x0d, 0x0c, 0x1a, 0x28, 0x27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 160-175*/ 93 | -1, -1, -1, -1, 0x0D, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 176-191*/ 94 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 192-207*/ 95 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0x0C, /* 208-223*/ 96 | -1, -1, -1, -1, 0x28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 224-239*/ 97 | -1, -1, -1, -1, -1, -1, 0x27, -1, -1, -1, -1, -1, 0x1A, -1, -1, -1, /* 240-255*/ 98 | /* Numeric keypad: */ 99 | 0x52, /* SDLK_KP0 = 256 */ 100 | 0x53, /* SDLK_KP1 = 257 */ 101 | 0x54, /* SDLK_KP2 = 258 */ 102 | 0x55, /* SDLK_KP3 = 259 */ 103 | 0x56, /* SDLK_KP4 = 260 */ 104 | 0x57, /* SDLK_KP5 = 261 */ 105 | 0x58, /* SDLK_KP6 = 262 */ 106 | 0x59, /* SDLK_KP7 = 263 */ 107 | 0x5b, /* SDLK_KP8 = 264 */ 108 | 0x5c, /* SDLK_KP9 = 265 */ 109 | 0x2F , /* SDLK_KP_PERIOD = 266 */ 110 | 0x4B, /* SDLK_KP_DIVIDE = 267 */ 111 | 0x43, /* SDLK_KP_MULTIPLY = 268 */ 112 | 0x4E, /* SDLK_KP_MINUS = 269 */ 113 | 0x45, /* SDLK_KP_PLUS = 270 */ 114 | 0x4C, /* SDLK_KP_ENTER = 271 */ 115 | 0x51, /* SDLK_KP_EQUALS = 272 */ 116 | /* Arrows + Home/End pad */ 117 | 0x7E, /* SDLK_UP = 273 */ 118 | 0x7D, /* SDLK_DOWN = 274 */ 119 | 0x7C, /* SDLK_RIGHT = 275 */ 120 | 0x7B, /* SDLK_LEFT = 276 */ 121 | -1, /* SDLK_INSERT = 277 */ 122 | 0x73, /* SDLK_HOME = 278 */ 123 | 0x77, /* SDLK_END = 279 */ 124 | 0x74, /* SDLK_PAGEUP = 280 */ 125 | 0x79, /* SDLK_PAGEDOWN = 281 */ 126 | /* Function keys */ 127 | 0x7a, /* SDLK_F1 = 282 */ 128 | 0x78, /* SDLK_F2 = 283 */ 129 | 0x63, /* SDLK_F3 = 284 */ 130 | 0x76, /* SDLK_F4 = 285 */ 131 | 0x60, /* SDLK_F5 = 286 */ 132 | 0x61, /* SDLK_F6 = 287 */ 133 | 0x62, /* SDLK_F7 = 288 */ 134 | 0x64, /* SDLK_F8 = 289 */ 135 | 0x65, /* SDLK_F9 = 290 */ 136 | 0x6d, /* SDLK_F10 = 291 */ 137 | 0x67, /* SDLK_F11 = 292 */ 138 | 0x6f, /* SDLK_F12 = 293 */ 139 | -1 , /* SDLK_F13 = 294 */ 140 | -1, /* SDLK_F14 = 295 */ 141 | -1, /* SDLK_F15 = 296 */ 142 | -1, /* 297 */ -1, /* 298 */ -1, /* 299 */ 143 | /* Key state modifier keys */ 144 | -1, /* SDLK_NUMLOCK = 300 */ 145 | 0x39, /* SDLK_CAPSLOCK = 301 */ 146 | 0x6B, /* SDLK_SCROLLOCK = 302 */ 147 | 0x38, /* SDLK_RSHIFT = 303 */ 148 | 0x38, /* SDLK_LSHIFT = 304 */ 149 | 0x3B, /* SDLK_RCTRL = 305 */ 150 | 0x3B, /* SDLK_LCTRL = 306 */ 151 | 0x37, /* SDLK_RALT = 307 */ 152 | 0x37, /* SDLK_LALT = 308 */ 153 | -1, /* SDLK_RMETA = 309 */ 154 | -1, /* SDLK_LMETA = 310 */ 155 | -1, /* SDLK_LSUPER = 311 */ 156 | -1, /* SDLK_RSUPER = 312 */ 157 | -1, /* SDLK_MODE = 313 */ /* "Alt Gr" key */ 158 | -1, /* SDLK_COMPOSE = 314 */ 159 | /* Miscellaneous function keys */ 160 | 0x72, /* SDLK_HELP = 315 */ 161 | 0x69, /* SDLK_PRINT = 316 */ 162 | -1, /* SDLK_SYSREQ = 317 */ 163 | -1, /* SDLK_BREAK = 318 */ 164 | -1, /* SDLK_MENU = 319 */ 165 | -1, /* SDLK_POWER = 320 */ 166 | -1, /* SDLK_EURO = 321 */ 167 | 0x61 /* SDLK_UNDO = 322 */ 168 | }; 169 | 170 | -------------------------------------------------------------------------------- /libretro/include/features_cpu.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2017 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (features_cpu.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef _LIBRETRO_SDK_CPU_INFO_H 24 | #define _LIBRETRO_SDK_CPU_INFO_H 25 | 26 | #include 27 | 28 | #include 29 | 30 | #include 31 | 32 | RETRO_BEGIN_DECLS 33 | 34 | /** 35 | * cpu_features_get_perf_counter: 36 | * 37 | * Gets performance counter. 38 | * 39 | * Returns: performance counter. 40 | **/ 41 | retro_perf_tick_t cpu_features_get_perf_counter(void); 42 | 43 | /** 44 | * cpu_features_get_time_usec: 45 | * 46 | * Gets time in microseconds, from an undefined epoch. 47 | * The epoch may change between computers or across reboots. 48 | * 49 | * Returns: time in microseconds 50 | **/ 51 | retro_time_t cpu_features_get_time_usec(void); 52 | 53 | /** 54 | * cpu_features_get: 55 | * 56 | * Gets CPU features. 57 | * 58 | * Returns: bitmask of all CPU features available. 59 | **/ 60 | uint64_t cpu_features_get(void); 61 | 62 | /** 63 | * cpu_features_get_core_amount: 64 | * 65 | * Gets the amount of available CPU cores. 66 | * 67 | * Returns: amount of CPU cores available. 68 | **/ 69 | unsigned cpu_features_get_core_amount(void); 70 | 71 | RETRO_END_DECLS 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /libretro/include/retro_common_api.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2016 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (retro_common_api.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef _LIBRETRO_COMMON_RETRO_COMMON_API_H 24 | #define _LIBRETRO_COMMON_RETRO_COMMON_API_H 25 | 26 | /* 27 | This file is designed to normalize the libretro-common compiling environment 28 | for public API headers. This should be leaner than a normal compiling environment, 29 | since it gets #included into other project's sources. 30 | */ 31 | 32 | /* ------------------------------------ */ 33 | 34 | /* 35 | Ordinarily we want to put #ifdef __cplusplus extern "C" in C library 36 | headers to enable them to get used by c++ sources. 37 | However, we want to support building this library as C++ as well, so a 38 | special technique is called for. 39 | */ 40 | 41 | #define RETRO_BEGIN_DECLS 42 | #define RETRO_END_DECLS 43 | 44 | #ifdef __cplusplus 45 | 46 | #ifdef CXX_BUILD 47 | /* build wants everything to be built as c++, so no extern "C" */ 48 | #else 49 | #undef RETRO_BEGIN_DECLS 50 | #undef RETRO_END_DECLS 51 | #define RETRO_BEGIN_DECLS extern "C" { 52 | #define RETRO_END_DECLS } 53 | #endif 54 | 55 | #else 56 | 57 | /* header is included by a C source file, so no extern "C" */ 58 | 59 | #endif 60 | 61 | /* 62 | IMO, this non-standard ssize_t should not be used. 63 | However, it's a good example of how to handle something like this. 64 | */ 65 | #ifdef _MSC_VER 66 | #ifndef HAVE_SSIZE_T 67 | #define HAVE_SSIZE_T 68 | #if defined(_WIN64) 69 | typedef __int64 ssize_t; 70 | #elif defined(_WIN32) 71 | typedef int ssize_t; 72 | #endif 73 | #endif 74 | #elif defined(__MACH__) 75 | #include 76 | #endif 77 | 78 | #ifdef _WIN32 79 | #define STRING_REP_INT64 "%I64u" 80 | #define STRING_REP_UINT64 "%I64u" 81 | #define STRING_REP_ULONG "%Iu" 82 | #elif defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L && !defined(VITA) && !defined(WIIU) 83 | #define STRING_REP_INT64 "%llu" 84 | #define STRING_REP_UINT64 "%llu" 85 | #define STRING_REP_ULONG "%zu" 86 | #else 87 | #define STRING_REP_INT64 "%llu" 88 | #define STRING_REP_UINT64 "%llu" 89 | #define STRING_REP_ULONG "%lu" 90 | #endif 91 | 92 | /* 93 | I would like to see retro_inline.h moved in here; possibly boolean too. 94 | 95 | rationale: these are used in public APIs, and it is easier to find problems 96 | and write code that works the first time portably when theyre included uniformly 97 | than to do the analysis from scratch each time you think you need it, for each feature. 98 | 99 | Moreover it helps force you to make hard decisions: if you EVER bring in boolean.h, 100 | then you should pay the price everywhere, so you can see how much grief it will cause. 101 | 102 | Of course, another school of thought is that you should do as little damage as possible 103 | in as few places as possible... 104 | */ 105 | 106 | 107 | /* _LIBRETRO_COMMON_RETRO_COMMON_API_H */ 108 | #endif 109 | -------------------------------------------------------------------------------- /libretro/include/retro_video.h: -------------------------------------------------------------------------------- 1 | #ifndef _retro_video_h 2 | #define _retro_video_h 3 | 4 | typedef struct{ 5 | signed short x, y; 6 | unsigned short w, h; 7 | } retro_Rect; 8 | 9 | typedef struct{ 10 | unsigned char *pixels; 11 | unsigned short w, h,pitch; 12 | } retro_Surface; 13 | 14 | typedef struct{ 15 | unsigned char r,g,b; 16 | } retro_pal; 17 | 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /libretro/include/retroscreen.h: -------------------------------------------------------------------------------- 1 | #ifndef RETROSCREEN_H 2 | #define RETROSCREEN_H 1 3 | 4 | extern int CROP_WIDTH; 5 | extern int CROP_HEIGHT; 6 | extern int VIRTUAL_WIDTH; 7 | extern int retrow ; 8 | extern int retroh ; 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /libretro/libretro-core.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBRETRO_CORE_H 2 | #define LIBRETRO_CORE_H 1 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "boolean.h" 11 | 12 | //#define MATRIX(a,b) (((a) << 3) | (b)) 13 | 14 | // DEVICE MINIVMAC 15 | #define RETRO_DEVICE_MINIVMAC_KEYBOARD RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_KEYBOARD, 0) 16 | #define RETRO_DEVICE_MINIVMAC_JOYSTICK RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 1) 17 | 18 | extern unsigned minivmac_devices[ 2 ]; 19 | 20 | #define TEX_WIDTH 640 21 | #define TEX_HEIGHT 480 22 | 23 | //TYPES 24 | 25 | typedef uint8_t Uint8; 26 | typedef uint16_t Uint16; 27 | typedef uint32_t Uint32; 28 | typedef uint64_t Uint64; 29 | 30 | typedef int8_t Sint8; 31 | typedef int16_t Sint16; 32 | typedef int32_t Sint32; 33 | typedef int64_t Sint64; 34 | 35 | typedef uint8_t uint8; 36 | typedef uint16_t uint16; 37 | typedef uint32_t uint32; 38 | 39 | typedef int8_t int8; 40 | typedef int16_t int16; 41 | typedef int32_t int32; 42 | 43 | typedef uint8_t UINT8; 44 | typedef uint16_t UINT16; 45 | typedef uint32_t UINT32; 46 | 47 | #define WINDOW_WIDTH 640 48 | #define WINDOW_HEIGHT 480 49 | #define WINDOW_SIZE (640*480) 50 | 51 | #define RGB565(r, g, b) (((r) << (5+6)) | ((g) << 6) | (b)) 52 | 53 | #ifdef FRONTEND_SUPPORTS_RGB565 54 | #define M16B 55 | #endif 56 | 57 | #ifdef FRONTEND_SUPPORTS_RGB565 58 | extern uint16_t *Retro_Screen; 59 | extern uint16_t bmp[WINDOW_SIZE]; 60 | #define PIXEL_BYTES 1 61 | #define PIXEL_TYPE UINT16 62 | #define PITCH 2 63 | #else 64 | extern unsigned int *Retro_Screen; 65 | extern unsigned int bmp[WINDOW_SIZE]; 66 | #define PIXEL_BYTES 2 67 | #define PIXEL_TYPE UINT32 68 | #define PITCH 4 69 | #endif 70 | 71 | 72 | //VKBD 73 | #define NPLGN 10 74 | #define NLIGN 5 75 | #define NLETT 5 76 | 77 | typedef struct { 78 | char norml[NLETT]; 79 | char shift[NLETT]; 80 | int val; 81 | } Mvk; 82 | 83 | extern Mvk MVk[NPLGN*NLIGN*2]; 84 | 85 | //STRUCTURES 86 | typedef struct{ 87 | signed short x, y; 88 | unsigned short w, h; 89 | } retro_Rect; 90 | 91 | typedef struct{ 92 | unsigned char *pixels; 93 | unsigned short w, h,pitch; 94 | } retro_Surface; 95 | 96 | typedef struct{ 97 | unsigned char r,g,b; 98 | } retro_pal; 99 | 100 | //VARIABLES 101 | extern int pauseg; 102 | extern int CROP_WIDTH; 103 | extern int CROP_HEIGHT; 104 | extern int VIRTUAL_WIDTH; 105 | extern int retrow ; 106 | extern int retroh ; 107 | extern int minivmac_statusbar; 108 | extern struct retro_vfs_interface *vfs_interface; 109 | 110 | //FUNCS 111 | extern void mainloop_retro(void); 112 | extern long GetTicks(void); 113 | #endif 114 | -------------------------------------------------------------------------------- /libretro/link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: retro_*; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /libretro/nukleargui/app.c: -------------------------------------------------------------------------------- 1 | /* nuklear - v1.00 - public domain */ 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | /* Forward declarations */ 17 | extern void filebrowser_init(void); 18 | extern void filebrowser_free(void); 19 | 20 | extern void Screen_SetFullUpdate(int scr); 21 | extern void vkbd_key(int key,int pressed); 22 | extern void app_vkb_handle(void); 23 | 24 | int UnInitOSGLU(void); 25 | 26 | /* Variables */ 27 | 28 | extern char Core_Key_Sate[512]; 29 | extern char Core_old_Key_Sate[512]; 30 | extern char RPATH[512]; 31 | extern int SHOWKEY; 32 | extern int want_quit; 33 | 34 | char LCONTENT[512]; 35 | int LOADCONTENT=-1; 36 | int LDRIVE=8; 37 | 38 | #define NK_INCLUDE_FIXED_TYPES 39 | #define NK_INCLUDE_STANDARD_VARARGS 40 | #define NK_INCLUDE_DEFAULT_ALLOCATOR 41 | #define NK_IMPLEMENTATION 42 | 43 | #define NK_RETRO_SOFT_IMPLEMENTATION 44 | 45 | #include "nuklear.h" 46 | #include "nuklear_retro_soft.h" 47 | 48 | static RSDL_Surface *screen_surface; 49 | 50 | extern void restore_bgk(); 51 | extern void save_bkg(); 52 | 53 | /* macros */ 54 | 55 | #define UNUSED(a) (void)a 56 | #define MIN(a,b) ((a) < (b) ? (a) : (b)) 57 | #define MAX(a,b) ((a) < (b) ? (b) : (a)) 58 | #define LEN(a) (sizeof(a)/sizeof(a)[0]) 59 | 60 | /* Platform */ 61 | 62 | float bg[4]; 63 | struct nk_color background; 64 | /* GUI */ 65 | struct nk_context *ctx; 66 | 67 | static nk_retro_Font *RSDL_font; 68 | 69 | #include "style.c" 70 | #include "filebrowser.c" 71 | #include "gui.i" 72 | 73 | int app_init() 74 | { 75 | 76 | #ifdef FRONTEND_SUPPORTS_RGB565 77 | screen_surface=Retro_CreateRGBSurface16(retrow,retroh,16,0,0,0,0); 78 | Retro_Screen=(unsigned short int *)screen_surface->pixels; 79 | #else 80 | screen_surface=Retro_CreateRGBSurface32(retrow,retroh,32,0,0,0,0); 81 | Retro_Screen=(unsigned int *)screen_surface->pixels; 82 | #endif 83 | 84 | RSDL_font = (nk_retro_Font*)calloc(1, sizeof(nk_retro_Font)); 85 | RSDL_font->width = 8; 86 | RSDL_font->height = 8; 87 | if (!RSDL_font) 88 | return -1; 89 | 90 | /* GUI */ 91 | ctx = nk_retro_init(RSDL_font,screen_surface,retrow,retroh); 92 | 93 | /* style.c */ 94 | /* THEME_BLACK, THEME_WHITE, THEME_RED, THEME_BLUE, THEME_DARK */ 95 | set_style(ctx, THEME_DARK); 96 | 97 | /* icons */ 98 | 99 | filebrowser_init(); 100 | sprintf(LCONTENT,"%s",RPATH); 101 | 102 | memset(Core_Key_Sate,0,512); 103 | memset(Core_old_Key_Sate ,0, sizeof(Core_old_Key_Sate)); 104 | 105 | printf("Init nuklear %d\n",0); 106 | 107 | return 0; 108 | } 109 | 110 | int app_free() 111 | { 112 | //FIXME: no more memory leak here ? 113 | if (RSDL_font) 114 | free(RSDL_font); 115 | RSDL_font = NULL; 116 | filebrowser_free(); 117 | nk_retro_shutdown(); 118 | 119 | Retro_FreeSurface(screen_surface); 120 | printf("free surfscreen\n"); 121 | if (screen_surface) 122 | free(screen_surface); 123 | screen_surface = NULL; 124 | 125 | UnInitOSGLU(); 126 | 127 | return 0; 128 | } 129 | 130 | int app_event(int poll) 131 | { 132 | int evt; 133 | 134 | nk_input_begin(ctx); 135 | nk_retro_handle_event(&evt,poll); 136 | nk_input_end(ctx); 137 | 138 | return 0; 139 | } 140 | 141 | int app_render(int poll) 142 | { 143 | static int prevpoll=0,prevstate=0,reset_state=0; 144 | int state; 145 | if(prevpoll!=poll || reset_state){nk_clear(ctx);reset_state=0;} 146 | 147 | if(poll==0) 148 | app_vkb_handle(); 149 | else 150 | restore_bgk(); 151 | 152 | app_event(poll); 153 | 154 | state=gui(&browser,ctx); 155 | if(state==1 && prevstate!=1)reset_state=1; 156 | 157 | nk_retro_render(nk_rgba(0,0,0,0)); 158 | 159 | prevpoll=poll; 160 | prevstate=state; 161 | 162 | return 0; 163 | } 164 | 165 | -------------------------------------------------------------------------------- /libretro/nukleargui/c64menu.i: -------------------------------------------------------------------------------- 1 | 2 | 3 | #define DEFHSZ 16 4 | #define DEFWSZ 64 5 | 6 | //misc options 7 | static int showled = nk_false; 8 | static int current_drvtype = 2; 9 | static int old_drvtype = 2; 10 | int i; 11 | 12 | if (minivmac_statusbar) { 13 | showled = nk_true; 14 | } 15 | else showled = nk_false; 16 | 17 | //floppy option 18 | current_drvtype = 2; 19 | old_drvtype = 2; 20 | 21 | // button toggle GUI/EMU 22 | nk_layout_row_dynamic(ctx, DEFHSZ, 3); 23 | if (nk_button_label(ctx, "Resume")){ 24 | fprintf(stdout, "quit GUI\n"); 25 | pauseg=0; 26 | } 27 | if (nk_button_label(ctx, "Reset")){ 28 | fprintf(stdout, "quit GUI & reset\n"); 29 | pauseg=0; 30 | emu_reset(); 31 | } 32 | if (nk_button_label(ctx, "Quit")){ 33 | fprintf(stdout, "quit GUI & emu\n"); 34 | pauseg=0; 35 | want_quit=1; 36 | } 37 | 38 | //joystick options 39 | //misc options 40 | nk_layout_row_dynamic(ctx, DEFHSZ, 1); 41 | nk_checkbox_label(ctx, "Statusbar", &showled); 42 | 43 | if(showled){ 44 | if(!minivmac_statusbar) 45 | minivmac_statusbar = 1; 46 | } 47 | else if(minivmac_statusbar) 48 | minivmac_statusbar = 0; 49 | 50 | 51 | //floppy option 52 | 53 | for(i=0;i<2;i++) 54 | if(LOADCONTENT==2 && LDRIVE==(i+8)); 55 | else if( (i==0? DISKA_NAME: DISKB_NAME)!=NULL){ 56 | sprintf((i==0?DF8NAME:DF9NAME),"%s",(i==0? DISKA_NAME: DISKB_NAME)); 57 | } 58 | //else sprintf(LCONTENT,"Choose Content\0"); 59 | 60 | nk_layout_row_dynamic(ctx, DEFHSZ, 1); 61 | nk_label(ctx, "DF8:", NK_TEXT_LEFT); 62 | nk_layout_row_dynamic(ctx, DEFHSZ, 1); 63 | 64 | if (nk_button_label(ctx, DF8NAME)){ 65 | fprintf(stdout, "LOAD DISKA\n"); 66 | LOADCONTENT=1; 67 | LDRIVE=8; 68 | } 69 | 70 | nk_layout_row_dynamic(ctx, DEFHSZ, 1); 71 | nk_label(ctx, "DF9:", NK_TEXT_LEFT); 72 | nk_layout_row_dynamic(ctx, DEFHSZ, 1); 73 | 74 | if (nk_button_label(ctx, DF9NAME)){ 75 | fprintf(stdout, "LOAD DISKB\n"); 76 | LOADCONTENT=1; 77 | LDRIVE=9; 78 | } 79 | if(LOADCONTENT==2 && strlen(LCONTENT) > 0){ 80 | 81 | fprintf(stdout, "LOAD CONTENT DF%d (%s)\n",LDRIVE,LCONTENT); 82 | 83 | sprintf((LDRIVE==8? DISKA_NAME: DISKB_NAME),"%s",LCONTENT); 84 | LOADCONTENT=-1; 85 | 86 | //cartridge_detach_image(-1); 87 | //tape_image_detach(1); 88 | 89 | if(HandleExtension(LCONTENT,"IMG") || HandleExtension(LCONTENT,"img")) 90 | ;//cartridge_attach_image(CARTRIDGE_CRT, LCONTENT); 91 | else { 92 | /* 93 | if(fliplst){ 94 | file_system_detach_disk(GET_DRIVE(LDRIVE)); 95 | printf("Attach to flip list\n"); 96 | file_system_attach_disk(LDRIVE, LCONTENT); 97 | fliplist_add_image(LDRIVE); 98 | } 99 | else if (LDRIVE==9) { 100 | file_system_detach_disk(GET_DRIVE(LDRIVE)); 101 | printf("Attach DF9 disk\n"); 102 | file_system_attach_disk(LDRIVE, LCONTENT); 103 | } 104 | else { 105 | printf("autostart\n"); 106 | autostart_autodetect(LCONTENT, NULL, 0, AUTOSTART_MODE_RUN); 107 | } 108 | */ 109 | } 110 | 111 | 112 | } 113 | else if(LOADCONTENT==2)LOADCONTENT=-1; 114 | 115 | -------------------------------------------------------------------------------- /libretro/nukleargui/filebrowser.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #ifndef _MSC_VER 4 | #include 5 | #endif 6 | #include 7 | 8 | /* =============================================================== 9 | * 10 | * GUI 11 | * 12 | * ===============================================================*/ 13 | 14 | #define MAX_PATH_LEN 512 15 | struct file_browser { 16 | /* path */ 17 | char file[MAX_PATH_LEN]; 18 | char home[MAX_PATH_LEN]; 19 | char desktop[MAX_PATH_LEN]; 20 | char directory[MAX_PATH_LEN]; 21 | 22 | /* directory content */ 23 | char **files; 24 | char **directories; 25 | size_t file_count; 26 | size_t dir_count; 27 | }; 28 | 29 | 30 | static struct file_browser browser; 31 | 32 | #ifdef __unix__ 33 | #include 34 | #endif 35 | 36 | #ifndef _WIN32 37 | # include 38 | #endif 39 | 40 | static void 41 | die(const char *fmt, ...) 42 | { 43 | va_list ap; 44 | va_start(ap, fmt); 45 | vfprintf(stderr, fmt, ap); 46 | va_end(ap); 47 | fputs("\n", stderr); 48 | exit(EXIT_FAILURE); 49 | } 50 | 51 | #ifndef __LIBRETRO__ 52 | static char* 53 | file_load(const char* path, size_t* siz) 54 | { 55 | char *buf; 56 | FILE *fd = fopen(path, "rb"); 57 | if (!fd) die("Failed to open file: %s\n", path); 58 | fseek(fd, 0, SEEK_END); 59 | *siz = (size_t)ftell(fd); 60 | fseek(fd, 0, SEEK_SET); 61 | buf = (char*)calloc(*siz, 1); 62 | fread(buf, *siz, 1, fd); 63 | fclose(fd); 64 | return buf; 65 | } 66 | #endif 67 | 68 | static char* 69 | str_duplicate(const char *src) 70 | { 71 | char *ret; 72 | size_t len = strlen(src); 73 | if (!len) return 0; 74 | ret = (char*)malloc(len+1); 75 | if (!ret) return 0; 76 | memcpy(ret, src, len); 77 | ret[len] = '\0'; 78 | return ret; 79 | } 80 | 81 | static void 82 | dir_free_list(char **list, size_t size) 83 | { 84 | size_t i; 85 | for (i = 0; i < size; ++i) 86 | free(list[i]); 87 | free(list); 88 | } 89 | 90 | static char** 91 | dir_list(const char *dir, int return_subdirs, size_t *count) 92 | { 93 | size_t n = 0; 94 | char buffer[MAX_PATH_LEN]; 95 | char **results = NULL; 96 | size_t capacity = 32; 97 | size_t size; 98 | struct RDIR *zh = NULL; 99 | 100 | assert(dir); 101 | assert(count); 102 | strncpy(buffer, dir, MAX_PATH_LEN); 103 | n = strlen(buffer); 104 | 105 | if (n > 0 && (buffer[n-1] != '/')) 106 | buffer[n++] = '/'; 107 | 108 | size = 0; 109 | 110 | zh = retro_opendir(dir); 111 | if (zh != NULL) { 112 | int nonempty = 1; 113 | nonempty = retro_readdir(zh); 114 | if (!nonempty) return NULL; 115 | 116 | do { 117 | char *p; 118 | int is_subdir = 0; 119 | const char *name = NULL; 120 | name = retro_dirent_get_name(zh); 121 | if (name[0] == '.') 122 | continue; 123 | 124 | is_subdir = retro_dirent_is_dir(zh, NULL); 125 | 126 | if ((return_subdirs && is_subdir) || (!is_subdir && !return_subdirs)){ 127 | if (!size) { 128 | results = (char**)calloc(sizeof(char*), capacity); 129 | } else if (size >= capacity) { 130 | void *old = results; 131 | capacity = capacity * 2; 132 | results = (char**)realloc(results, capacity * sizeof(char*)); 133 | assert(results); 134 | if (!results) free(old); 135 | } 136 | p = str_duplicate(name); 137 | results[size++] = p; 138 | } 139 | } while (zh != NULL && retro_readdir(zh)); 140 | } 141 | retro_closedir(zh); 142 | *count = size; 143 | return results; 144 | } 145 | 146 | static void 147 | file_browser_reload_directory_content(struct file_browser *browser, const char *path) 148 | { 149 | strncpy(browser->directory, path, MAX_PATH_LEN); 150 | dir_free_list(browser->files, browser->file_count); 151 | dir_free_list(browser->directories, browser->dir_count); 152 | browser->files = dir_list(path, 0, &browser->file_count); 153 | browser->directories = dir_list(path, 1, &browser->dir_count); 154 | } 155 | 156 | static void 157 | file_browser_init(struct file_browser *browser) 158 | { 159 | memset(browser, 0, sizeof(*browser)); 160 | 161 | { 162 | /* load files and sub-directory list */ 163 | const char *home = getenv("HOME"); 164 | #if defined(PS2) || defined(_3DS) || defined(SWITCH) // TODO: Fix directory 165 | if (!home) home = "/"; 166 | #elif defined(GEKKO) 167 | if (!home) home = "/sd:"; 168 | #elif defined(VITA) 169 | if (!home) home = "/ux0:"; 170 | #elif defined(_WIN32) 171 | if (!home) home = getenv("USERPROFILE"); 172 | #else 173 | if (!home) home = getpwuid(getuid())->pw_dir; 174 | { 175 | size_t l; 176 | strncpy(browser->home, home, MAX_PATH_LEN); 177 | l = strlen(browser->home); 178 | strcpy(browser->home + l, "/"); 179 | strcpy(browser->directory, browser->home); 180 | 181 | } 182 | #endif 183 | { 184 | size_t l; 185 | strcpy(browser->desktop, browser->home); 186 | l = strlen(browser->desktop); 187 | strcpy(browser->desktop + l, "Desktop/"); 188 | } 189 | browser->files = dir_list(browser->directory, 0, &browser->file_count); 190 | browser->directories = dir_list(browser->directory, 1, &browser->dir_count); 191 | } 192 | } 193 | 194 | static void 195 | file_browser_free(struct file_browser *browser) 196 | { 197 | if (browser->files) 198 | dir_free_list(browser->files, browser->file_count); 199 | if (browser->directories) 200 | dir_free_list(browser->directories, browser->dir_count); 201 | browser->files = NULL; 202 | browser->directories = NULL; 203 | memset(browser, 0, sizeof(*browser)); 204 | } 205 | 206 | void filebrowser_init() 207 | { 208 | 209 | file_browser_init(&browser); 210 | } 211 | 212 | void filebrowser_free() 213 | { 214 | 215 | file_browser_free(&browser); 216 | 217 | } 218 | 219 | -------------------------------------------------------------------------------- /libretro/nukleargui/filebrowser.i: -------------------------------------------------------------------------------- 1 | 2 | static float ratio[] = {0.25f, NK_UNDEFINED}; 3 | float spacing_x = ctx->style.window.spacing.x; 4 | 5 | /* output path directory selector in the menubar */ 6 | ctx->style.window.spacing.x = 0; 7 | nk_menubar_begin(ctx); 8 | { 9 | char *d = browser->directory; 10 | char *begin = d + 1; 11 | nk_layout_row_dynamic(ctx, 16, 6); 12 | 13 | while (*d++) { 14 | if (*d == '/') { 15 | *d = '\0'; 16 | if (nk_button_label(ctx, begin)) { 17 | *d++ = '/'; *d = '\0'; 18 | file_browser_reload_directory_content(browser, browser->directory); 19 | break; 20 | } 21 | *d = '/'; 22 | begin = d + 1; 23 | } 24 | } 25 | } 26 | nk_menubar_end(ctx); 27 | ctx->style.window.spacing.x = spacing_x; 28 | 29 | /* window layout */ 30 | total_space = nk_window_get_content_region(ctx); 31 | nk_layout_row(ctx, NK_DYNAMIC, total_space.h, 2, ratio); 32 | nk_group_begin(ctx,"Special", NK_WINDOW_NO_SCROLLBAR); 33 | { 34 | 35 | nk_layout_row_dynamic(ctx, 16, 1); 36 | if (nk_button_label(ctx, "Home")) 37 | file_browser_reload_directory_content(browser, browser->home); 38 | if (nk_button_label(ctx,"Desktop")) 39 | file_browser_reload_directory_content(browser, browser->desktop); 40 | if (nk_button_label(ctx,"/")) 41 | file_browser_reload_directory_content(browser, "/"); 42 | if (nk_button_label(ctx,"Cancel")) 43 | LOADCONTENT=-1; 44 | nk_group_end(ctx); 45 | } 46 | 47 | /* output directory content window */ 48 | nk_group_begin(ctx, "Content", 0); 49 | { 50 | int index = -1; 51 | size_t i = 0, j = 0, k = 0; 52 | size_t rows = 0, cols = 0; 53 | size_t count = browser->dir_count + browser->file_count; 54 | 55 | cols = 1; 56 | rows = count / cols; 57 | for (i = 0; i <= rows; i += 1) { 58 | 59 | {size_t n = j + cols; 60 | nk_layout_row_dynamic(ctx, 16, (int)cols); 61 | for (; j < count && j < n; ++j) { 62 | /* draw one row of icons */ 63 | if (j < browser->dir_count) { 64 | /* draw and execute directory buttons */ 65 | if (nk_button_label(ctx,browser->directories[j])) 66 | index = (int)j; 67 | } else { 68 | /* draw and execute files buttons */ 69 | 70 | size_t fileIndex = ((size_t)j - browser->dir_count); 71 | 72 | if (nk_button_label(ctx, browser->files[fileIndex])) { 73 | strncpy(browser->file, browser->directory, MAX_PATH_LEN); 74 | n = strlen(browser->file); 75 | strncpy(browser->file + n, browser->files[fileIndex], MAX_PATH_LEN - n); 76 | //ret = 1; 77 | sprintf(LCONTENT,"%s",browser->file); 78 | LOADCONTENT=2; 79 | } 80 | } 81 | }} 82 | 83 | } 84 | 85 | if (index != -1) { 86 | size_t n = strlen(browser->directory); 87 | strncpy(browser->directory + n, browser->directories[index], MAX_PATH_LEN - n); 88 | n = strlen(browser->directory); 89 | if (n < MAX_PATH_LEN - 1) { 90 | browser->directory[n] = '/'; 91 | browser->directory[n+1] = '\0'; 92 | } 93 | file_browser_reload_directory_content(browser, browser->directory); 94 | 95 | } 96 | nk_group_end(ctx); 97 | } 98 | 99 | 100 | -------------------------------------------------------------------------------- /libretro/nukleargui/gui.i: -------------------------------------------------------------------------------- 1 | /* nuklear - v1.00 - public domain */ 2 | 3 | //floppy option 4 | static char DF8NAME[512]="Choose Content\0"; 5 | static char DF9NAME[512]="Choose Content\0"; 6 | 7 | #define GET_DRIVE(code) ((code)&0x0F) 8 | #define NUMB(a) (sizeof(a) / sizeof(*a)) 9 | #define GUIRECT nk_rect(5,25, 364+10, 222) //nk_rect(10,30, 364, 212) 10 | 11 | typedef enum 12 | { 13 | GUI_NONE = 0, 14 | GUI_BROWSE , 15 | GUI_VKBD , 16 | GUI_MAIN , 17 | 18 | } GUI_ACTION; 19 | 20 | int GUISTATE=GUI_NONE; 21 | 22 | extern int pauseg; 23 | extern int NPAGE,SHIFTON; 24 | extern int vkey_pressed; 25 | extern int minivmac_statusbar; 26 | extern unsigned int cur_port; 27 | 28 | extern char DISKA_NAME[512]; 29 | extern char DISKB_NAME[512]; 30 | extern char TAPE_NAME[512]; 31 | 32 | extern void emu_reset(void); 33 | extern int HandleExtension(char *path,char *ext); 34 | extern void set_drive_type(int drive,int val); 35 | extern void retro_shutdown_core(void); 36 | 37 | static int 38 | gui(struct file_browser *browser,struct nk_context *ctx) 39 | { 40 | struct nk_rect total_space; 41 | 42 | /* window flags */ 43 | static int border = nk_true; 44 | static int resize = nk_true; 45 | static int movable = nk_true; 46 | static int no_scrollbar = nk_false; 47 | static nk_flags window_flags = 0; 48 | static int minimizable = nk_false; 49 | static int title = nk_true; 50 | int tmpval; 51 | 52 | /* window flags */ 53 | window_flags = 0; 54 | 55 | if (border) window_flags |= NK_WINDOW_BORDER; 56 | if (resize) window_flags |= NK_WINDOW_SCALABLE; 57 | if (movable) window_flags |= NK_WINDOW_MOVABLE; 58 | if (no_scrollbar || (pauseg==1 && LOADCONTENT==1) ) window_flags |= NK_WINDOW_NO_SCROLLBAR; 59 | if (minimizable) window_flags |= NK_WINDOW_MINIMIZABLE; 60 | if (title) window_flags |= NK_WINDOW_TITLE; 61 | 62 | if(pauseg==1 && SHOWKEY==1)SHOWKEY=-1; 63 | if(pauseg==0 && SHOWKEY==1)GUISTATE=GUI_VKBD; 64 | if(pauseg==1 && SHOWKEY==-1 && LOADCONTENT==1)GUISTATE=GUI_BROWSE; 65 | if(pauseg==1 && SHOWKEY==-1 && LOADCONTENT!=1)GUISTATE=GUI_MAIN; 66 | 67 | switch(GUISTATE){ 68 | 69 | case GUI_VKBD: 70 | 71 | if (nk_begin(ctx,"Minivmac keyboard", GUIRECT, window_flags)){ 72 | #include "vkboard.i" 73 | nk_end(ctx); 74 | } 75 | break; 76 | 77 | case GUI_BROWSE: 78 | 79 | if (nk_begin(ctx,"File Select", GUIRECT,NK_WINDOW_TITLE| NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_MOVABLE)){ 80 | #include "filebrowser.i" 81 | nk_end(ctx); 82 | } 83 | break; 84 | 85 | case GUI_MAIN: 86 | 87 | if (nk_begin(ctx,"Minivmac GUI", GUIRECT, window_flags)){ 88 | #include "c64menu.i" 89 | nk_end(ctx); 90 | } 91 | break; 92 | 93 | default: 94 | break; 95 | 96 | } 97 | 98 | if(pauseg==1 && SHOWKEY==1)SHOWKEY=-1; 99 | if(pauseg==0 && SHOWKEY==1)GUISTATE=GUI_VKBD; 100 | if(pauseg==1 && SHOWKEY==-1 && LOADCONTENT==1)GUISTATE=GUI_BROWSE; 101 | if(pauseg==1 && SHOWKEY==-1 && LOADCONTENT!=1)GUISTATE=GUI_MAIN; 102 | 103 | return GUISTATE; 104 | } 105 | 106 | -------------------------------------------------------------------------------- /libretro/nukleargui/nuklear/Readme.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/vurtun/nuklear.svg)](https://travis-ci.org/vurtun/nuklear) 2 | 3 | # Nuklear 4 | This is a minimal state immediate mode graphical user interface toolkit 5 | written in ANSI C and licensed under public domain. It was designed as a simple 6 | embeddable user interface for application and does not have any dependencies, 7 | a default renderbackend or OS window and input handling but instead provides a very modular 8 | library approach by using simple input state for input and draw 9 | commands describing primitive shapes as output. So instead of providing a 10 | layered library that tries to abstract over a number of platform and 11 | render backends it only focuses on the actual UI. 12 | 13 | ## Features 14 | - Immediate mode graphical user interface toolkit 15 | - Single header library 16 | - Written in C89 (ANSI C) 17 | - Small codebase (~15kLOC) 18 | - Focus on portability, efficiency and simplicity 19 | - No dependencies (not even the standard library if not wanted) 20 | - Fully skinnable and customizable 21 | - Low memory footprint with total memory control if needed or wanted 22 | - UTF-8 support 23 | - No global or hidden state 24 | - Customizable library modules (you can compile and use only what you need) 25 | - Optional font baker and vertex buffer output 26 | 27 | ## Building 28 | This library is self contained in one single header file and can be used either 29 | in header only mode or in implementation mode. The header only mode is used 30 | by default when included and allows including this header in other headers 31 | and does not contain the actual implementation. 32 | 33 | The implementation mode requires to define the preprocessor macro 34 | `NK_IMPLEMENTATION` in *one* .c/.cpp file before `#include`ing this file, e.g.: 35 | ```c 36 | #define NK_IMPLEMENTATION 37 | #include "nuklear.h" 38 | ``` 39 | IMPORTANT: Every time you include "nuklear.h" you have to define the same optional flags. 40 | This is very important not doing it either leads to compiler errors or even worse stack corruptions. 41 | 42 | ## Gallery 43 | ![screenshot](https://cloud.githubusercontent.com/assets/8057201/11761525/ae06f0ca-a0c6-11e5-819d-5610b25f6ef4.gif) 44 | ![screen](https://cloud.githubusercontent.com/assets/8057201/13538240/acd96876-e249-11e5-9547-5ac0b19667a0.png) 45 | ![screen2](https://cloud.githubusercontent.com/assets/8057201/13538243/b04acd4c-e249-11e5-8fd2-ad7744a5b446.png) 46 | ![node](https://cloud.githubusercontent.com/assets/8057201/9976995/e81ac04a-5ef7-11e5-872b-acd54fbeee03.gif) 47 | ![skinning](https://cloud.githubusercontent.com/assets/8057201/15991632/76494854-30b8-11e6-9555-a69840d0d50b.png) 48 | ![gamepad](https://cloud.githubusercontent.com/assets/8057201/14902576/339926a8-0d9c-11e6-9fee-a8b73af04473.png) 49 | 50 | ## Example 51 | ```c 52 | /* init gui state */ 53 | struct nk_context ctx; 54 | nk_init_fixed(&ctx, calloc(1, MAX_MEMORY), MAX_MEMORY, &font); 55 | 56 | enum {EASY, HARD}; 57 | int op = EASY; 58 | float value = 0.6f; 59 | int i = 20; 60 | 61 | if (nk_begin(&ctx, "Show", nk_rect(50, 50, 220, 220), 62 | NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_CLOSABLE)) { 63 | /* fixed widget pixel width */ 64 | nk_layout_row_static(&ctx, 30, 80, 1); 65 | if (nk_button_label(&ctx, "button")) { 66 | /* event handling */ 67 | } 68 | 69 | /* fixed widget window ratio width */ 70 | nk_layout_row_dynamic(&ctx, 30, 2); 71 | if (nk_option_label(&ctx, "easy", op == EASY)) op = EASY; 72 | if (nk_option_label(&ctx, "hard", op == HARD)) op = HARD; 73 | 74 | /* custom widget pixel width */ 75 | nk_layout_row_begin(&ctx, NK_STATIC, 30, 2); 76 | { 77 | nk_layout_row_push(&ctx, 50); 78 | nk_label(&ctx, "Volume:", NK_TEXT_LEFT); 79 | nk_layout_row_push(&ctx, 110); 80 | nk_slider_float(&ctx, 0, &value, 1.0f, 0.1f); 81 | } 82 | nk_layout_row_end(&ctx); 83 | } 84 | nk_end(&ctx); 85 | ``` 86 | ![example](https://cloud.githubusercontent.com/assets/8057201/10187981/584ecd68-675c-11e5-897c-822ef534a876.png) 87 | 88 | ## Bindings: 89 | Java: https://github.com/glegris/nuklear4j 90 | Golang: https://github.com/golang-ui/nuklear 91 | Rust: https://github.com/snuk182/nuklear-rust 92 | Chicken: https://github.com/wasamasa/nuklear 93 | 94 | ## Credits: 95 | Developed by Micha Mettke and every direct or indirect contributor to the GitHub. 96 | 97 | 98 | Embeds `stb_texedit`, `stb_truetype` and `stb_rectpack` by Sean Barret (public domain) 99 | Embeds `ProggyClean.ttf` font by Tristan Grimmer (MIT license). 100 | 101 | 102 | Big thank you to Omar Cornut (ocornut@github) for his [imgui](https://github.com/ocornut/imgui) library and 103 | giving me the inspiration for this library, Casey Muratori for handmade hero 104 | and his original immediate mode graphical user interface idea and Sean 105 | Barret for his amazing single header [libraries](https://github.com/nothings/stb) which restored my faith 106 | in libraries and brought me to create some of my own. 107 | 108 | ## License: 109 | This software is dual-licensed to the public domain and under the following 110 | license: you are granted a perpetual, irrevocable license to copy, modify, 111 | publish and distribute this file as you see fit. 112 | 113 | -------------------------------------------------------------------------------- /libretro/nukleargui/nuklear/calculator.c: -------------------------------------------------------------------------------- 1 | /* nuklear - v1.00 - public domain */ 2 | static void 3 | calculator(struct nk_context *ctx) 4 | { 5 | if (nk_begin(ctx, "Calculator", nk_rect(10, 10, 180, 250), 6 | NK_WINDOW_BORDER|NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_MOVABLE)) 7 | { 8 | static int set = 0, prev = 0, op = 0; 9 | static const char numbers[] = "789456123"; 10 | static const char ops[] = "+-*/"; 11 | static double a = 0, b = 0; 12 | static double *current = &a; 13 | 14 | size_t i = 0; 15 | int solve = 0; 16 | {int len; char buffer[256]; 17 | nk_layout_row_dynamic(ctx, 35, 1); 18 | len = snprintf(buffer, 256, "%.2f", *current); 19 | nk_edit_string(ctx, NK_EDIT_SIMPLE, buffer, &len, 255, nk_filter_float); 20 | buffer[len] = 0; 21 | *current = atof(buffer);} 22 | 23 | nk_layout_row_dynamic(ctx, 35, 4); 24 | for (i = 0; i < 16; ++i) { 25 | if (i >= 12 && i < 15) { 26 | if (i > 12) continue; 27 | if (nk_button_label(ctx, "C")) { 28 | a = b = op = 0; current = &a; set = 0; 29 | } if (nk_button_label(ctx, "0")) { 30 | *current = *current*10.0f; set = 0; 31 | } if (nk_button_label(ctx, "=")) { 32 | solve = 1; prev = op; op = 0; 33 | } 34 | } else if (((i+1) % 4)) { 35 | if (nk_button_text(ctx, &numbers[(i/4)*3+i%4], 1)) { 36 | *current = *current * 10.0f + numbers[(i/4)*3+i%4] - '0'; 37 | set = 0; 38 | } 39 | } else if (nk_button_text(ctx, &ops[i/4], 1)) { 40 | if (!set) { 41 | if (current != &b) { 42 | current = &b; 43 | } else { 44 | prev = op; 45 | solve = 1; 46 | } 47 | } 48 | op = ops[i/4]; 49 | set = 1; 50 | } 51 | } 52 | if (solve) { 53 | if (prev == '+') a = a + b; 54 | if (prev == '-') a = a - b; 55 | if (prev == '*') a = a * b; 56 | if (prev == '/') a = a / b; 57 | current = &a; 58 | if (set) current = &b; 59 | b = 0; set = 0; 60 | } 61 | } 62 | nk_end(ctx); 63 | } 64 | 65 | -------------------------------------------------------------------------------- /libretro/nukleargui/retro/RSDL_wrapper.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef NUKLEAR_RSDL_H 3 | #define NUKLEAR_RSDL_H 4 | 5 | #include "libretro-core.h" 6 | 7 | //RETRO HACK 8 | //#warning just an SDL wrapper for use SDL surface/maprgba in the core. 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | /* The number of elements in a table */ 15 | #define RSDL_TABLESIZE(table) (sizeof(table)/sizeof(table[0])) 16 | 17 | /* General keyboard/mouse state definitions */ 18 | enum { RSDL_PRESSED = 0x01, RSDL_RELEASED = 0x00 }; 19 | 20 | 21 | typedef struct{ 22 | Sint16 x, y; 23 | Uint16 w, h; 24 | } RSDL_Rect; 25 | 26 | 27 | typedef struct RSDL_Color 28 | { 29 | Uint8 r; 30 | Uint8 g; 31 | Uint8 b; 32 | Uint8 a; 33 | } RSDL_Color; 34 | 35 | #define RSDL_Colour RSDL_Color 36 | typedef struct RSDL_Palette 37 | { 38 | int ncolors; 39 | RSDL_Color *colors; 40 | Uint32 version; 41 | int refcount; 42 | } RSDL_Palette; 43 | 44 | typedef struct { 45 | RSDL_Palette *palette; 46 | Uint8 BitsPerPixel; 47 | Uint8 BytesPerPixel; 48 | Uint8 Rloss, Gloss, Bloss, Aloss; 49 | Uint8 Rshift, Gshift, Bshift, Ashift; 50 | Uint32 Rmask, Gmask, Bmask, Amask; 51 | Uint32 colorkey; 52 | Uint8 alpha; 53 | } RSDL_PixelFormat; 54 | 55 | typedef struct RSDL_Surface { 56 | Uint32 flags; /* Read-only */ 57 | RSDL_PixelFormat *format; /* Read-only */ 58 | int w, h; /* Read-only */ 59 | Uint16 pitch; /* Read-only */ 60 | void *pixels; /* Read-write */ 61 | 62 | /* clipping information */ 63 | RSDL_Rect clip_rect; /* Read-only */ 64 | 65 | /* Reference count -- used when freeing surface */ 66 | int refcount; /* Read-mostly */ 67 | 68 | /* This structure also contains private fields not shown here */ 69 | } RSDL_Surface; 70 | 71 | 72 | static INLINE unsigned short RSDL_Swap16(unsigned short x){ 73 | unsigned short result= ((x<<8)|(x>>8)); 74 | return result; 75 | } 76 | static INLINE unsigned RSDL_Swap32(unsigned x){ 77 | unsigned result= ((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24)); 78 | return result; 79 | } 80 | 81 | 82 | #ifdef MSB_FIRST 83 | #define RSDL_SwapLE16(X) RSDL_Swap16(X) 84 | #define RSDL_SwapLE32(X) RSDL_Swap32(X) 85 | 86 | #define RSDL_SwapBE16(X) (X) 87 | #define RSDL_SwapBE32(X) (X) 88 | #else 89 | #define RSDL_SwapLE16(X) (X) 90 | #define RSDL_SwapLE32(X) (X) 91 | 92 | #define RSDL_SwapBE16(X) RSDL_Swap16(X) 93 | #define RSDL_SwapBE32(X) RSDL_Swap32(X) 94 | 95 | #endif 96 | 97 | #define RSDL_LIL_ENDIAN 1234 98 | #define RSDL_BIG_ENDIAN 4321 99 | 100 | #ifdef MSB_FIRST 101 | #define RSDL_BYTEORDER RSDL_BIG_ENDIAN 102 | #else 103 | #define RSDL_BYTEORDER RSDL_LIL_ENDIAN 104 | #endif 105 | 106 | #ifdef __cplusplus 107 | typedef bool RSDL_bool; 108 | #define RSDL_FALSE false 109 | #define RSDL_TRUE true 110 | #else 111 | typedef enum { 112 | RSDL_FALSE = 0, 113 | RSDL_TRUE = 1 114 | } RSDL_bool; 115 | #endif 116 | 117 | #define RSDL_MUSTLOCK(a) 0 118 | #define RSDL_LockSurface(a) 0 119 | #define RSDL_UnlockSurface(a) 120 | #define RSDL_MapRGB(fmt, r, g, b) Retro_MapRGB(fmt, r, g, b) 121 | #define RSDL_MapRGBA(fmt, r, g, b,a) Retro_MapRGBA(fmt, r, g, b,a) 122 | 123 | extern void draw_cross(RSDL_Surface *surface,int x,int y); 124 | extern void RSDL_GetClipRect(RSDL_Surface *surface, RSDL_Rect *rect); 125 | extern RSDL_bool RSDL_SetClipRect(RSDL_Surface *surface, const RSDL_Rect *rect); 126 | #ifdef M16B 127 | extern void Retro_Draw_char(RSDL_Surface *surface, signed short int x, signed short int y, char string,unsigned short xscale, unsigned short yscale, unsigned short fg, unsigned short bg); 128 | #else 129 | extern void Retro_Draw_char(RSDL_Surface *surface, signed short int x, signed short int y, char string,unsigned short xscale, unsigned short yscale, unsigned fg, unsigned bg); 130 | #endif 131 | //extern void Retro_Draw_char(RSDL_Surface *surface, signed short int x, signed short int y, char string,unsigned short xscale, unsigned short yscale, unsigned fg, unsigned bg); 132 | extern void Retro_FreeSurface(RSDL_Surface *surf ); 133 | extern RSDL_Surface *Retro_CreateRGBSurface32( int w,int h, int d, int rm,int rg,int rb,int ra); 134 | extern RSDL_Surface *Retro_CreateRGBSurface16( int w,int h, int d, int rm,int rg,int rb,int ra); 135 | extern unsigned int Retro_MapRGB(RSDL_PixelFormat *a, int r, int g, int b); 136 | extern unsigned int Retro_MapRGBA(RSDL_PixelFormat *a, int r, int g, int b,int alpha); 137 | #endif 138 | -------------------------------------------------------------------------------- /libretro/nukleargui/vkboard.i: -------------------------------------------------------------------------------- 1 | 2 | int x = 0,y = 0; 3 | int page = (NPAGE == -1) ? 0 : NLIGN*NPLGN; 4 | 5 | nk_layout_row_dynamic(ctx, 32, NPLGN); 6 | 7 | vkey_pressed=-1; 8 | 9 | for(y=0;y" ,0x2F}, 94 | { " /"," ?" ,0x2C}, 95 | { " |" ," ^" ,54}, 96 | { " Num"," Num",69}, 97 | { " /" ," /" ,0x4B}, 98 | { " *" ," *" ,0x43}, 99 | { " -" ," -" ,0x4E}, 100 | { " Hme" ," 7",0x73}, 101 | { " ^"," Y" ,72}, 102 | 103 | { " PgU"," U" ,0x74},//90 104 | { " +"," I" ,0x18}, 105 | { " 4","Lft" ,0x56}, 106 | { " 5" ," 5" ,0x57}, 107 | { " 6" ,"Rgt" ,0x58}, 108 | { " 1" ,"End" ,0x53}, 109 | { "Njoy","Njoy",-5}, 110 | { "Col" ,"Col",-3}, 111 | { "Ent" ,"Ent",28}, 112 | { "Kbd" ,"Kbd",-4}, 113 | 114 | } ; 115 | 116 | 117 | -------------------------------------------------------------------------------- /link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: retro_*; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /minivmac/README.txt: -------------------------------------------------------------------------------- 1 | MnvM_b36: README 2 | Paul C. Pratt 3 | www.gryphel.com 4 | July 27, 2005 5 | 6 | 7 | MnvM_b36 is the build system for Mini vMac, 8 | a miniature Macintosh emulator. 9 | 10 | Further information may be found at 11 | "https://www.gryphel.com/c/minivmac/". 12 | 13 | 14 | You can redistribute MnvM_b36 and/or modify it under the terms 15 | of version 2 of the GNU General Public License as published by 16 | the Free Software Foundation. See the included file COPYING. 17 | 18 | MnvM_b36 is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | license for more details. 22 | -------------------------------------------------------------------------------- /minivmac/cfg/CNFGGLOB.h: -------------------------------------------------------------------------------- 1 | /* 2 | Configuration options used by both platform specific 3 | and platform independent code. 4 | 5 | This file is automatically generated by the build system, 6 | which tries to know what options are valid in what 7 | combinations. Avoid changing this file manually unless 8 | you know what you're doing. 9 | */ 10 | 11 | /* adapt to current compiler/host processor */ 12 | #include 13 | 14 | #ifdef _MSC_VER 15 | #define MayInline INLINE 16 | #define MayNotInline 17 | #else 18 | #define MayInline inline __attribute__((always_inline)) 19 | #define MayNotInline __attribute__((noinline)) 20 | #endif 21 | #define SmallGlobals 0 22 | #define cIncludeUnused 0 23 | #define UnusedParam(p) (void) p 24 | 25 | /* --- integer types ---- */ 26 | 27 | typedef unsigned char ui3b; 28 | #define HaveRealui3b 1 29 | 30 | typedef signed char si3b; 31 | #define HaveRealsi3b 1 32 | 33 | typedef unsigned short ui4b; 34 | #define HaveRealui4b 1 35 | 36 | typedef short si4b; 37 | #define HaveRealsi4b 1 38 | 39 | typedef unsigned int ui5b; 40 | #define HaveRealui5b 1 41 | 42 | typedef int si5b; 43 | #define HaveRealsi5b 1 44 | 45 | #define HaveRealui6b 0 46 | #define HaveRealsi6b 0 47 | 48 | /* --- integer representation types ---- */ 49 | 50 | typedef ui3b ui3r; 51 | #define ui3beqr 1 52 | 53 | typedef si3b si3r; 54 | #define si3beqr 1 55 | 56 | typedef ui4b ui4r; 57 | #define ui4beqr 1 58 | 59 | typedef si4b si4r; 60 | #define si4beqr 1 61 | 62 | typedef ui5b ui5r; 63 | #define ui5beqr 1 64 | 65 | typedef si5b si5r; 66 | #define si5beqr 1 67 | 68 | typedef signed long long si6r; 69 | typedef signed long long si6b; 70 | typedef unsigned long long ui6r; 71 | typedef unsigned long long ui6b; 72 | #define LIT64(a) a##ULL 73 | 74 | /* capabilities provided by platform specific code */ 75 | 76 | #define MySoundEnabled 1 77 | 78 | #define MySoundRecenterSilence 0 79 | #define kLn2SoundSampSz 3 80 | 81 | #define dbglog_HAVE 0 82 | #define WantAbnormalReports 0 83 | 84 | #define NumDrives 6 85 | #define IncludeSonyRawMode 1 86 | #define IncludeSonyGetName 1 87 | #define IncludeSonyNew 1 88 | #define IncludeSonyNameNew 1 89 | 90 | #define vMacScreenHeight 480 91 | #define vMacScreenWidth 640 92 | #define vMacScreenDepth 3 93 | 94 | #define kROM_Size 0x00040000 95 | 96 | #define IncludePbufs 1 97 | #define NumPbufs 4 98 | 99 | #define EnableMouseMotion 1 100 | 101 | #define IncludeHostTextClipExchange 1 102 | #define EnableAutoSlow 1 103 | #define EmLocalTalk 0 104 | #define AutoLocation 1 105 | #define AutoTimeZone 1 106 | -------------------------------------------------------------------------------- /minivmac/cfg/CNFGRAPI.h: -------------------------------------------------------------------------------- 1 | /* 2 | Configuration options used by platform specific code. 3 | 4 | This file is automatically generated by the build system, 5 | which tries to know what options are valid in what 6 | combinations. Avoid changing this file manually unless 7 | you know what you're doing. 8 | */ 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #ifndef __LIBRETRO__ 15 | #include 16 | #endif 17 | #include 18 | #include 19 | #include 20 | #ifdef _WIN32 21 | #include 22 | #else 23 | #include 24 | #endif 25 | 26 | #define CanGetAppPath 1 27 | #define HaveAppPathLink 1 28 | #define TheAppPathLink "/proc/self/exe" 29 | #define HaveSysctlPath 0 30 | 31 | 32 | #define RomFileName "MacII.ROM" 33 | #define kCheckSumRom_Size 0x00040000 34 | #define kRomCheckSum1 0x9779D2C4 35 | #define kRomCheckSum2 0x97221136 36 | #define RomStartCheckSum 1 37 | #define EnableDragDrop 1 38 | #define SaveDialogEnable 1 39 | #define EnableAltKeysMode 0 40 | #define MKC_formac_Control MKC_CM 41 | #define MKC_formac_Command MKC_Command 42 | #define MKC_formac_Option MKC_Option 43 | #define MKC_formac_Shift MKC_Shift 44 | #define MKC_formac_CapsLock MKC_CapsLock 45 | #define MKC_formac_Escape MKC_Escape 46 | #define MKC_formac_BackSlash MKC_BackSlash 47 | #define MKC_formac_Slash MKC_Slash 48 | #define MKC_formac_Grave MKC_Grave 49 | #define MKC_formac_Enter MKC_Enter 50 | #define MKC_formac_PageUp MKC_PageUp 51 | #define MKC_formac_PageDown MKC_PageDown 52 | #define MKC_formac_Home MKC_Home 53 | #define MKC_formac_End MKC_End 54 | #define MKC_formac_Help MKC_Help 55 | #define MKC_formac_ForwardDel MKC_ForwardDel 56 | #define MKC_formac_F1 MKC_Option 57 | #define MKC_formac_F2 MKC_Command 58 | #define MKC_formac_F3 MKC_F3 59 | #define MKC_formac_F4 MKC_F4 60 | #define MKC_formac_F5 MKC_F5 61 | #define MKC_formac_RControl MKC_CM 62 | #define MKC_formac_RCommand MKC_Command 63 | #define MKC_formac_ROption MKC_Option 64 | #define MKC_formac_RShift MKC_Shift 65 | #define MKC_UnMappedKey MKC_Control 66 | #define VarFullScreen 1 67 | #define WantInitFullScreen 0 68 | #define MayFullScreen 1 69 | #define MayNotFullScreen 1 70 | #define WantInitMagnify 0 71 | #define EnableMagnify 1 72 | #define MyWindowScale 2 73 | #define UseColorImage 1 74 | #define WantInitRunInBackground 0 75 | #define WantInitNotAutoSlow 1 76 | #define WantInitSpeedValue 2 77 | #define WantEnblCtrlInt 1 78 | #define WantEnblCtrlRst 1 79 | #define WantEnblCtrlKtg 1 80 | #define NeedRequestInsertDisk 0 81 | #define NeedDoMoreCommandsMsg 0 82 | #define NeedDoAboutMsg 0 83 | #define UseControlKeys 1 84 | #define UseActvCode 0 85 | #define EnableDemoMsg 0 86 | 87 | /* version and other info to display to user */ 88 | 89 | #define NeedIntlChars 0 90 | #define kStrAppName "Mini vMac" 91 | #define kAppVariationStr "minivmac-36.04-lx64" 92 | #define kStrCopyrightYear "2018" 93 | #define kMaintainerName "unknown" 94 | #define kStrHomePage "(unknown)" 95 | 96 | #define kBldOpts "-br 36 -t lx64 -m II -hres 960 -vres 540 -depth 5 -sss 4" 97 | -------------------------------------------------------------------------------- /minivmac/cfg/SOUNDGLU.h: -------------------------------------------------------------------------------- 1 | #include "SGLUALSA.h" 2 | -------------------------------------------------------------------------------- /minivmac/cfg/STRCONST.h: -------------------------------------------------------------------------------- 1 | #include "STRCNENG.h" 2 | -------------------------------------------------------------------------------- /minivmac/extras/mydriver/disk/README.txt: -------------------------------------------------------------------------------- 1 | Mini vMac: mydriver/README 2 | Paul C. Pratt 3 | www.gryphel.com 4 | February 23, 2002 5 | 6 | The mydriver folder contains source code 7 | for a replacement disk driver that is patched 8 | into the emulated rom. 9 | 10 | The compiled driver is already in ROMEMDEV.c 11 | (the initialization of sony_driver variable), 12 | so this source code is not needed for building 13 | Mini vMac. It is only needed if you want 14 | to change this driver. 15 | 16 | To compile the driver, use MPW commands 17 | such as: 18 | 19 | set srcdir hd4:Topaz:MinivMac:mydriver: 20 | asm -case on {srcdir}mydriver.a -o {srcdir}mydriver.a.o 21 | c {srcdir}mydriver.c -r -b -mbg off -opt full -o {srcdir}mydriver.c.o 22 | link {srcdir}mydriver.a.o {srcdir}mydriver.c.o -rt DRVR=128 -o {srcdir}mydriver 23 | 24 | Then you can use ResEdit to copy the hex data out 25 | of the DRVR 128 resource, format it a bit, and 26 | replace the initialization data of the variable 27 | sony_driver in the file ROMEMDEV.c 28 | 29 | (note: this is using the old c compiler, to use 30 | the current c compiler, use: 31 | SC {srcdir}mydriver.c -w 17 -proto strict -b -mbg off -opt all -o {srcdir}mydriver.c.o 32 | ) 33 | -------------------------------------------------------------------------------- /minivmac/extras/trans.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/libretro-minivmac/2eb65cd5ca80174435867d2453d702390e5aab45/minivmac/extras/trans.txt -------------------------------------------------------------------------------- /minivmac/setup/BLDUTIL4.i: -------------------------------------------------------------------------------- 1 | /* 2 | BLDUTIL4.i 3 | Copyright (C) 2009 Paul C. Pratt 4 | 5 | You can redistribute this file and/or modify it under the terms 6 | of version 2 of the GNU General Public License as published by 7 | the Free Software Foundation. You should have received a copy 8 | of the license along with this file; see the file COPYING. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | license for more details. 14 | */ 15 | 16 | /* 17 | BuiLD system UTILities part 4 18 | */ 19 | 20 | LOCALPROC WriteOutDummyContents(void) 21 | { 22 | WriteDestFileLn( 23 | "This file is here because some archive extraction"); 24 | WriteDestFileLn("software will not create an empty directory."); 25 | } 26 | 27 | LOCALPROC WriteMakeOutputDirectories(void) 28 | { 29 | if ((gbk_ide_xcd == cur_ide) && (! UseCmndLine)) { 30 | } else 31 | if (gbk_ide_mw8 == cur_ide) { 32 | } else { 33 | WriteSectionCommentDestFile("make output directory"); 34 | 35 | MakeSubDirectory("my_obj_d", "my_project_d", obj_d_name, ""); 36 | 37 | WriteADstFile1("my_obj_d", 38 | "dummy", ".txt", "Dummy", 39 | WriteOutDummyContents); 40 | } 41 | } 42 | 43 | LOCALPROC WriteIdeSpecificFiles(void) 44 | { 45 | #if gbk_ide_mpw == cur_ide 46 | WriteMPWSpecificFiles(); 47 | #endif 48 | 49 | #if gbk_ide_mvc == cur_ide 50 | WriteMVCSpecificFiles(); 51 | #endif 52 | 53 | #if (gbk_ide_bgc == cur_ide) \ 54 | || (gbk_ide_cyg == cur_ide) \ 55 | || (gbk_ide_mgw == cur_ide) \ 56 | || (gbk_ide_dkp == cur_ide) 57 | WriteBashGccSpecificFiles(); 58 | #endif 59 | 60 | #if gbk_ide_mw8 == cur_ide 61 | WriteMetrowerksSpecificFiles(); 62 | #endif 63 | 64 | #if gbk_ide_snc == cur_ide 65 | WriteSncSpecificFiles(); 66 | #endif 67 | 68 | #if gbk_ide_msv == cur_ide 69 | WriteMsvSpecificFiles(); 70 | #endif 71 | 72 | #if gbk_ide_lcc == cur_ide 73 | if (UseCmndLine) { 74 | WriteLccW32clSpecificFiles(); 75 | } else { 76 | WriteLccW32SpecificFiles(); 77 | } 78 | #endif 79 | 80 | #if gbk_ide_dvc == cur_ide 81 | if (UseCmndLine) { 82 | WriteBashGccSpecificFiles(); 83 | } else { 84 | WriteDevCSpecificFiles(); 85 | } 86 | #endif 87 | 88 | #if gbk_ide_xcd == cur_ide 89 | if (UseCmndLine) { 90 | WriteBashGccSpecificFiles(); 91 | } else { 92 | WriteXCDSpecificFiles(); 93 | } 94 | #endif 95 | 96 | #if gbk_ide_dmc == cur_ide 97 | WriteDMCSpecificFiles(); 98 | #endif 99 | 100 | #if gbk_ide_plc == cur_ide 101 | if (UseCmndLine) { 102 | WritePLCclSpecificFiles(); 103 | } else { 104 | WritePLCSpecificFiles(); 105 | } 106 | #endif 107 | 108 | #if gbk_ide_ccc == cur_ide 109 | WriteCccSpecificFiles(); 110 | #endif 111 | } 112 | 113 | LOCALPROC ResetAllCommandLineParameters(void) 114 | { 115 | GNResetCommandLineParameters(); 116 | GNDevResetCommandLineParameters(); 117 | #ifdef Have_SPBLDOPT 118 | SPResetCommandLineParameters(); 119 | #endif 120 | olv_cur = 1; 121 | OnlyUserOptions = falseblnr; 122 | } 123 | 124 | LOCALFUNC tMyErr TryAsAtOptionNot(void) 125 | { 126 | tMyErr err; 127 | 128 | if (! CurArgIsCStr_v2("@")) { 129 | err = kMyErrNoMatch; 130 | } else 131 | if (OnlyUserOptions) { 132 | err = ReportParseFailure("Already have @"); 133 | } else 134 | if (kMyErr_noErr != (err = AdvanceTheArg())) { 135 | /* fail */ 136 | } else 137 | { 138 | OnlyUserOptions = trueblnr; 139 | err = kMyErr_noErr; 140 | } 141 | 142 | return err; 143 | } 144 | 145 | LOCALFUNC tMyErr TryAsXClmOptionNot(void) 146 | { 147 | tMyErr err; 148 | 149 | if (! CurArgIsCStr_v2("!")) { 150 | err = kMyErrNoMatch; 151 | } else 152 | if (kMyErr_noErr != (err = AdvanceTheArg())) { 153 | /* fail */ 154 | } else 155 | { 156 | err = kMyErr_noErr; 157 | ++olv_cur; 158 | } 159 | 160 | return err; 161 | } 162 | 163 | LOCALFUNC tMyErr ReportUnknownSwitch(void) 164 | { 165 | MyPStr t0; 166 | MyPStr t; 167 | 168 | GetCurArgAsPStr(t0); 169 | PStrFromCStr(t, "unknown switch : "); 170 | PStrAppend(t, t0); 171 | 172 | return ReportParseFailPStr(t); 173 | } 174 | 175 | LOCALFUNC tMyErr ProcessCommandLineArguments(void) 176 | { 177 | tMyErr err; 178 | 179 | err = kMyErr_noErr; 180 | while ((! The_arg_end) && (kMyErr_noErr == err)) { 181 | if (kMyErrNoMatch == (err = TryAsGNOptionNot())) 182 | if (kMyErrNoMatch == (err = TryAsGNDevOptionNot())) 183 | #ifdef Have_SPBLDOPT 184 | if (kMyErrNoMatch == (err = TryAsSPOptionNot())) 185 | #endif 186 | if (kMyErrNoMatch == (err = TryAsAtOptionNot())) 187 | if (kMyErrNoMatch == (err = TryAsXClmOptionNot())) 188 | { 189 | err = ReportUnknownSwitch(); 190 | } 191 | } 192 | 193 | return err; 194 | } 195 | 196 | LOCALPROC DoDocTypeAddToMainRC(void) 197 | { 198 | WriteBgnDestFileLn(); 199 | WriteUnsignedToOutput(256 + DocTypeCounter); 200 | WriteCStrToDestFile( 201 | " ICON DISCARDABLE "); 202 | WriteQuoteToDestFile(); 203 | WriteDocTypeIconFileName(); 204 | WriteQuoteToDestFile(); 205 | WriteEndDestFileLn(); 206 | } 207 | 208 | LOCALPROC WriteWinMainRCcontents(void) 209 | { 210 | DoAllDocTypesWithSetup(DoDocTypeAddToMainRC); 211 | } 212 | 213 | LOCALPROC WriteWinMainRC(void) 214 | { 215 | WriteADstFile1("my_config_d", 216 | "main", ".rc", "Resource Configuration file", 217 | WriteWinMainRCcontents); 218 | } 219 | 220 | LOCALPROC WriteConfigFiles(void) 221 | { 222 | WriteAppSpecificConfigFiles(); 223 | 224 | if (HaveMacRrscs) { 225 | WriteCommonCNFGRSRC(); 226 | } 227 | 228 | if (gbk_apifam_win == gbo_apifam) { 229 | WriteWinMainRC(); 230 | } 231 | } 232 | 233 | 234 | LOCALPROC MakeConfigFolder(void) 235 | { 236 | WriteSectionCommentDestFile("make configuration folder"); 237 | 238 | MakeSubDirectory("my_config_d", "my_project_d", cfg_d_name, ""); 239 | } 240 | 241 | #if WantWriteVarName 242 | LOCALPROC WriteAppVariationStr1(void) 243 | { 244 | WriteBgnDestFileLn(); 245 | WriteAppVariationStr(); 246 | WriteEndDestFileLn(); 247 | } 248 | #endif 249 | 250 | #if WantWriteBldOpts 251 | LOCALPROC WriteBldOpts1(void) 252 | { 253 | WriteBgnDestFileLn(); 254 | WriteBldOpts(); 255 | WriteEndDestFileLn(); 256 | } 257 | #endif 258 | 259 | LOCALFUNC tMyErr DoTheCommand(void) 260 | { 261 | tMyErr err; 262 | 263 | ResetAllCommandLineParameters(); 264 | 265 | if (kMyErr_noErr == (err = ProcessCommandLineArguments())) 266 | if (kMyErr_noErr == (err = AutoChooseGNSettings())) 267 | if (kMyErr_noErr == (err = AutoChooseGNDevSettings())) 268 | #ifdef Have_SPBLDOPT 269 | if (kMyErr_noErr == (err = AutoChooseSPSettings())) 270 | #endif 271 | { 272 | WriteScriptLangHeader(); 273 | 274 | WriteMakeOutputDirectories(); 275 | 276 | MakeConfigFolder(); 277 | 278 | WriteConfigFiles(); 279 | 280 | if (CurPrintCFiles) { 281 | WriteCFilesList(); 282 | } 283 | 284 | #if WantWriteVarName 285 | WriteADstFile1("my_project_d", 286 | "var_name", "", "variation name", 287 | WriteAppVariationStr1); 288 | #endif 289 | #if WantWriteBldOpts 290 | WriteADstFile1("my_project_d", 291 | "bld_opts", "", "build options", 292 | WriteBldOpts1); 293 | #endif 294 | 295 | WriteIdeSpecificFiles(); 296 | } 297 | 298 | return err; 299 | } 300 | -------------------------------------------------------------------------------- /minivmac/setup/CMDARGT1.i: -------------------------------------------------------------------------------- 1 | /* 2 | CMDARGT1.i 3 | Copyright (C) 2009 Paul C. Pratt 4 | 5 | You can redistribute this file and/or modify it under the terms 6 | of version 2 of the GNU General Public License as published by 7 | the Free Software Foundation. You should have received a copy 8 | of the license along with this file; see the file COPYING. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | license for more details. 14 | */ 15 | 16 | /* 17 | CoMmandD ARGument Tool part 1 18 | 19 | allows code used with CMDARGW1 to also be 20 | used to make an MPW tool. 21 | */ 22 | 23 | 24 | LOCALVAR int The_argc; 25 | LOCALVAR int The_argi; 26 | typedef char **The_argvt; 27 | LOCALVAR The_argvt The_argv; 28 | LOCALVAR char *Cur_args; 29 | LOCALVAR blnr The_arg_end; 30 | 31 | GLOBALFUNC tMyErr AdvanceTheArg(void) 32 | { 33 | ++The_argi; 34 | if (The_argi < The_argc) { 35 | Cur_args = The_argv[The_argi]; 36 | } else { 37 | The_arg_end = trueblnr; 38 | } 39 | 40 | return kMyErr_noErr; 41 | } 42 | 43 | GLOBALFUNC blnr CurArgIsCStr_v2(char *s) 44 | { 45 | /* warning : assumes (! The_arg_end) */ 46 | return CStrEq(Cur_args, s); 47 | } 48 | 49 | GLOBALFUNC tMyErr CurArgIsCStrAdvance_v2(char *s) 50 | { 51 | tMyErr err; 52 | 53 | /* warning : assumes (! The_arg_end) */ 54 | if (! CurArgIsCStr_v2(s)) { 55 | err = kMyErrNoMatch; 56 | } else { 57 | err = AdvanceTheArg(); 58 | } 59 | 60 | return err; 61 | } 62 | 63 | GLOBALPROC GetCurArgAsCStr(char *s, uimr MaxN) 64 | { 65 | /* warning : assumes (! The_arg_end) */ 66 | if (CStrLength(Cur_args) > MaxN) { 67 | s[0] = 0; 68 | } else { 69 | CStrCopy(s, Cur_args); 70 | } 71 | } 72 | 73 | GLOBALPROC GetCurArgAsPStr(ps3p s) 74 | { 75 | /* warning : assumes (! The_arg_end) */ 76 | PStrFromCStr(s, Cur_args); 77 | } 78 | 79 | GLOBALPROC BeginParseCommandLineArguments(int argc, The_argvt argv) 80 | { 81 | The_argi = 0; 82 | The_argc = argc; 83 | The_argv = argv; 84 | The_arg_end = falseblnr; 85 | (void) AdvanceTheArg(); 86 | } 87 | 88 | GLOBALFUNC tMyErr ReportParseFailure(char *s) 89 | { 90 | fprintf(stderr, "%s\n", s); 91 | 92 | return kMyErrReported; 93 | } 94 | 95 | GLOBALFUNC tMyErr ReportParseFailPStr(ps3p s) 96 | { 97 | char t[256]; 98 | 99 | CStrFromPStr(s, t); 100 | return ReportParseFailure(t); 101 | } 102 | -------------------------------------------------------------------------------- /minivmac/setup/CNFGDLFT.i: -------------------------------------------------------------------------------- 1 | /* 2 | CNFGDLFT.i 3 | Copyright (C) 2018 Paul C. Pratt 4 | 5 | You can redistribute this file and/or modify it under the terms 6 | of version 2 of the GNU General Public License as published by 7 | the Free Software Foundation. You should have received a copy 8 | of the license along with this file; see the file COPYING. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | license for more details. 14 | */ 15 | 16 | /* 17 | CoNFiGuration DeFauLTs 18 | 19 | set default values for things not set in CONFIGUR.i 20 | */ 21 | 22 | 23 | #ifndef kMaintainerName 24 | #define kMaintainerName "unknown" 25 | #endif 26 | 27 | 28 | #ifndef kStrHomePage 29 | #define kStrHomePage "(unknown)" 30 | #endif 31 | 32 | 33 | #ifndef cur_ide 34 | 35 | #ifdef applec 36 | #define cur_ide gbk_ide_mpw 37 | #else 38 | #define cur_ide gbk_ide_bgc 39 | #endif 40 | 41 | #endif /* cur_ide */ 42 | 43 | 44 | #ifndef ide_vers 45 | 46 | #if gbk_ide_xcd == cur_ide 47 | #define ide_vers 9410 48 | #elif gbk_ide_msv == cur_ide 49 | #define ide_vers 15000 50 | #else 51 | #define ide_vers 1 52 | #endif 53 | 54 | #endif /* ide_vers */ 55 | 56 | 57 | #ifndef UseCmndLine 58 | #define UseCmndLine 0 59 | #endif 60 | 61 | 62 | #ifndef NeedSegmenting 63 | 64 | #if gbk_ide_mpw == cur_ide 65 | #define NeedSegmenting 1 66 | #else 67 | #define NeedSegmenting 0 68 | #endif 69 | 70 | #endif /* NeedSegmenting */ 71 | 72 | 73 | #ifndef gbo_script 74 | 75 | #if gbk_ide_mpw == cur_ide 76 | #define gbo_script gbk_script_mpw 77 | #else 78 | #define gbo_script gbk_script_bash 79 | #endif 80 | 81 | #endif /* gbo_script */ 82 | 83 | 84 | #ifndef WantWriteVarName 85 | #define WantWriteVarName 0 86 | #endif 87 | 88 | 89 | #ifndef WantWriteBldOpts 90 | #define WantWriteBldOpts 0 91 | #endif 92 | -------------------------------------------------------------------------------- /minivmac/setup/CNFGOPTS.i: -------------------------------------------------------------------------------- 1 | /* 2 | CNFGOPTS.i 3 | Copyright (C) 2018 Paul C. Pratt 4 | 5 | You can redistribute this file and/or modify it under the terms 6 | of version 2 of the GNU General Public License as published by 7 | the Free Software Foundation. You should have received a copy 8 | of the license along with this file; see the file COPYING. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | license for more details. 14 | */ 15 | 16 | /* 17 | CoNFiGuration OPTionS 18 | 19 | choices that can be used in CONFIGUR.i 20 | */ 21 | 22 | 23 | /* choices for cur_ide */ 24 | 25 | #define gbk_ide_mpw 1 /* Macintosh Programmers Workshop */ 26 | #define gbk_ide_mw8 2 /* Metrowerks CodeWarrior */ 27 | #define gbk_ide_bgc 3 /* Gnu tools */ 28 | #define gbk_ide_snc 4 /* Sun tools */ 29 | #define gbk_ide_msv 5 /* Microsoft Visual C++ */ 30 | #define gbk_ide_lcc 6 /* lcc-win32 - Jacob Navia */ 31 | #define gbk_ide_dvc 7 /* Bloodshed Dev-C++ */ 32 | #define gbk_ide_xcd 8 /* Apple XCode */ 33 | /* previously Apple Project Builder */ 34 | #define gbk_ide_dmc 9 /* Digital Mars Compiler */ 35 | #define gbk_ide_plc 10 /* Pelles C Compiler */ 36 | #define gbk_ide_mgw 11 /* MinGW */ 37 | #define gbk_ide_cyg 12 /* Cygwin */ 38 | #define gbk_ide_dkp 13 /* devkitpro */ 39 | #define gbk_ide_ccc 14 /* Generic command line c compiler */ 40 | #define gbk_ide_mvc 15 /* Mini vMac C (a specific version of gcc) */ 41 | 42 | /* choices for gbo_script */ 43 | 44 | #define gbk_script_mpw 1 45 | #define gbk_script_applescript 2 46 | #define gbk_script_bash 3 47 | #define gbk_script_xp 4 48 | #define gbk_script_vbscript 5 49 | -------------------------------------------------------------------------------- /minivmac/setup/CONFIGUR.i: -------------------------------------------------------------------------------- 1 | /* 2 | CONFIGUR.i 3 | */ 4 | 5 | /* 6 | CONFIGURation file 7 | 8 | see CNFGDLFT.i and CNFGOPTS.i for things 9 | that can go here. 10 | */ 11 | -------------------------------------------------------------------------------- /minivmac/setup/COREDEFS.i: -------------------------------------------------------------------------------- 1 | /* 2 | COREDEFS.i 3 | Copyright (C) 2018 Paul C. Pratt 4 | 5 | You can redistribute this file and/or modify it under the terms 6 | of version 2 of the GNU General Public License as published by 7 | the Free Software Foundation. You should have received a copy 8 | of the license along with this file; see the file COPYING. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | license for more details. 14 | */ 15 | 16 | /* 17 | CORE DEFinitionS 18 | */ 19 | 20 | 21 | typedef unsigned long ui5b; 22 | typedef unsigned short ui4b; 23 | typedef unsigned char ui3b; 24 | 25 | typedef signed long si5b; 26 | typedef signed short si4b; 27 | typedef signed char si3b; 28 | 29 | typedef ui5b ui5r; 30 | typedef ui4b ui4r; 31 | typedef ui3b ui3r; 32 | 33 | typedef si5b si5r; 34 | typedef si4b si4r; 35 | typedef si3b si3r; 36 | 37 | typedef si3b *si3p; 38 | typedef ui3b *ui3p; 39 | typedef si4b *si4p; 40 | typedef ui4b *ui4p; 41 | typedef si5b *si5p; 42 | typedef ui5b *ui5p; 43 | 44 | typedef ui5p *ui5h; 45 | typedef ui4p *ui4h; 46 | typedef ui3p *ui3h; 47 | 48 | /* 49 | define the largest supported 50 | representation types. 51 | */ 52 | #define uimbl2sz 5 53 | typedef si5r simr; 54 | typedef ui5r uimr; 55 | 56 | typedef ui3b blnb; 57 | typedef ui3r blnr; 58 | #define trueblnr 1 59 | #define falseblnr 0 60 | 61 | typedef si4r tMyErr; 62 | 63 | typedef unsigned char MyPStr[256]; 64 | typedef unsigned char *ps3p; 65 | typedef unsigned char MyCharR; 66 | typedef MyCharR *MyCharPtr; 67 | 68 | typedef unsigned char MyByte; 69 | typedef MyByte *MyPtr; 70 | 71 | #define nullpr ((void *) 0) 72 | 73 | #define DISCARDVAL (void) 74 | 75 | 76 | #define LOCALFUNC static 77 | #define GLOBALFUNC static 78 | #define EXPORTFUNC static 79 | #define TYPEDEFFUNC typedef 80 | 81 | #define LOCALPROC LOCALFUNC void 82 | #define GLOBALPROC GLOBALFUNC void 83 | #define EXPORTPROC EXPORTFUNC void 84 | #define TYPEDEFPROC TYPEDEFFUNC void 85 | 86 | #define LOCALVAR static 87 | #define GLOBALVAR static 88 | #define EXPORTVAR static 89 | 90 | GLOBALVAR MyPtr pDt; 91 | -------------------------------------------------------------------------------- /minivmac/setup/DFFILDEF.i: -------------------------------------------------------------------------------- 1 | /* 2 | DFFILDEF.i 3 | Copyright (C) 2007 Paul C. Pratt 4 | 5 | You can redistribute this file and/or modify it under the terms 6 | of version 2 of the GNU General Public License as published by 7 | the Free Software Foundation. You should have received a copy 8 | of the license along with this file; see the file COPYING. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | license for more details. 14 | */ 15 | 16 | /* 17 | DEFinitions for program SPecific FILe DEFinitions 18 | */ 19 | 20 | #define kDepDirCSrc 0 21 | #define kDepDirCnfg 1 22 | 23 | typedef void (*tDoOneDepends)(int DepDir, char *s); 24 | 25 | typedef void (*tDoDependsForC)(tDoOneDepends p); 26 | 27 | typedef void (*tDoOneCFile)(char *s, int DepDir, long Flgm, 28 | tDoDependsForC depends); 29 | 30 | typedef void (*tWriteOneExtension)(char *s); 31 | 32 | typedef void (*tWriteExtensionList)(tWriteOneExtension p); 33 | 34 | typedef void (*tWriteOneDocType)( 35 | char *ShortName, 36 | char *MacType, 37 | char *LongName, 38 | tWriteExtensionList WriteExtensionList); 39 | 40 | #if 0 41 | #define kCSrcFlagAsmAvail 0 42 | #define kCSrcFlagAltSrc 1 43 | #endif 44 | #define kCSrcFlagSkip 1 45 | #define kCSrcFlagUseAPI 2 46 | #define kCSrcFlagSortFirst 3 47 | #define kCSrcFlagNoSource 4 48 | #define kCSrcFlagNoHeader 5 49 | #define kCSrcFlagOjbc 6 50 | 51 | #define kCSrcFlgmNone 0 52 | #if 0 53 | #define kCSrcFlgmAltSrc (1 << kCSrcFlagAltSrc) 54 | #endif 55 | #define kCSrcFlgmSkip (1 << kCSrcFlagSkip) 56 | #define kCSrcFlgmUseAPI (1 << kCSrcFlagUseAPI) 57 | #define kCSrcFlgmSortFirst (1 << kCSrcFlagSortFirst) 58 | #define kCSrcFlgmNoSource (1 << kCSrcFlagNoSource) 59 | #define kCSrcFlgmNoHeader (1 << kCSrcFlagNoHeader) 60 | #define kCSrcFlgmOjbc (1 << kCSrcFlagOjbc) 61 | 62 | #define CSrcFlagsUseIf(b) ((b) ? kCSrcFlgmNone : kCSrcFlgmSkip) 63 | #define CSrcFlagsUseHdrIf(b) (CSrcFlagsUseIf(b) | kCSrcFlgmNoSource) 64 | #define CSrcFlagsUseSrcIf(b) (CSrcFlagsUseIf(b) | kCSrcFlgmNoHeader) 65 | -------------------------------------------------------------------------------- /minivmac/setup/SPBASDEF.i: -------------------------------------------------------------------------------- 1 | /* 2 | SPBASDEF.i 3 | Copyright (C) 2009 Paul C. Pratt 4 | 5 | You can redistribute this file and/or modify it under the terms 6 | of version 2 of the GNU General Public License as published by 7 | the Free Software Foundation. You should have received a copy 8 | of the license along with this file; see the file COPYING. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | license for more details. 14 | */ 15 | 16 | /* 17 | program SPecific BASic DEFinitions 18 | */ 19 | 20 | 21 | #define kStrAppName "Mini vMac" 22 | #define kStrAppAbbrev "minivmac" /* [a-z0-9_]{1,8} */ 23 | #define MajorVersion 36 24 | #define MinorVersion 04 25 | #define kStrCopyrightYear "2018" 26 | #define kMacCreatorSig "MnvM" 27 | #define kBundleIdentifier "com.gryphel.minivmac" 28 | #define kShortDescription "miniature Macintosh emulator" 29 | 30 | #define Have_SPBLDOPT 1 31 | #define Have_SPCNFGGL 1 32 | #define Have_SPCNFGAP 1 33 | 34 | #define UseOpenGLinOSX 1 35 | -------------------------------------------------------------------------------- /minivmac/setup/SPCNFGGL.i: -------------------------------------------------------------------------------- 1 | /* 2 | SPCNFGGL.i 3 | Copyright (C) 2007 Paul C. Pratt 4 | 5 | You can redistribute this file and/or modify it under the terms 6 | of version 2 of the GNU General Public License as published by 7 | the Free Software Foundation. You should have received a copy 8 | of the license along with this file; see the file COPYING. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | license for more details. 14 | */ 15 | 16 | /* 17 | program SPecific CoNFiGuration GLobals 18 | */ 19 | 20 | LOCALPROC WriteAppSpecificCNFGGLOBoptions(void) 21 | { 22 | WriteBlankLineToDestFile(); 23 | 24 | WriteCompCondBool("MySoundRecenterSilence", falseblnr); 25 | 26 | WriteDefineUimr("kLn2SoundSampSz", cur_SoundSampSz); 27 | 28 | WriteBlankLineToDestFile(); 29 | 30 | #if 0 /* not used currently */ 31 | WriteCompCondBool("Debug", gbk_dbg_off != gbo_dbg); 32 | #endif 33 | 34 | WriteCompCondBool("dbglog_HAVE", DbgLogHAVE); 35 | 36 | WriteCompCondBool("WantAbnormalReports", gbo_AbnormalReports); 37 | 38 | WriteBlankLineToDestFile(); 39 | 40 | WriteDefineUimr("NumDrives", cur_numdrives); 41 | 42 | WriteCompCondBool("IncludeSonyRawMode", (! WantMinExtn) 43 | && (gbk_apifam_nds != gbo_apifam)); 44 | WriteCompCondBool("IncludeSonyGetName", 45 | (! WantMinExtn) && (gbk_apifam_gtk != gbo_apifam) 46 | && (gbk_apifam_nds != gbo_apifam) 47 | && (gbk_apifam_sdl != gbo_apifam) 48 | && (gbk_apifam_sd2 != gbo_apifam)); 49 | WriteCompCondBool("IncludeSonyNew", 50 | (! WantMinExtn) && (gbk_apifam_gtk != gbo_apifam) 51 | && (gbk_apifam_sdl != gbo_apifam) 52 | && (gbk_apifam_sd2 != gbo_apifam) 53 | && (gbk_apifam_nds != gbo_apifam)); 54 | WriteCompCondBool("IncludeSonyNameNew", 55 | (! WantMinExtn) && (gbk_apifam_gtk != gbo_apifam) 56 | && (gbk_apifam_sdl != gbo_apifam) 57 | && (gbk_apifam_sd2 != gbo_apifam) 58 | && (gbk_apifam_nds != gbo_apifam)); 59 | 60 | WriteBlankLineToDestFile(); 61 | 62 | WriteDefineUimr("vMacScreenHeight", cur_vres); 63 | WriteDefineUimr("vMacScreenWidth", cur_hres); 64 | WriteDefineUimr("vMacScreenDepth", cur_ScrnDpth); 65 | 66 | 67 | WriteBlankLineToDestFile(); 68 | 69 | WriteBgnDestFileLn(); 70 | WriteCStrToDestFile("#define kROM_Size "); 71 | WriteCStrToDestFile("0x"); 72 | WriteHexLongToOutput(1UL << cur_RomSize); 73 | WriteEndDestFileLn(); 74 | 75 | 76 | WriteBlankLineToDestFile(); 77 | 78 | WriteCompCondBool("IncludePbufs", 79 | 1 /* ((! WantMinExtn) || WantActvCode || WantDemoMsg) */ 80 | && (gbk_apifam_gtk != gbo_apifam) 81 | && (gbk_apifam_nds != gbo_apifam)); 82 | 83 | WriteDefineUimr("NumPbufs", 4); 84 | 85 | 86 | WriteBlankLineToDestFile(); 87 | 88 | WriteCompCondBool("EnableMouseMotion", MyMouseMotion); 89 | 90 | WriteBlankLineToDestFile(); 91 | 92 | WriteCompCondBool("IncludeHostTextClipExchange", 93 | 1 /* ((! WantMinExtn) || WantActvCode || WantDemoMsg) */ 94 | && (gbk_apifam_gtk != gbo_apifam) 95 | && (gbk_apifam_sdl != gbo_apifam) 96 | && (gbk_apifam_nds != gbo_apifam)); 97 | 98 | WriteDestFileLn("#define EnableAutoSlow 1"); 99 | WriteCompCondBool("EmLocalTalk", WantLocalTalk); 100 | 101 | WriteCompCondBool("AutoLocation", WantAutoLocation); 102 | WriteCompCondBool("AutoTimeZone", WantAutoTimeZone); 103 | } 104 | -------------------------------------------------------------------------------- /minivmac/setup/STRUTILS.i: -------------------------------------------------------------------------------- 1 | /* 2 | STRUTILS.i 3 | Copyright (C) 2007 Paul C. Pratt 4 | 5 | You can redistribute this file and/or modify it under the terms 6 | of version 2 of the GNU General Public License as published by 7 | the Free Software Foundation. You should have received a copy 8 | of the license along with this file; see the file COPYING. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | license for more details. 14 | */ 15 | 16 | /* 17 | STRing UTILitieS 18 | 19 | Some very basic string macros and routines. 20 | */ 21 | 22 | 23 | #define PStrLength(s) (*(s)) 24 | #define PStrToMyCharPtr(s) ((s) + 1) 25 | 26 | #define PStrMaxLength 255 27 | 28 | #define SizeOfListMyChar(n) (n) 29 | #define PStrToPtr(s) ((MyPtr)PStrToMyCharPtr(s)) 30 | #define PStrToSize(s) (SizeOfListMyChar(PStrLength(s))) 31 | #define PStrToTotSize(s) (SizeOfListMyChar(PStrLength(s) + 1)) 32 | /* + 1 for length byte */ 33 | 34 | #define PStrClear(s) PStrLength(s) = 0 35 | 36 | GLOBALPROC PStrCopy(ps3p r, ps3p s) 37 | { 38 | MyMoveBytes((MyPtr)s, (MyPtr)r, PStrToTotSize(s)); 39 | } 40 | 41 | GLOBALPROC PStrApndChar(ps3p s, MyCharR x) 42 | { 43 | si4r n = s[0] + 1; 44 | 45 | if (n <= PStrMaxLength) { 46 | s[0] = (MyCharR)n; 47 | s[n] = x; 48 | } 49 | } 50 | 51 | GLOBALPROC PStrPrependChar(ps3p s, MyCharR x) 52 | { 53 | ps3p p = s; 54 | si4r n0 = *p++; 55 | si4r n = n0 + 1; 56 | 57 | if (n <= PStrMaxLength) { 58 | MyMoveBytes((MyPtr)p, (MyPtr)(p + 1), SizeOfListMyChar(n0)); 59 | s[1] = x; 60 | s[0] = (MyCharR)n; 61 | } 62 | } 63 | 64 | GLOBALPROC PStrAppend(ps3p r, ps3p s) 65 | { 66 | ps3p p = s; 67 | ps3p q = r; 68 | si4r m = *p++; 69 | si4r n = *q++; 70 | 71 | if (n + m > PStrMaxLength) { 72 | m = PStrMaxLength - n; 73 | } 74 | 75 | *r = (MyCharR)(n + m); 76 | MyMoveBytes((MyPtr)p, (MyPtr)(q + n), m); 77 | } 78 | 79 | GLOBALFUNC uimr CStrLength(char *s) 80 | { 81 | char *p = s; 82 | 83 | while (0 != *p++) { 84 | } 85 | return p - s - 1; 86 | } 87 | 88 | GLOBALPROC PStrFromCStr(ps3p r, /* CONST */ char *s) 89 | { 90 | uimr L; 91 | 92 | L = CStrLength(s); 93 | if (L > PStrMaxLength) { 94 | L = PStrMaxLength; 95 | } 96 | *r++ = (MyCharR)L; 97 | MyMoveBytes((MyPtr)s, (MyPtr)r, L); 98 | } 99 | 100 | GLOBALPROC PStrFromChar(ps3p r, char x) 101 | { 102 | r[0] = 1; 103 | r[1] = x; 104 | } 105 | 106 | GLOBALPROC PStrFromPtr(MyPtr p, uimr L, ps3p s) 107 | { 108 | uimr tL; 109 | 110 | if (L <= PStrMaxLength) { 111 | tL = L; 112 | } else { 113 | tL = PStrMaxLength; 114 | } 115 | s[0] = (MyCharR)tL; 116 | MyMoveBytes(p, PStrToPtr(s), SizeOfListMyChar(tL)); 117 | } 118 | 119 | GLOBALPROC PStrApndCStr(ps3p r, /* CONST */ char *s) 120 | { 121 | MyPStr t; 122 | 123 | PStrFromCStr(t, s); 124 | PStrAppend(r, t); 125 | } 126 | 127 | GLOBALFUNC blnr PStrEq(ps3p s1, ps3p s2) 128 | { 129 | register si4r i; 130 | MyCharPtr p1 = s1; 131 | MyCharPtr p2 = s2; 132 | MyCharR n = *p1++; 133 | MyCharR m = *p2++; 134 | 135 | if (n != m) { 136 | return falseblnr; 137 | } else { 138 | for (i = n; --i >= 0; ) { 139 | if (*p1++ != *p2++) { 140 | return falseblnr; 141 | } 142 | } 143 | return trueblnr; 144 | } 145 | } 146 | 147 | GLOBALFUNC blnr CStrEq(char *s1, char *s2) 148 | { 149 | MyCharR c1; 150 | 151 | while ((c1 = *s1++) == *s2++) { 152 | if (0 == c1) { 153 | return trueblnr; 154 | } 155 | } 156 | return falseblnr; 157 | } 158 | 159 | GLOBALPROC CStrFromPtr(MyPtr p, uimr L, char *s) 160 | { 161 | MyMoveBytes(p, (MyPtr)s, SizeOfListMyChar(L)); 162 | s[L] = (MyCharR)0; 163 | } 164 | 165 | GLOBALPROC CStrFromPStr(ps3p x, char *s) 166 | { 167 | CStrFromPtr(PStrToMyCharPtr(x), PStrLength(x), s); 168 | } 169 | 170 | GLOBALPROC CStrCopy(char *r, char *s) 171 | { 172 | while (0 != (*r++ = *s++)) { 173 | } 174 | } 175 | 176 | LOCALPROC ReversePStr(ps3p s) 177 | { 178 | MyCharR c; 179 | MyCharR *p1 = PStrToMyCharPtr(s); 180 | MyCharR *p2 = p1 + PStrLength(s) - 1; 181 | 182 | while (p1 < p2) { 183 | c = *p1; 184 | *p1 = *p2; 185 | *p2 = c; 186 | ++p1; 187 | --p2; 188 | } 189 | } 190 | 191 | LOCALPROC PStrFromUimr(uimr v, ps3p s) 192 | { 193 | MyCharR *p = PStrToMyCharPtr(s); 194 | uimr newv; 195 | 196 | do { 197 | newv = v / (uimr)10; 198 | *p++ = '0' + (v - newv * 10); 199 | v = newv; 200 | } while (v != 0); 201 | s[0] = p - PStrToMyCharPtr(s); 202 | 203 | ReversePStr(s); 204 | } 205 | 206 | LOCALFUNC uimr MyCharPtrToUimr(MyCharPtr p, MyCharR n) 207 | { 208 | register si4r i; 209 | uimr v = 0; 210 | 211 | for (i = n; --i >= 0; ) { 212 | v = (v * 10) + (*p++ - '0'); 213 | } 214 | 215 | return v; 216 | } 217 | 218 | LOCALFUNC uimr PStrToUimr(ps3p s) 219 | { 220 | MyCharPtr p = s; 221 | MyCharR n = *p++; 222 | 223 | return MyCharPtrToUimr(p, n); 224 | } 225 | 226 | LOCALFUNC simr PStrToSimr(ps3p s) 227 | { 228 | simr v; 229 | MyCharPtr p = s; 230 | MyCharR n = *p++; 231 | 232 | if (0 == n) { 233 | v = 0; 234 | } else if ('-' == p[0]) { 235 | v = - MyCharPtrToUimr(++p, --n); 236 | } else { 237 | v = MyCharPtrToUimr(p, n); 238 | } 239 | 240 | return v; 241 | } 242 | 243 | LOCALPROC PStrFromSimr(simr v, ps3p s) 244 | { 245 | if (v < 0) { 246 | PStrFromUimr(- v, s); 247 | PStrPrependChar(s, '-'); 248 | } else { 249 | PStrFromUimr(v, s); 250 | } 251 | } 252 | 253 | LOCALPROC PStrFromNUimr(uimr v, ui3r n, ps3p s) 254 | { 255 | uimr i; 256 | uimr newv; 257 | MyCharR *p = PStrToMyCharPtr(s); 258 | 259 | s[0] = n; 260 | for (i = n + 1; 0 != --i; ) { 261 | newv = v / (uimr)10; 262 | *p++ = '0' + (v - newv * 10); 263 | v = newv; 264 | } 265 | 266 | ReversePStr(s); 267 | } 268 | 269 | GLOBALPROC PStrApndNUimr(ps3p r, uimr v, ui3r n) 270 | { 271 | MyPStr t; 272 | 273 | PStrFromNUimr(v, n, t); 274 | PStrAppend(r, t); 275 | } 276 | 277 | #define Have_STRUTILS 1 278 | -------------------------------------------------------------------------------- /minivmac/setup/WRCCCFLS.i: -------------------------------------------------------------------------------- 1 | /* 2 | WRCCCFLS.i 3 | Copyright (C) 2007 Paul C. Pratt 4 | 5 | You can redistribute this file and/or modify it under the terms 6 | of version 2 of the GNU General Public License as published by 7 | the Free Software Foundation. You should have received a copy 8 | of the license along with this file; see the file COPYING. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | license for more details. 14 | */ 15 | 16 | /* 17 | WRite generic Command line C Compiler specific FiLeS 18 | */ 19 | 20 | 21 | LOCALPROC WriteCccMakeFile(void) 22 | { 23 | WriteDestFileLn("# make file generated by gryphel build system"); 24 | 25 | WriteBlankLineToDestFile(); 26 | 27 | WriteDestFileLn("mk_COptions = -c"); 28 | WriteCStrToDestFile(" -I"); 29 | Write_cfg_d_ToDestFile(); 30 | WriteCStrToDestFile(" -I"); 31 | Write_src_d_ToDestFile(); 32 | WriteBlankLineToDestFile(); 33 | 34 | WriteBgnDestFileLn(); 35 | WriteCStrToDestFile("TheDefaultOutput : "); 36 | Write_machobinpath_ToDestFile(); 37 | WriteEndDestFileLn(); 38 | 39 | WriteBlankLineToDestFile(); 40 | DoAllSrcFilesWithSetup(DoSrcFileMakeCompile); 41 | WriteBlankLineToDestFile(); 42 | WriteBgnDestFileLn(); 43 | WriteCStrToDestFile("ObjFiles = "); 44 | WriteBackSlashToDestFile(); 45 | WriteEndDestFileLn(); 46 | ++DestFileIndent; 47 | DoAllSrcFilesStandardMakeObjects(); 48 | WriteBlankLineToDestFile(); 49 | --DestFileIndent; 50 | WriteBlankLineToDestFile(); 51 | WriteBgnDestFileLn(); 52 | Write_machobinpath_ToDestFile(); 53 | WriteCStrToDestFile(" : $(ObjFiles)"); 54 | WriteEndDestFileLn(); 55 | ++DestFileIndent; 56 | WriteDestFileLn("cc \\"); 57 | ++DestFileIndent; 58 | WriteBgnDestFileLn(); 59 | WriteCStrToDestFile("-o "); 60 | WriteQuoteToDestFile(); 61 | Write_machobinpath_ToDestFile(); 62 | WriteQuoteToDestFile(); 63 | WriteCStrToDestFile(" \\"); 64 | WriteEndDestFileLn(); 65 | 66 | WriteBgnDestFileLn(); 67 | WriteCStrToDestFile("$(ObjFiles)"); 68 | #if 0 69 | WriteCStrToDestFile(" -lXext"); 70 | #endif 71 | WriteCStrToDestFile(" -L/usr/X11R6/lib -lX11"); 72 | WriteEndDestFileLn(); 73 | --DestFileIndent; 74 | --DestFileIndent; 75 | 76 | WriteBlankLineToDestFile(); 77 | WriteDestFileLn("clean :"); 78 | ++DestFileIndent; 79 | WriteDestFileLn("rm -f $(ObjFiles)"); 80 | WriteRmFile(WriteAppNamePath); 81 | --DestFileIndent; 82 | } 83 | 84 | LOCALPROC WriteCccSpecificFiles(void) 85 | { 86 | WriteADstFile1("my_project_d", 87 | "Makefile", "", "Make file", 88 | WriteCccMakeFile); 89 | } 90 | -------------------------------------------------------------------------------- /minivmac/setup/WRDMCFLS.i: -------------------------------------------------------------------------------- 1 | /* 2 | WRDMCFLS.i 3 | Copyright (C) 2010 Paul C. Pratt 4 | 5 | You can redistribute this file and/or modify it under the terms 6 | of version 2 of the GNU General Public License as published by 7 | the Free Software Foundation. You should have received a copy 8 | of the license along with this file; see the file COPYING. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | license for more details. 14 | */ 15 | 16 | /* 17 | WRite Digital Mars Compiler specific FiLeS 18 | */ 19 | 20 | 21 | LOCALPROC WriteMainRsrcObjDMCbuild(void) 22 | { 23 | WriteBgnDestFileLn(); 24 | WriteCStrToDestFile("rcc.exe -o"); 25 | WriteMainRsrcObjPath(); 26 | WriteSpaceToDestFile(); 27 | WriteMainRsrcSrcPath(); 28 | WriteCStrToDestFile(" -I"); 29 | Write_src_d_ToDestFile(); 30 | WriteEndDestFileLn(); 31 | } 32 | 33 | LOCALPROC WriteDMCclMakeFile(void) 34 | { 35 | WriteDestFileLn("# make file generated by gryphel build system"); 36 | WriteBlankLineToDestFile(); 37 | WriteBgnDestFileLn(); 38 | WriteCStrToDestFile("mk_COptions = -c -r -WA"); 39 | /* -o+space seems to generate bad code, compiler version 8.42n */ 40 | WriteCStrToDestFile(" -I"); 41 | Write_cfg_d_ToDestFile(); 42 | WriteCStrToDestFile(" -I"); 43 | Write_src_d_ToDestFile(); 44 | WriteEndDestFileLn(); 45 | WriteBlankLineToDestFile(); 46 | 47 | WriteBgnDestFileLn(); 48 | WriteCStrToDestFile("TheDefaultOutput:"); 49 | WriteMakeDependFile(WriteAppNamePath); 50 | WriteEndDestFileLn(); 51 | 52 | WriteBlankLineToDestFile(); 53 | WriteBlankLineToDestFile(); 54 | DoAllSrcFilesWithSetup(DoSrcFileMakeCompile); 55 | WriteBlankLineToDestFile(); 56 | WriteDestFileLn("ObjFiles = \\"); 57 | ++DestFileIndent; 58 | DoAllSrcFilesStandardMakeObjects(); 59 | WriteBlankLineToDestFile(); 60 | --DestFileIndent; 61 | 62 | WriteBlankLineToDestFile(); 63 | WriteMakeRule(WriteMainRsrcObjPath, 64 | WriteMainRsrcObjMSCdeps, WriteMainRsrcObjDMCbuild); 65 | WriteBlankLineToDestFile(); 66 | 67 | WriteBgnDestFileLn(); 68 | WriteAppNamePath(); 69 | WriteCStrToDestFile(": $(ObjFiles) "); 70 | WriteMainRsrcObjPath(); 71 | WriteEndDestFileLn(); 72 | 73 | ++DestFileIndent; 74 | WriteBgnDestFileLn(); 75 | WriteCStrToDestFile( 76 | "dmc.exe -L/exet:nt/su:windows:4.0 $(ObjFiles) "); 77 | WriteMainRsrcObjPath(); 78 | WriteCStrToDestFile(" -o\""); 79 | WriteAppNamePath(); 80 | WriteCStrToDestFile( 81 | "\" winmm.lib ole32.lib uuid.lib comdlg32.lib shell32.lib" 82 | " gdi32.lib"); 83 | WriteEndDestFileLn(); 84 | --DestFileIndent; 85 | 86 | WriteBlankLineToDestFile(); 87 | WriteDestFileLn("clean:"); 88 | ++DestFileIndent; 89 | DoAllSrcFilesStandardErase(); 90 | WriteRmFile(WriteMainRsrcObjPath); 91 | WriteRmFile(WriteAppNamePath); 92 | --DestFileIndent; 93 | } 94 | 95 | LOCALPROC WriteDMCSpecificFiles(void) 96 | { 97 | WriteADstFile1("my_project_d", 98 | "Makefile", "", "Make file", 99 | WriteDMCclMakeFile); 100 | } 101 | -------------------------------------------------------------------------------- /minivmac/setup/WRDVCFLS.i: -------------------------------------------------------------------------------- 1 | /* 2 | WRDVCFLS.i 3 | Copyright (C) 2007 Paul C. Pratt 4 | 5 | You can redistribute this file and/or modify it under the terms 6 | of version 2 of the GNU General Public License as published by 7 | the Free Software Foundation. You should have received a copy 8 | of the license along with this file; see the file COPYING. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | license for more details. 14 | */ 15 | 16 | /* 17 | WRite bloodshed DeV-C++ specific FiLeS 18 | */ 19 | 20 | 21 | static void DoSrcFileDvcAddFile(void) 22 | { 23 | WriteBlankLineToDestFile(); 24 | WriteBgnDestFileLn(); 25 | WriteCStrToDestFile("[Unit"); 26 | WriteUnsignedToOutput(FileCounter + 1); 27 | WriteCStrToDestFile("]"); 28 | WriteEndDestFileLn(); 29 | 30 | WriteBgnDestFileLn(); 31 | WriteCStrToDestFile("FileName="); 32 | WriteSrcFileFilePath(); 33 | WriteEndDestFileLn(); 34 | 35 | WriteDestFileLn("CompileCpp=0"); 36 | WriteBgnDestFileLn(); 37 | WriteCStrToDestFile("Folder="); 38 | WriteAppVariationStr(); 39 | WriteEndDestFileLn(); 40 | WriteDestFileLn("Compile=1"); 41 | WriteDestFileLn("Link=1"); 42 | WriteDestFileLn("Priority=1000"); 43 | WriteDestFileLn("OverrideBuildCmd=0"); 44 | WriteDestFileLn("BuildCmd="); 45 | } 46 | 47 | LOCALPROC WriteDevCProjectFile(void) 48 | { 49 | WriteDestFileLn("[Project]"); 50 | 51 | WriteBgnDestFileLn(); 52 | WriteCStrToDestFile("FileName="); 53 | WriteStrAppAbbrev(); 54 | WriteCStrToDestFile(".dev"); 55 | WriteEndDestFileLn(); 56 | 57 | WriteBgnDestFileLn(); 58 | WriteCStrToDestFile("Name="); 59 | WriteAppVariationStr(); 60 | WriteEndDestFileLn(); 61 | 62 | DoAllSrcFilesWithSetup(NullProc); 63 | ++FileCounter; /* main.rc */ 64 | 65 | WriteBgnDestFileLn(); 66 | WriteCStrToDestFile("UnitCount="); 67 | WriteUnsignedToOutput(FileCounter); 68 | WriteEndDestFileLn(); 69 | 70 | WriteDestFileLn("Type=0"); 71 | WriteDestFileLn("Ver=1"); 72 | 73 | WriteBgnDestFileLn(); 74 | WriteCStrToDestFile("Includes="); 75 | Write_cfg_d_ToDestFile(); 76 | WriteCStrToDestFile(" "); 77 | Write_src_d_ToDestFile(); 78 | WriteEndDestFileLn(); 79 | 80 | WriteBgnDestFileLn(); 81 | WriteCStrToDestFile("PrivateResource="); 82 | WriteAppVariationStr(); 83 | WriteCStrToDestFile("_private.rc"); 84 | WriteEndDestFileLn(); 85 | 86 | WriteBgnDestFileLn(); 87 | WriteCStrToDestFile("ResourceIncludes="); 88 | Write_src_d_ToDestFile(); 89 | WriteEndDestFileLn(); 90 | 91 | WriteDestFileLn("IsCpp=0"); 92 | WriteBgnDestFileLn(); 93 | WriteCStrToDestFile("ObjectOutput="); 94 | Write_obj_d_ToDestFile(); 95 | WriteEndDestFileLn(); 96 | WriteDestFileLn("OverrideOutput=1"); 97 | 98 | WriteBgnDestFileLn(); 99 | WriteCStrToDestFile("OverrideOutputName="); 100 | WriteAppNamePath(); 101 | WriteEndDestFileLn(); 102 | 103 | WriteDestFileLn("IncludeVersionInfo=0"); 104 | WriteDestFileLn("CompilerSet=0"); 105 | if (gbk_dbg_on == gbo_dbg) { 106 | WriteDestFileLn("CompilerSettings=000000000000000100"); 107 | WriteDestFileLn( 108 | "Compiler= -Wall -Wstrict-prototypes" 109 | " -Wno-uninitialized -O0_@@_"); 110 | } else { 111 | WriteDestFileLn("CompilerSettings=000000000000000000"); 112 | WriteDestFileLn( 113 | "Compiler= -Wall -Wstrict-prototypes" 114 | " -Wno-uninitialized -Os_@@_"); 115 | } 116 | WriteDestFileLn("Linker=-lwinmm -lole32 -luuid_@@_"); 117 | WriteBlankLineToDestFile(); 118 | WriteDestFileLn("[VersionInfo]"); 119 | WriteDestFileLn("Major=0"); 120 | WriteDestFileLn("Minor=1"); 121 | WriteDestFileLn("Release=1"); 122 | WriteDestFileLn("Build=1"); 123 | WriteDestFileLn("LanguageID=1033"); 124 | WriteDestFileLn("CharsetID=1252"); 125 | WriteDestFileLn("CompanyName="); 126 | WriteDestFileLn("FileVersion="); 127 | WriteDestFileLn("FileDescription=Developed using the Dev-C++ IDE"); 128 | WriteDestFileLn("InternalName="); 129 | WriteDestFileLn("LegalCopyright="); 130 | WriteDestFileLn("LegalTrademarks="); 131 | WriteDestFileLn("OriginalFilename="); 132 | WriteDestFileLn("ProductName="); 133 | WriteDestFileLn("ProductVersion="); 134 | WriteDestFileLn("AutoIncBuildNr=0"); 135 | 136 | DoAllSrcFilesWithSetup(DoSrcFileDvcAddFile); 137 | 138 | WriteBlankLineToDestFile(); 139 | 140 | WriteBgnDestFileLn(); 141 | WriteCStrToDestFile("[Unit"); 142 | WriteUnsignedToOutput(++FileCounter); 143 | WriteCStrToDestFile("]"); 144 | WriteEndDestFileLn(); 145 | 146 | WriteBgnDestFileLn(); 147 | WriteCStrToDestFile("FileName="); 148 | WriteMainRsrcSrcPath(); 149 | WriteEndDestFileLn(); 150 | 151 | WriteDestFileLn("CompileCpp=0"); 152 | WriteBgnDestFileLn(); 153 | WriteCStrToDestFile("Folder="); 154 | WriteAppVariationStr(); 155 | WriteEndDestFileLn(); 156 | WriteDestFileLn("Compile=1"); 157 | WriteDestFileLn("Link=0"); 158 | WriteDestFileLn("Priority=1000"); 159 | WriteDestFileLn("OverrideBuildCmd=0"); 160 | WriteDestFileLn("BuildCmd="); 161 | 162 | WriteBlankLineToDestFile(); 163 | } 164 | 165 | LOCALPROC WriteDevCSpecificFiles(void) 166 | { 167 | WriteADstFile1("my_project_d", 168 | vStrAppAbbrev, ".dev", "Project file", 169 | WriteDevCProjectFile); 170 | } 171 | -------------------------------------------------------------------------------- /minivmac/setup/WRLCCFLS.i: -------------------------------------------------------------------------------- 1 | /* 2 | WRLCCFLS.i 3 | Copyright (C) 2007 Paul C. Pratt 4 | 5 | You can redistribute this file and/or modify it under the terms 6 | of version 2 of the GNU General Public License as published by 7 | the Free Software Foundation. You should have received a copy 8 | of the license along with this file; see the file COPYING. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | license for more details. 14 | */ 15 | 16 | /* 17 | WRite LCC-win32 specific FiLeS 18 | */ 19 | 20 | 21 | LOCALPROC DoSrcFileLccAddFile(void) 22 | { 23 | WriteBgnDestFileLn(); 24 | WriteCStrToDestFile("File"); 25 | WriteUnsignedToOutput(FileCounter + 1); 26 | WriteCStrToDestFile("="); 27 | WriteSrcFileFilePath(); 28 | WriteEndDestFileLn(); 29 | } 30 | 31 | LOCALPROC WriteLccErrFileName(void) 32 | { 33 | WriteStrAppAbbrev(); 34 | WriteCStrToDestFile(".err"); 35 | } 36 | 37 | LOCALPROC WriteLccErrFilePath(void) 38 | { 39 | WriteFileInDirToDestFile0(Write_obj_d_ToDestFile, 40 | WriteLccErrFileName); 41 | } 42 | 43 | LOCALPROC WriteLccW32WorkSpaceFile(void) 44 | { 45 | WriteDestFileLn("; Wedit project file. Syntax: Name = value"); 46 | 47 | WriteBgnDestFileLn(); 48 | WriteCStrToDestFile("["); 49 | WriteAppVariationStr(); 50 | WriteCStrToDestFile("]"); 51 | WriteEndDestFileLn(); 52 | 53 | DoAllSrcFilesWithSetup(NullProc); 54 | ++FileCounter; /* main.rc */ 55 | 56 | WriteBgnDestFileLn(); 57 | WriteCStrToDestFile("PrjFiles="); 58 | WriteUnsignedToOutput(FileCounter); 59 | WriteEndDestFileLn(); 60 | 61 | DoAllSrcFilesWithSetup(DoSrcFileLccAddFile); 62 | 63 | WriteBgnDestFileLn(); 64 | WriteCStrToDestFile("File"); 65 | WriteUnsignedToOutput(++FileCounter); 66 | WriteCStrToDestFile("="); 67 | WriteMainRsrcSrcPath(); 68 | WriteEndDestFileLn(); 69 | 70 | WriteDestFileLn("ProjectFlags=0"); 71 | 72 | WriteBgnDestFileLn(); 73 | WriteCStrToDestFile("Name="); 74 | WriteAppVariationStr(); 75 | WriteEndDestFileLn(); 76 | 77 | WriteBgnDestFileLn(); 78 | WriteCStrToDestFile("ProjectPath="); 79 | WriteCStrToDestFile("c:\\output"); 80 | WriteEndDestFileLn(); 81 | 82 | WriteBgnDestFileLn(); 83 | WriteCStrToDestFile("SourcesDir="); 84 | /* setting it to my_c_src_d does not work */ 85 | WriteCStrToDestFile("c:\\output"); 86 | WriteEndDestFileLn(); 87 | 88 | WriteBgnDestFileLn(); 89 | WriteCStrToDestFile("Includes="); 90 | Write_cfg_d_ToDestFile(); 91 | WriteCStrToDestFile(" "); 92 | Write_src_d_ToDestFile(); 93 | WriteEndDestFileLn(); 94 | 95 | WriteBgnDestFileLn(); 96 | WriteCStrToDestFile("MakeDir="); 97 | Write_obj_d_ToDestFile(); 98 | WriteEndDestFileLn(); 99 | 100 | WriteBgnDestFileLn(); 101 | WriteCStrToDestFile("Exe="); 102 | WriteAppNamePath(); 103 | WriteEndDestFileLn(); 104 | 105 | WriteBgnDestFileLn(); 106 | WriteCStrToDestFile("DbgExeName="); 107 | WriteAppNamePath(); 108 | WriteEndDestFileLn(); 109 | 110 | WriteBgnDestFileLn(); 111 | WriteCStrToDestFile("DbgDir="); 112 | Write_obj_d_ToDestFile(); 113 | WriteEndDestFileLn(); 114 | 115 | switch (gbo_dbg) { 116 | case gbk_dbg_on: 117 | WriteDestFileLn("CompilerFlags=6728"); 118 | break; 119 | case gbk_dbg_test: 120 | WriteDestFileLn("CompilerFlags=580"); 121 | break; 122 | case gbk_dbg_off: 123 | WriteDestFileLn("CompilerFlags=581"); 124 | break; 125 | } 126 | 127 | WriteBgnDestFileLn(); 128 | WriteCStrToDestFile("Libraries="); 129 | WriteCStrToDestFile("shell32.lib ole32.lib uuid.lib winmm.lib"); 130 | WriteEndDestFileLn(); 131 | 132 | WriteBgnDestFileLn(); 133 | WriteCStrToDestFile("ErrorFile="); 134 | WriteLccErrFilePath(); 135 | WriteEndDestFileLn(); 136 | 137 | WriteBgnDestFileLn(); 138 | WriteCStrToDestFile("CurrentFile="); 139 | WriteCNFGGLOBPath(); 140 | WriteEndDestFileLn(); 141 | 142 | WriteDestFileLn("OpenFiles=1"); 143 | 144 | WriteBgnDestFileLn(); 145 | WriteCStrToDestFile("OpenFile1="); 146 | WriteQuoteToDestFile(); 147 | WriteCNFGGLOBPath(); 148 | WriteQuoteToDestFile(); 149 | WriteCStrToDestFile(" 1 29 14 532 435"); 150 | WriteEndDestFileLn(); 151 | } 152 | 153 | LOCALPROC WriteLccW32SpecificFiles(void) 154 | { 155 | WriteADstFile1("my_project_d", 156 | vStrAppAbbrev, ".prj", "Project file", 157 | WriteLccW32WorkSpaceFile); 158 | } 159 | 160 | 161 | LOCALPROC WriteMainRsrcObjLccbuild(void) 162 | { 163 | WriteBgnDestFileLn(); 164 | WriteCStrToDestFile("lrc.exe -fo"); 165 | WriteMainRsrcObjPath(); 166 | WriteSpaceToDestFile(); 167 | WriteMainRsrcSrcPath(); 168 | WriteEndDestFileLn(); 169 | } 170 | 171 | LOCALPROC WriteLccW32clMakeFile(void) 172 | { 173 | WriteBgnDestFileLn(); 174 | WriteCStrToDestFile( 175 | "# make file generated by gryphel build system"); 176 | WriteEndDestFileLn(); 177 | 178 | WriteBlankLineToDestFile(); 179 | 180 | WriteBgnDestFileLn(); 181 | WriteCStrToDestFile("mk_COptions= -c"); 182 | if (gbk_dbg_on != gbo_dbg) { 183 | WriteCStrToDestFile(" -O"); 184 | } else { 185 | WriteCStrToDestFile(" -g4"); 186 | } 187 | WriteCStrToDestFile(" -A"); 188 | WriteEndDestFileLn(); 189 | 190 | WriteBlankLineToDestFile(); 191 | WriteBlankLineToDestFile(); 192 | WriteBgnDestFileLn(); 193 | WriteCStrToDestFile("TheDefaultOutput:"); 194 | WriteMakeDependFile(WriteAppNamePath); 195 | WriteEndDestFileLn(); 196 | WriteBlankLineToDestFile(); 197 | WriteBlankLineToDestFile(); 198 | DoAllSrcFilesWithSetup(DoSrcFileMakeCompile); 199 | WriteBlankLineToDestFile(); 200 | WriteDestFileLn("ObjFiles=\\"); 201 | ++DestFileIndent; 202 | DoAllSrcFilesStandardMakeObjects(); 203 | WriteBlankLineToDestFile(); 204 | --DestFileIndent; 205 | 206 | WriteBlankLineToDestFile(); 207 | WriteBlankLineToDestFile(); 208 | WriteMakeRule(WriteMainRsrcObjPath, 209 | WriteMainRsrcObjMSCdeps, WriteMainRsrcObjLccbuild); 210 | WriteBlankLineToDestFile(); 211 | WriteBlankLineToDestFile(); 212 | 213 | WriteBgnDestFileLn(); 214 | WriteAppNamePath(); 215 | WriteCStrToDestFile(": $(ObjFiles) "); 216 | WriteMainRsrcObjPath(); 217 | WriteEndDestFileLn(); 218 | 219 | ++DestFileIndent; 220 | WriteBgnDestFileLn(); 221 | WriteCStrToDestFile("lcclnk.exe"); 222 | if (gbk_dbg_on != gbo_dbg) { 223 | WriteCStrToDestFile(" -s"); 224 | } 225 | WriteCStrToDestFile(" -subsystem windows -o "); 226 | WriteAppNamePath(); 227 | WriteCStrToDestFile(" $(ObjFiles) "); 228 | WriteMainRsrcObjPath(); 229 | WriteCStrToDestFile(" \\"); 230 | WriteEndDestFileLn(); 231 | ++DestFileIndent; 232 | WriteDestFileLn( 233 | "shell32.lib winmm.lib ole32.lib uuid.lib"); 234 | --DestFileIndent; 235 | --DestFileIndent; 236 | WriteBlankLineToDestFile(); 237 | 238 | WriteBlankLineToDestFile(); 239 | WriteDestFileLn("clean:"); 240 | ++DestFileIndent; 241 | DoAllSrcFilesStandardErase(); 242 | WriteRmFile(WriteMainRsrcObjPath); 243 | WriteRmFile(WriteAppNamePath); 244 | --DestFileIndent; 245 | } 246 | 247 | LOCALPROC WriteLccW32clSpecificFiles(void) 248 | { 249 | WriteADstFile1("my_project_d", 250 | "Makefile", "", "Make file", 251 | WriteLccW32clMakeFile); 252 | } 253 | -------------------------------------------------------------------------------- /minivmac/setup/WRSNCFLS.i: -------------------------------------------------------------------------------- 1 | /* 2 | WRSNCFLS.i 3 | Copyright (C) 2007 Paul C. Pratt 4 | 5 | You can redistribute this file and/or modify it under the terms 6 | of version 2 of the GNU General Public License as published by 7 | the Free Software Foundation. You should have received a copy 8 | of the license along with this file; see the file COPYING. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | license for more details. 14 | */ 15 | 16 | /* 17 | WRite SuN C specific FiLeS 18 | */ 19 | 20 | LOCALPROC WriteSncCOptions(void) 21 | { 22 | WriteCStrToDestFile(" -c -v -fd -xstrconst"); 23 | if (gbk_dbg_on != gbo_dbg) { 24 | WriteCStrToDestFile(" -xO4 -xspace -Qn"); 25 | } else { 26 | WriteCStrToDestFile(" -g"); 27 | } 28 | } 29 | 30 | LOCALPROC WriteSncMakeFile(void) 31 | { 32 | WriteDestFileLn("# make file generated by gryphel build system"); 33 | 34 | WriteBlankLineToDestFile(); 35 | 36 | WriteBgnDestFileLn(); 37 | WriteCStrToDestFile("mk_COptions ="); 38 | WriteSncCOptions(); 39 | WriteEndDestFileLn(); 40 | WriteBlankLineToDestFile(); 41 | 42 | WriteBgnDestFileLn(); 43 | WriteCStrToDestFile("TheDefaultOutput : "); 44 | Write_machobinpath_ToDestFile(); 45 | WriteEndDestFileLn(); 46 | 47 | WriteBlankLineToDestFile(); 48 | DoAllSrcFilesWithSetup(DoSrcFileMakeCompile); 49 | WriteBlankLineToDestFile(); 50 | WriteBgnDestFileLn(); 51 | WriteCStrToDestFile("ObjFiles = "); 52 | WriteBackSlashToDestFile(); 53 | WriteEndDestFileLn(); 54 | ++DestFileIndent; 55 | DoAllSrcFilesStandardMakeObjects(); 56 | WriteBlankLineToDestFile(); 57 | --DestFileIndent; 58 | WriteBlankLineToDestFile(); 59 | WriteBgnDestFileLn(); 60 | Write_machobinpath_ToDestFile(); 61 | WriteCStrToDestFile(" : $(ObjFiles)"); 62 | WriteEndDestFileLn(); 63 | ++DestFileIndent; 64 | WriteBgnDestFileLn(); 65 | WriteCStrToDestFile("cc"); 66 | if (gbk_dbg_on != gbo_dbg) { 67 | WriteCStrToDestFile(" -s -Qn -mr"); 68 | } 69 | WriteCStrToDestFile(" \\"); 70 | WriteEndDestFileLn(); 71 | ++DestFileIndent; 72 | WriteBgnDestFileLn(); 73 | WriteCStrToDestFile("-o "); 74 | WriteQuoteToDestFile(); 75 | Write_machobinpath_ToDestFile(); 76 | WriteQuoteToDestFile(); 77 | 78 | WriteCStrToDestFile(" -L/usr/X11R6/lib -lX11"); 79 | #if 0 80 | if (gbk_targfam_slrs == gbo_targfam) { 81 | WriteCStrToDestFile(" -lposix4"); 82 | } 83 | if (MySoundEnabled) { 84 | WriteCStrToDestFile(" -lasound"); 85 | } 86 | #endif 87 | WriteCStrToDestFile(" \\"); 88 | WriteEndDestFileLn(); 89 | WriteDestFileLn("$(ObjFiles)"); 90 | --DestFileIndent; 91 | if (gbk_dbg_on != gbo_dbg) { 92 | if (gbk_ide_xcd == cur_ide) { 93 | WriteBgnDestFileLn(); 94 | WriteCStrToDestFile("strip -u -r \""); 95 | Write_machobinpath_ToDestFile(); 96 | WriteCStrToDestFile("\""); 97 | WriteEndDestFileLn(); 98 | } 99 | } 100 | --DestFileIndent; 101 | 102 | WriteBlankLineToDestFile(); 103 | WriteDestFileLn("clean :"); 104 | ++DestFileIndent; 105 | WriteDestFileLn("rm -f $(ObjFiles)"); 106 | WriteRmFile(WriteAppNamePath); 107 | --DestFileIndent; 108 | } 109 | 110 | LOCALPROC WriteSncSpecificFiles(void) 111 | { 112 | WriteADstFile1("my_project_d", 113 | "Makefile", "", "Make file", 114 | WriteSncMakeFile); 115 | } 116 | -------------------------------------------------------------------------------- /minivmac/setup/tool.c: -------------------------------------------------------------------------------- 1 | /* 2 | app.c 3 | Copyright (C) 2009 Paul C. Pratt 4 | 5 | You can redistribute this file and/or modify it under the terms 6 | of version 2 of the GNU General Public License as published by 7 | the Free Software Foundation. You should have received a copy 8 | of the license along with this file; see the file COPYING. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | license for more details. 14 | */ 15 | 16 | #include 17 | #include 18 | #include 19 | 20 | #include "COREDEFS.i" 21 | 22 | #include "CNFGOPTS.i" 23 | #include "CONFIGUR.i" 24 | #include "CNFGDLFT.i" 25 | 26 | 27 | #define MyMoveBytes(src, dst, n) \ 28 | (void) memmove((void *)(dst), (void *)(src), n) 29 | 30 | #define kMyErr_noErr 0 /* no error */ 31 | 32 | #define kMyErrReported 1029 33 | /* already notified user, no further report needed */ 34 | #define kMyErrNoMatch 1030 35 | /* (so try something else) always should be handled, not reported */ 36 | 37 | #if NeedSegmenting 38 | #pragma segment Utilities 39 | #endif 40 | 41 | #include "STRUTILS.i" 42 | 43 | #include "CMDARGT1.i" 44 | 45 | #include "WRTEXTFL.i" 46 | 47 | #if NeedSegmenting 48 | #pragma segment Body 49 | #endif 50 | 51 | #include "SPBASDEF.i" 52 | 53 | #include "GNBLDOPT.i" 54 | #ifdef Have_SPBLDOPT 55 | #include "SPBLDOPT.i" 56 | #endif 57 | 58 | #if NeedSegmenting 59 | #pragma segment Body1 60 | #endif 61 | 62 | #include "BLDUTIL3.i" 63 | 64 | #include "DFFILDEF.i" 65 | #include "SPFILDEF.i" 66 | 67 | #if NeedSegmenting 68 | #pragma segment Body2 69 | #endif 70 | 71 | #include "USFILDEF.i" 72 | #include "WRMACRES.i" 73 | #include "WRMPLIST.i" 74 | #include "WRCNFGGL.i" 75 | #include "WRCNFGAP.i" 76 | 77 | #if NeedSegmenting 78 | #pragma segment Body3 79 | #endif 80 | 81 | #if gbk_ide_mpw == cur_ide 82 | #include "WRMPWFLS.i" 83 | #endif 84 | 85 | #if gbk_ide_mw8 == cur_ide 86 | #include "WRMW8FLS.i" 87 | #endif 88 | 89 | #if gbk_ide_mvc == cur_ide 90 | #include "WRMVCFLS.i" 91 | #endif 92 | 93 | #if (gbk_ide_bgc == cur_ide) \ 94 | || (gbk_ide_cyg == cur_ide) \ 95 | || (gbk_ide_mgw == cur_ide) \ 96 | || (gbk_ide_dkp == cur_ide) \ 97 | || (gbk_ide_dvc == cur_ide) \ 98 | || (gbk_ide_xcd == cur_ide) 99 | #include "WRBGCFLS.i" 100 | #endif 101 | 102 | #if gbk_ide_snc == cur_ide 103 | #include "WRSNCFLS.i" 104 | #endif 105 | 106 | #if gbk_ide_msv == cur_ide 107 | #include "WRMSCFLS.i" 108 | #endif 109 | 110 | #if gbk_ide_lcc == cur_ide 111 | #include "WRLCCFLS.i" 112 | #endif 113 | 114 | #if gbk_ide_dvc == cur_ide 115 | #include "WRDVCFLS.i" 116 | #endif 117 | 118 | #if gbk_ide_xcd == cur_ide 119 | #include "WRXCDFLS.i" 120 | #endif 121 | 122 | #if gbk_ide_dmc == cur_ide 123 | #include "WRDMCFLS.i" 124 | #endif 125 | 126 | #if gbk_ide_plc == cur_ide 127 | #include "WRPLCFLS.i" 128 | #endif 129 | 130 | #if gbk_ide_ccc == cur_ide 131 | #include "WRCCCFLS.i" 132 | #endif 133 | 134 | #if NeedSegmenting 135 | #pragma segment Body4 136 | #endif 137 | 138 | #ifdef Have_SPCNFGGL 139 | #include "SPCNFGGL.i" 140 | #endif 141 | #ifdef Have_SPCNFGAP 142 | #include "SPCNFGAP.i" 143 | #endif 144 | #include "SPOTHRCF.i" 145 | 146 | #if NeedSegmenting 147 | #pragma segment Main 148 | #endif 149 | 150 | #include "BLDUTIL4.i" 151 | 152 | int main(int argc, char *argv[]) 153 | { 154 | tMyErr err; 155 | int return_code = 1; 156 | 157 | BeginParseCommandLineArguments(argc, argv); 158 | 159 | err = DoTheCommand(); 160 | 161 | if (kMyErr_noErr == err) { 162 | return_code = 0; 163 | } else { 164 | if (kMyErrReported != err) { 165 | fprintf(stderr, "Unknown Error in %s", argv[0]); 166 | } 167 | } 168 | 169 | return return_code; 170 | } 171 | -------------------------------------------------------------------------------- /minivmac/src/ADBEMDEV.c: -------------------------------------------------------------------------------- 1 | /* 2 | ADBEMDEV.c 3 | 4 | Copyright (C) 2008 Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | /* 18 | Apple Desktop Bus EMulated DEVice 19 | */ 20 | 21 | #ifndef AllFiles 22 | #include "SYSDEPNS.h" 23 | #include "MYOSGLUE.h" 24 | #include "EMCONFIG.h" 25 | #include "GLOBGLUE.h" 26 | #endif 27 | 28 | #include "ADBEMDEV.h" 29 | 30 | #ifdef _VIA_Debug 31 | #include 32 | #endif 33 | 34 | /* 35 | ReportAbnormalID unused 0x0C06 - 0x0CFF 36 | */ 37 | 38 | IMPORTPROC ADB_ShiftOutData(ui3b v); 39 | IMPORTFUNC ui3b ADB_ShiftInData(void); 40 | 41 | #include "ADBSHARE.h" 42 | 43 | LOCALVAR blnr ADB_ListenDatBuf; 44 | LOCALVAR ui3b ADB_IndexDatBuf; 45 | 46 | GLOBALPROC ADB_DoNewState(void) 47 | { 48 | ui3b state = ADB_st1 * 2 + ADB_st0; 49 | #ifdef _VIA_Debug 50 | fprintf(stderr, "ADB_DoNewState: %d\n", state); 51 | #endif 52 | { 53 | ADB_Int = 1; 54 | switch (state) { 55 | case 0: /* Start a new command */ 56 | if (ADB_ListenDatBuf) { 57 | ADB_ListenDatBuf = falseblnr; 58 | ADB_SzDatBuf = ADB_IndexDatBuf; 59 | ADB_EndListen(); 60 | } 61 | ADB_TalkDatBuf = falseblnr; 62 | ADB_IndexDatBuf = 0; 63 | ADB_CurCmd = ADB_ShiftInData(); 64 | /* which sets interrupt, acknowleding command */ 65 | #ifdef _VIA_Debug 66 | fprintf(stderr, "in: %d\n", ADB_CurCmd); 67 | #endif 68 | switch ((ADB_CurCmd >> 2) & 3) { 69 | case 0: /* reserved */ 70 | switch (ADB_CurCmd & 3) { 71 | case 0: /* Send Reset */ 72 | ADB_DoReset(); 73 | break; 74 | case 1: /* Flush */ 75 | ADB_Flush(); 76 | break; 77 | case 2: /* reserved */ 78 | case 3: /* reserved */ 79 | ReportAbnormalID(0x0C01, 80 | "Reserved ADB command"); 81 | break; 82 | } 83 | break; 84 | case 1: /* reserved */ 85 | ReportAbnormalID(0x0C02, 86 | "Reserved ADB command"); 87 | break; 88 | case 2: /* listen */ 89 | ADB_ListenDatBuf = trueblnr; 90 | #ifdef _VIA_Debug 91 | fprintf(stderr, "*** listening\n"); 92 | #endif 93 | break; 94 | case 3: /* talk */ 95 | ADB_DoTalk(); 96 | break; 97 | } 98 | break; 99 | case 1: /* Transfer date byte (even) */ 100 | case 2: /* Transfer date byte (odd) */ 101 | if (! ADB_ListenDatBuf) { 102 | /* 103 | will get here even if no pending talk data, 104 | when there is pending event from device 105 | other than the one polled by the last talk 106 | command. this probably indicates a bug. 107 | */ 108 | if ((! ADB_TalkDatBuf) 109 | || (ADB_IndexDatBuf >= ADB_SzDatBuf)) 110 | { 111 | ADB_ShiftOutData(0xFF); 112 | ADB_Data = 1; 113 | ADB_Int = 0; 114 | } else { 115 | #ifdef _VIA_Debug 116 | fprintf(stderr, "*** talk one\n"); 117 | #endif 118 | ADB_ShiftOutData(ADB_DatBuf[ADB_IndexDatBuf]); 119 | ADB_Data = 1; 120 | ADB_IndexDatBuf += 1; 121 | } 122 | } else { 123 | if (ADB_IndexDatBuf >= ADB_MaxSzDatBuf) { 124 | ReportAbnormalID(0x0C03, "ADB listen too much"); 125 | /* ADB_MaxSzDatBuf isn't big enough */ 126 | (void) ADB_ShiftInData(); 127 | } else { 128 | #ifdef _VIA_Debug 129 | fprintf(stderr, "*** listen one\n"); 130 | #endif 131 | ADB_DatBuf[ADB_IndexDatBuf] = ADB_ShiftInData(); 132 | ADB_IndexDatBuf += 1; 133 | } 134 | } 135 | break; 136 | case 3: /* idle */ 137 | if (ADB_ListenDatBuf) { 138 | ReportAbnormalID(0x0C04, "ADB idle follows listen"); 139 | /* apparently doesn't happen */ 140 | } 141 | if (ADB_TalkDatBuf) { 142 | if (ADB_IndexDatBuf != 0) { 143 | ReportAbnormalID(0x0C05, 144 | "idle when not done talking"); 145 | } 146 | ADB_ShiftOutData(0xFF); 147 | /* ADB_Int = 0; */ 148 | } else if (CheckForADBanyEvt()) { 149 | if (((ADB_CurCmd >> 2) & 3) == 3) { 150 | ADB_DoTalk(); 151 | } 152 | ADB_ShiftOutData(0xFF); 153 | /* ADB_Int = 0; */ 154 | } 155 | break; 156 | } 157 | } 158 | } 159 | 160 | GLOBALPROC ADBstate_ChangeNtfy(void) 161 | { 162 | #ifdef _VIA_Debug 163 | fprintf(stderr, "ADBstate_ChangeNtfy: %d, %d, %d\n", 164 | ADB_st1, ADB_st0, GetCuriCount()); 165 | #endif 166 | ICT_add(kICT_ADB_NewState, 167 | 348160UL * kCycleScale / 64 * kMyClockMult); 168 | /* 169 | Macintosh Family Hardware Reference say device "must respond 170 | to talk command within 260 microseconds", which translates 171 | to about 190 instructions. But haven't seen much problems 172 | even for very large values (tens of thousands), and do see 173 | problems for small values. 50 is definitely too small, 174 | mouse doesn't move smoothly. There may still be some 175 | signs of this problem with 150. 176 | 177 | On the other hand, how fast the device must respond may 178 | not be related to how fast the ADB transceiver responds. 179 | */ 180 | } 181 | 182 | GLOBALPROC ADB_DataLineChngNtfy(void) 183 | { 184 | #ifdef _VIA_Debug 185 | fprintf(stderr, "ADB_DataLineChngNtfy: %d\n", ADB_Data); 186 | #endif 187 | } 188 | 189 | GLOBALPROC ADB_Update(void) 190 | { 191 | ui3b state = ADB_st1 * 2 + ADB_st0; 192 | 193 | if (state == 3) { /* idle */ 194 | if (ADB_TalkDatBuf) { 195 | /* ignore, presumably being taken care of */ 196 | } else if (CheckForADBanyEvt()) 197 | { 198 | if (((ADB_CurCmd >> 2) & 3) == 3) { 199 | ADB_DoTalk(); 200 | } 201 | ADB_ShiftOutData(0xFF); 202 | /* 203 | Wouldn't expect this would be needed unless 204 | there is actually talk data. But without it, 205 | ADB never polls the other devices. Clearing 206 | ADB_Int has no effect. 207 | */ 208 | /* 209 | ADB_Int = 0; 210 | seems to have no effect, which probably indicates a bug 211 | */ 212 | } 213 | } 214 | } 215 | -------------------------------------------------------------------------------- /minivmac/src/ADBEMDEV.h: -------------------------------------------------------------------------------- 1 | /* 2 | ADBEMDEV.h 3 | 4 | Copyright (C) 2008 Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | #ifdef ADBEMDEV_H 18 | #error "header already included" 19 | #else 20 | #define ADBEMDEV_H 21 | #endif 22 | 23 | 24 | EXPORTPROC ADBstate_ChangeNtfy(void); 25 | EXPORTPROC ADB_DoNewState(void); 26 | EXPORTPROC ADB_DataLineChngNtfy(void); 27 | EXPORTPROC ADB_Update(void); 28 | -------------------------------------------------------------------------------- /minivmac/src/ALTKEYSM.h: -------------------------------------------------------------------------------- 1 | /* 2 | ALTKEYSM.h 3 | 4 | Copyright (C) 2007 Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | /* 18 | ALTernate KEYs Mode 19 | */ 20 | 21 | #ifdef ALTKEYSM_H 22 | #error "header already included" 23 | #else 24 | #define ALTKEYSM_H 25 | #endif 26 | 27 | LOCALVAR blnr AltKeysLockText = falseblnr; 28 | LOCALVAR blnr AltKeysTrueCmnd = falseblnr; 29 | LOCALVAR blnr AltKeysTrueOption = falseblnr; 30 | LOCALVAR blnr AltKeysTrueShift = falseblnr; 31 | LOCALVAR blnr AltKeysModOn = falseblnr; 32 | LOCALVAR blnr AltKeysTextOn = falseblnr; 33 | 34 | LOCALPROC CheckAltKeyUseMode(void) 35 | { 36 | blnr NewAltKeysTextOn; 37 | 38 | AltKeysModOn = AltKeysTrueCmnd 39 | || AltKeysTrueOption || AltKeysTrueShift; 40 | NewAltKeysTextOn = AltKeysLockText || AltKeysModOn; 41 | if (NewAltKeysTextOn != AltKeysTextOn) { 42 | DisconnectKeyCodes(kKeepMaskControl | kKeepMaskCapsLock 43 | | (AltKeysTrueCmnd ? kKeepMaskCommand : 0) 44 | | (AltKeysTrueOption ? kKeepMaskOption : 0) 45 | | (AltKeysTrueShift ? kKeepMaskShift : 0)); 46 | AltKeysTextOn = NewAltKeysTextOn; 47 | } 48 | } 49 | 50 | LOCALPROC Keyboard_UpdateKeyMap1(ui3r key, blnr down) 51 | { 52 | if (MKC_Command == key) { 53 | AltKeysTrueCmnd = down; 54 | CheckAltKeyUseMode(); 55 | Keyboard_UpdateKeyMap(key, down); 56 | } else if (MKC_Option == key) { 57 | AltKeysTrueOption = down; 58 | CheckAltKeyUseMode(); 59 | Keyboard_UpdateKeyMap(key, down); 60 | } else if (MKC_Shift == key) { 61 | AltKeysTrueShift = down; 62 | CheckAltKeyUseMode(); 63 | Keyboard_UpdateKeyMap(key, down); 64 | } else if (MKC_SemiColon == key) { 65 | if (down && ! AltKeysModOn) { 66 | if (AltKeysLockText) { 67 | AltKeysLockText = falseblnr; 68 | NeedWholeScreenDraw = trueblnr; 69 | SpecialModeClr(SpclModeAltKeyText); 70 | 71 | CheckAltKeyUseMode(); 72 | } 73 | } else { 74 | Keyboard_UpdateKeyMap(key, down); 75 | } 76 | } else if (AltKeysTextOn) { 77 | Keyboard_UpdateKeyMap(key, down); 78 | } else if (MKC_M == key) { 79 | if (down) { 80 | if (! AltKeysLockText) { 81 | AltKeysLockText = trueblnr; 82 | SpecialModeSet(SpclModeAltKeyText); 83 | NeedWholeScreenDraw = trueblnr; 84 | CheckAltKeyUseMode(); 85 | } 86 | } 87 | } else { 88 | switch (key) { 89 | case MKC_A: 90 | key = MKC_SemiColon; 91 | break; 92 | case MKC_B: 93 | key = MKC_BackSlash; 94 | break; 95 | case MKC_C: 96 | key = MKC_F3; 97 | break; 98 | case MKC_D: 99 | key = MKC_Option; 100 | break; 101 | case MKC_E: 102 | key = MKC_BackSpace; 103 | break; 104 | case MKC_F: 105 | key = MKC_Command; 106 | break; 107 | case MKC_G: 108 | key = MKC_Enter; 109 | break; 110 | case MKC_H: 111 | key = MKC_Equal; 112 | break; 113 | case MKC_I: 114 | key = MKC_Up; 115 | break; 116 | case MKC_J: 117 | key = MKC_Left; 118 | break; 119 | case MKC_K: 120 | key = MKC_Down; 121 | break; 122 | case MKC_L: 123 | key = MKC_Right; 124 | break; 125 | case MKC_M: 126 | /* handled above */ 127 | break; 128 | case MKC_N: 129 | key = MKC_Minus; 130 | break; 131 | case MKC_O: 132 | key = MKC_RightBracket; 133 | break; 134 | case MKC_P: 135 | return; /* none */ 136 | break; 137 | case MKC_Q: 138 | key = MKC_Grave; 139 | break; 140 | case MKC_R: 141 | key = MKC_Return; 142 | break; 143 | case MKC_S: 144 | key = MKC_Shift; 145 | break; 146 | case MKC_T: 147 | key = MKC_Tab; 148 | break; 149 | case MKC_U: 150 | key = MKC_LeftBracket; 151 | break; 152 | case MKC_V: 153 | key = MKC_F4; 154 | break; 155 | case MKC_W: 156 | return; /* none */ 157 | break; 158 | case MKC_X: 159 | key = MKC_F2; 160 | break; 161 | case MKC_Y: 162 | key = MKC_Escape; 163 | break; 164 | case MKC_Z: 165 | key = MKC_F1; 166 | break; 167 | default: 168 | break; 169 | } 170 | Keyboard_UpdateKeyMap(key, down); 171 | } 172 | } 173 | 174 | LOCALPROC DisconnectKeyCodes1(ui5b KeepMask) 175 | { 176 | DisconnectKeyCodes(KeepMask); 177 | 178 | if (! (0 != (KeepMask & kKeepMaskCommand))) { 179 | AltKeysTrueCmnd = falseblnr; 180 | } 181 | if (! (0 != (KeepMask & kKeepMaskOption))) { 182 | AltKeysTrueOption = falseblnr; 183 | } 184 | if (! (0 != (KeepMask & kKeepMaskShift))) { 185 | AltKeysTrueShift = falseblnr; 186 | } 187 | AltKeysModOn = AltKeysTrueCmnd 188 | || AltKeysTrueOption || AltKeysTrueShift; 189 | AltKeysTextOn = AltKeysLockText || AltKeysModOn; 190 | } 191 | 192 | LOCALPROC DrawAltKeyMode(void) 193 | { 194 | int i; 195 | 196 | CurCellv0 = ControlBoxv0; 197 | CurCellh0 = ControlBoxh0; 198 | 199 | DrawCellAdvance(kInsertText00); 200 | for (i = (ControlBoxw - 4) / 2; --i >= 0; ) { 201 | DrawCellAdvance(kInsertText04); 202 | } 203 | DrawCellAdvance(kInsertText01); 204 | DrawCellAdvance(kInsertText02); 205 | for (i = (ControlBoxw - 4) / 2; --i >= 0; ) { 206 | DrawCellAdvance(kInsertText04); 207 | } 208 | DrawCellAdvance(kInsertText03); 209 | } 210 | -------------------------------------------------------------------------------- /minivmac/src/ASCEMDEV.h: -------------------------------------------------------------------------------- 1 | /* 2 | ASCEMDEV.h 3 | 4 | Copyright (C) 2008 Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | #ifdef ASCEMDEV_H 18 | #error "header already included" 19 | #else 20 | #define ASCEMDEV_H 21 | #endif 22 | 23 | EXPORTFUNC ui5b ASC_Access(ui5b Data, blnr WriteMem, CPTR addr); 24 | EXPORTPROC ASC_SubTick(int SubTick); 25 | -------------------------------------------------------------------------------- /minivmac/src/DATE2SEC.h: -------------------------------------------------------------------------------- 1 | /* 2 | DATE2SEC.h 3 | Copyright (C) 2003 Bradford L. Barrett, Paul C. Pratt 4 | 5 | You can redistribute this file and/or modify it under the terms 6 | of version 2 of the GNU General Public License as published by 7 | the Free Software Foundation. You should have received a copy 8 | of the license along with this file; see the file COPYING. 9 | 10 | This file is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | license for more details. 14 | */ 15 | 16 | /* 17 | DATE 2(to) SEConds 18 | 19 | convert year/month/day/hour/minute/second 20 | to number of seconds since the beginning 21 | of 1904, the format for storing dates 22 | on the Macintosh. 23 | 24 | The function jdate is from the program Webalizer 25 | by Bradford L. Barrett. 26 | */ 27 | 28 | #ifdef DATE2SEC_H 29 | #error "header already included" 30 | #else 31 | #define DATE2SEC_H 32 | #endif 33 | 34 | /* 35 | The function jdate was found at the end of the file 36 | webalizer.c in the program webalizer at 37 | "www.mrunix.net/webalizer/". 38 | Here is copyright info from the top of that file: 39 | 40 | webalizer - a web server log analysis program 41 | 42 | Copyright (C) 1997-2000 Bradford L. Barrett (brad@mrunix.net) 43 | 44 | This program is free software; you can redistribute it and/or modify 45 | it under the terms of the GNU General Public License as published by 46 | the Free Software Foundation; either version 2 of the License, or 47 | (at your option) any later version, and provided that the above 48 | copyright and permission notice is included with all distributed 49 | copies of this or derived software. 50 | */ 51 | 52 | /* ************************************************************* */ 53 | /* */ 54 | /* JDATE - Julian date calculator */ 55 | /* */ 56 | /* Calculates the number of days since Jan 1, 0000. */ 57 | /* */ 58 | /* Originally written by Bradford L. Barrett (03/17/1988) */ 59 | /* Returns an unsigned long value representing the number of */ 60 | /* days since January 1, 0000. */ 61 | /* */ 62 | /* Note: Due to the changes made by Pope Gregory XIII in the */ 63 | /* 16th Centyry (Feb 24, 1582), dates before 1583 will */ 64 | /* not return a truely accurate number (will be at least */ 65 | /* 10 days off). Somehow, I don't think this will */ 66 | /* present much of a problem for most situations :) */ 67 | /* */ 68 | /* Usage: days = jdate(day, month, year) */ 69 | /* */ 70 | /* The number returned is adjusted by 5 to facilitate day of */ 71 | /* week calculations. The mod of the returned value gives the */ 72 | /* day of the week the date is. (ie: dow = days % 7) where */ 73 | /* dow will return 0=Sunday, 1=Monday, 2=Tuesday, etc... */ 74 | /* */ 75 | /* ************************************************************* */ 76 | 77 | LOCALFUNC ui5b jdate(int day, int month, int year) 78 | { 79 | ui5b days; /* value returned */ 80 | int mtable[] = { 81 | 0, 31, 59, 90, 120, 151, 82 | 181, 212, 243, 273, 304, 334 83 | }; 84 | 85 | /* 86 | First, calculate base number including leap 87 | and Centenial year stuff 88 | */ 89 | 90 | days = (((ui5b)year * 365) + day + mtable[month - 1] 91 | + ((year + 4) / 4) - ((year / 100) - (year / 400))); 92 | 93 | /* now adjust for leap year before March 1st */ 94 | 95 | if ((year % 4 == 0) 96 | && (! ((year % 100 == 0) && (year % 400 != 0))) 97 | && (month < 3)) 98 | { 99 | --days; 100 | } 101 | 102 | /* done, return with calculated value */ 103 | 104 | return (days + 5); 105 | } 106 | 107 | LOCALFUNC ui5b Date2MacSeconds(int second, int minute, int hour, 108 | int day, int month, int year) 109 | { 110 | ui5b curjdate; 111 | ui5b basejdate; 112 | 113 | curjdate = jdate(day, month, year); 114 | basejdate = jdate(1, 1, 1904); 115 | return (((curjdate - basejdate) * 24 + hour) * 60 116 | + minute) * 60 + second; 117 | } 118 | -------------------------------------------------------------------------------- /minivmac/src/DISAM68K.h: -------------------------------------------------------------------------------- 1 | /* 2 | DISAM68K.h 3 | 4 | Copyright (C) 2010 Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | /* 18 | DISAssemble Motorola 68K instructions. 19 | */ 20 | 21 | #ifdef DIS1M68K_H 22 | #error "header already included" 23 | #else 24 | #define DIS1M68K_H 25 | #endif 26 | 27 | EXPORTPROC DisasmOneOrSave(ui5r pc); 28 | 29 | EXPORTPROC m68k_WantDisasmContext(void); 30 | -------------------------------------------------------------------------------- /minivmac/src/ENDIANAC.h: -------------------------------------------------------------------------------- 1 | /* 2 | ENDIANAC.h 3 | 4 | Copyright (C) 2006 Bernd Schmidt, Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | /* 18 | ENDIAN ACcess 19 | 20 | Deals with endian issues in memory access. 21 | 22 | This code is adapted from code in the Un*x Amiga Emulator by 23 | Bernd Schmidt, as found in vMac by Philip Cummins. 24 | */ 25 | 26 | #ifdef ENDIANAC_H 27 | #ifndef AllFiles 28 | #error "header already included" 29 | #endif 30 | #else 31 | #define ENDIANAC_H 32 | #endif 33 | 34 | 35 | #define do_get_mem_byte(a) ((ui3r)*((ui3b *)(a))) 36 | 37 | #if BigEndianUnaligned 38 | #define do_get_mem_word(a) ((ui4r)*((ui4b *)(a))) 39 | #else 40 | LOCALINLINEFUNC ui4r do_get_mem_word(ui3p a) 41 | { 42 | #if LittleEndianUnaligned 43 | ui4b b = (*((ui4b *)(a))); 44 | 45 | return ((b & 0x00FF) << 8) | ((b >> 8) & 0x00FF); 46 | #else 47 | return (((ui4r)*a) << 8) | ((ui4r)*(a + 1)); 48 | #endif 49 | } 50 | #endif 51 | 52 | #if BigEndianUnaligned 53 | #define do_get_mem_long(a) ((ui5r)*((ui5b *)(a))) 54 | #elif HaveMySwapUi5r && LittleEndianUnaligned 55 | #define do_get_mem_long(a) (MySwapUi5r((ui5r)*((ui5b *)(a)))) 56 | #else 57 | LOCALINLINEFUNC ui5r do_get_mem_long(ui3p a) 58 | { 59 | #if LittleEndianUnaligned 60 | #if 0 61 | ui5b b = (*((ui5b *)(a))); 62 | return ((b & 0x000000FF) << 24) 63 | | ((b & 0x0000FF00) << 8) 64 | | ((b & 0x00FF0000) >> 8) 65 | | ((b & 0xFF000000) >> 24); 66 | #endif 67 | #if 0 68 | ui5b b = (*((ui5b *)(a))); 69 | return ((b << 24) & 0xFF000000) 70 | | ((b << 8) & 0x00FF0000) 71 | | ((b >> 8) & 0x0000FF00) 72 | | ((b >> 24) & 0x000000FF); 73 | /* 74 | no, this doesn't do well with apple tools, 75 | instead try combining two 16 bit swaps. 76 | */ 77 | #endif 78 | ui5b b = (*((ui5b *)(a))); 79 | ui4b b1 = b; 80 | ui4b b2 = b >> 16; 81 | ui4b c1 = ((b1 & 0x00FF) << 8) | ((b1 >> 8) & 0x00FF); 82 | ui4b c2 = ((b2 & 0x00FF) << 8) | ((b2 >> 8) & 0x00FF); 83 | 84 | return (((ui5r)c1) << 16) | ((ui5r)c2); 85 | /* 86 | better, though still doesn't use BSWAP 87 | instruction with apple tools for intel. 88 | */ 89 | #else 90 | return (((ui5r)*a) << 24) | (((ui5r)*(a + 1)) << 16) 91 | | (((ui5r)*(a + 2)) << 8) | ((ui5r)*(a + 3)); 92 | #endif 93 | } 94 | #endif 95 | 96 | #define do_put_mem_byte(a, v) ((*((ui3b *)(a))) = (v)) 97 | 98 | #if BigEndianUnaligned 99 | #define do_put_mem_word(a, v) ((*((ui4b *)(a))) = (v)) 100 | #else 101 | LOCALINLINEFUNC void do_put_mem_word(ui3p a, ui4r v) 102 | { 103 | #if LittleEndianUnaligned 104 | ui4b b = ((v & 0x00FF) << 8) | ((v >> 8) & 0x00FF); 105 | 106 | *(ui4b *)a = b; 107 | #else 108 | *a = v >> 8; 109 | *(a + 1) = v; 110 | #endif 111 | } 112 | #endif 113 | 114 | #if BigEndianUnaligned 115 | #define do_put_mem_long(a, v) ((*((ui5b *)(a))) = (v)) 116 | #elif HaveMySwapUi5r && LittleEndianUnaligned 117 | #define do_put_mem_long(a, v) ((*((ui5b *)(a))) = MySwapUi5r(v)) 118 | #else 119 | LOCALINLINEFUNC void do_put_mem_long(ui3p a, ui5r v) 120 | { 121 | #if LittleEndianUnaligned 122 | ui4b b1 = v; 123 | ui4b b2 = v >> 16; 124 | ui4b c1 = ((b1 & 0x00FF) << 8) | ((b1 >> 8) & 0x00FF); 125 | ui4b c2 = ((b2 & 0x00FF) << 8) | ((b2 >> 8) & 0x00FF); 126 | 127 | *(ui5b *)a = (c1 << 16) | c2; 128 | #else 129 | *a = v >> 24; 130 | *(a + 1) = v >> 16; 131 | *(a + 2) = v >> 8; 132 | *(a + 3) = v; 133 | #endif 134 | } 135 | #endif 136 | -------------------------------------------------------------------------------- /minivmac/src/HPMCHACK.h: -------------------------------------------------------------------------------- 1 | /* 2 | HPMCHACK.c 3 | 4 | Copyright (C) 2016 Steve Chamberlin, Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | /* 18 | HaPpy MaCintosh Hack 19 | 20 | Patch the ROM for alternatives to the 21 | Happy Macintosh icon displayed on boot 22 | when a disk is inserted. 23 | */ 24 | 25 | #define kAHM_aside 0 26 | #define kAHM_cheese 1 27 | #define kAHM_evil 2 28 | #define kAHM_horror 3 29 | #define kAHM_lady_mac 4 30 | #define kAHM_moustache 5 31 | #define kAHM_nerdy 6 32 | #define kAHM_pirate 7 33 | #define kAHM_sleepy 8 34 | #define kAHM_sly 9 35 | #define kAHM_sunglasses 10 36 | #define kAHM_surprise 11 37 | #define kAHM_tongue 12 38 | #define kAHM_yuck 13 39 | #define kAHM_zombie 14 40 | 41 | LOCALVAR const ui3b my_HappyMac_icon[] = { 42 | #if CurAltHappyMac == kAHM_aside 43 | 0x00, 0x00, 44 | 0x39, 0x38, 45 | 0x21, 0x20, 46 | 0x01, 0x00, 47 | 0x01, 0x00, 48 | 0x03, 0x00, 49 | 0x00, 0x00, 50 | 0x00, 0x00, 51 | 0x07, 0x80, 52 | 0x00, 0x00 53 | #endif 54 | #if CurAltHappyMac == kAHM_cheese 55 | 0x10, 0x10, 56 | 0x28, 0x28, 57 | 0x00, 0x00, 58 | 0x00, 0x00, 59 | 0x3F, 0xF8, 60 | 0x20, 0x08, 61 | 0x20, 0x08, 62 | 0x20, 0x08, 63 | 0x10, 0x10, 64 | 0x0F, 0xE0, 65 | #endif 66 | #if CurAltHappyMac == kAHM_evil 67 | 0x00, 0x00, 68 | 0x10, 0x10, 69 | 0x08, 0x20, 70 | 0x0C, 0x60, 71 | 0x00, 0x00, 72 | 0x20, 0x08, 73 | 0x20, 0x08, 74 | 0x1F, 0xF0, 75 | 0x00, 0x00, 76 | 0x00, 0x00 77 | #endif 78 | #if CurAltHappyMac == kAHM_horror 79 | 0x38, 0x38, 80 | 0x44, 0x44, 81 | 0x44, 0x44, 82 | 0x44, 0x44, 83 | 0x38, 0x38, 84 | 0x03, 0x80, 85 | 0x03, 0x80, 86 | 0x03, 0x80, 87 | 0x03, 0x80, 88 | 0x03, 0x80 89 | #endif 90 | #if CurAltHappyMac == kAHM_lady_mac 91 | 0x38, 0x38, 92 | 0x45, 0x44, 93 | 0x55, 0x54, 94 | 0x45, 0x44, 95 | 0x39, 0x38, 96 | 0x03, 0x00, 97 | 0x00, 0x00, 98 | 0x00, 0x00, 99 | 0x07, 0x80, 100 | 0x03, 0x00 101 | #endif 102 | #if CurAltHappyMac == kAHM_moustache 103 | 0x00, 0x00, 104 | 0x11, 0x10, 105 | 0x11, 0x10, 106 | 0x01, 0x00, 107 | 0x01, 0x00, 108 | 0x03, 0x00, 109 | 0x1F, 0xE0, 110 | 0x00, 0x00, 111 | 0x08, 0x40, 112 | 0x07, 0x80 113 | #endif 114 | #if CurAltHappyMac == kAHM_nerdy 115 | 0x38, 0x38, 116 | 0x45, 0x45, 117 | 0xD7, 0xD6, 118 | 0x45, 0x44, 119 | 0x39, 0x38, 120 | 0x03, 0x00, 121 | 0x00, 0x00, 122 | 0x00, 0x00, 123 | 0x0F, 0xC0, 124 | 0x00, 0x00 125 | #endif 126 | #if CurAltHappyMac == kAHM_pirate 127 | 0x00, 0x81, 128 | 0x00, 0x7E, 129 | 0x11, 0x7E, 130 | 0x11, 0x3C, 131 | 0x01, 0x3C, 132 | 0x01, 0x18, 133 | 0x03, 0x00, 134 | 0x00, 0x00, 135 | 0x08, 0x40, 136 | 0x07, 0x80 137 | #endif 138 | #if CurAltHappyMac == kAHM_sleepy 139 | 0x00, 0x00, 140 | 0x1C, 0x70, 141 | 0x22, 0x88, 142 | 0x00, 0x00, 143 | 0x1C, 0x70, 144 | 0x08, 0x20, 145 | 0x00, 0x00, 146 | 0x00, 0x00, 147 | 0x03, 0x80, 148 | 0x00, 0x00 149 | #endif 150 | #if CurAltHappyMac == kAHM_sly 151 | 0x00, 0x00, 152 | 0x08, 0x20, 153 | 0x14, 0x50, 154 | 0x00, 0x00, 155 | 0x00, 0x00, 156 | 0x20, 0x08, 157 | 0x3F, 0xF8, 158 | 0x00, 0x00, 159 | 0x00, 0x00, 160 | 0x00, 0x00 161 | #endif 162 | #if CurAltHappyMac == kAHM_sunglasses 163 | 0x00, 0x00, 164 | 0xFF, 0xFE, 165 | 0x7D, 0x7C, 166 | 0x7D, 0x7C, 167 | 0x39, 0x38, 168 | 0x03, 0x00, 169 | 0x00, 0x00, 170 | 0x1F, 0xF0, 171 | 0x00, 0x00, 172 | 0x00, 0x00 173 | #endif 174 | #if CurAltHappyMac == kAHM_surprise 175 | 0x1C, 0x70, 176 | 0x22, 0x88, 177 | 0x41, 0x04, 178 | 0x49, 0x24, 179 | 0x41, 0x04, 180 | 0x22, 0x88, 181 | 0x1C, 0x70, 182 | 0x01, 0x00, 183 | 0x03, 0x80, 184 | 0x03, 0x80 185 | #endif 186 | #if CurAltHappyMac == kAHM_tongue 187 | 0x00, 0x00, 188 | 0x1E, 0x78, 189 | 0x00, 0x00, 190 | 0x00, 0x00, 191 | 0x20, 0x04, 192 | 0x3F, 0xFC, 193 | 0x05, 0x40, 194 | 0x05, 0x40, 195 | 0x04, 0x40, 196 | 0x03, 0x80 197 | #endif 198 | #if CurAltHappyMac == kAHM_yuck 199 | 0x00, 0x00, 200 | 0x18, 0x30, 201 | 0x04, 0x40, 202 | 0x02, 0x80, 203 | 0x00, 0x00, 204 | 0x00, 0x00, 205 | 0x1F, 0xF0, 206 | 0x15, 0x50, 207 | 0x04, 0x40, 208 | 0x03, 0x80 209 | #endif 210 | #if CurAltHappyMac == kAHM_zombie 211 | 0x70, 0x7C, 212 | 0x88, 0x82, 213 | 0x88, 0x8A, 214 | 0xA8, 0x8A, 215 | 0x70, 0x82, 216 | 0x00, 0x42, 217 | 0x00, 0x3C, 218 | 0x1E, 0x00, 219 | 0x3F, 0x00, 220 | 0x3F, 0x00 221 | #endif 222 | }; 223 | 224 | #if CurEmMd <= kEmMd_Twig43 225 | #define HappyMacBase 0xA34 226 | #elif CurEmMd <= kEmMd_Twiggy 227 | #define HappyMacBase 0x8F4 228 | #elif CurEmMd <= kEmMd_128K 229 | #define HappyMacBase 0x8A0 230 | #elif CurEmMd <= kEmMd_Plus 231 | #define HappyMacBase 0xFD2 232 | #elif CurEmMd <= kEmMd_Classic 233 | #define HappyMacBase 0x125C 234 | #elif CurEmMd <= kEmMd_PB100 235 | #define HappyMacBase 0x2BB0 236 | #elif (CurEmMd == kEmMd_II) || (CurEmMd == kEmMd_IIx) 237 | #define HappyMacBase 0x1948 238 | #endif 239 | 240 | LOCALPROC PatchHappyMac(void) 241 | { 242 | #if (CurEmMd == kEmMd_PB100) \ 243 | || (CurEmMd == kEmMd_II) || (CurEmMd == kEmMd_IIx) 244 | 245 | int i; 246 | ui3b *dst = HappyMacBase + ROM + 0x18; 247 | ui3b *src = (ui3b *)my_HappyMac_icon; 248 | 249 | for (i = 10; --i >= 0; ) { 250 | ++dst; 251 | *dst++ = *src++; 252 | *dst++ = *src++; 253 | ++dst; 254 | } 255 | 256 | #else 257 | MyMoveBytes((anyp)my_HappyMac_icon, 258 | (anyp)(HappyMacBase + ROM), 259 | sizeof(my_HappyMac_icon)); 260 | #endif 261 | } 262 | -------------------------------------------------------------------------------- /minivmac/src/ICONAPPO.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/libretro-minivmac/2eb65cd5ca80174435867d2453d702390e5aab45/minivmac/src/ICONAPPO.icns -------------------------------------------------------------------------------- /minivmac/src/ICONAPPW.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/libretro-minivmac/2eb65cd5ca80174435867d2453d702390e5aab45/minivmac/src/ICONAPPW.ico -------------------------------------------------------------------------------- /minivmac/src/ICONDSKO.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/libretro-minivmac/2eb65cd5ca80174435867d2453d702390e5aab45/minivmac/src/ICONDSKO.icns -------------------------------------------------------------------------------- /minivmac/src/ICONDSKW.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/libretro-minivmac/2eb65cd5ca80174435867d2453d702390e5aab45/minivmac/src/ICONDSKW.ico -------------------------------------------------------------------------------- /minivmac/src/ICONROMO.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/libretro-minivmac/2eb65cd5ca80174435867d2453d702390e5aab45/minivmac/src/ICONROMO.icns -------------------------------------------------------------------------------- /minivmac/src/ICONROMW.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/libretro-minivmac/2eb65cd5ca80174435867d2453d702390e5aab45/minivmac/src/ICONROMW.ico -------------------------------------------------------------------------------- /minivmac/src/IWMEMDEV.c: -------------------------------------------------------------------------------- 1 | /* 2 | IWMEVDEV.c 3 | 4 | Copyright (C) 2006 Philip Cummins, Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | /* 18 | Integrated Woz Machine EMulated DEVice 19 | 20 | Emulates the IWM found in the Mac Plus. 21 | 22 | This code is adapted from "IWM.c" in vMac by Philip Cummins. 23 | */ 24 | 25 | /* 26 | This is the emulation for the IWM, the Integrated Woz Machine. 27 | It's basically a serial to parallel converter with some timing 28 | in-built into it to perform handshaking. Emulation so far just 29 | includes Status and Mode Register Accesses. 30 | */ 31 | 32 | #ifndef AllFiles 33 | #include "SYSDEPNS.h" 34 | 35 | #include "MYOSGLUE.h" 36 | #include "EMCONFIG.h" 37 | #include "GLOBGLUE.h" 38 | #endif 39 | 40 | #include "IWMEMDEV.h" 41 | 42 | /* 43 | ReportAbnormalID unused 0x0603 - 0x06FF 44 | */ 45 | 46 | #define kph0L 0x00 /* CA0 off (0) */ 47 | #define kph0H 0x01 /* CA0 on (1) */ 48 | #define kph1L 0x02 /* CA1 off (0) */ 49 | #define kph1H 0x03 /* CA1 on (1) */ 50 | #define kph2L 0x04 /* CA2 off (0) */ 51 | #define kph2H 0x05 /* CA2 on (1) */ 52 | #define kph3L 0x06 /* LSTRB off (low) */ 53 | #define kph3H 0x07 /* LSTRB on (high) */ 54 | #define kmtrOff 0x08 /* disk enable off */ 55 | #define kmtrOn 0x09 /* disk enable on */ 56 | #define kintDrive 0x0A /* select internal drive */ 57 | #define kextDrive 0x0B /* select external drive */ 58 | #define kq6L 0x0C /* Q6 off */ 59 | #define kq6H 0x0D /* Q6 on */ 60 | #define kq7L 0x0E /* Q7 off */ 61 | #define kq7H 0x0F /* Q7 on */ 62 | 63 | #define kph0 0x01 64 | #define kph1 0x02 65 | #define kph2 0x04 66 | #define kph3 0x08 67 | #define kmtr 0x10 68 | #define kdrv 0x20 69 | #define kq6 0x40 70 | #define kq7 0x80 71 | 72 | typedef struct 73 | { 74 | ui3b DataIn; /* Read Data Register */ 75 | ui3b Handshake; /* Read Handshake Register */ 76 | ui3b Status; /* Read Status Register */ 77 | ui3b Mode; 78 | /* Drive Off : Write Mode Register */ 79 | /* Drive On : Write Data Register */ 80 | ui3b DataOut; /* Write Data Register */ 81 | ui3b Lines; /* Used to Access Disk Drive Registers */ 82 | } IWM_Ty; 83 | 84 | IWM_Ty IWM; 85 | 86 | GLOBALPROC IWM_Reset(void) 87 | { 88 | IWM.DataIn = IWM.Handshake = IWM.Status = IWM.Mode = 89 | IWM.DataOut = IWM.Lines = 0; 90 | } 91 | 92 | typedef enum {On, Off} Mode_Ty; 93 | 94 | LOCALPROC IWM_Set_Lines(ui3b line, Mode_Ty the_mode) 95 | { 96 | if (the_mode == Off) { 97 | IWM.Lines &= (0xFF - line); 98 | } else { 99 | IWM.Lines |= line; 100 | } 101 | } 102 | 103 | LOCALFUNC ui3b IWM_Read_Reg(void) 104 | { 105 | switch ((IWM.Lines & (kq6 + kq7)) >> 6) { 106 | case 0 : 107 | #if (CurEmMd >= kEmMd_SE) && (CurEmMd <= kEmMd_IIx) 108 | /* don't report */ 109 | #else 110 | ReportAbnormalID(0x0601, "IWM Data Read"); 111 | #endif 112 | #ifdef _IWM_Debug 113 | printf("IWM Data Read\n"); 114 | #endif 115 | return IWM.DataIn; 116 | break; 117 | case 1 : 118 | #ifdef _IWM_Debug 119 | printf("IWM Status Read\n"); 120 | #endif 121 | return IWM.Status; 122 | break; 123 | case 2 : 124 | ReportAbnormalID(0x0602, "IWM Handshake Read"); 125 | #ifdef _IWM_Debug 126 | printf("IWM Handshake Read\n"); 127 | #endif 128 | return IWM.Handshake; 129 | break; 130 | case 3 : 131 | default : 132 | /* 133 | should alway be in 0-3, 134 | but compiler warnings don't know that 135 | */ 136 | return 0; 137 | break; 138 | } 139 | } 140 | 141 | LOCALPROC IWM_Write_Reg(ui3b in) 142 | { 143 | if (((IWM.Lines & kmtr) >> 4) == 0) { 144 | #ifdef _IWM_Debug 145 | printf("IWM Mode Register Write\n"); 146 | #endif 147 | IWM.Mode = in; 148 | IWM.Status = ((IWM.Status & 0xE0) + (IWM.Mode & 0x1F)); 149 | } 150 | } 151 | 152 | GLOBALFUNC ui5b IWM_Access(ui5b Data, blnr WriteMem, CPTR addr) 153 | { 154 | switch (addr) { 155 | case kph0L : 156 | IWM_Set_Lines(kph0, Off); 157 | break; 158 | case kph0H : 159 | IWM_Set_Lines(kph0, On); 160 | break; 161 | case kph1L : 162 | IWM_Set_Lines(kph1, Off); 163 | break; 164 | case kph1H : 165 | IWM_Set_Lines(kph1, On); 166 | break; 167 | case kph2L : 168 | IWM_Set_Lines(kph2, Off); 169 | break; 170 | case kph2H : 171 | IWM_Set_Lines(kph2, On); 172 | break; 173 | case kph3L : 174 | IWM_Set_Lines(kph3, Off); 175 | break; 176 | case kph3H : 177 | IWM_Set_Lines(kph3, On); 178 | break; 179 | case kmtrOff : 180 | IWM.Status &= 0xDF; 181 | IWM_Set_Lines(kmtr, Off); 182 | break; 183 | case kmtrOn : 184 | IWM.Status |= 0x20; 185 | IWM_Set_Lines(kmtr, On); 186 | break; 187 | case kintDrive : 188 | IWM_Set_Lines(kdrv, Off); 189 | break; 190 | case kextDrive : 191 | IWM_Set_Lines(kdrv, On); 192 | break; 193 | case kq6L : 194 | IWM_Set_Lines(kq6, Off); 195 | break; 196 | case kq6H : 197 | IWM_Set_Lines(kq6, On); 198 | break; 199 | case kq7L : 200 | if (! WriteMem) { 201 | Data = IWM_Read_Reg(); 202 | } 203 | IWM_Set_Lines(kq7, Off); 204 | break; 205 | case kq7H : 206 | if (WriteMem) { 207 | IWM_Write_Reg(Data); 208 | } 209 | IWM_Set_Lines(kq7, On); 210 | break; 211 | } 212 | 213 | return Data; 214 | } 215 | -------------------------------------------------------------------------------- /minivmac/src/IWMEMDEV.h: -------------------------------------------------------------------------------- 1 | /* 2 | IWMEVDEV.h 3 | 4 | Copyright (C) 2004 Philip Cummins, Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | #ifdef IWMEVDEV_H 18 | #error "header already included" 19 | #else 20 | #define IWMEVDEV_H 21 | #endif 22 | 23 | EXPORTPROC IWM_Reset(void); 24 | 25 | EXPORTFUNC ui5b IWM_Access(ui5b Data, blnr WriteMem, CPTR addr); 26 | -------------------------------------------------------------------------------- /minivmac/src/KBRDEMDV.c: -------------------------------------------------------------------------------- 1 | /* 2 | KBRDEMDV.c 3 | 4 | Copyright (C) 2006 Philip Cummins, Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | /* 18 | KeyBoaRD EMulated DeVice 19 | 20 | Emulation of the keyboard in the Mac Plus. 21 | 22 | This code adapted from "Keyboard.c" in vMac by Philip Cummins. 23 | */ 24 | 25 | #ifndef AllFiles 26 | #include "SYSDEPNS.h" 27 | #include "MYOSGLUE.h" 28 | #include "EMCONFIG.h" 29 | #include "GLOBGLUE.h" 30 | #endif 31 | 32 | #include "KBRDEMDV.h" 33 | 34 | #ifdef _VIA_Debug 35 | #include 36 | #endif 37 | 38 | /* 39 | ReportAbnormalID unused 0x0B03 - 0x0BFF 40 | */ 41 | 42 | IMPORTPROC KYBD_ShiftOutData(ui3b v); 43 | IMPORTFUNC ui3b KYBD_ShiftInData(void); 44 | 45 | enum { 46 | kKybdStateIdle, 47 | kKybdStateRecievingCommand, 48 | kKybdStateRecievedCommand, 49 | kKybdStateRecievingEndCommand, 50 | 51 | kKybdStates 52 | }; 53 | 54 | LOCALVAR int KybdState = kKybdStateIdle; 55 | 56 | LOCALVAR blnr HaveKeyBoardResult = falseblnr; 57 | LOCALVAR ui3b KeyBoardResult; 58 | 59 | LOCALPROC GotKeyBoardData(ui3b v) 60 | { 61 | if (KybdState != kKybdStateIdle) { 62 | HaveKeyBoardResult = trueblnr; 63 | KeyBoardResult = v; 64 | } else { 65 | KYBD_ShiftOutData(v); 66 | VIA1_iCB2 = 1; 67 | } 68 | } 69 | 70 | LOCALVAR ui3b InstantCommandData = 0x7B; 71 | 72 | LOCALFUNC blnr AttemptToFinishInquiry(void) 73 | { 74 | int i; 75 | blnr KeyDown; 76 | ui3b Keyboard_Data; 77 | 78 | if (FindKeyEvent(&i, &KeyDown)) { 79 | if (i < 64) { 80 | Keyboard_Data = i << 1; 81 | if (! KeyDown) { 82 | Keyboard_Data += 128; 83 | } 84 | } else { 85 | Keyboard_Data = 121; 86 | InstantCommandData = (i - 64) << 1; 87 | if (! KeyDown) { 88 | InstantCommandData += 128; 89 | } 90 | } 91 | GotKeyBoardData(Keyboard_Data); 92 | return trueblnr; 93 | } else { 94 | return falseblnr; 95 | } 96 | } 97 | 98 | #define MaxKeyboardWait 16 /* in 60ths of a second */ 99 | /* 100 | Code in the mac rom will reset the keyboard if 101 | it hasn't been heard from in 32/60th of a second. 102 | So time out and send something before that 103 | to keep connection. 104 | */ 105 | 106 | LOCALVAR int InquiryCommandTimer = 0; 107 | 108 | GLOBALPROC DoKybd_ReceiveCommand(void) 109 | { 110 | if (KybdState != kKybdStateRecievingCommand) { 111 | ReportAbnormalID(0x0B01, 112 | "KybdState != kKybdStateRecievingCommand"); 113 | } else { 114 | ui3b in = KYBD_ShiftInData(); 115 | 116 | KybdState = kKybdStateRecievedCommand; 117 | 118 | switch (in) { 119 | case 0x10 : /* Inquiry Command */ 120 | if (! AttemptToFinishInquiry()) { 121 | InquiryCommandTimer = MaxKeyboardWait; 122 | } 123 | break; 124 | case 0x14 : /* Instant Command */ 125 | GotKeyBoardData(InstantCommandData); 126 | InstantCommandData = 0x7B; 127 | break; 128 | case 0x16 : /* Model Command */ 129 | GotKeyBoardData(0x0b /* 0x01 */); 130 | /* Test value, means Model 0, no extra devices */ 131 | /* 132 | Fixed by Hoshi Takanori - 133 | it uses the proper keyboard type now 134 | */ 135 | break; 136 | case 0x36 : /* Test Command */ 137 | GotKeyBoardData(0x7D); 138 | break; 139 | case 0x00: 140 | GotKeyBoardData(0); 141 | break; 142 | default : 143 | /* Debugger(); */ 144 | GotKeyBoardData(0); 145 | break; 146 | } 147 | } 148 | } 149 | 150 | GLOBALPROC DoKybd_ReceiveEndCommand(void) 151 | { 152 | if (KybdState != kKybdStateRecievingEndCommand) { 153 | ReportAbnormalID(0x0B02, 154 | "KybdState != kKybdStateRecievingEndCommand"); 155 | } else { 156 | KybdState = kKybdStateIdle; 157 | #ifdef _VIA_Debug 158 | fprintf(stderr, "enter DoKybd_ReceiveEndCommand\n"); 159 | #endif 160 | if (HaveKeyBoardResult) { 161 | #ifdef _VIA_Debug 162 | fprintf(stderr, "HaveKeyBoardResult: %d\n", KeyBoardResult); 163 | #endif 164 | HaveKeyBoardResult = falseblnr; 165 | KYBD_ShiftOutData(KeyBoardResult); 166 | VIA1_iCB2 = 1; 167 | } 168 | } 169 | } 170 | 171 | GLOBALPROC Kybd_DataLineChngNtfy(void) 172 | { 173 | switch (KybdState) { 174 | case kKybdStateIdle: 175 | if (VIA1_iCB2 == 0) { 176 | KybdState = kKybdStateRecievingCommand; 177 | #ifdef _VIA_Debug 178 | fprintf(stderr, "posting kICT_Kybd_ReceiveCommand\n"); 179 | #endif 180 | ICT_add(kICT_Kybd_ReceiveCommand, 181 | 6800UL * kCycleScale / 64 * kMyClockMult); 182 | 183 | if (InquiryCommandTimer != 0) { 184 | InquiryCommandTimer = 0; /* abort Inquiry */ 185 | } 186 | } 187 | break; 188 | case kKybdStateRecievedCommand: 189 | if (VIA1_iCB2 == 1) { 190 | KybdState = kKybdStateRecievingEndCommand; 191 | #ifdef _VIA_Debug 192 | fprintf(stderr, 193 | "posting kICT_Kybd_ReceiveEndCommand\n"); 194 | #endif 195 | ICT_add(kICT_Kybd_ReceiveEndCommand, 196 | 6800UL * kCycleScale / 64 * kMyClockMult); 197 | } 198 | break; 199 | } 200 | } 201 | 202 | GLOBALPROC KeyBoard_Update(void) 203 | { 204 | if (InquiryCommandTimer != 0) { 205 | if (AttemptToFinishInquiry()) { 206 | InquiryCommandTimer = 0; 207 | } else { 208 | --InquiryCommandTimer; 209 | if (InquiryCommandTimer == 0) { 210 | GotKeyBoardData(0x7B); 211 | } 212 | } 213 | } 214 | } 215 | -------------------------------------------------------------------------------- /minivmac/src/KBRDEMDV.h: -------------------------------------------------------------------------------- 1 | /* 2 | KBRDEMDV.h 3 | 4 | Copyright (C) 2003 Philip Cummins, Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | #ifdef KBRDEMDV_H 18 | #error "header already included" 19 | #else 20 | #define KBRDEMDV_H 21 | #endif 22 | 23 | 24 | EXPORTPROC Kybd_DataLineChngNtfy(void); 25 | EXPORTPROC DoKybd_ReceiveEndCommand(void); 26 | EXPORTPROC DoKybd_ReceiveCommand(void); 27 | EXPORTPROC KeyBoard_Update(void); 28 | -------------------------------------------------------------------------------- /minivmac/src/M68KITAB.h: -------------------------------------------------------------------------------- 1 | /* 2 | M68KITAB.h 3 | 4 | Copyright (C) 2007, Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | #ifdef M68KITAB_H 18 | #error "header already included" 19 | #else 20 | #define M68KITAB_H 21 | #endif 22 | 23 | enum { 24 | kIKindTst, 25 | kIKindCmpB, 26 | kIKindCmpW, 27 | kIKindCmpL, 28 | kIKindBccB, 29 | kIKindBccW, 30 | kIKindBraB, 31 | kIKindBraW, 32 | kIKindDBcc, 33 | kIKindDBF, 34 | kIKindSwap, 35 | kIKindMoveL, 36 | kIKindMoveW, 37 | kIKindMoveB, 38 | kIKindMoveAL, 39 | kIKindMoveAW, 40 | kIKindMoveQ, 41 | kIKindAddB, 42 | kIKindAddW, 43 | kIKindAddL, 44 | kIKindSubB, 45 | kIKindSubW, 46 | kIKindSubL, 47 | kIKindLea, 48 | kIKindPEA, 49 | kIKindA, 50 | kIKindBsrB, 51 | kIKindBsrW, 52 | kIKindJsr, 53 | kIKindLinkA6, 54 | kIKindMOVEMRmML, 55 | kIKindMOVEMApRL, 56 | kIKindUnlkA6, 57 | kIKindRts, 58 | kIKindJmp, 59 | kIKindClr, 60 | kIKindAddA, 61 | kIKindAddQA, 62 | kIKindSubA, 63 | kIKindSubQA, 64 | kIKindCmpA, 65 | kIKindAddXB, 66 | kIKindAddXW, 67 | kIKindAddXL, 68 | kIKindSubXB, 69 | kIKindSubXW, 70 | kIKindSubXL, 71 | kIKindAslB, 72 | kIKindAslW, 73 | kIKindAslL, 74 | kIKindAsrB, 75 | kIKindAsrW, 76 | kIKindAsrL, 77 | kIKindLslB, 78 | kIKindLslW, 79 | kIKindLslL, 80 | kIKindLsrB, 81 | kIKindLsrW, 82 | kIKindLsrL, 83 | kIKindRxlB, 84 | kIKindRxlW, 85 | kIKindRxlL, 86 | kIKindRxrB, 87 | kIKindRxrW, 88 | kIKindRxrL, 89 | kIKindRolB, 90 | kIKindRolW, 91 | kIKindRolL, 92 | kIKindRorB, 93 | kIKindRorW, 94 | kIKindRorL, 95 | kIKindBTstB, 96 | kIKindBChgB, 97 | kIKindBClrB, 98 | kIKindBSetB, 99 | kIKindBTstL, 100 | kIKindBChgL, 101 | kIKindBClrL, 102 | kIKindBSetL, 103 | kIKindAndI, 104 | kIKindAndEaD, 105 | kIKindAndDEa, 106 | kIKindOrI, 107 | kIKindOrDEa, 108 | kIKindOrEaD, 109 | kIKindEor, 110 | kIKindEorI, 111 | kIKindNot, 112 | kIKindScc, 113 | kIKindNegXB, 114 | kIKindNegXW, 115 | kIKindNegXL, 116 | kIKindNegB, 117 | kIKindNegW, 118 | kIKindNegL, 119 | kIKindEXTW, 120 | kIKindEXTL, 121 | kIKindMulU, 122 | kIKindMulS, 123 | kIKindDivU, 124 | kIKindDivS, 125 | kIKindExg, 126 | kIKindMoveEaCCR, 127 | kIKindMoveSREa, 128 | kIKindMoveEaSR, 129 | kIKindOrISR, 130 | kIKindAndISR, 131 | kIKindEorISR, 132 | kIKindOrICCR, 133 | kIKindAndICCR, 134 | kIKindEorICCR, 135 | kIKindMOVEMApRW, 136 | kIKindMOVEMRmMW, 137 | kIKindMOVEMrmW, 138 | kIKindMOVEMrmL, 139 | kIKindMOVEMmrW, 140 | kIKindMOVEMmrL, 141 | kIKindAbcd, 142 | kIKindSbcd, 143 | kIKindNbcd, 144 | kIKindRte, 145 | kIKindNop, 146 | kIKindMoveP0, 147 | kIKindMoveP1, 148 | kIKindMoveP2, 149 | kIKindMoveP3, 150 | kIKindIllegal, 151 | kIKindChkW, 152 | kIKindTrap, 153 | kIKindTrapV, 154 | kIKindRtr, 155 | kIKindLink, 156 | kIKindUnlk, 157 | kIKindMoveRUSP, 158 | kIKindMoveUSPR, 159 | kIKindTas, 160 | kIKindFdflt, 161 | kIKindStop, 162 | kIKindReset, 163 | 164 | #if Use68020 165 | kIKindCallMorRtm, 166 | kIKindBraL, 167 | kIKindBccL, 168 | kIKindBsrL, 169 | kIKindEXTBL, 170 | kIKindTRAPcc, 171 | kIKindChkL, 172 | kIKindBkpt, 173 | kIKindDivL, 174 | kIKindMulL, 175 | kIKindRtd, 176 | kIKindMoveCCREa, 177 | kIKindMoveCEa, 178 | kIKindMoveEaC, 179 | kIKindLinkL, 180 | kIKindPack, 181 | kIKindUnpk, 182 | kIKindCHK2orCMP2, 183 | kIKindCAS2, 184 | kIKindCAS, 185 | kIKindMoveS, 186 | kIKindBitField, 187 | #endif 188 | #if EmMMU 189 | kIKindMMU, 190 | #endif 191 | #if EmFPU 192 | kIKindFPUmd60, 193 | kIKindFPUDBcc, 194 | kIKindFPUTrapcc, 195 | kIKindFPUScc, 196 | kIKindFPUFBccW, 197 | kIKindFPUFBccL, 198 | kIKindFPUSave, 199 | kIKindFPURestore, 200 | kIKindFPUdflt, 201 | #endif 202 | 203 | kNumIKinds 204 | }; 205 | 206 | enum { 207 | kAMdRegB, 208 | kAMdRegW, 209 | kAMdRegL, 210 | kAMdIndirectB, 211 | kAMdIndirectW, 212 | kAMdIndirectL, 213 | kAMdAPosIncB, 214 | kAMdAPosIncW, 215 | kAMdAPosIncL, 216 | kAMdAPosInc7B, 217 | kAMdAPreDecB, 218 | kAMdAPreDecW, 219 | kAMdAPreDecL, 220 | kAMdAPreDec7B, 221 | kAMdADispB, 222 | kAMdADispW, 223 | kAMdADispL, 224 | kAMdAIndexB, 225 | kAMdAIndexW, 226 | kAMdAIndexL, 227 | kAMdAbsWB, 228 | kAMdAbsWW, 229 | kAMdAbsWL, 230 | kAMdAbsLB, 231 | kAMdAbsLW, 232 | kAMdAbsLL, 233 | kAMdPCDispB, 234 | kAMdPCDispW, 235 | kAMdPCDispL, 236 | kAMdPCIndexB, 237 | kAMdPCIndexW, 238 | kAMdPCIndexL, 239 | kAMdImmedB, 240 | kAMdImmedW, 241 | kAMdImmedL, 242 | kAMdDat4, 243 | 244 | kNumAMds 245 | }; 246 | 247 | struct DecOpXR { 248 | /* expected size : 4 bytes */ 249 | ui4b MainClas; 250 | ui4b Cycles; 251 | }; 252 | typedef struct DecOpXR DecOpXR; 253 | 254 | struct DecArgR { 255 | /* expected size : 2 bytes */ 256 | ui3b AMd; 257 | ui3b ArgDat; 258 | }; 259 | typedef struct DecArgR DecArgR; 260 | 261 | struct DecOpYR { 262 | /* expected size : 4 bytes */ 263 | DecArgR v[2]; 264 | }; 265 | typedef struct DecOpYR DecOpYR; 266 | 267 | struct DecOpR { 268 | /* expected size : 8 bytes */ 269 | DecOpXR x; 270 | DecOpYR y; 271 | } my_align_8; 272 | typedef struct DecOpR DecOpR; 273 | 274 | #define GetDcoCycles(p) ((p)->x.Cycles) 275 | 276 | #define SetDcoMainClas(p, xx) ((p)->x.MainClas = (xx)) 277 | #define SetDcoCycles(p, xx) ((p)->x.Cycles = (xx)) 278 | 279 | EXPORTPROC M68KITAB_setup(DecOpR *p); 280 | -------------------------------------------------------------------------------- /minivmac/src/MINEM68K.h: -------------------------------------------------------------------------------- 1 | /* 2 | MINEM68K.h 3 | 4 | Copyright (C) 2004 Bernd Schmidt, Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | #ifdef MINEM68K_H 18 | #error "header already included" 19 | #else 20 | #define MINEM68K_H 21 | #endif 22 | 23 | EXPORTPROC MINEM68K_Init( 24 | ui3b *fIPL); 25 | #if SmallGlobals 26 | EXPORTPROC MINEM68K_ReserveAlloc(void); 27 | #endif 28 | 29 | EXPORTPROC m68k_IPLchangeNtfy(void); 30 | EXPORTPROC DiskInsertedPsuedoException(CPTR newpc, ui5b data); 31 | EXPORTPROC m68k_reset(void); 32 | 33 | EXPORTFUNC si5r GetCyclesRemaining(void); 34 | EXPORTPROC SetCyclesRemaining(si5r n); 35 | 36 | EXPORTPROC m68k_go_nCycles(ui5b n); 37 | 38 | /* 39 | general purpose access of address space 40 | of emulated computer. (memory and 41 | memory mapped hardware.) 42 | */ 43 | 44 | EXPORTFUNC ui3r get_vm_byte(CPTR addr); 45 | EXPORTFUNC ui4r get_vm_word(CPTR addr); 46 | EXPORTFUNC ui5r get_vm_long(CPTR addr); 47 | 48 | EXPORTPROC put_vm_byte(CPTR addr, ui3r b); 49 | EXPORTPROC put_vm_word(CPTR addr, ui4r w); 50 | EXPORTPROC put_vm_long(CPTR addr, ui5r l); 51 | 52 | EXPORTPROC SetHeadATTel(ATTep p); 53 | EXPORTFUNC ATTep FindATTel(CPTR addr); 54 | -------------------------------------------------------------------------------- /minivmac/src/MOUSEMDV.c: -------------------------------------------------------------------------------- 1 | /* 2 | MOUSEMDV.c 3 | 4 | Copyright (C) 2006 Philip Cummins, Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | /* 18 | MOUSe EMulated DeVice 19 | 20 | Emulation of the mouse in the Mac Plus. 21 | 22 | This code descended from "Mouse-MacOS.c" in Richard F. Bannister's 23 | Macintosh port of vMac, by Philip Cummins. 24 | */ 25 | 26 | #ifndef AllFiles 27 | #include "SYSDEPNS.h" 28 | #include "MYOSGLUE.h" 29 | #include "ENDIANAC.h" 30 | #include "EMCONFIG.h" 31 | #include "GLOBGLUE.h" 32 | #include "SCCEMDEV.h" 33 | #include "MINEM68K.h" 34 | #endif 35 | 36 | #include "MOUSEMDV.h" 37 | 38 | GLOBALPROC Mouse_Update(void) 39 | { 40 | #if HaveMasterMyEvtQLock 41 | if (0 != MasterMyEvtQLock) { 42 | --MasterMyEvtQLock; 43 | } 44 | #endif 45 | 46 | /* 47 | Check mouse position first. After mouse button or key event, 48 | can't process another mouse position until following tick, 49 | otherwise button or key will be in wrong place. 50 | */ 51 | 52 | /* 53 | if start doing this too soon after boot, 54 | will mess up memory check 55 | */ 56 | if (Mouse_Enabled()) { 57 | MyEvtQEl *p; 58 | 59 | if ( 60 | #if HaveMasterMyEvtQLock 61 | (0 == MasterMyEvtQLock) && 62 | #endif 63 | (nullpr != (p = MyEvtQOutP()))) 64 | { 65 | #if EmClassicKbrd 66 | #if EnableMouseMotion 67 | if (MyEvtQElKindMouseDelta == p->kind) { 68 | 69 | if ((p->u.pos.h != 0) || (p->u.pos.v != 0)) { 70 | put_ram_word(0x0828, 71 | get_ram_word(0x0828) + p->u.pos.v); 72 | put_ram_word(0x082A, 73 | get_ram_word(0x082A) + p->u.pos.h); 74 | put_ram_byte(0x08CE, get_ram_byte(0x08CF)); 75 | /* Tell MacOS to redraw the Mouse */ 76 | } 77 | MyEvtQOutDone(); 78 | } else 79 | #endif 80 | #endif 81 | if (MyEvtQElKindMousePos == p->kind) { 82 | ui5r NewMouse = (p->u.pos.v << 16) | p->u.pos.h; 83 | 84 | if (get_ram_long(0x0828) != NewMouse) { 85 | put_ram_long(0x0828, NewMouse); 86 | /* Set Mouse Position */ 87 | put_ram_long(0x082C, NewMouse); 88 | #if EmClassicKbrd 89 | put_ram_byte(0x08CE, get_ram_byte(0x08CF)); 90 | /* Tell MacOS to redraw the Mouse */ 91 | #else 92 | put_ram_long(0x0830, NewMouse); 93 | put_ram_byte(0x08CE, 0xFF); 94 | /* Tell MacOS to redraw the Mouse */ 95 | #endif 96 | } 97 | MyEvtQOutDone(); 98 | } 99 | } 100 | } 101 | 102 | #if EmClassicKbrd 103 | { 104 | MyEvtQEl *p; 105 | 106 | if ( 107 | #if HaveMasterMyEvtQLock 108 | (0 == MasterMyEvtQLock) && 109 | #endif 110 | (nullpr != (p = MyEvtQOutP()))) 111 | { 112 | if (MyEvtQElKindMouseButton == p->kind) { 113 | MouseBtnUp = p->u.press.down ? 0 : 1; 114 | MyEvtQOutDone(); 115 | MasterMyEvtQLock = 4; 116 | } 117 | } 118 | } 119 | #endif 120 | } 121 | 122 | GLOBALPROC Mouse_EndTickNotify(void) 123 | { 124 | if (Mouse_Enabled()) { 125 | /* tell platform specific code where the mouse went */ 126 | CurMouseV = get_ram_word(0x082C); 127 | CurMouseH = get_ram_word(0x082E); 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /minivmac/src/MOUSEMDV.h: -------------------------------------------------------------------------------- 1 | /* 2 | MOUSEMDV.h 3 | 4 | Copyright (C) 2003 Philip Cummins, Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | #ifdef MOUSEMDV_H 18 | #error "header already included" 19 | #else 20 | #define MOUSEMDV_H 21 | #endif 22 | 23 | EXPORTPROC Mouse_Update(void); 24 | EXPORTPROC Mouse_EndTickNotify(void); 25 | -------------------------------------------------------------------------------- /minivmac/src/PBUFSTDC.h: -------------------------------------------------------------------------------- 1 | /* 2 | PBUFSTDC.h 3 | 4 | Copyright (C) 2018 Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | /* 18 | Parameter BUFfers implemented with STanDard C library 19 | */ 20 | 21 | 22 | #if IncludePbufs 23 | LOCALVAR void *PbufDat[NumPbufs]; 24 | #endif 25 | 26 | #if IncludePbufs 27 | LOCALFUNC tMacErr PbufNewFromPtr(void *p, ui5b count, tPbuf *r) 28 | { 29 | tPbuf i; 30 | tMacErr err; 31 | 32 | if (! FirstFreePbuf(&i)) { 33 | free(p); 34 | err = mnvm_miscErr; 35 | } else { 36 | *r = i; 37 | PbufDat[i] = p; 38 | PbufNewNotify(i, count); 39 | err = mnvm_noErr; 40 | } 41 | 42 | return err; 43 | } 44 | #endif 45 | 46 | #if IncludePbufs 47 | LOCALPROC PbufKillToPtr(void **p, ui5r *count, tPbuf r) 48 | { 49 | *p = PbufDat[r]; 50 | *count = PbufSize[r]; 51 | 52 | PbufDisposeNotify(r); 53 | } 54 | #endif 55 | 56 | #if IncludePbufs 57 | GLOBALOSGLUFUNC tMacErr PbufNew(ui5b count, tPbuf *r) 58 | { 59 | tMacErr err = mnvm_miscErr; 60 | 61 | void *p = calloc(1, count); 62 | if (NULL != p) { 63 | err = PbufNewFromPtr(p, count, r); 64 | } 65 | 66 | return err; 67 | } 68 | #endif 69 | 70 | #if IncludePbufs 71 | GLOBALOSGLUPROC PbufDispose(tPbuf i) 72 | { 73 | void *p; 74 | ui5r count; 75 | 76 | PbufKillToPtr(&p, &count, i); 77 | 78 | free(p); 79 | } 80 | #endif 81 | 82 | #if IncludePbufs 83 | LOCALPROC UnInitPbufs(void) 84 | { 85 | tPbuf i; 86 | 87 | for (i = 0; i < NumPbufs; ++i) { 88 | if (PbufIsAllocated(i)) { 89 | PbufDispose(i); 90 | } 91 | } 92 | } 93 | #endif 94 | 95 | #if IncludePbufs 96 | #define PbufHaveLock 1 97 | #endif 98 | 99 | #if IncludePbufs 100 | LOCALFUNC ui3p PbufLock(tPbuf i) 101 | { 102 | return (ui3p)PbufDat[i]; 103 | } 104 | #endif 105 | 106 | #if IncludePbufs 107 | #define PbufUnlock(i) 108 | #endif 109 | 110 | #if IncludePbufs 111 | GLOBALOSGLUPROC PbufTransfer(ui3p Buffer, 112 | tPbuf i, ui5r offset, ui5r count, blnr IsWrite) 113 | { 114 | void *p = ((ui3p)PbufDat[i]) + offset; 115 | if (IsWrite) { 116 | (void) memcpy(p, Buffer, count); 117 | } else { 118 | (void) memcpy(Buffer, p, count); 119 | } 120 | } 121 | #endif 122 | -------------------------------------------------------------------------------- /minivmac/src/PMUEMDEV.h: -------------------------------------------------------------------------------- 1 | /* 2 | PMUEMDEV.h 3 | 4 | Copyright (C) 2008 Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | #ifdef PMUEMDEV_H 18 | #error "header already included" 19 | #else 20 | #define PMUEMDEV_H 21 | #endif 22 | 23 | EXPORTPROC PmuToReady_ChangeNtfy(void); 24 | EXPORTPROC PMU_DoTask(void); 25 | -------------------------------------------------------------------------------- /minivmac/src/PROGMAIN.h: -------------------------------------------------------------------------------- 1 | /* 2 | PROGMAIN.h 3 | 4 | Copyright (C) 2009 Philip Cummins, Richard F. Bannister, 5 | Paul C. Pratt 6 | 7 | You can redistribute this file and/or modify it under the terms 8 | of version 2 of the GNU General Public License as published by 9 | the Free Software Foundation. You should have received a copy 10 | of the license along with this file; see the file COPYING. 11 | 12 | This file is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | license for more details. 16 | */ 17 | 18 | #ifdef PROGMAIN_H 19 | #error "header already included" 20 | #else 21 | #define PROGMAIN_H 22 | #endif 23 | 24 | EXPORTPROC EmulationReserveAlloc(void); 25 | EXPORTPROC ProgramMain(void); 26 | -------------------------------------------------------------------------------- /minivmac/src/ROMEMDEV.h: -------------------------------------------------------------------------------- 1 | /* 2 | ROMEMDEV.h 3 | 4 | Copyright (C) 2003 Philip Cummins, Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | #ifdef ROMEMDEV_H 18 | #error "header already included" 19 | #else 20 | #define ROMEMDEV_H 21 | #endif 22 | 23 | EXPORTFUNC blnr ROM_Init(void); 24 | -------------------------------------------------------------------------------- /minivmac/src/RTCEMDEV.h: -------------------------------------------------------------------------------- 1 | /* 2 | RTCEMDEV.h 3 | 4 | Copyright (C) 2003 Philip Cummins, Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | #ifdef RTCEMDEV_H 18 | #error "header already included" 19 | #else 20 | #define RTCEMDEV_H 21 | #endif 22 | 23 | EXPORTFUNC blnr RTC_Init(void); 24 | EXPORTPROC RTC_Interrupt(void); 25 | 26 | EXPORTPROC RTCunEnabled_ChangeNtfy(void); 27 | EXPORTPROC RTCclock_ChangeNtfy(void); 28 | EXPORTPROC RTCdataLine_ChangeNtfy(void); 29 | -------------------------------------------------------------------------------- /minivmac/src/SCCEMDEV.h: -------------------------------------------------------------------------------- 1 | /* 2 | SCCEMDEV.h 3 | 4 | Copyright (C) 2004 Philip Cummins, Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | #ifdef SCCEMDEV_H 18 | #error "header already included" 19 | #else 20 | #define SCCEMDEV_H 21 | #endif 22 | 23 | EXPORTPROC SCC_Reset(void); 24 | 25 | EXPORTFUNC ui5b SCC_Access(ui5b Data, blnr WriteMem, CPTR addr); 26 | 27 | EXPORTFUNC blnr SCC_InterruptsEnabled(void); 28 | 29 | #if EmLocalTalk 30 | EXPORTPROC LocalTalkTick(void); 31 | EXPORTFUNC int InitLocalTalk(void); 32 | #endif 33 | -------------------------------------------------------------------------------- /minivmac/src/SCRNEMDV.c: -------------------------------------------------------------------------------- 1 | /* 2 | SCRNEMDV.c 3 | 4 | Copyright (C) 2006 Philip Cummins, Richard F. Bannister, 5 | Paul C. Pratt 6 | 7 | You can redistribute this file and/or modify it under the terms 8 | of version 2 of the GNU General Public License as published by 9 | the Free Software Foundation. You should have received a copy 10 | of the license along with this file; see the file COPYING. 11 | 12 | This file is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | license for more details. 16 | */ 17 | 18 | /* 19 | SCReeN EMulated DeVice 20 | 21 | Emulation of the screen in the Mac Plus. 22 | 23 | This code descended from "Screen-MacOS.c" in Richard F. Bannister's 24 | Macintosh port of vMac, by Philip Cummins. 25 | */ 26 | 27 | #ifndef AllFiles 28 | #include "SYSDEPNS.h" 29 | #include "MYOSGLUE.h" 30 | #include "ENDIANAC.h" 31 | #include "EMCONFIG.h" 32 | #include "GLOBGLUE.h" 33 | #endif 34 | 35 | #include "SCRNEMDV.h" 36 | 37 | #if ! IncludeVidMem 38 | #define kMain_Offset 0x5900 39 | #define kAlternate_Offset 0xD900 40 | #define kMain_Buffer (kRAM_Size - kMain_Offset) 41 | #define kAlternate_Buffer (kRAM_Size - kAlternate_Offset) 42 | #endif 43 | 44 | GLOBALPROC Screen_EndTickNotify(void) 45 | { 46 | ui3p screencurrentbuff; 47 | 48 | #if IncludeVidMem 49 | screencurrentbuff = VidMem; 50 | #else 51 | if (SCRNvPage2 == 1) { 52 | screencurrentbuff = get_ram_address(kMain_Buffer); 53 | } else { 54 | screencurrentbuff = get_ram_address(kAlternate_Buffer); 55 | } 56 | #endif 57 | 58 | Screen_OutputFrame(screencurrentbuff); 59 | } 60 | -------------------------------------------------------------------------------- /minivmac/src/SCRNEMDV.h: -------------------------------------------------------------------------------- 1 | /* 2 | SCRNEMDV.h 3 | 4 | Copyright (C) 2006 Philip Cummins, Richard F. Bannister, 5 | Paul C. Pratt 6 | 7 | You can redistribute this file and/or modify it under the terms 8 | of version 2 of the GNU General Public License as published by 9 | the Free Software Foundation. You should have received a copy 10 | of the license along with this file; see the file COPYING. 11 | 12 | This file is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | license for more details. 16 | */ 17 | 18 | #ifdef SCRNEMDV_H 19 | #error "header already included" 20 | #else 21 | #define SCRNEMDV_H 22 | #endif 23 | 24 | EXPORTPROC Screen_EndTickNotify(void); 25 | -------------------------------------------------------------------------------- /minivmac/src/SCRNMAPR.h: -------------------------------------------------------------------------------- 1 | /* 2 | SCRNMAPR.h 3 | 4 | Copyright (C) 2012 Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | /* 18 | SCReeN MAPpeR 19 | */ 20 | 21 | /* required arguments for this template */ 22 | 23 | #ifndef ScrnMapr_DoMap /* procedure to be created by this template */ 24 | #error "ScrnMapr_DoMap not defined" 25 | #endif 26 | #ifndef ScrnMapr_Src 27 | #error "ScrnMapr_Src not defined" 28 | #endif 29 | #ifndef ScrnMapr_Dst 30 | #error "ScrnMapr_Dst not defined" 31 | #endif 32 | #ifndef ScrnMapr_SrcDepth 33 | #error "ScrnMapr_SrcDepth not defined" 34 | #endif 35 | #ifndef ScrnMapr_DstDepth 36 | #error "ScrnMapr_DstDepth not defined" 37 | #endif 38 | #ifndef ScrnMapr_Map 39 | #error "ScrnMapr_Map not defined" 40 | #endif 41 | 42 | /* optional argument for this template */ 43 | 44 | #ifndef ScrnMapr_Scale 45 | #define ScrnMapr_Scale 1 46 | #endif 47 | 48 | /* check of parameters */ 49 | 50 | #if (ScrnMapr_SrcDepth < 0) || (ScrnMapr_SrcDepth > 3) 51 | #error "bad ScrnMapr_SrcDepth" 52 | #endif 53 | 54 | #if (ScrnMapr_DstDepth < ScrnMapr_SrcDepth) 55 | #error "bad ScrnMapr_Dst" 56 | #endif 57 | 58 | /* calculate a few things local to this template */ 59 | 60 | #define ScrnMapr_MapElSz \ 61 | (ScrnMapr_Scale << (ScrnMapr_DstDepth - ScrnMapr_SrcDepth)) 62 | 63 | #if 0 == (ScrnMapr_MapElSz & 3) 64 | #define ScrnMapr_TranT ui5b 65 | #define ScrnMapr_TranLn2Sz 2 66 | #elif 0 == (ScrnMapr_MapElSz & 1) 67 | #define ScrnMapr_TranT ui4b 68 | #define ScrnMapr_TranLn2Sz 1 69 | #else 70 | #define ScrnMapr_TranT ui3b 71 | #define ScrnMapr_TranLn2Sz 0 72 | #endif 73 | 74 | #define ScrnMapr_TranN (ScrnMapr_MapElSz >> ScrnMapr_TranLn2Sz) 75 | 76 | #define ScrnMapr_ScrnWB (vMacScreenWidth >> (3 - ScrnMapr_SrcDepth)) 77 | 78 | /* now define the procedure */ 79 | 80 | LOCALPROC ScrnMapr_DoMap(si4b top, si4b left, 81 | si4b bottom, si4b right) 82 | { 83 | int i; 84 | int j; 85 | #if (ScrnMapr_TranN > 4) || (ScrnMapr_Scale > 2) 86 | int k; 87 | #endif 88 | ui5r t0; 89 | ScrnMapr_TranT *pMap; 90 | #if ScrnMapr_Scale > 1 91 | ScrnMapr_TranT *p3; 92 | #endif 93 | 94 | ui4r leftB = left >> (3 - ScrnMapr_SrcDepth); 95 | ui4r rightB = (right + (1 << (3 - ScrnMapr_SrcDepth)) - 1) 96 | >> (3 - ScrnMapr_SrcDepth); 97 | ui4r jn = rightB - leftB; 98 | ui4r SrcSkip = ScrnMapr_ScrnWB - jn; 99 | ui3b *pSrc = ((ui3b *)ScrnMapr_Src) 100 | + leftB + ScrnMapr_ScrnWB * (ui5r)top; 101 | ScrnMapr_TranT *pDst = ((ScrnMapr_TranT *)ScrnMapr_Dst) 102 | + ((leftB + ScrnMapr_ScrnWB * ScrnMapr_Scale * (ui5r)top) 103 | * ScrnMapr_TranN); 104 | ui5r DstSkip = SrcSkip * ScrnMapr_TranN; 105 | 106 | for (i = bottom - top; --i >= 0; ) { 107 | #if ScrnMapr_Scale > 1 108 | p3 = pDst; 109 | #endif 110 | 111 | for (j = jn; --j >= 0; ) { 112 | t0 = *pSrc++; 113 | pMap = 114 | &((ScrnMapr_TranT *)ScrnMapr_Map)[t0 * ScrnMapr_TranN]; 115 | 116 | #if ScrnMapr_TranN > 4 117 | for (k = ScrnMapr_TranN; --k >= 0; ) { 118 | *pDst++ = *pMap++; 119 | } 120 | #else 121 | 122 | #if ScrnMapr_TranN >= 2 123 | *pDst++ = *pMap++; 124 | #endif 125 | #if ScrnMapr_TranN >= 3 126 | *pDst++ = *pMap++; 127 | #endif 128 | #if ScrnMapr_TranN >= 4 129 | *pDst++ = *pMap++; 130 | #endif 131 | *pDst++ = *pMap; 132 | 133 | #endif /* ! ScrnMapr_TranN > 4 */ 134 | 135 | } 136 | pSrc += SrcSkip; 137 | pDst += DstSkip; 138 | 139 | #if ScrnMapr_Scale > 1 140 | #if ScrnMapr_Scale > 2 141 | for (k = ScrnMapr_Scale - 1; --k >= 0; ) 142 | #endif 143 | { 144 | pMap = p3; 145 | for (j = ScrnMapr_TranN * jn; --j >= 0; ) { 146 | *pDst++ = *pMap++; 147 | } 148 | pDst += DstSkip; 149 | } 150 | #endif /* ScrnMapr_Scale > 1 */ 151 | } 152 | } 153 | 154 | /* undefine template locals and parameters */ 155 | 156 | #undef ScrnMapr_ScrnWB 157 | #undef ScrnMapr_TranN 158 | #undef ScrnMapr_TranLn2Sz 159 | #undef ScrnMapr_TranT 160 | #undef ScrnMapr_MapElSz 161 | 162 | #undef ScrnMapr_DoMap 163 | #undef ScrnMapr_Src 164 | #undef ScrnMapr_Dst 165 | #undef ScrnMapr_SrcDepth 166 | #undef ScrnMapr_DstDepth 167 | #undef ScrnMapr_Map 168 | #undef ScrnMapr_Scale 169 | -------------------------------------------------------------------------------- /minivmac/src/SCRNTRNS.h: -------------------------------------------------------------------------------- 1 | /* 2 | SCRNTRNS.h 3 | 4 | Copyright (C) 2012 Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | /* 18 | SCReeN TRaNSlater 19 | */ 20 | 21 | /* required arguments for this template */ 22 | 23 | #ifndef ScrnTrns_DoTrans /* procedure to be created by this template */ 24 | #error "ScrnTrns_DoTrans not defined" 25 | #endif 26 | #ifndef ScrnTrns_Src 27 | #error "ScrnTrns_Src not defined" 28 | #endif 29 | #ifndef ScrnTrns_Dst 30 | #error "ScrnTrns_Dst not defined" 31 | #endif 32 | #ifndef ScrnTrns_SrcDepth 33 | #error "ScrnTrns_SrcDepth not defined" 34 | #endif 35 | #ifndef ScrnTrns_DstDepth 36 | #error "ScrnTrns_DstDepth not defined" 37 | #endif 38 | 39 | /* optional argument for this template */ 40 | 41 | #ifndef ScrnTrns_Scale 42 | #define ScrnTrns_Scale 1 43 | #endif 44 | 45 | #ifndef ScrnTrns_DstZLo 46 | #define ScrnTrns_DstZLo 0 47 | #endif 48 | 49 | /* check of parameters */ 50 | 51 | #if (ScrnTrns_SrcDepth < 4) 52 | #error "bad ScrnTrns_SrcDepth" 53 | #endif 54 | 55 | #if (ScrnTrns_DstDepth < 4) 56 | #error "bad ScrnTrns_Dst" 57 | #endif 58 | 59 | /* now define the procedure */ 60 | 61 | LOCALPROC ScrnTrns_DoTrans(si4b top, si4b left, 62 | si4b bottom, si4b right) 63 | { 64 | int i; 65 | int j; 66 | ui5b t0; 67 | ui5b t1; 68 | ui4r jn = right - left; 69 | ui4r SrcSkip = vMacScreenByteWidth 70 | - (jn << (ScrnTrns_SrcDepth - 3)); 71 | ui3b *pSrc = ((ui3b *)ScrnTrns_Src) 72 | + (left << (ScrnTrns_SrcDepth - 3)) 73 | + vMacScreenByteWidth * (ui5r)top; 74 | ui5b *pDst = ((ui5b *)ScrnTrns_Dst) 75 | + left * ScrnTrns_Scale 76 | + (ui5r)vMacScreenWidth * ScrnTrns_Scale * ScrnTrns_Scale * top; 77 | ui4r DstSkip = (vMacScreenWidth - jn) * ScrnTrns_Scale; 78 | #if ScrnTrns_Scale > 1 79 | int k; 80 | ui5b *p3; 81 | ui5b *p4; 82 | #endif 83 | 84 | for (i = bottom - top; --i >= 0; ) { 85 | #if ScrnTrns_Scale > 1 86 | p3 = pDst; 87 | #endif 88 | 89 | for (j = jn; --j >= 0; ) { 90 | #if 4 == ScrnTrns_SrcDepth 91 | t0 = do_get_mem_word(pSrc); 92 | pSrc += 2; 93 | t1 = 94 | #if ScrnTrns_DstZLo 95 | ((t0 & 0x7C00) << 17) | 96 | ((t0 & 0x7000) << 12) | 97 | ((t0 & 0x03E0) << 14) | 98 | ((t0 & 0x0380) << 9) | 99 | ((t0 & 0x001F) << 11) | 100 | ((t0 & 0x001C) << 6); 101 | #else 102 | ((t0 & 0x7C00) << 9) | 103 | ((t0 & 0x7000) << 4) | 104 | ((t0 & 0x03E0) << 6) | 105 | ((t0 & 0x0380) << 1) | 106 | ((t0 & 0x001F) << 3) | 107 | ((t0 & 0x001C) >> 2); 108 | #endif 109 | #if 0 110 | ((t0 & 0x7C00) << 1) | 111 | ((t0 & 0x7000) >> 4) | 112 | ((t0 & 0x03E0) << 14) | 113 | ((t0 & 0x0380) << 9) | 114 | ((t0 & 0x001F) << 27) | 115 | ((t0 & 0x001C) << 22); 116 | #endif 117 | 118 | #elif 5 == ScrnTrns_SrcDepth 119 | t0 = do_get_mem_long(pSrc); 120 | pSrc += 4; 121 | #if ScrnTrns_DstZLo 122 | t1 = t0 << 8; 123 | #else 124 | t1 = t0; 125 | #endif 126 | #endif 127 | 128 | #if ScrnTrns_Scale > 1 129 | for (k = ScrnTrns_Scale; --k >= 0; ) 130 | #endif 131 | { 132 | *pDst++ = t1; 133 | } 134 | } 135 | pSrc += SrcSkip; 136 | pDst += DstSkip; 137 | 138 | #if ScrnTrns_Scale > 1 139 | #if ScrnTrns_Scale > 2 140 | for (k = ScrnTrns_Scale - 1; --k >= 0; ) 141 | #endif 142 | { 143 | p4 = p3; 144 | for (j = ScrnTrns_Scale * jn; --j >= 0; ) { 145 | *pDst++ = *p4++; 146 | } 147 | pDst += DstSkip; 148 | } 149 | #endif /* ScrnTrns_Scale > 1 */ 150 | } 151 | } 152 | 153 | /* undefine template locals and parameters */ 154 | 155 | #undef ScrnTrns_DoTrans 156 | #undef ScrnTrns_Src 157 | #undef ScrnTrns_Dst 158 | #undef ScrnTrns_SrcDepth 159 | #undef ScrnTrns_DstDepth 160 | #undef ScrnTrns_Scale 161 | #undef ScrnTrns_DstZLo 162 | -------------------------------------------------------------------------------- /minivmac/src/SCSIEMDV.c: -------------------------------------------------------------------------------- 1 | /* 2 | SCSIEMDV.c 3 | 4 | Copyright (C) 2004 Philip Cummins, Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | /* 18 | Small Computer System Interface EMulated DeVice 19 | 20 | Emulates the SCSI found in the Mac Plus. 21 | 22 | This code adapted from "SCSI.c" in vMac by Philip Cummins. 23 | */ 24 | 25 | /* NCR5380 chip emulation by Yoav Shadmi, 1998 */ 26 | 27 | #ifndef AllFiles 28 | #include "SYSDEPNS.h" 29 | 30 | #include "ENDIANAC.h" 31 | #include "MYOSGLUE.h" 32 | #include "EMCONFIG.h" 33 | #include "GLOBGLUE.h" 34 | #include "MINEM68K.h" 35 | #endif 36 | 37 | #include "SCSIEMDV.h" 38 | 39 | #define scsiRd 0x00 40 | #define scsiWr 0x01 41 | 42 | #define sCDR 0x00 /* current scsi data register (r/o) */ 43 | #define sODR 0x00 /* output data register (w/o) */ 44 | #define sICR 0x02 /* initiator command register (r/w) */ 45 | #define sMR 0x04 /* mode register (r/w) */ 46 | #define sTCR 0x06 /* target command register (r/w) */ 47 | #define sCSR 0x08 /* current SCSI bus status (r/o) */ 48 | #define sSER 0x08 /* select enable register (w/o) */ 49 | #define sBSR 0x0A /* bus and status register (r/o) */ 50 | #define sDMAtx 0x0A /* start DMA send (w/o) */ 51 | #define sIDR 0x0C /* input data register (r/o) */ 52 | #define sTDMArx 0x0C /* start DMA target receive (w/o) */ 53 | #define sRESET 0x0E /* reset parity/interrupt (r/o) */ 54 | #define sIDMArx 0x0E /* start DMA initiator receive (w/o) */ 55 | 56 | #define kSCSI_Size 0x00010 57 | 58 | LOCALVAR ui3b SCSI[kSCSI_Size]; 59 | 60 | GLOBALPROC SCSI_Reset(void) 61 | { 62 | int i; 63 | 64 | for (i = 0; i < kSCSI_Size; i++) { 65 | SCSI[i] = 0; 66 | } 67 | } 68 | 69 | LOCALPROC SCSI_BusReset(void) 70 | { 71 | SCSI[scsiRd + sCDR] = 0; 72 | SCSI[scsiWr + sODR] = 0; 73 | SCSI[scsiRd + sICR] = 0x80; 74 | SCSI[scsiWr + sICR] &= 0x80; 75 | SCSI[scsiRd + sMR] &= 0x40; 76 | SCSI[scsiWr + sMR] &= 0x40; 77 | SCSI[scsiRd + sTCR] = 0; 78 | SCSI[scsiWr + sTCR] = 0; 79 | SCSI[scsiRd + sCSR] = 0x80; 80 | SCSI[scsiWr + sSER] = 0; 81 | SCSI[scsiRd + sBSR] = 0x10; 82 | SCSI[scsiWr + sDMAtx] = 0; 83 | SCSI[scsiRd + sIDR] = 0; 84 | SCSI[scsiWr + sTDMArx] = 0; 85 | SCSI[scsiRd + sRESET] = 0; 86 | SCSI[scsiWr + sIDMArx] = 0; 87 | #if 0 88 | SCSI[scsiRd + sODR + dackWr] = 0; 89 | SCSI[scsiWr + sIDR + dackRd] = 0; 90 | #endif 91 | 92 | /* The missing piece of the puzzle.. :) */ 93 | put_ram_word(0xb22, get_ram_word(0xb22) | 0x8000); 94 | } 95 | 96 | LOCALPROC SCSI_Check(void) 97 | { 98 | /* 99 | The arbitration select/reselect scenario 100 | [stub.. doesn't really work...] 101 | */ 102 | if ((SCSI[scsiWr + sODR] >> 7) == 1) { 103 | /* Check if the Mac tries to be an initiator */ 104 | if ((SCSI[scsiWr + sMR] & 1) == 1) { 105 | /* the Mac set arbitration in progress */ 106 | /* 107 | stub! tell the mac that there 108 | is arbitration in progress... 109 | */ 110 | SCSI[scsiRd + sICR] |= 0x40; 111 | /* ... that we didn't lose arbitration ... */ 112 | SCSI[scsiRd + sICR] &= ~ 0x20; 113 | /* 114 | ... and that there isn't a higher priority ID present... 115 | */ 116 | SCSI[scsiRd + sCDR] = 0x00; 117 | 118 | /* 119 | ... the arbitration and selection/reselection is 120 | complete. the initiator tries to connect to the SCSI 121 | device, fails and returns after timeout. 122 | */ 123 | } 124 | } 125 | 126 | /* check the chip registers, AS SET BY THE CPU */ 127 | if ((SCSI[scsiWr + sICR] >> 7) == 1) { 128 | /* Check Assert RST */ 129 | SCSI_BusReset(); 130 | } else { 131 | SCSI[scsiRd + sICR] &= ~ 0x80; 132 | SCSI[scsiRd + sCSR] &= ~ 0x80; 133 | } 134 | 135 | if ((SCSI[scsiWr + sICR] >> 2) == 1) { 136 | /* Check Assert SEL */ 137 | SCSI[scsiRd + sCSR] |= 0x02; 138 | SCSI[scsiRd + sBSR] = 0x10; 139 | } else { 140 | SCSI[scsiRd + sCSR] &= ~ 0x02; 141 | } 142 | } 143 | 144 | GLOBALFUNC ui5b SCSI_Access(ui5b Data, blnr WriteMem, CPTR addr) 145 | { 146 | if (addr < (kSCSI_Size / 2)) { 147 | addr *= 2; 148 | if (WriteMem) { 149 | SCSI[addr + 1] = Data; 150 | SCSI_Check(); 151 | } else { 152 | Data = SCSI[addr]; 153 | } 154 | } 155 | return Data; 156 | } 157 | -------------------------------------------------------------------------------- /minivmac/src/SCSIEMDV.h: -------------------------------------------------------------------------------- 1 | /* 2 | SCSIEMDV.h 3 | 4 | Copyright (C) 2004 Philip Cummins, Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | #ifdef SCSIEMDV_H 18 | #error "header already included" 19 | #else 20 | #define SCSIEMDV_H 21 | #endif 22 | 23 | EXPORTPROC SCSI_Reset(void); 24 | 25 | EXPORTFUNC ui5b SCSI_Access(ui5b Data, blnr WriteMem, CPTR addr); 26 | -------------------------------------------------------------------------------- /minivmac/src/SGLUDDSP.h: -------------------------------------------------------------------------------- 1 | /* 2 | SGLUDDSP.h 3 | 4 | Copyright (C) 2012 Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | /* 18 | Sound GLUe for "/Dev/DSP" 19 | OSS and related, accessed through "/dev/dsp" 20 | */ 21 | 22 | LOCALVAR int audio_fd = -1; 23 | LOCALVAR blnr audio_started; 24 | 25 | #if 4 == kLn2SoundSampSz 26 | LOCALPROC ConvertSoundBlockToNative(tpSoundSamp p) 27 | { 28 | int i; 29 | 30 | for (i = kOneBuffLen; --i >= 0; ) { 31 | *p++ -= 0x8000; 32 | } 33 | } 34 | #else 35 | #define ConvertSoundBlockToNative(p) 36 | #endif 37 | 38 | LOCALPROC MySound_WriteOut(void) 39 | { 40 | int retry_count = 32; 41 | 42 | label_retry: 43 | if (--retry_count > 0) { 44 | int err; 45 | struct audio_buf_info info; 46 | 47 | if (ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info) != 0) { 48 | fprintf(stderr, "SNDCTL_DSP_GETOSPACE fails\n"); 49 | } else { 50 | tpSoundSamp NextPlayPtr; 51 | ui4b PlayNowSize = 0; 52 | ui4b MaskedFillOffset = ThePlayOffset & kOneBuffMask; 53 | ui4b PrivateBuffUsed = TheFillOffset - ThePlayOffset; 54 | int used = (info.fragstotal * info.fragsize) - info.bytes; 55 | 56 | if (audio_started) { 57 | ui4b TotPendBuffs = used >> kLnOneBuffSz; 58 | 59 | if (TotPendBuffs < MinFilledSoundBuffs) { 60 | MinFilledSoundBuffs = TotPendBuffs; 61 | } 62 | /* fprintf(stderr, "buffer used %d\n", (int)used); */ 63 | } else { 64 | if (PrivateBuffUsed >= kAllBuffLen - kOneBuffLen) { 65 | audio_started = trueblnr; 66 | } else { 67 | info.bytes = 0; 68 | } 69 | } 70 | 71 | if (MaskedFillOffset != 0) { 72 | /* take care of left overs */ 73 | PlayNowSize = kOneBuffLen - MaskedFillOffset; 74 | NextPlayPtr = 75 | TheSoundBuffer + (ThePlayOffset & kAllBuffMask); 76 | } else if (0 != 77 | ((TheFillOffset - ThePlayOffset) >> kLnOneBuffLen)) 78 | { 79 | PlayNowSize = kOneBuffLen; 80 | NextPlayPtr = 81 | TheSoundBuffer + (ThePlayOffset & kAllBuffMask); 82 | } else { 83 | /* nothing to play now */ 84 | } 85 | 86 | #if 4 == kLn2SoundSampSz 87 | PlayNowSize <<= 1; 88 | #endif 89 | 90 | if (PlayNowSize > info.bytes) { 91 | PlayNowSize = info.bytes; 92 | } 93 | 94 | if (0 != PlayNowSize) { 95 | err = write( 96 | audio_fd, NextPlayPtr, PlayNowSize); 97 | if (err < 0) { 98 | if (- EAGAIN == err) { 99 | /* buffer full, try again later */ 100 | fprintf(stderr, "pcm write: EAGAIN\n"); 101 | } else if (- EPIPE == err) { 102 | /* buffer seems to have emptied */ 103 | fprintf(stderr, "pcm write emptied\n"); 104 | goto label_retry; 105 | } else { 106 | fprintf(stderr, "audio_fd write error: %d\n", 107 | err); 108 | } 109 | } else { 110 | ThePlayOffset += err 111 | #if 4 == kLn2SoundSampSz 112 | >> 1 113 | #endif 114 | ; 115 | goto label_retry; 116 | } 117 | } 118 | } 119 | } 120 | } 121 | 122 | LOCALPROC MySound_Start(void) 123 | { 124 | if (audio_fd >= 0) { 125 | MySound_Start0(); 126 | audio_started = falseblnr; 127 | } 128 | } 129 | 130 | LOCALPROC MySound_Stop(void) 131 | { 132 | if (audio_fd >= 0) { 133 | if (0 != 134 | ioctl(audio_fd, SNDCTL_DSP_RESET /* SNDCTL_DSP_HALT */, 135 | NULL)) 136 | { 137 | fprintf(stderr, "SNDCTL_DSP_RESET fails\n"); 138 | } 139 | } 140 | } 141 | 142 | #if 4 == kLn2SoundSampSz 143 | #define MyDesiredFormat AFMT_S16_NE 144 | #else 145 | #define MyDesiredFormat AFMT_U8 146 | #endif 147 | 148 | LOCALFUNC blnr MySound_Init(void) 149 | { 150 | blnr IsOk = falseblnr; 151 | 152 | audio_fd = open(AudioDevPath, O_WRONLY, 0); 153 | if (audio_fd < 0) { 154 | fprintf(stderr, "open /dev/dsp fails: %d\n", audio_fd); 155 | } else { 156 | int fragment_value = (16 /* 16 fragments */ << 16) 157 | #if 4 == kLn2SoundSampSz 158 | | 10 /* of 1024 bytes */ 159 | #else 160 | | 9 /* of 512 bytes */ 161 | #endif 162 | ; 163 | int channels_value = 1; 164 | int fmt_value = MyDesiredFormat; 165 | int speed_value = SOUND_SAMPLERATE; 166 | 167 | /* fprintf(stderr, "open /dev/dsp works\n"); */ 168 | 169 | if (0 != 170 | ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &fragment_value)) 171 | { 172 | fprintf(stderr, "SNDCTL_DSP_SETFRAGMENT fails\n"); 173 | } else if ((0 != 174 | ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &channels_value)) 175 | || (channels_value != 1)) 176 | { 177 | fprintf(stderr, "SNDCTL_DSP_CHANNELS fails\n"); 178 | } else if ((0 != 179 | ioctl(audio_fd, SNDCTL_DSP_SETFMT, &fmt_value)) 180 | || (fmt_value != MyDesiredFormat)) 181 | { 182 | fprintf(stderr, "SNDCTL_DSP_SETFMT fails\n"); 183 | } else if ((0 != 184 | ioctl(audio_fd, SNDCTL_DSP_SPEED, &speed_value)) 185 | || (speed_value != SOUND_SAMPLERATE)) 186 | { 187 | fprintf(stderr, "SNDCTL_DSP_SPEED fails\n"); 188 | } else 189 | { 190 | IsOk = trueblnr; 191 | } 192 | 193 | if (! IsOk) { 194 | (void) close(audio_fd); 195 | audio_fd = -1; 196 | } 197 | } 198 | 199 | return trueblnr; /* keep going, even if no sound */ 200 | } 201 | 202 | LOCALPROC MySound_UnInit(void) 203 | { 204 | if (audio_fd >= 0) { 205 | if (close(audio_fd) != 0) { 206 | fprintf(stderr, "close /dev/dsp fails\n"); 207 | } 208 | audio_fd = -1; 209 | } 210 | } 211 | 212 | GLOBALOSGLUPROC MySound_EndWrite(ui4r actL) 213 | { 214 | if (MySound_EndWrite0(actL)) { 215 | ConvertSoundBlockToNative(TheSoundBuffer 216 | + ((TheFillOffset - kOneBuffLen) & kAllBuffMask)); 217 | if (audio_fd >= 0) { 218 | MySound_WriteOut(); 219 | } 220 | } 221 | } 222 | 223 | LOCALPROC MySound_SecondNotify(void) 224 | { 225 | if (audio_fd >= 0) { 226 | MySound_SecondNotify0(); 227 | } 228 | } 229 | -------------------------------------------------------------------------------- /minivmac/src/SNDEMDEV.c: -------------------------------------------------------------------------------- 1 | /* 2 | SNDEMDEV.c 3 | 4 | Copyright (C) 2003 Philip Cummins, Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | /* 18 | SouND EMulated DEVice 19 | 20 | Emulation of Sound in the Mac Plus could go here. 21 | 22 | This code adapted from "Sound.c" in vMac by Philip Cummins. 23 | */ 24 | 25 | #ifndef AllFiles 26 | #include "SYSDEPNS.h" 27 | 28 | #include "MYOSGLUE.h" 29 | #include "EMCONFIG.h" 30 | #include "GLOBGLUE.h" 31 | #include "MINEM68K.h" 32 | #endif 33 | 34 | #include "SNDEMDEV.h" 35 | 36 | 37 | #if MySoundEnabled 38 | 39 | #define kSnd_Main_Offset 0x0300 40 | #define kSnd_Alt_Offset 0x5F00 41 | 42 | #define kSnd_Main_Buffer (kRAM_Size - kSnd_Main_Offset) 43 | #define kSnd_Alt_Buffer (kRAM_Size - kSnd_Alt_Offset) 44 | 45 | /* 46 | approximate volume levels of vMac, so: 47 | 48 | x * vol_mult[SoundVolume] >> 16 49 | + vol_offset[SoundVolume] 50 | = {approx} (x - kCenterSound) / (8 - SoundVolume) + kCenterSound; 51 | */ 52 | 53 | LOCALVAR const ui4b vol_mult[] = { 54 | 8192, 9362, 10922, 13107, 16384, 21845, 32768 55 | }; 56 | 57 | LOCALVAR const trSoundSamp vol_offset[] = { 58 | #if 3 == kLn2SoundSampSz 59 | 112, 110, 107, 103, 96, 86, 64, 0 60 | #elif 4 == kLn2SoundSampSz 61 | 28672, 28087, 27307, 26215, 24576, 21846, 16384, 0 62 | #else 63 | #error "unsupported kLn2SoundSampSz" 64 | #endif 65 | }; 66 | 67 | LOCALVAR const ui4b SubTick_offset[kNumSubTicks] = { 68 | 0, 25, 50, 90, 102, 115, 138, 161, 69 | 185, 208, 231, 254, 277, 300, 323, 346 70 | }; 71 | 72 | LOCALVAR const ui3r SubTick_n[kNumSubTicks] = { 73 | 25, 25, 40, 12, 13, 23, 23, 24, 74 | 23, 23, 23, 23, 23, 23, 23, 24 75 | }; 76 | 77 | /* 78 | One version of free form sound driver 79 | spends around 18000 cycles writing 80 | offsets 50 to 370, then around another 3000 81 | cycles writing 0 to 50. So be done 82 | with 0 to 50 at end of second sixtieth. 83 | */ 84 | 85 | /* 86 | Different in system 6.0.4: 87 | spends around 23500 cycles writing 88 | offsets 90 to 370, then around another 7500 89 | cycles writing 0 to 90. This is nastier, 90 | because gets to be a very small gap 91 | between where is being read and 92 | where written. So read a bit in 93 | advance for third subtick. 94 | */ 95 | 96 | /* 97 | startup sound spends around 19500 cycles 98 | writing offsets 0 to 370. presumably 99 | writing offset 0 before it is read. 100 | */ 101 | 102 | LOCALVAR ui5b SoundInvertPhase = 0; 103 | LOCALVAR ui4b SoundInvertState = 0; 104 | 105 | IMPORTFUNC ui4b GetSoundInvertTime(void); 106 | 107 | GLOBALPROC MacSound_SubTick(int SubTick) 108 | { 109 | ui4r actL; 110 | tpSoundSamp p; 111 | ui4r i; 112 | ui5b StartOffset = SubTick_offset[SubTick]; 113 | ui4r n = SubTick_n[SubTick]; 114 | unsigned long addy = 115 | #ifdef SoundBuffer 116 | (SoundBuffer == 0) ? kSnd_Alt_Buffer : 117 | #endif 118 | kSnd_Main_Buffer; 119 | #ifndef ln2mtb 120 | ui3p addr = addy + (2 * StartOffset) + RAM; 121 | #else 122 | CPTR addr = addy + (2 * StartOffset); 123 | #endif 124 | ui4b SoundInvertTime = GetSoundInvertTime(); 125 | ui3b SoundVolume = SoundVolb0 126 | | (SoundVolb1 << 1) 127 | | (SoundVolb2 << 2); 128 | 129 | #if dbglog_HAVE && 0 130 | dbglog_StartLine(); 131 | dbglog_writeCStr("reading sound buffer "); 132 | dbglog_writeHex(StartOffset); 133 | dbglog_writeCStr(" to "); 134 | dbglog_writeHex(StartOffset + n); 135 | dbglog_writeReturn(); 136 | #endif 137 | 138 | label_retry: 139 | p = MySound_BeginWrite(n, &actL); 140 | if (actL > 0) { 141 | if (SoundDisable && (SoundInvertTime == 0)) { 142 | for (i = 0; i < actL; i++) { 143 | #if 0 144 | *p++ = 0x00; /* this is believed more accurate */ 145 | #else 146 | /* But this avoids more clicks. */ 147 | *p++ = kCenterSound; 148 | #endif 149 | } 150 | } else { 151 | for (i = 0; i < actL; i++) { 152 | /* Copy sound data, high byte of each word */ 153 | *p++ = 154 | #ifndef ln2mtb 155 | *addr 156 | #else 157 | get_vm_byte(addr) 158 | #endif 159 | #if 4 == kLn2SoundSampSz 160 | << 8 161 | #endif 162 | ; 163 | 164 | /* Move the address on */ 165 | addr += 2; 166 | } 167 | 168 | if (SoundInvertTime != 0) { 169 | ui5b PhaseIncr = (ui5b)SoundInvertTime * (ui5b)20; 170 | p -= actL; 171 | 172 | for (i = 0; i < actL; i++) { 173 | if (SoundInvertPhase < 704) { 174 | ui5b OnPortion = 0; 175 | ui5b LastPhase = 0; 176 | do { 177 | if (! SoundInvertState) { 178 | OnPortion += 179 | (SoundInvertPhase - LastPhase); 180 | } 181 | SoundInvertState = ! SoundInvertState; 182 | LastPhase = SoundInvertPhase; 183 | SoundInvertPhase += PhaseIncr; 184 | } while (SoundInvertPhase < 704); 185 | if (! SoundInvertState) { 186 | OnPortion += 704 - LastPhase; 187 | } 188 | *p = (*p * OnPortion) / 704; 189 | } else { 190 | if (SoundInvertState) { 191 | *p = 0; 192 | } 193 | } 194 | SoundInvertPhase -= 704; 195 | p++; 196 | } 197 | } 198 | } 199 | 200 | if (SoundVolume < 7) { 201 | /* 202 | Usually have volume at 7, so this 203 | is just for completeness. 204 | */ 205 | ui5b mult = (ui5b)vol_mult[SoundVolume]; 206 | trSoundSamp offset = vol_offset[SoundVolume]; 207 | 208 | p -= actL; 209 | for (i = 0; i < actL; i++) { 210 | *p = (trSoundSamp)((ui5b)(*p) * mult >> 16) + offset; 211 | ++p; 212 | } 213 | } 214 | 215 | MySound_EndWrite(actL); 216 | n -= actL; 217 | if (n > 0) { 218 | goto label_retry; 219 | } 220 | } 221 | } 222 | 223 | #endif 224 | -------------------------------------------------------------------------------- /minivmac/src/SNDEMDEV.h: -------------------------------------------------------------------------------- 1 | /* 2 | SNDEMDEV.h 3 | 4 | Copyright (C) 2003 Philip Cummins, Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | #ifdef SNDEMDEV_H 18 | #error "header already included" 19 | #else 20 | #define SNDEMDEV_H 21 | #endif 22 | 23 | #if MySoundEnabled 24 | EXPORTPROC MacSound_SubTick(int SubTick); 25 | #endif 26 | -------------------------------------------------------------------------------- /minivmac/src/SONYEMDV.h: -------------------------------------------------------------------------------- 1 | /* 2 | SONYEMDV.h 3 | 4 | Copyright (C) 2004 Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | #ifdef SONYEMDV_H 18 | #error "header already included" 19 | #else 20 | #define SONYEMDV_H 21 | #endif 22 | 23 | EXPORTPROC ExtnDisk_Access(CPTR p); 24 | EXPORTPROC ExtnSony_Access(CPTR p); 25 | 26 | EXPORTPROC Sony_SetQuitOnEject(void); 27 | 28 | EXPORTPROC Sony_EjectAllDisks(void); 29 | EXPORTPROC Sony_Reset(void); 30 | 31 | EXPORTPROC Sony_Update(void); 32 | -------------------------------------------------------------------------------- /minivmac/src/SYSDEPNS.h: -------------------------------------------------------------------------------- 1 | /* 2 | SYSDEPNS.h 3 | 4 | Copyright (C) 2006 Bernd Schmidt, Philip Cummins, Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | /* 18 | SYStem DEPeNdencies. 19 | */ 20 | 21 | #ifdef SYSDEPNS_H 22 | #error "header already included" 23 | #else 24 | #define SYSDEPNS_H 25 | #endif 26 | 27 | #include "CNFGGLOB.h" 28 | 29 | 30 | typedef ui3b *ui3p; 31 | typedef ui4b *ui4p; 32 | typedef ui5b *ui5p; 33 | 34 | /* 35 | Largest efficiently supported 36 | representation types. uimr should be 37 | large enough to hold number of elements 38 | of any array we will deal with. 39 | */ 40 | typedef ui5r uimr; 41 | typedef si5r simr; 42 | 43 | #define blnr ui3r 44 | #define trueblnr 1 45 | #define falseblnr 0 46 | 47 | #define nullpr ((void *) 0) 48 | 49 | #define anyp ui3p 50 | 51 | /* pascal string, single byte characters */ 52 | #define ps3p ui3p 53 | 54 | #ifndef MayInline 55 | #define MayInline 56 | #endif 57 | 58 | #ifndef MayNotInline 59 | #define MayNotInline 60 | #endif 61 | 62 | #ifndef my_reg_call 63 | #define my_reg_call 64 | #endif 65 | 66 | #ifndef my_osglu_call 67 | #define my_osglu_call 68 | #endif 69 | 70 | #define LOCALVAR static 71 | #ifdef AllFiles 72 | #define GLOBALVAR LOCALVAR 73 | #define EXPORTVAR(t, v) 74 | #else 75 | #define GLOBALVAR 76 | #define EXPORTVAR(t, v) extern t v; 77 | #endif 78 | 79 | #define LOCALFUNC static MayNotInline 80 | #define FORWARDFUNC LOCALFUNC 81 | #ifdef AllFiles 82 | #define GLOBALFUNC LOCALFUNC 83 | #define EXPORTFUNC LOCALFUNC 84 | #else 85 | #define GLOBALFUNC MayNotInline 86 | #define EXPORTFUNC extern 87 | #endif 88 | #define IMPORTFUNC EXPORTFUNC 89 | #define TYPEDEFFUNC typedef 90 | 91 | #define LOCALPROC LOCALFUNC void 92 | #define GLOBALPROC GLOBALFUNC void 93 | #define EXPORTPROC EXPORTFUNC void 94 | #define IMPORTPROC IMPORTFUNC void 95 | #define FORWARDPROC FORWARDFUNC void 96 | #define TYPEDEFPROC TYPEDEFFUNC void 97 | 98 | #define LOCALINLINEFUNC static MayInline 99 | #define LOCALINLINEPROC LOCALINLINEFUNC void 100 | 101 | #define LOCALFUNCUSEDONCE LOCALINLINEFUNC 102 | #define LOCALPROCUSEDONCE LOCALINLINEPROC 103 | 104 | #define GLOBALOSGLUFUNC GLOBALFUNC my_osglu_call 105 | #define EXPORTOSGLUFUNC EXPORTFUNC my_osglu_call 106 | #define GLOBALOSGLUPROC GLOBALFUNC my_osglu_call void 107 | #define EXPORTOSGLUPROC EXPORTFUNC my_osglu_call void 108 | /* 109 | For functions in operating system glue that 110 | are called by rest of program. 111 | */ 112 | 113 | /* 114 | best type for ui4r that is probably in register 115 | (when compiler messes up otherwise) 116 | */ 117 | 118 | #ifndef BigEndianUnaligned 119 | #define BigEndianUnaligned 0 120 | #endif 121 | 122 | #ifndef LittleEndianUnaligned 123 | #define LittleEndianUnaligned 0 124 | #endif 125 | 126 | #ifndef ui3rr 127 | #define ui3rr ui3r 128 | #endif 129 | 130 | #ifndef ui4rr 131 | #define ui4rr ui4r 132 | #endif 133 | 134 | #ifndef si5rr 135 | #define si5rr si5r 136 | #endif 137 | 138 | #ifndef my_align_8 139 | #define my_align_8 140 | #endif 141 | 142 | #ifndef my_cond_rare 143 | #define my_cond_rare(x) (x) 144 | #endif 145 | 146 | #ifndef Have_ASR 147 | #define Have_ASR 0 148 | #endif 149 | 150 | #ifndef HaveMySwapUi5r 151 | #define HaveMySwapUi5r 0 152 | #endif 153 | -------------------------------------------------------------------------------- /minivmac/src/VIA2EMDV.h: -------------------------------------------------------------------------------- 1 | /* 2 | VIA2EMDV.h 3 | 4 | Copyright (C) 2004 Philip Cummins, Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | #ifdef VIA2EMDV_H 18 | #error "header already included" 19 | #else 20 | #define VIA2EMDV_H 21 | #endif 22 | 23 | EXPORTPROC VIA2_Zap(void); 24 | EXPORTPROC VIA2_Reset(void); 25 | 26 | EXPORTFUNC ui5b VIA2_Access(ui5b Data, blnr WriteMem, CPTR addr); 27 | 28 | EXPORTPROC VIA2_ExtraTimeBegin(void); 29 | EXPORTPROC VIA2_ExtraTimeEnd(void); 30 | #ifdef VIA2_iCA1_PulseNtfy 31 | EXPORTPROC VIA2_iCA1_PulseNtfy(void); 32 | #endif 33 | #ifdef VIA2_iCA2_PulseNtfy 34 | EXPORTPROC VIA2_iCA2_PulseNtfy(void); 35 | #endif 36 | #ifdef VIA2_iCB1_PulseNtfy 37 | EXPORTPROC VIA2_iCB1_PulseNtfy(void); 38 | #endif 39 | #ifdef VIA2_iCB2_PulseNtfy 40 | EXPORTPROC VIA2_iCB2_PulseNtfy(void); 41 | #endif 42 | EXPORTPROC VIA2_DoTimer1Check(void); 43 | EXPORTPROC VIA2_DoTimer2Check(void); 44 | 45 | EXPORTFUNC ui4b VIA2_GetT1InvertTime(void); 46 | 47 | EXPORTPROC VIA2_ShiftInData(ui3b v); 48 | EXPORTFUNC ui3b VIA2_ShiftOutData(void); 49 | -------------------------------------------------------------------------------- /minivmac/src/VIAEMDEV.h: -------------------------------------------------------------------------------- 1 | /* 2 | VIAEMDEV.h 3 | 4 | Copyright (C) 2004 Philip Cummins, Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | #ifdef VIAEMDEV_H 18 | #error "header already included" 19 | #else 20 | #define VIAEMDEV_H 21 | #endif 22 | 23 | EXPORTPROC VIA1_Zap(void); 24 | EXPORTPROC VIA1_Reset(void); 25 | 26 | EXPORTFUNC ui5b VIA1_Access(ui5b Data, blnr WriteMem, CPTR addr); 27 | 28 | EXPORTPROC VIA1_ExtraTimeBegin(void); 29 | EXPORTPROC VIA1_ExtraTimeEnd(void); 30 | #ifdef VIA1_iCA1_PulseNtfy 31 | EXPORTPROC VIA1_iCA1_PulseNtfy(void); 32 | #endif 33 | #ifdef VIA1_iCA2_PulseNtfy 34 | EXPORTPROC VIA1_iCA2_PulseNtfy(void); 35 | #endif 36 | #ifdef VIA1_iCB1_PulseNtfy 37 | EXPORTPROC VIA1_iCB1_PulseNtfy(void); 38 | #endif 39 | #ifdef VIA1_iCB2_PulseNtfy 40 | EXPORTPROC VIA1_iCB2_PulseNtfy(void); 41 | #endif 42 | EXPORTPROC VIA1_DoTimer1Check(void); 43 | EXPORTPROC VIA1_DoTimer2Check(void); 44 | 45 | EXPORTFUNC ui4b VIA1_GetT1InvertTime(void); 46 | 47 | EXPORTPROC VIA1_ShiftInData(ui3b v); 48 | EXPORTFUNC ui3b VIA1_ShiftOutData(void); 49 | -------------------------------------------------------------------------------- /minivmac/src/VIDEMDEV.h: -------------------------------------------------------------------------------- 1 | /* 2 | VIDEMDEV.h 3 | 4 | Copyright (C) 2008 Paul C. Pratt 5 | 6 | You can redistribute this file and/or modify it under the terms 7 | of version 2 of the GNU General Public License as published by 8 | the Free Software Foundation. You should have received a copy 9 | of the license along with this file; see the file COPYING. 10 | 11 | This file is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | license for more details. 15 | */ 16 | 17 | #ifdef VIDEMDEV_H 18 | #error "header already included" 19 | #else 20 | #define VIDEMDEV_H 21 | #endif 22 | 23 | EXPORTFUNC blnr Vid_Init(void); 24 | EXPORTFUNC ui4r Vid_Reset(void); 25 | EXPORTPROC Vid_Update(void); 26 | 27 | EXPORTPROC ExtnVideo_Access(CPTR p); 28 | -------------------------------------------------------------------------------- /minivmac/src/main.r: -------------------------------------------------------------------------------- 1 | /* 2 | main.r 3 | 4 | Copyright (C) 2003 Philip Cummins, Richard F. Bannister, 5 | Paul C. Pratt 6 | 7 | You can redistribute this file and/or modify it under the terms 8 | of version 2 of the GNU General Public License as published by 9 | the Free Software Foundation. You should have received a copy 10 | of the license along with this file; see the file COPYING. 11 | 12 | This file is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | license for more details. 16 | */ 17 | 18 | #include "CNFGRSRC.h" 19 | 20 | /* Alerts Constants */ 21 | 22 | #define kMyStandardAlert 128 23 | 24 | resource 'DITL' (kMyStandardAlert, purgeable) { 25 | { /* array DITLarray: 2 elements */ 26 | /* [1] */ 27 | {177, 293, 197, 351}, 28 | Button { 29 | enabled, 30 | "OK" 31 | }, 32 | /* [2] */ 33 | {10, 72, 162, 353}, 34 | StaticText { 35 | disabled, 36 | "^0\n\n^1^2^3" 37 | } 38 | } 39 | }; 40 | 41 | resource 'ALRT' (kMyStandardAlert, "Non Fatal Error", purgeable) { 42 | {40, 43, 249, 405}, 43 | kMyStandardAlert, 44 | { /* array: 4 elements */ 45 | /* [1] */ 46 | OK, visible, sound1, 47 | /* [2] */ 48 | OK, visible, sound1, 49 | /* [3] */ 50 | OK, visible, sound1, 51 | /* [4] */ 52 | OK, visible, sound1 53 | }, 54 | alertPositionMainScreen 55 | }; 56 | --------------------------------------------------------------------------------