JoeyLib 68k ASM code changed to GAS format to avoid vasm commerical license restrictions.

This commit is contained in:
Scott Duensing 2026-04-26 21:03:06 -05:00
parent d023d76ebe
commit 6f37b126b8
6 changed files with 456 additions and 163 deletions

281
LICENSES.md Normal file
View file

@ -0,0 +1,281 @@
# Third-Party Licenses
This file inventories every third-party component JoeyLib depends on,
either at runtime (linked into the produced binaries) or at build /
test time. Components are grouped by role; within each group entries
list the platforms that consume the component, the upstream URL, and
the license.
When upstream license terms change, update the corresponding row here.
---
## Runtime libraries (linked into joeylib output binaries)
These ship as part of, or are linked into, an executable built by
JoeyLib. License compatibility for these matters most.
### libxmp-lite
- **Used on:** DOS, Atari ST
- **URL:** <https://github.com/libxmp/libxmp>
- **License:** MIT
- **Role:** ProTracker / Amiga MOD replayer + SMIX SFX overlay. Linked
into AUDIO binaries on the chunky-display platforms.
- **Vendored at:** `toolchains/audio/libxmp-lite/`
### NinjaTrackerPlus (NTP)
- **Used on:** Apple IIgs
- **URL:** <https://www.ninjaforce.com/html/products_software.html>
(downloads from <https://www.ninjaforce.com/downloads/>)
- **License:** No explicit license in the source distribution; written
by Jesse Blue (NinjaForce). Treated here as free for use; consult
upstream before commercial redistribution.
- **Role:** Apple IIgs Ensoniq DOC `.NTP` module replayer + SFX
streamer. Merlin32-assembled and **linked** into the AUDIO binary as
bytes (see `make/iigs.mk` `$(NTP_HEADER)` rule).
- **Vendored at:** `toolchains/iigs/ntp/ninjatrackerplus.s` (source);
build product baked into `examples/audio` AUDIO binary.
### PTPlayer
- **Used on:** Amiga
- **URL:** <http://aminet.net/mus/play/ptplayer.lha>
(author Frank Wille, <http://aminet.net/package/mus/play/ptplayer>)
- **License:** Public Domain
- **Role:** ProTracker MOD replayer + `mt_playfx` SFX channel for the
Paula audio HAL.
- **Vendored at:** `toolchains/amiga/ptplayer/`
---
## Build-time toolchains (NOT linked, used to produce binaries)
These run on the developer's machine to compile / assemble / link
JoeyLib for each target. They are not redistributed inside the
produced game binaries.
### Golden Gate (host tools: iix, profuse, mkfs-profuse, dumpobj)
- **Used on:** Apple IIgs
- **URL:** <https://golden-gate.ksherlock.com/>
(publisher / store: <https://juiced.gs/store/golden-gate/>)
- **License:** **Commercial** software by Kelvin Sherlock,
distributed through Juiced.GS / Gamebits. End-user purchase
required; redistribution **not** permitted.
- **Role:** Cross-host harness that runs ORCA-style IIgs tools on a
modern OS. Provides the `iix` shell, the OMF linker, `profuse`
(ProDOS FUSE mount), `mkfs-profuse`, `dumpobj`, and the IIgs-side
filesystem image (`$GOLDEN_GATE`) that the harness emulates.
- **Distribution:** **Not redistributed by JoeyLib.** Each developer
must bring their own purchased copy. `toolchains/install.sh`
builds host tools from a developer-supplied source checkout under
`stuff/GoldenGate/` (the `stuff/` tree is gitignored) and stages
the IIgs filesystem from a developer-supplied `gg-linux.tgz`. The
resulting `toolchains/iigs/gg-tools/` and `toolchains/iigs/goldengate/`
trees are gitignored.
### ORCA/C compiler + ORCA libraries
- **Used on:** Apple IIgs
- **URL:** <https://github.com/byteworksinc/ORCA-C>
(commercial distribution: <https://juiced.gs/store/opus-ii/>)
- **License:** **Commercial** product by The Byte Works, Inc.
(Mike Westerfield). Source code is published on GitHub under a
custom license that grants only **private use, fork, and
modification**; redistribution in any form other than submission
back to the upstream repo requires written permission. Commercial
rights remain with Byte Works; the compiler is sold today as part
of the **Opus ][** collection via Juiced.GS.
- **Role:** ANSI C compiler for the 65816 + Apple IIgs runtime
libraries. Run via Golden Gate's `iix` harness.
- **Distribution:** **Not redistributed by JoeyLib.** ORCA support
files arrive as part of the developer-supplied Golden Gate /
Opus ][ install bundle and land inside the gitignored
`toolchains/iigs/goldengate/` tree.
### Merlin32
- **Used on:** Apple IIgs
- **URL:** <https://brutaldeluxe.fr/products/crossdevtools/merlin/>
- **License:** Freely distributed by Brutal Deluxe Software
(Olivier Zardini, Antoine Vignau). Source published with no
formal open-source license header — Brutal Deluxe's "open source
philosophy" but copyright is retained. Treat as "free to use,
redistribute as part of a build chain; ask before forking
commercially."
- **Role:** 65816 cross-assembler. Builds NinjaTrackerPlus.
- **Vendored at:** `toolchains/iigs/merlin32/`
### Bebbo m68k-amigaos GCC toolchain
- **Used on:** Amiga
- **URL:** <https://github.com/AmigaPorts/m68k-amigaos-gcc>
- **License:** GNU GPL v2 (gcc, binutils, libnix); per-component
copyrights listed in upstream `README.md`. Includes assets covered
by individual permissive notices (Roadshow, fd2pragma public
domain, ira freeware, etc.).
- **Role:** AmigaOS HUNK-format gcc + binutils + libnix used to
compile the Amiga port and link against PTPlayer.
- **Vendored at:** `toolchains/amiga/gcc/`
### vasm
- **Used on:** Amiga (PTPlayer only)
- **URL:** <http://sun.hasenbraten.de/vasm/>
- **License:** vasm custom license — © Volker Barthelmann; free for
non-commercial use, plus an explicit **commercial-use exception
for M68k + AmigaOS targets** (see vasm distribution README). Other
commercial use requires written permission. JoeyLib's only
remaining vasm invocation is `ptplayer.asm` on the Amiga path,
which falls under the M68k+AmigaOS exception.
- **Role:** Assemble third-party `ptplayer.asm` (Frank Wille's
Devpac/vasm-syntax source). Our own `.s` files are GAS syntax and
go through `m68k-amigaos-as` (binutils, GPL) instead.
- **Vendored at:** `toolchains/amiga/vasm/`
### m68k-atari-mint GCC toolchain (Thorsten Otto builds)
- **Used on:** Atari ST
- **URL:** <https://tho-otto.de/download/mint/>
(gcc upstream: GNU; mintlib: <https://github.com/freemint/mintlib>)
- **License:** GNU GPL v2 (gcc, binutils); mintlib is a mix of GPL
and permissive (per-file headers).
- **Role:** GEMDOS-native gcc + binutils + mintlib used to compile
the Atari ST port.
- **Vendored at:** `toolchains/atarist/gcc/`
### DJGPP (build-djgpp packaging)
- **Used on:** DOS
- **URL:** <https://github.com/andrewwutw/build-djgpp>
(DJGPP upstream: <http://www.delorie.com/djgpp/>)
- **License:** Build script GNU GPL v3; bundled gcc/binutils GNU
GPL v2; DJGPP runtime libraries (libc) are mostly public-domain or
permissive — see DJGPP `readme.1st`.
- **Role:** 32-bit protected-mode gcc cross-compiler producing
COFF binaries that run on 386+ DOS via DPMI.
- **Vendored at:** `toolchains/dos/djgpp/`
### CWSDPMI
- **Used on:** DOS
- **URL:** <https://sandmann.dotster.com/cwsdpmi/>
- **License:** Custom redistribution terms (Charles W. Sandmann,
© 19952010). Binary may be redistributed without source provided
the executables are unmodified and end users are notified of
source availability — full terms in `cwsdpmi.doc`. Source is
GPL-licensed if distributed.
- **Role:** Stubbed-into-binary DPMI server for DJGPP-compiled DOS
executables (via `embed-dpmi.sh`).
- **Vendored at:** `toolchains/dos/cwsdpmi/`
### NASM
- **Used on:** DOS
- **URL:** <https://www.nasm.us/>
- **License:** 2-clause BSD
- **Role:** Assembler for x86 inline-asm support files in the DOS
port.
- **Vendored at:** `toolchains/dos/nasm/`
---
## Test-time emulators (not shipped, not linked)
Used by `scripts/run-*.sh` to run the produced binaries on the
developer's machine. Not part of any redistributed artifact.
### GSplus (KEGS fork)
- **Used on:** Apple IIgs
- **URL:** <https://github.com/digarok/gsplus>
- **License:** GNU GPL v3
- **Vendored at:** `toolchains/emulators/gsplus/`
### MAME
- **Used on:** Apple IIgs (apple2gs driver, optional)
- **URL:** <https://www.mamedev.org/>
- **License:** GNU GPL v2+ (GPL-2.0-or-later) plus a 3-clause BSD
alternative for some components.
### Hatari
- **Used on:** Atari ST
- **URL:** <https://www.hatari-emu.org/>
- **License:** GNU GPL v2
### DOSBox
- **Used on:** DOS
- **URL:** <https://www.dosbox.com/>
- **License:** GNU GPL v2
### FS-UAE
- **Used on:** Amiga
- **URL:** <https://fs-uae.net/>
- **License:** GNU GPL v2 (UAE codebase)
### EmuTOS
- **Used on:** Atari ST (TOS replacement for Hatari)
- **URL:** <https://emutos.sourceforge.io/>
- **License:** GNU GPL v2
- **Vendored at:** `toolchains/emulators/support/emutos-512k.img`
---
## System ROMs and disk images (used for testing only)
These are **not** part of JoeyLib distribution and **not**
redistributed. They are downloaded to the developer's local cache by
`toolchains/install.sh` for emulator-side testing only. License terms
prohibit redistribution; please consult the source if you intend to
ship anything that depends on them.
### Apple IIgs ROM 03
- **Used on:** Apple IIgs (GSplus, MAME)
- **URL:** Various preservation archives, e.g.
<https://mirrors.apple2.org.za/ftp.apple.asimov.net/emulators/rom_images/>
- **License:** Apple Inc. proprietary firmware. Provided here for
developer testing only; **do not redistribute** as part of any
derivative project.
### Apple IIgs System 6.0.4
- **Used on:** Apple IIgs (GSplus boot disk)
- **URL:** <https://mirrors.apple2.org.za/ftp.apple.asimov.net/images/gs/os/gsos/>
- **License:** Apple Inc. proprietary OS. Same caveat as the ROM.
### Apple IIgs apple2gs MAME ROM set
- **Used on:** Apple IIgs (MAME testing path)
- **URL:** Same preservation archives as above.
- **License:** Apple Inc. proprietary firmware. Required for MAME's
apple2gs driver but not redistributed.
### Amiga Kickstart ROM (optional)
- **Used on:** Amiga (FS-UAE, optional — falls back to AROS)
- **URL:** Cloanto / Amiga Forever (commercial), or original media.
- **License:** Cloanto / Amiga Corp. proprietary. JoeyLib does **not**
bundle Kickstart; users supply their own ROM at
`toolchains/emulators/support/kickstart.rom` if they have one.
---
## Maintenance
When adding a new third-party dependency:
1. Append a row in the appropriate section above.
2. Record platform(s), upstream URL, license name, and a one-line
role description.
3. If the dependency is vendored, list the path under
`toolchains/`.
4. If license terms restrict redistribution, call that out
explicitly (as we do for Apple ROMs).

View file

@ -17,11 +17,15 @@ CFLAGS := $(COMMON_CFLAGS) -DJOEYLIB_PLATFORM_AMIGA -m68000 -fomit-frame-pointe
# OSCOMPAT=1 selects PTPlayer's audio.device-friendly variant (uses
# CIA-B + audio.device interrupts via the OS rather than taking over
# Paula directly), matching the way our HAL cooperates with Intuition.
# vasm is only invoked for ptplayer.asm here -- Frank Wille's source
# is written in Devpac/vasm syntax and there is no maintained GAS-
# syntax port. JoeyLib's own .s files are GAS syntax and assembled by
# the bundled m68k-amigaos-as via the gcc driver.
# -Fhunk matches Bebbo gcc-amigaos's AmigaOS HUNK object format. ELF
# objects from vasm cannot be linked into a HUNK libjoey.a (the ar
# "file format not recognized" failure mode is silent at archive time
# and surfaces as undefined references at every binary's link step).
ASFLAGS := -Fhunk -m68000 -quiet -DOSCOMPAT=1
PTPLAYER_ASFLAGS := -Fhunk -m68000 -quiet -DOSCOMPAT=1
# --allow-multiple-definition lets our user-space tzset stub
# (src/port/amiga/libinit.c) win over libnix's version in
# __gmtoffset.o. libnix's tzset dereferences a possibly-NULL
@ -82,13 +86,17 @@ $(BUILD)/obj/port/%.o: $(SRC_PORT)/amiga/%.c
@mkdir -p $(dir $@)
$(AMIGA_CC) $(CFLAGS) -c $< -o $@
# Hand-written 68k assembly: GAS syntax, fed through the gcc driver
# so the bundled m68k-amigaos-as (binutils) does the work.
$(BUILD)/obj/port/%.o: $(SRC_PORT)/amiga/%.s
@mkdir -p $(dir $@)
$(AMIGA_AS) $(ASFLAGS) $< -o $@
$(AMIGA_CC) $(CFLAGS) -c $< -o $@
# PTPlayer is third-party Devpac/vasm-syntax assembly with no
# maintained GAS port; vasm is invoked only here.
$(BUILD)/obj/port/ptplayer.o: $(PTPLAYER_DIR)/ptplayer.asm
@mkdir -p $(dir $@)
$(AMIGA_AS) $(ASFLAGS) $< -o $@
$(AMIGA_AS) $(PTPLAYER_ASFLAGS) $< -o $@
$(BUILD)/obj/codegen/%.o: $(CODEGEN_DIR)/%.c
@mkdir -p $(dir $@)
@ -96,7 +104,7 @@ $(BUILD)/obj/codegen/%.o: $(CODEGEN_DIR)/%.c
$(BUILD)/obj/68k/%.o: $(SRC_68K)/%.s
@mkdir -p $(dir $@)
$(AMIGA_AS) $(ASFLAGS) $< -o $@
$(AMIGA_CC) $(CFLAGS) -c $< -o $@
$(LIB): $(LIB_OBJS)
@mkdir -p $(dir $@)

View file

@ -8,10 +8,6 @@ LIBDIR := $(BUILD)/lib
BINDIR := $(BUILD)/bin
CFLAGS := $(COMMON_CFLAGS) -DJOEYLIB_PLATFORM_ATARIST -m68000 -fomit-frame-pointer -I$(REPO_DIR)/toolchains/audio/libxmp-lite/include -I$(REPO_DIR)/toolchains/atarist/include-shim
# m68k-atari-mint gcc emits a.out (.o files report "a.out SunOS"),
# not ELF. vasm has to match or `ld: file in wrong format` fires at
# link time.
ASFLAGS := -Faout -m68000 -quiet
LDFLAGS :=
# libxmp-lite shared with the DOS port. Built as a static archive that
@ -75,13 +71,16 @@ $(BUILD)/obj/port/%.o: $(SRC_PORT)/atarist/%.c
@mkdir -p $(dir $@)
$(ST_CC) $(CFLAGS) -c $< -o $@
# Hand-written 68k assembly: GAS syntax, fed through the gcc driver
# so the bundled m68k-atari-mint-as (binutils) does the work. No vasm
# dependency on the ST path.
$(BUILD)/obj/port/%.o: $(SRC_PORT)/atarist/%.s
@mkdir -p $(dir $@)
$(ST_AS) $(ASFLAGS) $< -o $@
$(ST_CC) $(CFLAGS) -c $< -o $@
$(BUILD)/obj/68k/%.o: $(SRC_68K)/%.s
@mkdir -p $(dir $@)
$(ST_AS) $(ASFLAGS) $< -o $@
$(ST_CC) $(CFLAGS) -c $< -o $@
$(BUILD)/obj/codegen/%.o: $(CODEGEN_DIR)/%.c
@mkdir -p $(dir $@)

View file

@ -1,125 +1,127 @@
; Amiga chunky-to-planar conversion -- 68000 hand-rolled.
;
; Drop-in replacement for hal.c's old c2pRange C inner loop. The C
; version walked every pixel and OR'd individual bits into 4 plane
; accumulators -- ~1.5 s for a full 320x200 frame on a 7 MHz 68000
; (the GCC m68k codegen is poor for tight bit-twiddling). This rewrite
; uses a 4 KB lookup table built once at HAL init: each (sourceByte,
; bytePosition, plane) tuple maps to the plane-byte-bit contribution
; that source byte makes when it sits at that position within a
; 4-byte (= 8-pixel) planar group.
;
; Calling convention: m68k-amigaos-gcc cdecl.
; Args on stack at 4(sp), 8(sp), ...
; d2-d7, a2-a6 are callee-save.
; No return value.
;
; void chunkyToPlanarRow(const uint8_t *src, ; 4(sp) - 4bpp packed source row
; uint8_t *p0, ; 8(sp) - plane 0 dest row
; uint8_t *p1, ; 12(sp) - plane 1 dest row
; uint8_t *p2, ; 16(sp) - plane 2 dest row
; uint8_t *p3, ; 20(sp) - plane 3 dest row
; uint16_t n, ; 24(sp) - planar byte count (low word)
; const uint8_t *lut); ; 28(sp) - 4 KB LUT base
;
; LUT layout: lut[pos*1024 + plane*256 + src] = 1-byte plane contribution
; for source byte `src` sitting at byte-position `pos` within its
; 4-byte planar group, going to plane `plane`. Byte-position 0 is the
; leftmost (its two pixels land in plane-byte bits 7 and 6); position
; 3 is the rightmost (bits 1 and 0). Built once by chunkyToPlanarInit
; (in hal.c) at HAL boot.
| Amiga chunky-to-planar conversion -- 68000 hand-rolled.
|
| Drop-in replacement for hal.c's old c2pRange C inner loop. The C
| version walked every pixel and OR'd individual bits into 4 plane
| accumulators -- ~1.5 s for a full 320x200 frame on a 7 MHz 68000
| (the GCC m68k codegen is poor for tight bit-twiddling). This rewrite
| uses a 4 KB lookup table built once at HAL init: each (sourceByte,
| bytePosition, plane) tuple maps to the plane-byte-bit contribution
| that source byte makes when it sits at that position within a
| 4-byte (= 8-pixel) planar group.
|
| Calling convention: m68k-amigaos-gcc cdecl.
| Args on stack at 4(sp), 8(sp), ...
| d2-d7, a2-a6 are callee-save.
| No return value.
|
| void chunkyToPlanarRow(const uint8_t *src, ; 4(sp) - 4bpp packed source row
| uint8_t *p0, ; 8(sp) - plane 0 dest row
| uint8_t *p1, ; 12(sp) - plane 1 dest row
| uint8_t *p2, ; 16(sp) - plane 2 dest row
| uint8_t *p3, ; 20(sp) - plane 3 dest row
| uint16_t n, ; 24(sp) - planar byte count (low word)
| const uint8_t *lut); ; 28(sp) - 4 KB LUT base
|
| LUT layout: lut[pos*1024 + plane*256 + src] = 1-byte plane contribution
| for source byte `src` sitting at byte-position `pos` within its
| 4-byte planar group, going to plane `plane`. Byte-position 0 is the
| leftmost (its two pixels land in plane-byte bits 7 and 6); position
| 3 is the rightmost (bits 1 and 0). Built once by chunkyToPlanarInit
| (in hal.c) at HAL boot.
|
| GAS-syntax (binutils m68k); assembled by m68k-amigaos-as via the
| gcc driver.
xdef _chunkyToPlanarRow
.text
.globl _chunkyToPlanarRow
section .text,code
; Stack frame size of MOVEM.L block: d2-d7 (6) + a2-a6 (5) = 11 regs
; * 4 bytes = 44 bytes. Args therefore start at the original sp+4
; offset PLUS 44.
SAVED_REGS_SIZE equ 44
| Stack frame size of MOVEM.L block: d2-d7 (6) + a2-a6 (5) = 11 regs
| * 4 bytes = 44 bytes. Args therefore start at the original sp+4
| offset PLUS 44.
.equ SAVED_REGS_SIZE, 44
_chunkyToPlanarRow:
movem.l d2-d7/a2-a6,-(sp)
movem.l %d2-%d7/%a2-%a6,-(%sp)
move.l 4+SAVED_REGS_SIZE(sp),a0 ; src
move.l 8+SAVED_REGS_SIZE(sp),a1 ; p0
move.l 12+SAVED_REGS_SIZE(sp),a2 ; p1
move.l 16+SAVED_REGS_SIZE(sp),a3 ; p2
move.l 20+SAVED_REGS_SIZE(sp),a4 ; p3
; n is a uint16_t but GCC promotes to int and pushes a
; full 4 bytes -- the low word lives at +2 in big-endian
; layout.
move.w 24+SAVED_REGS_SIZE+2(sp),d7 ; planar byte count
move.l 28+SAVED_REGS_SIZE(sp),a5 ; LUT base
move.l 4+SAVED_REGS_SIZE(%sp),%a0 | src
move.l 8+SAVED_REGS_SIZE(%sp),%a1 | p0
move.l 12+SAVED_REGS_SIZE(%sp),%a2 | p1
move.l 16+SAVED_REGS_SIZE(%sp),%a3 | p2
move.l 20+SAVED_REGS_SIZE(%sp),%a4 | p3
| n is a uint16_t but GCC promotes to int and pushes a
| full 4 bytes -- the low word lives at +2 in big-endian
| layout.
move.w 24+SAVED_REGS_SIZE+2(%sp),%d7 | planar byte count
move.l 28+SAVED_REGS_SIZE(%sp),%a5 | LUT base
subq.w #1,d7 ; DBRA: count-1
bmi .done ; nothing to do
subq.w #1,%d7 | DBRA: count-1
bmi .Ldone | nothing to do
.byteLoop:
moveq #0,d0 ; plane 0 acc
moveq #0,d1 ; plane 1 acc
moveq #0,d2 ; plane 2 acc
moveq #0,d3 ; plane 3 acc
.LbyteLoop:
moveq #0,%d0 | plane 0 acc
moveq #0,%d1 | plane 1 acc
moveq #0,%d2 | plane 2 acc
moveq #0,%d3 | plane 3 acc
; ----- Source byte position 0 -----
; a5 points to start of LUT. Plane 0/1/2/3 sub-tables
; for position 0 are at offsets 0/256/512/768.
moveq #0,d4
move.b (a0)+,d4 ; src[0]
move.l a5,a6
or.b (a6,d4.w),d0 ; +0 = pos0 plane 0
lea 256(a6),a6
or.b (a6,d4.w),d1 ; +256 = pos0 plane 1
lea 256(a6),a6
or.b (a6,d4.w),d2 ; +512 = pos0 plane 2
lea 256(a6),a6
or.b (a6,d4.w),d3 ; +768 = pos0 plane 3
| ----- Source byte position 0 -----
| a5 points to start of LUT. Plane 0/1/2/3 sub-tables
| for position 0 are at offsets 0/256/512/768.
moveq #0,%d4
move.b (%a0)+,%d4 | src[0]
move.l %a5,%a6
or.b (%a6,%d4.w),%d0 | +0 = pos0 plane 0
lea 256(%a6),%a6
or.b (%a6,%d4.w),%d1 | +256 = pos0 plane 1
lea 256(%a6),%a6
or.b (%a6,%d4.w),%d2 | +512 = pos0 plane 2
lea 256(%a6),%a6
or.b (%a6,%d4.w),%d3 | +768 = pos0 plane 3
; ----- Source byte position 1 -----
lea 256(a6),a6 ; advance to pos1 plane 0
moveq #0,d4
move.b (a0)+,d4
or.b (a6,d4.w),d0
lea 256(a6),a6
or.b (a6,d4.w),d1
lea 256(a6),a6
or.b (a6,d4.w),d2
lea 256(a6),a6
or.b (a6,d4.w),d3
| ----- Source byte position 1 -----
lea 256(%a6),%a6 | advance to pos1 plane 0
moveq #0,%d4
move.b (%a0)+,%d4
or.b (%a6,%d4.w),%d0
lea 256(%a6),%a6
or.b (%a6,%d4.w),%d1
lea 256(%a6),%a6
or.b (%a6,%d4.w),%d2
lea 256(%a6),%a6
or.b (%a6,%d4.w),%d3
; ----- Source byte position 2 -----
lea 256(a6),a6
moveq #0,d4
move.b (a0)+,d4
or.b (a6,d4.w),d0
lea 256(a6),a6
or.b (a6,d4.w),d1
lea 256(a6),a6
or.b (a6,d4.w),d2
lea 256(a6),a6
or.b (a6,d4.w),d3
| ----- Source byte position 2 -----
lea 256(%a6),%a6
moveq #0,%d4
move.b (%a0)+,%d4
or.b (%a6,%d4.w),%d0
lea 256(%a6),%a6
or.b (%a6,%d4.w),%d1
lea 256(%a6),%a6
or.b (%a6,%d4.w),%d2
lea 256(%a6),%a6
or.b (%a6,%d4.w),%d3
; ----- Source byte position 3 -----
lea 256(a6),a6
moveq #0,d4
move.b (a0)+,d4
or.b (a6,d4.w),d0
lea 256(a6),a6
or.b (a6,d4.w),d1
lea 256(a6),a6
or.b (a6,d4.w),d2
lea 256(a6),a6
or.b (a6,d4.w),d3
| ----- Source byte position 3 -----
lea 256(%a6),%a6
moveq #0,%d4
move.b (%a0)+,%d4
or.b (%a6,%d4.w),%d0
lea 256(%a6),%a6
or.b (%a6,%d4.w),%d1
lea 256(%a6),%a6
or.b (%a6,%d4.w),%d2
lea 256(%a6),%a6
or.b (%a6,%d4.w),%d3
; ----- Store plane bytes -----
move.b d0,(a1)+
move.b d1,(a2)+
move.b d2,(a3)+
move.b d3,(a4)+
| ----- Store plane bytes -----
move.b %d0,(%a1)+
move.b %d1,(%a2)+
move.b %d2,(%a3)+
move.b %d3,(%a4)+
dbra d7,.byteLoop
dbra %d7,.LbyteLoop
.done:
movem.l (sp)+,d2-d7/a2-a6
.Ldone:
movem.l (%sp)+,%d2-%d7/%a2-%a6
rts

View file

@ -1,56 +1,55 @@
; Atari ST audio ISR -- MFP Timer A drives per-sample PWM output via
; the YM2149 channel-A volume register.
;
; Each interrupt:
; 1. Reads one byte from the libxmp-lite mix buffer.
; 2. Writes its high 4 bits to YM register 8 (channel A volume) so
; the analog filter on the YM output emits a 4-bit-resolution
; sample for that tick.
; 3. Advances the play pointer; raises a refill flag when crossing
; the midpoint or end of the buffer; wraps at the end.
; 4. Acks the MFP Timer-A bit in ISRA and RTEs.
;
; Communication with the C HAL is via four globals defined in audio.c:
; _gMixBuf -- start of the mix buffer (uint8_t array)
; _gMixPos -- volatile pointer to the next sample to play
; _gMixMid -- end of first half (used to detect mid-cross)
; _gMixEnd -- end of buffer (used to detect wrap)
; _gNeedRefill -- two-byte array; ISR writes 1 to mark a half stale
| Atari ST audio ISR -- MFP Timer A drives per-sample PWM output via
| the YM2149 channel-A volume register.
|
| Each interrupt:
| 1. Reads one byte from the libxmp-lite mix buffer.
| 2. Writes its high 4 bits to YM register 8 (channel A volume) so
| the analog filter on the YM output emits a 4-bit-resolution
| sample for that tick.
| 3. Advances the play pointer; raises a refill flag when crossing
| the midpoint or end of the buffer; wraps at the end.
| 4. Acks the MFP Timer-A bit in ISRA and RTEs.
|
| Communication with the C HAL is via four globals defined in audio.c:
| _gMixBuf -- start of the mix buffer (uint8_t array)
| _gMixPos -- volatile pointer to the next sample to play
| _gMixMid -- end of first half (used to detect mid-cross)
| _gMixEnd -- end of buffer (used to detect wrap)
| _gNeedRefill -- two-byte array; ISR writes 1 to mark a half stale
|
| GAS-syntax (binutils m68k); assembled by m68k-atari-mint-as via the
| gcc driver.
xdef _mfpTimerAIsr
xref _gMixBuf
xref _gMixPos
xref _gMixMid
xref _gMixEnd
xref _gNeedRefill
.text
.globl _mfpTimerAIsr
YM_SELECT equ $FFFF8800
YM_DATA equ $FFFF8802
MFP_ISRA equ $FFFFFA0F
.equ YM_SELECT, 0xFFFF8800
.equ YM_DATA, 0xFFFF8802
.equ MFP_ISRA, 0xFFFFFA0F
_mfpTimerAIsr:
movem.l d0/a0,-(sp)
movem.l %d0/%a0,-(%sp)
move.l _gMixPos,a0
move.b (a0)+,d0
lsr.b #4,d0
and.w #$0F,d0
move.l _gMixPos,%a0
move.b (%a0)+,%d0
lsr.b #4,%d0
and.w #0x0F,%d0
move.b #8,YM_SELECT
move.b d0,YM_DATA
move.b %d0,YM_DATA
cmp.l _gMixMid,a0
bne.s .check_end
cmp.l _gMixMid,%a0
bne.s 1f
move.b #1,_gNeedRefill+0
.check_end:
cmp.l _gMixEnd,a0
blt.s .save_pos
1:
cmp.l _gMixEnd,%a0
blt.s 2f
move.b #1,_gNeedRefill+1
lea _gMixBuf,a0
.save_pos:
move.l a0,_gMixPos
lea _gMixBuf,%a0
2:
move.l %a0,_gMixPos
move.b #$DF,MFP_ISRA
move.b #0xDF,MFP_ISRA
movem.l (sp)+,d0/a0
movem.l (%sp)+,%d0/%a0
rte

View file

@ -43,6 +43,9 @@ export AMIGA_PREFIX="${JOEY_TOOLCHAINS}/amiga/gcc"
export AMIGA_CC="${AMIGA_PREFIX}/bin/m68k-amigaos-gcc"
export AMIGA_AR="${AMIGA_PREFIX}/bin/m68k-amigaos-ar"
export AMIGA_LD="${AMIGA_PREFIX}/bin/m68k-amigaos-ld"
# vasm is invoked only for ptplayer.asm (third-party Devpac/vasm
# syntax). JoeyLib's own .s files are GAS syntax and go through
# AMIGA_CC -> m68k-amigaos-as (binutils, GPL) instead.
export AMIGA_AS="${JOEY_TOOLCHAINS}/amiga/vasm/bin/vasmm68k_mot"
export AMIGA_NDK="${AMIGA_PREFIX}/m68k-amigaos/sys-include"
export AMIGA_PTPLAYER="${JOEY_TOOLCHAINS}/amiga/ptplayer"
@ -55,7 +58,8 @@ export ST_PREFIX="${JOEY_TOOLCHAINS}/atarist/gcc"
export ST_CC="${ST_PREFIX}/bin/m68k-atari-mint-gcc"
export ST_AR="${ST_PREFIX}/bin/m68k-atari-mint-ar"
export ST_LD="${ST_PREFIX}/bin/m68k-atari-mint-ld"
export ST_AS="${JOEY_TOOLCHAINS}/atarist/vasm/bin/vasmm68k_mot"
# Atari ST .s files are GAS syntax and assembled via ST_CC ->
# m68k-atari-mint-as (binutils, GPL). No vasm dependency.
# ------------------------------------------------------------------------
# DOS