# Part of JoeyLib, Copyright (c) 2026 Scott Duensing, under the MIT License. # See LICENSE.md for license information. # SPDX-License-Identifier: MIT # # Apple IIgs firmware and system software for MAME: # - the MAME apple2gs (ROM 03) and apple2gsr1 (ROM 01) ROM sets, and a2ssc # (the Super Serial Card firmware the serial gates' slot card needs), from # the archive.org MAME 0.240 split set (the source llvm816 also uses) # - the CFFA2 card firmware, freely redistributed by dreher.net, needed # to boot images larger than an 800 KB floppy # - the GS/OS 6.0.4 System.Disk, from the Apple II archive # Everything lands in toolchains/firmware/iigs. compDescription="IIgs firmware: MAME ROM sets (ROM 01 + 03, Super Serial Card), CFFA2 firmware, GS/OS 6.0.4" compGroups="emulator:iigs" compRequires="host" compHostDeps="unzip" romBase="https://archive.org/download/mame-0.240-roms-split_202201/MAME%200.240%20ROMs%20(split)" cffaUrl="https://dreher.net/projects/CFforAppleII/downloads/Run6_CDROM.zip" gsosUrl="https://mirrors.apple2.org.za/ftp.apple.asimov.net/images/gs/os/gsos/Apple_IIGS_System_6.0.4.zip" fwDir="$JOEY_FIRMWARE/iigs" # file sha256 romSets=( "apple2gs.zip eddce4a9f9f6e73ffed06c5aede6fbcdaa01dda5568b81f90d865858a3d7d9bc" "apple2gsr1.zip 1c16fec7b9e785c4118909e409e61dcc38d0921f774b8708bae176bc5eb27307" "a2ssc.zip 2e46808466d578006d9e12f86af8e831aa4dffb554149e184c044a1d14ed8a20" ) cffaSha256="48242b9e2e87d87bfef1f1b1d64d1091bbfca182d745c1d031690fac0f80c0fe" gsosSha256="e42a4f1f50c1aae0cc17dc555415a2fbf21dc0b7b6b3e33e0d73bf22ef97506a" compPin="${romSets[*]} $cffaSha256 $gsosSha256" compInstall() { local entry local name local sha local tmp for entry in "${romSets[@]}"; do read -r name sha <<< "$entry" install -D -m 644 "$(fetchFile "$romBase/$name" "$sha")" "$fwDir/roms/$name" done tmp="$(freshBuildDir "$compId")" unzip -oq "$(fetchFile "$cffaUrl" "$cffaSha256")" 'Firmware/V2.0/CFFA20EEC02.BIN' -d "$tmp" install -D -m 644 "$tmp/Firmware/V2.0/CFFA20EEC02.BIN" "$fwDir/roms/a2cffa2/cffa20eec02.bin" unzip -oq "$(fetchFile "$gsosUrl" "$gsosSha256")" 'Apple_IIGS_System_6.0.4/PO Disk Images/System.Disk.po' -d "$tmp" install -D -m 644 "$tmp/Apple_IIGS_System_6.0.4/PO Disk Images/System.Disk.po" "$fwDir/gsos-system.po" dropBuildDir "$compId" } compInstalled() { local entry for entry in "${romSets[@]}"; do [ -f "$fwDir/roms/${entry%% *}" ] || return 1 done [ -f "$fwDir/roms/a2cffa2/cffa20eec02.bin" ] && [ -f "$fwDir/gsos-system.po" ] } compVerify() { local entry local name local sha for entry in "${romSets[@]}"; do read -r name sha <<< "$entry" [ "$(sha256Of "$fwDir/roms/$name")" = "$sha" ] || return 1 done [ "$(sha1sum "$fwDir/roms/a2cffa2/cffa20eec02.bin" | cut -d' ' -f1)" = "080ff88f19de22328e162954ee2b51ee65f9d5cd" ] && [ "$(sha1sum "$fwDir/gsos-system.po" | cut -d' ' -f1)" = "a57940a0b724fc7dc545236a4f9d4c6dd68f3e81" ] } compEnv() { envVar IIGS_ROMPATH "$fwDir/roms" envVar GSOS_SYSTEM_DISK "$fwDir/gsos-system.po" }