Skip to content

Modernize Shoebill for macOS ARM64: SwiftUI GUI + core optimizations#22

Open
kkeker wants to merge 3 commits intopruten:masterfrom
kkeker:modernize-arm64-swiftui
Open

Modernize Shoebill for macOS ARM64: SwiftUI GUI + core optimizations#22
kkeker wants to merge 3 commits intopruten:masterfrom
kkeker:modernize-arm64-swiftui

Conversation

@kkeker
Copy link
Copy Markdown

@kkeker kkeker commented Mar 22, 2026

Summary

Comprehensive modernization of Shoebill for modern macOS on Apple Silicon. Verified to boot A/UX 3.1 to desktop on macOS 15 / Apple M-series.

This supersedes PR #21 (minimal ARM64 build fixes) with a complete overhaul:

  • ARM64 native support — universal binary (arm64 + x86_64), fixes memset bug (incorrect memset() in fpu.c #20), K&R declaration (Error trying to build under Fedora 31 with lin.build.sh #15)
  • New SwiftUI + Metal GUI (ShoebillApp/) — modern macOS 14+ interface replacing deprecated Cocoa/OpenGL app, with Metal framebuffer rendering, HiDPI support, mouse capture, full ADB keyboard mapping, PRAM persistence, and app icon
  • CPU dispatch optimization — single direct 64K function pointer table replaces two-level indirection; cpu_step() marked __attribute__((hot))
  • 4-way set-associative PMMU cache — upgraded from direct-mapped, with pseudo-LRU eviction, reducing conflict misses
  • SoftFloat 2b → 3e — Berkeley SoftFloat library upgraded from Release 2b to 3e with full backward-compatible API shim (softfloat_compat.c), improved accuracy and ARM64 codegen
  • Core Audio sound output — Apple Sound Chip (ASC) emulation now produces audio via AudioQueue API (22254 Hz stereo 8-bit PCM)
  • Modern timer APIs — all gettimeofday() replaced with clock_gettime(CLOCK_MONOTONIC) for accurate monotonic timing
  • Ethernet synchronizationusleep(50) busy-polling replaced with pthread_cond_timedwait on a dedicated condition variable
  • SDL GUI modernized — deprecated immediate-mode OpenGL replaced with SDL_Renderer + SDL_Texture
  • Debugger rewrite — migrated from GLUT to SDL2, fixed ch_reset linker error

Build

make app      # SwiftUI app (requires macOS 14+, Command Line Tools)
make sdl      # SDL GUI (requires SDL2)
make core     # Core library only

Credits

Test plan

  • make core produces universal libshoebill_core.a (arm64 + x86_64)
  • make app builds Shoebill.app with embedded core library
  • Zero compiler warnings during build
  • A/UX 3.1 boots to desktop on Apple Silicon (macOS 15, M-series)
  • Mouse input and keyboard input work correctly
  • Audio output works (ASC via Core Audio)
  • All 7 core optimizations applied and verified incrementally

Fixes #15, #20.

Made with Cursor

Mark Nowak added 3 commits March 21, 2026 18:47
- Add arm64 architecture to core/Makefile, replacing i386 (dead on modern macOS)
- Update Xcode project: MACOSX_DEPLOYMENT_TARGET=14.0, SDKROOT=macosx,
  VALID_ARCHS="x86_64 arm64", enable CLANG_ENABLE_OBJC_WEAK
- Fix memset() argument swap in fpu_initialize() (issue pruten#20, reported by @mitchblank)
- Fix K&R-style _native_tentox(a) -> _native_tentox(double a) (issue pruten#15)
- Rename HACKY_MATH_X86 to HACKY_MATH_NATIVE since double+math.h works on all archs
- Bump version to 0.1.0

Based on ARM64 build work from PR pruten#19 by @calmsacibis995.
Tested: libshoebill_core.a builds clean (zero warnings) as universal arm64+x86_64.

Made-with: Cursor
New SwiftUI application (ShoebillApp/) replacing the legacy Objective-C/OpenGL GUI:
- Metal-based framebuffer rendering with proper HiDPI/Retina scaling
- SwiftUI Settings with tabbed preferences (General, Disks, Display)
- Full ADB keyboard mapping ported from shoeApplication.m
- Mouse capture/release (click to capture, right-click to release)
- PRAM persistence via ~/Library/Application Support/Shoebill/
- Xcode project with "Build Core Library" script phase
- C bridge helpers for Swift interop with anonymous C struct fields

Build system:
- New top-level Makefile targets: app, core, sdl, legacy-gui, debugger
- Updated .gitignore for new build outputs

Documentation:
- Rewritten README.md with build instructions, requirements, credits
- Added CHANGELOG.md documenting all changes for v0.1.0

Made-with: Cursor
Major update bringing Shoebill to modern macOS with Apple Silicon support,
a native SwiftUI interface, and extensive emulation core optimizations.
Verified to boot A/UX 3.1 to desktop on macOS 15 / Apple M-series.

ARM64 & Build:
- Universal binary (arm64 + x86_64) for core library
- Fixed FPU memset() argument swap (pruten#20) and K&R declaration (pruten#15)
- Renamed HACKY_MATH_X86 to HACKY_MATH_NATIVE
- Updated deployment target to macOS 14.0

SwiftUI Application (ShoebillApp/):
- Modern Metal-based framebuffer rendering
- HiDPI/Retina display support
- Full ADB keyboard mapping and mouse capture
- PRAM persistence via Application Support
- Settings UI for ROM, disks, display resolution
- App icon

Core Optimizations:
- CPU dispatch: single direct 64K table replaces two-level indirection
- PMMU cache: 4-way set-associative with pseudo-LRU (was direct-mapped)
- SoftFloat 2b upgraded to 3e via backward-compatible API shim
- Audio: Apple Sound Chip output via Core Audio AudioQueue API
- Timer APIs: gettimeofday() replaced with clock_gettime(CLOCK_MONOTONIC)
- Ethernet: usleep busy-polling replaced with pthread_cond_timedwait
- VBL interrupt delivery with proper thread-safety

SDL GUI & Debugger:
- Replaced deprecated OpenGL with SDL_Renderer + SDL_Texture
- Debugger migrated from GLUT to SDL2
- Fixed ch_reset linker error with libedit

Incorporates build changes from PR pruten#19 by @calmsacibis995.
Fixes pruten#15, pruten#20.

Made-with: Cursor
@calmsacibis995
Copy link
Copy Markdown

Can you add a .PHONY target to the central Makefile, to ensure a smooth build process?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error trying to build under Fedora 31 with lin.build.sh

2 participants