Add Nintendo DS port (Embedded Swift)#2
Merged
Merged
Conversation
Build system modeled on MillerTechnologyPeru/swift-embedded-nds and junkbot-swift's ports/NDS: the port compiles whole-module for armv5te-none-none-eabi (the DS's ARM946E-S; needs a nightly toolchain's Embedded stdlib slice -- release toolchains only ship armv4t), links against calico-based libnds, and packages with ndstool using calico's prebuilt ARM7. Both screens are 256x192: the bottom (touch) screen hosts the iPod UI through the shared software rasterizer, drawn into a double-buffered 16bpp ARGB1555 bitmap background (map-base flip); the top screen shows a static controls banner. The embedded mini-core (ClassicCore.swift) is identical to ports/3DS's; Renderer.swift differs only in screen size, pixel format (ARGB1555, red in the low bits), and present path. common/shim.c carries the ARMv5TE runtime support: posix_memalign, arc4random_buf, the _swift_stdlib_strto* wrappers, and the __atomic_* outline helpers (no atomic instructions on the ARM946E-S). Controls: D-pad up/down = click wheel, A = select, B = Menu (back), X/Y = play/pause, L/R = previous/next track, START = exit. A CI workflow builds and uploads the .nds on every push.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Adds
ports/NDS: a Nintendo DS homebrew port of ClassicUI built with Embedded Swift, modeled on MillerTechnologyPeru/swift-embedded-nds and junkbot-swift's ports/NDS — a Makefile-driven build targetingarmv5te-none-none-eabi(an exact match for the DS's ARM946E-S), linked against calico-based libnds and packaged with ndstool using calico's prebuilt ARM7.Both screens are 256×192: the bottom (touch) screen hosts the iPod UI through a software rasterizer drawn into a double-buffered 16bpp bitmap background (map-base flip, vblank-synced); the top screen shows a static controls banner in a second bitmap background.
Design
Same engine/port split as
ports/3DS(#1): the desktop SwiftUI-subset core cannot compile under Embedded Swift (noMirror, noany Viewexistentials, no Foundation, no Observation), so the port uses the embedded mini-core —source/ClassicCore.swiftandtools/gen_font.pyare byte-identical to the 3DS port's, andsource/Renderer.swiftdiffers only in:Everything else carries over: menus with selection restore and scroll windowing, settings value rows, Notes-style wrapped text pages, Now Playing with a live progress bar, the eased navigation slide with pinned status bar, and antialiased 8-bit-coverage text from the same build-time Helvetica rasterization.
common/shim.ccarries the ARMv5TE runtime support the Embedded Swift object needs:posix_memalign,arc4random_buf, the_swift_stdlib_strto*_clocalewrappers, and the__atomic_*outline helpers (the ARM946E-S has no atomic instructions; a short IRQ lock makes each operation atomic with respect to interrupt handlers).Once this and #1 both land, the shared embedded mini-core is a candidate for extraction into a common
ports/location.Controls
Building
Requires devkitPro with nds-dev, a Swift toolchain whose Embedded stdlib ships an
armv5te-none-none-eabislice (main-branch nightly snapshots; release toolchains only ship armv4t), and python3 with Pillow. Verified: builds a 175 KBClassicUI.nds.CI / Testing
Nintendo DSworkflow builds the ROM on every push (devkitPro pacman + nightly Swift toolchain resolved at run time) and uploadsClassicUI.ndsas an artifact — green, alongside the existing macOS/Linux jobs.