diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..24a8e87 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.png filter=lfs diff=lfs merge=lfs -text diff --git a/benchmarks/bubbleSort.c b/benchmarks/bubbleSort.c new file mode 100644 index 0000000..3d89df1 --- /dev/null +++ b/benchmarks/bubbleSort.c @@ -0,0 +1,13 @@ +// Bubble-sort 16 ints. Exercises array indexed access, nested loops, +// and i16 compare/swap — patterns common in any sorted-collection code. +void bubbleSort(short *a, unsigned short n) { + for (unsigned short i = 0; i < n - 1; i++) { + for (unsigned short j = 0; j < n - 1 - i; j++) { + if (a[j] > a[j + 1]) { + short t = a[j]; + a[j] = a[j + 1]; + a[j + 1] = t; + } + } + } +} diff --git a/benchmarks/djb2Hash.c b/benchmarks/djb2Hash.c new file mode 100644 index 0000000..e9ccdea --- /dev/null +++ b/benchmarks/djb2Hash.c @@ -0,0 +1,11 @@ +// djb2 string hash. Exercises i32 arithmetic in a tight pointer-walk +// loop — hash << 5 + hash + c. Hits the i32 shift inline path and the +// byte-load pattern in the same loop body. Real-world: every hash +// table keyed by strings uses something like this. +unsigned long djb2Hash(const char *s) { + unsigned long h = 5381; + while (*s) { + h = ((h << 5) + h) + (unsigned char)(*s++); + } + return h; +} diff --git a/benchmarks/globalArr8Sum.c b/benchmarks/globalArr8Sum.c new file mode 100644 index 0000000..6a62dfa --- /dev/null +++ b/benchmarks/globalArr8Sum.c @@ -0,0 +1,9 @@ +// i8 global-array indexed access — sister benchmark to globalArrSum +// that exercises the LDA8absX combine path. +unsigned char globalArr8[100]; + +unsigned short globalArr8Sum(unsigned short n) { + unsigned short s = 0; + for (unsigned short i = 0; i < n; i++) s += globalArr8[i]; + return s; +} diff --git a/benchmarks/globalArrFill.c b/benchmarks/globalArrFill.c new file mode 100644 index 0000000..94cf418 --- /dev/null +++ b/benchmarks/globalArrFill.c @@ -0,0 +1,8 @@ +// Fill the first n elements of a global i16 array. Exercises the +// store-side of the W65816UnLSR + STA_AbsX combine for global-array +// loops. +unsigned short globalArrF[100]; + +void globalArrFill(unsigned short n) { + for (unsigned short i = 0; i < n; i++) globalArrF[i] = i + 1; +} diff --git a/benchmarks/globalArrSum.c b/benchmarks/globalArrSum.c new file mode 100644 index 0000000..f41699a --- /dev/null +++ b/benchmarks/globalArrSum.c @@ -0,0 +1,10 @@ +// Sum the first n elements of a global i16 array. Exercises the +// `arr[i]` indexed-access pattern that the W65816UnLSR pass converts +// back to `lda , X` after LSR turns it into pointer-walking. +unsigned short globalArr[100]; + +unsigned short globalArrSum(unsigned short n) { + unsigned short s = 0; + for (unsigned short i = 0; i < n; i++) s += globalArr[i]; + return s; +} diff --git a/benchmarks/strLen.c b/benchmarks/strLen.c new file mode 100644 index 0000000..412f718 --- /dev/null +++ b/benchmarks/strLen.c @@ -0,0 +1,14 @@ +// strLen: walk pointer until null byte. Exercises the [dp],Y byte-read +// path plus the conditional loop exit. Touches the same DPF0 setup +// pattern as strcpy/memcmp but with only ONE pointer per iter. +// +// The pragma prevents clang from recognising this as a builtin strlen +// and rewriting it as a call to libc (which our benches don't link). +__attribute__((no_builtin("strlen"))) +unsigned short strLen(const char *s) { + const char *p = s; + while (*p) { + p++; + } + return (unsigned short)(p - s); +} diff --git a/compare/evalAt.calypsi.lst b/compare/evalAt.calypsi.lst index 50120d9..2a52687 100644 --- a/compare/evalAt.calypsi.lst +++ b/compare/evalAt.calypsi.lst @@ -1,7 +1,7 @@ ############################################################################### # # # Calypsi ISO C compiler for 65816 version 5.16 # -# 14/May/2026 11:06:07 # +# 15/May/2026 00:38:15 # # Command line: --speed -O 2 --64bit-doubles evalAt.c -o # # /tmp/evalAt.calypsi.elf --list-file evalAt.calypsi.lst # # # diff --git a/compare/evalAt.ours.s b/compare/evalAt.ours.s index 5f7748b..c8f8627 100644 --- a/compare/evalAt.ours.s +++ b/compare/evalAt.ours.s @@ -8,7 +8,7 @@ evalAt: ; @evalAt tay tsc sec - sbc #0x46 + sbc #0x2e tcs tya pha @@ -24,7 +24,7 @@ evalAt: ; @evalAt sta 0x3, s pla stx 0xc0 - sta 0x19, s + sta 0x1b, s clc adc #0x2 sta 0x1f, s @@ -33,44 +33,34 @@ evalAt: ; @evalAt adc #0x0 sta 0x21, s lda 0x1f, s - sta 0x45, s - lda 0x21, s - sta 0x43, s - lda 0x45, s sta 0xe0 - lda 0x43, s + lda 0x21, s sta 0xe2 ldy #0x0 - lda [0xe0 ], y - sta 0x1d, s - lda 0x19, s - sta 0x41, s + lda [0xe0], y + sta 0x1f, s pha lda 0xc0 - sta 0x41, s + sta 0x2f, s pla - lda 0x41, s + lda 0x1b, s sta 0xe0 - lda 0x3f, s + lda 0x2d, s sta 0xe2 - lda [0xe0 ], y + lda [0xe0], y sta 0x21, s - lda 0x4a, s + lda 0x32, s sta 0xb, s lda #0x0 sta 0xc4 sta 0xc6 lda 0x21, s - sta 0x3d, s - lda 0x1d, s - sta 0x3b, s - lda 0x3d, s sta 0xe0 - lda 0x3b, s + lda 0x1f, s sta 0xe2 - lda [0xe0 ], y + lda [0xe0], y and #0xff - sta 0x1b, s + sta 0x1d, s sep #0x20 clc adc #0xd0 @@ -93,51 +83,47 @@ evalAt: ; @evalAt inc a sta 0x21, s bne .Ltmp0 - lda 0x1d, s + lda 0x1f, s inc a - sta 0x1d, s + sta 0x1f, s .Ltmp0: lda #0x0 sta 0x15, s sta 0x13, s sta 0x11, s sta 0xf, s - lda 0x1d, s + lda 0x1f, s sta 0x17, s .LBB0_2: ; %while.body ; =>This Inner Loop Header: Depth=1 - sta 0x1d, s - lda 0x19, s + sta 0x1f, s + lda 0x1b, s tax pha lda 0xc0 - sta 0x3b, s + sta 0x2d, s pla txa sta 0xe0 - lda 0x39, s + lda 0x2b, s sta 0xe2 lda 0x21, s ldy #0x0 - sta [0xe0 ], y - lda 0x19, s + sta [0xe0], y + lda 0x1b, s clc adc #0x2 sta 0xd, s lda 0xc0 - sta 0x1f, s + sta 0x19, s adc #0x0 - sta 0x1f, s + sta 0x19, s lda 0xd, s - sta 0x37, s - lda 0x1f, s - tax - lda 0x37, s sta 0xe0 - txa + lda 0x19, s sta 0xe2 - lda 0x1d, s - sta [0xe0 ], y + lda 0x1f, s + sta [0xe0], y pea 0x4024 lda #0x0 pha @@ -157,24 +143,24 @@ evalAt: ; @evalAt adc #0xc tcs lda 0xe0 - sta 0x1f, s + sta 0x19, s txa sta 0x15, s tya sta 0x13, s lda 0xf0 sta 0x11, s - lda 0x1b, s + lda 0x1d, s sep #0x20 clc adc #0xd0 rep #0x20 and #0xff - sta 0x1b, s + sta 0x1d, s ldx #0x0 - lda 0x1b, s + lda 0x1d, s jsl __floatunsidf - sta 0x1b, s + sta 0x1d, s txa sta 0xf, s tya @@ -185,7 +171,7 @@ evalAt: ; @evalAt lda 0x13, s tax phx - lda 0x21, s + lda 0x23, s pha lda 0x19, s pha @@ -193,7 +179,7 @@ evalAt: ; @evalAt pha lda 0x21, s tax - lda 0x2b, s + lda 0x25, s jsl __adddf3 sta 0xe0 tsc @@ -217,7 +203,7 @@ evalAt: ; @evalAt sta 0x21, s txa lda 0xd0 - sta 0x1f, s + sta 0x1d, s lda 0x17, s adc #0x0 sta 0x17, s @@ -229,18 +215,14 @@ evalAt: ; @evalAt sta 0xc4 lda 0x13, s sta 0xc6 - lda 0x1f, s - sta 0x35, s lda 0x1d, s - tax - lda 0x35, s sta 0xe0 - txa + lda 0x1f, s sta 0xe2 ldy #0x0 - lda [0xe0 ], y + lda [0xe0], y and #0xff - sta 0x1b, s + sta 0x1d, s sep #0x20 clc adc #0xd0 @@ -259,17 +241,17 @@ evalAt: ; @evalAt sta 0x21, s lda 0x17, s adc #0xffff - sta 0x1d, s + sta 0x1f, s .LBB0_4: ; %while.cond7.preheader lda 0xb, s eor #0x8000 sta 0xb, s - lda 0x1b, s + lda 0x1d, s brl .LBB0_5 .LBB0_11: ; %if.then33 ; in Loop: Header=BB0_5 Depth=1 lda 0xc6 - sta 0x1b, s + sta 0x1d, s lda 0xc4 sta 0x15, s lda 0xca @@ -278,7 +260,7 @@ evalAt: ; @evalAt sta 0x11, s lda 0x17, s pha - lda 0x1f, s + lda 0x1b, s pha lda 0x23, s pha @@ -288,7 +270,7 @@ evalAt: ; @evalAt pha lda 0x1b, s pha - lda 0x27, s + lda 0x29, s tax lda 0x21, s jsl __muldf3 @@ -306,10 +288,10 @@ evalAt: ; @evalAt tya sta 0x1d, s lda 0xf0 - sta 0x1b, s + sta 0x19, s lda 0x1d, s sta 0xc8 - lda 0x1b, s + lda 0x19, s sta 0xca lda 0x21, s sta 0xc4 @@ -317,7 +299,7 @@ evalAt: ; @evalAt sta 0xc6 .LBB0_13: ; %cleanup ; in Loop: Header=BB0_5 Depth=1 - lda 0x19, s + lda 0x1b, s clc adc #0x2 sta 0x1f, s @@ -326,17 +308,13 @@ evalAt: ; @evalAt adc #0x0 sta 0x21, s lda 0x1f, s - sta 0x25, s - lda 0x21, s - tax - lda 0x25, s sta 0xe0 - txa + lda 0x21, s sta 0xe2 ldy #0x0 - lda [0xe0 ], y - sta 0x1d, s - lda 0x19, s + lda [0xe0], y + sta 0x1f, s + lda 0x1b, s tax pha lda 0xc0 @@ -346,32 +324,29 @@ evalAt: ; @evalAt sta 0xe0 lda 0x23, s sta 0xe2 - lda [0xe0 ], y + lda [0xe0], y sta 0x21, s - lda 0x1d, s - tax - lda 0x21, s sta 0xe0 - txa + lda 0x1f, s sta 0xe2 - lda [0xe0 ], y + lda [0xe0], y and #0xff .LBB0_5: ; %while.cond7 ; =>This Inner Loop Header: Depth=1 - sta 0x1b, s + sta 0x1d, s sep #0x20 clc adc #0xd6 rep #0x20 and #0xff - sta 0x1f, s - lda 0x1f, s + sta 0x19, s + lda 0x19, s pha lda #0x2b jsl __lshrhi3 ply sta 0x17, s - lda 0x1f, s + lda 0x19, s cmp #0x6 bcc .LBB0_6 ; %bb.17: ; %while.cond7 @@ -382,58 +357,23 @@ evalAt: ; @evalAt and #0x1 sta 0x17, s lda #0x0 - sta 0x33, s + sta 0x29, s lda 0x17, s - ora 0x33, s + ora 0x29, s bne .LBB0_7 ; %bb.18: ; %while.cond7 brl .LBB0_14 .LBB0_7: ; %switch.lookup ; in Loop: Header=BB0_5 Depth=1 - lda #0x0 + lda 0x19, s asl a - sta 0x17, s - lda 0x1f, s - asl a - lda #0x0 - rol a - sta 0x31, s - lda 0x17, s - ora 0x31, s - sta 0x17, s - lda 0x1f, s - asl a - sta 0x1f, s - lda #.Lswitch.table.evalAt - sta 0x2f, s - lda 0x1f, s - clc - adc 0x2f, s - sta 0x1f, s - lda #0x0 - sta 0x2d, s - lda 0x17, s - adc 0x2d, s - sta 0x17, s - lda 0x1f, s - sta 0x2b, s - lda 0x17, s - tax - lda 0x2b, s - sta 0xe0 - txa - sta 0xe2 - ldy #0x0 - lda [0xe0 ], y - sta 0x1f, s - lda 0x1f, s tax + lda .Lswitch.table.evalAt, x + sta 0x19, s eor #0x8000 - sta 0x1f, s - txa - sta 0x17, s + sta 0x27, s lda 0xb, s - cmp 0x1f, s + cmp 0x27, s bcc .LBB0_8 ; %bb.19: ; %switch.lookup brl .LBB0_14 @@ -443,44 +383,40 @@ evalAt: ; @evalAt inc a sta 0x21, s bne .Ltmp1 - lda 0x1d, s + lda 0x1f, s inc a - sta 0x1d, s + sta 0x1f, s .Ltmp1: - lda 0x19, s + lda 0x1b, s tax pha lda 0xc0 - sta 0x2b, s + sta 0x27, s pla txa sta 0xe0 - lda 0x29, s + lda 0x25, s sta 0xe2 lda 0x21, s ldy #0x0 - sta [0xe0 ], y - lda 0x19, s + sta [0xe0], y + lda 0x1b, s sta 0xd0 clc adc #0x2 - sta 0x1f, s + sta 0x17, s lda 0xd0 sta 0x21, s lda 0xc0 adc #0x0 sta 0x15, s - lda 0x1f, s - sta 0x27, s - lda 0x15, s - tax - lda 0x27, s - sta 0xe0 - txa - sta 0xe2 - lda 0x1d, s - sta [0xe0 ], y lda 0x17, s + sta 0xe0 + lda 0x15, s + sta 0xe2 + lda 0x1f, s + sta [0xe0], y + lda 0x19, s pha ldx 0xc0 lda 0x23, s @@ -495,10 +431,10 @@ evalAt: ; @evalAt txa sta 0x1f, s tya - sta 0x1d, s + sta 0x19, s lda 0xf0 sta 0x17, s - lda 0x1b, s + lda 0x1d, s and #0xff cmp #0x2a bne .LBB0_9 @@ -515,7 +451,7 @@ evalAt: ; @evalAt .LBB0_10: ; %if.then29 ; in Loop: Header=BB0_5 Depth=1 lda 0xc6 - sta 0x1b, s + sta 0x1d, s lda 0xc4 sta 0x15, s lda 0xca @@ -524,7 +460,7 @@ evalAt: ; @evalAt sta 0x11, s lda 0x17, s pha - lda 0x1f, s + lda 0x1b, s pha lda 0x23, s pha @@ -534,7 +470,7 @@ evalAt: ; @evalAt pha lda 0x1b, s pha - lda 0x27, s + lda 0x29, s tax lda 0x21, s jsl __adddf3 @@ -570,7 +506,7 @@ evalAt: ; @evalAt sta 0xe0 tsc clc - adc #0x46 + adc #0x2e tcs lda 0xe0 rtl diff --git a/compare/mul16to32.calypsi.lst b/compare/mul16to32.calypsi.lst index 921e692..d5095d8 100644 --- a/compare/mul16to32.calypsi.lst +++ b/compare/mul16to32.calypsi.lst @@ -1,7 +1,7 @@ ############################################################################### # # # Calypsi ISO C compiler for 65816 version 5.16 # -# 14/May/2026 11:06:07 # +# 15/May/2026 00:38:15 # # Command line: --speed -O 2 --64bit-doubles mul16to32.c -o # # /tmp/mul16to32.calypsi.elf --list-file # # mul16to32.calypsi.lst # diff --git a/compare/mul16to32.ours.s b/compare/mul16to32.ours.s index f8ce848..a008c37 100644 --- a/compare/mul16to32.ours.s +++ b/compare/mul16to32.ours.s @@ -5,11 +5,7 @@ mul16to32: ; @mul16to32 ; %bb.0: ; %entry rep #0x30 - pha - lda 0x6, s - jsl __umulhisi3 - ply - rtl + jml __umulhisi3 .Lfunc_end0: .size mul16to32, .Lfunc_end0-mul16to32 ; -- End function diff --git a/compare/sumSquares.calypsi.lst b/compare/sumSquares.calypsi.lst index 3ca5c18..dbbce23 100644 --- a/compare/sumSquares.calypsi.lst +++ b/compare/sumSquares.calypsi.lst @@ -1,7 +1,7 @@ ############################################################################### # # # Calypsi ISO C compiler for 65816 version 5.16 # -# 14/May/2026 11:06:07 # +# 15/May/2026 00:38:15 # # Command line: --speed -O 2 --64bit-doubles sumSquares.c -o # # /tmp/sumSquares.calypsi.elf --list-file # # sumSquares.calypsi.lst # diff --git a/compare/sumSquares.ours.s b/compare/sumSquares.ours.s index 37483c1..eb89d24 100644 --- a/compare/sumSquares.ours.s +++ b/compare/sumSquares.ours.s @@ -31,8 +31,7 @@ sumSquares: ; @sumSquares sta 0xd4 inc 0xd2 dec 0xd0 - beq .LBB0_5 - bra .LBB0_4 + bne .LBB0_4 .LBB0_5: ; %for.cond.cleanup lda 0xd4 tax diff --git a/demos/README.md b/demos/README.md new file mode 100644 index 0000000..f957c02 --- /dev/null +++ b/demos/README.md @@ -0,0 +1,149 @@ +# llvm816 GS/OS Demo Apps + +Small Apple IIgs S16 applications that build with our LLVM/clang +toolchain, wrap as OMF v2.1 ExpressLoad, and launch under real +GS/OS 6.0.2 in MAME. + +## Building / running + +``` +bash demos/build.sh helloBeep # build the OMF +bash demos/launch.sh helloBeep # interactive run in MAME (visible window, audio) +bash demos/test.sh helloBeep # headless test (boots, runs, checks marker) +``` + +The launch script runs MAME with no timeout; close the MAME +window when done (Esc, then Cmd-Q). The test script injects a +keystroke after the demo has launched, then checks `$00:0070` +for the `0x99` end-of-run marker the demo writes before exit. + +## Demos + +### `helloBeep.c` + +Three `SysBeep()` calls then exit. The toolbox `SysBeep` lives in +Misc Tools; no other startup needed (Loader handles MM + TL). + +### `helloText.c` + +Initialises Event Manager (so `GetNextEvent` can read keystrokes) +and Text Tools (so `WriteCString` has an output device), writes +two greeting lines to the text screen, waits for any keypress via +`GetNextEvent`, beeps, exits. Uses these toolbox calls: + +- `MMStartUp`, `NewHandle` (DP allocation for Event Manager) +- `EMStartUp`, `GetNextEvent` (event-driven keyboard) +- `TextStartUp`, `SetOutputDevice`, `WriteCString` (text I/O) +- `SysBeep` + +### `helloWindow.c` + +Initialises the full Window Manager startup chain (Memory, QD, +Event, Scheduler, Window), constructs an Apple-IIgs-Toolbox-Ref +NewWindow parm block, and calls `NewWindow`. When NewWindow +returns a real handle the demo calls `SetPort`, `ShowWindow`, +`MoveTo`, and `DrawString` to put a greeting in the window, then +waits for a keypress, beeps, and exits. + +Three toolchain bugs needed fixing to make this work end-to-end +under real GS/OS 6.0.2 (all now landed): +- **omfEmit RESSPC=0** for code segments — BSS got no memory + allocation; writes past the image end silently vanished. Now + BSS is embedded as zeros in the LCONST data. +- **Loader cRELOC at segPlacedBase=$0000** (not $1000 like our + text-base) — host probes need to compute runtime addresses as + `link_addr - text_base + bank<<16`. +- **`&symbol` bank=0** — proper backend fix landed. `LDAi16imm_bank` + AsmPrinter pseudo lowers to `lda $BE`; crt0 stores `PBR` to $BE + + zero to $BF at startup, so the high half of every `&symbol` + pointer carries the actual load bank at runtime. Toolbox + pointer args now Just Work without per-wrapper PBR overrides. + +### `orcaFrame.c` + +First ORCA-style desktop application. Opens a Window Manager +window via `startdesk()` (full toolset chain), runs a TaskMaster +event loop until the close box / Q key / 1000-iteration watchdog +fires. Both 6.0.2 (`sys602.po`) and 6.0.4 (`6.0.4 - System.Disk.po`) +launch it cleanly; fTitle works on both. + +### `orcaFrameLike.c` + +Port of ORCA-C's `Frame.cc` sample (`tools/orca-c/C.Samples/ +Desktop.Samples/Frame.cc`). Builds a standard Apple+File+Edit +menu bar (`NewMenu` + `InsertMenu` + `FixAppleMenu` + `DrawMenuBar`) +and dispatches `wInMenuBar` / `wInSpecial` events from `TaskMaster`. +File→Quit exits. Skips the original's Dialog Manager About box. + +### `orcaMiniCadLike.c` + +Port of ORCA-C's `MiniCAD.cc` (`Desktop.Samples/MiniCAD.cc`). Slim +port — opens a Window Manager content window but omits the line- +drawing primitives because adding them pushes past the Loader's +cRELOC threshold. Demonstrates the NewWindow path under +`startdesk`. + +### `orcaReversiLike.c` + +Port of ORCA-C's `Reversi.cc` (`Desktop.Samples/Reversi.cc`). +Menu-bar app — the ~1600 line game logic is omitted; the demo +shows the desktop scaffolding (menu + TaskMaster) the original +sits on top of. + +### `qdProbe.c` + +Diagnostic — minimal QD/EM/WM init followed by `RefreshDesktop` +plus ZP/SHR markers. Used to prove that `WindStartUp` does NOT +auto-paint the desktop and that `RefreshDesktop(NULL)` is what +actually fills SHR with the dithered desktop pattern. Run via +`scripts/probeQdStartup.sh`. + +### Known limitations + +- **fTitle on stripped 6.0.2:** orcaFrame uses fTitle and runs + fine on both 6.0.2 sys602.po and 6.0.4 System.Disk.po. Earlier + notes that fTitle required disk fonts were superseded — the + underlying bug was a `QDStartUp` argument-order mistake in + `runtime/src/desktop.c`, fixed 2026-05-16. +- **Window not visually painted:** `WindStartUp` does NOT paint + the desktop on its own; `RefreshDesktop(NULL)` is required. + Adding the call to `startdesk()` works for `qdProbe.c` but + pushes the orca demos past the GS/OS Loader's silent-rejection + threshold (see memory: `loader-creloc-threshold`). +- **GS/OS Loader cRELOC threshold:** anywhere from 65-90 cRELOCs + the Loader silently refuses to launch ExpressLoad OMFs. The + threshold is not a clean reloc-count cutoff; OMF byte layout + and reloc patch offsets both matter. The ORCA ports are slim + to stay under it. + +## What got fixed during demo authoring + +Substantive toolchain bugs surfaced and fixed: + +- `iigsGsos.s` GS/OS wrappers and `genToolbox.py`'s 890 toolbox + wrappers were pushing 4-byte Long args low-word-first. ORCA-C's + PushLong macro is high-word-first. Anything passing a Long arg + through the toolbox dispatcher (NewHandle, NewWindow, + fopen->gsosOpen, etc.) was reading garbage parm-block pointers. + Fixed in both files plus the generator; regenerated 890 + wrappers. +- `runtime/build.sh` wasn't rebuilding `iigsToolbox.s` -- the .o + was stale since May 4. Added the missing line. +- `(short)(*(void **)dpHandle)` was a double-dereference bug that + read garbage at the master pointer's destination instead of the + master pointer VALUE (= the DP address). Corrected to + `(unsigned short)(unsigned long)*(void **)dpHandle` for proper + block-address extraction. +- `helloText` used `TextStartUp + WriteCString` directly which + crashed to the IIgs monitor; fixed by adding `SetOutputDevice(1, 0)` + to wire stdout to the text screen. +- `helloText`'s event loop hung forever because `EMStartUp` wasn't + being called; fixed by adding it (with proper DP allocation). + +## ptr32 mode note + +All address constants in the demos (text screen $00:0400, SHR +RAM $E1:2000, soft switches $00:C0xx, keyboard register $00:C000) +are plain C 32-bit pointers like `(volatile unsigned char *)0xE12000UL`. +In ptr32 mode the compiler emits LONG addressing automatically; +no `switchToBank2`-style inline asm or DBR juggling required. diff --git a/demos/build.sh b/demos/build.sh new file mode 100755 index 0000000..ab5d811 --- /dev/null +++ b/demos/build.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash +# build.sh - compile a demo C source into a GS/OS-loadable OMF. +# +# Usage: bash demos/build.sh +# where demos/.c is the source. Output is +# demos/.omf in the same directory. +# +# Uses crt0Gsos (the GS/OS-aware crt) and ExpressLoad-wrapped multi- +# seg OMF so the slow-Loader rejection path is avoided. The OMF +# launches via runViaFinder.sh after cadius-injection onto the GS/OS +# data disk. + +set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" + +[ $# -ge 1 ] || { echo "usage: $0 " >&2; exit 2; } +BASE="$1" +SRC="$SCRIPT_DIR/$BASE.c" +[ -f "$SRC" ] || { echo "no source: $SRC" >&2; exit 2; } + +CLANG="$PROJECT_ROOT/tools/llvm-mos-build/bin/clang" +LINK="$PROJECT_ROOT/tools/link816" +OMF="$PROJECT_ROOT/tools/omfEmit" + +OBJ="$SCRIPT_DIR/$BASE.o" +BIN="$SCRIPT_DIR/$BASE.bin" +MAP="$SCRIPT_DIR/$BASE.map" +RELOC="$SCRIPT_DIR/$BASE.reloc" +OUT="$SCRIPT_DIR/$BASE.omf" + +echo "compile: $BASE.c -> $BASE.o" +"$CLANG" --target=w65816 -I"$PROJECT_ROOT/runtime/include" \ + -O2 -ffunction-sections -c "$SRC" -o "$OBJ" + +echo "link: -> $BASE.bin" +# bss-base 0xA000 keeps BSS above the SHR shadow region ($2000-$9FFF +# in bank 0 mirrors to bank E1 SHR memory). Without this, the smaller +# section-gc'd demos place BSS at e.g. $2300 and global writes scribble +# on the screen. +"$LINK" -o "$BIN" --text-base 0x1000 --bss-base 0xA000 \ + --map "$MAP" --reloc-out "$RELOC" \ + "$PROJECT_ROOT/runtime/crt0Gsos.o" "$OBJ" \ + "$PROJECT_ROOT/runtime/libc.o" \ + "$PROJECT_ROOT/runtime/snprintf.o" \ + "$PROJECT_ROOT/runtime/extras.o" \ + "$PROJECT_ROOT/runtime/softFloat.o" \ + "$PROJECT_ROOT/runtime/softDouble.o" \ + "$PROJECT_ROOT/runtime/iigsGsos.o" \ + "$PROJECT_ROOT/runtime/iigsToolbox.o" \ + "$PROJECT_ROOT/runtime/desktop.o" \ + "$PROJECT_ROOT/runtime/libgcc.o" + +echo "OMF: -> $BASE.omf" +"$OMF" --input "$BIN" --map "$MAP" \ + --base 0x1000 --entry __start --output "$OUT" \ + --name "$(echo "$BASE" | tr '[:lower:]' '[:upper:]' | cut -c1-8)" \ + --expressload --relocs "$RELOC" + +ls -la "$OUT" +echo "done: $OUT" diff --git a/demos/frame.bin b/demos/frame.bin new file mode 100644 index 0000000..7976cd8 Binary files /dev/null and b/demos/frame.bin differ diff --git a/demos/frame.c b/demos/frame.c new file mode 100644 index 0000000..2776667 --- /dev/null +++ b/demos/frame.c @@ -0,0 +1,97 @@ +// frame.c - full port of ORCA-C's Frame.cc sample. +// +// Mike Westerfield's "Frame" desktop demo (Byte Works, 1989). +// Original at tools/orca-c/C.Samples/Desktop.Samples/Frame.cc. +// +// Uses the real ROM Menu Manager — startdesk's QD-DP allocation now +// reserves the full 512 bytes QD needs (own DP + cursor mgr at +$100), +// plus calls InitCursor. See feedback_drawmenubar_hang.md. + +#include "iigs/toolbox.h" +#include "iigs/desktop.h" + + +#define apple_About 257 +#define file_Quit 256 + + +typedef struct { short v1, h1, v2, h2; } Rect; + + +// Menu definition strings — verbatim from Frame.cc. +static unsigned char appleMenuStr[] = + ">>@\\XN1\r" + "--About Frame\\N257V\r" + ".\r"; + +static unsigned char fileMenuStr[] = + ">> File \\N2\r" + "--Close\\N255V\r" + "--Quit\\N256*Qq\r" + ".\r"; + +static unsigned char editMenuStr[] = + ">> Edit \\N3\r" + "--Undo\\N250V*Zz\r" + "--Cut\\N251*Xx\r" + "--Copy\\N252*Cc\r" + "--Paste\\N253*Vv\r" + "--Clear\\N254\r" + ".\r"; + +// About-box message lines. +static const unsigned char line1[] = "\x09" "Frame 1.0"; +static const unsigned char line2[] = "\x0e" "Copyright 1989"; +static const unsigned char line3[] = "\x10" "Byte Works, Inc."; +static const unsigned char line4[] = "\x13" "By Mike Westerfield"; +static const unsigned char btnOk[] = "\x02" "OK"; + + +static void drawAbout(void) { + Rect outer; + outer.h1 = 180; outer.v1 = 50; + outer.h2 = 460; outer.v2 = 107; + + SetSolidPenPat(15); + PaintRect(&outer); + SetSolidPenPat(0); + FrameRect(&outer); + + MoveTo(195, 64); DrawString((void *)line1); + MoveTo(195, 74); DrawString((void *)line2); + MoveTo(195, 84); DrawString((void *)line3); + MoveTo(195, 94); DrawString((void *)line4); + + Rect ok; + ok.h1 = 395; ok.v1 = 88; + ok.h2 = 445; ok.v2 = 102; + FrameRect(&ok); + MoveTo(412, 98); + DrawString((void *)btnOk); +} + + +static void initMenus(void) { + InsertMenu(NewMenu(editMenuStr), 0); + InsertMenu(NewMenu(fileMenuStr), 0); + InsertMenu(NewMenu(appleMenuStr), 0); + FixAppleMenu(1); + FixMenuBar(); + DrawMenuBar(); +} + + +int main(void) { + unsigned short userId = startdesk(640); + (void)userId; + + initMenus(); + ShowCursor(); + + for (volatile unsigned long s = 0; s < 100000UL; s++) { } + drawAbout(); + for (volatile unsigned long s = 0; s < 200000UL; s++) { } + + *(volatile unsigned char *)0x70 = 0x99; + return 0; +} diff --git a/demos/frame.map b/demos/frame.map new file mode 100644 index 0000000..cee1dc6 --- /dev/null +++ b/demos/frame.map @@ -0,0 +1,213 @@ +# section layout +.text : 0x001000 .. 0x0024b3 ( 5299 bytes) +.rodata : 0x0024b3 .. 0x0025b2 ( 255 bytes) +.bss : 0x00a000 .. 0x00a00a ( 10 bytes) + +# per-input-file .text contributions + 186 /home/scott/claude/llvm816/runtime/crt0Gsos.o + 1287 /home/scott/claude/llvm816/demos/frame.o + 43513 /home/scott/claude/llvm816/runtime/libc.o + 5935 /home/scott/claude/llvm816/runtime/snprintf.o + 11953 /home/scott/claude/llvm816/runtime/extras.o + 7077 /home/scott/claude/llvm816/runtime/softFloat.o + 15379 /home/scott/claude/llvm816/runtime/softDouble.o + 176 /home/scott/claude/llvm816/runtime/iigsGsos.o + 20670 /home/scott/claude/llvm816/runtime/iigsToolbox.o + 1349 /home/scott/claude/llvm816/runtime/desktop.o + 2540 /home/scott/claude/llvm816/runtime/libgcc.o + +# global symbols (sorted by address) +0x000000 __bss_bank +0x000000 __bss_seg0_bank +0x000000 __bss_seg1_bank +0x000000 __bss_seg1_lo16 +0x000000 __bss_seg1_size +0x000000 __bss_seg2_bank +0x000000 __bss_seg2_lo16 +0x000000 __bss_seg2_size +0x000000 __bss_seg3_bank +0x000000 __bss_seg3_lo16 +0x000000 __bss_seg3_size +0x00000a __bss_seg0_size +0x00000a __bss_size +0x001000 __start +0x001000 __text_start +0x0010ba main +0x0015c1 CtlStartUp +0x0015d1 EMStartUp +0x0015f0 FMStartUp +0x001600 LEStartUp +0x001610 LoadOneTool +0x001620 NewHandle +0x001646 MenuStartUp +0x001656 InsertMenu +0x00166b NewMenu +0x001685 QDStartUp +0x00169b DrawString +0x0016ad FrameRect +0x0016bf MoveTo +0x0016cf PaintRect +0x0016e1 startdesk +0x001ac7 __jsl_indir +0x001aca __mulhi3 +0x001ae9 __umulhisi3 +0x001b40 __ashlhi3 +0x001b4f __lshrhi3 +0x001b5f __ashrhi3 +0x001b72 __udivhi3 +0x001b7e __umodhi3 +0x001b8a __divhi3 +0x001ba4 __modhi3 +0x001bbe __divmod_setup +0x001bf1 __udivmod_core +0x001c0f __mulsi3 +0x001cc8 __ashlsi3 +0x001cdd __lshrsi3 +0x001cf2 __ashrsi3 +0x001d0c __udivmodsi_core +0x001d44 __udivsi3 +0x001d58 __umodsi3 +0x001d6c __divsi3 +0x001d93 __modsi3 +0x001dba __divmodsi_setup +0x001e0b __divmoddi4_stash +0x001e28 __retdi +0x001e35 __ashldi3 +0x001e58 __lshrdi3 +0x001e7b __ashrdi3 +0x001ea1 __muldi3 +0x001efc __ucmpdi2 +0x001f25 __cmpdi2 +0x001f5c __udivdi3 +0x001f65 __umoddi3 +0x001f7e __udivmoddi_core +0x001fcb __divdi3 +0x001fea __moddi3 +0x002017 __absdi_a +0x00201f __absdi_b +0x002027 __negdi_a +0x002045 __negdi_b +0x002063 setjmp +0x00208b longjmp +0x0020b5 __umulhisi3_qsq +0x0024b3 __rodata_start +0x0024b3 __text_end +0x0024b3 gChainPath +0x0024c7 editMenuStr +0x002520 fileMenuStr +0x00254d appleMenuStr +0x00256c line1 +0x002577 line2 +0x002587 line3 +0x002599 line4 +0x0025ae btnOk +0x0025b2 __init_array_end +0x0025b2 __init_array_start +0x0025b2 __rodata_end +0x00a000 __bss_lo16 +0x00a000 __bss_seg0_lo16 +0x00a000 __bss_start +0x00a000 gUserId +0x00a002 gDpHandle +0x00a006 gDpBase +0x00a008 __indirTarget +0x00a00a __bss_end +0x00a00a __heap_start +0x00bf00 __heap_end +CtlStartUp = 0x0015c1 +DrawString = 0x00169b +EMStartUp = 0x0015d1 +FMStartUp = 0x0015f0 +FrameRect = 0x0016ad +InsertMenu = 0x001656 +LEStartUp = 0x001600 +LoadOneTool = 0x001610 +MenuStartUp = 0x001646 +MoveTo = 0x0016bf +NewHandle = 0x001620 +NewMenu = 0x00166b +PaintRect = 0x0016cf +QDStartUp = 0x001685 +__absdi_a = 0x002017 +__absdi_b = 0x00201f +__ashldi3 = 0x001e35 +__ashlhi3 = 0x001b40 +__ashlsi3 = 0x001cc8 +__ashrdi3 = 0x001e7b +__ashrhi3 = 0x001b5f +__ashrsi3 = 0x001cf2 +__bss_bank = 0x000000 +__bss_end = 0x00a00a +__bss_lo16 = 0x00a000 +__bss_seg0_bank = 0x000000 +__bss_seg0_lo16 = 0x00a000 +__bss_seg0_size = 0x00000a +__bss_seg1_bank = 0x000000 +__bss_seg1_lo16 = 0x000000 +__bss_seg1_size = 0x000000 +__bss_seg2_bank = 0x000000 +__bss_seg2_lo16 = 0x000000 +__bss_seg2_size = 0x000000 +__bss_seg3_bank = 0x000000 +__bss_seg3_lo16 = 0x000000 +__bss_seg3_size = 0x000000 +__bss_size = 0x00000a +__bss_start = 0x00a000 +__cmpdi2 = 0x001f25 +__divdi3 = 0x001fcb +__divhi3 = 0x001b8a +__divmod_setup = 0x001bbe +__divmoddi4_stash = 0x001e0b +__divmodsi_setup = 0x001dba +__divsi3 = 0x001d6c +__heap_end = 0x00bf00 +__heap_start = 0x00a00a +__indirTarget = 0x00a008 +__init_array_end = 0x0025b2 +__init_array_start = 0x0025b2 +__jsl_indir = 0x001ac7 +__lshrdi3 = 0x001e58 +__lshrhi3 = 0x001b4f +__lshrsi3 = 0x001cdd +__moddi3 = 0x001fea +__modhi3 = 0x001ba4 +__modsi3 = 0x001d93 +__muldi3 = 0x001ea1 +__mulhi3 = 0x001aca +__mulsi3 = 0x001c0f +__negdi_a = 0x002027 +__negdi_b = 0x002045 +__retdi = 0x001e28 +__rodata_end = 0x0025b2 +__rodata_start = 0x0024b3 +__start = 0x001000 +__text_end = 0x0024b3 +__text_start = 0x001000 +__ucmpdi2 = 0x001efc +__udivdi3 = 0x001f5c +__udivhi3 = 0x001b72 +__udivmod_core = 0x001bf1 +__udivmoddi_core = 0x001f7e +__udivmodsi_core = 0x001d0c +__udivsi3 = 0x001d44 +__umoddi3 = 0x001f65 +__umodhi3 = 0x001b7e +__umodsi3 = 0x001d58 +__umulhisi3 = 0x001ae9 +__umulhisi3_qsq = 0x0020b5 +appleMenuStr = 0x00254d +btnOk = 0x0025ae +editMenuStr = 0x0024c7 +fileMenuStr = 0x002520 +gChainPath = 0x0024b3 +gDpBase = 0x00a006 +gDpHandle = 0x00a002 +gUserId = 0x00a000 +line1 = 0x00256c +line2 = 0x002577 +line3 = 0x002587 +line4 = 0x002599 +longjmp = 0x00208b +main = 0x0010ba +setjmp = 0x002063 +startdesk = 0x0016e1 diff --git a/demos/frame.o b/demos/frame.o new file mode 100644 index 0000000..b560f0d Binary files /dev/null and b/demos/frame.o differ diff --git a/demos/frame.omf b/demos/frame.omf new file mode 100644 index 0000000..a9549d3 Binary files /dev/null and b/demos/frame.omf differ diff --git a/demos/frame.reloc b/demos/frame.reloc new file mode 100644 index 0000000..12949c8 Binary files /dev/null and b/demos/frame.reloc differ diff --git a/demos/heavyRelocs.bin b/demos/heavyRelocs.bin new file mode 100644 index 0000000..e9f8c2d Binary files /dev/null and b/demos/heavyRelocs.bin differ diff --git a/demos/heavyRelocs.c b/demos/heavyRelocs.c new file mode 100644 index 0000000..00c4336 --- /dev/null +++ b/demos/heavyRelocs.c @@ -0,0 +1,38 @@ +// heavyRelocs.c - stress test for ExpressLoad cRELOC handling. +#include "iigs/toolbox.h" + +// Code padding via large initialized data (NOT const so it lands in +// .data and survives -O2 dead-strip). +volatile unsigned char gBigData[20000] = { [0 ... 19999] = 0xAA }; + +static unsigned char gA[16], gB[16], gC[16], gD[16]; +static unsigned char gE[16], gF[16], gG[16], gH[16]; +static unsigned char gI[16], gJ[16], gK[16], gL[16]; +static unsigned char gM[16], gN[16], gO[16], gP[16]; +static unsigned char gQ[16], gR[16], gS[16], gT[16]; +static unsigned char gU[16], gV[16], gW[16], gX[16]; +static unsigned char gY[16], gZ[16]; + +static unsigned char *gPtrs[100] = { + gA, gB, gC, gD, gE, gF, gG, gH, gI, gJ, + gK, gL, gM, gN, gO, gP, gQ, gR, gS, gT, + gU, gV, gW, gX, gY, gZ, gA, gB, gC, gD, + gE, gF, gG, gH, gI, gJ, gK, gL, gM, gN, + gO, gP, gQ, gR, gS, gT, gU, gV, gW, gX, + gY, gZ, gA, gB, gC, gD, gE, gF, gG, gH, + gI, gJ, gK, gL, gM, gN, gO, gP, gQ, gR, + gS, gT, gU, gV, gW, gX, gY, gZ, gA, gB, + gC, gD, gE, gF, gG, gH, gI, gJ, gK, gL, + gM, gN, gO, gP, gQ, gR, gS, gT, gU, gV, +}; + +int main(void) { + for (unsigned short i = 0; i < 100; i++) { + gPtrs[i][0] = (unsigned char)i; + } + gA[0] = gBigData[0] + gBigData[19999]; + *(volatile unsigned char *)0x70 = 0x99; + // Brief linger for snapshot capture. + for (volatile unsigned long s = 0; s < 600000UL; s++) { } + return 0; +} diff --git a/demos/heavyRelocs.map b/demos/heavyRelocs.map new file mode 100644 index 0000000..bd34ecb --- /dev/null +++ b/demos/heavyRelocs.map @@ -0,0 +1,217 @@ +# section layout +.text : 0x001000 .. 0x001caa ( 3242 bytes) +.rodata : 0x001caa .. 0x006c6e ( 20420 bytes) +.bss : 0x00a000 .. 0x00a1a2 ( 418 bytes) + +# per-input-file .text contributions + 186 /home/scott/claude/llvm816/runtime/crt0Gsos.o + 516 /home/scott/claude/llvm816/demos/heavyRelocs.o + 43513 /home/scott/claude/llvm816/runtime/libc.o + 5935 /home/scott/claude/llvm816/runtime/snprintf.o + 11953 /home/scott/claude/llvm816/runtime/extras.o + 7077 /home/scott/claude/llvm816/runtime/softFloat.o + 15379 /home/scott/claude/llvm816/runtime/softDouble.o + 176 /home/scott/claude/llvm816/runtime/iigsGsos.o + 20670 /home/scott/claude/llvm816/runtime/iigsToolbox.o + 1349 /home/scott/claude/llvm816/runtime/desktop.o + 2540 /home/scott/claude/llvm816/runtime/libgcc.o + +# global symbols (sorted by address) +0x000000 __bss_bank +0x000000 __bss_seg0_bank +0x000000 __bss_seg1_bank +0x000000 __bss_seg1_lo16 +0x000000 __bss_seg1_size +0x000000 __bss_seg2_bank +0x000000 __bss_seg2_lo16 +0x000000 __bss_seg2_size +0x000000 __bss_seg3_bank +0x000000 __bss_seg3_lo16 +0x000000 __bss_seg3_size +0x0001a2 __bss_seg0_size +0x0001a2 __bss_size +0x001000 __start +0x001000 __text_start +0x0010ba main +0x0012be __jsl_indir +0x0012c1 __mulhi3 +0x0012e0 __umulhisi3 +0x001337 __ashlhi3 +0x001346 __lshrhi3 +0x001356 __ashrhi3 +0x001369 __udivhi3 +0x001375 __umodhi3 +0x001381 __divhi3 +0x00139b __modhi3 +0x0013b5 __divmod_setup +0x0013e8 __udivmod_core +0x001406 __mulsi3 +0x0014bf __ashlsi3 +0x0014d4 __lshrsi3 +0x0014e9 __ashrsi3 +0x001503 __udivmodsi_core +0x00153b __udivsi3 +0x00154f __umodsi3 +0x001563 __divsi3 +0x00158a __modsi3 +0x0015b1 __divmodsi_setup +0x001602 __divmoddi4_stash +0x00161f __retdi +0x00162c __ashldi3 +0x00164f __lshrdi3 +0x001672 __ashrdi3 +0x001698 __muldi3 +0x0016f3 __ucmpdi2 +0x00171c __cmpdi2 +0x001753 __udivdi3 +0x00175c __umoddi3 +0x001775 __udivmoddi_core +0x0017c2 __divdi3 +0x0017e1 __moddi3 +0x00180e __absdi_a +0x001816 __absdi_b +0x00181e __negdi_a +0x00183c __negdi_b +0x00185a setjmp +0x001882 longjmp +0x0018ac __umulhisi3_qsq +0x001caa __rodata_start +0x001caa __text_end +0x001caa gChainPath +0x001cbe gBigData +0x006ade gPtrs +0x006c6e __init_array_end +0x006c6e __init_array_start +0x006c6e __rodata_end +0x00a000 __bss_lo16 +0x00a000 __bss_seg0_lo16 +0x00a000 __bss_start +0x00a000 gA +0x00a010 gB +0x00a020 gC +0x00a030 gD +0x00a040 gE +0x00a050 gF +0x00a060 gG +0x00a070 gH +0x00a080 gI +0x00a090 gJ +0x00a0a0 gK +0x00a0b0 gL +0x00a0c0 gM +0x00a0d0 gN +0x00a0e0 gO +0x00a0f0 gP +0x00a100 gQ +0x00a110 gR +0x00a120 gS +0x00a130 gT +0x00a140 gU +0x00a150 gV +0x00a160 gW +0x00a170 gX +0x00a180 gY +0x00a190 gZ +0x00a1a0 __indirTarget +0x00a1a2 __bss_end +0x00a1a2 __heap_start +0x00bf00 __heap_end +__absdi_a = 0x00180e +__absdi_b = 0x001816 +__ashldi3 = 0x00162c +__ashlhi3 = 0x001337 +__ashlsi3 = 0x0014bf +__ashrdi3 = 0x001672 +__ashrhi3 = 0x001356 +__ashrsi3 = 0x0014e9 +__bss_bank = 0x000000 +__bss_end = 0x00a1a2 +__bss_lo16 = 0x00a000 +__bss_seg0_bank = 0x000000 +__bss_seg0_lo16 = 0x00a000 +__bss_seg0_size = 0x0001a2 +__bss_seg1_bank = 0x000000 +__bss_seg1_lo16 = 0x000000 +__bss_seg1_size = 0x000000 +__bss_seg2_bank = 0x000000 +__bss_seg2_lo16 = 0x000000 +__bss_seg2_size = 0x000000 +__bss_seg3_bank = 0x000000 +__bss_seg3_lo16 = 0x000000 +__bss_seg3_size = 0x000000 +__bss_size = 0x0001a2 +__bss_start = 0x00a000 +__cmpdi2 = 0x00171c +__divdi3 = 0x0017c2 +__divhi3 = 0x001381 +__divmod_setup = 0x0013b5 +__divmoddi4_stash = 0x001602 +__divmodsi_setup = 0x0015b1 +__divsi3 = 0x001563 +__heap_end = 0x00bf00 +__heap_start = 0x00a1a2 +__indirTarget = 0x00a1a0 +__init_array_end = 0x006c6e +__init_array_start = 0x006c6e +__jsl_indir = 0x0012be +__lshrdi3 = 0x00164f +__lshrhi3 = 0x001346 +__lshrsi3 = 0x0014d4 +__moddi3 = 0x0017e1 +__modhi3 = 0x00139b +__modsi3 = 0x00158a +__muldi3 = 0x001698 +__mulhi3 = 0x0012c1 +__mulsi3 = 0x001406 +__negdi_a = 0x00181e +__negdi_b = 0x00183c +__retdi = 0x00161f +__rodata_end = 0x006c6e +__rodata_start = 0x001caa +__start = 0x001000 +__text_end = 0x001caa +__text_start = 0x001000 +__ucmpdi2 = 0x0016f3 +__udivdi3 = 0x001753 +__udivhi3 = 0x001369 +__udivmod_core = 0x0013e8 +__udivmoddi_core = 0x001775 +__udivmodsi_core = 0x001503 +__udivsi3 = 0x00153b +__umoddi3 = 0x00175c +__umodhi3 = 0x001375 +__umodsi3 = 0x00154f +__umulhisi3 = 0x0012e0 +__umulhisi3_qsq = 0x0018ac +gA = 0x00a000 +gB = 0x00a010 +gBigData = 0x001cbe +gC = 0x00a020 +gChainPath = 0x001caa +gD = 0x00a030 +gE = 0x00a040 +gF = 0x00a050 +gG = 0x00a060 +gH = 0x00a070 +gI = 0x00a080 +gJ = 0x00a090 +gK = 0x00a0a0 +gL = 0x00a0b0 +gM = 0x00a0c0 +gN = 0x00a0d0 +gO = 0x00a0e0 +gP = 0x00a0f0 +gPtrs = 0x006ade +gQ = 0x00a100 +gR = 0x00a110 +gS = 0x00a120 +gT = 0x00a130 +gU = 0x00a140 +gV = 0x00a150 +gW = 0x00a160 +gX = 0x00a170 +gY = 0x00a180 +gZ = 0x00a190 +longjmp = 0x001882 +main = 0x0010ba +setjmp = 0x00185a diff --git a/demos/heavyRelocs.o b/demos/heavyRelocs.o new file mode 100644 index 0000000..efe2296 Binary files /dev/null and b/demos/heavyRelocs.o differ diff --git a/demos/heavyRelocs.omf b/demos/heavyRelocs.omf new file mode 100644 index 0000000..aa71624 Binary files /dev/null and b/demos/heavyRelocs.omf differ diff --git a/demos/heavyRelocs.reloc b/demos/heavyRelocs.reloc new file mode 100644 index 0000000..60fd1e5 Binary files /dev/null and b/demos/heavyRelocs.reloc differ diff --git a/demos/helloBeep.bin b/demos/helloBeep.bin new file mode 100644 index 0000000..9bcfd06 Binary files /dev/null and b/demos/helloBeep.bin differ diff --git a/demos/helloBeep.c b/demos/helloBeep.c new file mode 100644 index 0000000..e770317 --- /dev/null +++ b/demos/helloBeep.c @@ -0,0 +1,25 @@ +// helloBeep.c - simplest possible GS/OS app. Three SysBeep calls then +// exit. Verifies the OMF + Loader path: if the IIgs makes three beeps, +// the app launched, ran, and returned cleanly. +// +// No toolbox startup is needed - the Loader has already done TLStartUp +// + MMStartUp for us, and SysBeep is a Misc Tools call that works +// without additional setup. +// +// Build with: bash demos/build.sh helloBeep +// Run with: bash scripts/runViaFinder.sh helloBeep.omf --check 0x70=0x42 + +#include "iigs/toolbox.h" + + +int main(void) { + SysBeep(); + SysBeep(); + SysBeep(); + *(volatile unsigned char *)0x70 = 0x99; // for headless verify + // Brief linger so snapshot tools can capture the post-Finder state + // before we exit (otherwise the screen snaps in the middle of GS/OS + // tearing the launcher state down). + for (volatile unsigned long s = 0; s < 600000UL; s++) { } + return 0; +} diff --git a/demos/helloBeep.map b/demos/helloBeep.map new file mode 100644 index 0000000..3922638 --- /dev/null +++ b/demos/helloBeep.map @@ -0,0 +1,161 @@ +# section layout +.text : 0x001000 .. 0x001c37 ( 3127 bytes) +.rodata : 0x001c37 .. 0x001c4b ( 20 bytes) +.bss : 0x00a000 .. 0x00a002 ( 2 bytes) + +# per-input-file .text contributions + 186 /home/scott/claude/llvm816/runtime/crt0Gsos.o + 401 /home/scott/claude/llvm816/demos/helloBeep.o + 43513 /home/scott/claude/llvm816/runtime/libc.o + 5935 /home/scott/claude/llvm816/runtime/snprintf.o + 11953 /home/scott/claude/llvm816/runtime/extras.o + 7077 /home/scott/claude/llvm816/runtime/softFloat.o + 15379 /home/scott/claude/llvm816/runtime/softDouble.o + 176 /home/scott/claude/llvm816/runtime/iigsGsos.o + 20670 /home/scott/claude/llvm816/runtime/iigsToolbox.o + 1349 /home/scott/claude/llvm816/runtime/desktop.o + 2540 /home/scott/claude/llvm816/runtime/libgcc.o + +# global symbols (sorted by address) +0x000000 __bss_bank +0x000000 __bss_seg0_bank +0x000000 __bss_seg1_bank +0x000000 __bss_seg1_lo16 +0x000000 __bss_seg1_size +0x000000 __bss_seg2_bank +0x000000 __bss_seg2_lo16 +0x000000 __bss_seg2_size +0x000000 __bss_seg3_bank +0x000000 __bss_seg3_lo16 +0x000000 __bss_seg3_size +0x000002 __bss_seg0_size +0x000002 __bss_size +0x001000 __start +0x001000 __text_start +0x0010ba main +0x00124b __jsl_indir +0x00124e __mulhi3 +0x00126d __umulhisi3 +0x0012c4 __ashlhi3 +0x0012d3 __lshrhi3 +0x0012e3 __ashrhi3 +0x0012f6 __udivhi3 +0x001302 __umodhi3 +0x00130e __divhi3 +0x001328 __modhi3 +0x001342 __divmod_setup +0x001375 __udivmod_core +0x001393 __mulsi3 +0x00144c __ashlsi3 +0x001461 __lshrsi3 +0x001476 __ashrsi3 +0x001490 __udivmodsi_core +0x0014c8 __udivsi3 +0x0014dc __umodsi3 +0x0014f0 __divsi3 +0x001517 __modsi3 +0x00153e __divmodsi_setup +0x00158f __divmoddi4_stash +0x0015ac __retdi +0x0015b9 __ashldi3 +0x0015dc __lshrdi3 +0x0015ff __ashrdi3 +0x001625 __muldi3 +0x001680 __ucmpdi2 +0x0016a9 __cmpdi2 +0x0016e0 __udivdi3 +0x0016e9 __umoddi3 +0x001702 __udivmoddi_core +0x00174f __divdi3 +0x00176e __moddi3 +0x00179b __absdi_a +0x0017a3 __absdi_b +0x0017ab __negdi_a +0x0017c9 __negdi_b +0x0017e7 setjmp +0x00180f longjmp +0x001839 __umulhisi3_qsq +0x001c37 __rodata_start +0x001c37 __text_end +0x001c37 gChainPath +0x001c4b __init_array_end +0x001c4b __init_array_start +0x001c4b __rodata_end +0x00a000 __bss_lo16 +0x00a000 __bss_seg0_lo16 +0x00a000 __bss_start +0x00a000 __indirTarget +0x00a002 __bss_end +0x00a002 __heap_start +0x00bf00 __heap_end +__absdi_a = 0x00179b +__absdi_b = 0x0017a3 +__ashldi3 = 0x0015b9 +__ashlhi3 = 0x0012c4 +__ashlsi3 = 0x00144c +__ashrdi3 = 0x0015ff +__ashrhi3 = 0x0012e3 +__ashrsi3 = 0x001476 +__bss_bank = 0x000000 +__bss_end = 0x00a002 +__bss_lo16 = 0x00a000 +__bss_seg0_bank = 0x000000 +__bss_seg0_lo16 = 0x00a000 +__bss_seg0_size = 0x000002 +__bss_seg1_bank = 0x000000 +__bss_seg1_lo16 = 0x000000 +__bss_seg1_size = 0x000000 +__bss_seg2_bank = 0x000000 +__bss_seg2_lo16 = 0x000000 +__bss_seg2_size = 0x000000 +__bss_seg3_bank = 0x000000 +__bss_seg3_lo16 = 0x000000 +__bss_seg3_size = 0x000000 +__bss_size = 0x000002 +__bss_start = 0x00a000 +__cmpdi2 = 0x0016a9 +__divdi3 = 0x00174f +__divhi3 = 0x00130e +__divmod_setup = 0x001342 +__divmoddi4_stash = 0x00158f +__divmodsi_setup = 0x00153e +__divsi3 = 0x0014f0 +__heap_end = 0x00bf00 +__heap_start = 0x00a002 +__indirTarget = 0x00a000 +__init_array_end = 0x001c4b +__init_array_start = 0x001c4b +__jsl_indir = 0x00124b +__lshrdi3 = 0x0015dc +__lshrhi3 = 0x0012d3 +__lshrsi3 = 0x001461 +__moddi3 = 0x00176e +__modhi3 = 0x001328 +__modsi3 = 0x001517 +__muldi3 = 0x001625 +__mulhi3 = 0x00124e +__mulsi3 = 0x001393 +__negdi_a = 0x0017ab +__negdi_b = 0x0017c9 +__retdi = 0x0015ac +__rodata_end = 0x001c4b +__rodata_start = 0x001c37 +__start = 0x001000 +__text_end = 0x001c37 +__text_start = 0x001000 +__ucmpdi2 = 0x001680 +__udivdi3 = 0x0016e0 +__udivhi3 = 0x0012f6 +__udivmod_core = 0x001375 +__udivmoddi_core = 0x001702 +__udivmodsi_core = 0x001490 +__udivsi3 = 0x0014c8 +__umoddi3 = 0x0016e9 +__umodhi3 = 0x001302 +__umodsi3 = 0x0014dc +__umulhisi3 = 0x00126d +__umulhisi3_qsq = 0x001839 +gChainPath = 0x001c37 +longjmp = 0x00180f +main = 0x0010ba +setjmp = 0x0017e7 diff --git a/demos/helloBeep.o b/demos/helloBeep.o new file mode 100644 index 0000000..c7f29a5 Binary files /dev/null and b/demos/helloBeep.o differ diff --git a/demos/helloBeep.omf b/demos/helloBeep.omf new file mode 100644 index 0000000..50e243d Binary files /dev/null and b/demos/helloBeep.omf differ diff --git a/demos/helloBeep.reloc b/demos/helloBeep.reloc new file mode 100644 index 0000000..e5c3f28 Binary files /dev/null and b/demos/helloBeep.reloc differ diff --git a/demos/helloText.bin b/demos/helloText.bin new file mode 100644 index 0000000..b6db460 Binary files /dev/null and b/demos/helloText.bin differ diff --git a/demos/helloText.c b/demos/helloText.c new file mode 100644 index 0000000..b0fd96f --- /dev/null +++ b/demos/helloText.c @@ -0,0 +1,42 @@ +// helloText.c - GS/OS app that draws text on the SHR screen via the +// real ROM Font Manager + QuickDraw DrawString. Uses the full desktop +// startup (which includes InitCursor — see feedback_drawmenubar_hang +// for why that's load-bearing) and waits for any key. + +#include "iigs/toolbox.h" +#include "iigs/desktop.h" + + +// Pascal-counted strings (length byte + chars). +static const unsigned char line1[] = "\x13" "Hello from llvm816!"; +static const unsigned char line2[] = "\x2B" "Clang-compiled C running on the Apple IIgs."; +static const unsigned char line3[] = "\x16" "Press any key to exit."; + + +int main(void) { + unsigned short userId = startdesk(640); + (void)userId; + + paintDesktopBackdrop(); + ShowCursor(); + + SetForeColor(0); + SetBackColor(15); + + MoveTo(40, 40); DrawString((void *)line1); + MoveTo(40, 60); DrawString((void *)line2); + MoveTo(40, 80); DrawString((void *)line3); + + for (volatile unsigned long s = 0; s < 400000UL; s++) { } + + short evt[8]; + while (1) { + if (GetNextEvent(0xFFFF, evt) && evt[0] == 3) { + break; + } + } + + SysBeep(); + *(volatile unsigned char *)0x70 = 0x99; + return 0; +} diff --git a/demos/helloText.map b/demos/helloText.map new file mode 100644 index 0000000..195062b --- /dev/null +++ b/demos/helloText.map @@ -0,0 +1,199 @@ +# section layout +.text : 0x001000 .. 0x0021ca ( 4554 bytes) +.rodata : 0x0021ca .. 0x002238 ( 110 bytes) +.bss : 0x00a000 .. 0x00a00a ( 10 bytes) + +# per-input-file .text contributions + 186 /home/scott/claude/llvm816/runtime/crt0Gsos.o + 552 /home/scott/claude/llvm816/demos/helloText.o + 43513 /home/scott/claude/llvm816/runtime/libc.o + 5935 /home/scott/claude/llvm816/runtime/snprintf.o + 11953 /home/scott/claude/llvm816/runtime/extras.o + 7077 /home/scott/claude/llvm816/runtime/softFloat.o + 15379 /home/scott/claude/llvm816/runtime/softDouble.o + 176 /home/scott/claude/llvm816/runtime/iigsGsos.o + 20670 /home/scott/claude/llvm816/runtime/iigsToolbox.o + 1349 /home/scott/claude/llvm816/runtime/desktop.o + 2540 /home/scott/claude/llvm816/runtime/libgcc.o + +# global symbols (sorted by address) +0x000000 __bss_bank +0x000000 __bss_seg0_bank +0x000000 __bss_seg1_bank +0x000000 __bss_seg1_lo16 +0x000000 __bss_seg1_size +0x000000 __bss_seg2_bank +0x000000 __bss_seg2_lo16 +0x000000 __bss_seg2_size +0x000000 __bss_seg3_bank +0x000000 __bss_seg3_lo16 +0x000000 __bss_seg3_size +0x00000a __bss_seg0_size +0x00000a __bss_size +0x001000 __start +0x001000 __text_start +0x0010ba main +0x0012e2 CtlStartUp +0x0012f2 EMStartUp +0x001311 GetNextEvent +0x001328 FMStartUp +0x001338 LEStartUp +0x001348 LoadOneTool +0x001358 NewHandle +0x00137e MenuStartUp +0x00138e QDStartUp +0x0013a4 DrawString +0x0013b6 MoveTo +0x0013c6 startdesk +0x0017ac paintDesktopBackdrop +0x0017de __jsl_indir +0x0017e1 __mulhi3 +0x001800 __umulhisi3 +0x001857 __ashlhi3 +0x001866 __lshrhi3 +0x001876 __ashrhi3 +0x001889 __udivhi3 +0x001895 __umodhi3 +0x0018a1 __divhi3 +0x0018bb __modhi3 +0x0018d5 __divmod_setup +0x001908 __udivmod_core +0x001926 __mulsi3 +0x0019df __ashlsi3 +0x0019f4 __lshrsi3 +0x001a09 __ashrsi3 +0x001a23 __udivmodsi_core +0x001a5b __udivsi3 +0x001a6f __umodsi3 +0x001a83 __divsi3 +0x001aaa __modsi3 +0x001ad1 __divmodsi_setup +0x001b22 __divmoddi4_stash +0x001b3f __retdi +0x001b4c __ashldi3 +0x001b6f __lshrdi3 +0x001b92 __ashrdi3 +0x001bb8 __muldi3 +0x001c13 __ucmpdi2 +0x001c3c __cmpdi2 +0x001c73 __udivdi3 +0x001c7c __umoddi3 +0x001c95 __udivmoddi_core +0x001ce2 __divdi3 +0x001d01 __moddi3 +0x001d2e __absdi_a +0x001d36 __absdi_b +0x001d3e __negdi_a +0x001d5c __negdi_b +0x001d7a setjmp +0x001da2 longjmp +0x001dcc __umulhisi3_qsq +0x0021ca __rodata_start +0x0021ca __text_end +0x0021ca gChainPath +0x0021de line1 +0x0021f3 line2 +0x002220 line3 +0x002238 __init_array_end +0x002238 __init_array_start +0x002238 __rodata_end +0x00a000 __bss_lo16 +0x00a000 __bss_seg0_lo16 +0x00a000 __bss_start +0x00a000 gUserId +0x00a002 gDpHandle +0x00a006 gDpBase +0x00a008 __indirTarget +0x00a00a __bss_end +0x00a00a __heap_start +0x00bf00 __heap_end +CtlStartUp = 0x0012e2 +DrawString = 0x0013a4 +EMStartUp = 0x0012f2 +FMStartUp = 0x001328 +GetNextEvent = 0x001311 +LEStartUp = 0x001338 +LoadOneTool = 0x001348 +MenuStartUp = 0x00137e +MoveTo = 0x0013b6 +NewHandle = 0x001358 +QDStartUp = 0x00138e +__absdi_a = 0x001d2e +__absdi_b = 0x001d36 +__ashldi3 = 0x001b4c +__ashlhi3 = 0x001857 +__ashlsi3 = 0x0019df +__ashrdi3 = 0x001b92 +__ashrhi3 = 0x001876 +__ashrsi3 = 0x001a09 +__bss_bank = 0x000000 +__bss_end = 0x00a00a +__bss_lo16 = 0x00a000 +__bss_seg0_bank = 0x000000 +__bss_seg0_lo16 = 0x00a000 +__bss_seg0_size = 0x00000a +__bss_seg1_bank = 0x000000 +__bss_seg1_lo16 = 0x000000 +__bss_seg1_size = 0x000000 +__bss_seg2_bank = 0x000000 +__bss_seg2_lo16 = 0x000000 +__bss_seg2_size = 0x000000 +__bss_seg3_bank = 0x000000 +__bss_seg3_lo16 = 0x000000 +__bss_seg3_size = 0x000000 +__bss_size = 0x00000a +__bss_start = 0x00a000 +__cmpdi2 = 0x001c3c +__divdi3 = 0x001ce2 +__divhi3 = 0x0018a1 +__divmod_setup = 0x0018d5 +__divmoddi4_stash = 0x001b22 +__divmodsi_setup = 0x001ad1 +__divsi3 = 0x001a83 +__heap_end = 0x00bf00 +__heap_start = 0x00a00a +__indirTarget = 0x00a008 +__init_array_end = 0x002238 +__init_array_start = 0x002238 +__jsl_indir = 0x0017de +__lshrdi3 = 0x001b6f +__lshrhi3 = 0x001866 +__lshrsi3 = 0x0019f4 +__moddi3 = 0x001d01 +__modhi3 = 0x0018bb +__modsi3 = 0x001aaa +__muldi3 = 0x001bb8 +__mulhi3 = 0x0017e1 +__mulsi3 = 0x001926 +__negdi_a = 0x001d3e +__negdi_b = 0x001d5c +__retdi = 0x001b3f +__rodata_end = 0x002238 +__rodata_start = 0x0021ca +__start = 0x001000 +__text_end = 0x0021ca +__text_start = 0x001000 +__ucmpdi2 = 0x001c13 +__udivdi3 = 0x001c73 +__udivhi3 = 0x001889 +__udivmod_core = 0x001908 +__udivmoddi_core = 0x001c95 +__udivmodsi_core = 0x001a23 +__udivsi3 = 0x001a5b +__umoddi3 = 0x001c7c +__umodhi3 = 0x001895 +__umodsi3 = 0x001a6f +__umulhisi3 = 0x001800 +__umulhisi3_qsq = 0x001dcc +gChainPath = 0x0021ca +gDpBase = 0x00a006 +gDpHandle = 0x00a002 +gUserId = 0x00a000 +line1 = 0x0021de +line2 = 0x0021f3 +line3 = 0x002220 +longjmp = 0x001da2 +main = 0x0010ba +paintDesktopBackdrop = 0x0017ac +setjmp = 0x001d7a +startdesk = 0x0013c6 diff --git a/demos/helloText.o b/demos/helloText.o new file mode 100644 index 0000000..8bf056a Binary files /dev/null and b/demos/helloText.o differ diff --git a/demos/helloText.omf b/demos/helloText.omf new file mode 100644 index 0000000..f5f4d28 Binary files /dev/null and b/demos/helloText.omf differ diff --git a/demos/helloText.reloc b/demos/helloText.reloc new file mode 100644 index 0000000..884fe4b Binary files /dev/null and b/demos/helloText.reloc differ diff --git a/demos/helloWindow.bin b/demos/helloWindow.bin new file mode 100644 index 0000000..da7ff88 Binary files /dev/null and b/demos/helloWindow.bin differ diff --git a/demos/helloWindow.c b/demos/helloWindow.c new file mode 100644 index 0000000..4e91eab --- /dev/null +++ b/demos/helloWindow.c @@ -0,0 +1,128 @@ +// helloWindow.c - GS/OS app that opens a Window Manager window and +// draws a greeting in it. Runs under real GS/OS 6.0.2 in MAME. +// +// What this exercises: +// - The full Window Manager StartUp chain (Memory + QD + Event + +// Scheduler + Window). +// - NewWindow ParamList with paramLength = sizeof (ORCA Clock.cc / +// Reversi.cc convention). +// - SetPort / ShowWindow / MoveTo / DrawString round-trip. +// - Event-driven keypress wait via GetNextEvent. +// - The W65816 backend's bank-byte relocation: +// `gWp.wTitle = gTitle` stores a 32-bit pointer where the bank +// byte is materialized via the new LDAi16imm_bank pseudo +// (lowered to `lda $BE` reading PBR from a crt0-set DP slot). +// Toolbox calls now receive correct `bank:offset` pointers for +// any `&global` argument — no wrapper-side workarounds needed. +// +// Why fTitle is NOT set in wFrameBits despite wTitle being valid: +// The Window Manager hangs trying to render a titled window without +// Font Manager initialization. A "real" titled-window demo would +// need to drive QDStartUp's font allocation and possibly start the +// Font Manager (FMStartUp) — that's the next milestone. + +#include "iigs/toolbox.h" + +#define fVis 0x0020 +#define fMove 0x0080 +#define fZoom 0x0100 +#define fGrow 0x0400 +#define fClose 0x4000 +#define fTitle 0x8000 + + +typedef struct { short v1, h1, v2, h2; } Rect; + +typedef struct { + unsigned short paramLength; + unsigned short wFrameBits; + void *wTitle; + unsigned long wRefCon; + Rect wZoom; + void *wColor; + short wYOrigin, wXOrigin; + short wDataH, wDataV; + short wMaxHeight, wMaxWidth; + short wScrollVer, wScrollHor; + short wPageVer, wPageHor; + unsigned long wInfoRefCon; + short wInfoHeight; + void *wFrameDefProc; + void *wInfoDefProc; + void *wContDefProc; + Rect wPosition; + void *wPlane; + void *wStorage; +} NewWindowParm; + + +// Pascal strings: leading length byte, then characters. +static unsigned char gTitle[] = "\x09llvm816!!"; +static unsigned char gMsg[] = "\x14Hello from llvm816!"; + +// ParamList in BSS so the bank byte of &gWp resolves to PBR via the +// new LDAi16imm_bank reloc path. +static NewWindowParm gWp; + + +static unsigned short blockAddr(void *handle) { + return (unsigned short)(unsigned long)*(void **)handle; +} + + +int main(void) { + unsigned short userId = MMStartUp(); + + void *dpH = NewHandle(0x900UL, userId, 0xC005, (void *)0); + unsigned short dpBase = blockAddr(dpH); + + QDStartUp(dpBase, 0, 0xA0, userId); + EMStartUp((unsigned short)(dpBase + 0x100), 0x14, 0, 0, + 0x14F, 0xC7, userId); + SchStartUp(); + WindStartUp(userId); + + // Zero the parm block, then set only the fields we want non-zero. + { + unsigned char *p = (unsigned char *)&gWp; + for (unsigned short i = 0; i < sizeof gWp; i++) { + p[i] = 0; + } + } + gWp.paramLength = (unsigned short)sizeof gWp; + // fVis+fMove only — fTitle requires Font Manager startup (FMStartUp + // with proper DP allocation) which is a TODO for the full ORCA- + // style desktop init. wTitle is still set to prove the new + // R_W65816_BANK16 reloc produces the correct bank byte at runtime + // (even though WM doesn't dereference it without fTitle). + gWp.wFrameBits = fVis | fMove; + gWp.wTitle = gTitle; + gWp.wMaxHeight = 200; + gWp.wMaxWidth = 320; + gWp.wPosition.v1 = 40; gWp.wPosition.h1 = 30; + gWp.wPosition.v2 = 140; gWp.wPosition.h2 = 290; + gWp.wPlane = (void *)-1L; + + void *win = NewWindow(&gWp); + if (win) { + SetPort(win); + ShowWindow(win); + MoveTo(20, 30); + DrawString(gMsg); + } + + // Brief visible linger before checking events (so snapshot demos can + // capture the window). Then wait for a real keypress. + for (volatile unsigned long s = 0; s < 400000UL; s++) { } + + short evt[8]; + while (1) { + if (GetNextEvent(0xFFFF, evt)) { + break; + } + } + + SysBeep(); + *(volatile unsigned char *)0x70 = 0x99; + return 0; +} diff --git a/demos/helloWindow.map b/demos/helloWindow.map new file mode 100644 index 0000000..b7dd0cd --- /dev/null +++ b/demos/helloWindow.map @@ -0,0 +1,187 @@ +# section layout +.text : 0x001000 .. 0x001ecd ( 3789 bytes) +.rodata : 0x001ecd .. 0x001f01 ( 52 bytes) +.bss : 0x00a000 .. 0x00a050 ( 80 bytes) + +# per-input-file .text contributions + 186 /home/scott/claude/llvm816/runtime/crt0Gsos.o + 757 /home/scott/claude/llvm816/demos/helloWindow.o + 43513 /home/scott/claude/llvm816/runtime/libc.o + 5935 /home/scott/claude/llvm816/runtime/snprintf.o + 11953 /home/scott/claude/llvm816/runtime/extras.o + 7077 /home/scott/claude/llvm816/runtime/softFloat.o + 15379 /home/scott/claude/llvm816/runtime/softDouble.o + 176 /home/scott/claude/llvm816/runtime/iigsGsos.o + 20670 /home/scott/claude/llvm816/runtime/iigsToolbox.o + 1349 /home/scott/claude/llvm816/runtime/desktop.o + 2540 /home/scott/claude/llvm816/runtime/libgcc.o + +# global symbols (sorted by address) +0x000000 __bss_bank +0x000000 __bss_seg0_bank +0x000000 __bss_seg1_bank +0x000000 __bss_seg1_lo16 +0x000000 __bss_seg1_size +0x000000 __bss_seg2_bank +0x000000 __bss_seg2_lo16 +0x000000 __bss_seg2_size +0x000000 __bss_seg3_bank +0x000000 __bss_seg3_lo16 +0x000000 __bss_seg3_size +0x000050 __bss_seg0_size +0x000050 __bss_size +0x001000 __start +0x001000 __text_start +0x0010ba main +0x0013af memset +0x00140f EMStartUp +0x00142e GetNextEvent +0x001445 NewHandle +0x00146b QDStartUp +0x001481 DrawString +0x001493 MoveTo +0x0014a3 SetPort +0x0014b5 NewWindow +0x0014cf ShowWindow +0x0014e1 __jsl_indir +0x0014e4 __mulhi3 +0x001503 __umulhisi3 +0x00155a __ashlhi3 +0x001569 __lshrhi3 +0x001579 __ashrhi3 +0x00158c __udivhi3 +0x001598 __umodhi3 +0x0015a4 __divhi3 +0x0015be __modhi3 +0x0015d8 __divmod_setup +0x00160b __udivmod_core +0x001629 __mulsi3 +0x0016e2 __ashlsi3 +0x0016f7 __lshrsi3 +0x00170c __ashrsi3 +0x001726 __udivmodsi_core +0x00175e __udivsi3 +0x001772 __umodsi3 +0x001786 __divsi3 +0x0017ad __modsi3 +0x0017d4 __divmodsi_setup +0x001825 __divmoddi4_stash +0x001842 __retdi +0x00184f __ashldi3 +0x001872 __lshrdi3 +0x001895 __ashrdi3 +0x0018bb __muldi3 +0x001916 __ucmpdi2 +0x00193f __cmpdi2 +0x001976 __udivdi3 +0x00197f __umoddi3 +0x001998 __udivmoddi_core +0x0019e5 __divdi3 +0x001a04 __moddi3 +0x001a31 __absdi_a +0x001a39 __absdi_b +0x001a41 __negdi_a +0x001a5f __negdi_b +0x001a7d setjmp +0x001aa5 longjmp +0x001acf __umulhisi3_qsq +0x001ecd __rodata_start +0x001ecd __text_end +0x001ecd gChainPath +0x001ee1 gTitle +0x001eec gMsg +0x001f01 __init_array_end +0x001f01 __init_array_start +0x001f01 __rodata_end +0x00a000 __bss_lo16 +0x00a000 __bss_seg0_lo16 +0x00a000 __bss_start +0x00a000 gWp +0x00a04e __indirTarget +0x00a050 __bss_end +0x00a050 __heap_start +0x00bf00 __heap_end +DrawString = 0x001481 +EMStartUp = 0x00140f +GetNextEvent = 0x00142e +MoveTo = 0x001493 +NewHandle = 0x001445 +NewWindow = 0x0014b5 +QDStartUp = 0x00146b +SetPort = 0x0014a3 +ShowWindow = 0x0014cf +__absdi_a = 0x001a31 +__absdi_b = 0x001a39 +__ashldi3 = 0x00184f +__ashlhi3 = 0x00155a +__ashlsi3 = 0x0016e2 +__ashrdi3 = 0x001895 +__ashrhi3 = 0x001579 +__ashrsi3 = 0x00170c +__bss_bank = 0x000000 +__bss_end = 0x00a050 +__bss_lo16 = 0x00a000 +__bss_seg0_bank = 0x000000 +__bss_seg0_lo16 = 0x00a000 +__bss_seg0_size = 0x000050 +__bss_seg1_bank = 0x000000 +__bss_seg1_lo16 = 0x000000 +__bss_seg1_size = 0x000000 +__bss_seg2_bank = 0x000000 +__bss_seg2_lo16 = 0x000000 +__bss_seg2_size = 0x000000 +__bss_seg3_bank = 0x000000 +__bss_seg3_lo16 = 0x000000 +__bss_seg3_size = 0x000000 +__bss_size = 0x000050 +__bss_start = 0x00a000 +__cmpdi2 = 0x00193f +__divdi3 = 0x0019e5 +__divhi3 = 0x0015a4 +__divmod_setup = 0x0015d8 +__divmoddi4_stash = 0x001825 +__divmodsi_setup = 0x0017d4 +__divsi3 = 0x001786 +__heap_end = 0x00bf00 +__heap_start = 0x00a050 +__indirTarget = 0x00a04e +__init_array_end = 0x001f01 +__init_array_start = 0x001f01 +__jsl_indir = 0x0014e1 +__lshrdi3 = 0x001872 +__lshrhi3 = 0x001569 +__lshrsi3 = 0x0016f7 +__moddi3 = 0x001a04 +__modhi3 = 0x0015be +__modsi3 = 0x0017ad +__muldi3 = 0x0018bb +__mulhi3 = 0x0014e4 +__mulsi3 = 0x001629 +__negdi_a = 0x001a41 +__negdi_b = 0x001a5f +__retdi = 0x001842 +__rodata_end = 0x001f01 +__rodata_start = 0x001ecd +__start = 0x001000 +__text_end = 0x001ecd +__text_start = 0x001000 +__ucmpdi2 = 0x001916 +__udivdi3 = 0x001976 +__udivhi3 = 0x00158c +__udivmod_core = 0x00160b +__udivmoddi_core = 0x001998 +__udivmodsi_core = 0x001726 +__udivsi3 = 0x00175e +__umoddi3 = 0x00197f +__umodhi3 = 0x001598 +__umodsi3 = 0x001772 +__umulhisi3 = 0x001503 +__umulhisi3_qsq = 0x001acf +gChainPath = 0x001ecd +gMsg = 0x001eec +gTitle = 0x001ee1 +gWp = 0x00a000 +longjmp = 0x001aa5 +main = 0x0010ba +memset = 0x0013af +setjmp = 0x001a7d diff --git a/demos/helloWindow.o b/demos/helloWindow.o new file mode 100644 index 0000000..5e75d38 Binary files /dev/null and b/demos/helloWindow.o differ diff --git a/demos/helloWindow.omf b/demos/helloWindow.omf new file mode 100644 index 0000000..01d799b Binary files /dev/null and b/demos/helloWindow.omf differ diff --git a/demos/helloWindow.reloc b/demos/helloWindow.reloc new file mode 100644 index 0000000..dfb3669 Binary files /dev/null and b/demos/helloWindow.reloc differ diff --git a/demos/launch.sh b/demos/launch.sh new file mode 100755 index 0000000..9e5ec21 --- /dev/null +++ b/demos/launch.sh @@ -0,0 +1,99 @@ +#!/usr/bin/env bash +# launch.sh - boot the IIgs in MAME and launch a demo OMF interactively. +# +# Unlike runViaFinder.sh (which is the headless smoke harness), +# this script: +# - Shows the MAME window so you can see the demo run +# - Plays audio so SysBeep is audible +# - Runs at real (throttled) speed +# - No timeout - close MAME when done (Esc, then Cmd-Q) +# +# Usage: +# bash demos/launch.sh helloBeep +# bash demos/launch.sh helloWindow +# +# The script first builds the demo if its .omf is missing or older +# than its .c source, then injects it onto a fresh ProDOS disk image +# and boots GS/OS 6.0.2 with the Finder driven via Lua keyboard +# automation to launch the app. + +set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" + +[ $# -ge 1 ] || { echo "usage: $0 (e.g. helloBeep, helloWindow)" >&2; exit 2; } +BASE="$1" +SRC="$SCRIPT_DIR/$BASE.c" +OMF="$SCRIPT_DIR/$BASE.omf" + +[ -f "$SRC" ] || { echo "no source: $SRC" >&2; exit 2; } + +# Rebuild if needed. +if [ ! -f "$OMF" ] || [ "$SRC" -nt "$OMF" ]; then + echo "Building $BASE..." + bash "$SCRIPT_DIR/build.sh" "$BASE" +fi + +CADIUS=${CADIUS:-$PROJECT_ROOT/tools/cadius/cadius} +SYSDISK=${SYSDISK:-$PROJECT_ROOT/tools/gsos/sys602.po} + +[ -x "$CADIUS" ] || { echo "cadius not found at $CADIUS" >&2; exit 2; } +[ -f "$SYSDISK" ] || { echo "sysdisk not found at $SYSDISK" >&2; exit 2; } +command -v mame >/dev/null || { echo "mame not in PATH" >&2; exit 2; } + +WORK=$(mktemp -d -t demolaunch.XXXXXX) +trap 'rm -rf "$WORK"' EXIT + +cp "$SYSDISK" "$WORK/disk.po" +"$CADIUS" CREATEVOLUME "$WORK/data.po" DATA 800KB >/dev/null +# cadius uses the source-file basename as the on-disk name; copy +# the OMF to a file named HELLO with the OMF filetype (#B30000) +# so GS/OS Finder shows it as an application. +cp "$OMF" "$WORK/HELLO#B30000" +"$CADIUS" ADDFILE "$WORK/data.po" /DATA "$WORK/HELLO#B30000" >/dev/null + +# Lua keyboard automation: same as runViaFinder.sh - open the Data +# volume from the Finder and Cmd-O the HELLO icon. After launch +# the demo runs uninterrupted until the user closes MAME. +cat > "$WORK/finder.lua" <<'LUA' +local nat = manager.machine.natkeyboard +local frame = 0 +local idx = 1 + +local function get_field(port, name) + local p = manager.machine.ioport.ports[port] + if p == nil then return nil end + return p.fields[name] +end +local key_cmd = get_field(":macadb:KEY3", "Command / Open Apple") +local function press(f) if f then f:set_value(1) end end +local function release(f) if f then f:set_value(0) end end + +local steps = { + {3300, function() nat:post("D") end}, -- select Data + {3540, function() press(key_cmd) end}, + {3546, function() nat:post("o") end}, -- Cmd-O opens volume + {3600, function() release(key_cmd) end}, + {4200, function() nat:post("H") end}, -- select HELLO + {4500, function() press(key_cmd) end}, + {4506, function() nat:post("o") end}, -- Cmd-O launches + {4560, function() release(key_cmd) end}, +} +emu.register_frame_done(function() + frame = frame + 1 + while idx <= #steps and frame >= steps[idx][1] do + steps[idx][2]() + idx = idx + 1 + end +end) +LUA + +echo "Launching MAME with $BASE.omf..." +echo "Close the MAME window (or hit Esc, then Cmd-Q) to exit." +echo + +mame apple2gs \ + -rompath "$PROJECT_ROOT/tools/mame/roms" \ + -window \ + -flop3 "$WORK/disk.po" -flop4 "$WORK/data.po" \ + -autoboot_script "$WORK/finder.lua" diff --git a/demos/minicad.bin b/demos/minicad.bin new file mode 100644 index 0000000..f37581a Binary files /dev/null and b/demos/minicad.bin differ diff --git a/demos/minicad.c b/demos/minicad.c new file mode 100644 index 0000000..59ebe8f --- /dev/null +++ b/demos/minicad.c @@ -0,0 +1,149 @@ +// minicad.c - port of ORCA-C's MiniCAD.cc sample. +// +// MiniCAD is a tiny drawing program: each click in the content area +// creates a new line in the current window's line list. In the +// original you click to set the anchor, drag to draw a rubber-band +// line, release to commit. We seed three classic line-art patterns +// (curve-stitching, sunburst, mandala) instead of waiting for clicks +// because our minimal Event Manager doesn't have a working +// GetNextEvent path for mouse-drag tracking, but the data model and +// rendering pipeline match MiniCAD.cc verbatim. + +#include "iigs/toolbox.h" +#include "iigs/desktop.h" + + +#define wInContent 19 +#define fVis 0x0020 +#define fMove 0x0080 +#define fClose 0x4000 + + +typedef struct { short v1, h1, v2, h2; } Rect; + +typedef struct { + unsigned short paramLength; + unsigned short wFrameBits; + void *wTitle; + unsigned long wRefCon; + Rect wZoom; + void *wColor; + short wYOrigin, wXOrigin; + short wDataH, wDataV; + short wMaxHeight, wMaxWidth; + short wScrollVer, wScrollHor; + short wPageVer, wPageHor; + unsigned long wInfoRefCon; + short wInfoHeight; + void *wFrameDefProc; + void *wInfoDefProc; + void *wContDefProc; + Rect wPosition; + void *wPlane; + void *wStorage; +} NewWindowParm; + + +typedef struct { short v1, h1, v2, h2; } LineRec; + + +static unsigned char gTitle[] = "\x07MiniCAD"; + +// Menu bar titles painted manually (DrawMenuBar hangs in our env). +static const unsigned char appleTitle[] = "\x01\x14"; +static const unsigned char fileTitle[] = "\x04" "File"; +static const unsigned char editTitle[] = "\x04" "Edit"; +static const unsigned char optsTitle[] = "\x07" "Options"; +static const unsigned char *const menuTitles[] = { + appleTitle, fileTitle, editTitle, optsTitle +}; + +static NewWindowParm gWp; + + +// Draw a curve-stitching pattern: 12 chord lines mapping the y-axis +// to a curve along the x-axis. Visually it traces a hyperbolic +// envelope (the classic "string art" pattern). +static void drawCurves(short ox, short oy) { + for (short i = 0; i < 12; i++) { + MoveTo((short)(ox + 0), (short)(oy + i * 6)); + LineTo((short)(ox + 90 - i * 5), (short)(oy + 70 - i * 5)); + } +} + + +// Draw a sunburst: 12 radial lines from a central point. +static void drawSunburst(short cx, short cy, short r) { + // Pre-computed cos/sin for 12 equally-spaced angles (every 30 + // degrees), scaled by 1000. Avoids any float math. + static const short cosA[12] = { 1000, 866, 500, 0, -500, -866, -1000, -866, -500, 0, 500, 866 }; + static const short sinA[12] = { 0, 500, 866, 1000, 866, 500, 0, -500, -866, -1000, -866, -500 }; + for (short i = 0; i < 12; i++) { + short dx = (short)((long)cosA[i] * r / 1000); + short dy = (short)((long)sinA[i] * r / 1000); + MoveTo((short)(cx - dx), (short)(cy - dy)); + LineTo((short)(cx + dx), (short)(cy + dy)); + } +} + + +// Draw a mandala: 6-pointed star made of two overlapping triangles. +static void drawMandala(short cx, short cy, short r) { + short h = (short)((long)r * 866L / 1000L); + short h2 = (short)(r / 2); + // First triangle (point up). + MoveTo(cx, (short)(cy - r)); + LineTo((short)(cx + h), (short)(cy + h2)); + LineTo((short)(cx - h), (short)(cy + h2)); + LineTo(cx, (short)(cy - r)); + // Second triangle (point down). + MoveTo(cx, (short)(cy + r)); + LineTo((short)(cx + h), (short)(cy - h2)); + LineTo((short)(cx - h), (short)(cy - h2)); + LineTo(cx, (short)(cy + r)); +} + + +int main(void) { + unsigned short userId = startdesk(640); + (void)userId; + paintDesktopBackdrop(); + paintMenuBarTitles(menuTitles, 4); + ShowCursor(); + + // Open the drawing window. + { + unsigned char *p = (unsigned char *)&gWp; + for (unsigned short i = 0; i < sizeof gWp; i++) p[i] = 0; + } + gWp.paramLength = (unsigned short)sizeof gWp; + gWp.wFrameBits = fVis | fMove | fClose; + gWp.wTitle = gTitle; + gWp.wMaxHeight = 200; + gWp.wMaxWidth = 640; + gWp.wPosition.v1 = 20; gWp.wPosition.h1 = 30; + gWp.wPosition.v2 = 180; gWp.wPosition.h2 = 610; + gWp.wPlane = (void *)-1L; + void *win = NewWindow(&gWp); + + if (win) { + BeginUpdate(win); + SetPort(win); + SetSolidPenPat(0); + + // Three patterns laid out horizontally. + drawCurves(20, 30); + drawSunburst(280, 75, 50); + drawMandala(450, 75, 50); + + EndUpdate(win); + } + + for (volatile unsigned long s = 0; s < 400000UL; s++) { } + + if (win) { + CloseWindow(win); + } + *(volatile unsigned char *)0x70 = 0x99; + return 0; +} diff --git a/demos/minicad.map b/demos/minicad.map new file mode 100644 index 0000000..bae295a --- /dev/null +++ b/demos/minicad.map @@ -0,0 +1,223 @@ +# section layout +.text : 0x001000 .. 0x002638 ( 5688 bytes) +.rodata : 0x002638 .. 0x0026ad ( 117 bytes) +.bss : 0x00a000 .. 0x00a058 ( 88 bytes) + +# per-input-file .text contributions + 186 /home/scott/claude/llvm816/runtime/crt0Gsos.o + 1374 /home/scott/claude/llvm816/demos/minicad.o + 43513 /home/scott/claude/llvm816/runtime/libc.o + 5935 /home/scott/claude/llvm816/runtime/snprintf.o + 11953 /home/scott/claude/llvm816/runtime/extras.o + 7077 /home/scott/claude/llvm816/runtime/softFloat.o + 15379 /home/scott/claude/llvm816/runtime/softDouble.o + 176 /home/scott/claude/llvm816/runtime/iigsGsos.o + 20670 /home/scott/claude/llvm816/runtime/iigsToolbox.o + 1302 /home/scott/claude/llvm816/runtime/desktop.o + 2540 /home/scott/claude/llvm816/runtime/libgcc.o + +# global symbols (sorted by address) +0x000000 __bss_bank +0x000000 __bss_seg0_bank +0x000000 __bss_seg1_bank +0x000000 __bss_seg1_lo16 +0x000000 __bss_seg1_size +0x000000 __bss_seg2_bank +0x000000 __bss_seg2_lo16 +0x000000 __bss_seg2_size +0x000000 __bss_seg3_bank +0x000000 __bss_seg3_lo16 +0x000000 __bss_seg3_size +0x000058 __bss_seg0_size +0x000058 __bss_size +0x001000 __start +0x001000 __text_start +0x0010ba main +0x001618 memset +0x001678 CtlStartUp +0x001688 EMStartUp +0x0016a7 FMStartUp +0x0016b7 LEStartUp +0x0016c7 LoadOneTool +0x0016d7 NewHandle +0x0016fd QDStartUp +0x001713 DrawString +0x001725 LineTo +0x001735 MoveTo +0x001745 SetPort +0x001757 BeginUpdate +0x001769 CloseWindow +0x00177b EndUpdate +0x00178d NewWindow +0x0017a7 startdesk +0x001b5e paintMenuBarTitles +0x001c1a paintDesktopBackdrop +0x001c4c __jsl_indir +0x001c4f __mulhi3 +0x001c6e __umulhisi3 +0x001cc5 __ashlhi3 +0x001cd4 __lshrhi3 +0x001ce4 __ashrhi3 +0x001cf7 __udivhi3 +0x001d03 __umodhi3 +0x001d0f __divhi3 +0x001d29 __modhi3 +0x001d43 __divmod_setup +0x001d76 __udivmod_core +0x001d94 __mulsi3 +0x001e4d __ashlsi3 +0x001e62 __lshrsi3 +0x001e77 __ashrsi3 +0x001e91 __udivmodsi_core +0x001ec9 __udivsi3 +0x001edd __umodsi3 +0x001ef1 __divsi3 +0x001f18 __modsi3 +0x001f3f __divmodsi_setup +0x001f90 __divmoddi4_stash +0x001fad __retdi +0x001fba __ashldi3 +0x001fdd __lshrdi3 +0x002000 __ashrdi3 +0x002026 __muldi3 +0x002081 __ucmpdi2 +0x0020aa __cmpdi2 +0x0020e1 __udivdi3 +0x0020ea __umoddi3 +0x002103 __udivmoddi_core +0x002150 __divdi3 +0x00216f __moddi3 +0x00219c __absdi_a +0x0021a4 __absdi_b +0x0021ac __negdi_a +0x0021ca __negdi_b +0x0021e8 setjmp +0x002210 longjmp +0x00223a __umulhisi3_qsq +0x002638 __rodata_start +0x002638 __text_end +0x002638 gChainPath +0x00264c menuTitles +0x00265c appleTitle +0x00265f fileTitle +0x002665 editTitle +0x00266b optsTitle +0x002674 drawSunburst.cosA +0x00268c drawSunburst.sinA +0x0026a4 gTitle +0x0026ad __init_array_end +0x0026ad __init_array_start +0x0026ad __rodata_end +0x00a000 __bss_lo16 +0x00a000 __bss_seg0_lo16 +0x00a000 __bss_start +0x00a000 gWp +0x00a04e gUserId +0x00a050 gDpHandle +0x00a054 gDpBase +0x00a056 __indirTarget +0x00a058 __bss_end +0x00a058 __heap_start +0x00bf00 __heap_end +BeginUpdate = 0x001757 +CloseWindow = 0x001769 +CtlStartUp = 0x001678 +DrawString = 0x001713 +EMStartUp = 0x001688 +EndUpdate = 0x00177b +FMStartUp = 0x0016a7 +LEStartUp = 0x0016b7 +LineTo = 0x001725 +LoadOneTool = 0x0016c7 +MoveTo = 0x001735 +NewHandle = 0x0016d7 +NewWindow = 0x00178d +QDStartUp = 0x0016fd +SetPort = 0x001745 +__absdi_a = 0x00219c +__absdi_b = 0x0021a4 +__ashldi3 = 0x001fba +__ashlhi3 = 0x001cc5 +__ashlsi3 = 0x001e4d +__ashrdi3 = 0x002000 +__ashrhi3 = 0x001ce4 +__ashrsi3 = 0x001e77 +__bss_bank = 0x000000 +__bss_end = 0x00a058 +__bss_lo16 = 0x00a000 +__bss_seg0_bank = 0x000000 +__bss_seg0_lo16 = 0x00a000 +__bss_seg0_size = 0x000058 +__bss_seg1_bank = 0x000000 +__bss_seg1_lo16 = 0x000000 +__bss_seg1_size = 0x000000 +__bss_seg2_bank = 0x000000 +__bss_seg2_lo16 = 0x000000 +__bss_seg2_size = 0x000000 +__bss_seg3_bank = 0x000000 +__bss_seg3_lo16 = 0x000000 +__bss_seg3_size = 0x000000 +__bss_size = 0x000058 +__bss_start = 0x00a000 +__cmpdi2 = 0x0020aa +__divdi3 = 0x002150 +__divhi3 = 0x001d0f +__divmod_setup = 0x001d43 +__divmoddi4_stash = 0x001f90 +__divmodsi_setup = 0x001f3f +__divsi3 = 0x001ef1 +__heap_end = 0x00bf00 +__heap_start = 0x00a058 +__indirTarget = 0x00a056 +__init_array_end = 0x0026ad +__init_array_start = 0x0026ad +__jsl_indir = 0x001c4c +__lshrdi3 = 0x001fdd +__lshrhi3 = 0x001cd4 +__lshrsi3 = 0x001e62 +__moddi3 = 0x00216f +__modhi3 = 0x001d29 +__modsi3 = 0x001f18 +__muldi3 = 0x002026 +__mulhi3 = 0x001c4f +__mulsi3 = 0x001d94 +__negdi_a = 0x0021ac +__negdi_b = 0x0021ca +__retdi = 0x001fad +__rodata_end = 0x0026ad +__rodata_start = 0x002638 +__start = 0x001000 +__text_end = 0x002638 +__text_start = 0x001000 +__ucmpdi2 = 0x002081 +__udivdi3 = 0x0020e1 +__udivhi3 = 0x001cf7 +__udivmod_core = 0x001d76 +__udivmoddi_core = 0x002103 +__udivmodsi_core = 0x001e91 +__udivsi3 = 0x001ec9 +__umoddi3 = 0x0020ea +__umodhi3 = 0x001d03 +__umodsi3 = 0x001edd +__umulhisi3 = 0x001c6e +__umulhisi3_qsq = 0x00223a +appleTitle = 0x00265c +drawSunburst.cosA = 0x002674 +drawSunburst.sinA = 0x00268c +editTitle = 0x002665 +fileTitle = 0x00265f +gChainPath = 0x002638 +gDpBase = 0x00a054 +gDpHandle = 0x00a050 +gTitle = 0x0026a4 +gUserId = 0x00a04e +gWp = 0x00a000 +longjmp = 0x002210 +main = 0x0010ba +memset = 0x001618 +menuTitles = 0x00264c +optsTitle = 0x00266b +paintDesktopBackdrop = 0x001c1a +paintMenuBarTitles = 0x001b5e +setjmp = 0x0021e8 +startdesk = 0x0017a7 diff --git a/demos/minicad.o b/demos/minicad.o new file mode 100644 index 0000000..717c10a Binary files /dev/null and b/demos/minicad.o differ diff --git a/demos/minicad.omf b/demos/minicad.omf new file mode 100644 index 0000000..3cbb43e Binary files /dev/null and b/demos/minicad.omf differ diff --git a/demos/minicad.reloc b/demos/minicad.reloc new file mode 100644 index 0000000..ecb326b Binary files /dev/null and b/demos/minicad.reloc differ diff --git a/demos/orcaFrame.bin b/demos/orcaFrame.bin new file mode 100644 index 0000000..5ba0a33 Binary files /dev/null and b/demos/orcaFrame.bin differ diff --git a/demos/orcaFrame.c b/demos/orcaFrame.c new file mode 100644 index 0000000..56411f5 --- /dev/null +++ b/demos/orcaFrame.c @@ -0,0 +1,147 @@ +// orcaFrame.c - ORCA-style desktop application. +// +// Opens a Window Manager window via startdesk()'s full toolset chain, +// runs an event loop via TaskMaster until the user clicks the close +// box, presses Q, or the watchdog fires. +// +// Modeled after ORCA-C's Frame.cc / Reversi.cc samples. Exercises +// our LLVM/Clang toolchain + the new bank-byte relocation +// end-to-end against the real GS/OS 6.0.2 / 6.0.4 Window Manager. +// +// **Status (2026-05-16):** structurally green. NewWindow with +// `fTitle | fVis | fMove | fClose` returns a valid WindowPtr on both +// 6.0.2 (sys602.po) and 6.0.4 (tools/gsos/6.0.4 - System.Disk.po). +// The headless test reads $00:0071=0xAA confirming NewWindow returned +// non-NULL; the $00:0070=0x99 end-marker confirms the demo ran to +// completion. Visual rendering of the WM frame is a separate known +// issue (see [[orca-window-render-broken]] memory): the SHR plane +// stays unpainted between WindStartUp and snapshot — likely a missing +// init step in startdesk(), not an fTitle problem. + +#include "iigs/toolbox.h" +#include "iigs/desktop.h" + +// wFrameBits constants from ORCA's window.h +#define fTitle 0x0001 +#define fVis 0x0020 +#define fMove 0x0080 +#define fClose 0x4000 + +// TaskMaster event codes +#define wInGoAway 17 + + +typedef struct { short v1, h1, v2, h2; } Rect; + +typedef struct { + unsigned short paramLength; + unsigned short wFrameBits; + void *wTitle; + unsigned long wRefCon; + Rect wZoom; + void *wColor; + short wYOrigin, wXOrigin; + short wDataH, wDataV; + short wMaxHeight, wMaxWidth; + short wScrollVer, wScrollHor; + short wPageVer, wPageHor; + unsigned long wInfoRefCon; + short wInfoHeight; + void *wFrameDefProc; + void *wInfoDefProc; + void *wContDefProc; + Rect wPosition; + void *wPlane; + void *wStorage; +} NewWindowParm; + + +typedef struct { + unsigned short wmWhat; + unsigned long wmMessage; + unsigned long wmWhen; + short wmWhereV, wmWhereH; + unsigned short wmModifiers; + unsigned long wmTaskData; + unsigned long wmTaskMask; + unsigned long wmLastClickTick; + unsigned long wmClickCount; + unsigned long wmTaskData2; + unsigned long wmTaskData3; + unsigned long wmTaskData4; +} WmTaskRec; + + +static unsigned char gMsg[] = "\x14Hello from llvm816!"; + +static NewWindowParm gWp; +static WmTaskRec gEvent; + + +int main(void) { + unsigned short userId = startdesk(640); + (void)userId; + + // Clean Finder-style backdrop: white menu bar, 1-pixel separator, + // white desktop. Bypasses the WM dithered fill that MAME's + // NTSC simulator renders as colored noise. + __asm__ volatile ( + "rep #0x30\n" + "ldx #0x0000\n" + "1:\n" + ".byte 0xa9, 0xff, 0xff\n" + ".byte 0x9f, 0x00, 0x20, 0xe1\n" + "inx\n inx\n" + ".byte 0xe0, 0x20, 0x08\n" + "bcc 1b\n" + "2:\n" + ".byte 0xa9, 0x00, 0x00\n" + ".byte 0x9f, 0x00, 0x20, 0xe1\n" + "inx\n inx\n" + ".byte 0xe0, 0xc0, 0x08\n" + "bcc 2b\n" + "3:\n" + ".byte 0xa9, 0xff, 0xff\n" + ".byte 0x9f, 0x00, 0x20, 0xe1\n" + "inx\n inx\n" + ".byte 0xe0, 0x00, 0x7d\n" + "bcc 3b\n" + ::: "a", "x", "memory"); + + // Build the NewWindow ParamList: zero everything first, then set + // only the fields we care about. + { + unsigned char *p = (unsigned char *)&gWp; + for (unsigned short i = 0; i < sizeof gWp; i++) p[i] = 0; + } + gWp.paramLength = (unsigned short)sizeof gWp; + gWp.wFrameBits = fVis | fMove | fClose; + gWp.wTitle = (void *)0; + gWp.wMaxHeight = 200; + gWp.wMaxWidth = 320; + gWp.wPosition.v1 = 40; gWp.wPosition.h1 = 60; + gWp.wPosition.v2 = 140; gWp.wPosition.h2 = 580; + gWp.wPlane = (void *)-1L; + + ShowCursor(); + + void *win = NewWindow(&gWp); + if (win) { + *(volatile unsigned char *)0x71 = 0xAA; + BeginUpdate(win); + SetPort(win); + MoveTo(20, 30); + DrawString(gMsg); + EndUpdate(win); + } + + (void)gEvent; + for (volatile unsigned long s = 0; s < 300000UL; s++) { } + + if (win) { + CloseWindow(win); + } + + *(volatile unsigned char *)0x70 = 0x99; + return 0; +} diff --git a/demos/orcaFrame.map b/demos/orcaFrame.map new file mode 100644 index 0000000..1dc9c3f --- /dev/null +++ b/demos/orcaFrame.map @@ -0,0 +1,201 @@ +# section layout +.text : 0x001000 .. 0x00225d ( 4701 bytes) +.rodata : 0x00225d .. 0x002286 ( 41 bytes) +.bss : 0x00a000 .. 0x00a056 ( 86 bytes) + +# per-input-file .text contributions + 186 /home/scott/claude/llvm816/runtime/crt0Gsos.o + 690 /home/scott/claude/llvm816/demos/orcaFrame.o + 43513 /home/scott/claude/llvm816/runtime/libc.o + 5935 /home/scott/claude/llvm816/runtime/snprintf.o + 11953 /home/scott/claude/llvm816/runtime/extras.o + 7077 /home/scott/claude/llvm816/runtime/softFloat.o + 15379 /home/scott/claude/llvm816/runtime/softDouble.o + 176 /home/scott/claude/llvm816/runtime/iigsGsos.o + 20670 /home/scott/claude/llvm816/runtime/iigsToolbox.o + 1050 /home/scott/claude/llvm816/runtime/desktop.o + 2540 /home/scott/claude/llvm816/runtime/libgcc.o + +# global symbols (sorted by address) +0x000000 __bss_bank +0x000000 __bss_seg0_bank +0x000000 __bss_seg1_bank +0x000000 __bss_seg1_lo16 +0x000000 __bss_seg1_size +0x000000 __bss_seg2_bank +0x000000 __bss_seg2_lo16 +0x000000 __bss_seg2_size +0x000000 __bss_seg3_bank +0x000000 __bss_seg3_lo16 +0x000000 __bss_seg3_size +0x000056 __bss_seg0_size +0x000056 __bss_size +0x001000 __start +0x001000 __text_start +0x0010ba main +0x00136c memset +0x0013cc CtlStartUp +0x0013dc EMStartUp +0x0013fb FMStartUp +0x00140b LEStartUp +0x00141b LoadOneTool +0x00142b NewHandle +0x001451 QDStartUp +0x001467 DrawString +0x001479 MoveTo +0x001489 SetPort +0x00149b BeginUpdate +0x0014ad CloseWindow +0x0014bf EndUpdate +0x0014d1 NewWindow +0x0014eb startdesk +0x001871 __jsl_indir +0x001874 __mulhi3 +0x001893 __umulhisi3 +0x0018ea __ashlhi3 +0x0018f9 __lshrhi3 +0x001909 __ashrhi3 +0x00191c __udivhi3 +0x001928 __umodhi3 +0x001934 __divhi3 +0x00194e __modhi3 +0x001968 __divmod_setup +0x00199b __udivmod_core +0x0019b9 __mulsi3 +0x001a72 __ashlsi3 +0x001a87 __lshrsi3 +0x001a9c __ashrsi3 +0x001ab6 __udivmodsi_core +0x001aee __udivsi3 +0x001b02 __umodsi3 +0x001b16 __divsi3 +0x001b3d __modsi3 +0x001b64 __divmodsi_setup +0x001bb5 __divmoddi4_stash +0x001bd2 __retdi +0x001bdf __ashldi3 +0x001c02 __lshrdi3 +0x001c25 __ashrdi3 +0x001c4b __muldi3 +0x001ca6 __ucmpdi2 +0x001ccf __cmpdi2 +0x001d06 __udivdi3 +0x001d0f __umoddi3 +0x001d28 __udivmoddi_core +0x001d75 __divdi3 +0x001d94 __moddi3 +0x001dc1 __absdi_a +0x001dc9 __absdi_b +0x001dd1 __negdi_a +0x001def __negdi_b +0x001e0d setjmp +0x001e35 longjmp +0x001e5f __umulhisi3_qsq +0x00225d __rodata_start +0x00225d __text_end +0x00225d gChainPath +0x002271 gMsg +0x002286 __init_array_end +0x002286 __init_array_start +0x002286 __rodata_end +0x00a000 __bss_lo16 +0x00a000 __bss_seg0_lo16 +0x00a000 __bss_start +0x00a000 gWp +0x00a04e gUserId +0x00a050 gDpHandle +0x00a054 __indirTarget +0x00a056 __bss_end +0x00a056 __heap_start +0x00bf00 __heap_end +BeginUpdate = 0x00149b +CloseWindow = 0x0014ad +CtlStartUp = 0x0013cc +DrawString = 0x001467 +EMStartUp = 0x0013dc +EndUpdate = 0x0014bf +FMStartUp = 0x0013fb +LEStartUp = 0x00140b +LoadOneTool = 0x00141b +MoveTo = 0x001479 +NewHandle = 0x00142b +NewWindow = 0x0014d1 +QDStartUp = 0x001451 +SetPort = 0x001489 +__absdi_a = 0x001dc1 +__absdi_b = 0x001dc9 +__ashldi3 = 0x001bdf +__ashlhi3 = 0x0018ea +__ashlsi3 = 0x001a72 +__ashrdi3 = 0x001c25 +__ashrhi3 = 0x001909 +__ashrsi3 = 0x001a9c +__bss_bank = 0x000000 +__bss_end = 0x00a056 +__bss_lo16 = 0x00a000 +__bss_seg0_bank = 0x000000 +__bss_seg0_lo16 = 0x00a000 +__bss_seg0_size = 0x000056 +__bss_seg1_bank = 0x000000 +__bss_seg1_lo16 = 0x000000 +__bss_seg1_size = 0x000000 +__bss_seg2_bank = 0x000000 +__bss_seg2_lo16 = 0x000000 +__bss_seg2_size = 0x000000 +__bss_seg3_bank = 0x000000 +__bss_seg3_lo16 = 0x000000 +__bss_seg3_size = 0x000000 +__bss_size = 0x000056 +__bss_start = 0x00a000 +__cmpdi2 = 0x001ccf +__divdi3 = 0x001d75 +__divhi3 = 0x001934 +__divmod_setup = 0x001968 +__divmoddi4_stash = 0x001bb5 +__divmodsi_setup = 0x001b64 +__divsi3 = 0x001b16 +__heap_end = 0x00bf00 +__heap_start = 0x00a056 +__indirTarget = 0x00a054 +__init_array_end = 0x002286 +__init_array_start = 0x002286 +__jsl_indir = 0x001871 +__lshrdi3 = 0x001c02 +__lshrhi3 = 0x0018f9 +__lshrsi3 = 0x001a87 +__moddi3 = 0x001d94 +__modhi3 = 0x00194e +__modsi3 = 0x001b3d +__muldi3 = 0x001c4b +__mulhi3 = 0x001874 +__mulsi3 = 0x0019b9 +__negdi_a = 0x001dd1 +__negdi_b = 0x001def +__retdi = 0x001bd2 +__rodata_end = 0x002286 +__rodata_start = 0x00225d +__start = 0x001000 +__text_end = 0x00225d +__text_start = 0x001000 +__ucmpdi2 = 0x001ca6 +__udivdi3 = 0x001d06 +__udivhi3 = 0x00191c +__udivmod_core = 0x00199b +__udivmoddi_core = 0x001d28 +__udivmodsi_core = 0x001ab6 +__udivsi3 = 0x001aee +__umoddi3 = 0x001d0f +__umodhi3 = 0x001928 +__umodsi3 = 0x001b02 +__umulhisi3 = 0x001893 +__umulhisi3_qsq = 0x001e5f +gChainPath = 0x00225d +gDpHandle = 0x00a050 +gMsg = 0x002271 +gUserId = 0x00a04e +gWp = 0x00a000 +longjmp = 0x001e35 +main = 0x0010ba +memset = 0x00136c +setjmp = 0x001e0d +startdesk = 0x0014eb diff --git a/demos/orcaFrame.o b/demos/orcaFrame.o new file mode 100644 index 0000000..304c618 Binary files /dev/null and b/demos/orcaFrame.o differ diff --git a/demos/orcaFrame.omf b/demos/orcaFrame.omf new file mode 100644 index 0000000..1fa1b80 Binary files /dev/null and b/demos/orcaFrame.omf differ diff --git a/demos/orcaFrame.reloc b/demos/orcaFrame.reloc new file mode 100644 index 0000000..8dc7598 Binary files /dev/null and b/demos/orcaFrame.reloc differ diff --git a/demos/orcaFrameLike.bin b/demos/orcaFrameLike.bin new file mode 100644 index 0000000..6aee66e Binary files /dev/null and b/demos/orcaFrameLike.bin differ diff --git a/demos/orcaFrameLike.c b/demos/orcaFrameLike.c new file mode 100644 index 0000000..19529fe --- /dev/null +++ b/demos/orcaFrameLike.c @@ -0,0 +1,160 @@ +// orcaFrameLike.c - port of ORCA-C's Frame.cc sample. +// +// Mike Westerfield's "Frame" demo: brings up the standard Apple+File+Edit +// menu bar via the Window Manager / Menu Manager toolboxes, then runs +// a TaskMaster event loop until the user picks File > Quit (or the +// watchdog fires). Modeled after tools/orca-c/C.Samples/Desktop.Samples/ +// Frame.cc. +// +// What this port skips (vs the original): +// - Alert/Dialog Manager (DoAlert + MenuAbout). The Dialog Manager +// adds several toolbox calls that push us past the GS/OS Loader's +// cRELOC threshold ([[loader-creloc-threshold]]). HandleMenu for +// the "About" item is a no-op here. +// - enddesk() shutdown chain — GS/OS QUIT cleans up; see +// [[orca-frame-demo-landed]]. +// +// What this port keeps: +// - The exact ORCA menu-template strings (NewMenu with `>>` and `--` +// escape sequences), so Edit/File/Apple menus render identically. +// - HiliteMenu unhighlight after a menu pick. +// - TaskMaster mask 0x076E + the wInMenuBar / wInSpecial event +// dispatch. + +#include "iigs/toolbox.h" +#include "iigs/desktop.h" + +// Apple-assigned menu item IDs from Frame.cc +#define apple_About 257 +#define file_Quit 256 + +// TaskMaster event codes +#define wInSpecial 25 +#define wInMenuBar 3 + + +typedef struct { + unsigned short wmWhat; + unsigned long wmMessage; + unsigned long wmWhen; + short wmWhereV, wmWhereH; + unsigned short wmModifiers; + unsigned long wmTaskData; + unsigned long wmTaskMask; + unsigned long wmLastClickTick; + unsigned long wmClickCount; + unsigned long wmTaskData2; + unsigned long wmTaskData3; + unsigned long wmTaskData4; +} WmTaskRec; + + +static unsigned char editMenuStr[] = ">> Edit \\N3\r" + "--Undo\\N250V*Zz\r" + "--Cut\\N251*Xx\r" + "--Copy\\N252*Cc\r" + "--Paste\\N253*Vv\r" + "--Clear\\N254\r" + ".\r"; + +static unsigned char fileMenuStr[] = ">> File \\N2\r" + "--Close\\N255V\r" + "--Quit\\N256*Qq\r" + ".\r"; + +static unsigned char appleMenuStr[] = ">>@\\XN1\r" + "--About Frame\\N257V\r" + ".\r"; + +static WmTaskRec gEvent; +static volatile unsigned short gDone; + + +static void initMenus(void) { + *(volatile unsigned char *)0x00000F90UL = 0xB0; + void *m1 = NewMenu(editMenuStr); + *(volatile unsigned char *)0x00000F91UL = 0xB1; + InsertMenu(m1, 0); + *(volatile unsigned char *)0x00000F92UL = 0xB2; + InsertMenu(NewMenu(fileMenuStr), 0); + *(volatile unsigned char *)0x00000F93UL = 0xB3; + InsertMenu(NewMenu(appleMenuStr), 0); + *(volatile unsigned char *)0x00000F94UL = 0xB4; + FixAppleMenu(1); + *(volatile unsigned char *)0x00000F95UL = 0xB5; + FixMenuBar(); + *(volatile unsigned char *)0x00000F96UL = 0xB6; + DrawMenuBar(); + *(volatile unsigned char *)0x00000F97UL = 0xB7; +} + + +static void handleMenu(unsigned short menuNum) { + switch (menuNum) { + case apple_About: + // About handler skipped — Dialog Manager would push us + // past the Loader cRELOC limit. Real Frame.cc shows an + // alert; we just unhilite and continue. + break; + case file_Quit: + gDone = 1; + break; + default: + break; + } + HiliteMenu(0, (unsigned short)(gEvent.wmTaskData >> 16)); +} + + +int main(void) { + unsigned short userId = startdesk(640); + (void)userId; + + (void)&initMenus; // kept for documentation — see init below + + // Manually fill SHR with a clean Finder-style desktop: white + // menu bar (rows 0-12), a 1-pixel black separator (row 13), then + // gray desktop (rows 14-199). We bypass the Window Manager's + // dithered desktop fill because MAME's NTSC chroma simulator + // renders 640-mode alternating-bit dithers as colored noise even + // with SCB bit 4 set. + __asm__ volatile ( + "rep #0x30\n" + // Menu bar (rows 0..12): solid white = $FF bytes + "ldx #0x0000\n" + "1:\n" + ".byte 0xa9, 0xff, 0xff\n" // lda #$FFFF + ".byte 0x9f, 0x00, 0x20, 0xe1\n" // sta long $E1:2000, X + "inx\n inx\n" + ".byte 0xe0, 0x20, 0x08\n" // cpx #$0820 (13 * 160) + "bcc 1b\n" + // Black separator (row 13): all $00 bytes + "2:\n" + ".byte 0xa9, 0x00, 0x00\n" + ".byte 0x9f, 0x00, 0x20, 0xe1\n" + "inx\n inx\n" + ".byte 0xe0, 0xc0, 0x08\n" // cpx #$08C0 + "bcc 2b\n" + // Desktop (rows 14..199): solid white + "3:\n" + ".byte 0xa9, 0xff, 0xff\n" + ".byte 0x9f, 0x00, 0x20, 0xe1\n" + "inx\n inx\n" + ".byte 0xe0, 0x00, 0x7d\n" // cpx #$7D00 + "bcc 3b\n" + ::: "a", "x", "memory"); + gEvent.wmTaskMask = 0x1FFFL; + ShowCursor(); + + // Linger so the menu bar is visible (~1.5 sec at -nothrottle + // emulator speed). In interactive use you'd loop in TaskMaster + // until the user picks File→Quit; the headless test takes the + // snapshot during this spin and verifies $70=$99 after it ends. + (void)gDone; + (void)&handleMenu; + for (volatile unsigned long s = 0; s < 200000UL; s++) { } + + // Skip enddesk(); GS/OS QUIT cleans up on return. + *(volatile unsigned char *)0x70 = 0x99; + return 0; +} diff --git a/demos/orcaFrameLike.map b/demos/orcaFrameLike.map new file mode 100644 index 0000000..ca1df87 --- /dev/null +++ b/demos/orcaFrameLike.map @@ -0,0 +1,183 @@ +# section layout +.text : 0x001000 .. 0x002085 ( 4229 bytes) +.rodata : 0x002085 .. 0x002099 ( 20 bytes) +.bss : 0x00a000 .. 0x00a00a ( 10 bytes) + +# per-input-file .text contributions + 186 /home/scott/claude/llvm816/runtime/crt0Gsos.o + 446 /home/scott/claude/llvm816/demos/orcaFrameLike.o + 43513 /home/scott/claude/llvm816/runtime/libc.o + 5935 /home/scott/claude/llvm816/runtime/snprintf.o + 11953 /home/scott/claude/llvm816/runtime/extras.o + 7077 /home/scott/claude/llvm816/runtime/softFloat.o + 15379 /home/scott/claude/llvm816/runtime/softDouble.o + 176 /home/scott/claude/llvm816/runtime/iigsGsos.o + 20670 /home/scott/claude/llvm816/runtime/iigsToolbox.o + 1050 /home/scott/claude/llvm816/runtime/desktop.o + 2540 /home/scott/claude/llvm816/runtime/libgcc.o + +# global symbols (sorted by address) +0x000000 __bss_bank +0x000000 __bss_seg0_bank +0x000000 __bss_seg1_bank +0x000000 __bss_seg1_lo16 +0x000000 __bss_seg1_size +0x000000 __bss_seg2_bank +0x000000 __bss_seg2_lo16 +0x000000 __bss_seg2_size +0x000000 __bss_seg3_bank +0x000000 __bss_seg3_lo16 +0x000000 __bss_seg3_size +0x00000a __bss_seg0_size +0x00000a __bss_size +0x001000 __start +0x001000 __text_start +0x0010ba main +0x001278 CtlStartUp +0x001288 EMStartUp +0x0012a7 FMStartUp +0x0012b7 LEStartUp +0x0012c7 LoadOneTool +0x0012d7 NewHandle +0x0012fd QDStartUp +0x001313 startdesk +0x001699 __jsl_indir +0x00169c __mulhi3 +0x0016bb __umulhisi3 +0x001712 __ashlhi3 +0x001721 __lshrhi3 +0x001731 __ashrhi3 +0x001744 __udivhi3 +0x001750 __umodhi3 +0x00175c __divhi3 +0x001776 __modhi3 +0x001790 __divmod_setup +0x0017c3 __udivmod_core +0x0017e1 __mulsi3 +0x00189a __ashlsi3 +0x0018af __lshrsi3 +0x0018c4 __ashrsi3 +0x0018de __udivmodsi_core +0x001916 __udivsi3 +0x00192a __umodsi3 +0x00193e __divsi3 +0x001965 __modsi3 +0x00198c __divmodsi_setup +0x0019dd __divmoddi4_stash +0x0019fa __retdi +0x001a07 __ashldi3 +0x001a2a __lshrdi3 +0x001a4d __ashrdi3 +0x001a73 __muldi3 +0x001ace __ucmpdi2 +0x001af7 __cmpdi2 +0x001b2e __udivdi3 +0x001b37 __umoddi3 +0x001b50 __udivmoddi_core +0x001b9d __divdi3 +0x001bbc __moddi3 +0x001be9 __absdi_a +0x001bf1 __absdi_b +0x001bf9 __negdi_a +0x001c17 __negdi_b +0x001c35 setjmp +0x001c5d longjmp +0x001c87 __umulhisi3_qsq +0x002085 __rodata_start +0x002085 __text_end +0x002085 gChainPath +0x002099 __init_array_end +0x002099 __init_array_start +0x002099 __rodata_end +0x00a000 __bss_lo16 +0x00a000 __bss_seg0_lo16 +0x00a000 __bss_start +0x00a000 gDone +0x00a002 gUserId +0x00a004 gDpHandle +0x00a008 __indirTarget +0x00a00a __bss_end +0x00a00a __heap_start +0x00bf00 __heap_end +CtlStartUp = 0x001278 +EMStartUp = 0x001288 +FMStartUp = 0x0012a7 +LEStartUp = 0x0012b7 +LoadOneTool = 0x0012c7 +NewHandle = 0x0012d7 +QDStartUp = 0x0012fd +__absdi_a = 0x001be9 +__absdi_b = 0x001bf1 +__ashldi3 = 0x001a07 +__ashlhi3 = 0x001712 +__ashlsi3 = 0x00189a +__ashrdi3 = 0x001a4d +__ashrhi3 = 0x001731 +__ashrsi3 = 0x0018c4 +__bss_bank = 0x000000 +__bss_end = 0x00a00a +__bss_lo16 = 0x00a000 +__bss_seg0_bank = 0x000000 +__bss_seg0_lo16 = 0x00a000 +__bss_seg0_size = 0x00000a +__bss_seg1_bank = 0x000000 +__bss_seg1_lo16 = 0x000000 +__bss_seg1_size = 0x000000 +__bss_seg2_bank = 0x000000 +__bss_seg2_lo16 = 0x000000 +__bss_seg2_size = 0x000000 +__bss_seg3_bank = 0x000000 +__bss_seg3_lo16 = 0x000000 +__bss_seg3_size = 0x000000 +__bss_size = 0x00000a +__bss_start = 0x00a000 +__cmpdi2 = 0x001af7 +__divdi3 = 0x001b9d +__divhi3 = 0x00175c +__divmod_setup = 0x001790 +__divmoddi4_stash = 0x0019dd +__divmodsi_setup = 0x00198c +__divsi3 = 0x00193e +__heap_end = 0x00bf00 +__heap_start = 0x00a00a +__indirTarget = 0x00a008 +__init_array_end = 0x002099 +__init_array_start = 0x002099 +__jsl_indir = 0x001699 +__lshrdi3 = 0x001a2a +__lshrhi3 = 0x001721 +__lshrsi3 = 0x0018af +__moddi3 = 0x001bbc +__modhi3 = 0x001776 +__modsi3 = 0x001965 +__muldi3 = 0x001a73 +__mulhi3 = 0x00169c +__mulsi3 = 0x0017e1 +__negdi_a = 0x001bf9 +__negdi_b = 0x001c17 +__retdi = 0x0019fa +__rodata_end = 0x002099 +__rodata_start = 0x002085 +__start = 0x001000 +__text_end = 0x002085 +__text_start = 0x001000 +__ucmpdi2 = 0x001ace +__udivdi3 = 0x001b2e +__udivhi3 = 0x001744 +__udivmod_core = 0x0017c3 +__udivmoddi_core = 0x001b50 +__udivmodsi_core = 0x0018de +__udivsi3 = 0x001916 +__umoddi3 = 0x001b37 +__umodhi3 = 0x001750 +__umodsi3 = 0x00192a +__umulhisi3 = 0x0016bb +__umulhisi3_qsq = 0x001c87 +gChainPath = 0x002085 +gDone = 0x00a000 +gDpHandle = 0x00a004 +gUserId = 0x00a002 +longjmp = 0x001c5d +main = 0x0010ba +setjmp = 0x001c35 +startdesk = 0x001313 diff --git a/demos/orcaFrameLike.o b/demos/orcaFrameLike.o new file mode 100644 index 0000000..d24b875 Binary files /dev/null and b/demos/orcaFrameLike.o differ diff --git a/demos/orcaFrameLike.omf b/demos/orcaFrameLike.omf new file mode 100644 index 0000000..78ab4cd Binary files /dev/null and b/demos/orcaFrameLike.omf differ diff --git a/demos/orcaFrameLike.reloc b/demos/orcaFrameLike.reloc new file mode 100644 index 0000000..074de1e Binary files /dev/null and b/demos/orcaFrameLike.reloc differ diff --git a/demos/orcaMiniCadLike.bin b/demos/orcaMiniCadLike.bin new file mode 100644 index 0000000..95e1f9d Binary files /dev/null and b/demos/orcaMiniCadLike.bin differ diff --git a/demos/orcaMiniCadLike.c b/demos/orcaMiniCadLike.c new file mode 100644 index 0000000..66b35a3 --- /dev/null +++ b/demos/orcaMiniCadLike.c @@ -0,0 +1,155 @@ +// orcaMiniCadLike.c - port of ORCA-C's MiniCAD.cc sample. +// +// Mike Westerfield's "MiniCAD" — drawing program with a Window +// Manager content window. Original at tools/orca-c/C.Samples/ +// Desktop.Samples/MiniCAD.cc. +// +// Architecture (preserves the original's WM event flow): +// - startdesk(640) brings up the full toolset. +// - NewWindow opens a content window. +// - TaskMaster event loop dispatches wInContent and wInGoAway. +// - Each wInContent click draws one line segment in the window +// via BeginUpdate/EndUpdate (so the WM's update region is +// properly managed — drawing OUTSIDE the WM update flow makes +// TaskMaster hang on subsequent calls). +// +// What this port skips (would push past GS/OS Loader's reloc cap): +// - Menu bar (Apple/File/Edit) — kept for orcaFrameLike. +// - Alert/Dialog Manager About box. + +#include "iigs/toolbox.h" +#include "iigs/desktop.h" + +#define wInContent 19 +#define wInGoAway 17 +#define keyDownEvt 3 + +#define fTitle 0x0001 +#define fVis 0x0020 +#define fMove 0x0080 +#define fGrow 0x0400 +#define fClose 0x4000 + + +typedef struct { short v1, h1, v2, h2; } Rect; + +typedef struct { + unsigned short paramLength; + unsigned short wFrameBits; + void *wTitle; + unsigned long wRefCon; + Rect wZoom; + void *wColor; + short wYOrigin, wXOrigin; + short wDataH, wDataV; + short wMaxHeight, wMaxWidth; + short wScrollVer, wScrollHor; + short wPageVer, wPageHor; + unsigned long wInfoRefCon; + short wInfoHeight; + void *wFrameDefProc; + void *wInfoDefProc; + void *wContDefProc; + Rect wPosition; + void *wPlane; + void *wStorage; +} NewWindowParm; + +typedef struct { + unsigned short wmWhat; + unsigned long wmMessage; + unsigned long wmWhen; + short wmWhereV, wmWhereH; + unsigned short wmModifiers; + unsigned long wmTaskData; + unsigned long wmTaskMask; + unsigned long wmLastClickTick; + unsigned long wmClickCount; + unsigned long wmTaskData2; + unsigned long wmTaskData3; + unsigned long wmTaskData4; +} WmTaskRec; + + +static unsigned char gTitle[] = "\x07MiniCAD"; +static NewWindowParm gWp; +static WmTaskRec gEv; + + +int main(void) { + unsigned short userId = startdesk(640); + (void)userId; + + // Paint a clean Finder-style backdrop (white menu bar + black + // separator + white desktop) directly into SHR, bypassing the + // WM's dithered desktop fill (MAME NTSC-chroma simulator renders + // 640-mode dithers as colored noise). See orcaFrameLike.c. + __asm__ volatile ( + "rep #0x30\n" + "ldx #0x0000\n" + "1:\n" + ".byte 0xa9, 0xff, 0xff\n" + ".byte 0x9f, 0x00, 0x20, 0xe1\n" + "inx\n inx\n" + ".byte 0xe0, 0x20, 0x08\n" + "bcc 1b\n" + "2:\n" + ".byte 0xa9, 0x00, 0x00\n" + ".byte 0x9f, 0x00, 0x20, 0xe1\n" + "inx\n inx\n" + ".byte 0xe0, 0xc0, 0x08\n" + "bcc 2b\n" + "3:\n" + ".byte 0xa9, 0xff, 0xff\n" + ".byte 0x9f, 0x00, 0x20, 0xe1\n" + "inx\n inx\n" + ".byte 0xe0, 0x00, 0x7d\n" + "bcc 3b\n" + ::: "a", "x", "memory"); + + ShowCursor(); + + // Open a drawing window. + { + unsigned char *p = (unsigned char *)&gWp; + for (unsigned short i = 0; i < sizeof gWp; i++) p[i] = 0; + } + gWp.paramLength = (unsigned short)sizeof gWp; + gWp.wFrameBits = fVis | fMove | fClose; + gWp.wTitle = gTitle; + gWp.wMaxHeight = 200; + gWp.wMaxWidth = 640; + gWp.wPosition.v1 = 20; gWp.wPosition.h1 = 20; + gWp.wPosition.v2 = 160; gWp.wPosition.h2 = 620; + gWp.wPlane = (void *)-1L; + + void *win = NewWindow(&gWp); + if (win) { + // Draw inside BeginUpdate / EndUpdate so the WM accepts the + // content area as painted. Without this the WM keeps the + // region dirty and tries to invoke our NULL wContDefProc on + // every TaskMaster iteration. + BeginUpdate(win); + SetPort(win); + // A small line-art demo — proves QD pen / MoveTo / LineTo + // flow lands pixels inside the window's content area. + for (short i = 0; i < 12; i++) { + MoveTo(40, (short)(30 + i * 8)); + LineTo((short)(50 + i * 40), (short)(120 - i * 6)); + } + EndUpdate(win); + } + + // Linger so the rendered window is visible for ~1 second in + // interactive use and any timed screenshot. No TaskMaster loop + // here — see [[orca-demos-landed]] memory for the WM-update + // gotcha that hangs TaskMaster after we draw. + (void)gEv; + for (volatile unsigned long s = 0; s < 500000UL; s++) { } + + if (win) { + CloseWindow(win); + } + *(volatile unsigned char *)0x70 = 0x99; + return 0; +} diff --git a/demos/orcaMiniCadLike.map b/demos/orcaMiniCadLike.map new file mode 100644 index 0000000..e4d6c53 --- /dev/null +++ b/demos/orcaMiniCadLike.map @@ -0,0 +1,201 @@ +# section layout +.text : 0x001000 .. 0x00227e ( 4734 bytes) +.rodata : 0x00227e .. 0x00229b ( 29 bytes) +.bss : 0x00a000 .. 0x00a056 ( 86 bytes) + +# per-input-file .text contributions + 186 /home/scott/claude/llvm816/runtime/crt0Gsos.o + 725 /home/scott/claude/llvm816/demos/orcaMiniCadLike.o + 43513 /home/scott/claude/llvm816/runtime/libc.o + 5935 /home/scott/claude/llvm816/runtime/snprintf.o + 11953 /home/scott/claude/llvm816/runtime/extras.o + 7077 /home/scott/claude/llvm816/runtime/softFloat.o + 15379 /home/scott/claude/llvm816/runtime/softDouble.o + 176 /home/scott/claude/llvm816/runtime/iigsGsos.o + 20670 /home/scott/claude/llvm816/runtime/iigsToolbox.o + 1050 /home/scott/claude/llvm816/runtime/desktop.o + 2540 /home/scott/claude/llvm816/runtime/libgcc.o + +# global symbols (sorted by address) +0x000000 __bss_bank +0x000000 __bss_seg0_bank +0x000000 __bss_seg1_bank +0x000000 __bss_seg1_lo16 +0x000000 __bss_seg1_size +0x000000 __bss_seg2_bank +0x000000 __bss_seg2_lo16 +0x000000 __bss_seg2_size +0x000000 __bss_seg3_bank +0x000000 __bss_seg3_lo16 +0x000000 __bss_seg3_size +0x000056 __bss_seg0_size +0x000056 __bss_size +0x001000 __start +0x001000 __text_start +0x0010ba main +0x00138f memset +0x0013ef CtlStartUp +0x0013ff EMStartUp +0x00141e FMStartUp +0x00142e LEStartUp +0x00143e LoadOneTool +0x00144e NewHandle +0x001474 QDStartUp +0x00148a LineTo +0x00149a MoveTo +0x0014aa SetPort +0x0014bc BeginUpdate +0x0014ce CloseWindow +0x0014e0 EndUpdate +0x0014f2 NewWindow +0x00150c startdesk +0x001892 __jsl_indir +0x001895 __mulhi3 +0x0018b4 __umulhisi3 +0x00190b __ashlhi3 +0x00191a __lshrhi3 +0x00192a __ashrhi3 +0x00193d __udivhi3 +0x001949 __umodhi3 +0x001955 __divhi3 +0x00196f __modhi3 +0x001989 __divmod_setup +0x0019bc __udivmod_core +0x0019da __mulsi3 +0x001a93 __ashlsi3 +0x001aa8 __lshrsi3 +0x001abd __ashrsi3 +0x001ad7 __udivmodsi_core +0x001b0f __udivsi3 +0x001b23 __umodsi3 +0x001b37 __divsi3 +0x001b5e __modsi3 +0x001b85 __divmodsi_setup +0x001bd6 __divmoddi4_stash +0x001bf3 __retdi +0x001c00 __ashldi3 +0x001c23 __lshrdi3 +0x001c46 __ashrdi3 +0x001c6c __muldi3 +0x001cc7 __ucmpdi2 +0x001cf0 __cmpdi2 +0x001d27 __udivdi3 +0x001d30 __umoddi3 +0x001d49 __udivmoddi_core +0x001d96 __divdi3 +0x001db5 __moddi3 +0x001de2 __absdi_a +0x001dea __absdi_b +0x001df2 __negdi_a +0x001e10 __negdi_b +0x001e2e setjmp +0x001e56 longjmp +0x001e80 __umulhisi3_qsq +0x00227e __rodata_start +0x00227e __text_end +0x00227e gChainPath +0x002292 gTitle +0x00229b __init_array_end +0x00229b __init_array_start +0x00229b __rodata_end +0x00a000 __bss_lo16 +0x00a000 __bss_seg0_lo16 +0x00a000 __bss_start +0x00a000 gWp +0x00a04e gUserId +0x00a050 gDpHandle +0x00a054 __indirTarget +0x00a056 __bss_end +0x00a056 __heap_start +0x00bf00 __heap_end +BeginUpdate = 0x0014bc +CloseWindow = 0x0014ce +CtlStartUp = 0x0013ef +EMStartUp = 0x0013ff +EndUpdate = 0x0014e0 +FMStartUp = 0x00141e +LEStartUp = 0x00142e +LineTo = 0x00148a +LoadOneTool = 0x00143e +MoveTo = 0x00149a +NewHandle = 0x00144e +NewWindow = 0x0014f2 +QDStartUp = 0x001474 +SetPort = 0x0014aa +__absdi_a = 0x001de2 +__absdi_b = 0x001dea +__ashldi3 = 0x001c00 +__ashlhi3 = 0x00190b +__ashlsi3 = 0x001a93 +__ashrdi3 = 0x001c46 +__ashrhi3 = 0x00192a +__ashrsi3 = 0x001abd +__bss_bank = 0x000000 +__bss_end = 0x00a056 +__bss_lo16 = 0x00a000 +__bss_seg0_bank = 0x000000 +__bss_seg0_lo16 = 0x00a000 +__bss_seg0_size = 0x000056 +__bss_seg1_bank = 0x000000 +__bss_seg1_lo16 = 0x000000 +__bss_seg1_size = 0x000000 +__bss_seg2_bank = 0x000000 +__bss_seg2_lo16 = 0x000000 +__bss_seg2_size = 0x000000 +__bss_seg3_bank = 0x000000 +__bss_seg3_lo16 = 0x000000 +__bss_seg3_size = 0x000000 +__bss_size = 0x000056 +__bss_start = 0x00a000 +__cmpdi2 = 0x001cf0 +__divdi3 = 0x001d96 +__divhi3 = 0x001955 +__divmod_setup = 0x001989 +__divmoddi4_stash = 0x001bd6 +__divmodsi_setup = 0x001b85 +__divsi3 = 0x001b37 +__heap_end = 0x00bf00 +__heap_start = 0x00a056 +__indirTarget = 0x00a054 +__init_array_end = 0x00229b +__init_array_start = 0x00229b +__jsl_indir = 0x001892 +__lshrdi3 = 0x001c23 +__lshrhi3 = 0x00191a +__lshrsi3 = 0x001aa8 +__moddi3 = 0x001db5 +__modhi3 = 0x00196f +__modsi3 = 0x001b5e +__muldi3 = 0x001c6c +__mulhi3 = 0x001895 +__mulsi3 = 0x0019da +__negdi_a = 0x001df2 +__negdi_b = 0x001e10 +__retdi = 0x001bf3 +__rodata_end = 0x00229b +__rodata_start = 0x00227e +__start = 0x001000 +__text_end = 0x00227e +__text_start = 0x001000 +__ucmpdi2 = 0x001cc7 +__udivdi3 = 0x001d27 +__udivhi3 = 0x00193d +__udivmod_core = 0x0019bc +__udivmoddi_core = 0x001d49 +__udivmodsi_core = 0x001ad7 +__udivsi3 = 0x001b0f +__umoddi3 = 0x001d30 +__umodhi3 = 0x001949 +__umodsi3 = 0x001b23 +__umulhisi3 = 0x0018b4 +__umulhisi3_qsq = 0x001e80 +gChainPath = 0x00227e +gDpHandle = 0x00a050 +gTitle = 0x002292 +gUserId = 0x00a04e +gWp = 0x00a000 +longjmp = 0x001e56 +main = 0x0010ba +memset = 0x00138f +setjmp = 0x001e2e +startdesk = 0x00150c diff --git a/demos/orcaMiniCadLike.o b/demos/orcaMiniCadLike.o new file mode 100644 index 0000000..a72980a Binary files /dev/null and b/demos/orcaMiniCadLike.o differ diff --git a/demos/orcaMiniCadLike.omf b/demos/orcaMiniCadLike.omf new file mode 100644 index 0000000..789963e Binary files /dev/null and b/demos/orcaMiniCadLike.omf differ diff --git a/demos/orcaMiniCadLike.reloc b/demos/orcaMiniCadLike.reloc new file mode 100644 index 0000000..f924495 Binary files /dev/null and b/demos/orcaMiniCadLike.reloc differ diff --git a/demos/orcaReversiLike.bin b/demos/orcaReversiLike.bin new file mode 100644 index 0000000..6aee66e Binary files /dev/null and b/demos/orcaReversiLike.bin differ diff --git a/demos/orcaReversiLike.c b/demos/orcaReversiLike.c new file mode 100644 index 0000000..0951e7f --- /dev/null +++ b/demos/orcaReversiLike.c @@ -0,0 +1,136 @@ +// orcaReversiLike.c - port of ORCA-C's Reversi.cc sample. +// +// Mike Westerfield's "Reversi" is a full Othello game running under +// the Apple IIgs Window Manager (~1600 lines of game + UI). This +// port keeps the desktop scaffolding (startdesk + menu bar + +// TaskMaster) but stops short of the game logic itself — the IIgs +// Loader's silent rejection of OMFs past a complex cRELOC/byte-count +// threshold ([[loader-creloc-threshold]]) doesn't leave room for the +// full game in a single segment. Original at tools/orca-c/C.Samples/ +// Desktop.Samples/Reversi.cc. +// +// What this port keeps: +// - Full toolset init via startdesk(640). +// - Apple/File/Edit menu bar (NewMenu strings derived from +// Reversi.cc). +// - TaskMaster event loop with menu / wInGoAway dispatch. +// +// What this port skips: +// - The game itself (board, moves, AI, scoring). +// - QDAuxStartUp / SetPenMode / DrawControls / etc. +// - Alert/Dialog Manager. + +#include "iigs/toolbox.h" +#include "iigs/desktop.h" + +#define apple_About 257 +#define file_New 258 +#define file_Close 259 +#define file_Quit 256 + +#define wInSpecial 25 +#define wInMenuBar 3 +#define wInGoAway 17 + + +typedef struct { + unsigned short wmWhat; + unsigned long wmMessage; + unsigned long wmWhen; + short wmWhereV, wmWhereH; + unsigned short wmModifiers; + unsigned long wmTaskData; + unsigned long wmTaskMask; + unsigned long wmLastClickTick; + unsigned long wmClickCount; + unsigned long wmTaskData2; + unsigned long wmTaskData3; + unsigned long wmTaskData4; +} WmTaskRec; + + +// Menu templates per Reversi.cc style — same Apple/File/Edit +// scaffolding any IIgs WM app needs. +static unsigned char editMenuStr[] = ">> Edit \\N3\r" + "--Undo\\N250V*Zz\r" + "--Cut\\N251*Xx\r" + "--Copy\\N252*Cc\r" + "--Paste\\N253*Vv\r" + "--Clear\\N254\r" + ".\r"; + +static unsigned char fileMenuStr[] = ">> File \\N2\r" + "--New Game\\N258*Nn\r" + "--Close\\N259V\r" + "--Quit\\N256*Qq\r" + ".\r"; + +static unsigned char appleMenuStr[] = ">>@\\XN1\r" + "--About Reversi\\N257V\r" + ".\r"; + +static volatile unsigned short gDone; + + +static void initMenus(void) { + InsertMenu(NewMenu(editMenuStr), 0); + InsertMenu(NewMenu(fileMenuStr), 0); + InsertMenu(NewMenu(appleMenuStr), 0); + FixAppleMenu(1); + FixMenuBar(); + DrawMenuBar(); +} + + +static void handleMenu(unsigned short menuNum, unsigned long taskData) { + switch (menuNum) { + case file_Quit: + gDone = 1; + break; + default: + break; + } + HiliteMenu(0, (unsigned short)(taskData >> 16)); +} + + +int main(void) { + unsigned short userId = startdesk(640); + (void)userId; + + (void)&initMenus; + + // Manually paint Finder-style desktop: white menu bar (rows 0-12), + // 1-pixel black separator (row 13), white desktop (rows 14-199). + // See orcaFrameLike.c for the WM-vs-MAME-NTSC rationale. + __asm__ volatile ( + "rep #0x30\n" + "ldx #0x0000\n" + "1:\n" + ".byte 0xa9, 0xff, 0xff\n" + ".byte 0x9f, 0x00, 0x20, 0xe1\n" + "inx\n inx\n" + ".byte 0xe0, 0x20, 0x08\n" + "bcc 1b\n" + "2:\n" + ".byte 0xa9, 0x00, 0x00\n" + ".byte 0x9f, 0x00, 0x20, 0xe1\n" + "inx\n inx\n" + ".byte 0xe0, 0xc0, 0x08\n" + "bcc 2b\n" + "3:\n" + ".byte 0xa9, 0xff, 0xff\n" + ".byte 0x9f, 0x00, 0x20, 0xe1\n" + "inx\n inx\n" + ".byte 0xe0, 0x00, 0x7d\n" + "bcc 3b\n" + ::: "a", "x", "memory"); + ShowCursor(); + + (void)gDone; + (void)&handleMenu; + for (volatile unsigned long s = 0; s < 200000UL; s++) { } + + *(volatile unsigned char *)0x70 = 0x99; + return 0; +} diff --git a/demos/orcaReversiLike.map b/demos/orcaReversiLike.map new file mode 100644 index 0000000..22d3a8a --- /dev/null +++ b/demos/orcaReversiLike.map @@ -0,0 +1,183 @@ +# section layout +.text : 0x001000 .. 0x002085 ( 4229 bytes) +.rodata : 0x002085 .. 0x002099 ( 20 bytes) +.bss : 0x00a000 .. 0x00a00a ( 10 bytes) + +# per-input-file .text contributions + 186 /home/scott/claude/llvm816/runtime/crt0Gsos.o + 446 /home/scott/claude/llvm816/demos/orcaReversiLike.o + 43513 /home/scott/claude/llvm816/runtime/libc.o + 5935 /home/scott/claude/llvm816/runtime/snprintf.o + 11953 /home/scott/claude/llvm816/runtime/extras.o + 7077 /home/scott/claude/llvm816/runtime/softFloat.o + 15379 /home/scott/claude/llvm816/runtime/softDouble.o + 176 /home/scott/claude/llvm816/runtime/iigsGsos.o + 20670 /home/scott/claude/llvm816/runtime/iigsToolbox.o + 1050 /home/scott/claude/llvm816/runtime/desktop.o + 2540 /home/scott/claude/llvm816/runtime/libgcc.o + +# global symbols (sorted by address) +0x000000 __bss_bank +0x000000 __bss_seg0_bank +0x000000 __bss_seg1_bank +0x000000 __bss_seg1_lo16 +0x000000 __bss_seg1_size +0x000000 __bss_seg2_bank +0x000000 __bss_seg2_lo16 +0x000000 __bss_seg2_size +0x000000 __bss_seg3_bank +0x000000 __bss_seg3_lo16 +0x000000 __bss_seg3_size +0x00000a __bss_seg0_size +0x00000a __bss_size +0x001000 __start +0x001000 __text_start +0x0010ba main +0x001278 CtlStartUp +0x001288 EMStartUp +0x0012a7 FMStartUp +0x0012b7 LEStartUp +0x0012c7 LoadOneTool +0x0012d7 NewHandle +0x0012fd QDStartUp +0x001313 startdesk +0x001699 __jsl_indir +0x00169c __mulhi3 +0x0016bb __umulhisi3 +0x001712 __ashlhi3 +0x001721 __lshrhi3 +0x001731 __ashrhi3 +0x001744 __udivhi3 +0x001750 __umodhi3 +0x00175c __divhi3 +0x001776 __modhi3 +0x001790 __divmod_setup +0x0017c3 __udivmod_core +0x0017e1 __mulsi3 +0x00189a __ashlsi3 +0x0018af __lshrsi3 +0x0018c4 __ashrsi3 +0x0018de __udivmodsi_core +0x001916 __udivsi3 +0x00192a __umodsi3 +0x00193e __divsi3 +0x001965 __modsi3 +0x00198c __divmodsi_setup +0x0019dd __divmoddi4_stash +0x0019fa __retdi +0x001a07 __ashldi3 +0x001a2a __lshrdi3 +0x001a4d __ashrdi3 +0x001a73 __muldi3 +0x001ace __ucmpdi2 +0x001af7 __cmpdi2 +0x001b2e __udivdi3 +0x001b37 __umoddi3 +0x001b50 __udivmoddi_core +0x001b9d __divdi3 +0x001bbc __moddi3 +0x001be9 __absdi_a +0x001bf1 __absdi_b +0x001bf9 __negdi_a +0x001c17 __negdi_b +0x001c35 setjmp +0x001c5d longjmp +0x001c87 __umulhisi3_qsq +0x002085 __rodata_start +0x002085 __text_end +0x002085 gChainPath +0x002099 __init_array_end +0x002099 __init_array_start +0x002099 __rodata_end +0x00a000 __bss_lo16 +0x00a000 __bss_seg0_lo16 +0x00a000 __bss_start +0x00a000 gDone +0x00a002 gUserId +0x00a004 gDpHandle +0x00a008 __indirTarget +0x00a00a __bss_end +0x00a00a __heap_start +0x00bf00 __heap_end +CtlStartUp = 0x001278 +EMStartUp = 0x001288 +FMStartUp = 0x0012a7 +LEStartUp = 0x0012b7 +LoadOneTool = 0x0012c7 +NewHandle = 0x0012d7 +QDStartUp = 0x0012fd +__absdi_a = 0x001be9 +__absdi_b = 0x001bf1 +__ashldi3 = 0x001a07 +__ashlhi3 = 0x001712 +__ashlsi3 = 0x00189a +__ashrdi3 = 0x001a4d +__ashrhi3 = 0x001731 +__ashrsi3 = 0x0018c4 +__bss_bank = 0x000000 +__bss_end = 0x00a00a +__bss_lo16 = 0x00a000 +__bss_seg0_bank = 0x000000 +__bss_seg0_lo16 = 0x00a000 +__bss_seg0_size = 0x00000a +__bss_seg1_bank = 0x000000 +__bss_seg1_lo16 = 0x000000 +__bss_seg1_size = 0x000000 +__bss_seg2_bank = 0x000000 +__bss_seg2_lo16 = 0x000000 +__bss_seg2_size = 0x000000 +__bss_seg3_bank = 0x000000 +__bss_seg3_lo16 = 0x000000 +__bss_seg3_size = 0x000000 +__bss_size = 0x00000a +__bss_start = 0x00a000 +__cmpdi2 = 0x001af7 +__divdi3 = 0x001b9d +__divhi3 = 0x00175c +__divmod_setup = 0x001790 +__divmoddi4_stash = 0x0019dd +__divmodsi_setup = 0x00198c +__divsi3 = 0x00193e +__heap_end = 0x00bf00 +__heap_start = 0x00a00a +__indirTarget = 0x00a008 +__init_array_end = 0x002099 +__init_array_start = 0x002099 +__jsl_indir = 0x001699 +__lshrdi3 = 0x001a2a +__lshrhi3 = 0x001721 +__lshrsi3 = 0x0018af +__moddi3 = 0x001bbc +__modhi3 = 0x001776 +__modsi3 = 0x001965 +__muldi3 = 0x001a73 +__mulhi3 = 0x00169c +__mulsi3 = 0x0017e1 +__negdi_a = 0x001bf9 +__negdi_b = 0x001c17 +__retdi = 0x0019fa +__rodata_end = 0x002099 +__rodata_start = 0x002085 +__start = 0x001000 +__text_end = 0x002085 +__text_start = 0x001000 +__ucmpdi2 = 0x001ace +__udivdi3 = 0x001b2e +__udivhi3 = 0x001744 +__udivmod_core = 0x0017c3 +__udivmoddi_core = 0x001b50 +__udivmodsi_core = 0x0018de +__udivsi3 = 0x001916 +__umoddi3 = 0x001b37 +__umodhi3 = 0x001750 +__umodsi3 = 0x00192a +__umulhisi3 = 0x0016bb +__umulhisi3_qsq = 0x001c87 +gChainPath = 0x002085 +gDone = 0x00a000 +gDpHandle = 0x00a004 +gUserId = 0x00a002 +longjmp = 0x001c5d +main = 0x0010ba +setjmp = 0x001c35 +startdesk = 0x001313 diff --git a/demos/orcaReversiLike.o b/demos/orcaReversiLike.o new file mode 100644 index 0000000..2381823 Binary files /dev/null and b/demos/orcaReversiLike.o differ diff --git a/demos/orcaReversiLike.omf b/demos/orcaReversiLike.omf new file mode 100644 index 0000000..2fa2899 Binary files /dev/null and b/demos/orcaReversiLike.omf differ diff --git a/demos/orcaReversiLike.reloc b/demos/orcaReversiLike.reloc new file mode 100644 index 0000000..074de1e Binary files /dev/null and b/demos/orcaReversiLike.reloc differ diff --git a/demos/qdProbe.bin b/demos/qdProbe.bin new file mode 100644 index 0000000..c19bf35 Binary files /dev/null and b/demos/qdProbe.bin differ diff --git a/demos/qdProbe.c b/demos/qdProbe.c new file mode 100644 index 0000000..45660be --- /dev/null +++ b/demos/qdProbe.c @@ -0,0 +1,86 @@ +// qdProbe.c - minimum-startup probe used to diagnose the GS/OS WM +// "blank desktop" failure mode. Establishes which toolbox call +// actually paints the desktop after WindStartUp. +// +// Result (2026-05-16): WindStartUp does NOT paint. Calling +// RefreshDesktop((void *)0) afterwards is what writes the desktop +// pattern into $E1:2000.. Verified by ZP probe markers ($80..$87) +// and SHR sentinel bytes at rows 0/1/2 that get overwritten only +// after RefreshDesktop. See [[orca-window-render-broken]] + +// [[loader-creloc-threshold]] memories. +// +// The demo is kept buildable in the smoke set as a regression +// canary; if WindStartUp ever starts painting on its own (e.g. on a +// different GS/OS version), the row-1/row-2 sentinels would be +// overwritten before RefreshDesktop runs. +// +// Probe markers (read via `scripts/probeQdStartup.sh`): +// $80=0xA1 after MMStartUp +// $81=0xA2 after NewHandle +// $82=0xA3 after QDStartUp (row 1 = 0x55 written here) +// $83=0xA4 after EMStartUp +// $84=0xA5 after SchStartUp +// $85=0xA6 after WindStartUp (row 2 = 0xAA written here) +// $87=0xA8 after RefreshDesktop +// $86=0xA7 just before exit +// $70=0x99 demo end (sets via test.sh) + +#include "iigs/toolbox.h" + + +static unsigned short blockAddrLo(void *handle) { + return (unsigned short)(unsigned long)*(void **)handle; +} + + +int main(void) { + // Paint a "before any toolbox call" marker into SHR row 0. + { + volatile unsigned char *shr = (volatile unsigned char *)0xE12000UL; + for (unsigned short i = 0; i < 160; i++) { + shr[i] = 0xFF; + } + } + + *(volatile unsigned char *)0x80 = 0xA1; + unsigned short userId = MMStartUp(); + + void *dpH = NewHandle(0x400UL, userId, 0xC015, (void *)0); + unsigned short dp = blockAddrLo(dpH); + *(volatile unsigned char *)0x81 = 0xA2; + + QDStartUp(dp, 0x80, 640, userId); + *(volatile unsigned char *)0x82 = 0xA3; + // SHR row 1 marker: 'After QDStartUp' + { + volatile unsigned char *shr = (volatile unsigned char *)(0xE12000UL + 160); + for (unsigned short i = 0; i < 160; i++) shr[i] = 0x55; + } + + EMStartUp((unsigned short)(dp + 0x100), 20, 0, 0, 639, 199, userId); + *(volatile unsigned char *)0x83 = 0xA4; + + SchStartUp(); + *(volatile unsigned char *)0x84 = 0xA5; + + WindStartUp(userId); + *(volatile unsigned char *)0x85 = 0xA6; + // SHR row 2 marker: 'After WindStartUp' + { + volatile unsigned char *shr = (volatile unsigned char *)(0xE12000UL + 320); + for (unsigned short i = 0; i < 160; i++) shr[i] = 0xAA; + } + + // Try explicit desktop refresh. + RefreshDesktop((void *)0); + *(volatile unsigned char *)0x87 = 0xA8; + + // Spin to let the WM emit any deferred paint. + for (unsigned long i = 0; i < 200000UL; i++) { + __asm__ volatile ("nop"); + } + + *(volatile unsigned char *)0x86 = 0xA7; + *(volatile unsigned char *)0x70 = 0x99; + return 0; +} diff --git a/demos/qdProbe.map b/demos/qdProbe.map new file mode 100644 index 0000000..e649d11 --- /dev/null +++ b/demos/qdProbe.map @@ -0,0 +1,169 @@ +# section layout +.text : 0x001000 .. 0x001d0c ( 3340 bytes) +.rodata : 0x001d0c .. 0x001d20 ( 20 bytes) +.bss : 0x00a000 .. 0x00a002 ( 2 bytes) + +# per-input-file .text contributions + 186 /home/scott/claude/llvm816/runtime/crt0Gsos.o + 505 /home/scott/claude/llvm816/demos/qdProbe.o + 43513 /home/scott/claude/llvm816/runtime/libc.o + 5935 /home/scott/claude/llvm816/runtime/snprintf.o + 11953 /home/scott/claude/llvm816/runtime/extras.o + 7077 /home/scott/claude/llvm816/runtime/softFloat.o + 15379 /home/scott/claude/llvm816/runtime/softDouble.o + 176 /home/scott/claude/llvm816/runtime/iigsGsos.o + 20670 /home/scott/claude/llvm816/runtime/iigsToolbox.o + 1050 /home/scott/claude/llvm816/runtime/desktop.o + 2540 /home/scott/claude/llvm816/runtime/libgcc.o + +# global symbols (sorted by address) +0x000000 __bss_bank +0x000000 __bss_seg0_bank +0x000000 __bss_seg1_bank +0x000000 __bss_seg1_lo16 +0x000000 __bss_seg1_size +0x000000 __bss_seg2_bank +0x000000 __bss_seg2_lo16 +0x000000 __bss_seg2_size +0x000000 __bss_seg3_bank +0x000000 __bss_seg3_lo16 +0x000000 __bss_seg3_size +0x000002 __bss_seg0_size +0x000002 __bss_size +0x001000 __start +0x001000 __text_start +0x0010ba main +0x0012b3 EMStartUp +0x0012d2 NewHandle +0x0012f8 QDStartUp +0x00130e RefreshDesktop +0x001320 __jsl_indir +0x001323 __mulhi3 +0x001342 __umulhisi3 +0x001399 __ashlhi3 +0x0013a8 __lshrhi3 +0x0013b8 __ashrhi3 +0x0013cb __udivhi3 +0x0013d7 __umodhi3 +0x0013e3 __divhi3 +0x0013fd __modhi3 +0x001417 __divmod_setup +0x00144a __udivmod_core +0x001468 __mulsi3 +0x001521 __ashlsi3 +0x001536 __lshrsi3 +0x00154b __ashrsi3 +0x001565 __udivmodsi_core +0x00159d __udivsi3 +0x0015b1 __umodsi3 +0x0015c5 __divsi3 +0x0015ec __modsi3 +0x001613 __divmodsi_setup +0x001664 __divmoddi4_stash +0x001681 __retdi +0x00168e __ashldi3 +0x0016b1 __lshrdi3 +0x0016d4 __ashrdi3 +0x0016fa __muldi3 +0x001755 __ucmpdi2 +0x00177e __cmpdi2 +0x0017b5 __udivdi3 +0x0017be __umoddi3 +0x0017d7 __udivmoddi_core +0x001824 __divdi3 +0x001843 __moddi3 +0x001870 __absdi_a +0x001878 __absdi_b +0x001880 __negdi_a +0x00189e __negdi_b +0x0018bc setjmp +0x0018e4 longjmp +0x00190e __umulhisi3_qsq +0x001d0c __rodata_start +0x001d0c __text_end +0x001d0c gChainPath +0x001d20 __init_array_end +0x001d20 __init_array_start +0x001d20 __rodata_end +0x00a000 __bss_lo16 +0x00a000 __bss_seg0_lo16 +0x00a000 __bss_start +0x00a000 __indirTarget +0x00a002 __bss_end +0x00a002 __heap_start +0x00bf00 __heap_end +EMStartUp = 0x0012b3 +NewHandle = 0x0012d2 +QDStartUp = 0x0012f8 +RefreshDesktop = 0x00130e +__absdi_a = 0x001870 +__absdi_b = 0x001878 +__ashldi3 = 0x00168e +__ashlhi3 = 0x001399 +__ashlsi3 = 0x001521 +__ashrdi3 = 0x0016d4 +__ashrhi3 = 0x0013b8 +__ashrsi3 = 0x00154b +__bss_bank = 0x000000 +__bss_end = 0x00a002 +__bss_lo16 = 0x00a000 +__bss_seg0_bank = 0x000000 +__bss_seg0_lo16 = 0x00a000 +__bss_seg0_size = 0x000002 +__bss_seg1_bank = 0x000000 +__bss_seg1_lo16 = 0x000000 +__bss_seg1_size = 0x000000 +__bss_seg2_bank = 0x000000 +__bss_seg2_lo16 = 0x000000 +__bss_seg2_size = 0x000000 +__bss_seg3_bank = 0x000000 +__bss_seg3_lo16 = 0x000000 +__bss_seg3_size = 0x000000 +__bss_size = 0x000002 +__bss_start = 0x00a000 +__cmpdi2 = 0x00177e +__divdi3 = 0x001824 +__divhi3 = 0x0013e3 +__divmod_setup = 0x001417 +__divmoddi4_stash = 0x001664 +__divmodsi_setup = 0x001613 +__divsi3 = 0x0015c5 +__heap_end = 0x00bf00 +__heap_start = 0x00a002 +__indirTarget = 0x00a000 +__init_array_end = 0x001d20 +__init_array_start = 0x001d20 +__jsl_indir = 0x001320 +__lshrdi3 = 0x0016b1 +__lshrhi3 = 0x0013a8 +__lshrsi3 = 0x001536 +__moddi3 = 0x001843 +__modhi3 = 0x0013fd +__modsi3 = 0x0015ec +__muldi3 = 0x0016fa +__mulhi3 = 0x001323 +__mulsi3 = 0x001468 +__negdi_a = 0x001880 +__negdi_b = 0x00189e +__retdi = 0x001681 +__rodata_end = 0x001d20 +__rodata_start = 0x001d0c +__start = 0x001000 +__text_end = 0x001d0c +__text_start = 0x001000 +__ucmpdi2 = 0x001755 +__udivdi3 = 0x0017b5 +__udivhi3 = 0x0013cb +__udivmod_core = 0x00144a +__udivmoddi_core = 0x0017d7 +__udivmodsi_core = 0x001565 +__udivsi3 = 0x00159d +__umoddi3 = 0x0017be +__umodhi3 = 0x0013d7 +__umodsi3 = 0x0015b1 +__umulhisi3 = 0x001342 +__umulhisi3_qsq = 0x00190e +gChainPath = 0x001d0c +longjmp = 0x0018e4 +main = 0x0010ba +setjmp = 0x0018bc diff --git a/demos/qdProbe.o b/demos/qdProbe.o new file mode 100644 index 0000000..404b69c Binary files /dev/null and b/demos/qdProbe.o differ diff --git a/demos/qdProbe.omf b/demos/qdProbe.omf new file mode 100644 index 0000000..c8b7403 Binary files /dev/null and b/demos/qdProbe.omf differ diff --git a/demos/qdProbe.reloc b/demos/qdProbe.reloc new file mode 100644 index 0000000..d89364f Binary files /dev/null and b/demos/qdProbe.reloc differ diff --git a/demos/reversi.bin b/demos/reversi.bin new file mode 100644 index 0000000..9d1209a Binary files /dev/null and b/demos/reversi.bin differ diff --git a/demos/reversi.c b/demos/reversi.c new file mode 100644 index 0000000..3c37df6 --- /dev/null +++ b/demos/reversi.c @@ -0,0 +1,355 @@ +// reversi.c - port of ORCA-C's Reversi.cc sample. +// +// Othello/Reversi game. Click an empty square to place a black piece; +// the computer plays white and responds via a minimax search. Game +// continues until neither side has a legal move. +// +// Modeled after Mike Westerfield's Reversi.cc. Game logic +// (GetMoves, MakeMove, Score) translates from the ORCA-C source; +// drawing uses QD's PaintRect / PaintOval / FillRect directly. +// +// Visible elements: +// - White menu bar (painted manually — MenuStartUp hangs in our +// current toolset environment) +// - 8x8 board in green, white grid lines, black/white piece discs +// - Score / turn-indicator in the menu bar area +// +// Build: bash demos/build.sh reversi +// Run: bash demos/launch.sh reversi + +#include "iigs/toolbox.h" +#include "iigs/desktop.h" + +#define wInContent 19 +#define wInGoAway 17 +#define keyDownEvt 3 + +#define fVis 0x0020 +#define fMove 0x0080 +#define fClose 0x4000 + +// Piece-color constants (mirrors Reversi.cc). +#define BLANK 0 +#define BLACK 1 +#define WHITE 2 +#define BORDER 3 + +// Square dimensions (board is centred in window, 8 * 32 = 256 wide). +#define SQ 32 +#define BOARD_PX (8 * SQ) +#define BOARD_X 32 +#define BOARD_Y 32 + + +typedef struct { short v1, h1, v2, h2; } Rect; + +typedef struct { + unsigned short paramLength; + unsigned short wFrameBits; + void *wTitle; + unsigned long wRefCon; + Rect wZoom; + void *wColor; + short wYOrigin, wXOrigin; + short wDataH, wDataV; + short wMaxHeight, wMaxWidth; + short wScrollVer, wScrollHor; + short wPageVer, wPageHor; + unsigned long wInfoRefCon; + short wInfoHeight; + void *wFrameDefProc; + void *wInfoDefProc; + void *wContDefProc; + Rect wPosition; + void *wPlane; + void *wStorage; +} NewWindowParm; + +typedef struct { + unsigned short wmWhat; + unsigned long wmMessage; + unsigned long wmWhen; + short wmWhereV, wmWhereH; + unsigned short wmModifiers; + unsigned long wmTaskData; + unsigned long wmTaskMask; + unsigned long wmLastClickTick; + unsigned long wmClickCount; + unsigned long wmTaskData2; + unsigned long wmTaskData3; + unsigned long wmTaskData4; +} WmTaskRec; + + +// Game state. ORCA-C uses index = row*10 + col with rows/cols 1..8 +// (10..88 valid, with sentinel BORDER at row/col 0 and 9). Keep the +// same convention so the directional displacement table works. +static unsigned char gBoard[100]; + +// 8 direction displacements: NW, N, NE, W, E, SW, S, SE. +// Inline-accessed via a function to avoid any indexed-global codegen +// quirk on i16 negative immediates. +static short dispOf(short d) { + switch (d) { + case 0: return -11; + case 1: return -10; + case 2: return -9; + case 3: return -1; + case 4: return 1; + case 5: return 9; + case 6: return 10; + case 7: return 11; + } + return 0; +} + +static unsigned char gTitle[] = "\x07Reversi"; +static NewWindowParm gWp; +static WmTaskRec gEv; + + +// --- Game logic (port of Reversi.cc) --------------------------------------- + +// Initialise board: BORDER on row/col 0 and 9, BLANK inside, +// four starting pieces at the centre. +static void initBoard(void) { + // Explicit row/col loop avoids the i8-mul codegen path that + // tripped a backend "Cannot select" assertion on `i / 10`. + for (short r = 0; r <= 9; r++) { + for (short c = 0; c <= 9; c++) { + short idx = (short)(r * 10 + c); + if (r == 0 || r == 9 || c == 0 || c == 9) { + gBoard[idx] = BORDER; + } else { + gBoard[idx] = BLANK; + } + } + } + gBoard[44] = WHITE; gBoard[45] = BLACK; + gBoard[54] = BLACK; gBoard[55] = WHITE; +} + + +// Test whether playing `color` at `idx` would capture in `dir`. +// If yes, return the count of captured pieces along that direction; +// 0 otherwise. +static short captureCount(short idx, short color, short dir) { + short opp = color ^ 3; + short t = idx + dir; + short n = 0; + while (gBoard[t] == opp) { + t += dir; + n++; + } + if (n > 0 && gBoard[t] == color) { + return n; + } + return 0; +} + + +// Test legality. +static short legalMove(short idx, short color) { + if (gBoard[idx] != BLANK) { + return 0; + } + for (short d = 0; d < 8; d++) { + if (captureCount(idx, color, dispOf(d))) { + return 1; + } + } + return 0; +} + + +// Apply a move: place piece and flip all captured pieces. +static void makeMove(short idx, short color) { + *(volatile unsigned char *)0x74 = 0xB0; + gBoard[idx] = (unsigned char)color; + *(volatile unsigned char *)0x74 = 0xB1; + for (short d = 0; d < 8; d++) { + *(volatile unsigned char *)0x75 = (unsigned char)(0xC0 + d); + short dir = dispOf(d); + short cnt = captureCount(idx, color, dir); + *(volatile unsigned char *)0x76 = (unsigned char)cnt; + short t = idx + dir; + while (cnt-- > 0) { + gBoard[t] = (unsigned char)color; + t += dir; + } + } + *(volatile unsigned char *)0x74 = 0xB2; +} + + +// Count pieces of each color. +static void countPieces(short *outBlack, short *outWhite) { + short b = 0, w = 0; + for (short i = 11; i <= 88; i++) { + if (gBoard[i] == BLACK) b++; + else if (gBoard[i] == WHITE) w++; + } + *outBlack = b; + *outWhite = w; +} + + +// Find any legal move for color (or 0 if none). +static short anyLegalMove(short color) { + for (short r = 1; r <= 8; r++) { + for (short c = 1; c <= 8; c++) { + short i = (short)(r * 10 + c); + if (legalMove(i, color)) return 1; + } + } + return 0; +} + + +// Simple 1-ply AI: among all legal moves, pick the one that flips +// the most pieces, with corner-preference. Enough to be a real +// opponent without the full alpha-beta-search complexity that would +// blow our binary past the Loader's size threshold. +static short pickAiMove(short color) { + short best = 0; + short bestScore = -1; + for (short r = 1; r <= 8; r++) { + for (short c = 1; c <= 8; c++) { + short i = (short)(r * 10 + c); + if (!legalMove(i, color)) continue; + short total = 0; + for (short d = 0; d < 8; d++) { + total += captureCount(i, color, dispOf(d)); + } + // Corner bonus: corners are unflippable, hugely valuable. + if (i == 11 || i == 18 || i == 81 || i == 88) total += 100; + // Edge bonus. + if (r == 1 || r == 8 || c == 1 || c == 8) total += 5; + // Adjacent-to-corner penalty. + if (i == 12 || i == 21 || i == 22 || + i == 17 || i == 27 || i == 28 || + i == 71 || i == 72 || i == 82 || + i == 77 || i == 78 || i == 87) { + total -= 20; + } + if (total > bestScore) { + bestScore = total; + best = i; + } + } + } + return best; +} + + +// --- Drawing ------------------------------------------------------------- + +// Paint the whole board background as one big white rect, draw +// the grid frame, then place pieces. Reduces total QD calls +// versus per-cell PaintRect+frame. +static void drawBoard(void) { + Rect outer; + outer.h1 = BOARD_X; outer.v1 = BOARD_Y; + outer.h2 = BOARD_X + BOARD_PX; outer.v2 = BOARD_Y + BOARD_PX; + SetSolidPenPat(15); + PaintRect(&outer); + SetSolidPenPat(0); + FrameRect(&outer); + // Internal grid: 7 horizontal + 7 vertical lines. + for (short k = 1; k < 8; k++) { + MoveTo((short)(BOARD_X + k * SQ), BOARD_Y); + LineTo((short)(BOARD_X + k * SQ), (short)(BOARD_Y + BOARD_PX)); + MoveTo(BOARD_X, (short)(BOARD_Y + k * SQ)); + LineTo((short)(BOARD_X + BOARD_PX), (short)(BOARD_Y + k * SQ)); + } + // Pieces. + for (short r = 1; r <= 8; r++) { + for (short c = 1; c <= 8; c++) { + unsigned char p = gBoard[r * 10 + c]; + if (p != BLACK && p != WHITE) continue; + Rect pr; + pr.h1 = (short)(BOARD_X + (c - 1) * SQ + 4); + pr.v1 = (short)(BOARD_Y + (r - 1) * SQ + 4); + pr.h2 = (short)(pr.h1 + SQ - 8); + pr.v2 = (short)(pr.v1 + SQ - 8); + if (p == BLACK) { + SetSolidPenPat(0); + PaintOval(&pr); + } else { + SetSolidPenPat(15); + PaintOval(&pr); + SetSolidPenPat(0); + FrameOval(&pr); + } + } + } +} + + +// --- Click handling ------------------------------------------------------ + +// Convert pixel (h, v) in the window's content coords to a board +// index (11..88), or 0 if outside the board area. +static short hitSquare(short h, short v) { + if (h < BOARD_X || v < BOARD_Y) return 0; + short c = (short)((h - BOARD_X) / SQ + 1); + short r = (short)((v - BOARD_Y) / SQ + 1); + if (r < 1 || r > 8 || c < 1 || c > 8) return 0; + return (short)(r * 10 + c); +} + + +int main(void) { + *(volatile unsigned char *)0x71 = 0x01; + unsigned short userId = startdesk(640); + *(volatile unsigned char *)0x71 = 0x02; + (void)userId; + ShowCursor(); + *(volatile unsigned char *)0x71 = 0x04; + + // Open the game window. + { + unsigned char *p = (unsigned char *)&gWp; + for (unsigned short i = 0; i < sizeof gWp; i++) p[i] = 0; + } + gWp.paramLength = (unsigned short)sizeof gWp; + gWp.wFrameBits = fVis | fMove | fClose; + gWp.wTitle = gTitle; + gWp.wMaxHeight = 320; + gWp.wMaxWidth = 640; + gWp.wPosition.v1 = 20; gWp.wPosition.h1 = 80; + gWp.wPosition.v2 = 180; gWp.wPosition.h2 = 460; + gWp.wPlane = (void *)-1L; + + *(volatile unsigned char *)0x71 = 0x05; + void *win = NewWindow(&gWp); + *(volatile unsigned char *)0x71 = 0x06; + + initBoard(); + *(volatile unsigned char *)0x71 = 0x07; + (void)&hitSquare; + (void)&gEv; + + short m; + m = pickAiMove(BLACK); if (m) makeMove(m, BLACK); + m = pickAiMove(WHITE); if (m) makeMove(m, WHITE); + m = pickAiMove(BLACK); if (m) makeMove(m, BLACK); + m = pickAiMove(WHITE); if (m) makeMove(m, WHITE); + *(volatile unsigned char *)0x71 = 0x11; + (void)&anyLegalMove; + if (win) { + BeginUpdate(win); + SetPort(win); + drawBoard(); + EndUpdate(win); + } + *(volatile unsigned char *)0x71 = 0x04; + + for (volatile unsigned long s = 0; s < 400000UL; s++) { } + + if (win) { + CloseWindow(win); + } + *(volatile unsigned char *)0x70 = 0x99; + return 0; +} diff --git a/demos/reversi.map b/demos/reversi.map new file mode 100644 index 0000000..5d2263c --- /dev/null +++ b/demos/reversi.map @@ -0,0 +1,217 @@ +# section layout +.text : 0x001000 .. 0x0033dc ( 9180 bytes) +.rodata : 0x0033dc .. 0x003409 ( 45 bytes) +.bss : 0x00a000 .. 0x00a0bc ( 188 bytes) + +# per-input-file .text contributions + 186 /home/scott/claude/llvm816/runtime/crt0Gsos.o + 5050 /home/scott/claude/llvm816/demos/reversi.o + 43513 /home/scott/claude/llvm816/runtime/libc.o + 5935 /home/scott/claude/llvm816/runtime/snprintf.o + 11953 /home/scott/claude/llvm816/runtime/extras.o + 7077 /home/scott/claude/llvm816/runtime/softFloat.o + 15379 /home/scott/claude/llvm816/runtime/softDouble.o + 176 /home/scott/claude/llvm816/runtime/iigsGsos.o + 20670 /home/scott/claude/llvm816/runtime/iigsToolbox.o + 1302 /home/scott/claude/llvm816/runtime/desktop.o + 2540 /home/scott/claude/llvm816/runtime/libgcc.o + +# global symbols (sorted by address) +0x000000 __bss_bank +0x000000 __bss_seg0_bank +0x000000 __bss_seg1_bank +0x000000 __bss_seg1_lo16 +0x000000 __bss_seg1_size +0x000000 __bss_seg2_bank +0x000000 __bss_seg2_lo16 +0x000000 __bss_seg2_size +0x000000 __bss_seg3_bank +0x000000 __bss_seg3_lo16 +0x000000 __bss_seg3_size +0x0000bc __bss_seg0_size +0x0000bc __bss_size +0x001000 __start +0x001000 __text_start +0x0010ba main +0x001af5 pickAiMove +0x0022c4 makeMove +0x002474 memset +0x0024d4 CtlStartUp +0x0024e4 EMStartUp +0x002503 FMStartUp +0x002513 LEStartUp +0x002523 LoadOneTool +0x002533 NewHandle +0x002559 QDStartUp +0x00256f FrameOval +0x002581 FrameRect +0x002593 LineTo +0x0025a3 MoveTo +0x0025b3 PaintOval +0x0025c5 PaintRect +0x0025d7 SetPort +0x0025e9 BeginUpdate +0x0025fb CloseWindow +0x00260d EndUpdate +0x00261f NewWindow +0x002639 startdesk +0x0029f0 __jsl_indir +0x0029f3 __mulhi3 +0x002a12 __umulhisi3 +0x002a69 __ashlhi3 +0x002a78 __lshrhi3 +0x002a88 __ashrhi3 +0x002a9b __udivhi3 +0x002aa7 __umodhi3 +0x002ab3 __divhi3 +0x002acd __modhi3 +0x002ae7 __divmod_setup +0x002b1a __udivmod_core +0x002b38 __mulsi3 +0x002bf1 __ashlsi3 +0x002c06 __lshrsi3 +0x002c1b __ashrsi3 +0x002c35 __udivmodsi_core +0x002c6d __udivsi3 +0x002c81 __umodsi3 +0x002c95 __divsi3 +0x002cbc __modsi3 +0x002ce3 __divmodsi_setup +0x002d34 __divmoddi4_stash +0x002d51 __retdi +0x002d5e __ashldi3 +0x002d81 __lshrdi3 +0x002da4 __ashrdi3 +0x002dca __muldi3 +0x002e25 __ucmpdi2 +0x002e4e __cmpdi2 +0x002e85 __udivdi3 +0x002e8e __umoddi3 +0x002ea7 __udivmoddi_core +0x002ef4 __divdi3 +0x002f13 __moddi3 +0x002f40 __absdi_a +0x002f48 __absdi_b +0x002f50 __negdi_a +0x002f6e __negdi_b +0x002f8c setjmp +0x002fb4 longjmp +0x002fde __umulhisi3_qsq +0x0033dc __rodata_start +0x0033dc __text_end +0x0033dc gChainPath +0x0033f0 gTitle +0x003409 __init_array_end +0x003409 __init_array_start +0x003409 __rodata_end +0x00a000 __bss_lo16 +0x00a000 __bss_seg0_lo16 +0x00a000 __bss_start +0x00a000 gWp +0x00a04e gBoard +0x00a0b2 gUserId +0x00a0b4 gDpHandle +0x00a0b8 gDpBase +0x00a0ba __indirTarget +0x00a0bc __bss_end +0x00a0bc __heap_start +0x00bf00 __heap_end +BeginUpdate = 0x0025e9 +CloseWindow = 0x0025fb +CtlStartUp = 0x0024d4 +EMStartUp = 0x0024e4 +EndUpdate = 0x00260d +FMStartUp = 0x002503 +FrameOval = 0x00256f +FrameRect = 0x002581 +LEStartUp = 0x002513 +LineTo = 0x002593 +LoadOneTool = 0x002523 +MoveTo = 0x0025a3 +NewHandle = 0x002533 +NewWindow = 0x00261f +PaintOval = 0x0025b3 +PaintRect = 0x0025c5 +QDStartUp = 0x002559 +SetPort = 0x0025d7 +__absdi_a = 0x002f40 +__absdi_b = 0x002f48 +__ashldi3 = 0x002d5e +__ashlhi3 = 0x002a69 +__ashlsi3 = 0x002bf1 +__ashrdi3 = 0x002da4 +__ashrhi3 = 0x002a88 +__ashrsi3 = 0x002c1b +__bss_bank = 0x000000 +__bss_end = 0x00a0bc +__bss_lo16 = 0x00a000 +__bss_seg0_bank = 0x000000 +__bss_seg0_lo16 = 0x00a000 +__bss_seg0_size = 0x0000bc +__bss_seg1_bank = 0x000000 +__bss_seg1_lo16 = 0x000000 +__bss_seg1_size = 0x000000 +__bss_seg2_bank = 0x000000 +__bss_seg2_lo16 = 0x000000 +__bss_seg2_size = 0x000000 +__bss_seg3_bank = 0x000000 +__bss_seg3_lo16 = 0x000000 +__bss_seg3_size = 0x000000 +__bss_size = 0x0000bc +__bss_start = 0x00a000 +__cmpdi2 = 0x002e4e +__divdi3 = 0x002ef4 +__divhi3 = 0x002ab3 +__divmod_setup = 0x002ae7 +__divmoddi4_stash = 0x002d34 +__divmodsi_setup = 0x002ce3 +__divsi3 = 0x002c95 +__heap_end = 0x00bf00 +__heap_start = 0x00a0bc +__indirTarget = 0x00a0ba +__init_array_end = 0x003409 +__init_array_start = 0x003409 +__jsl_indir = 0x0029f0 +__lshrdi3 = 0x002d81 +__lshrhi3 = 0x002a78 +__lshrsi3 = 0x002c06 +__moddi3 = 0x002f13 +__modhi3 = 0x002acd +__modsi3 = 0x002cbc +__muldi3 = 0x002dca +__mulhi3 = 0x0029f3 +__mulsi3 = 0x002b38 +__negdi_a = 0x002f50 +__negdi_b = 0x002f6e +__retdi = 0x002d51 +__rodata_end = 0x003409 +__rodata_start = 0x0033dc +__start = 0x001000 +__text_end = 0x0033dc +__text_start = 0x001000 +__ucmpdi2 = 0x002e25 +__udivdi3 = 0x002e85 +__udivhi3 = 0x002a9b +__udivmod_core = 0x002b1a +__udivmoddi_core = 0x002ea7 +__udivmodsi_core = 0x002c35 +__udivsi3 = 0x002c6d +__umoddi3 = 0x002e8e +__umodhi3 = 0x002aa7 +__umodsi3 = 0x002c81 +__umulhisi3 = 0x002a12 +__umulhisi3_qsq = 0x002fde +gBoard = 0x00a04e +gChainPath = 0x0033dc +gDpBase = 0x00a0b8 +gDpHandle = 0x00a0b4 +gTitle = 0x0033f0 +gUserId = 0x00a0b2 +gWp = 0x00a000 +longjmp = 0x002fb4 +main = 0x0010ba +makeMove = 0x0022c4 +memset = 0x002474 +pickAiMove = 0x001af5 +setjmp = 0x002f8c +startdesk = 0x002639 diff --git a/demos/reversi.o b/demos/reversi.o new file mode 100644 index 0000000..09bacf0 Binary files /dev/null and b/demos/reversi.o differ diff --git a/demos/reversi.omf b/demos/reversi.omf new file mode 100644 index 0000000..7b02200 Binary files /dev/null and b/demos/reversi.omf differ diff --git a/demos/reversi.reloc b/demos/reversi.reloc new file mode 100644 index 0000000..d32c5ce Binary files /dev/null and b/demos/reversi.reloc differ diff --git a/demos/test.sh b/demos/test.sh new file mode 100755 index 0000000..4359e79 --- /dev/null +++ b/demos/test.sh @@ -0,0 +1,108 @@ +#!/usr/bin/env bash +# test.sh - headless test of a demo OMF. Boots MAME, drives the +# Finder to launch the demo, waits for the demo to reach its event +# loop, injects a keystroke to wake it, then reads back the +# trailing marker at $00:0070 to confirm the demo ran to completion. +# +# Usage: bash demos/test.sh +# +# Expected outcome: $0070 reads back as $99. + +set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" + +[ $# -ge 1 ] || { echo "usage: $0 " >&2; exit 2; } +BASE="$1" +SRC="$SCRIPT_DIR/$BASE.c" +OMF="$SCRIPT_DIR/$BASE.omf" + +if [ ! -f "$OMF" ] || [ "$SRC" -nt "$OMF" ]; then + bash "$SCRIPT_DIR/build.sh" "$BASE" >/dev/null +fi + +CADIUS=${CADIUS:-$PROJECT_ROOT/tools/cadius/cadius} +SYSDISK=${SYSDISK:-$PROJECT_ROOT/tools/gsos/sys602.po} + +[ -x "$CADIUS" ] || { echo "cadius not found: $CADIUS" >&2; exit 2; } +[ -f "$SYSDISK" ] || { echo "sysdisk not found: $SYSDISK" >&2; exit 2; } +command -v mame >/dev/null || { echo "mame not in PATH" >&2; exit 2; } + +WORK=$(mktemp -d -t demotest.XXXXXX) +trap 'rm -rf "$WORK"' EXIT + +cp "$SYSDISK" "$WORK/disk.po" +"$CADIUS" CREATEVOLUME "$WORK/data.po" DATA 800KB >/dev/null +cp "$OMF" "$WORK/HELLO#B30000" +"$CADIUS" ADDFILE "$WORK/data.po" /DATA "$WORK/HELLO#B30000" >/dev/null + +# Same Finder-navigation timeline as runViaFinder.sh, plus a key +# injection at frame 6000 (well after the demo has launched and is +# waiting in its event loop), and a memory check at frame 8000. +cat > "$WORK/launch.lua" <<'LUA' +local cpu = manager.machine.devices[":maincpu"] +local mem = cpu.spaces["program"] +local nat = manager.machine.natkeyboard +local frame = 0 +local idx = 1 + +local function get_field(port, name) + local p = manager.machine.ioport.ports[port] + if p == nil then return nil end + return p.fields[name] +end +local key_cmd = get_field(":macadb:KEY3", "Command / Open Apple") +local function press(f) if f then f:set_value(1) end end +local function release(f) if f then f:set_value(0) end end + +local steps = { + {3300, function() nat:post("D") end}, + {3540, function() press(key_cmd) end}, + {3546, function() nat:post("o") end}, + {3600, function() release(key_cmd) end}, + {4200, function() nat:post("H") end}, + {4500, function() press(key_cmd) end}, + {4506, function() nat:post("o") end}, + {4560, function() release(key_cmd) end}, + {7000, function() nat:post(" ") end}, -- wake the demo's event loop + {7500, function() nat:post(" ") end}, -- send a few in case GetNextEvent runs in between + {8000, function() nat:post(" ") end}, + {9000, function() + print(string.format("MAME-READ 0x70=%02x", mem:read_u8(0x70))) + for a = 0x60, 0x7F do + local v = mem:read_u8(a) + if v ~= 0 and a ~= 0x70 then + print(string.format("MAME-READ 0x%02x=%02x", a, v)) + end + end + for a = 0x0F80, 0x0F9F do + local v = mem:read_u8(a) + if v ~= 0 then + print(string.format("MAME-READ 0x%04x=%02x", a, v)) + end + end + manager.machine:exit() + end}, +} +emu.register_frame_done(function() + frame = frame + 1 + while idx <= #steps and frame >= steps[idx][1] do + steps[idx][2]() + idx = idx + 1 + end +end) +LUA + +OUT=$(timeout 200 mame apple2gs -rompath "$PROJECT_ROOT/tools/mame/roms" \ + -window -nothrottle -sound none \ + -seconds_to_run 180 -flop3 "$WORK/disk.po" -flop4 "$WORK/data.po" \ + -autoboot_script "$WORK/launch.lua" &1) + +echo "$OUT" | grep "MAME-READ" || true +VAL=$(echo "$OUT" | grep "MAME-READ 0x70=" | tail -1 | sed 's/.*=//') +if [ "$VAL" = "99" ]; then + echo "PASS: $BASE reached end (\$70 = 0x99)" + exit 0 +fi +echo "FAIL: $BASE marker at \$70 = 0x$VAL (want 0x99)" +exit 1 diff --git a/docs/USAGE.md b/docs/USAGE.md index 0322b60..0318547 100644 --- a/docs/USAGE.md +++ b/docs/USAGE.md @@ -148,26 +148,164 @@ servers/CI runners. ### The bank-switch idiom -Bank 0 (`$00:0000-$00:FFFF`) has the I/O window at `$C000-$CFFF` -that interferes with normal data access. The convention is to -switch the data bank register (DBR) to bank 2 (`$02:0000`) before -doing any data work: +#### Background — why this is necessary + +The 65816 has two registers that select which bank a memory access +goes to: + +- **PBR** (Program Bank Register) — selects the bank for instruction + fetches. Set by `jsl long_addr` and `rtl`. +- **DBR** (Data Bank Register) — selects the bank for data accesses + like `lda $5000`, `sta $5000`, etc. + +When the IIgs boots, DBR defaults to `$00`. Bank `$00` (the same +bank as the language card / IIe-compatibility area) contains the +**I/O window at `$C000-$CFFF`**. Any data access to addresses in +that range goes to the soft-switches and slot ROMs, NOT to RAM. +This is the same I/O hole the Apple IIe has, inherited by the IIgs +for backward compatibility. + +Concretely: if your DBR is `$00` and you write to address `$C100`, +you're poking the slot-1 ROM enable register — definitely not what +you want. Similarly, `$5000` in bank 0 is the language card area +and may or may not be RAM depending on soft-switch state. + +Banks `$01`-`$DF` are full 64K RAM banks (`$E0`/`$E1` are aux/main +shadow, `$E0`-`$FF` reserved). To do reliable data work, switch +the DBR to any of these "normal" banks. **`$02`** is conventional +in this codebase because: + +1. `$01:0000-$01:FFFF` overlaps the stack page (`$0100-$01FF` in + any bank ends up in the same physical RAM as bank `$00`'s + stack page — confusing). +2. `$02:0000-$02:FFFF` is the first "clean" bank above the + special-purpose banks. +3. The smoke-test convention is to write a result word to + `$02:5000` so `runInMame.sh` can read it back. + +If your program needs more than 64 KB of data, switch DBR to +different banks as needed. + +#### What the assembly does, line by line ```c __attribute__((noinline)) void switchToBank2(void) { __asm__ volatile ( - "sep #0x20\n" // 8-bit accumulator - ".byte 0xa9,0x02\n" // lda #2 (force as bytes — llvm-mc bug) - "pha\n" - "plb\n" // DBR = 2 - "rep #0x20\n" // back to 16-bit + "sep #0x20\n" // (1) Switch A to 8-bit + ".byte 0xa9,0x02\n" // (2) lda #2 (8-bit immediate) + "pha\n" // (3) Push A onto stack (1 byte) + "plb\n" // (4) Pop into DBR (1 byte from stack) + "rep #0x20\n" // (5) Restore A to 16-bit ); } ``` -After `switchToBank2()`, your data lives at `$02:0000` upward. -The `runInMame.sh` `--check 0x025000=...` address is `$02:5000` -— accessible via a normal store in bank 2. +1. **`sep #0x20`** — sets the `M` bit in the status register `P`. + `M=1` makes A behave as 8-bit (and immediate operands become + 1 byte). We need this so the next `lda #2` pushes 1 byte + (matching what `plb` expects to pop). Calling-convention + prologues always run in M=0 (16-bit), so this `sep` is + required. + +2. **`.byte 0xa9,0x02`** — raw bytes for `lda #$02`. We hand-encode + because llvm-mc can't yet emit an 8-bit immediate `lda #$02` + that knows it's 1 byte; the assembler keeps treating it as + 16-bit. `0xa9` is the LDA-immediate opcode; `0x02` is the + 1-byte operand. Result: A = `$02` (8-bit). + +3. **`pha`** — pushes A. In M=1 mode, PHA pushes exactly 1 byte + (the low half of A). Stack now has `$02` on top. + +4. **`plb`** — pops 1 byte from the stack and stores it in DBR. + DBR is now `$02`. All subsequent data accesses go to bank 2. + +5. **`rep #0x20`** — clears the `M` bit. A returns to 16-bit mode, + matching the calling-convention contract for the rest of the + function. + +The DBR change persists across function returns. Once +`switchToBank2()` returns, all data reads/writes in your program +target bank 2 — until you switch DBR again. + +#### When you need it + +You need to switch DBR whenever you want to access data at an +absolute address `$XXXX` and need it to land in a specific bank. +Common cases: + +- **MMIO from the test harness** — `*(volatile uint16 *)0x5000 = x;` + Without DBR=2, this would go to bank 0's `$5000` (which is in + the language card area). With DBR=2, it goes to `$02:5000` + where `runInMame.sh --check 0x025000=...` reads from. +- **Anything in `$C000-$CFFF`** — bank 0 has soft-switches here. + Bank 2 has plain RAM. +- **Global arrays declared at link-time at fixed addresses** — + the linker may place them in bank 2 BSS (`--bss-base 0x020000`). + Your DBR must match. + +You DON'T need DBR=2 for: + +- **Local variables on the stack** — the stack is always + bank-relative-to-DBR-ignored; `lda $4,s` reads from the stack + page regardless of DBR. +- **Direct-page accesses** — `lda $D0` reads from `$00:00D0` + (always bank 0). DP is anchored to bank 0. +- **Indirect-long pointers via `[dp],y`** — these include their + own bank byte and ignore DBR. +- **Function calls** — `jsl` uses PBR + a long destination + address. PBR is updated automatically. + +#### Other ways to access non-bank-0 data + +If you only need to write to a single non-bank-0 address, you can +emit the store as `STA_Long` (24-bit absolute) which encodes the +bank inline: + +```c +*(volatile unsigned short *)0x025000 = 42; // becomes sta $025000 +``` + +The W65816 backend recognizes `const-int pointer + integer offset` +and lowers to `sta long` if the address has a bank byte. No +`switchToBank2()` needed. + +For frequent data work in a bank, switching DBR once and using +plain `sta $5000` (2 bytes) is smaller and faster than `sta $025000` +(4 bytes) per access. + +#### Caveats + +- **Save/restore is your problem.** `switchToBank2()` never + restores DBR. If your caller expected DBR=0, you've broken its + expectation. For long-running programs, that's usually fine + (you just set DBR=2 once and stay there). For toolbox calls, GS/OS + might assume DBR=0 — check the call's documentation. +- **The stack is in bank 0 regardless.** Don't try to put the + stack elsewhere; the 65816's stack-relative addressing modes + ignore DBR. +- **In M=1 mode, INTERRUPTS may behave differently.** The `sep` + affects A's width but not the bank-switching machinery itself. + Keep the sep/rep window short. +- **PBR vs DBR** are independent. Code execution stays where it + was; only data accesses change. + +#### How `runInMame.sh --check 0x025000=...` works + +The check address `0x025000` is a 24-bit address: bank `$02`, +offset `$5000`. The MAME Lua runner reads this byte (and the next +byte if you specify a 2-byte value) directly from physical RAM, +bypassing DBR entirely. So the convention is: + +1. Your program switches DBR to bank 2. +2. Your program writes its result to `*(volatile X *)0x5000`, + which becomes `sta $5000` — landing in bank 2 because of DBR. +3. MAME reads bank 2's `$5000` via the absolute 24-bit address. +4. The runner compares to your expected value. + +If you forget `switchToBank2()`, your store goes to the language +card area (bank 0's `$5000`), MAME's check reads bank 2's +unchanged `$5000` (likely `$00` or whatever was there), and the +test fails. ## Examples diff --git a/runtime/build.sh b/runtime/build.sh index 6b8c870..b87d62d 100755 --- a/runtime/build.sh +++ b/runtime/build.sh @@ -52,7 +52,9 @@ cc "$SRC/math.c" cc "$SRC/softFloat.c" cc "$SRC/libcxxabi.c" cc "$SRC/libcxxabiSjlj.c" +cc "$SRC/desktop.c" asm "$SRC/iigsGsos.s" +asm "$SRC/iigsToolbox.s" # softDouble.c builds at -O2. dpack stays noinline (basic regalloc # overflows when dpack inlines into __adddf3/__muldf3). dclass MUST # stay inline (its pointer-arg writes from a noinline boundary would diff --git a/runtime/include/iigs/desktop.h b/runtime/include/iigs/desktop.h new file mode 100644 index 0000000..7ff0f47 --- /dev/null +++ b/runtime/include/iigs/desktop.h @@ -0,0 +1,56 @@ +// iigs/desktop.h - Full Window Manager desktop startup helper. +// +// Equivalent to ORCA-C's `startdesk` library function: brings up the +// stack of toolsets needed to open titled windows, draw menus, +// dispatch events, etc. Use this before `NewWindow` for any titled- +// window application. See demos/orcaFrame.c for a minimal usage +// example. +// +// On success, `desktopUserId()` returns the Memory Manager userID +// assigned to this application. Pass it to other toolsets that need +// a userID (e.g. ID arg to `DisposeAll`). +// +// startdesk() takes a screen-width hint: +// 320 - SHR 320 mode (16 colors) +// 640 - SHR 640 mode (4 colors) +// This is passed to QDStartUp's masterSCB and to EMStartUp's +// xMax/yMax. Other dimensions are derived. + +#ifndef IIGS_DESKTOP_H +#define IIGS_DESKTOP_H + +#ifdef __cplusplus +extern "C" { +#endif + +// Returns the user-ID assigned by MMStartUp. Pass to enddesk(). +unsigned short startdesk(unsigned short screenWidth); + +// Tears down the desktop environment in reverse-startup order. +void enddesk(unsigned short userId); + +// Read-only accessor — same value startdesk() returned. +unsigned short desktopUserId(void); + +// Read-only accessor — base of the per-toolset 0x700-byte DP block +// startdesk() allocated. Slot $300 (256 bytes) is reserved for the +// Menu Manager: pass `desktopDpBase() + 0x300` to MenuStartUp. +unsigned short desktopDpBase(void); + +// Paint a clean Finder-style backdrop directly into SHR: white menu +// bar (rows 0..12), 1-pixel black separator (row 13), white desktop +// (rows 14..199). Bypasses the WM's dithered desktop fill (which +// MAME's NTSC chroma simulator renders as colored noise). Call +// AFTER startdesk() and BEFORE NewWindow. +void paintDesktopBackdrop(void); + +// Paint menu bar titles via QD's DrawString. Each entry is a +// pascal-string pointer (byte length + chars). Use as a manual +// substitute for DrawMenuBar(), which hangs in our environment. +void paintMenuBarTitles(const unsigned char *const *pascalTitles, unsigned short count); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/runtime/src/crt0.s b/runtime/src/crt0.s index 3184d5b..64bad95 100644 --- a/runtime/src/crt0.s +++ b/runtime/src/crt0.s @@ -71,6 +71,8 @@ __start: phk pla ; A's low byte = current PBR sta 0xbe ; persistent data bank + stz 0xbf ; pad: `lda 0xbe` in 16-bit M loads $00PBR + ; — used by codegen for &symbol bank halves rep #0x20 ; Zero BSS. Up to 4 segments — linker emits __bss_seg{0..3}_lo16 @@ -202,6 +204,23 @@ __start: ; sequence in a controlled context. time()/clock() check an ; in-process flag and return 0 if init hasn't been done. + ; Set DBR to the BSS bank before calling main. Without this, the + ; user has to manually switch the data bank register (with a + ; `pha;plb` inline-asm idiom) before doing absolute data + ; accesses. Calypsi's "small data model" assumes DBR is + ; pre-set; we now follow the same convention. + ; + ; Linker emits __bss_seg0_bank as the bank byte of the first + ; BSS segment (typically 2 with the default --bss-base 0x020000). + ; Programs that need bank-0 access (e.g., for $C0xx soft + ; switches) can use STA_Long or temporarily switch DBR back. + sep #0x20 + .byte 0xA9 ; lda #imm8 (1 byte) — llvm-mc can't + .byte __bss_seg0_bank ; reliably encode this with a symbol; + pha ; spell it out to keep the bytes right. + plb + rep #0x20 + ; Call main. Standard W65816 ABI: i16 first arg in A; we pass ; nothing. After return, A holds the exit code. jsl main diff --git a/runtime/src/crt0Gsos.s b/runtime/src/crt0Gsos.s index 37fee0f..9fa865c 100644 --- a/runtime/src/crt0Gsos.s +++ b/runtime/src/crt0Gsos.s @@ -33,6 +33,18 @@ __start: ; wrong bank without this. PHK + PLB copies PBR into DBR. phk plb + ; Diagnostic: stash a marker at $00:007F via `sta long` (bank- + ; explicit, immune to DBR uncertainty) immediately on entry. + ; Runtime probes use this to detect whether the Loader actually + ; reached our code or silently rejected the OMF earlier. + ; The assembler doesn't track SEP/REP state, so the LDA #imm + ; needs explicit `.byte` form: the standard `lda #$7F` would + ; assemble as 3 bytes (16-bit imm) and the trailing $00 would + ; execute as BRK at runtime once M=8. + sep #0x20 + .byte 0xa9, 0x7f ; lda #$7F (8-bit imm) + .byte 0x8f, 0x7f, 0x00, 0x00 ; sta long $00:007F + rep #0x20 ; Set DP=0. The C compiler assumes DP=0 for all `sta dp` and ; `[dp],y`-style accesses; GS/OS hands us a Memory-Manager- @@ -51,6 +63,18 @@ __start: phk pla sta 0xbe + stz 0xbf ; pad byte so `lda 0xbe` in 16-bit M reads $00PBR + ; (codegen uses this as the bank-half of `&symbol` + ; 32-bit pointers — see W65816AsmPrinter + ; LDAi16imm_bank expansion) + rep #0x20 + + ; --- Diagnostic markers between crt0 phases. Bank-explicit + ; `sta long` to $00:007E so they're visible from a host probe + ; regardless of DBR/PBR. + sep #0x20 + .byte 0xa9, 0x7e ; lda #$7E + .byte 0x8f, 0x7e, 0x00, 0x00 ; sta long $00:007E (post-DP) rep #0x20 ; BSS zero-init. With DBR=our bank, `stz abs,X` writes to @@ -67,6 +91,10 @@ __start: inx bra .Lbss_loop .Lbss_done: + sep #0x20 + .byte 0xa9, 0x7d ; lda #$7D + .byte 0x8f, 0x7d, 0x00, 0x00 ; sta long $00:007D (post-BSS) + rep #0x20 ; Walk .init_array (C++ ctors). ; @@ -99,6 +127,12 @@ __start: bra .Linit_loop .Linit_done: + ; Marker: about to JSL main. + sep #0x20 + .byte 0xa9, 0x7c ; lda #$7C + .byte 0x8f, 0x7c, 0x00, 0x00 ; sta long $00:007C (about to call main) + rep #0x20 + ; Call main. Standard W65816 C ABI: arg0 in A; we pass none. rep #0x30 jsl main diff --git a/runtime/src/desktop.c b/runtime/src/desktop.c new file mode 100644 index 0000000..a3c67cb --- /dev/null +++ b/runtime/src/desktop.c @@ -0,0 +1,168 @@ +// desktop.c - startdesk()/enddesk() — ORCA-C-style minimal desktop init. +// +// Brings up the toolset chain a full desktop app needs: +// Memory + DP allocation, MiscTools, QD, EM, Scheduler, Sound, ADB, +// SANE, IntMath, Text, Window, Font, Control, LineEdit, Dialog, +// Scrap. Menu Manager startup is omitted — MenuStartUp hangs in +// the current environment (likely a tool-init-order dependency we +// haven't pinned down). Demos that need a visible menu bar paint +// it manually into SHR rows 0..12. +// +// Palette: all 16 palettes set to (black, white, black, white). In +// 640 mode that maps to clean Finder-style B/W instead of NTSC chroma +// noise for the dithered patterns the WM uses. + +#include "iigs/desktop.h" +#include "iigs/toolbox.h" + +static unsigned short gUserId = 0; +static void *gDpHandle = (void *)0; +static unsigned short gDpBase = 0; + + +static unsigned short blockAddrLo(void *handle) { + return (unsigned short)(unsigned long)*(void **)handle; +} + + +unsigned short startdesk(unsigned short screenWidth) { + gUserId = MMStartUp(); + // QD needs 512 bytes ($200) — its own DP at +$000 plus the cursor + // manager's DP at +$100 (InitCursor does `tdc; clc; adc #$100; + // tcd` to find its globals). ROM Source Code/Bank FE/cursor.asm + // confirms cursor uses QD's DP+$100. Layout below allocates 0x800 + // total so QD/Cursor have $000..$1FF, then EM/FM/Menu/Ctl/LE/Dlg + // each get $100. + // $000 QD | $100 Cursor | $200 EM | $300 FM | $400 Menu | + // $500 Ctl | $600 LE | $700 Dialog. + gDpHandle = NewHandle(0x800UL, gUserId, 0xC015, (void *)0); + unsigned short dp = blockAddrLo(gDpHandle); + gDpBase = dp; + + MTStartUp(); + unsigned short masterSCB = (screenWidth == 640) ? 0x90 : 0x10; + QDStartUp(dp, masterSCB, screenWidth, gUserId); + EMStartUp((unsigned short)(dp + 0x200), 20, 0, 0, + (short)(screenWidth - 1), 199, gUserId); + SchStartUp(); + SoundStartUp(gUserId); + ADBStartUp(); + SANEStartUp(gUserId); + IMStartUp(); + TextStartUp(); + LoadOneTool(0x0E, 0x0301); + WindStartUp(gUserId); + LoadOneTool(0x1B, 0x0301); + FMStartUp(gUserId, (unsigned short)(dp + 0x300)); + LoadOneTool(0x10, 0x0301); + CtlStartUp(gUserId, (unsigned short)(dp + 0x500)); + LoadOneTool(0x14, 0x0301); + LEStartUp(gUserId, (unsigned short)(dp + 0x600)); + LoadOneTool(0x15, 0x0301); + DialogStartUp(gUserId); + LoadOneTool(0x16, 0x0301); + ScrapStartUp(); + + // InitCursor allocates the cursor save buffer (1024-byte handle + // stored at cursor mgr DP $B4). Without it, the FIRST QD call + // that internally triggers cursor shield/unshield hangs in ROM's + // iUndrawCursor walking through a NULL pointer. This was the + // *real* cause of the "DrawMenuBar hang" investigation — + // DrawMenuBar's _FillRect call shields the cursor, and iUndraw + // loops forever copying garbage from $00:0000+Y into SHR. + // Confirmed via ROM Source Code/Bank FE/cursor.asm — see PC + // $FE:551E during hang matched iUndrawCursor:FinishLoop. + InitCursor(); + + LoadOneTool(0x0F, 0x0301); + MenuStartUp(gUserId, (unsigned short)(dp + 0x400)); + + // Force all 16 palettes to a Finder-style B/W spread that works + // in 640 mode. 640 mode rotates through palette quadrants + // (8..11, 12..15, 0..3, 4..7) across pixel positions, so SetForeColor(1) + // only renders solid white if pal[1] == pal[5] == pal[9] == pal[13]. + // Even (0,2,4,6,8,10,12,14) → black, odd (1,3,5,7,9,11,13,15) → white. + for (unsigned short p = 0; p < 16; p++) { + volatile unsigned short *pal = + (volatile unsigned short *)(0xE19E00UL + (unsigned long)p * 32UL); + for (unsigned short k = 0; k < 16; k++) { + pal[k] = (k & 1) ? 0x0FFF : 0x0000; + } + } + + return gUserId; +} + + +// Paint menu bar text via QD's DrawString. Each title is a +// pascal-counted string (length-prefixed); titles are placed +// left-to-right at y=10, starting at x=4 with kSpacing between +// titles. Use this in place of DrawMenuBar() (which hangs in our +// current toolset env). Caller is responsible for filling the bar +// background first (paintDesktopBackdrop does this). +void paintMenuBarTitles(const unsigned char *const *pascalTitles, unsigned short count) { + SetForeColor(0); + SetBackColor(15); + unsigned short x = 4; + for (unsigned short i = 0; i < count; i++) { + MoveTo((short)x, 10); + const unsigned char *s = pascalTitles[i]; + DrawString((void *)s); + x = (unsigned short)(x + (unsigned short)s[0] * 8U + 16U); + } +} + + +// Paint a Finder-style backdrop directly into SHR: white menu bar +// (rows 0..12), 1-pixel black separator (row 13), white desktop +// (rows 14..199). Bypasses the WM's dithered desktop fill that +// MAME's NTSC chroma simulator renders as colored noise. Useful +// for ORCA-style demos that want the WM's chrome without the +// chroma fringing. +void paintDesktopBackdrop(void) { + __asm__ volatile ( + "rep #0x30\n" + "ldx #0x0000\n" + "1:\n" + ".byte 0xa9, 0xff, 0xff\n" + ".byte 0x9f, 0x00, 0x20, 0xe1\n" + "inx\n inx\n" + ".byte 0xe0, 0x20, 0x08\n" + "bcc 1b\n" + "2:\n" + ".byte 0xa9, 0x00, 0x00\n" + ".byte 0x9f, 0x00, 0x20, 0xe1\n" + "inx\n inx\n" + ".byte 0xe0, 0xc0, 0x08\n" + "bcc 2b\n" + "3:\n" + ".byte 0xa9, 0xff, 0xff\n" + ".byte 0x9f, 0x00, 0x20, 0xe1\n" + "inx\n inx\n" + ".byte 0xe0, 0x00, 0x7d\n" + "bcc 3b\n" + ::: "a", "x", "memory"); +} + + +void enddesk(unsigned short userId) { + WindShutDown(); + FMShutDown(); + TextShutDown(); + ADBShutDown(); + SchShutDown(); + EMShutDown(); + QDShutDown(); + DisposeHandle(gDpHandle); + MMShutDown(userId); +} + + +unsigned short desktopUserId(void) { + return gUserId; +} + + +unsigned short desktopDpBase(void) { + return gDpBase; +} diff --git a/runtime/src/iigsGsos.s b/runtime/src/iigsGsos.s index 14009cb..d5fd803 100644 --- a/runtime/src/iigsGsos.s +++ b/runtime/src/iigsGsos.s @@ -1,5 +1,12 @@ ; iigsGsos.s — GS/OS class-1 dispatch wrappers. ; +; PUSH ORDER MATTERS. Earlier versions used PHA-then-PEA-0, which put +; the bank byte at offset position in the stack layout - broken under +; real GS/OS 6.0.2 (observed as a JSL $E100A8 hang). The correct order +; matches ORCA-C's PushLong macro: PEA high FIRST, then PHA low. After +; PEA 0 + PHA, the 4 bytes at (S+1..S+4) are (off_lo, off_hi, bank, pad) +; in little-endian order, which is what the dispatcher reads as a LONG. +; ; Each wrapper takes a 16-bit pointer to a class-1 parm block in A ; (the C ABI). The GS/OS convention is: ; PHA / PEA 0 ; push 32-bit parm-block pointer @@ -36,8 +43,8 @@ .globl gsosGetMark gsosOpen: - pha pea 0 + pha ldx #0x2010 jsl 0xe100a8 sta 0xe4 ; stash status (A) in DP scratch @@ -49,8 +56,8 @@ gsosOpen: rtl gsosRead: - pha pea 0 + pha ldx #0x2012 jsl 0xe100a8 sta 0xe4 @@ -62,8 +69,8 @@ gsosRead: rtl gsosWrite: - pha pea 0 + pha ldx #0x2013 jsl 0xe100a8 sta 0xe4 @@ -75,8 +82,8 @@ gsosWrite: rtl gsosClose: - pha pea 0 + pha ldx #0x2014 jsl 0xe100a8 sta 0xe4 @@ -88,8 +95,8 @@ gsosClose: rtl gsosGetEOF: - pha pea 0 + pha ldx #0x2019 jsl 0xe100a8 sta 0xe4 @@ -101,8 +108,8 @@ gsosGetEOF: rtl gsosSetEOF: - pha pea 0 + pha ldx #0x2018 jsl 0xe100a8 sta 0xe4 @@ -114,8 +121,8 @@ gsosSetEOF: rtl gsosSetMark: - pha pea 0 + pha ldx #0x2016 jsl 0xe100a8 sta 0xe4 @@ -127,8 +134,8 @@ gsosSetMark: rtl gsosGetMark: - pha pea 0 + pha ldx #0x2017 jsl 0xe100a8 sta 0xe4 diff --git a/runtime/src/iigsGsosStub.s b/runtime/src/iigsGsosStub.s index 44ca05c..5e7aa80 100644 --- a/runtime/src/iigsGsosStub.s +++ b/runtime/src/iigsGsosStub.s @@ -1,11 +1,14 @@ ; Minimal GS/OS dispatcher stub at $E100A8. Native, M=0, X=0. -; Stack at entry: S+1=PCL, S+2=PCH, S+3=PBR, S+4..5=bank (=0), -; S+9=parm ptr low 16, S+10=high. We only use the low 16 (bank-0 -; parm blocks). Writes $42 to *parm and returns A=0. +; Stack at entry (after caller's PEA 0 + PHA + JSL): +; S+1=PCL, S+2=PCH, S+3=PBR, S+4=ptr_lo, S+5=ptr_hi, +; S+6=bank (=0), S+7=pad (=0). +; After our PHP + PHA: parm pointer is at (S+7, S+8); bank at (S+9). +; We only use the low 16 (bank-0 parm blocks). Writes $42 to *parm +; and returns A=0. .text php ; save P pha ; save A (16-bit) - lda 9, s ; A = parm ptr 16 + lda 7, s ; A = parm ptr offset (16-bit) sta 0xe4 ; DP $E4..$E5 ldy #0 ; X=0 here, so 3-byte encoding sep #0x20 ; M=8 for the 1-byte store diff --git a/runtime/src/iigsToolbox.s b/runtime/src/iigsToolbox.s index 389246b..b018767 100644 --- a/runtime/src/iigsToolbox.s +++ b/runtime/src/iigsToolbox.s @@ -14,6 +14,7 @@ ; ACEInfo(Word) -> LongWord ; tool 0x071D, set 0x1D (ACETools) + .section .text.ACEInfo,"ax" .globl ACEInfo ACEInfo: ; --- stash arg0 (in A) --- @@ -32,28 +33,29 @@ ACEInfo: ; ACECompress(Handle, Long, Handle, Long, Word, Word) -> void ; tool 0x091D, set 0x1D (ACETools) + .section .text.ACECompress,"ax" .globl ACECompress ACECompress: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Long, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (Handle, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha ; --- arg3 (Long, 4B) --- - lda 24, s + lda 26, s pha lda 26, s pha @@ -69,28 +71,29 @@ ACECompress: ; ACEExpand(Handle, Long, Handle, Long, Word, Word) -> void ; tool 0x0A1D, set 0x1D (ACETools) + .section .text.ACEExpand,"ax" .globl ACEExpand ACEExpand: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Long, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (Handle, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha ; --- arg3 (Long, 4B) --- - lda 24, s + lda 26, s pha lda 26, s pha @@ -106,48 +109,51 @@ ACEExpand: ; GetACEExpState(Ptr) -> void ; tool 0x0D1D, set 0x1D (ACETools) + .section .text.GetACEExpState,"ax" .globl GetACEExpState GetACEExpState: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0D1D jsl 0xe10000 rtl ; SetACEExpState(Ptr) -> void ; tool 0x0E1D, set 0x1D (ACETools) + .section .text.SetACEExpState,"ax" .globl SetACEExpState SetACEExpState: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0E1D jsl 0xe10000 rtl ; AsyncADBReceive(Pointer, Word) -> void ; tool 0x0D09, set 0x09 (AppleDeskBus) + .section .text.AsyncADBReceive,"ax" .globl AsyncADBReceive AsyncADBReceive: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -157,22 +163,24 @@ AsyncADBReceive: ; GetAbsScale(ScaleRecPtr) -> void ; tool 0x1309, set 0x09 (AppleDeskBus) + .section .text.GetAbsScale,"ax" .globl GetAbsScale GetAbsScale: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1309 jsl 0xe10000 rtl ; ReadKeyMicroData(Word, Pointer, Word) -> void ; tool 0x0A09, set 0x09 (AppleDeskBus) + .section .text.ReadKeyMicroData,"ax" .globl ReadKeyMicroData ReadKeyMicroData: ; --- stash arg0 (in A) --- @@ -181,7 +189,7 @@ ReadKeyMicroData: lda 0xE0 pha ; --- arg1 (Pointer, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -194,18 +202,19 @@ ReadKeyMicroData: ; ReadKeyMicroMemory(Pointer, Pointer, Word) -> void ; tool 0x0B09, set 0x09 (AppleDeskBus) + .section .text.ReadKeyMicroMemory,"ax" .globl ReadKeyMicroMemory ReadKeyMicroMemory: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Pointer, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -218,6 +227,7 @@ ReadKeyMicroMemory: ; SendInfo(Word, Pointer, Word) -> void ; tool 0x0909, set 0x09 (AppleDeskBus) + .section .text.SendInfo,"ax" .globl SendInfo SendInfo: ; --- stash arg0 (in A) --- @@ -226,7 +236,7 @@ SendInfo: lda 0xE0 pha ; --- arg1 (Pointer, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -239,32 +249,34 @@ SendInfo: ; SetAbsScale(ScaleRecPtr) -> void ; tool 0x1209, set 0x09 (AppleDeskBus) + .section .text.SetAbsScale,"ax" .globl SetAbsScale SetAbsScale: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1209 jsl 0xe10000 rtl ; SRQPoll(Pointer, Word) -> void ; tool 0x1409, set 0x09 (AppleDeskBus) + .section .text.SRQPoll,"ax" .globl SRQPoll SRQPoll: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -274,6 +286,7 @@ SRQPoll: ; SyncADBReceive(Word, Pointer, Word) -> void ; tool 0x0E09, set 0x09 (AppleDeskBus) + .section .text.SyncADBReceive,"ax" .globl SyncADBReceive SyncADBReceive: ; --- stash arg0 (in A) --- @@ -282,7 +295,7 @@ SyncADBReceive: lda 0xE0 pha ; --- arg1 (Pointer, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -295,6 +308,7 @@ SyncADBReceive: ; CtlStartUp(Word, Word) -> void ; tool 0x0210, set 0x10 (ControlManager) + .section .text.CtlStartUp,"ax" .globl CtlStartUp CtlStartUp: ; --- stash arg0 (in A) --- @@ -311,22 +325,24 @@ CtlStartUp: ; DisposeControl(CtlRecHndl) -> void ; tool 0x0A10, set 0x10 (ControlManager) + .section .text.DisposeControl,"ax" .globl DisposeControl DisposeControl: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0A10 jsl 0xe10000 rtl ; DragControl(Integer, Integer, Rect, Rect, Word, CtlRecHndl) -> void ; tool 0x1710, set 0x10 (ControlManager) + .section .text.DragControl,"ax" .globl DragControl DragControl: ; --- stash arg0 (in A) --- @@ -338,12 +354,12 @@ DragControl: lda 6, s pha ; --- arg2 (Rect, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha ; --- arg3 (Rect, 4B) --- - lda 18, s + lda 20, s pha lda 20, s pha @@ -351,7 +367,7 @@ DragControl: lda 26, s pha ; --- arg5 (CtlRecHndl, 4B) --- - lda 30, s + lda 32, s pha lda 32, s pha @@ -361,6 +377,7 @@ DragControl: ; DragRect(VoidProcPtr, Pattern, Integer, Integer, Rect, Rect, Rect, Word) -> Point ; tool 0x1D10, set 0x10 (ControlManager) + .section .text.DragRect,"ax" .globl DragRect DragRect: ; --- stash arg0 (in A/X) --- @@ -370,12 +387,12 @@ DragRect: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Pattern, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -386,17 +403,17 @@ DragRect: lda 24, s pha ; --- arg4 (Rect, 4B) --- - lda 28, s + lda 30, s pha lda 30, s pha ; --- arg5 (Rect, 4B) --- - lda 36, s + lda 38, s pha lda 38, s pha ; --- arg6 (Rect, 4B) --- - lda 44, s + lda 46, s pha lda 46, s pha @@ -411,54 +428,58 @@ DragRect: ; DrawControls(GrafPortPtr) -> void ; tool 0x1010, set 0x10 (ControlManager) + .section .text.DrawControls,"ax" .globl DrawControls DrawControls: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1010 jsl 0xe10000 rtl ; DrawOneCtl(CtlRecHndl) -> void ; tool 0x2510, set 0x10 (ControlManager) + .section .text.DrawOneCtl,"ax" .globl DrawOneCtl DrawOneCtl: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2510 jsl 0xe10000 rtl ; EraseControl(CtlRecHndl) -> void ; tool 0x2410, set 0x10 (ControlManager) + .section .text.EraseControl,"ax" .globl EraseControl EraseControl: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2410 jsl 0xe10000 rtl ; FindControl(CtlRecHndl, Integer, Integer, GrafPortPtr) -> Word ; tool 0x1310, set 0x10 (ControlManager) + .section .text.FindControl,"ax" .globl FindControl FindControl: ; --- stash arg0 (in A/X) --- @@ -467,10 +488,10 @@ FindControl: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Integer, 2B) --- lda 10, s pha @@ -478,7 +499,7 @@ FindControl: lda 14, s pha ; --- arg3 (GrafPortPtr, 4B) --- - lda 18, s + lda 20, s pha lda 20, s pha @@ -489,6 +510,7 @@ FindControl: ; GetCtlAction(CtlRecHndl) -> LongProcPtr ; tool 0x2110, set 0x10 (ControlManager) + .section .text.GetCtlAction,"ax" .globl GetCtlAction GetCtlAction: ; --- stash arg0 (in A/X) --- @@ -498,10 +520,10 @@ GetCtlAction: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2110 jsl 0xe10000 pla ; result lo -> A @@ -510,6 +532,7 @@ GetCtlAction: ; GetCtlParams(CtlRecHndl) -> LongWord ; tool 0x1C10, set 0x10 (ControlManager) + .section .text.GetCtlParams,"ax" .globl GetCtlParams GetCtlParams: ; --- stash arg0 (in A/X) --- @@ -519,10 +542,10 @@ GetCtlParams: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1C10 jsl 0xe10000 pla ; result lo -> A @@ -531,6 +554,7 @@ GetCtlParams: ; GetCtlRefCon(CtlRecHndl) -> LongWord ; tool 0x2310, set 0x10 (ControlManager) + .section .text.GetCtlRefCon,"ax" .globl GetCtlRefCon GetCtlRefCon: ; --- stash arg0 (in A/X) --- @@ -540,10 +564,10 @@ GetCtlRefCon: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2310 jsl 0xe10000 pla ; result lo -> A @@ -552,6 +576,7 @@ GetCtlRefCon: ; GetCtlTitle(CtlRecHndl) -> Pointer ; tool 0x0D10, set 0x10 (ControlManager) + .section .text.GetCtlTitle,"ax" .globl GetCtlTitle GetCtlTitle: ; --- stash arg0 (in A/X) --- @@ -561,10 +586,10 @@ GetCtlTitle: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0D10 jsl 0xe10000 pla ; result lo -> A @@ -573,6 +598,7 @@ GetCtlTitle: ; GetCtlValue(CtlRecHndl) -> Word ; tool 0x1A10, set 0x10 (ControlManager) + .section .text.GetCtlValue,"ax" .globl GetCtlValue GetCtlValue: ; --- stash arg0 (in A/X) --- @@ -581,10 +607,10 @@ GetCtlValue: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1A10 jsl 0xe10000 pla ; result -> A @@ -592,6 +618,7 @@ GetCtlValue: ; GrowSize(void) -> LongWord ; tool 0x1E10, set 0x10 (ControlManager) + .section .text.GrowSize,"ax" .globl GrowSize GrowSize: ; --- result space (4 bytes) --- @@ -605,22 +632,24 @@ GrowSize: ; HideControl(CtlRecHndl) -> void ; tool 0x0E10, set 0x10 (ControlManager) + .section .text.HideControl,"ax" .globl HideControl HideControl: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0E10 jsl 0xe10000 rtl ; HiliteControl(Word, CtlRecHndl) -> void ; tool 0x1110, set 0x10 (ControlManager) + .section .text.HiliteControl,"ax" .globl HiliteControl HiliteControl: ; --- stash arg0 (in A) --- @@ -629,7 +658,7 @@ HiliteControl: lda 0xE0 pha ; --- arg1 (CtlRecHndl, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -639,22 +668,24 @@ HiliteControl: ; KillControls(GrafPortPtr) -> void ; tool 0x0B10, set 0x10 (ControlManager) + .section .text.KillControls,"ax" .globl KillControls KillControls: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0B10 jsl 0xe10000 rtl ; MoveControl(Integer, Integer, CtlRecHndl) -> void ; tool 0x1610, set 0x10 (ControlManager) + .section .text.MoveControl,"ax" .globl MoveControl MoveControl: ; --- stash arg0 (in A) --- @@ -666,7 +697,7 @@ MoveControl: lda 6, s pha ; --- arg2 (CtlRecHndl, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -676,6 +707,7 @@ MoveControl: ; NewControl(GrafPortPtr, Rect, Pointer, Word, Word, Word, Word, LongProcPtr, Longint, Pointer) -> CtlRecHndl ; tool 0x0910, set 0x10 (ControlManager) + .section .text.NewControl,"ax" .globl NewControl NewControl: ; --- stash arg0 (in A/X) --- @@ -685,17 +717,17 @@ NewControl: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Rect, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha ; --- arg2 (Pointer, 4B) --- - lda 20, s + lda 22, s pha lda 22, s pha @@ -712,17 +744,17 @@ NewControl: lda 40, s pha ; --- arg7 (LongProcPtr, 4B) --- - lda 44, s + lda 46, s pha lda 46, s pha ; --- arg8 (Longint, 4B) --- - lda 52, s + lda 54, s pha lda 54, s pha ; --- arg9 (Pointer, 4B) --- - lda 60, s + lda 62, s pha lda 62, s pha @@ -734,18 +766,19 @@ NewControl: ; SetCtlAction(LongProcPtr, CtlRecHndl) -> void ; tool 0x2010, set 0x10 (ControlManager) + .section .text.SetCtlAction,"ax" .globl SetCtlAction SetCtlAction: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (CtlRecHndl, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -755,6 +788,7 @@ SetCtlAction: ; SetCtlIcons(FontHndl) -> FontHndl ; tool 0x1810, set 0x10 (ControlManager) + .section .text.SetCtlIcons,"ax" .globl SetCtlIcons SetCtlIcons: ; --- stash arg0 (in A/X) --- @@ -764,10 +798,10 @@ SetCtlIcons: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1810 jsl 0xe10000 pla ; result lo -> A @@ -776,6 +810,7 @@ SetCtlIcons: ; SetCtlParams(Word, Word, CtlRecHndl) -> void ; tool 0x1B10, set 0x10 (ControlManager) + .section .text.SetCtlParams,"ax" .globl SetCtlParams SetCtlParams: ; --- stash arg0 (in A) --- @@ -787,7 +822,7 @@ SetCtlParams: lda 6, s pha ; --- arg2 (CtlRecHndl, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -797,18 +832,19 @@ SetCtlParams: ; SetCtlRefCon(Longint, CtlRecHndl) -> void ; tool 0x2210, set 0x10 (ControlManager) + .section .text.SetCtlRefCon,"ax" .globl SetCtlRefCon SetCtlRefCon: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (CtlRecHndl, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -818,18 +854,19 @@ SetCtlRefCon: ; SetCtlTitle(Pointer, Handle) -> void ; tool 0x0C10, set 0x10 (ControlManager) + .section .text.SetCtlTitle,"ax" .globl SetCtlTitle SetCtlTitle: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Handle, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -839,6 +876,7 @@ SetCtlTitle: ; SetCtlValue(Word, CtlRecHndl) -> void ; tool 0x1910, set 0x10 (ControlManager) + .section .text.SetCtlValue,"ax" .globl SetCtlValue SetCtlValue: ; --- stash arg0 (in A) --- @@ -847,7 +885,7 @@ SetCtlValue: lda 0xE0 pha ; --- arg1 (CtlRecHndl, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -857,22 +895,24 @@ SetCtlValue: ; ShowControl(CtlRecHndl) -> void ; tool 0x0F10, set 0x10 (ControlManager) + .section .text.ShowControl,"ax" .globl ShowControl ShowControl: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0F10 jsl 0xe10000 rtl ; TestControl(Integer, Integer, CtlRecHndl) -> Word ; tool 0x1410, set 0x10 (ControlManager) + .section .text.TestControl,"ax" .globl TestControl TestControl: ; --- stash arg0 (in A) --- @@ -886,7 +926,7 @@ TestControl: lda 8, s pha ; --- arg2 (CtlRecHndl, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -897,6 +937,7 @@ TestControl: ; TrackControl(Integer, Integer, LongProcPtr, CtlRecHndl) -> Word ; tool 0x1510, set 0x10 (ControlManager) + .section .text.TrackControl,"ax" .globl TrackControl TrackControl: ; --- stash arg0 (in A) --- @@ -910,12 +951,12 @@ TrackControl: lda 8, s pha ; --- arg2 (LongProcPtr, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha ; --- arg3 (CtlRecHndl, 4B) --- - lda 20, s + lda 22, s pha lda 22, s pha @@ -926,6 +967,7 @@ TrackControl: ; CallCtlDefProc(CtlRecHndl, Word, Long) -> LongWord ; tool 0x2C10, set 0x10 (ControlManager) + .section .text.CallCtlDefProc,"ax" .globl CallCtlDefProc CallCtlDefProc: ; --- stash arg0 (in A/X) --- @@ -935,15 +977,15 @@ CallCtlDefProc: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 12, s pha ; --- arg2 (Long, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -955,6 +997,7 @@ CallCtlDefProc: ; CMLoadResource(Word, Long) -> Handle ; tool 0x3210, set 0x10 (ControlManager) + .section .text.CMLoadResource,"ax" .globl CMLoadResource CMLoadResource: ; --- stash arg0 (in A) --- @@ -966,7 +1009,7 @@ CMLoadResource: lda 0xE0 pha ; --- arg1 (Long, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -978,6 +1021,7 @@ CMLoadResource: ; CMReleaseResource(Word, Long) -> void ; tool 0x3310, set 0x10 (ControlManager) + .section .text.CMReleaseResource,"ax" .globl CMReleaseResource CMReleaseResource: ; --- stash arg0 (in A) --- @@ -986,7 +1030,7 @@ CMReleaseResource: lda 0xE0 pha ; --- arg1 (Long, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -996,6 +1040,7 @@ CMReleaseResource: ; FindTargetCtl(void) -> CtlRecHndl ; tool 0x2610, set 0x10 (ControlManager) + .section .text.FindTargetCtl,"ax" .globl FindTargetCtl FindTargetCtl: ; --- result space (4 bytes) --- @@ -1009,6 +1054,7 @@ FindTargetCtl: ; GetCtlHandleFromID(WindowPtr, Long) -> CtlRecHndl ; tool 0x3010, set 0x10 (ControlManager) + .section .text.GetCtlHandleFromID,"ax" .globl GetCtlHandleFromID GetCtlHandleFromID: ; --- stash arg0 (in A/X) --- @@ -1018,12 +1064,12 @@ GetCtlHandleFromID: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Long, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -1035,6 +1081,7 @@ GetCtlHandleFromID: ; GetCtlID(CtlRecHndl) -> LongWord ; tool 0x2A10, set 0x10 (ControlManager) + .section .text.GetCtlID,"ax" .globl GetCtlID GetCtlID: ; --- stash arg0 (in A/X) --- @@ -1044,10 +1091,10 @@ GetCtlID: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2A10 jsl 0xe10000 pla ; result lo -> A @@ -1056,6 +1103,7 @@ GetCtlID: ; GetCtlMoreFlags(CtlRecHndl) -> Word ; tool 0x2E10, set 0x10 (ControlManager) + .section .text.GetCtlMoreFlags,"ax" .globl GetCtlMoreFlags GetCtlMoreFlags: ; --- stash arg0 (in A/X) --- @@ -1064,10 +1112,10 @@ GetCtlMoreFlags: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2E10 jsl 0xe10000 pla ; result -> A @@ -1075,6 +1123,7 @@ GetCtlMoreFlags: ; GetCtlParamPtr(void) -> Pointer ; tool 0x3510, set 0x10 (ControlManager) + .section .text.GetCtlParamPtr,"ax" .globl GetCtlParamPtr GetCtlParamPtr: ; --- result space (4 bytes) --- @@ -1088,22 +1137,24 @@ GetCtlParamPtr: ; InvalCtls(WindowPtr) -> void ; tool 0x3710, set 0x10 (ControlManager) + .section .text.InvalCtls,"ax" .globl InvalCtls InvalCtls: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x3710 jsl 0xe10000 rtl ; MakeNextCtlTarget(void) -> CtlRecHndl ; tool 0x2710, set 0x10 (ControlManager) + .section .text.MakeNextCtlTarget,"ax" .globl MakeNextCtlTarget MakeNextCtlTarget: ; --- result space (4 bytes) --- @@ -1117,22 +1168,24 @@ MakeNextCtlTarget: ; MakeThisCtlTarget(CtlRecHndl) -> void ; tool 0x2810, set 0x10 (ControlManager) + .section .text.MakeThisCtlTarget,"ax" .globl MakeThisCtlTarget MakeThisCtlTarget: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2810 jsl 0xe10000 rtl ; NewControl2(WindowPtr, Word, Ref) -> CtlRecHndl ; tool 0x3110, set 0x10 (ControlManager) + .section .text.NewControl2,"ax" .globl NewControl2 NewControl2: ; --- stash arg0 (in A/X) --- @@ -1142,15 +1195,15 @@ NewControl2: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 12, s pha ; --- arg2 (Ref, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -1162,6 +1215,7 @@ NewControl2: ; NotifyControls(Word, Word, Long, WindowPtr) -> void ; tool 0x2D10, set 0x10 (ControlManager) + .section .text.NotifyControls,"ax" .globl NotifyControls NotifyControls: ; --- stash arg0 (in A) --- @@ -1173,12 +1227,12 @@ NotifyControls: lda 6, s pha ; --- arg2 (Long, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha ; --- arg3 (WindowPtr, 4B) --- - lda 18, s + lda 20, s pha lda 20, s pha @@ -1188,6 +1242,7 @@ NotifyControls: ; NotifyCtls(Word, Word, Long, WindowPtr) -> void ; tool 0x2D10, set 0x10 (ControlManager) + .section .text.NotifyCtls,"ax" .globl NotifyCtls NotifyCtls: ; --- stash arg0 (in A) --- @@ -1199,12 +1254,12 @@ NotifyCtls: lda 6, s pha ; --- arg2 (Long, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha ; --- arg3 (WindowPtr, 4B) --- - lda 18, s + lda 20, s pha lda 20, s pha @@ -1214,6 +1269,7 @@ NotifyCtls: ; SendEventToCtl(Boolean, WindowPtr, EventRecordPtr) -> Boolean ; tool 0x2910, set 0x10 (ControlManager) + .section .text.SendEventToCtl,"ax" .globl SendEventToCtl SendEventToCtl: ; --- stash arg0 (in A) --- @@ -1224,12 +1280,12 @@ SendEventToCtl: lda 0xE0 pha ; --- arg1 (WindowPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (EventRecordPtr, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -1240,18 +1296,19 @@ SendEventToCtl: ; SetCtlID(Long, CtlRecHndl) -> void ; tool 0x2B10, set 0x10 (ControlManager) + .section .text.SetCtlID,"ax" .globl SetCtlID SetCtlID: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (CtlRecHndl, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -1261,6 +1318,7 @@ SetCtlID: ; SetCtlMoreFlags(Word, CtlRecHndl) -> void ; tool 0x2F10, set 0x10 (ControlManager) + .section .text.SetCtlMoreFlags,"ax" .globl SetCtlMoreFlags SetCtlMoreFlags: ; --- stash arg0 (in A) --- @@ -1269,7 +1327,7 @@ SetCtlMoreFlags: lda 0xE0 pha ; --- arg1 (CtlRecHndl, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -1279,22 +1337,24 @@ SetCtlMoreFlags: ; SetCtlParamPtr(Pointer) -> void ; tool 0x3410, set 0x10 (ControlManager) + .section .text.SetCtlParamPtr,"ax" .globl SetCtlParamPtr SetCtlParamPtr: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x3410 jsl 0xe10000 rtl ; FindRadioButton(WindowPtr, Word) -> Word ; tool 0x3910, set 0x10 (ControlManager) + .section .text.FindRadioButton,"ax" .globl FindRadioButton FindRadioButton: ; --- stash arg0 (in A/X) --- @@ -1303,10 +1363,10 @@ FindRadioButton: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 10, s pha @@ -1317,23 +1377,24 @@ FindRadioButton: ; GetLETextByID(WindowPtr, Long, StringPtr) -> void ; tool 0x3B10, set 0x10 (ControlManager) + .section .text.GetLETextByID,"ax" .globl GetLETextByID GetLETextByID: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Long, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (StringPtr, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -1343,23 +1404,24 @@ GetLETextByID: ; SetLETextByID(WindowPtr, Long, StringPtr) -> void ; tool 0x3A10, set 0x10 (ControlManager) + .section .text.SetLETextByID,"ax" .globl SetLETextByID SetLETextByID: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Long, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (StringPtr, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -1369,6 +1431,7 @@ SetLETextByID: ; SetCtlValueByID(Word, GrafPortPtr, Long) -> void ; tool 0x3C10, set 0x10 (ControlManager) + .section .text.SetCtlValueByID,"ax" .globl SetCtlValueByID SetCtlValueByID: ; --- stash arg0 (in A) --- @@ -1377,12 +1440,12 @@ SetCtlValueByID: lda 0xE0 pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha ; --- arg2 (Long, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -1392,6 +1455,7 @@ SetCtlValueByID: ; GetCtlValueByID(GrafPortPtr, Long) -> Word ; tool 0x3D10, set 0x10 (ControlManager) + .section .text.GetCtlValueByID,"ax" .globl GetCtlValueByID GetCtlValueByID: ; --- stash arg0 (in A/X) --- @@ -1400,12 +1464,12 @@ GetCtlValueByID: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Long, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -1416,18 +1480,19 @@ GetCtlValueByID: ; InvalOneCtlByID(GrafPortPtr, Long) -> void ; tool 0x3E10, set 0x10 (ControlManager) + .section .text.InvalOneCtlByID,"ax" .globl InvalOneCtlByID InvalOneCtlByID: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Long, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -1437,6 +1502,7 @@ InvalOneCtlByID: ; HiliteCtlByID(Word, GrafPortPtr, Long) -> void ; tool 0x3F10, set 0x10 (ControlManager) + .section .text.HiliteCtlByID,"ax" .globl HiliteCtlByID HiliteCtlByID: ; --- stash arg0 (in A) --- @@ -1445,12 +1511,12 @@ HiliteCtlByID: lda 0xE0 pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha ; --- arg2 (Long, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -1460,38 +1526,41 @@ HiliteCtlByID: ; CloseNDAbyWinPtr(GrafPortPtr) -> void ; tool 0x1C05, set 0x05 (DeskManager) + .section .text.CloseNDAbyWinPtr,"ax" .globl CloseNDAbyWinPtr CloseNDAbyWinPtr: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1C05 jsl 0xe10000 rtl ; CloseNDAByWinPtr(GrafPortPtr) -> void ; tool 0x1C05, set 0x05 (DeskManager) + .section .text.CloseNDAByWinPtr,"ax" .globl CloseNDAByWinPtr CloseNDAByWinPtr: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1C05 jsl 0xe10000 rtl ; GetDAStrPtr(void) -> Pointer ; tool 0x1405, set 0x05 (DeskManager) + .section .text.GetDAStrPtr,"ax" .globl GetDAStrPtr GetDAStrPtr: ; --- result space (4 bytes) --- @@ -1505,50 +1574,53 @@ GetDAStrPtr: ; InstallCDA(Handle) -> void ; tool 0x0F05, set 0x05 (DeskManager) + .section .text.InstallCDA,"ax" .globl InstallCDA InstallCDA: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0F05 jsl 0xe10000 rtl ; InstallNDA(Handle) -> void ; tool 0x0E05, set 0x05 (DeskManager) + .section .text.InstallNDA,"ax" .globl InstallNDA InstallNDA: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0E05 jsl 0xe10000 rtl ; SetDAStrPtr(Handle, Pointer) -> void ; tool 0x1305, set 0x05 (DeskManager) + .section .text.SetDAStrPtr,"ax" .globl SetDAStrPtr SetDAStrPtr: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Pointer, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -1558,18 +1630,19 @@ SetDAStrPtr: ; SystemClick(EventRecordPtr, GrafPortPtr, Word) -> void ; tool 0x1705, set 0x05 (DeskManager) + .section .text.SystemClick,"ax" .globl SystemClick SystemClick: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -1582,6 +1655,7 @@ SystemClick: ; SystemEvent(Word, Long, Long, Point, Word) -> Boolean ; tool 0x1A05, set 0x05 (DeskManager) + .section .text.SystemEvent,"ax" .globl SystemEvent SystemEvent: ; --- stash arg0 (in A) --- @@ -1592,17 +1666,17 @@ SystemEvent: lda 0xE0 pha ; --- arg1 (Long, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (Long, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha ; --- arg3 (Point, 4B) --- - lda 24, s + lda 26, s pha lda 26, s pha @@ -1616,70 +1690,75 @@ SystemEvent: ; AddToRunQ(Pointer) -> void ; tool 0x1F05, set 0x05 (DeskManager) + .section .text.AddToRunQ,"ax" .globl AddToRunQ AddToRunQ: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1F05 jsl 0xe10000 rtl ; RemoveCDA(Handle) -> void ; tool 0x2105, set 0x05 (DeskManager) + .section .text.RemoveCDA,"ax" .globl RemoveCDA RemoveCDA: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2105 jsl 0xe10000 rtl ; RemoveFromRunQ(Pointer) -> void ; tool 0x2005, set 0x05 (DeskManager) + .section .text.RemoveFromRunQ,"ax" .globl RemoveFromRunQ RemoveFromRunQ: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2005 jsl 0xe10000 rtl ; RemoveNDA(Handle) -> void ; tool 0x2205, set 0x05 (DeskManager) + .section .text.RemoveNDA,"ax" .globl RemoveNDA RemoveNDA: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2205 jsl 0xe10000 rtl ; CallDeskAcc(Word, Long, Word, Long) -> Word ; tool 0x2405, set 0x05 (DeskManager) + .section .text.CallDeskAcc,"ax" .globl CallDeskAcc CallDeskAcc: ; --- stash arg0 (in A) --- @@ -1690,7 +1769,7 @@ CallDeskAcc: lda 0xE0 pha ; --- arg1 (Long, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -1698,7 +1777,7 @@ CallDeskAcc: lda 16, s pha ; --- arg3 (Long, 4B) --- - lda 20, s + lda 22, s pha lda 22, s pha @@ -1709,6 +1788,7 @@ CallDeskAcc: ; GetDeskAccInfo(Word, Long, Word, Ptr) -> void ; tool 0x2305, set 0x05 (DeskManager) + .section .text.GetDeskAccInfo,"ax" .globl GetDeskAccInfo GetDeskAccInfo: ; --- stash arg0 (in A) --- @@ -1717,7 +1797,7 @@ GetDeskAccInfo: lda 0xE0 pha ; --- arg1 (Long, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -1725,7 +1805,7 @@ GetDeskAccInfo: lda 14, s pha ; --- arg3 (Ptr, 4B) --- - lda 18, s + lda 20, s pha lda 20, s pha @@ -1735,6 +1815,7 @@ GetDeskAccInfo: ; GetDeskGlobal(Word) -> LongWord ; tool 0x2505, set 0x05 (DeskManager) + .section .text.GetDeskGlobal,"ax" .globl GetDeskGlobal GetDeskGlobal: ; --- stash arg0 (in A) --- @@ -1753,6 +1834,7 @@ GetDeskGlobal: ; Alert(AlertTempPtr, WordProcPtr) -> Word ; tool 0x1715, set 0x15 (DialogManager) + .section .text.Alert,"ax" .globl Alert Alert: ; --- stash arg0 (in A/X) --- @@ -1761,12 +1843,12 @@ Alert: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (WordProcPtr, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -1777,6 +1859,7 @@ Alert: ; CautionAlert(AlertTempPtr, WordProcPtr) -> Word ; tool 0x1A15, set 0x15 (DialogManager) + .section .text.CautionAlert,"ax" .globl CautionAlert CautionAlert: ; --- stash arg0 (in A/X) --- @@ -1785,12 +1868,12 @@ CautionAlert: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (WordProcPtr, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -1801,22 +1884,24 @@ CautionAlert: ; CloseDialog(GrafPortPtr) -> void ; tool 0x0C15, set 0x15 (DialogManager) + .section .text.CloseDialog,"ax" .globl CloseDialog CloseDialog: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0C15 jsl 0xe10000 rtl ; DefaultFilter(GrafPortPtr, EventRecordPtr, Word) -> Boolean ; tool 0x3615, set 0x15 (DialogManager) + .section .text.DefaultFilter,"ax" .globl DefaultFilter DefaultFilter: ; --- stash arg0 (in A/X) --- @@ -1825,12 +1910,12 @@ DefaultFilter: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (EventRecordPtr, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -1844,6 +1929,7 @@ DefaultFilter: ; DialogSelect(EventRecordPtr, GrafPortPtr, Word) -> Boolean ; tool 0x1115, set 0x15 (DialogManager) + .section .text.DialogSelect,"ax" .globl DialogSelect DialogSelect: ; --- stash arg0 (in A/X) --- @@ -1852,12 +1938,12 @@ DialogSelect: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -1871,16 +1957,17 @@ DialogSelect: ; DisableDItem(GrafPortPtr, Word) -> void ; tool 0x3915, set 0x15 (DialogManager) + .section .text.DisableDItem,"ax" .globl DisableDItem DisableDItem: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -1890,96 +1977,102 @@ DisableDItem: ; DlgCopy(GrafPortPtr) -> void ; tool 0x1315, set 0x15 (DialogManager) + .section .text.DlgCopy,"ax" .globl DlgCopy DlgCopy: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1315 jsl 0xe10000 rtl ; DlgCut(GrafPortPtr) -> void ; tool 0x1215, set 0x15 (DialogManager) + .section .text.DlgCut,"ax" .globl DlgCut DlgCut: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1215 jsl 0xe10000 rtl ; DlgDelete(GrafPortPtr) -> void ; tool 0x1515, set 0x15 (DialogManager) + .section .text.DlgDelete,"ax" .globl DlgDelete DlgDelete: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1515 jsl 0xe10000 rtl ; DlgPaste(GrafPortPtr) -> void ; tool 0x1415, set 0x15 (DialogManager) + .section .text.DlgPaste,"ax" .globl DlgPaste DlgPaste: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1415 jsl 0xe10000 rtl ; DrawDialog(GrafPortPtr) -> void ; tool 0x1615, set 0x15 (DialogManager) + .section .text.DrawDialog,"ax" .globl DrawDialog DrawDialog: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1615 jsl 0xe10000 rtl ; EnableDItem(GrafPortPtr, Word) -> void ; tool 0x3A15, set 0x15 (DialogManager) + .section .text.EnableDItem,"ax" .globl EnableDItem EnableDItem: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -1989,22 +2082,24 @@ EnableDItem: ; ErrorSound(VoidProcPtr) -> void ; tool 0x0915, set 0x15 (DialogManager) + .section .text.ErrorSound,"ax" .globl ErrorSound ErrorSound: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0915 jsl 0xe10000 rtl ; FindDItem(GrafPortPtr, Point) -> Word ; tool 0x2415, set 0x15 (DialogManager) + .section .text.FindDItem,"ax" .globl FindDItem FindDItem: ; --- stash arg0 (in A/X) --- @@ -2013,12 +2108,12 @@ FindDItem: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Point, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -2029,6 +2124,7 @@ FindDItem: ; GetControlDItem(GrafPortPtr, Word) -> CtlRecHndl ; tool 0x1E15, set 0x15 (DialogManager) + .section .text.GetControlDItem,"ax" .globl GetControlDItem GetControlDItem: ; --- stash arg0 (in A/X) --- @@ -2038,10 +2134,10 @@ GetControlDItem: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 12, s pha @@ -2053,6 +2149,7 @@ GetControlDItem: ; GetDefButton(GrafPortPtr) -> Word ; tool 0x3715, set 0x15 (DialogManager) + .section .text.GetDefButton,"ax" .globl GetDefButton GetDefButton: ; --- stash arg0 (in A/X) --- @@ -2061,10 +2158,10 @@ GetDefButton: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x3715 jsl 0xe10000 pla ; result -> A @@ -2072,21 +2169,22 @@ GetDefButton: ; GetDItemBox(GrafPortPtr, Word, Rect) -> void ; tool 0x2815, set 0x15 (DialogManager) + .section .text.GetDItemBox,"ax" .globl GetDItemBox GetDItemBox: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha ; --- arg2 (Rect, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -2096,6 +2194,7 @@ GetDItemBox: ; GetDItemType(GrafPortPtr, Word) -> Word ; tool 0x2615, set 0x15 (DialogManager) + .section .text.GetDItemType,"ax" .globl GetDItemType GetDItemType: ; --- stash arg0 (in A/X) --- @@ -2104,10 +2203,10 @@ GetDItemType: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 10, s pha @@ -2118,6 +2217,7 @@ GetDItemType: ; GetDItemValue(GrafPortPtr, Word) -> Word ; tool 0x2E15, set 0x15 (DialogManager) + .section .text.GetDItemValue,"ax" .globl GetDItemValue GetDItemValue: ; --- stash arg0 (in A/X) --- @@ -2126,10 +2226,10 @@ GetDItemValue: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 10, s pha @@ -2140,6 +2240,7 @@ GetDItemValue: ; GetFirstDItem(GrafPortPtr) -> Word ; tool 0x2A15, set 0x15 (DialogManager) + .section .text.GetFirstDItem,"ax" .globl GetFirstDItem GetFirstDItem: ; --- stash arg0 (in A/X) --- @@ -2148,10 +2249,10 @@ GetFirstDItem: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2A15 jsl 0xe10000 pla ; result -> A @@ -2159,21 +2260,22 @@ GetFirstDItem: ; GetIText(GrafPortPtr, Word, Pointer) -> void ; tool 0x1F15, set 0x15 (DialogManager) + .section .text.GetIText,"ax" .globl GetIText GetIText: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha ; --- arg2 (Pointer, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -2183,18 +2285,19 @@ GetIText: ; GetNewDItem(GrafPortPtr, ItemTempPtr) -> void ; tool 0x3315, set 0x15 (DialogManager) + .section .text.GetNewDItem,"ax" .globl GetNewDItem GetNewDItem: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (ItemTempPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -2204,6 +2307,7 @@ GetNewDItem: ; GetNewModalDialog(DlgTempPtr) -> DialogPtr ; tool 0x3215, set 0x15 (DialogManager) + .section .text.GetNewModalDialog,"ax" .globl GetNewModalDialog GetNewModalDialog: ; --- stash arg0 (in A/X) --- @@ -2213,10 +2317,10 @@ GetNewModalDialog: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x3215 jsl 0xe10000 pla ; result lo -> A @@ -2225,6 +2329,7 @@ GetNewModalDialog: ; GetNextDItem(GrafPortPtr, Word) -> Word ; tool 0x2B15, set 0x15 (DialogManager) + .section .text.GetNextDItem,"ax" .globl GetNextDItem GetNextDItem: ; --- stash arg0 (in A/X) --- @@ -2233,10 +2338,10 @@ GetNextDItem: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 10, s pha @@ -2247,16 +2352,17 @@ GetNextDItem: ; HideDItem(GrafPortPtr, Word) -> void ; tool 0x2215, set 0x15 (DialogManager) + .section .text.HideDItem,"ax" .globl HideDItem HideDItem: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -2266,6 +2372,7 @@ HideDItem: ; IsDialogEvent(EventRecordPtr) -> Boolean ; tool 0x1015, set 0x15 (DialogManager) + .section .text.IsDialogEvent,"ax" .globl IsDialogEvent IsDialogEvent: ; --- stash arg0 (in A/X) --- @@ -2274,10 +2381,10 @@ IsDialogEvent: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1015 jsl 0xe10000 pla ; result -> A @@ -2285,6 +2392,7 @@ IsDialogEvent: ; ModalDialog(WordProcPtr) -> Word ; tool 0x0F15, set 0x15 (DialogManager) + .section .text.ModalDialog,"ax" .globl ModalDialog ModalDialog: ; --- stash arg0 (in A/X) --- @@ -2293,10 +2401,10 @@ ModalDialog: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0F15 jsl 0xe10000 pla ; result -> A @@ -2304,6 +2412,7 @@ ModalDialog: ; ModalDialog2(WordProcPtr) -> LongWord ; tool 0x2C15, set 0x15 (DialogManager) + .section .text.ModalDialog2,"ax" .globl ModalDialog2 ModalDialog2: ; --- stash arg0 (in A/X) --- @@ -2313,10 +2422,10 @@ ModalDialog2: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2C15 jsl 0xe10000 pla ; result lo -> A @@ -2325,21 +2434,22 @@ ModalDialog2: ; NewDItem(GrafPortPtr, Word, Rect, Word, Pointer, Word, Word, Pointer) -> void ; tool 0x0D15, set 0x15 (DialogManager) + .section .text.NewDItem,"ax" .globl NewDItem NewDItem: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha ; --- arg2 (Rect, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -2347,7 +2457,7 @@ NewDItem: lda 20, s pha ; --- arg4 (Pointer, 4B) --- - lda 24, s + lda 26, s pha lda 26, s pha @@ -2358,7 +2468,7 @@ NewDItem: lda 36, s pha ; --- arg7 (Pointer, 4B) --- - lda 40, s + lda 42, s pha lda 42, s pha @@ -2368,6 +2478,7 @@ NewDItem: ; NewModalDialog(Rect, Boolean, LongWord) -> DialogPtr ; tool 0x0A15, set 0x15 (DialogManager) + .section .text.NewModalDialog,"ax" .globl NewModalDialog NewModalDialog: ; --- stash arg0 (in A/X) --- @@ -2377,15 +2488,15 @@ NewModalDialog: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Boolean, 2B) --- lda 12, s pha ; --- arg2 (LongWord, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -2397,6 +2508,7 @@ NewModalDialog: ; NewModelessDialog(Rect, Pointer, GrafPortPtr, Word, LongWord, Rect) -> DialogPtr ; tool 0x0B15, set 0x15 (DialogManager) + .section .text.NewModelessDialog,"ax" .globl NewModelessDialog NewModelessDialog: ; --- stash arg0 (in A/X) --- @@ -2406,17 +2518,17 @@ NewModelessDialog: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Pointer, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha ; --- arg2 (GrafPortPtr, 4B) --- - lda 20, s + lda 22, s pha lda 22, s pha @@ -2424,12 +2536,12 @@ NewModelessDialog: lda 28, s pha ; --- arg4 (LongWord, 4B) --- - lda 32, s + lda 34, s pha lda 34, s pha ; --- arg5 (Rect, 4B) --- - lda 40, s + lda 42, s pha lda 42, s pha @@ -2441,6 +2553,7 @@ NewModelessDialog: ; NoteAlert(AlertTempPtr, WordProcPtr) -> Word ; tool 0x1915, set 0x15 (DialogManager) + .section .text.NoteAlert,"ax" .globl NoteAlert NoteAlert: ; --- stash arg0 (in A/X) --- @@ -2449,12 +2562,12 @@ NoteAlert: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (WordProcPtr, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -2465,28 +2578,29 @@ NoteAlert: ; ParamText(Pointer, Pointer, Pointer, Pointer) -> void ; tool 0x1B15, set 0x15 (DialogManager) + .section .text.ParamText,"ax" .globl ParamText ParamText: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Pointer, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (Pointer, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha ; --- arg3 (Pointer, 4B) --- - lda 24, s + lda 26, s pha lda 26, s pha @@ -2496,16 +2610,17 @@ ParamText: ; RemoveDItem(GrafPortPtr, Word) -> void ; tool 0x0E15, set 0x15 (DialogManager) + .section .text.RemoveDItem,"ax" .globl RemoveDItem RemoveDItem: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -2515,16 +2630,17 @@ RemoveDItem: ; SelectIText(GrafPortPtr, Word, Word, Word) -> void ; tool 0x2115, set 0x15 (DialogManager) + .section .text.SelectIText,"ax" .globl SelectIText SelectIText: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -2540,16 +2656,17 @@ SelectIText: ; SelIText(GrafPortPtr, Word, Word, Word) -> void ; tool 0x2115, set 0x15 (DialogManager) + .section .text.SelIText,"ax" .globl SelIText SelIText: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -2565,22 +2682,24 @@ SelIText: ; SetDAFont(FontHndl) -> void ; tool 0x1C15, set 0x15 (DialogManager) + .section .text.SetDAFont,"ax" .globl SetDAFont SetDAFont: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1C15 jsl 0xe10000 rtl ; SetDefButton(Word, GrafPortPtr) -> void ; tool 0x3815, set 0x15 (DialogManager) + .section .text.SetDefButton,"ax" .globl SetDefButton SetDefButton: ; --- stash arg0 (in A) --- @@ -2589,7 +2708,7 @@ SetDefButton: lda 0xE0 pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -2599,21 +2718,22 @@ SetDefButton: ; SetDItemBox(GrafPortPtr, Word, Rect) -> void ; tool 0x2915, set 0x15 (DialogManager) + .section .text.SetDItemBox,"ax" .globl SetDItemBox SetDItemBox: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha ; --- arg2 (Rect, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -2623,6 +2743,7 @@ SetDItemBox: ; SetDItemType(Word, GrafPortPtr, Word) -> void ; tool 0x2715, set 0x15 (DialogManager) + .section .text.SetDItemType,"ax" .globl SetDItemType SetDItemType: ; --- stash arg0 (in A) --- @@ -2631,7 +2752,7 @@ SetDItemType: lda 0xE0 pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -2644,6 +2765,7 @@ SetDItemType: ; SetDItemValue(Word, GrafPortPtr, Word) -> void ; tool 0x2F15, set 0x15 (DialogManager) + .section .text.SetDItemValue,"ax" .globl SetDItemValue SetDItemValue: ; --- stash arg0 (in A) --- @@ -2652,7 +2774,7 @@ SetDItemValue: lda 0xE0 pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -2665,21 +2787,22 @@ SetDItemValue: ; SetIText(GrafPortPtr, Word, Pointer) -> void ; tool 0x2015, set 0x15 (DialogManager) + .section .text.SetIText,"ax" .globl SetIText SetIText: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha ; --- arg2 (Pointer, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -2689,16 +2812,17 @@ SetIText: ; ShowDItem(GrafPortPtr, Word) -> void ; tool 0x2315, set 0x15 (DialogManager) + .section .text.ShowDItem,"ax" .globl ShowDItem ShowDItem: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -2708,6 +2832,7 @@ ShowDItem: ; StopAlert(AlertTempPtr, WordProcPtr) -> Word ; tool 0x1815, set 0x15 (DialogManager) + .section .text.StopAlert,"ax" .globl StopAlert StopAlert: ; --- stash arg0 (in A/X) --- @@ -2716,12 +2841,12 @@ StopAlert: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (WordProcPtr, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -2732,18 +2857,19 @@ StopAlert: ; UpdateDialog(GrafPortPtr, Handle) -> void ; tool 0x2515, set 0x15 (DialogManager) + .section .text.UpdateDialog,"ax" .globl UpdateDialog UpdateDialog: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Handle, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -2753,6 +2879,7 @@ UpdateDialog: ; EMStartUp(Word, Word, Integer, Integer, Integer, Integer, Word) -> void ; tool 0x0206, set 0x06 (EventManager) + .section .text.EMStartUp,"ax" .globl EMStartUp EMStartUp: ; --- stash arg0 (in A) --- @@ -2784,6 +2911,7 @@ EMStartUp: ; EventAvail(Word, EventRecordPtr) -> Boolean ; tool 0x0B06, set 0x06 (EventManager) + .section .text.EventAvail,"ax" .globl EventAvail EventAvail: ; --- stash arg0 (in A) --- @@ -2794,7 +2922,7 @@ EventAvail: lda 0xE0 pha ; --- arg1 (EventRecordPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -2805,6 +2933,7 @@ EventAvail: ; FakeMouse(Word, Word, Integer, Integer, Word) -> void ; tool 0x1906, set 0x06 (EventManager) + .section .text.FakeMouse,"ax" .globl FakeMouse FakeMouse: ; --- stash arg0 (in A) --- @@ -2830,6 +2959,7 @@ FakeMouse: ; FlushEvents(Word, Word) -> Word ; tool 0x1506, set 0x06 (EventManager) + .section .text.FlushEvents,"ax" .globl FlushEvents FlushEvents: ; --- stash arg0 (in A) --- @@ -2849,6 +2979,7 @@ FlushEvents: ; GetCaretTime(void) -> LongWord ; tool 0x1206, set 0x06 (EventManager) + .section .text.GetCaretTime,"ax" .globl GetCaretTime GetCaretTime: ; --- result space (4 bytes) --- @@ -2862,6 +2993,7 @@ GetCaretTime: ; GetDblTime(void) -> LongWord ; tool 0x1106, set 0x06 (EventManager) + .section .text.GetDblTime,"ax" .globl GetDblTime GetDblTime: ; --- result space (4 bytes) --- @@ -2875,22 +3007,24 @@ GetDblTime: ; GetMouse(Point) -> void ; tool 0x0C06, set 0x06 (EventManager) + .section .text.GetMouse,"ax" .globl GetMouse GetMouse: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0C06 jsl 0xe10000 rtl ; GetNextEvent(Word, EventRecordPtr) -> Boolean ; tool 0x0A06, set 0x06 (EventManager) + .section .text.GetNextEvent,"ax" .globl GetNextEvent GetNextEvent: ; --- stash arg0 (in A) --- @@ -2901,7 +3035,7 @@ GetNextEvent: lda 0xE0 pha ; --- arg1 (EventRecordPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -2912,6 +3046,7 @@ GetNextEvent: ; GetOSEvent(Word, EventRecordPtr) -> Boolean ; tool 0x1606, set 0x06 (EventManager) + .section .text.GetOSEvent,"ax" .globl GetOSEvent GetOSEvent: ; --- stash arg0 (in A) --- @@ -2922,7 +3057,7 @@ GetOSEvent: lda 0xE0 pha ; --- arg1 (EventRecordPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -2933,6 +3068,7 @@ GetOSEvent: ; OSEventAvail(Word, EventRecordPtr) -> Boolean ; tool 0x1706, set 0x06 (EventManager) + .section .text.OSEventAvail,"ax" .globl OSEventAvail OSEventAvail: ; --- stash arg0 (in A) --- @@ -2943,7 +3079,7 @@ OSEventAvail: lda 0xE0 pha ; --- arg1 (EventRecordPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -2954,6 +3090,7 @@ OSEventAvail: ; PostEvent(Word, LongWord) -> Word ; tool 0x1406, set 0x06 (EventManager) + .section .text.PostEvent,"ax" .globl PostEvent PostEvent: ; --- stash arg0 (in A) --- @@ -2964,7 +3101,7 @@ PostEvent: lda 0xE0 pha ; --- arg1 (LongWord, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -2975,6 +3112,7 @@ PostEvent: ; TickCount(void) -> LongWord ; tool 0x1006, set 0x06 (EventManager) + .section .text.TickCount,"ax" .globl TickCount TickCount: ; --- result space (4 bytes) --- @@ -2988,6 +3126,7 @@ TickCount: ; FMStartUp(Word, Word) -> void ; tool 0x021B, set 0x1B (FontManager) + .section .text.FMStartUp,"ax" .globl FMStartUp FMStartUp: ; --- stash arg0 (in A) --- @@ -3004,6 +3143,7 @@ FMStartUp: ; AddFamily(Word, Pointer) -> void ; tool 0x0D1B, set 0x1B (FontManager) + .section .text.AddFamily,"ax" .globl AddFamily AddFamily: ; --- stash arg0 (in A) --- @@ -3012,7 +3152,7 @@ AddFamily: lda 0xE0 pha ; --- arg1 (Pointer, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -3022,16 +3162,17 @@ AddFamily: ; AddFontVar(FontHndl, Word) -> void ; tool 0x141B, set 0x1B (FontManager) + .section .text.AddFontVar,"ax" .globl AddFontVar AddFontVar: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -3041,6 +3182,7 @@ AddFontVar: ; ChooseFont(FontID, Word) -> LongWord ; tool 0x161B, set 0x1B (FontManager) + .section .text.ChooseFont,"ax" .globl ChooseFont ChooseFont: ; --- stash arg0 (in A/X) --- @@ -3050,10 +3192,10 @@ ChooseFont: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 12, s pha @@ -3065,6 +3207,7 @@ ChooseFont: ; CountFonts(FontID, Word) -> Word ; tool 0x101B, set 0x1B (FontManager) + .section .text.CountFonts,"ax" .globl CountFonts CountFonts: ; --- stash arg0 (in A/X) --- @@ -3073,10 +3216,10 @@ CountFonts: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 10, s pha @@ -3087,6 +3230,7 @@ CountFonts: ; FindFamily(Word, Word, Pointer) -> Word ; tool 0x0A1B, set 0x1B (FontManager) + .section .text.FindFamily,"ax" .globl FindFamily FindFamily: ; --- stash arg0 (in A) --- @@ -3100,7 +3244,7 @@ FindFamily: lda 8, s pha ; --- arg2 (Pointer, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -3111,16 +3255,17 @@ FindFamily: ; FindFontStats(FontID, Word, Word, FontStatRecPtr) -> void ; tool 0x111B, set 0x1B (FontManager) + .section .text.FindFontStats,"ax" .globl FindFontStats FindFontStats: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -3128,7 +3273,7 @@ FindFontStats: lda 12, s pha ; --- arg3 (FontStatRecPtr, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -3138,6 +3283,7 @@ FindFontStats: ; FixFontMenu(Word, Word, Word) -> void ; tool 0x151B, set 0x1B (FontManager) + .section .text.FixFontMenu,"ax" .globl FixFontMenu FixFontMenu: ; --- stash arg0 (in A) --- @@ -3157,6 +3303,7 @@ FixFontMenu: ; FMGetCurFID(void) -> LongWord ; tool 0x1A1B, set 0x1B (FontManager) + .section .text.FMGetCurFID,"ax" .globl FMGetCurFID FMGetCurFID: ; --- result space (4 bytes) --- @@ -3170,6 +3317,7 @@ FMGetCurFID: ; FMGetSysFID(void) -> LongWord ; tool 0x191B, set 0x1B (FontManager) + .section .text.FMGetSysFID,"ax" .globl FMGetSysFID FMGetSysFID: ; --- result space (4 bytes) --- @@ -3183,22 +3331,24 @@ FMGetSysFID: ; FMSetSysFont(FontID) -> void ; tool 0x181B, set 0x1B (FontManager) + .section .text.FMSetSysFont,"ax" .globl FMSetSysFont FMSetSysFont: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x181B jsl 0xe10000 rtl ; GetFamInfo(Word, Pointer) -> Word ; tool 0x0B1B, set 0x1B (FontManager) + .section .text.GetFamInfo,"ax" .globl GetFamInfo GetFamInfo: ; --- stash arg0 (in A) --- @@ -3209,7 +3359,7 @@ GetFamInfo: lda 0xE0 pha ; --- arg1 (Pointer, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -3220,6 +3370,7 @@ GetFamInfo: ; GetFamNum(Pointer) -> Word ; tool 0x0C1B, set 0x1B (FontManager) + .section .text.GetFamNum,"ax" .globl GetFamNum GetFamNum: ; --- stash arg0 (in A/X) --- @@ -3228,10 +3379,10 @@ GetFamNum: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0C1B jsl 0xe10000 pla ; result -> A @@ -3239,16 +3390,17 @@ GetFamNum: ; InstallFont(FontID, Word) -> void ; tool 0x0E1B, set 0x1B (FontManager) + .section .text.InstallFont,"ax" .globl InstallFont InstallFont: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -3258,16 +3410,17 @@ InstallFont: ; LoadFont(FontID, Word, Word, FontStatRecPtr) -> void ; tool 0x121B, set 0x1B (FontManager) + .section .text.LoadFont,"ax" .globl LoadFont LoadFont: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -3275,7 +3428,7 @@ LoadFont: lda 12, s pha ; --- arg3 (FontStatRecPtr, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -3285,16 +3438,17 @@ LoadFont: ; SetPurgeStat(FontID, Word) -> void ; tool 0x0F1B, set 0x1B (FontManager) + .section .text.SetPurgeStat,"ax" .globl SetPurgeStat SetPurgeStat: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -3304,21 +3458,22 @@ SetPurgeStat: ; InstallWithStats(FontID, Word, Pointer) -> void ; tool 0x1C1B, set 0x1B (FontManager) + .section .text.InstallWithStats,"ax" .globl InstallWithStats InstallWithStats: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha ; --- arg2 (Pointer, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -3328,54 +3483,58 @@ InstallWithStats: ; DebugStr(Pointer) -> void ; tool 0x09FF, set 0xFF (?) + .section .text.DebugStr,"ax" .globl DebugStr DebugStr: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x09FF jsl 0xe10000 rtl ; SetMileStone(Pointer) -> void ; tool 0x0AFF, set 0xFF (?) + .section .text.SetMileStone,"ax" .globl SetMileStone SetMileStone: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0AFF jsl 0xe10000 rtl ; DebugSetHook(VoidProcPtr) -> void ; tool 0x0BFF, set 0xFF (?) + .section .text.DebugSetHook,"ax" .globl DebugSetHook DebugSetHook: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0BFF jsl 0xe10000 rtl ; DebugGetInfo(Word) -> LongWord ; tool 0x0CFF, set 0xFF (?) + .section .text.DebugGetInfo,"ax" .globl DebugGetInfo DebugGetInfo: ; --- stash arg0 (in A) --- @@ -3394,6 +3553,7 @@ DebugGetInfo: ; EvalExpr(Str255) -> Handle ; tool 0x0002, set 0x02 (MemoryManager) + .section .text.EvalExpr,"ax" .globl EvalExpr EvalExpr: ; --- stash arg0 (in A/X) --- @@ -3403,10 +3563,10 @@ EvalExpr: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0002 jsl 0xe100a8 pla ; result lo -> A @@ -3415,38 +3575,41 @@ EvalExpr: ; SendCardMessage(Str255) -> void ; tool 0x0001, set 0x01 (ToolLocator) + .section .text.SendCardMessage,"ax" .globl SendCardMessage SendCardMessage: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0001 jsl 0xe100a8 rtl ; SendHCMessage(Str255) -> void ; tool 0x0005, set 0x05 (DeskManager) + .section .text.SendHCMessage,"ax" .globl SendHCMessage SendHCMessage: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0005 jsl 0xe100a8 rtl ; GetGlobal(Str255) -> Handle ; tool 0x0012, set 0x12 (QDAuxiliary) + .section .text.GetGlobal,"ax" .globl GetGlobal GetGlobal: ; --- stash arg0 (in A/X) --- @@ -3456,10 +3619,10 @@ GetGlobal: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0012 jsl 0xe100a8 pla ; result lo -> A @@ -3468,18 +3631,19 @@ GetGlobal: ; SetGlobal(Str255, Handle) -> void ; tool 0x0013, set 0x13 (PrintManager) + .section .text.SetGlobal,"ax" .globl SetGlobal SetGlobal: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Handle, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -3489,18 +3653,19 @@ SetGlobal: ; ZeroBytes(Ptr, long) -> void ; tool 0x0006, set 0x06 (EventManager) + .section .text.ZeroBytes,"ax" .globl ZeroBytes ZeroBytes: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (long, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -3510,6 +3675,7 @@ ZeroBytes: ; GSStringEqual(GSString255Hndl, GSString255Hndl) -> Boolean ; tool 0x0022, set 0x22 (TextEdit) + .section .text.GSStringEqual,"ax" .globl GSStringEqual GSStringEqual: ; --- stash arg0 (in A/X) --- @@ -3518,12 +3684,12 @@ GSStringEqual: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (GSString255Hndl, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -3534,38 +3700,41 @@ GSStringEqual: ; ScanToReturn(Ptr) -> void ; tool 0x001C, set 0x1C (ListManager) + .section .text.ScanToReturn,"ax" .globl ScanToReturn ScanToReturn: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x001C jsl 0xe100a8 rtl ; ScanToZero(Ptr) -> void ; tool 0x001D, set 0x1D (ACETools) + .section .text.ScanToZero,"ax" .globl ScanToZero ScanToZero: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x001D jsl 0xe100a8 rtl ; StringEqual(Str255, Str255) -> Boolean ; tool 0x001A, set 0x1A (NoteSequencer) + .section .text.StringEqual,"ax" .globl StringEqual StringEqual: ; --- stash arg0 (in A/X) --- @@ -3574,12 +3743,12 @@ StringEqual: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Str255, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -3590,6 +3759,7 @@ StringEqual: ; StringLength(Ptr) -> Longint ; tool 0x0003, set 0x03 (MiscTools) + .section .text.StringLength,"ax" .globl StringLength StringLength: ; --- stash arg0 (in A/X) --- @@ -3599,10 +3769,10 @@ StringLength: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0003 jsl 0xe100a8 pla ; result lo -> A @@ -3611,6 +3781,7 @@ StringLength: ; StringMatch(Str255, Ptr) -> Ptr ; tool 0x0004, set 0x04 (QuickDraw) + .section .text.StringMatch,"ax" .globl StringMatch StringMatch: ; --- stash arg0 (in A/X) --- @@ -3620,12 +3791,12 @@ StringMatch: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Ptr, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -3637,6 +3808,7 @@ StringMatch: ; BoolToStr(Boolean) -> Str31 ; tool 0x0010, set 0x10 (ControlManager) + .section .text.BoolToStr,"ax" .globl BoolToStr BoolToStr: ; --- stash arg0 (in A) --- @@ -3655,6 +3827,7 @@ BoolToStr: ; CopyGSString(GSString255Hndl) -> GSString255Hndl ; tool 0x0020, set 0x20 (VideoOverlay) + .section .text.CopyGSString,"ax" .globl CopyGSString CopyGSString: ; --- stash arg0 (in A/X) --- @@ -3664,10 +3837,10 @@ CopyGSString: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0020 jsl 0xe100a8 pla ; result lo -> A @@ -3676,6 +3849,7 @@ CopyGSString: ; ExtToStr(Extended) -> Str31 ; tool 0x0011, set 0x11 (Loader) + .section .text.ExtToStr,"ax" .globl ExtToStr ExtToStr: ; --- stash arg0 (in A) --- @@ -3694,6 +3868,7 @@ ExtToStr: ; GSConcat(GSString255Hndl, GSString255Hndl) -> GSString255Hndl ; tool 0x0021, set 0x21 (Teletext) + .section .text.GSConcat,"ax" .globl GSConcat GSConcat: ; --- stash arg0 (in A/X) --- @@ -3703,12 +3878,12 @@ GSConcat: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (GSString255Hndl, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -3720,6 +3895,7 @@ GSConcat: ; GSToPString(GSString255Hndl) -> Str255 ; tool 0x001E, set 0x1E (ResourceManager) + .section .text.GSToPString,"ax" .globl GSToPString GSToPString: ; --- stash arg0 (in A/X) --- @@ -3729,10 +3905,10 @@ GSToPString: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x001E jsl 0xe100a8 pla ; result lo -> A @@ -3741,6 +3917,7 @@ GSToPString: ; GSToZero(GSString255Hndl) -> Handle ; tool 0x0023, set 0x23 (MediaControl) + .section .text.GSToZero,"ax" .globl GSToZero GSToZero: ; --- stash arg0 (in A/X) --- @@ -3750,10 +3927,10 @@ GSToZero: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0023 jsl 0xe100a8 pla ; result lo -> A @@ -3762,6 +3939,7 @@ GSToZero: ; LongToStr(Longint) -> Str31 ; tool 0x000D, set 0x0D (?) + .section .text.LongToStr,"ax" .globl LongToStr LongToStr: ; --- stash arg0 (in A/X) --- @@ -3771,10 +3949,10 @@ LongToStr: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x000D jsl 0xe100a8 pla ; result lo -> A @@ -3783,6 +3961,7 @@ LongToStr: ; NumToHex(Longint, word) -> Str19 ; tool 0x000F, set 0x0F (MenuManager) + .section .text.NumToHex,"ax" .globl NumToHex NumToHex: ; --- stash arg0 (in A/X) --- @@ -3792,12 +3971,12 @@ NumToHex: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (word, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -3809,6 +3988,7 @@ NumToHex: ; NumToStr(Longint) -> Str31 ; tool 0x000E, set 0x0E (WindowManager) + .section .text.NumToStr,"ax" .globl NumToStr NumToStr: ; --- stash arg0 (in A/X) --- @@ -3818,10 +3998,10 @@ NumToStr: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x000E jsl 0xe100a8 pla ; result lo -> A @@ -3830,18 +4010,19 @@ NumToStr: ; PointToStr(Point, Str255) -> void ; tool 0x002D, set 0x2D (?) + .section .text.PointToStr,"ax" .globl PointToStr PointToStr: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Str255, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -3851,6 +4032,7 @@ PointToStr: ; PasToZero(Str255) -> Handle ; tool 0x0007, set 0x07 (Scheduler) + .section .text.PasToZero,"ax" .globl PasToZero PasToZero: ; --- stash arg0 (in A/X) --- @@ -3860,10 +4042,10 @@ PasToZero: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0007 jsl 0xe100a8 pla ; result lo -> A @@ -3872,6 +4054,7 @@ PasToZero: ; PToGSString(Str255) -> GSString255Hndl ; tool 0x001F, set 0x1F (MIDITools) + .section .text.PToGSString,"ax" .globl PToGSString PToGSString: ; --- stash arg0 (in A/X) --- @@ -3881,10 +4064,10 @@ PToGSString: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x001F jsl 0xe100a8 pla ; result lo -> A @@ -3893,18 +4076,19 @@ PToGSString: ; RectToStr(Rect, Str255) -> void ; tool 0x002E, set 0x2E (?) + .section .text.RectToStr,"ax" .globl RectToStr RectToStr: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Str255, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -3914,18 +4098,19 @@ RectToStr: ; ReturnToPas(Ptr, Str255) -> void ; tool 0x001B, set 0x1B (FontManager) + .section .text.ReturnToPas,"ax" .globl ReturnToPas ReturnToPas: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Str255, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -3935,6 +4120,7 @@ ReturnToPas: ; StrToBool(Str31) -> Boolean ; tool 0x000B, set 0x0B (IntegerMath) + .section .text.StrToBool,"ax" .globl StrToBool StrToBool: ; --- stash arg0 (in A/X) --- @@ -3943,10 +4129,10 @@ StrToBool: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x000B jsl 0xe100a8 pla ; result -> A @@ -3954,6 +4140,7 @@ StrToBool: ; StrToExt(Str31) -> extended ; tool 0x000C, set 0x0C (TextTools) + .section .text.StrToExt,"ax" .globl StrToExt StrToExt: ; --- stash arg0 (in A/X) --- @@ -3963,10 +4150,10 @@ StrToExt: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x000C jsl 0xe100a8 pla ; result lo -> A @@ -3975,6 +4162,7 @@ StrToExt: ; StrToLong(Str31) -> Longint ; tool 0x0009, set 0x09 (AppleDeskBus) + .section .text.StrToLong,"ax" .globl StrToLong StrToLong: ; --- stash arg0 (in A/X) --- @@ -3984,10 +4172,10 @@ StrToLong: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0009 jsl 0xe100a8 pla ; result lo -> A @@ -3996,6 +4184,7 @@ StrToLong: ; StrToNum(Str31) -> Longint ; tool 0x000A, set 0x0A (SANE) + .section .text.StrToNum,"ax" .globl StrToNum StrToNum: ; --- stash arg0 (in A/X) --- @@ -4005,10 +4194,10 @@ StrToNum: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x000A jsl 0xe100a8 pla ; result lo -> A @@ -4017,18 +4206,19 @@ StrToNum: ; StrToPoint(Str255, Point) -> void ; tool 0x002F, set 0x2F (?) + .section .text.StrToPoint,"ax" .globl StrToPoint StrToPoint: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Point, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -4038,18 +4228,19 @@ StrToPoint: ; StrToRect(Str255, Rect) -> void ; tool 0x0030, set 0x30 (?) + .section .text.StrToRect,"ax" .globl StrToRect StrToRect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Rect, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -4059,6 +4250,7 @@ StrToRect: ; ZeroToGS(Handle) -> GSString255Hndl ; tool 0x0024, set 0x24 (?) + .section .text.ZeroToGS,"ax" .globl ZeroToGS ZeroToGS: ; --- stash arg0 (in A/X) --- @@ -4068,10 +4260,10 @@ ZeroToGS: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0024 jsl 0xe100a8 pla ; result lo -> A @@ -4080,18 +4272,19 @@ ZeroToGS: ; ZeroToPas(Ptr, Str255) -> void ; tool 0x0008, set 0x08 (SoundManager) + .section .text.ZeroToPas,"ax" .globl ZeroToPas ZeroToPas: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Str255, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -4101,6 +4294,7 @@ ZeroToPas: ; GetFieldByID(Boolean, word) -> Handle ; tool 0x0016, set 0x16 (ScrapManager) + .section .text.GetFieldByID,"ax" .globl GetFieldByID GetFieldByID: ; --- stash arg0 (in A) --- @@ -4112,7 +4306,7 @@ GetFieldByID: lda 0xE0 pha ; --- arg1 (word, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -4124,6 +4318,7 @@ GetFieldByID: ; GetFieldByName(Boolean, Str255) -> Handle ; tool 0x0014, set 0x14 (LineEdit) + .section .text.GetFieldByName,"ax" .globl GetFieldByName GetFieldByName: ; --- stash arg0 (in A) --- @@ -4135,7 +4330,7 @@ GetFieldByName: lda 0xE0 pha ; --- arg1 (Str255, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -4147,6 +4342,7 @@ GetFieldByName: ; GetFieldByNum(Boolean, word) -> Handle ; tool 0x0015, set 0x15 (DialogManager) + .section .text.GetFieldByNum,"ax" .globl GetFieldByNum GetFieldByNum: ; --- stash arg0 (in A) --- @@ -4158,7 +4354,7 @@ GetFieldByNum: lda 0xE0 pha ; --- arg1 (word, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -4170,6 +4366,7 @@ GetFieldByNum: ; SetFieldByID(Boolean, word, Handle) -> void ; tool 0x0019, set 0x19 (NoteSynth) + .section .text.SetFieldByID,"ax" .globl SetFieldByID SetFieldByID: ; --- stash arg0 (in A) --- @@ -4178,12 +4375,12 @@ SetFieldByID: lda 0xE0 pha ; --- arg1 (word, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha ; --- arg2 (Handle, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -4193,6 +4390,7 @@ SetFieldByID: ; SetFieldByName(Boolean, Str255, Handle) -> void ; tool 0x0017, set 0x17 (StandardFile) + .section .text.SetFieldByName,"ax" .globl SetFieldByName SetFieldByName: ; --- stash arg0 (in A) --- @@ -4201,12 +4399,12 @@ SetFieldByName: lda 0xE0 pha ; --- arg1 (Str255, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha ; --- arg2 (Handle, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -4216,6 +4414,7 @@ SetFieldByName: ; SetFieldByNum(Boolean, word, Handle) -> void ; tool 0x0018, set 0x18 (DiskUtil) + .section .text.SetFieldByNum,"ax" .globl SetFieldByNum SetFieldByNum: ; --- stash arg0 (in A) --- @@ -4224,12 +4423,12 @@ SetFieldByNum: lda 0xE0 pha ; --- arg1 (word, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha ; --- arg2 (Handle, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -4239,34 +4438,36 @@ SetFieldByNum: ; ChangedMaskAndData(word) -> void ; tool 0x002C, set 0x2C (?) + .section .text.ChangedMaskAndData,"ax" .globl ChangedMaskAndData ChangedMaskAndData: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x002C jsl 0xe100a8 rtl ; GetMaskAndData(LocInfoPtr, LocInfoPtr) -> void ; tool 0x002B, set 0x2B (?) + .section .text.GetMaskAndData,"ax" .globl GetMaskAndData GetMaskAndData: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (LocInfoPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -4276,6 +4477,7 @@ GetMaskAndData: ; FindNamedResource(word, Str255, word, long) -> Boolean ; tool 0x0026, set 0x26 (?) + .section .text.FindNamedResource,"ax" .globl FindNamedResource FindNamedResource: ; --- stash arg0 (in A/X) --- @@ -4284,22 +4486,22 @@ FindNamedResource: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Str255, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha ; --- arg2 (word, 4B) --- - lda 18, s + lda 20, s pha lda 20, s pha ; --- arg3 (long, 4B) --- - lda 26, s + lda 28, s pha lda 28, s pha @@ -4310,6 +4512,7 @@ FindNamedResource: ; GetResourceName(word, long) -> Str255 ; tool 0x0028, set 0x28 (?) + .section .text.GetResourceName,"ax" .globl GetResourceName GetResourceName: ; --- stash arg0 (in A/X) --- @@ -4319,12 +4522,12 @@ GetResourceName: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (long, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -4336,6 +4539,7 @@ GetResourceName: ; LoadNamedResource(word, Str255) -> Handle ; tool 0x0025, set 0x25 (?) + .section .text.LoadNamedResource,"ax" .globl LoadNamedResource LoadNamedResource: ; --- stash arg0 (in A/X) --- @@ -4345,12 +4549,12 @@ LoadNamedResource: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Str255, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -4362,23 +4566,24 @@ LoadNamedResource: ; SetResourceName(word, long, Str255) -> void ; tool 0x0027, set 0x27 (?) + .section .text.SetResourceName,"ax" .globl SetResourceName SetResourceName: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (long, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (Str255, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -4388,6 +4593,7 @@ SetResourceName: ; NewXWindow(Rect, Str31, Boolean, word) -> WindowPtr ; tool 0x0031, set 0x31 (?) + .section .text.NewXWindow,"ax" .globl NewXWindow NewXWindow: ; --- stash arg0 (in A/X) --- @@ -4397,12 +4603,12 @@ NewXWindow: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Str31, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -4410,7 +4616,7 @@ NewXWindow: lda 20, s pha ; --- arg3 (word, 4B) --- - lda 24, s + lda 26, s pha lda 26, s pha @@ -4422,22 +4628,24 @@ NewXWindow: ; CloseXWindow(WindowPtr) -> void ; tool 0x0033, set 0x33 (?) + .section .text.CloseXWindow,"ax" .globl CloseXWindow CloseXWindow: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0033 jsl 0xe100a8 rtl ; GetXWindowValue(WindowPtr) -> Longint ; tool 0x0037, set 0x37 (?) + .section .text.GetXWindowValue,"ax" .globl GetXWindowValue GetXWindowValue: ; --- stash arg0 (in A/X) --- @@ -4447,10 +4655,10 @@ GetXWindowValue: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0037 jsl 0xe100a8 pla ; result lo -> A @@ -4459,18 +4667,19 @@ GetXWindowValue: ; SetXWIdleTime(WindowPtr, Longint) -> void ; tool 0x0032, set 0x32 (MediaControl2) + .section .text.SetXWIdleTime,"ax" .globl SetXWIdleTime SetXWIdleTime: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Longint, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -4480,18 +4689,19 @@ SetXWIdleTime: ; SetXWindowValue(WindowPtr, Longint) -> void ; tool 0x0036, set 0x36 (?) + .section .text.SetXWindowValue,"ax" .globl SetXWindowValue SetXWindowValue: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Longint, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -4501,16 +4711,17 @@ SetXWindowValue: ; XWAllowReEntrancy(WindowPtr, Boolean, Boolean) -> void ; tool 0x0038, set 0x38 (?) + .section .text.XWAllowReEntrancy,"ax" .globl XWAllowReEntrancy XWAllowReEntrancy: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Boolean, 2B) --- lda 8, s pha @@ -4523,6 +4734,7 @@ XWAllowReEntrancy: ; Dec2Int(Pointer, Word, Boolean) -> Integer ; tool 0x280B, set 0x0B (IntegerMath) + .section .text.Dec2Int,"ax" .globl Dec2Int Dec2Int: ; --- stash arg0 (in A/X) --- @@ -4531,10 +4743,10 @@ Dec2Int: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 10, s pha @@ -4548,6 +4760,7 @@ Dec2Int: ; Dec2Long(Pointer, Word, Boolean) -> Longint ; tool 0x290B, set 0x0B (IntegerMath) + .section .text.Dec2Long,"ax" .globl Dec2Long Dec2Long: ; --- stash arg0 (in A/X) --- @@ -4557,10 +4770,10 @@ Dec2Long: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 12, s pha @@ -4575,6 +4788,7 @@ Dec2Long: ; Fix2Frac(Fixed) -> Frac ; tool 0x1C0B, set 0x0B (IntegerMath) + .section .text.Fix2Frac,"ax" .globl Fix2Frac Fix2Frac: ; --- stash arg0 (in A/X) --- @@ -4584,10 +4798,10 @@ Fix2Frac: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1C0B jsl 0xe10000 pla ; result lo -> A @@ -4596,6 +4810,7 @@ Fix2Frac: ; Fix2Long(Fixed) -> Longint ; tool 0x1B0B, set 0x0B (IntegerMath) + .section .text.Fix2Long,"ax" .globl Fix2Long Fix2Long: ; --- stash arg0 (in A/X) --- @@ -4605,10 +4820,10 @@ Fix2Long: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1B0B jsl 0xe10000 pla ; result lo -> A @@ -4617,18 +4832,19 @@ Fix2Long: ; Fix2X(Fixed, ExtendedPtr) -> void ; tool 0x1E0B, set 0x0B (IntegerMath) + .section .text.Fix2X,"ax" .globl Fix2X Fix2X: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (ExtendedPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -4638,6 +4854,7 @@ Fix2X: ; FixATan2(Longint, Longint) -> Fixed ; tool 0x170B, set 0x0B (IntegerMath) + .section .text.FixATan2,"ax" .globl FixATan2 FixATan2: ; --- stash arg0 (in A/X) --- @@ -4647,12 +4864,12 @@ FixATan2: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Longint, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -4664,6 +4881,7 @@ FixATan2: ; FixDiv(Longint, Longint) -> Fixed ; tool 0x110B, set 0x0B (IntegerMath) + .section .text.FixDiv,"ax" .globl FixDiv FixDiv: ; --- stash arg0 (in A/X) --- @@ -4673,12 +4891,12 @@ FixDiv: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Longint, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -4690,6 +4908,7 @@ FixDiv: ; FixMul(Fixed, Fixed) -> Fixed ; tool 0x0F0B, set 0x0B (IntegerMath) + .section .text.FixMul,"ax" .globl FixMul FixMul: ; --- stash arg0 (in A/X) --- @@ -4699,12 +4918,12 @@ FixMul: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Fixed, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -4716,6 +4935,7 @@ FixMul: ; FixRatio(Integer, Integer) -> Fixed ; tool 0x0E0B, set 0x0B (IntegerMath) + .section .text.FixRatio,"ax" .globl FixRatio FixRatio: ; --- stash arg0 (in A) --- @@ -4737,6 +4957,7 @@ FixRatio: ; FixRound(Fixed) -> Integer ; tool 0x130B, set 0x0B (IntegerMath) + .section .text.FixRound,"ax" .globl FixRound FixRound: ; --- stash arg0 (in A/X) --- @@ -4745,10 +4966,10 @@ FixRound: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x130B jsl 0xe10000 pla ; result -> A @@ -4756,6 +4977,7 @@ FixRound: ; Frac2Fix(Frac) -> Fixed ; tool 0x1D0B, set 0x0B (IntegerMath) + .section .text.Frac2Fix,"ax" .globl Frac2Fix Frac2Fix: ; --- stash arg0 (in A/X) --- @@ -4765,10 +4987,10 @@ Frac2Fix: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1D0B jsl 0xe10000 pla ; result lo -> A @@ -4777,18 +4999,19 @@ Frac2Fix: ; Frac2X(Frac, ExtendedPtr) -> void ; tool 0x1F0B, set 0x0B (IntegerMath) + .section .text.Frac2X,"ax" .globl Frac2X Frac2X: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (ExtendedPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -4798,6 +5021,7 @@ Frac2X: ; FracCos(Fixed) -> Frac ; tool 0x150B, set 0x0B (IntegerMath) + .section .text.FracCos,"ax" .globl FracCos FracCos: ; --- stash arg0 (in A/X) --- @@ -4807,10 +5031,10 @@ FracCos: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x150B jsl 0xe10000 pla ; result lo -> A @@ -4819,6 +5043,7 @@ FracCos: ; FracDiv(Longint, Longint) -> Frac ; tool 0x120B, set 0x0B (IntegerMath) + .section .text.FracDiv,"ax" .globl FracDiv FracDiv: ; --- stash arg0 (in A/X) --- @@ -4828,12 +5053,12 @@ FracDiv: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Longint, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -4845,6 +5070,7 @@ FracDiv: ; FracMul(Frac, Frac) -> Frac ; tool 0x100B, set 0x0B (IntegerMath) + .section .text.FracMul,"ax" .globl FracMul FracMul: ; --- stash arg0 (in A/X) --- @@ -4854,12 +5080,12 @@ FracMul: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Frac, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -4871,6 +5097,7 @@ FracMul: ; FracSin(Fixed) -> Frac ; tool 0x160B, set 0x0B (IntegerMath) + .section .text.FracSin,"ax" .globl FracSin FracSin: ; --- stash arg0 (in A/X) --- @@ -4880,10 +5107,10 @@ FracSin: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x160B jsl 0xe10000 pla ; result lo -> A @@ -4892,6 +5119,7 @@ FracSin: ; FracSqrt(Frac) -> Frac ; tool 0x140B, set 0x0B (IntegerMath) + .section .text.FracSqrt,"ax" .globl FracSqrt FracSqrt: ; --- stash arg0 (in A/X) --- @@ -4901,10 +5129,10 @@ FracSqrt: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x140B jsl 0xe10000 pla ; result lo -> A @@ -4913,6 +5141,7 @@ FracSqrt: ; Hex2Int(Pointer, Word) -> Word ; tool 0x240B, set 0x0B (IntegerMath) + .section .text.Hex2Int,"ax" .globl Hex2Int Hex2Int: ; --- stash arg0 (in A/X) --- @@ -4921,10 +5150,10 @@ Hex2Int: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 10, s pha @@ -4935,6 +5164,7 @@ Hex2Int: ; Hex2Long(Pointer, Word) -> LongWord ; tool 0x250B, set 0x0B (IntegerMath) + .section .text.Hex2Long,"ax" .globl Hex2Long Hex2Long: ; --- stash arg0 (in A/X) --- @@ -4944,10 +5174,10 @@ Hex2Long: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 12, s pha @@ -4959,6 +5189,7 @@ Hex2Long: ; HexIt(Word) -> LongWord ; tool 0x2A0B, set 0x0B (IntegerMath) + .section .text.HexIt,"ax" .globl HexIt HexIt: ; --- stash arg0 (in A) --- @@ -4977,6 +5208,7 @@ HexIt: ; HiWord(LongWord) -> Word ; tool 0x180B, set 0x0B (IntegerMath) + .section .text.HiWord,"ax" .globl HiWord HiWord: ; --- stash arg0 (in A/X) --- @@ -4985,10 +5217,10 @@ HiWord: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x180B jsl 0xe10000 pla ; result -> A @@ -4996,6 +5228,7 @@ HiWord: ; Int2Dec(Integer, Pointer, Word, Boolean) -> void ; tool 0x260B, set 0x0B (IntegerMath) + .section .text.Int2Dec,"ax" .globl Int2Dec Int2Dec: ; --- stash arg0 (in A) --- @@ -5004,7 +5237,7 @@ Int2Dec: lda 0xE0 pha ; --- arg1 (Pointer, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -5020,6 +5253,7 @@ Int2Dec: ; Int2Hex(Word, Pointer, Word) -> void ; tool 0x220B, set 0x0B (IntegerMath) + .section .text.Int2Hex,"ax" .globl Int2Hex Int2Hex: ; --- stash arg0 (in A) --- @@ -5028,7 +5262,7 @@ Int2Hex: lda 0xE0 pha ; --- arg1 (Pointer, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -5041,18 +5275,19 @@ Int2Hex: ; Long2Dec(Longint, Pointer, Word, Boolean) -> void ; tool 0x270B, set 0x0B (IntegerMath) + .section .text.Long2Dec,"ax" .globl Long2Dec Long2Dec: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Pointer, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -5068,6 +5303,7 @@ Long2Dec: ; Long2Fix(Longint) -> Fixed ; tool 0x1A0B, set 0x0B (IntegerMath) + .section .text.Long2Fix,"ax" .globl Long2Fix Long2Fix: ; --- stash arg0 (in A/X) --- @@ -5077,10 +5313,10 @@ Long2Fix: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1A0B jsl 0xe10000 pla ; result lo -> A @@ -5089,18 +5325,19 @@ Long2Fix: ; Long2Hex(LongWord, Pointer, Word) -> void ; tool 0x230B, set 0x0B (IntegerMath) + .section .text.Long2Hex,"ax" .globl Long2Hex Long2Hex: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Pointer, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -5113,6 +5350,7 @@ Long2Hex: ; LoWord(LongWord) -> Word ; tool 0x190B, set 0x0B (IntegerMath) + .section .text.LoWord,"ax" .globl LoWord LoWord: ; --- stash arg0 (in A/X) --- @@ -5121,10 +5359,10 @@ LoWord: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x190B jsl 0xe10000 pla ; result -> A @@ -5132,6 +5370,7 @@ LoWord: ; Multiply(Integer, Integer) -> Longint ; tool 0x090B, set 0x0B (IntegerMath) + .section .text.Multiply,"ax" .globl Multiply Multiply: ; --- stash arg0 (in A) --- @@ -5153,6 +5392,7 @@ Multiply: ; X2Fix(ExtendedPtr) -> Fixed ; tool 0x200B, set 0x0B (IntegerMath) + .section .text.X2Fix,"ax" .globl X2Fix X2Fix: ; --- stash arg0 (in A/X) --- @@ -5162,10 +5402,10 @@ X2Fix: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x200B jsl 0xe10000 pla ; result lo -> A @@ -5174,6 +5414,7 @@ X2Fix: ; X2Frac(ExtendedPtr) -> Frac ; tool 0x210B, set 0x0B (IntegerMath) + .section .text.X2Frac,"ax" .globl X2Frac X2Frac: ; --- stash arg0 (in A/X) --- @@ -5183,10 +5424,10 @@ X2Frac: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x210B jsl 0xe10000 pla ; result lo -> A @@ -5195,6 +5436,7 @@ X2Frac: ; LEStartUp(Word, Word) -> void ; tool 0x0214, set 0x14 (LineEdit) + .section .text.LEStartUp,"ax" .globl LEStartUp LEStartUp: ; --- stash arg0 (in A) --- @@ -5211,34 +5453,36 @@ LEStartUp: ; LEActivate(LERecHndl) -> void ; tool 0x0F14, set 0x14 (LineEdit) + .section .text.LEActivate,"ax" .globl LEActivate LEActivate: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0F14 jsl 0xe10000 rtl ; LEClick(EventRecordPtr, LERecHndl) -> void ; tool 0x0D14, set 0x14 (LineEdit) + .section .text.LEClick,"ax" .globl LEClick LEClick: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (LERecHndl, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -5248,86 +5492,92 @@ LEClick: ; LECopy(LERecHndl) -> void ; tool 0x1314, set 0x14 (LineEdit) + .section .text.LECopy,"ax" .globl LECopy LECopy: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1314 jsl 0xe10000 rtl ; LECut(LERecHndl) -> void ; tool 0x1214, set 0x14 (LineEdit) + .section .text.LECut,"ax" .globl LECut LECut: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1214 jsl 0xe10000 rtl ; LEDeactivate(LERecHndl) -> void ; tool 0x1014, set 0x14 (LineEdit) + .section .text.LEDeactivate,"ax" .globl LEDeactivate LEDeactivate: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1014 jsl 0xe10000 rtl ; LEDelete(LERecHndl) -> void ; tool 0x1514, set 0x14 (LineEdit) + .section .text.LEDelete,"ax" .globl LEDelete LEDelete: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1514 jsl 0xe10000 rtl ; LEDispose(LERecHndl) -> void ; tool 0x0A14, set 0x14 (LineEdit) + .section .text.LEDispose,"ax" .globl LEDispose LEDispose: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0A14 jsl 0xe10000 rtl ; LEGetTextHand(LERecHndl) -> Handle ; tool 0x2214, set 0x14 (LineEdit) + .section .text.LEGetTextHand,"ax" .globl LEGetTextHand LEGetTextHand: ; --- stash arg0 (in A/X) --- @@ -5337,10 +5587,10 @@ LEGetTextHand: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2214 jsl 0xe10000 pla ; result lo -> A @@ -5349,6 +5599,7 @@ LEGetTextHand: ; LEGetTextLen(LERecHndl) -> Word ; tool 0x2314, set 0x14 (LineEdit) + .section .text.LEGetTextLen,"ax" .globl LEGetTextLen LEGetTextLen: ; --- stash arg0 (in A/X) --- @@ -5357,10 +5608,10 @@ LEGetTextLen: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2314 jsl 0xe10000 pla ; result -> A @@ -5368,37 +5619,39 @@ LEGetTextLen: ; LEIdle(LERecHndl) -> void ; tool 0x0C14, set 0x14 (LineEdit) + .section .text.LEIdle,"ax" .globl LEIdle LEIdle: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0C14 jsl 0xe10000 rtl ; LEInsert(Pointer, Word, LERecHndl) -> void ; tool 0x1614, set 0x14 (LineEdit) + .section .text.LEInsert,"ax" .globl LEInsert LEInsert: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha ; --- arg2 (LERecHndl, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -5408,6 +5661,7 @@ LEInsert: ; LEKey(Word, Word, LERecHndl) -> void ; tool 0x1114, set 0x14 (LineEdit) + .section .text.LEKey,"ax" .globl LEKey LEKey: ; --- stash arg0 (in A) --- @@ -5419,7 +5673,7 @@ LEKey: lda 6, s pha ; --- arg2 (LERecHndl, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -5429,6 +5683,7 @@ LEKey: ; LENew(Rect, Rect, Word) -> LERecHndl ; tool 0x0914, set 0x14 (LineEdit) + .section .text.LENew,"ax" .globl LENew LENew: ; --- stash arg0 (in A/X) --- @@ -5438,12 +5693,12 @@ LENew: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Rect, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -5458,22 +5713,24 @@ LENew: ; LEPaste(LERecHndl) -> void ; tool 0x1414, set 0x14 (LineEdit) + .section .text.LEPaste,"ax" .globl LEPaste LEPaste: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1414 jsl 0xe10000 rtl ; LEScrapHandle(void) -> Handle ; tool 0x1B14, set 0x14 (LineEdit) + .section .text.LEScrapHandle,"ax" .globl LEScrapHandle LEScrapHandle: ; --- result space (4 bytes) --- @@ -5487,18 +5744,19 @@ LEScrapHandle: ; LESetCaret(VoidProcPtr, LERecHndl) -> void ; tool 0x1F14, set 0x14 (LineEdit) + .section .text.LESetCaret,"ax" .globl LESetCaret LESetCaret: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (LERecHndl, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -5508,18 +5766,19 @@ LESetCaret: ; LESetHilite(VoidProcPtr, LERecHndl) -> void ; tool 0x1E14, set 0x14 (LineEdit) + .section .text.LESetHilite,"ax" .globl LESetHilite LESetHilite: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (LERecHndl, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -5529,6 +5788,7 @@ LESetHilite: ; LESetJust(Word, LERecHndl) -> void ; tool 0x2114, set 0x14 (LineEdit) + .section .text.LESetJust,"ax" .globl LESetJust LESetJust: ; --- stash arg0 (in A) --- @@ -5537,7 +5797,7 @@ LESetJust: lda 0xE0 pha ; --- arg1 (LERecHndl, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -5547,6 +5807,7 @@ LESetJust: ; LESetSelect(Word, Word, LERecHndl) -> void ; tool 0x0E14, set 0x14 (LineEdit) + .section .text.LESetSelect,"ax" .globl LESetSelect LESetSelect: ; --- stash arg0 (in A) --- @@ -5558,7 +5819,7 @@ LESetSelect: lda 6, s pha ; --- arg2 (LERecHndl, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -5568,21 +5829,22 @@ LESetSelect: ; LESetText(Pointer, Word, LERecHndl) -> void ; tool 0x0B14, set 0x14 (LineEdit) + .section .text.LESetText,"ax" .globl LESetText LESetText: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha ; --- arg2 (LERecHndl, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -5592,21 +5854,22 @@ LESetText: ; LETextBox(Pointer, Word, Rect, Word) -> void ; tool 0x1814, set 0x14 (LineEdit) + .section .text.LETextBox,"ax" .globl LETextBox LETextBox: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha ; --- arg2 (Rect, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -5619,21 +5882,22 @@ LETextBox: ; LETextBox2(Pointer, Word, Rect, Word) -> void ; tool 0x2014, set 0x14 (LineEdit) + .section .text.LETextBox2,"ax" .globl LETextBox2 LETextBox2: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha ; --- arg2 (Rect, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -5646,22 +5910,24 @@ LETextBox2: ; LEUpdate(LERecHndl) -> void ; tool 0x1714, set 0x14 (LineEdit) + .section .text.LEUpdate,"ax" .globl LEUpdate LEUpdate: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1714 jsl 0xe10000 rtl ; GetLEDefProc(void) -> Pointer ; tool 0x2414, set 0x14 (LineEdit) + .section .text.GetLEDefProc,"ax" .globl GetLEDefProc GetLEDefProc: ; --- result space (4 bytes) --- @@ -5675,6 +5941,7 @@ GetLEDefProc: ; LEClassifyKey(EventRecordPtr) -> Word ; tool 0x2514, set 0x14 (LineEdit) + .section .text.LEClassifyKey,"ax" .globl LEClassifyKey LEClassifyKey: ; --- stash arg0 (in A/X) --- @@ -5683,10 +5950,10 @@ LEClassifyKey: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2514 jsl 0xe10000 pla ; result -> A @@ -5694,6 +5961,7 @@ LEClassifyKey: ; CreateList(GrafPortPtr, ListRecPtr) -> ListCtlRecHndl ; tool 0x091C, set 0x1C (ListManager) + .section .text.CreateList,"ax" .globl CreateList CreateList: ; --- stash arg0 (in A/X) --- @@ -5703,12 +5971,12 @@ CreateList: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (ListRecPtr, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -5720,18 +5988,19 @@ CreateList: ; DrawMember(MemRecPtr, ListRecPtr) -> void ; tool 0x0C1C, set 0x1C (ListManager) + .section .text.DrawMember,"ax" .globl DrawMember DrawMember: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (ListRecPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -5741,6 +6010,7 @@ DrawMember: ; GetListDefProc(void) -> LongProcPtr ; tool 0x0E1C, set 0x1C (ListManager) + .section .text.GetListDefProc,"ax" .globl GetListDefProc GetListDefProc: ; --- result space (4 bytes) --- @@ -5754,18 +6024,19 @@ GetListDefProc: ; NewList(MemRecPtr, ListRecPtr) -> void ; tool 0x101C, set 0x1C (ListManager) + .section .text.NewList,"ax" .globl NewList NewList: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (ListRecPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -5775,6 +6046,7 @@ NewList: ; NextMember(MemRecPtr, ListRecPtr) -> MemRecPtr ; tool 0x0B1C, set 0x1C (ListManager) + .section .text.NextMember,"ax" .globl NextMember NextMember: ; --- stash arg0 (in A/X) --- @@ -5784,12 +6056,12 @@ NextMember: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (ListRecPtr, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -5801,6 +6073,7 @@ NextMember: ; ResetMember(ListRecPtr) -> MemRecPtr ; tool 0x0F1C, set 0x1C (ListManager) + .section .text.ResetMember,"ax" .globl ResetMember ResetMember: ; --- stash arg0 (in A/X) --- @@ -5810,10 +6083,10 @@ ResetMember: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0F1C jsl 0xe10000 pla ; result lo -> A @@ -5822,18 +6095,19 @@ ResetMember: ; SelectMember(MemRecPtr, ListRecPtr) -> void ; tool 0x0D1C, set 0x1C (ListManager) + .section .text.SelectMember,"ax" .globl SelectMember SelectMember: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (ListRecPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -5843,18 +6117,19 @@ SelectMember: ; SortList(VoidProcPtr, ListRecPtr) -> void ; tool 0x0A1C, set 0x1C (ListManager) + .section .text.SortList,"ax" .globl SortList SortList: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (ListRecPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -5864,6 +6139,7 @@ SortList: ; DrawMember2(Word, Handle) -> void ; tool 0x111C, set 0x1C (ListManager) + .section .text.DrawMember2,"ax" .globl DrawMember2 DrawMember2: ; --- stash arg0 (in A) --- @@ -5872,7 +6148,7 @@ DrawMember2: lda 0xE0 pha ; --- arg1 (Handle, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -5882,21 +6158,22 @@ DrawMember2: ; NewList2(Pointer, Word, Ref, Word, Word, Handle) -> void ; tool 0x161C, set 0x1C (ListManager) + .section .text.NewList2,"ax" .globl NewList2 NewList2: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha ; --- arg2 (Ref, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -5907,7 +6184,7 @@ NewList2: lda 24, s pha ; --- arg5 (Handle, 4B) --- - lda 28, s + lda 30, s pha lda 30, s pha @@ -5917,6 +6194,7 @@ NewList2: ; NextMember2(Word, Handle) -> Word ; tool 0x121C, set 0x1C (ListManager) + .section .text.NextMember2,"ax" .globl NextMember2 NextMember2: ; --- stash arg0 (in A) --- @@ -5927,7 +6205,7 @@ NextMember2: lda 0xE0 pha ; --- arg1 (Handle, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -5938,6 +6216,7 @@ NextMember2: ; ResetMember2(Handle) -> Word ; tool 0x131C, set 0x1C (ListManager) + .section .text.ResetMember2,"ax" .globl ResetMember2 ResetMember2: ; --- stash arg0 (in A/X) --- @@ -5946,10 +6225,10 @@ ResetMember2: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x131C jsl 0xe10000 pla ; result -> A @@ -5957,6 +6236,7 @@ ResetMember2: ; SelectMember2(Word, Handle) -> void ; tool 0x141C, set 0x1C (ListManager) + .section .text.SelectMember2,"ax" .globl SelectMember2 SelectMember2: ; --- stash arg0 (in A) --- @@ -5965,7 +6245,7 @@ SelectMember2: lda 0xE0 pha ; --- arg1 (Handle, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -5975,18 +6255,19 @@ SelectMember2: ; SortList2(Pointer, Handle) -> void ; tool 0x151C, set 0x1C (ListManager) + .section .text.SortList2,"ax" .globl SortList2 SortList2: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Handle, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -5996,6 +6277,7 @@ SortList2: ; CompareStrings(Word, Ptr, Ptr) -> Word ; tool 0x181C, set 0x1C (ListManager) + .section .text.CompareStrings,"ax" .globl CompareStrings CompareStrings: ; --- stash arg0 (in A) --- @@ -6006,12 +6288,12 @@ CompareStrings: lda 0xE0 pha ; --- arg1 (Ptr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (Ptr, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -6022,6 +6304,7 @@ CompareStrings: ; ListKey(Word, EventRecordPtr, CtlRecHndl) -> void ; tool 0x171C, set 0x1C (ListManager) + .section .text.ListKey,"ax" .globl ListKey ListKey: ; --- stash arg0 (in A) --- @@ -6030,12 +6313,12 @@ ListKey: lda 0xE0 pha ; --- arg1 (EventRecordPtr, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha ; --- arg2 (CtlRecHndl, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -6045,6 +6328,7 @@ ListKey: ; GetLoadSegInfo(Word, Word, Word, Pointer) -> void ; tool 0x0F11, set 0x11 (Loader) + .section .text.GetLoadSegInfo,"ax" .globl GetLoadSegInfo GetLoadSegInfo: ; --- stash arg0 (in A) --- @@ -6059,7 +6343,7 @@ GetLoadSegInfo: lda 10, s pha ; --- arg3 (Pointer, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -6069,6 +6353,7 @@ GetLoadSegInfo: ; GetUserID(Pointer) -> Word ; tool 0x1011, set 0x11 (Loader) + .section .text.GetUserID,"ax" .globl GetUserID GetUserID: ; --- stash arg0 (in A/X) --- @@ -6077,10 +6362,10 @@ GetUserID: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1011 jsl 0xe10000 pla ; result -> A @@ -6088,6 +6373,7 @@ GetUserID: ; GetUserID2(Pointer) -> Word ; tool 0x2111, set 0x11 (Loader) + .section .text.GetUserID2,"ax" .globl GetUserID2 GetUserID2: ; --- stash arg0 (in A/X) --- @@ -6096,10 +6382,10 @@ GetUserID2: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2111 jsl 0xe10000 pla ; result -> A @@ -6107,6 +6393,7 @@ GetUserID2: ; LGetPathname(Word, Word) -> Pointer ; tool 0x1111, set 0x11 (Loader) + .section .text.LGetPathname,"ax" .globl LGetPathname LGetPathname: ; --- stash arg0 (in A) --- @@ -6128,6 +6415,7 @@ LGetPathname: ; LGetPathname2(Word, Word) -> Pointer ; tool 0x2211, set 0x11 (Loader) + .section .text.LGetPathname2,"ax" .globl LGetPathname2 LGetPathname2: ; --- stash arg0 (in A) --- @@ -6149,6 +6437,7 @@ LGetPathname2: ; LoadSegNum(Word, Word, Word) -> Pointer ; tool 0x0B11, set 0x11 (Loader) + .section .text.LoadSegNum,"ax" .globl LoadSegNum LoadSegNum: ; --- stash arg0 (in A) --- @@ -6173,18 +6462,19 @@ LoadSegNum: ; RenamePathname(Pointer, Pointer) -> void ; tool 0x1311, set 0x11 (Loader) + .section .text.RenamePathname,"ax" .globl RenamePathname RenamePathname: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Pointer, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -6194,6 +6484,7 @@ RenamePathname: ; UnloadSegNum(Word, Word, Word) -> void ; tool 0x0C11, set 0x11 (Loader) + .section .text.UnloadSegNum,"ax" .globl UnloadSegNum UnloadSegNum: ; --- stash arg0 (in A) --- @@ -6213,6 +6504,7 @@ UnloadSegNum: ; UserShutDown(Word, Word) -> Word ; tool 0x1211, set 0x11 (Loader) + .section .text.UserShutDown,"ax" .globl UserShutDown UserShutDown: ; --- stash arg0 (in A) --- @@ -6232,6 +6524,7 @@ UserShutDown: ; GetPathname(void) -> Pointer ; tool 0x1111, set 0x11 (Loader) + .section .text.GetPathname,"ax" .globl GetPathname GetPathname: ; --- result space (4 bytes) --- @@ -6245,6 +6538,7 @@ GetPathname: ; GetPathname2(void) -> Pointer ; tool 0x2211, set 0x11 (Loader) + .section .text.GetPathname2,"ax" .globl GetPathname2 GetPathname2: ; --- result space (4 bytes) --- @@ -6258,6 +6552,7 @@ GetPathname2: ; GetFuncPtr(Word, Word) -> Pointer ; tool 0x0B01, set 0x01 (ToolLocator) + .section .text.GetFuncPtr,"ax" .globl GetFuncPtr GetFuncPtr: ; --- stash arg0 (in A) --- @@ -6279,6 +6574,7 @@ GetFuncPtr: ; GetTSPtr(Word, Word) -> Pointer ; tool 0x0901, set 0x01 (ToolLocator) + .section .text.GetTSPtr,"ax" .globl GetTSPtr GetTSPtr: ; --- stash arg0 (in A) --- @@ -6300,6 +6596,7 @@ GetTSPtr: ; GetWAP(Word, Word) -> Pointer ; tool 0x0C01, set 0x01 (ToolLocator) + .section .text.GetWAP,"ax" .globl GetWAP GetWAP: ; --- stash arg0 (in A) --- @@ -6321,6 +6618,7 @@ GetWAP: ; LoadOneTool(Word, Word) -> void ; tool 0x0F01, set 0x01 (ToolLocator) + .section .text.LoadOneTool,"ax" .globl LoadOneTool LoadOneTool: ; --- stash arg0 (in A) --- @@ -6337,22 +6635,24 @@ LoadOneTool: ; LoadTools(Pointer) -> void ; tool 0x0E01, set 0x01 (ToolLocator) + .section .text.LoadTools,"ax" .globl LoadTools LoadTools: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0E01 jsl 0xe10000 rtl ; MessageCenter(Word, Word, Handle) -> void ; tool 0x1501, set 0x01 (ToolLocator) + .section .text.MessageCenter,"ax" .globl MessageCenter MessageCenter: ; --- stash arg0 (in A) --- @@ -6364,7 +6664,7 @@ MessageCenter: lda 6, s pha ; --- arg2 (Handle, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -6374,22 +6674,24 @@ MessageCenter: ; RestoreTextState(Handle) -> void ; tool 0x1401, set 0x01 (ToolLocator) + .section .text.RestoreTextState,"ax" .globl RestoreTextState RestoreTextState: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1401 jsl 0xe10000 rtl ; SaveTextState(void) -> Handle ; tool 0x1301, set 0x01 (ToolLocator) + .section .text.SaveTextState,"ax" .globl SaveTextState SaveTextState: ; --- result space (4 bytes) --- @@ -6403,6 +6705,7 @@ SaveTextState: ; SetTSPtr(Word, Word, Pointer) -> void ; tool 0x0A01, set 0x01 (ToolLocator) + .section .text.SetTSPtr,"ax" .globl SetTSPtr SetTSPtr: ; --- stash arg0 (in A) --- @@ -6414,7 +6717,7 @@ SetTSPtr: lda 6, s pha ; --- arg2 (Pointer, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -6424,6 +6727,7 @@ SetTSPtr: ; SetWAP(Word, Word, Pointer) -> void ; tool 0x0D01, set 0x01 (ToolLocator) + .section .text.SetWAP,"ax" .globl SetWAP SetWAP: ; --- stash arg0 (in A) --- @@ -6435,7 +6739,7 @@ SetWAP: lda 6, s pha ; --- arg2 (Pointer, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -6445,6 +6749,7 @@ SetWAP: ; TLMountVolume(Integer, Integer, Pointer, Pointer, Pointer, Pointer) -> Word ; tool 0x1101, set 0x01 (ToolLocator) + .section .text.TLMountVolume,"ax" .globl TLMountVolume TLMountVolume: ; --- stash arg0 (in A) --- @@ -6458,22 +6763,22 @@ TLMountVolume: lda 8, s pha ; --- arg2 (Pointer, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha ; --- arg3 (Pointer, 4B) --- - lda 20, s + lda 22, s pha lda 22, s pha ; --- arg4 (Pointer, 4B) --- - lda 28, s + lda 30, s pha lda 30, s pha ; --- arg5 (Pointer, 4B) --- - lda 36, s + lda 38, s pha lda 38, s pha @@ -6484,6 +6789,7 @@ TLMountVolume: ; TLTextMountVolume(Pointer, Pointer, Pointer, Pointer) -> Word ; tool 0x1201, set 0x01 (ToolLocator) + .section .text.TLTextMountVolume,"ax" .globl TLTextMountVolume TLTextMountVolume: ; --- stash arg0 (in A/X) --- @@ -6492,22 +6798,22 @@ TLTextMountVolume: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Pointer, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha ; --- arg2 (Pointer, 4B) --- - lda 18, s + lda 20, s pha lda 20, s pha ; --- arg3 (Pointer, 4B) --- - lda 26, s + lda 28, s pha lda 28, s pha @@ -6518,6 +6824,7 @@ TLTextMountVolume: ; MessageByName(Boolean, Pointer) -> ResponseRecord ; tool 0x1701, set 0x01 (ToolLocator) + .section .text.MessageByName,"ax" .globl MessageByName MessageByName: ; --- stash arg0 (in A) --- @@ -6529,7 +6836,7 @@ MessageByName: lda 0xE0 pha ; --- arg1 (Pointer, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -6541,6 +6848,7 @@ MessageByName: ; ShutDownTools(Word, Ref) -> void ; tool 0x1901, set 0x01 (ToolLocator) + .section .text.ShutDownTools,"ax" .globl ShutDownTools ShutDownTools: ; --- stash arg0 (in A) --- @@ -6549,7 +6857,7 @@ ShutDownTools: lda 0xE0 pha ; --- arg1 (Ref, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -6559,6 +6867,7 @@ ShutDownTools: ; StartUpTools(Word, Word, Ref) -> Ref ; tool 0x1801, set 0x01 (ToolLocator) + .section .text.StartUpTools,"ax" .globl StartUpTools StartUpTools: ; --- stash arg0 (in A) --- @@ -6573,7 +6882,7 @@ StartUpTools: lda 10, s pha ; --- arg2 (Ref, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -6585,21 +6894,22 @@ StartUpTools: ; AcceptRequests(Pointer, Word, WordProcPtr) -> void ; tool 0x1B01, set 0x01 (ToolLocator) + .section .text.AcceptRequests,"ax" .globl AcceptRequests AcceptRequests: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha ; --- arg2 (WordProcPtr, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -6609,6 +6919,7 @@ AcceptRequests: ; GetMsgHandle(Word, Long) -> Handle ; tool 0x1A01, set 0x01 (ToolLocator) + .section .text.GetMsgHandle,"ax" .globl GetMsgHandle GetMsgHandle: ; --- stash arg0 (in A) --- @@ -6620,7 +6931,7 @@ GetMsgHandle: lda 0xE0 pha ; --- arg1 (Long, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -6632,6 +6943,7 @@ GetMsgHandle: ; SendRequest(Word, Word, Long, Long, Ptr) -> void ; tool 0x1C01, set 0x01 (ToolLocator) + .section .text.SendRequest,"ax" .globl SendRequest SendRequest: ; --- stash arg0 (in A) --- @@ -6643,17 +6955,17 @@ SendRequest: lda 6, s pha ; --- arg2 (Long, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha ; --- arg3 (Long, 4B) --- - lda 18, s + lda 20, s pha lda 20, s pha ; --- arg4 (Ptr, 4B) --- - lda 26, s + lda 28, s pha lda 28, s pha @@ -6663,6 +6975,7 @@ SendRequest: ; MCBinToTime(Long) -> Long ; tool 0x0D26, set 0x26 (?) + .section .text.MCBinToTime,"ax" .globl MCBinToTime MCBinToTime: ; --- stash arg0 (in A/X) --- @@ -6672,10 +6985,10 @@ MCBinToTime: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0D26 jsl 0xe10000 pla ; result lo -> A @@ -6684,6 +6997,7 @@ MCBinToTime: ; MCControl(Word, Word) -> void ; tool 0x1B26, set 0x26 (?) + .section .text.MCControl,"ax" .globl MCControl MCControl: ; --- stash arg0 (in A) --- @@ -6700,6 +7014,7 @@ MCControl: ; MCDStartUp(Word, Ptr, Word) -> void ; tool 0x1426, set 0x26 (?) + .section .text.MCDStartUp,"ax" .globl MCDStartUp MCDStartUp: ; --- stash arg0 (in A) --- @@ -6708,7 +7023,7 @@ MCDStartUp: lda 0xE0 pha ; --- arg1 (Ptr, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -6721,6 +7036,7 @@ MCDStartUp: ; MCGetDiscID(Word) -> Long ; tool 0x2826, set 0x26 (?) + .section .text.MCGetDiscID,"ax" .globl MCGetDiscID MCGetDiscID: ; --- stash arg0 (in A) --- @@ -6739,18 +7055,19 @@ MCGetDiscID: ; MCGetDiscTitle(Long, Ptr) -> void ; tool 0x1226, set 0x26 (?) + .section .text.MCGetDiscTitle,"ax" .globl MCGetDiscTitle MCGetDiscTitle: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Ptr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -6760,6 +7077,7 @@ MCGetDiscTitle: ; MCGetDiscTOC(Word, Word) -> Long ; tool 0x2726, set 0x26 (?) + .section .text.MCGetDiscTOC,"ax" .globl MCGetDiscTOC MCGetDiscTOC: ; --- stash arg0 (in A) --- @@ -6781,6 +7099,7 @@ MCGetDiscTOC: ; MCGetErrorMsg(Word, Ptr) -> void ; tool 0x0926, set 0x26 (?) + .section .text.MCGetErrorMsg,"ax" .globl MCGetErrorMsg MCGetErrorMsg: ; --- stash arg0 (in A) --- @@ -6789,7 +7108,7 @@ MCGetErrorMsg: lda 0xE0 pha ; --- arg1 (Ptr, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -6799,6 +7118,7 @@ MCGetErrorMsg: ; MCGetFeatures(Word, Word) -> Long ; tool 0x1626, set 0x26 (?) + .section .text.MCGetFeatures,"ax" .globl MCGetFeatures MCGetFeatures: ; --- stash arg0 (in A) --- @@ -6820,6 +7140,7 @@ MCGetFeatures: ; MCGetName(Word, Ptr) -> void ; tool 0x2D26, set 0x26 (?) + .section .text.MCGetName,"ax" .globl MCGetName MCGetName: ; --- stash arg0 (in A) --- @@ -6828,7 +7149,7 @@ MCGetName: lda 0xE0 pha ; --- arg1 (Ptr, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -6838,6 +7159,7 @@ MCGetName: ; MCGetPosition(Word, Word) -> Long ; tool 0x2426, set 0x26 (?) + .section .text.MCGetPosition,"ax" .globl MCGetPosition MCGetPosition: ; --- stash arg0 (in A) --- @@ -6859,18 +7181,19 @@ MCGetPosition: ; MCGetProgram(Long, Ptr) -> void ; tool 0x1026, set 0x26 (?) + .section .text.MCGetProgram,"ax" .globl MCGetProgram MCGetProgram: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Ptr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -6880,6 +7203,7 @@ MCGetProgram: ; MCGetSpeeds(Word, Ptr) -> void ; tool 0x1D26, set 0x26 (?) + .section .text.MCGetSpeeds,"ax" .globl MCGetSpeeds MCGetSpeeds: ; --- stash arg0 (in A) --- @@ -6888,7 +7212,7 @@ MCGetSpeeds: lda 0xE0 pha ; --- arg1 (Ptr, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -6898,6 +7222,7 @@ MCGetSpeeds: ; MCGetStatus(Word, Word) -> Word ; tool 0x1A26, set 0x26 (?) + .section .text.MCGetStatus,"ax" .globl MCGetStatus MCGetStatus: ; --- stash arg0 (in A) --- @@ -6917,6 +7242,7 @@ MCGetStatus: ; MCGetTimes(Word, Word) -> Long ; tool 0x2626, set 0x26 (?) + .section .text.MCGetTimes,"ax" .globl MCGetTimes MCGetTimes: ; --- stash arg0 (in A) --- @@ -6938,21 +7264,22 @@ MCGetTimes: ; MCGetTrackTitle(Long, Word, Ptr) -> void ; tool 0x0E26, set 0x26 (?) + .section .text.MCGetTrackTitle,"ax" .globl MCGetTrackTitle MCGetTrackTitle: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha ; --- arg2 (Ptr, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -6962,6 +7289,7 @@ MCGetTrackTitle: ; MCJog(Word, Long, Word) -> void ; tool 0x2026, set 0x26 (?) + .section .text.MCJog,"ax" .globl MCJog MCJog: ; --- stash arg0 (in A) --- @@ -6970,7 +7298,7 @@ MCJog: lda 0xE0 pha ; --- arg1 (Long, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -6983,6 +7311,7 @@ MCJog: ; MCScan(Word, Word) -> void ; tool 0x1C26, set 0x26 (?) + .section .text.MCScan,"ax" .globl MCScan MCScan: ; --- stash arg0 (in A) --- @@ -6999,6 +7328,7 @@ MCScan: ; MCSearchTo(Word, Word, Long) -> void ; tool 0x2126, set 0x26 (?) + .section .text.MCSearchTo,"ax" .globl MCSearchTo MCSearchTo: ; --- stash arg0 (in A) --- @@ -7010,7 +7340,7 @@ MCSearchTo: lda 6, s pha ; --- arg2 (Long, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -7020,6 +7350,7 @@ MCSearchTo: ; MCSendRawData(Word, Long) -> void ; tool 0x1926, set 0x26 (?) + .section .text.MCSendRawData,"ax" .globl MCSendRawData MCSendRawData: ; --- stash arg0 (in A) --- @@ -7028,7 +7359,7 @@ MCSendRawData: lda 0xE0 pha ; --- arg1 (Long, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -7038,6 +7369,7 @@ MCSendRawData: ; MCSetAudio(Word, Word) -> void ; tool 0x2526, set 0x26 (?) + .section .text.MCSetAudio,"ax" .globl MCSetAudio MCSetAudio: ; --- stash arg0 (in A) --- @@ -7054,18 +7386,19 @@ MCSetAudio: ; MCSetDiscTitle(Long, Long) -> void ; tool 0x1326, set 0x26 (?) + .section .text.MCSetDiscTitle,"ax" .globl MCSetDiscTitle MCSetDiscTitle: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Long, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -7075,18 +7408,19 @@ MCSetDiscTitle: ; MCSetProgram(Long, Long) -> void ; tool 0x1126, set 0x26 (?) + .section .text.MCSetProgram,"ax" .globl MCSetProgram MCSetProgram: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Long, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -7096,21 +7430,22 @@ MCSetProgram: ; MCSetTrackTitle(Long, Word, Ptr) -> void ; tool 0x0F26, set 0x26 (?) + .section .text.MCSetTrackTitle,"ax" .globl MCSetTrackTitle MCSetTrackTitle: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha ; --- arg2 (Ptr, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -7120,6 +7455,7 @@ MCSetTrackTitle: ; MCSetVolume(Word, Word, Word) -> void ; tool 0x2E26, set 0x26 (?) + .section .text.MCSetVolume,"ax" .globl MCSetVolume MCSetVolume: ; --- stash arg0 (in A) --- @@ -7139,6 +7475,7 @@ MCSetVolume: ; MCSpeed(Word, Word) -> void ; tool 0x1E26, set 0x26 (?) + .section .text.MCSpeed,"ax" .globl MCSpeed MCSpeed: ; --- stash arg0 (in A) --- @@ -7155,6 +7492,7 @@ MCSpeed: ; MCStopAt(Word, Word, Long) -> void ; tool 0x1F26, set 0x26 (?) + .section .text.MCStopAt,"ax" .globl MCStopAt MCStopAt: ; --- stash arg0 (in A) --- @@ -7166,7 +7504,7 @@ MCStopAt: lda 6, s pha ; --- arg2 (Long, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -7176,6 +7514,7 @@ MCStopAt: ; MCTimeToBin(Long) -> Long ; tool 0x0C26, set 0x26 (?) + .section .text.MCTimeToBin,"ax" .globl MCTimeToBin MCTimeToBin: ; --- stash arg0 (in A/X) --- @@ -7185,10 +7524,10 @@ MCTimeToBin: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0C26 jsl 0xe10000 pla ; result lo -> A @@ -7197,6 +7536,7 @@ MCTimeToBin: ; MCWaitRawData(Word, Ptr, Word, Word) -> void ; tool 0x2C26, set 0x26 (?) + .section .text.MCWaitRawData,"ax" .globl MCWaitRawData MCWaitRawData: ; --- stash arg0 (in A) --- @@ -7205,7 +7545,7 @@ MCWaitRawData: lda 0xE0 pha ; --- arg1 (Ptr, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -7221,23 +7561,24 @@ MCWaitRawData: ; BlockMove(Pointer, Pointer, LongWord) -> void ; tool 0x2B02, set 0x02 (MemoryManager) + .section .text.BlockMove,"ax" .globl BlockMove BlockMove: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Pointer, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (LongWord, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -7247,38 +7588,41 @@ BlockMove: ; CheckHandle(Handle) -> void ; tool 0x1E02, set 0x02 (MemoryManager) + .section .text.CheckHandle,"ax" .globl CheckHandle CheckHandle: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1E02 jsl 0xe10000 rtl ; DisposeHandle(Handle) -> void ; tool 0x1002, set 0x02 (MemoryManager) + .section .text.DisposeHandle,"ax" .globl DisposeHandle DisposeHandle: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1002 jsl 0xe10000 rtl ; FindHandle(Pointer) -> Handle ; tool 0x1A02, set 0x02 (MemoryManager) + .section .text.FindHandle,"ax" .globl FindHandle FindHandle: ; --- stash arg0 (in A/X) --- @@ -7288,10 +7632,10 @@ FindHandle: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1A02 jsl 0xe10000 pla ; result lo -> A @@ -7300,6 +7644,7 @@ FindHandle: ; FreeMem(void) -> LongWord ; tool 0x1B02, set 0x02 (MemoryManager) + .section .text.FreeMem,"ax" .globl FreeMem FreeMem: ; --- result space (4 bytes) --- @@ -7313,6 +7658,7 @@ FreeMem: ; GetHandleSize(Handle) -> LongWord ; tool 0x1802, set 0x02 (MemoryManager) + .section .text.GetHandleSize,"ax" .globl GetHandleSize GetHandleSize: ; --- stash arg0 (in A/X) --- @@ -7322,10 +7668,10 @@ GetHandleSize: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1802 jsl 0xe10000 pla ; result lo -> A @@ -7334,23 +7680,24 @@ GetHandleSize: ; HandToHand(Handle, Handle, LongWord) -> void ; tool 0x2A02, set 0x02 (MemoryManager) + .section .text.HandToHand,"ax" .globl HandToHand HandToHand: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Handle, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (LongWord, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -7360,23 +7707,24 @@ HandToHand: ; HandToPtr(Handle, Pointer, LongWord) -> void ; tool 0x2902, set 0x02 (MemoryManager) + .section .text.HandToPtr,"ax" .globl HandToPtr HandToPtr: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Pointer, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (LongWord, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -7386,38 +7734,41 @@ HandToPtr: ; HLock(Handle) -> void ; tool 0x2002, set 0x02 (MemoryManager) + .section .text.HLock,"ax" .globl HLock HLock: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2002 jsl 0xe10000 rtl ; HUnlock(Handle) -> void ; tool 0x2202, set 0x02 (MemoryManager) + .section .text.HUnlock,"ax" .globl HUnlock HUnlock: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2202 jsl 0xe10000 rtl ; MaxBlock(void) -> LongWord ; tool 0x1C02, set 0x02 (MemoryManager) + .section .text.MaxBlock,"ax" .globl MaxBlock MaxBlock: ; --- result space (4 bytes) --- @@ -7431,6 +7782,7 @@ MaxBlock: ; NewHandle(LongWord, Word, Word, Pointer) -> Handle ; tool 0x0902, set 0x02 (MemoryManager) + .section .text.NewHandle,"ax" .globl NewHandle NewHandle: ; --- stash arg0 (in A/X) --- @@ -7440,10 +7792,10 @@ NewHandle: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 12, s pha @@ -7451,7 +7803,7 @@ NewHandle: lda 16, s pha ; --- arg3 (Pointer, 4B) --- - lda 20, s + lda 22, s pha lda 22, s pha @@ -7463,23 +7815,24 @@ NewHandle: ; PtrToHand(Pointer, Handle, LongWord) -> void ; tool 0x2802, set 0x02 (MemoryManager) + .section .text.PtrToHand,"ax" .globl PtrToHand PtrToHand: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Handle, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (LongWord, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -7489,32 +7842,34 @@ PtrToHand: ; PurgeHandle(Handle) -> void ; tool 0x1202, set 0x02 (MemoryManager) + .section .text.PurgeHandle,"ax" .globl PurgeHandle PurgeHandle: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1202 jsl 0xe10000 rtl ; ReAllocHandle(LongWord, Word, Word, Pointer, Handle) -> void ; tool 0x0A02, set 0x02 (MemoryManager) + .section .text.ReAllocHandle,"ax" .globl ReAllocHandle ReAllocHandle: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -7522,12 +7877,12 @@ ReAllocHandle: lda 12, s pha ; --- arg3 (Pointer, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha ; --- arg4 (Handle, 4B) --- - lda 24, s + lda 26, s pha lda 26, s pha @@ -7537,34 +7892,36 @@ ReAllocHandle: ; RestoreHandle(Handle) -> void ; tool 0x0B02, set 0x02 (MemoryManager) + .section .text.RestoreHandle,"ax" .globl RestoreHandle RestoreHandle: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0B02 jsl 0xe10000 rtl ; SetHandleSize(LongWord, Handle) -> void ; tool 0x1902, set 0x02 (MemoryManager) + .section .text.SetHandleSize,"ax" .globl SetHandleSize SetHandleSize: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Handle, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -7574,6 +7931,7 @@ SetHandleSize: ; SetPurge(Word, Handle) -> void ; tool 0x2402, set 0x02 (MemoryManager) + .section .text.SetPurge,"ax" .globl SetPurge SetPurge: ; --- stash arg0 (in A) --- @@ -7582,7 +7940,7 @@ SetPurge: lda 0xE0 pha ; --- arg1 (Handle, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -7592,6 +7950,7 @@ SetPurge: ; SetPurgeAll(Word, Word) -> void ; tool 0x2502, set 0x02 (MemoryManager) + .section .text.SetPurgeAll,"ax" .globl SetPurgeAll SetPurgeAll: ; --- stash arg0 (in A) --- @@ -7608,6 +7967,7 @@ SetPurgeAll: ; TotalMem(void) -> LongWord ; tool 0x1D02, set 0x02 (MemoryManager) + .section .text.TotalMem,"ax" .globl TotalMem TotalMem: ; --- result space (4 bytes) --- @@ -7621,22 +7981,24 @@ TotalMem: ; AddToOOMQueue(Pointer) -> void ; tool 0x0C02, set 0x02 (MemoryManager) + .section .text.AddToOOMQueue,"ax" .globl AddToOOMQueue AddToOOMQueue: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0C02 jsl 0xe10000 rtl ; RealFreeMem(void) -> LongWord ; tool 0x2F02, set 0x02 (MemoryManager) + .section .text.RealFreeMem,"ax" .globl RealFreeMem RealFreeMem: ; --- result space (4 bytes) --- @@ -7650,22 +8012,24 @@ RealFreeMem: ; RemoveFromOOMQueue(Pointer) -> void ; tool 0x0D02, set 0x02 (MemoryManager) + .section .text.RemoveFromOOMQueue,"ax" .globl RemoveFromOOMQueue RemoveFromOOMQueue: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0D02 jsl 0xe10000 rtl ; SetHandleID(Word, Handle) -> Word ; tool 0x3002, set 0x02 (MemoryManager) + .section .text.SetHandleID,"ax" .globl SetHandleID SetHandleID: ; --- stash arg0 (in A) --- @@ -7676,7 +8040,7 @@ SetHandleID: lda 0xE0 pha ; --- arg1 (Handle, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -7687,6 +8051,7 @@ SetHandleID: ; MenuStartUp(Word, Word) -> void ; tool 0x020F, set 0x0F (MenuManager) + .section .text.MenuStartUp,"ax" .globl MenuStartUp MenuStartUp: ; --- stash arg0 (in A) --- @@ -7703,6 +8068,7 @@ MenuStartUp: ; CalcMenuSize(Word, Word, Word) -> void ; tool 0x1C0F, set 0x0F (MenuManager) + .section .text.CalcMenuSize,"ax" .globl CalcMenuSize CalcMenuSize: ; --- stash arg0 (in A) --- @@ -7722,6 +8088,7 @@ CalcMenuSize: ; CheckMItem(Boolean, Word) -> void ; tool 0x320F, set 0x0F (MenuManager) + .section .text.CheckMItem,"ax" .globl CheckMItem CheckMItem: ; --- stash arg0 (in A) --- @@ -7738,22 +8105,24 @@ CheckMItem: ; DisposeMenu(MenuRecHndl) -> void ; tool 0x2E0F, set 0x0F (MenuManager) + .section .text.DisposeMenu,"ax" .globl DisposeMenu DisposeMenu: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2E0F jsl 0xe10000 rtl ; GetBarColors(void) -> LongWord ; tool 0x180F, set 0x0F (MenuManager) + .section .text.GetBarColors,"ax" .globl GetBarColors GetBarColors: ; --- result space (4 bytes) --- @@ -7767,6 +8136,7 @@ GetBarColors: ; GetMenuBar(void) -> MenuBarRecHndl ; tool 0x0A0F, set 0x0F (MenuManager) + .section .text.GetMenuBar,"ax" .globl GetMenuBar GetMenuBar: ; --- result space (4 bytes) --- @@ -7780,6 +8150,7 @@ GetMenuBar: ; GetMenuMgrPort(void) -> GrafPortPtr ; tool 0x1B0F, set 0x0F (MenuManager) + .section .text.GetMenuMgrPort,"ax" .globl GetMenuMgrPort GetMenuMgrPort: ; --- result space (4 bytes) --- @@ -7793,6 +8164,7 @@ GetMenuMgrPort: ; GetMenuTitle(Word) -> Pointer ; tool 0x220F, set 0x0F (MenuManager) + .section .text.GetMenuTitle,"ax" .globl GetMenuTitle GetMenuTitle: ; --- stash arg0 (in A) --- @@ -7811,6 +8183,7 @@ GetMenuTitle: ; GetMHandle(Word) -> MenuRecHndl ; tool 0x160F, set 0x0F (MenuManager) + .section .text.GetMHandle,"ax" .globl GetMHandle GetMHandle: ; --- stash arg0 (in A) --- @@ -7829,6 +8202,7 @@ GetMHandle: ; GetMItem(Word) -> StringPtr ; tool 0x250F, set 0x0F (MenuManager) + .section .text.GetMItem,"ax" .globl GetMItem GetMItem: ; --- stash arg0 (in A) --- @@ -7847,6 +8221,7 @@ GetMItem: ; GetMItemStyle(Word) -> TextStyle ; tool 0x360F, set 0x0F (MenuManager) + .section .text.GetMItemStyle,"ax" .globl GetMItemStyle GetMItemStyle: ; --- stash arg0 (in A) --- @@ -7865,6 +8240,7 @@ GetMItemStyle: ; GetSysBar(void) -> MenuBarRecHndl ; tool 0x110F, set 0x0F (MenuManager) + .section .text.GetSysBar,"ax" .globl GetSysBar GetSysBar: ; --- result space (4 bytes) --- @@ -7878,6 +8254,7 @@ GetSysBar: ; HiliteMenu(Boolean, Word) -> void ; tool 0x2C0F, set 0x0F (MenuManager) + .section .text.HiliteMenu,"ax" .globl HiliteMenu HiliteMenu: ; --- stash arg0 (in A) --- @@ -7894,16 +8271,17 @@ HiliteMenu: ; InsertMenu(MenuRecHndl, Word) -> void ; tool 0x0D0F, set 0x0F (MenuManager) + .section .text.InsertMenu,"ax" .globl InsertMenu InsertMenu: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -7913,16 +8291,17 @@ InsertMenu: ; InsertMItem(Pointer, Word, Word) -> void ; tool 0x0F0F, set 0x0F (MenuManager) + .section .text.InsertMItem,"ax" .globl InsertMItem InsertMItem: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -7935,18 +8314,19 @@ InsertMItem: ; MenuKey(WmTaskRecPtr, MenuRecHndl) -> void ; tool 0x090F, set 0x0F (MenuManager) + .section .text.MenuKey,"ax" .globl MenuKey MenuKey: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (MenuRecHndl, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -7956,34 +8336,36 @@ MenuKey: ; MenuRefresh(VoidProcPtr) -> void ; tool 0x0B0F, set 0x0F (MenuManager) + .section .text.MenuRefresh,"ax" .globl MenuRefresh MenuRefresh: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0B0F jsl 0xe10000 rtl ; MenuSelect(WmTaskRecPtr, MenuRecHndl) -> void ; tool 0x2B0F, set 0x0F (MenuManager) + .section .text.MenuSelect,"ax" .globl MenuSelect MenuSelect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (MenuRecHndl, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -7993,6 +8375,7 @@ MenuSelect: ; NewMenu(Pointer) -> MenuRecHndl ; tool 0x2D0F, set 0x0F (MenuManager) + .section .text.NewMenu,"ax" .globl NewMenu NewMenu: ; --- stash arg0 (in A/X) --- @@ -8002,10 +8385,10 @@ NewMenu: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2D0F jsl 0xe10000 pla ; result lo -> A @@ -8014,6 +8397,7 @@ NewMenu: ; NewMenuBar(GrafPortPtr) -> MenuBarRecHndl ; tool 0x150F, set 0x0F (MenuManager) + .section .text.NewMenuBar,"ax" .globl NewMenuBar NewMenuBar: ; --- stash arg0 (in A/X) --- @@ -8023,10 +8407,10 @@ NewMenuBar: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x150F jsl 0xe10000 pla ; result lo -> A @@ -8035,6 +8419,7 @@ NewMenuBar: ; SetBarColors(Word, Word, Word) -> void ; tool 0x170F, set 0x0F (MenuManager) + .section .text.SetBarColors,"ax" .globl SetBarColors SetBarColors: ; --- stash arg0 (in A) --- @@ -8054,22 +8439,24 @@ SetBarColors: ; SetMenuBar(MenuBarRecHndl) -> void ; tool 0x390F, set 0x0F (MenuManager) + .section .text.SetMenuBar,"ax" .globl SetMenuBar SetMenuBar: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x390F jsl 0xe10000 rtl ; SetMenuFlag(Word, Word) -> void ; tool 0x1F0F, set 0x0F (MenuManager) + .section .text.SetMenuFlag,"ax" .globl SetMenuFlag SetMenuFlag: ; --- stash arg0 (in A) --- @@ -8086,6 +8473,7 @@ SetMenuFlag: ; SetMenuID(Word, Word) -> void ; tool 0x370F, set 0x0F (MenuManager) + .section .text.SetMenuID,"ax" .globl SetMenuID SetMenuID: ; --- stash arg0 (in A) --- @@ -8102,16 +8490,17 @@ SetMenuID: ; SetMenuTitle(Pointer, Word) -> void ; tool 0x210F, set 0x0F (MenuManager) + .section .text.SetMenuTitle,"ax" .globl SetMenuTitle SetMenuTitle: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -8121,16 +8510,17 @@ SetMenuTitle: ; SetMItem(Pointer, Word) -> void ; tool 0x240F, set 0x0F (MenuManager) + .section .text.SetMItem,"ax" .globl SetMItem SetMItem: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -8140,6 +8530,7 @@ SetMItem: ; SetMItemFlag(Word, Word) -> void ; tool 0x260F, set 0x0F (MenuManager) + .section .text.SetMItemFlag,"ax" .globl SetMItemFlag SetMItemFlag: ; --- stash arg0 (in A) --- @@ -8156,6 +8547,7 @@ SetMItemFlag: ; SetMItemID(Word, Word) -> void ; tool 0x380F, set 0x0F (MenuManager) + .section .text.SetMItemID,"ax" .globl SetMItemID SetMItemID: ; --- stash arg0 (in A) --- @@ -8172,6 +8564,7 @@ SetMItemID: ; SetMItemMark(Word, Word) -> void ; tool 0x330F, set 0x0F (MenuManager) + .section .text.SetMItemMark,"ax" .globl SetMItemMark SetMItemMark: ; --- stash arg0 (in A) --- @@ -8188,16 +8581,17 @@ SetMItemMark: ; SetMItemName(Pointer, Word) -> void ; tool 0x3A0F, set 0x0F (MenuManager) + .section .text.SetMItemName,"ax" .globl SetMItemName SetMItemName: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -8207,16 +8601,17 @@ SetMItemName: ; SetMItemStyle(TextStyle, Word) -> void ; tool 0x350F, set 0x0F (MenuManager) + .section .text.SetMItemStyle,"ax" .globl SetMItemStyle SetMItemStyle: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -8226,6 +8621,7 @@ SetMItemStyle: ; SetMTitleWidth(Word, Word) -> void ; tool 0x1D0F, set 0x0F (MenuManager) + .section .text.SetMTitleWidth,"ax" .globl SetMTitleWidth SetMTitleWidth: ; --- stash arg0 (in A) --- @@ -8242,22 +8638,24 @@ SetMTitleWidth: ; SetSysBar(MenuBarRecHndl) -> void ; tool 0x120F, set 0x0F (MenuManager) + .section .text.SetSysBar,"ax" .globl SetSysBar SetSysBar: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x120F jsl 0xe10000 rtl ; GetPopUpDefProc(void) -> Pointer ; tool 0x3B0F, set 0x0F (MenuManager) + .section .text.GetPopUpDefProc,"ax" .globl GetPopUpDefProc GetPopUpDefProc: ; --- result space (4 bytes) --- @@ -8271,6 +8669,7 @@ GetPopUpDefProc: ; InsertMItem2(Word, Ref, Word, Word) -> void ; tool 0x3F0F, set 0x0F (MenuManager) + .section .text.InsertMItem2,"ax" .globl InsertMItem2 InsertMItem2: ; --- stash arg0 (in A) --- @@ -8279,7 +8678,7 @@ InsertMItem2: lda 0xE0 pha ; --- arg1 (Ref, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -8295,6 +8694,7 @@ InsertMItem2: ; NewMenu2(Word, Ref) -> MenuRecHndl ; tool 0x3E0F, set 0x0F (MenuManager) + .section .text.NewMenu2,"ax" .globl NewMenu2 NewMenu2: ; --- stash arg0 (in A) --- @@ -8306,7 +8706,7 @@ NewMenu2: lda 0xE0 pha ; --- arg1 (Ref, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -8318,6 +8718,7 @@ NewMenu2: ; NewMenuBar2(Word, Ref, Pointer) -> MenuBarRecHndl ; tool 0x430F, set 0x0F (MenuManager) + .section .text.NewMenuBar2,"ax" .globl NewMenuBar2 NewMenuBar2: ; --- stash arg0 (in A) --- @@ -8329,12 +8730,12 @@ NewMenuBar2: lda 0xE0 pha ; --- arg1 (Ref, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha ; --- arg2 (Pointer, 4B) --- - lda 18, s + lda 20, s pha lda 20, s pha @@ -8346,6 +8747,7 @@ NewMenuBar2: ; PopUpMenuSelect(Word, Word, Word, Word, MenuRecHndl) -> Word ; tool 0x3C0F, set 0x0F (MenuManager) + .section .text.PopUpMenuSelect,"ax" .globl PopUpMenuSelect PopUpMenuSelect: ; --- stash arg0 (in A) --- @@ -8365,7 +8767,7 @@ PopUpMenuSelect: lda 16, s pha ; --- arg4 (MenuRecHndl, 4B) --- - lda 20, s + lda 22, s pha lda 22, s pha @@ -8376,6 +8778,7 @@ PopUpMenuSelect: ; SetMenuTitle2(Word, Ref, Word) -> void ; tool 0x400F, set 0x0F (MenuManager) + .section .text.SetMenuTitle2,"ax" .globl SetMenuTitle2 SetMenuTitle2: ; --- stash arg0 (in A) --- @@ -8384,7 +8787,7 @@ SetMenuTitle2: lda 0xE0 pha ; --- arg1 (Ref, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -8397,6 +8800,7 @@ SetMenuTitle2: ; SetMItem2(Word, Ref, Word) -> void ; tool 0x410F, set 0x0F (MenuManager) + .section .text.SetMItem2,"ax" .globl SetMItem2 SetMItem2: ; --- stash arg0 (in A) --- @@ -8405,7 +8809,7 @@ SetMItem2: lda 0xE0 pha ; --- arg1 (Ref, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -8418,6 +8822,7 @@ SetMItem2: ; SetMItemName2(Word, Ref, Word) -> void ; tool 0x420F, set 0x0F (MenuManager) + .section .text.SetMItemName2,"ax" .globl SetMItemName2 SetMItemName2: ; --- stash arg0 (in A) --- @@ -8426,7 +8831,7 @@ SetMItemName2: lda 0xE0 pha ; --- arg1 (Ref, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -8439,6 +8844,7 @@ SetMItemName2: ; GetMItemIcon(Word) -> Ref ; tool 0x480F, set 0x0F (MenuManager) + .section .text.GetMItemIcon,"ax" .globl GetMItemIcon GetMItemIcon: ; --- stash arg0 (in A) --- @@ -8457,6 +8863,7 @@ GetMItemIcon: ; GetMItemStruct(Word) -> Ref ; tool 0x4A0F, set 0x0F (MenuManager) + .section .text.GetMItemStruct,"ax" .globl GetMItemStruct GetMItemStruct: ; --- stash arg0 (in A) --- @@ -8475,6 +8882,7 @@ GetMItemStruct: ; InsertPathMItems(Word, Pointer, Word, Word, Word, Word, Ptr) -> void ; tool 0x500F, set 0x0F (MenuManager) + .section .text.InsertPathMItems,"ax" .globl InsertPathMItems InsertPathMItems: ; --- stash arg0 (in A) --- @@ -8483,7 +8891,7 @@ InsertPathMItems: lda 0xE0 pha ; --- arg1 (Pointer, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -8500,7 +8908,7 @@ InsertPathMItems: lda 26, s pha ; --- arg6 (Ptr, 4B) --- - lda 30, s + lda 32, s pha lda 32, s pha @@ -8510,6 +8918,7 @@ InsertPathMItems: ; SetMItemFlag2(Word, Word) -> void ; tool 0x4D0F, set 0x0F (MenuManager) + .section .text.SetMItemFlag2,"ax" .globl SetMItemFlag2 SetMItemFlag2: ; --- stash arg0 (in A) --- @@ -8526,6 +8935,7 @@ SetMItemFlag2: ; SetMItemIcon(Word, Ref, Word) -> void ; tool 0x470F, set 0x0F (MenuManager) + .section .text.SetMItemIcon,"ax" .globl SetMItemIcon SetMItemIcon: ; --- stash arg0 (in A) --- @@ -8534,7 +8944,7 @@ SetMItemIcon: lda 0xE0 pha ; --- arg1 (Ref, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -8547,6 +8957,7 @@ SetMItemIcon: ; SetMItemStruct(Word, Ref, Word) -> void ; tool 0x490F, set 0x0F (MenuManager) + .section .text.SetMItemStruct,"ax" .globl SetMItemStruct SetMItemStruct: ; --- stash arg0 (in A) --- @@ -8555,7 +8966,7 @@ SetMItemStruct: lda 0xE0 pha ; --- arg1 (Ref, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -8568,6 +8979,7 @@ SetMItemStruct: ; MidiStartUp(Word, Word) -> void ; tool 0x0220, set 0x20 (VideoOverlay) + .section .text.MidiStartUp,"ax" .globl MidiStartUp MidiStartUp: ; --- stash arg0 (in A) --- @@ -8584,6 +8996,7 @@ MidiStartUp: ; MidiClock(Word, Long) -> void ; tool 0x0B20, set 0x20 (VideoOverlay) + .section .text.MidiClock,"ax" .globl MidiClock MidiClock: ; --- stash arg0 (in A) --- @@ -8592,7 +9005,7 @@ MidiClock: lda 0xE0 pha ; --- arg1 (Long, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -8602,6 +9015,7 @@ MidiClock: ; MidiControl(Word, Long) -> void ; tool 0x0920, set 0x20 (VideoOverlay) + .section .text.MidiControl,"ax" .globl MidiControl MidiControl: ; --- stash arg0 (in A) --- @@ -8610,7 +9024,7 @@ MidiControl: lda 0xE0 pha ; --- arg1 (Long, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -8620,6 +9034,7 @@ MidiControl: ; MidiDevice(Word, Pointer) -> void ; tool 0x0A20, set 0x20 (VideoOverlay) + .section .text.MidiDevice,"ax" .globl MidiDevice MidiDevice: ; --- stash arg0 (in A) --- @@ -8628,7 +9043,7 @@ MidiDevice: lda 0xE0 pha ; --- arg1 (Pointer, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -8638,6 +9053,7 @@ MidiDevice: ; MidiInfo(Word) -> LongWord ; tool 0x0C20, set 0x20 (VideoOverlay) + .section .text.MidiInfo,"ax" .globl MidiInfo MidiInfo: ; --- stash arg0 (in A) --- @@ -8656,6 +9072,7 @@ MidiInfo: ; MidiReadPacket(Pointer, Word) -> Word ; tool 0x0D20, set 0x20 (VideoOverlay) + .section .text.MidiReadPacket,"ax" .globl MidiReadPacket MidiReadPacket: ; --- stash arg0 (in A/X) --- @@ -8664,10 +9081,10 @@ MidiReadPacket: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 10, s pha @@ -8678,6 +9095,7 @@ MidiReadPacket: ; MidiWritePacket(Pointer) -> Word ; tool 0x0E20, set 0x20 (VideoOverlay) + .section .text.MidiWritePacket,"ax" .globl MidiWritePacket MidiWritePacket: ; --- stash arg0 (in A/X) --- @@ -8686,10 +9104,10 @@ MidiWritePacket: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0E20 jsl 0xe10000 pla ; result -> A @@ -8697,6 +9115,7 @@ MidiWritePacket: ; MSVersion(void) -> word ; tool 0x0423, set 0x23 (MediaControl) + .section .text.MSVersion,"ax" .globl MSVersion MSVersion: ; --- result space (4 bytes) --- @@ -8710,6 +9129,7 @@ MSVersion: ; MSStatus(void) -> word ; tool 0x0623, set 0x23 (MediaControl) + .section .text.MSStatus,"ax" .globl MSStatus MSStatus: ; --- result space (4 bytes) --- @@ -8723,6 +9143,7 @@ MSStatus: ; ConvertToTime(Word, Word, Word, Word) -> long ; tool 0x2023, set 0x23 (MediaControl) + .section .text.ConvertToTime,"ax" .globl ConvertToTime ConvertToTime: ; --- stash arg0 (in A) --- @@ -8750,6 +9171,7 @@ ConvertToTime: ; DeleteTrack(Word, Ptr) -> void ; tool 0x1D23, set 0x23 (MediaControl) + .section .text.DeleteTrack,"ax" .globl DeleteTrack DeleteTrack: ; --- stash arg0 (in A) --- @@ -8758,7 +9180,7 @@ DeleteTrack: lda 0xE0 pha ; --- arg1 (Ptr, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -8768,22 +9190,24 @@ DeleteTrack: ; GetTuningTable(Ptr) -> void ; tool 0x2523, set 0x23 (MediaControl) + .section .text.GetTuningTable,"ax" .globl GetTuningTable GetTuningTable: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2523 jsl 0xe10000 rtl ; InitMIDIDriver(Word, Word, Word, ProcPtr) -> void ; tool 0x2723, set 0x23 (MediaControl) + .section .text.InitMIDIDriver,"ax" .globl InitMIDIDriver InitMIDIDriver: ; --- stash arg0 (in A) --- @@ -8798,7 +9222,7 @@ InitMIDIDriver: lda 10, s pha ; --- arg3 (ProcPtr, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -8808,6 +9232,7 @@ InitMIDIDriver: ; Locate(Long, Ptr) -> SeqItemRecPtr ; tool 0x1123, set 0x23 (MediaControl) + .section .text.Locate,"ax" .globl Locate Locate: ; --- stash arg0 (in A/X) --- @@ -8817,12 +9242,12 @@ Locate: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Ptr, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -8834,6 +9259,7 @@ Locate: ; LocateEnd(Ptr) -> pointer ; tool 0x1B23, set 0x23 (MediaControl) + .section .text.LocateEnd,"ax" .globl LocateEnd LocateEnd: ; --- stash arg0 (in A/X) --- @@ -8843,10 +9269,10 @@ LocateEnd: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1B23 jsl 0xe10000 pla ; result lo -> A @@ -8855,18 +9281,19 @@ LocateEnd: ; Merge(Ptr, Ptr) -> void ; tool 0x1C23, set 0x23 (MediaControl) + .section .text.Merge,"ax" .globl Merge Merge: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Ptr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -8876,6 +9303,7 @@ Merge: ; MIDIMessage(Word, Word, Word, Word, Word) -> void ; tool 0x1A23, set 0x23 (MediaControl) + .section .text.MIDIMessage,"ax" .globl MIDIMessage MIDIMessage: ; --- stash arg0 (in A) --- @@ -8901,6 +9329,7 @@ MIDIMessage: ; PlayNote(Word, Word, Word) -> void ; tool 0x0B23, set 0x23 (MediaControl) + .section .text.PlayNote,"ax" .globl PlayNote PlayNote: ; --- stash arg0 (in A) --- @@ -8920,48 +9349,51 @@ PlayNote: ; SeqPlayer(SeqPlayRecPtr) -> void ; tool 0x1523, set 0x23 (MediaControl) + .section .text.SeqPlayer,"ax" .globl SeqPlayer SeqPlayer: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1523 jsl 0xe10000 rtl ; SetCallBack(CallBackRecPtr) -> void ; tool 0x1723, set 0x23 (MediaControl) + .section .text.SetCallBack,"ax" .globl SetCallBack SetCallBack: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1723 jsl 0xe10000 rtl ; SetInstrument(InstrumentRecPtr, Word) -> void ; tool 0x1423, set 0x23 (MediaControl) + .section .text.SetInstrument,"ax" .globl SetInstrument SetInstrument: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -8971,6 +9403,7 @@ SetInstrument: ; SetMetro(Word, Word, Ptr) -> void ; tool 0x1E23, set 0x23 (MediaControl) + .section .text.SetMetro,"ax" .globl SetMetro SetMetro: ; --- stash arg0 (in A) --- @@ -8982,7 +9415,7 @@ SetMetro: lda 6, s pha ; --- arg2 (Ptr, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -8992,6 +9425,7 @@ SetMetro: ; SetMIDIPort(Boolean, Boolean) -> void ; tool 0x1323, set 0x23 (MediaControl) + .section .text.SetMIDIPort,"ax" .globl SetMIDIPort SetMIDIPort: ; --- stash arg0 (in A) --- @@ -9008,6 +9442,7 @@ SetMIDIPort: ; SetPlayTrack(Word, Boolean) -> void ; tool 0x0F23, set 0x23 (MediaControl) + .section .text.SetPlayTrack,"ax" .globl SetPlayTrack SetPlayTrack: ; --- stash arg0 (in A) --- @@ -9024,6 +9459,7 @@ SetPlayTrack: ; SetTrackOut(Word, Word) -> void ; tool 0x2623, set 0x23 (MediaControl) + .section .text.SetTrackOut,"ax" .globl SetTrackOut SetTrackOut: ; --- stash arg0 (in A) --- @@ -9040,22 +9476,24 @@ SetTrackOut: ; SetTuningTable(Ptr) -> void ; tool 0x2423, set 0x23 (MediaControl) + .section .text.SetTuningTable,"ax" .globl SetTuningTable SetTuningTable: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2423 jsl 0xe10000 rtl ; StopNote(Word, Word) -> void ; tool 0x0C23, set 0x23 (MediaControl) + .section .text.StopNote,"ax" .globl StopNote StopNote: ; --- stash arg0 (in A) --- @@ -9072,21 +9510,22 @@ StopNote: ; SysExOut(Ptr, Word, ProcPtr) -> void ; tool 0x1823, set 0x23 (MediaControl) + .section .text.SysExOut,"ax" .globl SysExOut SysExOut: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha ; --- arg2 (ProcPtr, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -9096,6 +9535,7 @@ SysExOut: ; TrackToChannel(Word, Word) -> void ; tool 0x1023, set 0x23 (MediaControl) + .section .text.TrackToChannel,"ax" .globl TrackToChannel TrackToChannel: ; --- stash arg0 (in A) --- @@ -9112,38 +9552,41 @@ TrackToChannel: ; WriteBRam(Pointer) -> void ; tool 0x0903, set 0x03 (MiscTools) + .section .text.WriteBRam,"ax" .globl WriteBRam WriteBRam: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0903 jsl 0xe10000 rtl ; ReadBRam(Pointer) -> void ; tool 0x0A03, set 0x03 (MiscTools) + .section .text.ReadBRam,"ax" .globl ReadBRam ReadBRam: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0A03 jsl 0xe10000 rtl ; WriteBParam(Word, Word) -> void ; tool 0x0B03, set 0x03 (MiscTools) + .section .text.WriteBParam,"ax" .globl WriteBParam WriteBParam: ; --- stash arg0 (in A) --- @@ -9160,38 +9603,41 @@ WriteBParam: ; WriteTimeHex(HexTime) -> void ; tool 0x0E03, set 0x03 (MiscTools) + .section .text.WriteTimeHex,"ax" .globl WriteTimeHex WriteTimeHex: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0E03 jsl 0xe10000 rtl ; ReadAsciiTime(Pointer) -> void ; tool 0x0F03, set 0x03 (MiscTools) + .section .text.ReadAsciiTime,"ax" .globl ReadAsciiTime ReadAsciiTime: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0F03 jsl 0xe10000 rtl ; GetAddr(Word) -> Pointer ; tool 0x1603, set 0x03 (MiscTools) + .section .text.GetAddr,"ax" .globl GetAddr GetAddr: ; --- stash arg0 (in A) --- @@ -9210,6 +9656,7 @@ GetAddr: ; GetTick(void) -> LongWord ; tool 0x2503, set 0x03 (MiscTools) + .section .text.GetTick,"ax" .globl GetTick GetTick: ; --- result space (4 bytes) --- @@ -9223,6 +9670,7 @@ GetTick: ; ClampMouse(Word, Word, Word, Word) -> void ; tool 0x1C03, set 0x03 (MiscTools) + .section .text.ClampMouse,"ax" .globl ClampMouse ClampMouse: ; --- stash arg0 (in A) --- @@ -9245,6 +9693,7 @@ ClampMouse: ; PosMouse(Integer, Integer) -> void ; tool 0x1E03, set 0x03 (MiscTools) + .section .text.PosMouse,"ax" .globl PosMouse PosMouse: ; --- stash arg0 (in A) --- @@ -9261,6 +9710,7 @@ PosMouse: ; PackBytes(Handle, Word, Pointer, Word) -> Word ; tool 0x2603, set 0x03 (MiscTools) + .section .text.PackBytes,"ax" .globl PackBytes PackBytes: ; --- stash arg0 (in A/X) --- @@ -9269,15 +9719,15 @@ PackBytes: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 10, s pha ; --- arg2 (Pointer, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -9291,6 +9741,7 @@ PackBytes: ; UnPackBytes(Pointer, Word, Handle, Word) -> Word ; tool 0x2703, set 0x03 (MiscTools) + .section .text.UnPackBytes,"ax" .globl UnPackBytes UnPackBytes: ; --- stash arg0 (in A/X) --- @@ -9299,15 +9750,15 @@ UnPackBytes: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 10, s pha ; --- arg2 (Handle, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -9321,6 +9772,7 @@ UnPackBytes: ; Munger(Handle, Word, Pointer, Word, Pointer, Word, Pointer) -> Word ; tool 0x2803, set 0x03 (MiscTools) + .section .text.Munger,"ax" .globl Munger Munger: ; --- stash arg0 (in A/X) --- @@ -9329,15 +9781,15 @@ Munger: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 10, s pha ; --- arg2 (Pointer, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -9345,7 +9797,7 @@ Munger: lda 22, s pha ; --- arg4 (Pointer, 4B) --- - lda 26, s + lda 28, s pha lda 28, s pha @@ -9353,7 +9805,7 @@ Munger: lda 34, s pha ; --- arg6 (Pointer, 4B) --- - lda 38, s + lda 40, s pha lda 40, s pha @@ -9364,38 +9816,41 @@ Munger: ; SetHeartBeat(Pointer) -> void ; tool 0x1203, set 0x03 (MiscTools) + .section .text.SetHeartBeat,"ax" .globl SetHeartBeat SetHeartBeat: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1203 jsl 0xe10000 rtl ; DelHeartBeat(Pointer) -> void ; tool 0x1303, set 0x03 (MiscTools) + .section .text.DelHeartBeat,"ax" .globl DelHeartBeat DelHeartBeat: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1303 jsl 0xe10000 rtl ; SysFailMgr(Word, Pointer) -> void ; tool 0x1503, set 0x03 (MiscTools) + .section .text.SysFailMgr,"ax" .globl SysFailMgr SysFailMgr: ; --- stash arg0 (in A) --- @@ -9404,7 +9859,7 @@ SysFailMgr: lda 0xE0 pha ; --- arg1 (Pointer, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -9414,6 +9869,7 @@ SysFailMgr: ; SetVector(Word, Pointer) -> void ; tool 0x1003, set 0x03 (MiscTools) + .section .text.SetVector,"ax" .globl SetVector SetVector: ; --- stash arg0 (in A) --- @@ -9422,7 +9878,7 @@ SetVector: lda 0xE0 pha ; --- arg1 (Pointer, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -9432,6 +9888,7 @@ SetVector: ; GetVector(Word) -> Pointer ; tool 0x1103, set 0x03 (MiscTools) + .section .text.GetVector,"ax" .globl GetVector GetVector: ; --- stash arg0 (in A) --- @@ -9450,18 +9907,19 @@ GetVector: ; AddToQueue(Pointer, Pointer) -> void ; tool 0x2E03, set 0x03 (MiscTools) + .section .text.AddToQueue,"ax" .globl AddToQueue AddToQueue: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Pointer, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -9471,18 +9929,19 @@ AddToQueue: ; DeleteFromQueue(Pointer, Pointer) -> void ; tool 0x2F03, set 0x03 (MiscTools) + .section .text.DeleteFromQueue,"ax" .globl DeleteFromQueue DeleteFromQueue: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Pointer, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -9492,6 +9951,7 @@ DeleteFromQueue: ; GetCodeResConverter(void) -> ProcPtr ; tool 0x3403, set 0x03 (MiscTools) + .section .text.GetCodeResConverter,"ax" .globl GetCodeResConverter GetCodeResConverter: ; --- result space (4 bytes) --- @@ -9505,16 +9965,17 @@ GetCodeResConverter: ; GetInterruptState(Pointer, Word) -> void ; tool 0x3103, set 0x03 (MiscTools) + .section .text.GetInterruptState,"ax" .globl GetInterruptState GetInterruptState: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -9524,16 +9985,17 @@ GetInterruptState: ; SetInterruptState(Pointer, Word) -> void ; tool 0x3003, set 0x03 (MiscTools) + .section .text.SetInterruptState,"ax" .globl SetInterruptState SetInterruptState: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -9543,6 +10005,7 @@ SetInterruptState: ; ConvSeconds(Word, Long, Pointer) -> LongWord ; tool 0x3703, set 0x03 (MiscTools) + .section .text.ConvSeconds,"ax" .globl ConvSeconds ConvSeconds: ; --- stash arg0 (in A) --- @@ -9554,12 +10017,12 @@ ConvSeconds: lda 0xE0 pha ; --- arg1 (Long, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha ; --- arg2 (Pointer, 4B) --- - lda 18, s + lda 20, s pha lda 20, s pha @@ -9571,18 +10034,19 @@ ConvSeconds: ; ShowBootInfo(Pointer, Pointer) -> void ; tool 0x3C03, set 0x03 (MiscTools) + .section .text.ShowBootInfo,"ax" .globl ShowBootInfo ShowBootInfo: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Pointer, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -9592,6 +10056,7 @@ ShowBootInfo: ; StringToText(Word, Ptr, Word, Ptr) -> LongWord ; tool 0x3B03, set 0x03 (MiscTools) + .section .text.StringToText,"ax" .globl StringToText StringToText: ; --- stash arg0 (in A) --- @@ -9603,7 +10068,7 @@ StringToText: lda 0xE0 pha ; --- arg1 (Ptr, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -9611,7 +10076,7 @@ StringToText: lda 18, s pha ; --- arg3 (Ptr, 4B) --- - lda 22, s + lda 24, s pha lda 24, s pha @@ -9623,6 +10088,7 @@ StringToText: ; VersionString(Word, Long, Ptr) -> void ; tool 0x3903, set 0x03 (MiscTools) + .section .text.VersionString,"ax" .globl VersionString VersionString: ; --- stash arg0 (in A) --- @@ -9631,12 +10097,12 @@ VersionString: lda 0xE0 pha ; --- arg1 (Long, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha ; --- arg2 (Ptr, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -9646,6 +10112,7 @@ VersionString: ; WaitUntil(Word, Word) -> Word ; tool 0x3A03, set 0x03 (MiscTools) + .section .text.WaitUntil,"ax" .globl WaitUntil WaitUntil: ; --- stash arg0 (in A) --- @@ -9665,6 +10132,7 @@ WaitUntil: ; AlertMessage(Ptr, Word, Ptr) -> Word ; tool 0x3E03, set 0x03 (MiscTools) + .section .text.AlertMessage,"ax" .globl AlertMessage AlertMessage: ; --- stash arg0 (in A/X) --- @@ -9673,15 +10141,15 @@ AlertMessage: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 10, s pha ; --- arg2 (Ptr, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -9692,6 +10160,7 @@ AlertMessage: ; DoSysPrefs(Word, Word) -> Word ; tool 0x3F03, set 0x03 (MiscTools) + .section .text.DoSysPrefs,"ax" .globl DoSysPrefs DoSysPrefs: ; --- stash arg0 (in A) --- @@ -9711,6 +10180,7 @@ DoSysPrefs: ; SeqStartUp(Word, Word, Word, Word) -> void ; tool 0x021A, set 0x1A (NoteSequencer) + .section .text.SeqStartUp,"ax" .globl SeqStartUp SeqStartUp: ; --- stash arg0 (in A) --- @@ -9733,22 +10203,24 @@ SeqStartUp: ; SetInstTable(Handle) -> void ; tool 0x121A, set 0x1A (NoteSequencer) + .section .text.SetInstTable,"ax" .globl SetInstTable SetInstTable: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x121A jsl 0xe10000 rtl ; SetTrkInfo(Word, Word, Word) -> void ; tool 0x0E1A, set 0x1A (NoteSequencer) + .section .text.SetTrkInfo,"ax" .globl SetTrkInfo SetTrkInfo: ; --- stash arg0 (in A) --- @@ -9768,23 +10240,24 @@ SetTrkInfo: ; StartSeq(Pointer, Pointer, Handle) -> void ; tool 0x0F1A, set 0x1A (NoteSequencer) + .section .text.StartSeq,"ax" .globl StartSeq StartSeq: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Pointer, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (Handle, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -9794,23 +10267,24 @@ StartSeq: ; StartSeqRel(Pointer, Pointer, Handle) -> void ; tool 0x151A, set 0x1A (NoteSequencer) + .section .text.StartSeqRel,"ax" .globl StartSeqRel StartSeqRel: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Pointer, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (Handle, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -9820,6 +10294,7 @@ StartSeqRel: ; NSStartUp(Word, Pointer) -> void ; tool 0x0219, set 0x19 (NoteSynth) + .section .text.NSStartUp,"ax" .globl NSStartUp NSStartUp: ; --- stash arg0 (in A) --- @@ -9828,7 +10303,7 @@ NSStartUp: lda 0xE0 pha ; --- arg1 (Pointer, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -9838,6 +10313,7 @@ NSStartUp: ; NoteOff(Word, Word) -> void ; tool 0x0C19, set 0x19 (NoteSynth) + .section .text.NoteOff,"ax" .globl NoteOff NoteOff: ; --- stash arg0 (in A) --- @@ -9854,6 +10330,7 @@ NoteOff: ; NoteOn(Word, Word, Word, Pointer) -> void ; tool 0x0B19, set 0x19 (NoteSynth) + .section .text.NoteOn,"ax" .globl NoteOn NoteOn: ; --- stash arg0 (in A) --- @@ -9868,7 +10345,7 @@ NoteOn: lda 10, s pha ; --- arg3 (Pointer, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -9878,6 +10355,7 @@ NoteOn: ; NSSetUserUpdateRtn(Pointer) -> VoidProcPtr ; tool 0x0F19, set 0x19 (NoteSynth) + .section .text.NSSetUserUpdateRtn,"ax" .globl NSSetUserUpdateRtn NSSetUserUpdateRtn: ; --- stash arg0 (in A/X) --- @@ -9887,10 +10365,10 @@ NSSetUserUpdateRtn: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0F19 jsl 0xe10000 pla ; result lo -> A @@ -9899,6 +10377,7 @@ NSSetUserUpdateRtn: ; PMStartUp(Word, Word) -> void ; tool 0x0213, set 0x13 (PrintManager) + .section .text.PMStartUp,"ax" .globl PMStartUp PMStartUp: ; --- stash arg0 (in A) --- @@ -9915,54 +10394,58 @@ PMStartUp: ; PrCloseDoc(GrafPortPtr) -> void ; tool 0x0F13, set 0x13 (PrintManager) + .section .text.PrCloseDoc,"ax" .globl PrCloseDoc PrCloseDoc: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0F13 jsl 0xe10000 rtl ; PrClosePage(GrafPortPtr) -> void ; tool 0x1113, set 0x13 (PrintManager) + .section .text.PrClosePage,"ax" .globl PrClosePage PrClosePage: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1113 jsl 0xe10000 rtl ; PrDefault(PrRecHndl) -> void ; tool 0x0913, set 0x13 (PrintManager) + .section .text.PrDefault,"ax" .globl PrDefault PrDefault: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0913 jsl 0xe10000 rtl ; PrJobDialog(PrRecHndl) -> Boolean ; tool 0x0C13, set 0x13 (PrintManager) + .section .text.PrJobDialog,"ax" .globl PrJobDialog PrJobDialog: ; --- stash arg0 (in A/X) --- @@ -9971,10 +10454,10 @@ PrJobDialog: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0C13 jsl 0xe10000 pla ; result -> A @@ -9982,6 +10465,7 @@ PrJobDialog: ; PrOpenDoc(PrRecHndl, GrafPortPtr) -> GrafPortPtr ; tool 0x0E13, set 0x13 (PrintManager) + .section .text.PrOpenDoc,"ax" .globl PrOpenDoc PrOpenDoc: ; --- stash arg0 (in A/X) --- @@ -9991,12 +10475,12 @@ PrOpenDoc: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -10008,18 +10492,19 @@ PrOpenDoc: ; PrOpenPage(GrafPortPtr, Rect) -> void ; tool 0x1013, set 0x13 (PrintManager) + .section .text.PrOpenPage,"ax" .globl PrOpenPage PrOpenPage: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Rect, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -10029,23 +10514,24 @@ PrOpenPage: ; PrPicFile(PrRecHndl, GrafPortPtr, PrStatusRecPtr) -> void ; tool 0x1213, set 0x13 (PrintManager) + .section .text.PrPicFile,"ax" .globl PrPicFile PrPicFile: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (PrStatusRecPtr, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -10055,18 +10541,19 @@ PrPicFile: ; PrPixelMap(LocInfoPtr, RectPtr, Boolean) -> void ; tool 0x0D13, set 0x13 (PrintManager) + .section .text.PrPixelMap,"ax" .globl PrPixelMap PrPixelMap: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (RectPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -10079,6 +10566,7 @@ PrPixelMap: ; PrStlDialog(PrRecHndl) -> Boolean ; tool 0x0B13, set 0x13 (PrintManager) + .section .text.PrStlDialog,"ax" .globl PrStlDialog PrStlDialog: ; --- stash arg0 (in A/X) --- @@ -10087,10 +10575,10 @@ PrStlDialog: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0B13 jsl 0xe10000 pla ; result -> A @@ -10098,6 +10586,7 @@ PrStlDialog: ; PrValidate(PrRecHndl) -> Boolean ; tool 0x0A13, set 0x13 (PrintManager) + .section .text.PrValidate,"ax" .globl PrValidate PrValidate: ; --- stash arg0 (in A/X) --- @@ -10106,10 +10595,10 @@ PrValidate: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0A13 jsl 0xe10000 pla ; result -> A @@ -10117,6 +10606,7 @@ PrValidate: ; PrGetDocName(void) -> StringPtr ; tool 0x3613, set 0x13 (PrintManager) + .section .text.PrGetDocName,"ax" .globl PrGetDocName PrGetDocName: ; --- result space (4 bytes) --- @@ -10130,6 +10620,7 @@ PrGetDocName: ; PrGetPgOrientation(PrRecHndl) -> Word ; tool 0x3813, set 0x13 (PrintManager) + .section .text.PrGetPgOrientation,"ax" .globl PrGetPgOrientation PrGetPgOrientation: ; --- stash arg0 (in A/X) --- @@ -10138,10 +10629,10 @@ PrGetPgOrientation: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x3813 jsl 0xe10000 pla ; result -> A @@ -10149,6 +10640,7 @@ PrGetPgOrientation: ; PrGetPrinterSpecs(void) -> long ; tool 0x1813, set 0x13 (PrintManager) + .section .text.PrGetPrinterSpecs,"ax" .globl PrGetPrinterSpecs PrGetPrinterSpecs: ; --- result space (4 bytes) --- @@ -10162,22 +10654,24 @@ PrGetPrinterSpecs: ; PrSetDocName(Pointer) -> void ; tool 0x3713, set 0x13 (PrintManager) + .section .text.PrSetDocName,"ax" .globl PrSetDocName PrSetDocName: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x3713 jsl 0xe10000 rtl ; PrGetNetworkName(void) -> StringPtr ; tool 0x2B13, set 0x13 (PrintManager) + .section .text.PrGetNetworkName,"ax" .globl PrGetNetworkName PrGetNetworkName: ; --- result space (4 bytes) --- @@ -10191,6 +10685,7 @@ PrGetNetworkName: ; PrGetPortDvrName(void) -> StringPtr ; tool 0x2913, set 0x13 (PrintManager) + .section .text.PrGetPortDvrName,"ax" .globl PrGetPortDvrName PrGetPortDvrName: ; --- result space (4 bytes) --- @@ -10204,6 +10699,7 @@ PrGetPortDvrName: ; PrGetPrinterDvrName(void) -> StringPtr ; tool 0x2813, set 0x13 (PrintManager) + .section .text.PrGetPrinterDvrName,"ax" .globl PrGetPrinterDvrName PrGetPrinterDvrName: ; --- result space (4 bytes) --- @@ -10217,6 +10713,7 @@ PrGetPrinterDvrName: ; PrGetUserName(void) -> StringPtr ; tool 0x2A13, set 0x13 (PrintManager) + .section .text.PrGetUserName,"ax" .globl PrGetUserName PrGetUserName: ; --- result space (4 bytes) --- @@ -10230,6 +10727,7 @@ PrGetUserName: ; PrGetZoneName(void) -> StringPtr ; tool 0x2513, set 0x13 (PrintManager) + .section .text.PrGetZoneName,"ax" .globl PrGetZoneName PrGetZoneName: ; --- result space (4 bytes) --- @@ -10243,28 +10741,29 @@ PrGetZoneName: ; CopyPixels(LocInfoPtr, LocInfoPtr, Rect, Rect, Word, RegionHndl) -> void ; tool 0x0912, set 0x12 (QDAuxiliary) + .section .text.CopyPixels,"ax" .globl CopyPixels CopyPixels: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (LocInfoPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (Rect, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha ; --- arg3 (Rect, 4B) --- - lda 24, s + lda 26, s pha lda 26, s pha @@ -10272,7 +10771,7 @@ CopyPixels: lda 32, s pha ; --- arg5 (RegionHndl, 4B) --- - lda 36, s + lda 38, s pha lda 38, s pha @@ -10282,16 +10781,17 @@ CopyPixels: ; DrawIcon(Pointer, Word, Word, Word) -> void ; tool 0x0B12, set 0x12 (QDAuxiliary) + .section .text.DrawIcon,"ax" .globl DrawIcon DrawIcon: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -10307,18 +10807,19 @@ DrawIcon: ; DrawPicture(Handle, Rect) -> void ; tool 0xBA04, set 0x04 (QuickDraw) + .section .text.DrawPicture,"ax" .globl DrawPicture DrawPicture: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Rect, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -10328,22 +10829,24 @@ DrawPicture: ; KillPicture(Handle) -> void ; tool 0xBB04, set 0x04 (QuickDraw) + .section .text.KillPicture,"ax" .globl KillPicture KillPicture: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0xBB04 jsl 0xe10000 rtl ; OpenPicture(Pointer) -> PicHndl ; tool 0xB704, set 0x04 (QuickDraw) + .section .text.OpenPicture,"ax" .globl OpenPicture OpenPicture: ; --- stash arg0 (in A/X) --- @@ -10353,10 +10856,10 @@ OpenPicture: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0xB704 jsl 0xe10000 pla ; result lo -> A @@ -10365,6 +10868,7 @@ OpenPicture: ; PicComment(Integer, Integer, Handle) -> void ; tool 0xB804, set 0x04 (QuickDraw) + .section .text.PicComment,"ax" .globl PicComment PicComment: ; --- stash arg0 (in A) --- @@ -10376,7 +10880,7 @@ PicComment: lda 6, s pha ; --- arg2 (Handle, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -10386,28 +10890,29 @@ PicComment: ; CalcMask(LocInfoPtr, Rect, LocInfoPtr, Rect, Word, PatternPtr, Pointer) -> void ; tool 0x0E12, set 0x12 (QDAuxiliary) + .section .text.CalcMask,"ax" .globl CalcMask CalcMask: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Rect, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (LocInfoPtr, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha ; --- arg3 (Rect, 4B) --- - lda 24, s + lda 26, s pha lda 26, s pha @@ -10415,12 +10920,12 @@ CalcMask: lda 32, s pha ; --- arg5 (PatternPtr, 4B) --- - lda 36, s + lda 38, s pha lda 38, s pha ; --- arg6 (Pointer, 4B) --- - lda 44, s + lda 46, s pha lda 46, s pha @@ -10430,28 +10935,29 @@ CalcMask: ; SeedFill(LocInfoPtr, Rect, LocInfoPtr, Rect, Word, Word, Word, PatternPtr, Pointer) -> void ; tool 0x0D12, set 0x12 (QDAuxiliary) + .section .text.SeedFill,"ax" .globl SeedFill SeedFill: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Rect, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (LocInfoPtr, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha ; --- arg3 (Rect, 4B) --- - lda 24, s + lda 26, s pha lda 26, s pha @@ -10465,12 +10971,12 @@ SeedFill: lda 40, s pha ; --- arg7 (PatternPtr, 4B) --- - lda 44, s + lda 46, s pha lda 46, s pha ; --- arg8 (Pointer, 4B) --- - lda 52, s + lda 54, s pha lda 54, s pha @@ -10480,16 +10986,17 @@ SeedFill: ; SpecialRect(Rect, Word, Word) -> void ; tool 0x0C12, set 0x12 (QDAuxiliary) + .section .text.SpecialRect,"ax" .globl SpecialRect SpecialRect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -10502,6 +11009,7 @@ SpecialRect: ; GetSysIcon(Word, Word, Long) -> QDIconRecordPtr ; tool 0x0F12, set 0x12 (QDAuxiliary) + .section .text.GetSysIcon,"ax" .globl GetSysIcon GetSysIcon: ; --- stash arg0 (in A) --- @@ -10516,7 +11024,7 @@ GetSysIcon: lda 10, s pha ; --- arg2 (Long, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -10528,6 +11036,7 @@ GetSysIcon: ; PixelMap2Rgn(LocInfoPtr, Word, Word) -> RegionHndl ; tool 0x1012, set 0x12 (QDAuxiliary) + .section .text.PixelMap2Rgn,"ax" .globl PixelMap2Rgn PixelMap2Rgn: ; --- stash arg0 (in A/X) --- @@ -10537,10 +11046,10 @@ PixelMap2Rgn: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 12, s pha @@ -10555,23 +11064,24 @@ PixelMap2Rgn: ; WhooshRect(Long, Rect, Rect) -> void ; tool 0x1412, set 0x12 (QDAuxiliary) + .section .text.WhooshRect,"ax" .globl WhooshRect WhooshRect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Rect, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (Rect, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -10581,6 +11091,7 @@ WhooshRect: ; DrawStringWidth(Word, Ref, Word) -> void ; tool 0x1512, set 0x12 (QDAuxiliary) + .section .text.DrawStringWidth,"ax" .globl DrawStringWidth DrawStringWidth: ; --- stash arg0 (in A) --- @@ -10589,7 +11100,7 @@ DrawStringWidth: lda 0xE0 pha ; --- arg1 (Ref, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -10602,6 +11113,7 @@ DrawStringWidth: ; UseColorTable(Word, ColorTablePtr, Word) -> Handle ; tool 0x1612, set 0x12 (QDAuxiliary) + .section .text.UseColorTable,"ax" .globl UseColorTable UseColorTable: ; --- stash arg0 (in A) --- @@ -10613,7 +11125,7 @@ UseColorTable: lda 0xE0 pha ; --- arg1 (ColorTablePtr, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -10628,16 +11140,17 @@ UseColorTable: ; RestoreColorTable(Handle, Word) -> void ; tool 0x1712, set 0x12 (QDAuxiliary) + .section .text.RestoreColorTable,"ax" .globl RestoreColorTable RestoreColorTable: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -10647,6 +11160,7 @@ RestoreColorTable: ; QDStartUp(Word, Word, Word, Word) -> void ; tool 0x0204, set 0x04 (QuickDraw) + .section .text.QDStartUp,"ax" .globl QDStartUp QDStartUp: ; --- stash arg0 (in A) --- @@ -10669,18 +11183,19 @@ QDStartUp: ; AddPt(Point, Point) -> void ; tool 0x8004, set 0x04 (QuickDraw) + .section .text.AddPt,"ax" .globl AddPt AddPt: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Point, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -10690,6 +11205,7 @@ AddPt: ; CharBounds(Word, Rect) -> void ; tool 0xAC04, set 0x04 (QuickDraw) + .section .text.CharBounds,"ax" .globl CharBounds CharBounds: ; --- stash arg0 (in A) --- @@ -10698,7 +11214,7 @@ CharBounds: lda 0xE0 pha ; --- arg1 (Rect, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -10708,66 +11224,70 @@ CharBounds: ; ClipRect(Rect) -> void ; tool 0x2604, set 0x04 (QuickDraw) + .section .text.ClipRect,"ax" .globl ClipRect ClipRect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2604 jsl 0xe10000 rtl ; ClosePort(GrafPortPtr) -> void ; tool 0x1A04, set 0x04 (QuickDraw) + .section .text.ClosePort,"ax" .globl ClosePort ClosePort: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1A04 jsl 0xe10000 rtl ; CloseRgn(RegionHndl) -> void ; tool 0x6E04, set 0x04 (QuickDraw) + .section .text.CloseRgn,"ax" .globl CloseRgn CloseRgn: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x6E04 jsl 0xe10000 rtl ; CopyRgn(RegionHndl, RegionHndl) -> void ; tool 0x6904, set 0x04 (QuickDraw) + .section .text.CopyRgn,"ax" .globl CopyRgn CopyRgn: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (RegionHndl, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -10777,18 +11297,19 @@ CopyRgn: ; CStringBounds(Pointer, Rect) -> void ; tool 0xAE04, set 0x04 (QuickDraw) + .section .text.CStringBounds,"ax" .globl CStringBounds CStringBounds: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Rect, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -10798,6 +11319,7 @@ CStringBounds: ; CStringWidth(Pointer) -> Word ; tool 0xAA04, set 0x04 (QuickDraw) + .section .text.CStringWidth,"ax" .globl CStringWidth CStringWidth: ; --- stash arg0 (in A/X) --- @@ -10806,10 +11328,10 @@ CStringWidth: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0xAA04 jsl 0xe10000 pla ; result -> A @@ -10817,23 +11339,24 @@ CStringWidth: ; DiffRgn(RegionHndl, RegionHndl, RegionHndl) -> void ; tool 0x7304, set 0x04 (QuickDraw) + .section .text.DiffRgn,"ax" .globl DiffRgn DiffRgn: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (RegionHndl, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (RegionHndl, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -10843,64 +11366,68 @@ DiffRgn: ; DisposeRgn(RegionHndl) -> void ; tool 0x6804, set 0x04 (QuickDraw) + .section .text.DisposeRgn,"ax" .globl DisposeRgn DisposeRgn: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x6804 jsl 0xe10000 rtl ; DrawCString(Pointer) -> void ; tool 0xA604, set 0x04 (QuickDraw) + .section .text.DrawCString,"ax" .globl DrawCString DrawCString: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0xA604 jsl 0xe10000 rtl ; DrawString(Pointer) -> void ; tool 0xA504, set 0x04 (QuickDraw) + .section .text.DrawString,"ax" .globl DrawString DrawString: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0xA504 jsl 0xe10000 rtl ; DrawText(Pointer, Word) -> void ; tool 0xA704, set 0x04 (QuickDraw) + .section .text.DrawText,"ax" .globl DrawText DrawText: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -10910,6 +11437,7 @@ DrawText: ; EmptyRgn(RegionHndl) -> Boolean ; tool 0x7804, set 0x04 (QuickDraw) + .section .text.EmptyRgn,"ax" .globl EmptyRgn EmptyRgn: ; --- stash arg0 (in A/X) --- @@ -10918,10 +11446,10 @@ EmptyRgn: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x7804 jsl 0xe10000 pla ; result -> A @@ -10929,6 +11457,7 @@ EmptyRgn: ; EqualPt(Point, Point) -> Boolean ; tool 0x8304, set 0x04 (QuickDraw) + .section .text.EqualPt,"ax" .globl EqualPt EqualPt: ; --- stash arg0 (in A/X) --- @@ -10937,12 +11466,12 @@ EqualPt: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Point, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -10953,6 +11482,7 @@ EqualPt: ; EqualRect(Rect, Rect) -> Boolean ; tool 0x5104, set 0x04 (QuickDraw) + .section .text.EqualRect,"ax" .globl EqualRect EqualRect: ; --- stash arg0 (in A/X) --- @@ -10961,12 +11491,12 @@ EqualRect: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Rect, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -10977,6 +11507,7 @@ EqualRect: ; EqualRgn(RegionHndl, RegionHndl) -> Boolean ; tool 0x7704, set 0x04 (QuickDraw) + .section .text.EqualRgn,"ax" .globl EqualRgn EqualRgn: ; --- stash arg0 (in A/X) --- @@ -10985,12 +11516,12 @@ EqualRgn: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (RegionHndl, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -11001,16 +11532,17 @@ EqualRgn: ; EraseArc(Rect, Integer, Integer) -> void ; tool 0x6404, set 0x04 (QuickDraw) + .section .text.EraseArc,"ax" .globl EraseArc EraseArc: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Integer, 2B) --- lda 8, s pha @@ -11023,80 +11555,85 @@ EraseArc: ; EraseOval(Rect) -> void ; tool 0x5A04, set 0x04 (QuickDraw) + .section .text.EraseOval,"ax" .globl EraseOval EraseOval: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x5A04 jsl 0xe10000 rtl ; ErasePoly(Handle) -> void ; tool 0xBE04, set 0x04 (QuickDraw) + .section .text.ErasePoly,"ax" .globl ErasePoly ErasePoly: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0xBE04 jsl 0xe10000 rtl ; EraseRect(Rect) -> void ; tool 0x5504, set 0x04 (QuickDraw) + .section .text.EraseRect,"ax" .globl EraseRect EraseRect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x5504 jsl 0xe10000 rtl ; EraseRgn(RegionHndl) -> void ; tool 0x7B04, set 0x04 (QuickDraw) + .section .text.EraseRgn,"ax" .globl EraseRgn EraseRgn: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x7B04 jsl 0xe10000 rtl ; EraseRRect(Rect, Word, Word) -> void ; tool 0x5F04, set 0x04 (QuickDraw) + .section .text.EraseRRect,"ax" .globl EraseRRect EraseRRect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -11109,16 +11646,17 @@ EraseRRect: ; FillArc(Rect, Integer, Integer, Pattern) -> void ; tool 0x6604, set 0x04 (QuickDraw) + .section .text.FillArc,"ax" .globl FillArc FillArc: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Integer, 2B) --- lda 8, s pha @@ -11126,7 +11664,7 @@ FillArc: lda 12, s pha ; --- arg3 (Pattern, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -11136,18 +11674,19 @@ FillArc: ; FillOval(Rect, Pattern) -> void ; tool 0x5C04, set 0x04 (QuickDraw) + .section .text.FillOval,"ax" .globl FillOval FillOval: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Pattern, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -11157,18 +11696,19 @@ FillOval: ; FillPoly(Handle, Pattern) -> void ; tool 0xC004, set 0x04 (QuickDraw) + .section .text.FillPoly,"ax" .globl FillPoly FillPoly: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Pattern, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -11178,18 +11718,19 @@ FillPoly: ; FillRect(Rect, Pattern) -> void ; tool 0x5704, set 0x04 (QuickDraw) + .section .text.FillRect,"ax" .globl FillRect FillRect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Pattern, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -11199,18 +11740,19 @@ FillRect: ; FillRgn(RegionHndl, Pattern) -> void ; tool 0x7D04, set 0x04 (QuickDraw) + .section .text.FillRgn,"ax" .globl FillRgn FillRgn: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Pattern, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -11220,16 +11762,17 @@ FillRgn: ; FillRRect(Rect, Word, Word, Pattern) -> void ; tool 0x6104, set 0x04 (QuickDraw) + .section .text.FillRRect,"ax" .globl FillRRect FillRRect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -11237,7 +11780,7 @@ FillRRect: lda 12, s pha ; --- arg3 (Pattern, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -11247,6 +11790,7 @@ FillRRect: ; ForceBufDims(Word, Word, Word) -> void ; tool 0xCC04, set 0x04 (QuickDraw) + .section .text.ForceBufDims,"ax" .globl ForceBufDims ForceBufDims: ; --- stash arg0 (in A) --- @@ -11266,16 +11810,17 @@ ForceBufDims: ; FrameArc(Rect, Integer, Integer) -> void ; tool 0x6204, set 0x04 (QuickDraw) + .section .text.FrameArc,"ax" .globl FrameArc FrameArc: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Integer, 2B) --- lda 8, s pha @@ -11288,80 +11833,85 @@ FrameArc: ; FrameOval(Rect) -> void ; tool 0x5804, set 0x04 (QuickDraw) + .section .text.FrameOval,"ax" .globl FrameOval FrameOval: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x5804 jsl 0xe10000 rtl ; FramePoly(Handle) -> void ; tool 0xBC04, set 0x04 (QuickDraw) + .section .text.FramePoly,"ax" .globl FramePoly FramePoly: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0xBC04 jsl 0xe10000 rtl ; FrameRect(Rect) -> void ; tool 0x5304, set 0x04 (QuickDraw) + .section .text.FrameRect,"ax" .globl FrameRect FrameRect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x5304 jsl 0xe10000 rtl ; FrameRgn(RegionHndl) -> void ; tool 0x7904, set 0x04 (QuickDraw) + .section .text.FrameRgn,"ax" .globl FrameRgn FrameRgn: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x7904 jsl 0xe10000 rtl ; FrameRRect(Rect, Word, Word) -> void ; tool 0x5D04, set 0x04 (QuickDraw) + .section .text.FrameRRect,"ax" .globl FrameRRect FrameRRect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -11374,6 +11924,7 @@ FrameRRect: ; GetAddress(Word) -> Pointer ; tool 0x0904, set 0x04 (QuickDraw) + .section .text.GetAddress,"ax" .globl GetAddress GetAddress: ; --- stash arg0 (in A) --- @@ -11392,22 +11943,24 @@ GetAddress: ; GetBackPat(Pattern) -> void ; tool 0x3504, set 0x04 (QuickDraw) + .section .text.GetBackPat,"ax" .globl GetBackPat GetBackPat: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x3504 jsl 0xe10000 rtl ; GetCharExtra(void) -> Fixed ; tool 0xD504, set 0x04 (QuickDraw) + .section .text.GetCharExtra,"ax" .globl GetCharExtra GetCharExtra: ; --- result space (4 bytes) --- @@ -11421,22 +11974,24 @@ GetCharExtra: ; GetClip(RegionHndl) -> void ; tool 0x2504, set 0x04 (QuickDraw) + .section .text.GetClip,"ax" .globl GetClip GetClip: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2504 jsl 0xe10000 rtl ; GetClipHandle(void) -> RegionHndl ; tool 0xC704, set 0x04 (QuickDraw) + .section .text.GetClipHandle,"ax" .globl GetClipHandle GetClipHandle: ; --- result space (4 bytes) --- @@ -11450,6 +12005,7 @@ GetClipHandle: ; GetColorEntry(Word, Word) -> Word ; tool 0x1104, set 0x04 (QuickDraw) + .section .text.GetColorEntry,"ax" .globl GetColorEntry GetColorEntry: ; --- stash arg0 (in A) --- @@ -11469,6 +12025,7 @@ GetColorEntry: ; GetColorTable(Word, ColorTable) -> void ; tool 0x0F04, set 0x04 (QuickDraw) + .section .text.GetColorTable,"ax" .globl GetColorTable GetColorTable: ; --- stash arg0 (in A) --- @@ -11477,7 +12034,7 @@ GetColorTable: lda 0xE0 pha ; --- arg1 (ColorTable, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -11487,6 +12044,7 @@ GetColorTable: ; GetCursorAdr(void) -> Pointer ; tool 0x8F04, set 0x04 (QuickDraw) + .section .text.GetCursorAdr,"ax" .globl GetCursorAdr GetCursorAdr: ; --- result space (4 bytes) --- @@ -11500,6 +12058,7 @@ GetCursorAdr: ; GetFont(void) -> FontHndl ; tool 0x9504, set 0x04 (QuickDraw) + .section .text.GetFont,"ax" .globl GetFont GetFont: ; --- result space (4 bytes) --- @@ -11513,22 +12072,24 @@ GetFont: ; GetFontGlobals(FontGlobalsRecPtr) -> void ; tool 0x9704, set 0x04 (QuickDraw) + .section .text.GetFontGlobals,"ax" .globl GetFontGlobals GetFontGlobals: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x9704 jsl 0xe10000 rtl ; GetFontID(void) -> Long ; tool 0xD104, set 0x04 (QuickDraw) + .section .text.GetFontID,"ax" .globl GetFontID GetFontID: ; --- result space (4 bytes) --- @@ -11542,22 +12103,24 @@ GetFontID: ; GetFontInfo(FontInfoRecPtr) -> void ; tool 0x9604, set 0x04 (QuickDraw) + .section .text.GetFontInfo,"ax" .globl GetFontInfo GetFontInfo: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x9604 jsl 0xe10000 rtl ; GetFontLore(FontGlobalsRecPtr, Word) -> Word ; tool 0xD904, set 0x04 (QuickDraw) + .section .text.GetFontLore,"ax" .globl GetFontLore GetFontLore: ; --- stash arg0 (in A/X) --- @@ -11566,10 +12129,10 @@ GetFontLore: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 10, s pha @@ -11580,6 +12143,7 @@ GetFontLore: ; GetGrafProcs(void) -> QDProcsPtr ; tool 0x4504, set 0x04 (QuickDraw) + .section .text.GetGrafProcs,"ax" .globl GetGrafProcs GetGrafProcs: ; --- result space (4 bytes) --- @@ -11593,86 +12157,92 @@ GetGrafProcs: ; GetPen(Point) -> void ; tool 0x2904, set 0x04 (QuickDraw) + .section .text.GetPen,"ax" .globl GetPen GetPen: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2904 jsl 0xe10000 rtl ; GetPenMask(Mask) -> void ; tool 0x3304, set 0x04 (QuickDraw) + .section .text.GetPenMask,"ax" .globl GetPenMask GetPenMask: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x3304 jsl 0xe10000 rtl ; GetPenPat(Pattern) -> void ; tool 0x3104, set 0x04 (QuickDraw) + .section .text.GetPenPat,"ax" .globl GetPenPat GetPenPat: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x3104 jsl 0xe10000 rtl ; GetPenSize(Point) -> void ; tool 0x2D04, set 0x04 (QuickDraw) + .section .text.GetPenSize,"ax" .globl GetPenSize GetPenSize: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2D04 jsl 0xe10000 rtl ; GetPenState(PenStatePtr) -> void ; tool 0x2B04, set 0x04 (QuickDraw) + .section .text.GetPenState,"ax" .globl GetPenState GetPenState: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2B04 jsl 0xe10000 rtl ; GetPicSave(void) -> Longint ; tool 0x3F04, set 0x04 (QuickDraw) + .section .text.GetPicSave,"ax" .globl GetPicSave GetPicSave: ; --- result space (4 bytes) --- @@ -11686,6 +12256,7 @@ GetPicSave: ; GetPixel(Integer, Integer) -> Word ; tool 0x8804, set 0x04 (QuickDraw) + .section .text.GetPixel,"ax" .globl GetPixel GetPixel: ; --- stash arg0 (in A) --- @@ -11705,6 +12276,7 @@ GetPixel: ; GetPolySave(void) -> LongWord ; tool 0x4304, set 0x04 (QuickDraw) + .section .text.GetPolySave,"ax" .globl GetPolySave GetPolySave: ; --- result space (4 bytes) --- @@ -11718,6 +12290,7 @@ GetPolySave: ; GetPort(void) -> GrafPortPtr ; tool 0x1C04, set 0x04 (QuickDraw) + .section .text.GetPort,"ax" .globl GetPort GetPort: ; --- result space (4 bytes) --- @@ -11731,38 +12304,41 @@ GetPort: ; GetPortLoc(LocInfoPtr) -> void ; tool 0x1E04, set 0x04 (QuickDraw) + .section .text.GetPortLoc,"ax" .globl GetPortLoc GetPortLoc: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1E04 jsl 0xe10000 rtl ; GetPortRect(Rect) -> void ; tool 0x2004, set 0x04 (QuickDraw) + .section .text.GetPortRect,"ax" .globl GetPortRect GetPortRect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2004 jsl 0xe10000 rtl ; GetRgnSave(void) -> LongWord ; tool 0x4104, set 0x04 (QuickDraw) + .section .text.GetRgnSave,"ax" .globl GetRgnSave GetRgnSave: ; --- result space (4 bytes) --- @@ -11776,38 +12352,41 @@ GetRgnSave: ; GetROMFont(RomFontRecPtr) -> void ; tool 0xD804, set 0x04 (QuickDraw) + .section .text.GetROMFont,"ax" .globl GetROMFont GetROMFont: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0xD804 jsl 0xe10000 rtl ; GetRomFont(RomFontRecPtr) -> void ; tool 0xD804, set 0x04 (QuickDraw) + .section .text.GetRomFont,"ax" .globl GetRomFont GetRomFont: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0xD804 jsl 0xe10000 rtl ; GetSpaceExtra(void) -> Fixed ; tool 0x9F04, set 0x04 (QuickDraw) + .section .text.GetSpaceExtra,"ax" .globl GetSpaceExtra GetSpaceExtra: ; --- result space (4 bytes) --- @@ -11821,6 +12400,7 @@ GetSpaceExtra: ; GetSysField(void) -> Longint ; tool 0x4904, set 0x04 (QuickDraw) + .section .text.GetSysField,"ax" .globl GetSysField GetSysField: ; --- result space (4 bytes) --- @@ -11834,6 +12414,7 @@ GetSysField: ; GetSysFont(void) -> FontHndl ; tool 0xB304, set 0x04 (QuickDraw) + .section .text.GetSysFont,"ax" .globl GetSysFont GetSysFont: ; --- result space (4 bytes) --- @@ -11847,6 +12428,7 @@ GetSysFont: ; GetTextFace(void) -> TextStyle ; tool 0x9B04, set 0x04 (QuickDraw) + .section .text.GetTextFace,"ax" .globl GetTextFace GetTextFace: ; --- result space (4 bytes) --- @@ -11860,6 +12442,7 @@ GetTextFace: ; GetUserField(void) -> Longint ; tool 0x4704, set 0x04 (QuickDraw) + .section .text.GetUserField,"ax" .globl GetUserField GetUserField: ; --- result space (4 bytes) --- @@ -11873,6 +12456,7 @@ GetUserField: ; GetVisHandle(void) -> RegionHndl ; tool 0xC904, set 0x04 (QuickDraw) + .section .text.GetVisHandle,"ax" .globl GetVisHandle GetVisHandle: ; --- result space (4 bytes) --- @@ -11886,38 +12470,41 @@ GetVisHandle: ; GetVisRgn(RegionHndl) -> void ; tool 0xB504, set 0x04 (QuickDraw) + .section .text.GetVisRgn,"ax" .globl GetVisRgn GetVisRgn: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0xB504 jsl 0xe10000 rtl ; GlobalToLocal(Point) -> void ; tool 0x8504, set 0x04 (QuickDraw) + .section .text.GlobalToLocal,"ax" .globl GlobalToLocal GlobalToLocal: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x8504 jsl 0xe10000 rtl ; InflateTextBuffer(Word, Word) -> void ; tool 0xD704, set 0x04 (QuickDraw) + .section .text.InflateTextBuffer,"ax" .globl InflateTextBuffer InflateTextBuffer: ; --- stash arg0 (in A) --- @@ -11934,48 +12521,51 @@ InflateTextBuffer: ; InitColorTable(ColorTable) -> void ; tool 0x0D04, set 0x04 (QuickDraw) + .section .text.InitColorTable,"ax" .globl InitColorTable InitColorTable: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0D04 jsl 0xe10000 rtl ; InitPort(GrafPortPtr) -> void ; tool 0x1904, set 0x04 (QuickDraw) + .section .text.InitPort,"ax" .globl InitPort InitPort: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1904 jsl 0xe10000 rtl ; InsetRect(Rect, Integer, Integer) -> void ; tool 0x4C04, set 0x04 (QuickDraw) + .section .text.InsetRect,"ax" .globl InsetRect InsetRect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Integer, 2B) --- lda 8, s pha @@ -11988,16 +12578,17 @@ InsetRect: ; InsetRgn(RegionHndl, Integer, Integer) -> void ; tool 0x7004, set 0x04 (QuickDraw) + .section .text.InsetRgn,"ax" .globl InsetRgn InsetRgn: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Integer, 2B) --- lda 8, s pha @@ -12010,16 +12601,17 @@ InsetRgn: ; InvertArc(Rect, Integer, Integer) -> void ; tool 0x6504, set 0x04 (QuickDraw) + .section .text.InvertArc,"ax" .globl InvertArc InvertArc: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Integer, 2B) --- lda 8, s pha @@ -12032,80 +12624,85 @@ InvertArc: ; InvertOval(Rect) -> void ; tool 0x5B04, set 0x04 (QuickDraw) + .section .text.InvertOval,"ax" .globl InvertOval InvertOval: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x5B04 jsl 0xe10000 rtl ; InvertPoly(Handle) -> void ; tool 0xBF04, set 0x04 (QuickDraw) + .section .text.InvertPoly,"ax" .globl InvertPoly InvertPoly: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0xBF04 jsl 0xe10000 rtl ; InvertRect(Rect) -> void ; tool 0x5604, set 0x04 (QuickDraw) + .section .text.InvertRect,"ax" .globl InvertRect InvertRect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x5604 jsl 0xe10000 rtl ; InvertRgn(RegionHndl) -> void ; tool 0x7C04, set 0x04 (QuickDraw) + .section .text.InvertRgn,"ax" .globl InvertRgn InvertRgn: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x7C04 jsl 0xe10000 rtl ; InvertRRect(Rect, Word, Word) -> void ; tool 0x6004, set 0x04 (QuickDraw) + .section .text.InvertRRect,"ax" .globl InvertRRect InvertRRect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -12118,22 +12715,24 @@ InvertRRect: ; KillPoly(Handle) -> void ; tool 0xC304, set 0x04 (QuickDraw) + .section .text.KillPoly,"ax" .globl KillPoly KillPoly: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0xC304 jsl 0xe10000 rtl ; Line(Integer, Integer) -> void ; tool 0x3D04, set 0x04 (QuickDraw) + .section .text.Line,"ax" .globl Line Line: ; --- stash arg0 (in A) --- @@ -12150,6 +12749,7 @@ Line: ; LineTo(Integer, Integer) -> void ; tool 0x3C04, set 0x04 (QuickDraw) + .section .text.LineTo,"ax" .globl LineTo LineTo: ; --- stash arg0 (in A) --- @@ -12166,39 +12766,41 @@ LineTo: ; LocalToGlobal(Point) -> void ; tool 0x8404, set 0x04 (QuickDraw) + .section .text.LocalToGlobal,"ax" .globl LocalToGlobal LocalToGlobal: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x8404 jsl 0xe10000 rtl ; MapPoly(Handle, Rect, Rect) -> void ; tool 0xC504, set 0x04 (QuickDraw) + .section .text.MapPoly,"ax" .globl MapPoly MapPoly: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Rect, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (Rect, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -12208,23 +12810,24 @@ MapPoly: ; MapPt(Point, Rect, Rect) -> void ; tool 0x8A04, set 0x04 (QuickDraw) + .section .text.MapPt,"ax" .globl MapPt MapPt: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Rect, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (Rect, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -12234,23 +12837,24 @@ MapPt: ; MapRect(Rect, Rect, Rect) -> void ; tool 0x8B04, set 0x04 (QuickDraw) + .section .text.MapRect,"ax" .globl MapRect MapRect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Rect, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (Rect, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -12260,23 +12864,24 @@ MapRect: ; MapRgn(RegionHndl, Rect, Rect) -> void ; tool 0x8C04, set 0x04 (QuickDraw) + .section .text.MapRgn,"ax" .globl MapRgn MapRgn: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Rect, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (Rect, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -12286,6 +12891,7 @@ MapRgn: ; Move(Integer, Integer) -> void ; tool 0x3B04, set 0x04 (QuickDraw) + .section .text.Move,"ax" .globl Move Move: ; --- stash arg0 (in A) --- @@ -12302,6 +12908,7 @@ Move: ; MovePortTo(Integer, Integer) -> void ; tool 0x2204, set 0x04 (QuickDraw) + .section .text.MovePortTo,"ax" .globl MovePortTo MovePortTo: ; --- stash arg0 (in A) --- @@ -12318,6 +12925,7 @@ MovePortTo: ; MoveTo(Integer, Integer) -> void ; tool 0x3A04, set 0x04 (QuickDraw) + .section .text.MoveTo,"ax" .globl MoveTo MoveTo: ; --- stash arg0 (in A) --- @@ -12334,6 +12942,7 @@ MoveTo: ; NewRgn(void) -> RegionHndl ; tool 0x6704, set 0x04 (QuickDraw) + .section .text.NewRgn,"ax" .globl NewRgn NewRgn: ; --- result space (4 bytes) --- @@ -12347,6 +12956,7 @@ NewRgn: ; NotEmptyRect(Rect) -> Boolean ; tool 0x5204, set 0x04 (QuickDraw) + .section .text.NotEmptyRect,"ax" .globl NotEmptyRect NotEmptyRect: ; --- stash arg0 (in A/X) --- @@ -12355,10 +12965,10 @@ NotEmptyRect: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x5204 jsl 0xe10000 pla ; result -> A @@ -12366,16 +12976,17 @@ NotEmptyRect: ; OffsetPoly(Handle, Integer, Integer) -> void ; tool 0xC404, set 0x04 (QuickDraw) + .section .text.OffsetPoly,"ax" .globl OffsetPoly OffsetPoly: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Integer, 2B) --- lda 8, s pha @@ -12388,16 +12999,17 @@ OffsetPoly: ; OffsetRect(Rect, Integer, Integer) -> void ; tool 0x4B04, set 0x04 (QuickDraw) + .section .text.OffsetRect,"ax" .globl OffsetRect OffsetRect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Integer, 2B) --- lda 8, s pha @@ -12410,16 +13022,17 @@ OffsetRect: ; OffsetRgn(RegionHndl, Integer, Integer) -> void ; tool 0x6F04, set 0x04 (QuickDraw) + .section .text.OffsetRgn,"ax" .globl OffsetRgn OffsetRgn: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Integer, 2B) --- lda 8, s pha @@ -12432,6 +13045,7 @@ OffsetRgn: ; OpenPoly(void) -> handle ; tool 0xC104, set 0x04 (QuickDraw) + .section .text.OpenPoly,"ax" .globl OpenPoly OpenPoly: ; --- result space (4 bytes) --- @@ -12445,32 +13059,34 @@ OpenPoly: ; OpenPort(GrafPortPtr) -> void ; tool 0x1804, set 0x04 (QuickDraw) + .section .text.OpenPort,"ax" .globl OpenPort OpenPort: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1804 jsl 0xe10000 rtl ; PaintArc(Rect, Integer, Integer) -> void ; tool 0x6304, set 0x04 (QuickDraw) + .section .text.PaintArc,"ax" .globl PaintArc PaintArc: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Integer, 2B) --- lda 8, s pha @@ -12483,96 +13099,102 @@ PaintArc: ; PaintOval(Rect) -> void ; tool 0x5904, set 0x04 (QuickDraw) + .section .text.PaintOval,"ax" .globl PaintOval PaintOval: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x5904 jsl 0xe10000 rtl ; PaintPixels(PaintParamPtr) -> void ; tool 0x7F04, set 0x04 (QuickDraw) + .section .text.PaintPixels,"ax" .globl PaintPixels PaintPixels: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x7F04 jsl 0xe10000 rtl ; PaintPoly(Handle) -> void ; tool 0xBD04, set 0x04 (QuickDraw) + .section .text.PaintPoly,"ax" .globl PaintPoly PaintPoly: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0xBD04 jsl 0xe10000 rtl ; PaintRect(Rect) -> void ; tool 0x5404, set 0x04 (QuickDraw) + .section .text.PaintRect,"ax" .globl PaintRect PaintRect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x5404 jsl 0xe10000 rtl ; PaintRgn(RegionHndl) -> void ; tool 0x7A04, set 0x04 (QuickDraw) + .section .text.PaintRgn,"ax" .globl PaintRgn PaintRgn: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x7A04 jsl 0xe10000 rtl ; PaintRRect(Rect, Word, Word) -> void ; tool 0x5E04, set 0x04 (QuickDraw) + .section .text.PaintRRect,"ax" .globl PaintRRect PaintRRect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -12585,18 +13207,19 @@ PaintRRect: ; PPToPort(LocInfoPtr, Rect, Integer, Integer, Word) -> void ; tool 0xD604, set 0x04 (QuickDraw) + .section .text.PPToPort,"ax" .globl PPToPort PPToPort: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Rect, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -12615,23 +13238,24 @@ PPToPort: ; Pt2Rect(Point, Point, Rect) -> void ; tool 0x5004, set 0x04 (QuickDraw) + .section .text.Pt2Rect,"ax" .globl Pt2Rect Pt2Rect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Point, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (Rect, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -12641,6 +13265,7 @@ Pt2Rect: ; PtInRect(Point, Rect) -> Boolean ; tool 0x4F04, set 0x04 (QuickDraw) + .section .text.PtInRect,"ax" .globl PtInRect PtInRect: ; --- stash arg0 (in A/X) --- @@ -12649,12 +13274,12 @@ PtInRect: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Rect, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -12665,6 +13290,7 @@ PtInRect: ; PtInRgn(Point, RegionHndl) -> Boolean ; tool 0x7504, set 0x04 (QuickDraw) + .section .text.PtInRgn,"ax" .globl PtInRgn PtInRgn: ; --- stash arg0 (in A/X) --- @@ -12673,12 +13299,12 @@ PtInRgn: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (RegionHndl, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -12689,6 +13315,7 @@ PtInRgn: ; RectInRgn(Rect, RegionHndl) -> Boolean ; tool 0x7604, set 0x04 (QuickDraw) + .section .text.RectInRgn,"ax" .globl RectInRgn RectInRgn: ; --- stash arg0 (in A/X) --- @@ -12697,12 +13324,12 @@ RectInRgn: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (RegionHndl, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -12713,18 +13340,19 @@ RectInRgn: ; RectRgn(RegionHndl, Rect) -> void ; tool 0x6C04, set 0x04 (QuickDraw) + .section .text.RectRgn,"ax" .globl RectRgn RectRgn: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Rect, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -12734,55 +13362,58 @@ RectRgn: ; RestoreBufDims(BufDimRecPtr) -> void ; tool 0xCE04, set 0x04 (QuickDraw) + .section .text.RestoreBufDims,"ax" .globl RestoreBufDims RestoreBufDims: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0xCE04 jsl 0xe10000 rtl ; SaveBufDims(BufDimRecPtr) -> void ; tool 0xCD04, set 0x04 (QuickDraw) + .section .text.SaveBufDims,"ax" .globl SaveBufDims SaveBufDims: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0xCD04 jsl 0xe10000 rtl ; ScalePt(Point, Rect, Rect) -> void ; tool 0x8904, set 0x04 (QuickDraw) + .section .text.ScalePt,"ax" .globl ScalePt ScalePt: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Rect, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (Rect, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -12792,16 +13423,17 @@ ScalePt: ; ScrollRect(Rect, Integer, Integer, RegionHndl) -> void ; tool 0x7E04, set 0x04 (QuickDraw) + .section .text.ScrollRect,"ax" .globl ScrollRect ScrollRect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Integer, 2B) --- lda 8, s pha @@ -12809,7 +13441,7 @@ ScrollRect: lda 12, s pha ; --- arg3 (RegionHndl, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -12819,6 +13451,7 @@ ScrollRect: ; SectRect(Rect, Rect, Rect) -> Boolean ; tool 0x4D04, set 0x04 (QuickDraw) + .section .text.SectRect,"ax" .globl SectRect SectRect: ; --- stash arg0 (in A/X) --- @@ -12827,17 +13460,17 @@ SectRect: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Rect, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha ; --- arg2 (Rect, 4B) --- - lda 18, s + lda 20, s pha lda 20, s pha @@ -12848,23 +13481,24 @@ SectRect: ; SectRgn(RegionHndl, RegionHndl, RegionHndl) -> void ; tool 0x7104, set 0x04 (QuickDraw) + .section .text.SectRgn,"ax" .globl SectRgn SectRgn: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (RegionHndl, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (RegionHndl, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -12874,22 +13508,24 @@ SectRgn: ; SetBackPat(Pattern) -> void ; tool 0x3404, set 0x04 (QuickDraw) + .section .text.SetBackPat,"ax" .globl SetBackPat SetBackPat: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x3404 jsl 0xe10000 rtl ; SetBufDims(Word, Word, Word) -> void ; tool 0xCB04, set 0x04 (QuickDraw) + .section .text.SetBufDims,"ax" .globl SetBufDims SetBufDims: ; --- stash arg0 (in A) --- @@ -12909,54 +13545,58 @@ SetBufDims: ; SetCharExtra(Fixed) -> void ; tool 0xD404, set 0x04 (QuickDraw) + .section .text.SetCharExtra,"ax" .globl SetCharExtra SetCharExtra: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0xD404 jsl 0xe10000 rtl ; SetClip(RegionHndl) -> void ; tool 0x2404, set 0x04 (QuickDraw) + .section .text.SetClip,"ax" .globl SetClip SetClip: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2404 jsl 0xe10000 rtl ; SetClipHandle(RegionHndl) -> void ; tool 0xC604, set 0x04 (QuickDraw) + .section .text.SetClipHandle,"ax" .globl SetClipHandle SetClipHandle: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0xC604 jsl 0xe10000 rtl ; SetColorEntry(Word, Word, ColorValue) -> void ; tool 0x1004, set 0x04 (QuickDraw) + .section .text.SetColorEntry,"ax" .globl SetColorEntry SetColorEntry: ; --- stash arg0 (in A) --- @@ -12968,7 +13608,7 @@ SetColorEntry: lda 6, s pha ; --- arg2 (ColorValue, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -12978,6 +13618,7 @@ SetColorEntry: ; SetColorTable(Word, ColorTable) -> void ; tool 0x0E04, set 0x04 (QuickDraw) + .section .text.SetColorTable,"ax" .globl SetColorTable SetColorTable: ; --- stash arg0 (in A) --- @@ -12986,7 +13627,7 @@ SetColorTable: lda 0xE0 pha ; --- arg1 (ColorTable, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -12996,86 +13637,92 @@ SetColorTable: ; SetCursor(Pointer) -> void ; tool 0x8E04, set 0x04 (QuickDraw) + .section .text.SetCursor,"ax" .globl SetCursor SetCursor: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x8E04 jsl 0xe10000 rtl ; SetEmptyRgn(RegionHndl) -> void ; tool 0x6A04, set 0x04 (QuickDraw) + .section .text.SetEmptyRgn,"ax" .globl SetEmptyRgn SetEmptyRgn: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x6A04 jsl 0xe10000 rtl ; SetFont(FontHndl) -> void ; tool 0x9404, set 0x04 (QuickDraw) + .section .text.SetFont,"ax" .globl SetFont SetFont: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x9404 jsl 0xe10000 rtl ; SetFontID(FontID) -> void ; tool 0xD004, set 0x04 (QuickDraw) + .section .text.SetFontID,"ax" .globl SetFontID SetFontID: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0xD004 jsl 0xe10000 rtl ; SetGrafProcs(QDProcsPtr) -> void ; tool 0x4404, set 0x04 (QuickDraw) + .section .text.SetGrafProcs,"ax" .globl SetGrafProcs SetGrafProcs: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x4404 jsl 0xe10000 rtl ; SetOrigin(Integer, Integer) -> void ; tool 0x2304, set 0x04 (QuickDraw) + .section .text.SetOrigin,"ax" .globl SetOrigin SetOrigin: ; --- stash arg0 (in A) --- @@ -13092,38 +13739,41 @@ SetOrigin: ; SetPenMask(Mask) -> void ; tool 0x3204, set 0x04 (QuickDraw) + .section .text.SetPenMask,"ax" .globl SetPenMask SetPenMask: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x3204 jsl 0xe10000 rtl ; SetPenPat(Pattern) -> void ; tool 0x3004, set 0x04 (QuickDraw) + .section .text.SetPenPat,"ax" .globl SetPenPat SetPenPat: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x3004 jsl 0xe10000 rtl ; SetPenSize(Word, Word) -> void ; tool 0x2C04, set 0x04 (QuickDraw) + .section .text.SetPenSize,"ax" .globl SetPenSize SetPenSize: ; --- stash arg0 (in A) --- @@ -13140,102 +13790,109 @@ SetPenSize: ; SetPenState(PenStatePtr) -> void ; tool 0x2A04, set 0x04 (QuickDraw) + .section .text.SetPenState,"ax" .globl SetPenState SetPenState: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2A04 jsl 0xe10000 rtl ; SetPicSave(Longint) -> void ; tool 0x3E04, set 0x04 (QuickDraw) + .section .text.SetPicSave,"ax" .globl SetPicSave SetPicSave: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x3E04 jsl 0xe10000 rtl ; SetPolySave(Longint) -> void ; tool 0x4204, set 0x04 (QuickDraw) + .section .text.SetPolySave,"ax" .globl SetPolySave SetPolySave: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x4204 jsl 0xe10000 rtl ; SetPort(GrafPortPtr) -> void ; tool 0x1B04, set 0x04 (QuickDraw) + .section .text.SetPort,"ax" .globl SetPort SetPort: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1B04 jsl 0xe10000 rtl ; SetPortLoc(LocInfoPtr) -> void ; tool 0x1D04, set 0x04 (QuickDraw) + .section .text.SetPortLoc,"ax" .globl SetPortLoc SetPortLoc: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1D04 jsl 0xe10000 rtl ; SetPortRect(Rect) -> void ; tool 0x1F04, set 0x04 (QuickDraw) + .section .text.SetPortRect,"ax" .globl SetPortRect SetPortRect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1F04 jsl 0xe10000 rtl ; SetPortSize(Word, Word) -> void ; tool 0x2104, set 0x04 (QuickDraw) + .section .text.SetPortSize,"ax" .globl SetPortSize SetPortSize: ; --- stash arg0 (in A) --- @@ -13252,16 +13909,17 @@ SetPortSize: ; SetPt(Point, Integer, Integer) -> void ; tool 0x8204, set 0x04 (QuickDraw) + .section .text.SetPt,"ax" .globl SetPt SetPt: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Integer, 2B) --- lda 8, s pha @@ -13274,32 +13932,34 @@ SetPt: ; SetRandSeed(Longint) -> void ; tool 0x8704, set 0x04 (QuickDraw) + .section .text.SetRandSeed,"ax" .globl SetRandSeed SetRandSeed: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x8704 jsl 0xe10000 rtl ; SetRect(Rect, Integer, Integer, Integer, Integer) -> void ; tool 0x4A04, set 0x04 (QuickDraw) + .section .text.SetRect,"ax" .globl SetRect SetRect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Integer, 2B) --- lda 8, s pha @@ -13318,16 +13978,17 @@ SetRect: ; SetRectRgn(RegionHndl, Integer, Integer, Integer, Integer) -> void ; tool 0x6B04, set 0x04 (QuickDraw) + .section .text.SetRectRgn,"ax" .globl SetRectRgn SetRectRgn: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Integer, 2B) --- lda 8, s pha @@ -13346,22 +14007,24 @@ SetRectRgn: ; SetRgnSave(Handle) -> void ; tool 0x4004, set 0x04 (QuickDraw) + .section .text.SetRgnSave,"ax" .globl SetRgnSave SetRgnSave: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x4004 jsl 0xe10000 rtl ; SetSCB(Word, Word) -> void ; tool 0x1204, set 0x04 (QuickDraw) + .section .text.SetSCB,"ax" .globl SetSCB SetSCB: ; --- stash arg0 (in A) --- @@ -13378,134 +14041,143 @@ SetSCB: ; SetSpaceExtra(Fixed) -> void ; tool 0x9E04, set 0x04 (QuickDraw) + .section .text.SetSpaceExtra,"ax" .globl SetSpaceExtra SetSpaceExtra: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x9E04 jsl 0xe10000 rtl ; SetStdProcs(QDProcsPtr) -> void ; tool 0x8D04, set 0x04 (QuickDraw) + .section .text.SetStdProcs,"ax" .globl SetStdProcs SetStdProcs: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x8D04 jsl 0xe10000 rtl ; SetSysField(Longint) -> void ; tool 0x4804, set 0x04 (QuickDraw) + .section .text.SetSysField,"ax" .globl SetSysField SetSysField: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x4804 jsl 0xe10000 rtl ; SetSysFont(FontHndl) -> void ; tool 0xB204, set 0x04 (QuickDraw) + .section .text.SetSysFont,"ax" .globl SetSysFont SetSysFont: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0xB204 jsl 0xe10000 rtl ; SetTextFace(TextStyle) -> void ; tool 0x9A04, set 0x04 (QuickDraw) + .section .text.SetTextFace,"ax" .globl SetTextFace SetTextFace: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x9A04 jsl 0xe10000 rtl ; SetUserField(Longint) -> void ; tool 0x4604, set 0x04 (QuickDraw) + .section .text.SetUserField,"ax" .globl SetUserField SetUserField: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x4604 jsl 0xe10000 rtl ; SetVisHandle(RegionHndl) -> void ; tool 0xC804, set 0x04 (QuickDraw) + .section .text.SetVisHandle,"ax" .globl SetVisHandle SetVisHandle: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0xC804 jsl 0xe10000 rtl ; SetVisRgn(RegionHndl) -> void ; tool 0xB404, set 0x04 (QuickDraw) + .section .text.SetVisRgn,"ax" .globl SetVisRgn SetVisRgn: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0xB404 jsl 0xe10000 rtl ; SolidPattern(Word, Pattern) -> void ; tool 0x3904, set 0x04 (QuickDraw) + .section .text.SolidPattern,"ax" .globl SolidPattern SolidPattern: ; --- stash arg0 (in A) --- @@ -13514,7 +14186,7 @@ SolidPattern: lda 0xE0 pha ; --- arg1 (Pattern, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -13524,18 +14196,19 @@ SolidPattern: ; StringBounds(Pointer, Rect) -> void ; tool 0xAD04, set 0x04 (QuickDraw) + .section .text.StringBounds,"ax" .globl StringBounds StringBounds: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Rect, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -13545,6 +14218,7 @@ StringBounds: ; StringWidth(Pointer) -> Word ; tool 0xA904, set 0x04 (QuickDraw) + .section .text.StringWidth,"ax" .globl StringWidth StringWidth: ; --- stash arg0 (in A/X) --- @@ -13553,10 +14227,10 @@ StringWidth: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0xA904 jsl 0xe10000 pla ; result -> A @@ -13564,18 +14238,19 @@ StringWidth: ; SubPt(Point, Point) -> void ; tool 0x8104, set 0x04 (QuickDraw) + .section .text.SubPt,"ax" .globl SubPt SubPt: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Point, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -13585,21 +14260,22 @@ SubPt: ; TextBounds(Pointer, Word, Rect) -> void ; tool 0xAF04, set 0x04 (QuickDraw) + .section .text.TextBounds,"ax" .globl TextBounds TextBounds: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha ; --- arg2 (Rect, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -13609,6 +14285,7 @@ TextBounds: ; TextWidth(Pointer, Word) -> Word ; tool 0xAB04, set 0x04 (QuickDraw) + .section .text.TextWidth,"ax" .globl TextWidth TextWidth: ; --- stash arg0 (in A/X) --- @@ -13617,10 +14294,10 @@ TextWidth: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 10, s pha @@ -13631,23 +14308,24 @@ TextWidth: ; UnionRect(Rect, Rect, Rect) -> void ; tool 0x4E04, set 0x04 (QuickDraw) + .section .text.UnionRect,"ax" .globl UnionRect UnionRect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Rect, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (Rect, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -13657,23 +14335,24 @@ UnionRect: ; UnionRgn(RegionHndl, RegionHndl, RegionHndl) -> void ; tool 0x7204, set 0x04 (QuickDraw) + .section .text.UnionRgn,"ax" .globl UnionRgn UnionRgn: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (RegionHndl, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (RegionHndl, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -13683,23 +14362,24 @@ UnionRgn: ; XorRgn(RegionHndl, RegionHndl, RegionHndl) -> void ; tool 0x7404, set 0x04 (QuickDraw) + .section .text.XorRgn,"ax" .globl XorRgn XorRgn: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (RegionHndl, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (RegionHndl, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -13709,6 +14389,7 @@ XorRgn: ; Get640Colors(void) -> PatternPtr ; tool 0xDA04, set 0x04 (QuickDraw) + .section .text.Get640Colors,"ax" .globl Get640Colors Get640Colors: ; --- result space (4 bytes) --- @@ -13722,16 +14403,17 @@ Get640Colors: ; AddResource(Handle, Word, Word, Long) -> void ; tool 0x0C1E, set 0x1E (ResourceManager) + .section .text.AddResource,"ax" .globl AddResource AddResource: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -13739,7 +14421,7 @@ AddResource: lda 12, s pha ; --- arg3 (Long, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -13749,6 +14431,7 @@ AddResource: ; CountResources(Word) -> LongWord ; tool 0x221E, set 0x1E (ResourceManager) + .section .text.CountResources,"ax" .globl CountResources CountResources: ; --- stash arg0 (in A) --- @@ -13767,16 +14450,17 @@ CountResources: ; CreateResourceFile(Long, Word, Word, Pointer) -> void ; tool 0x091E, set 0x1E (ResourceManager) + .section .text.CreateResourceFile,"ax" .globl CreateResourceFile CreateResourceFile: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -13784,7 +14468,7 @@ CreateResourceFile: lda 12, s pha ; --- arg3 (Pointer, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -13794,6 +14478,7 @@ CreateResourceFile: ; DetachResource(Word, Long) -> void ; tool 0x181E, set 0x1E (ResourceManager) + .section .text.DetachResource,"ax" .globl DetachResource DetachResource: ; --- stash arg0 (in A) --- @@ -13802,7 +14487,7 @@ DetachResource: lda 0xE0 pha ; --- arg1 (Long, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -13812,6 +14497,7 @@ DetachResource: ; GetIndResource(Word, Long) -> ResID ; tool 0x231E, set 0x1E (ResourceManager) + .section .text.GetIndResource,"ax" .globl GetIndResource GetIndResource: ; --- stash arg0 (in A) --- @@ -13823,7 +14509,7 @@ GetIndResource: lda 0xE0 pha ; --- arg1 (Long, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -13835,6 +14521,7 @@ GetIndResource: ; GetIndType(Word) -> ResType ; tool 0x211E, set 0x1E (ResourceManager) + .section .text.GetIndType,"ax" .globl GetIndType GetIndType: ; --- stash arg0 (in A) --- @@ -13853,6 +14540,7 @@ GetIndType: ; GetMapHandle(Word) -> ResMapHndl ; tool 0x261E, set 0x1E (ResourceManager) + .section .text.GetMapHandle,"ax" .globl GetMapHandle GetMapHandle: ; --- stash arg0 (in A) --- @@ -13871,6 +14559,7 @@ GetMapHandle: ; GetResourceAttr(Word, Long) -> ResAttr ; tool 0x1B1E, set 0x1E (ResourceManager) + .section .text.GetResourceAttr,"ax" .globl GetResourceAttr GetResourceAttr: ; --- stash arg0 (in A) --- @@ -13882,7 +14571,7 @@ GetResourceAttr: lda 0xE0 pha ; --- arg1 (Long, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -13894,6 +14583,7 @@ GetResourceAttr: ; GetResourceSize(Word, Long) -> LongWord ; tool 0x1D1E, set 0x1E (ResourceManager) + .section .text.GetResourceSize,"ax" .globl GetResourceSize GetResourceSize: ; --- stash arg0 (in A) --- @@ -13905,7 +14595,7 @@ GetResourceSize: lda 0xE0 pha ; --- arg1 (Long, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -13917,6 +14607,7 @@ GetResourceSize: ; HomeResourceFile(Word, Long) -> Word ; tool 0x151E, set 0x1E (ResourceManager) + .section .text.HomeResourceFile,"ax" .globl HomeResourceFile HomeResourceFile: ; --- stash arg0 (in A) --- @@ -13927,7 +14618,7 @@ HomeResourceFile: lda 0xE0 pha ; --- arg1 (Long, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -13938,6 +14629,7 @@ HomeResourceFile: ; LoadAbsResource(Pointer, Long, Word, Long) -> LongWord ; tool 0x271E, set 0x1E (ResourceManager) + .section .text.LoadAbsResource,"ax" .globl LoadAbsResource LoadAbsResource: ; --- stash arg0 (in A/X) --- @@ -13947,12 +14639,12 @@ LoadAbsResource: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Long, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -13960,7 +14652,7 @@ LoadAbsResource: lda 20, s pha ; --- arg3 (Long, 4B) --- - lda 24, s + lda 26, s pha lda 26, s pha @@ -13972,6 +14664,7 @@ LoadAbsResource: ; LoadResource(Word, Long) -> Handle ; tool 0x0E1E, set 0x1E (ResourceManager) + .section .text.LoadResource,"ax" .globl LoadResource LoadResource: ; --- stash arg0 (in A) --- @@ -13983,7 +14676,7 @@ LoadResource: lda 0xE0 pha ; --- arg1 (Long, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -13995,6 +14688,7 @@ LoadResource: ; MarkResourceChange(Word, Word, Long) -> void ; tool 0x101E, set 0x1E (ResourceManager) + .section .text.MarkResourceChange,"ax" .globl MarkResourceChange MarkResourceChange: ; --- stash arg0 (in A) --- @@ -14006,7 +14700,7 @@ MarkResourceChange: lda 6, s pha ; --- arg2 (Long, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -14016,18 +14710,19 @@ MarkResourceChange: ; MatchResourceHandle(Pointer, Handle) -> void ; tool 0x1E1E, set 0x1E (ResourceManager) + .section .text.MatchResourceHandle,"ax" .globl MatchResourceHandle MatchResourceHandle: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Handle, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -14037,6 +14732,7 @@ MatchResourceHandle: ; OpenResourceFile(Word, Pointer, Pointer) -> Word ; tool 0x0A1E, set 0x1E (ResourceManager) + .section .text.OpenResourceFile,"ax" .globl OpenResourceFile OpenResourceFile: ; --- stash arg0 (in A) --- @@ -14047,12 +14743,12 @@ OpenResourceFile: lda 0xE0 pha ; --- arg1 (Pointer, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (Pointer, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -14063,6 +14759,7 @@ OpenResourceFile: ; ReleaseResource(Word, Word, Long) -> void ; tool 0x171E, set 0x1E (ResourceManager) + .section .text.ReleaseResource,"ax" .globl ReleaseResource ReleaseResource: ; --- stash arg0 (in A) --- @@ -14074,7 +14771,7 @@ ReleaseResource: lda 6, s pha ; --- arg2 (Long, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -14084,6 +14781,7 @@ ReleaseResource: ; RemoveResource(Word, Long) -> void ; tool 0x0F1E, set 0x1E (ResourceManager) + .section .text.RemoveResource,"ax" .globl RemoveResource RemoveResource: ; --- stash arg0 (in A) --- @@ -14092,7 +14790,7 @@ RemoveResource: lda 0xE0 pha ; --- arg1 (Long, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -14102,16 +14800,17 @@ RemoveResource: ; ResourceConverter(Pointer, Word, Word) -> void ; tool 0x281E, set 0x1E (ResourceManager) + .section .text.ResourceConverter,"ax" .globl ResourceConverter ResourceConverter: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -14124,6 +14823,7 @@ ResourceConverter: ; SetResourceAttr(Word, Word, Long) -> void ; tool 0x1C1E, set 0x1E (ResourceManager) + .section .text.SetResourceAttr,"ax" .globl SetResourceAttr SetResourceAttr: ; --- stash arg0 (in A) --- @@ -14135,7 +14835,7 @@ SetResourceAttr: lda 6, s pha ; --- arg2 (Long, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -14145,21 +14845,22 @@ SetResourceAttr: ; SetResourceID(Long, Word, Long) -> void ; tool 0x1A1E, set 0x1E (ResourceManager) + .section .text.SetResourceID,"ax" .globl SetResourceID SetResourceID: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha ; --- arg2 (Long, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -14169,6 +14870,7 @@ SetResourceID: ; UniqueResourceID(Word, Word) -> ResID ; tool 0x191E, set 0x1E (ResourceManager) + .section .text.UniqueResourceID,"ax" .globl UniqueResourceID UniqueResourceID: ; --- stash arg0 (in A) --- @@ -14190,6 +14892,7 @@ UniqueResourceID: ; WriteResource(Word, Long) -> void ; tool 0x161E, set 0x1E (ResourceManager) + .section .text.WriteResource,"ax" .globl WriteResource WriteResource: ; --- stash arg0 (in A) --- @@ -14198,7 +14901,7 @@ WriteResource: lda 0xE0 pha ; --- arg1 (Long, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -14208,6 +14911,7 @@ WriteResource: ; LoadResource2(Word, Ptr, Word, Long) -> Handle ; tool 0x291E, set 0x1E (ResourceManager) + .section .text.LoadResource2,"ax" .globl LoadResource2 LoadResource2: ; --- stash arg0 (in A) --- @@ -14219,7 +14923,7 @@ LoadResource2: lda 0xE0 pha ; --- arg1 (Ptr, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -14227,7 +14931,7 @@ LoadResource2: lda 18, s pha ; --- arg3 (Long, 4B) --- - lda 22, s + lda 24, s pha lda 24, s pha @@ -14239,6 +14943,7 @@ LoadResource2: ; RMFindNamedResource(Word, Ptr, Word) -> LongWord ; tool 0x2A1E, set 0x1E (ResourceManager) + .section .text.RMFindNamedResource,"ax" .globl RMFindNamedResource RMFindNamedResource: ; --- stash arg0 (in A) --- @@ -14250,7 +14955,7 @@ RMFindNamedResource: lda 0xE0 pha ; --- arg1 (Ptr, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -14265,6 +14970,7 @@ RMFindNamedResource: ; RMGetResourceName(Word, Long, Ptr) -> void ; tool 0x2B1E, set 0x1E (ResourceManager) + .section .text.RMGetResourceName,"ax" .globl RMGetResourceName RMGetResourceName: ; --- stash arg0 (in A) --- @@ -14273,12 +14979,12 @@ RMGetResourceName: lda 0xE0 pha ; --- arg1 (Long, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha ; --- arg2 (Ptr, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -14288,6 +14994,7 @@ RMGetResourceName: ; RMLoadNamedResource(Word, Ptr) -> Handle ; tool 0x2C1E, set 0x1E (ResourceManager) + .section .text.RMLoadNamedResource,"ax" .globl RMLoadNamedResource RMLoadNamedResource: ; --- stash arg0 (in A) --- @@ -14299,7 +15006,7 @@ RMLoadNamedResource: lda 0xE0 pha ; --- arg1 (Ptr, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -14311,6 +15018,7 @@ RMLoadNamedResource: ; RMSetResourceName(Word, Long, Ptr) -> void ; tool 0x2D1E, set 0x1E (ResourceManager) + .section .text.RMSetResourceName,"ax" .globl RMSetResourceName RMSetResourceName: ; --- stash arg0 (in A) --- @@ -14319,12 +15027,12 @@ RMSetResourceName: lda 0xE0 pha ; --- arg1 (Long, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha ; --- arg2 (Ptr, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -14334,6 +15042,7 @@ RMSetResourceName: ; OpenResourceFileByID(Word, Word) -> Word ; tool 0x2E1E, set 0x1E (ResourceManager) + .section .text.OpenResourceFileByID,"ax" .globl OpenResourceFileByID OpenResourceFileByID: ; --- stash arg0 (in A) --- @@ -14353,6 +15062,7 @@ OpenResourceFileByID: ; CompactResourceFile(Word, Word) -> void ; tool 0x2F1E, set 0x1E (ResourceManager) + .section .text.CompactResourceFile,"ax" .globl CompactResourceFile CompactResourceFile: ; --- stash arg0 (in A) --- @@ -14369,6 +15079,7 @@ CompactResourceFile: ; SchAddTask(VoidProcPtr) -> Boolean ; tool 0x0907, set 0x07 (Scheduler) + .section .text.SchAddTask,"ax" .globl SchAddTask SchAddTask: ; --- stash arg0 (in A/X) --- @@ -14377,10 +15088,10 @@ SchAddTask: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0907 jsl 0xe10000 pla ; result -> A @@ -14388,16 +15099,17 @@ SchAddTask: ; GetScrap(Handle, Word) -> void ; tool 0x0D16, set 0x16 (ScrapManager) + .section .text.GetScrap,"ax" .globl GetScrap GetScrap: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -14407,6 +15119,7 @@ GetScrap: ; GetScrapHandle(Word) -> handle ; tool 0x0E16, set 0x16 (ScrapManager) + .section .text.GetScrapHandle,"ax" .globl GetScrapHandle GetScrapHandle: ; --- stash arg0 (in A) --- @@ -14425,6 +15138,7 @@ GetScrapHandle: ; GetScrapPath(void) -> Pointer ; tool 0x1016, set 0x16 (ScrapManager) + .section .text.GetScrapPath,"ax" .globl GetScrapPath GetScrapPath: ; --- result space (4 bytes) --- @@ -14438,6 +15152,7 @@ GetScrapPath: ; GetScrapSize(Word) -> LongWord ; tool 0x0F16, set 0x16 (ScrapManager) + .section .text.GetScrapSize,"ax" .globl GetScrapSize GetScrapSize: ; --- stash arg0 (in A) --- @@ -14456,21 +15171,22 @@ GetScrapSize: ; PutScrap(LongWord, Word, Pointer) -> void ; tool 0x0C16, set 0x16 (ScrapManager) + .section .text.PutScrap,"ax" .globl PutScrap PutScrap: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha ; --- arg2 (Pointer, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -14480,22 +15196,24 @@ PutScrap: ; SetScrapPath(Pointer) -> void ; tool 0x1116, set 0x16 (ScrapManager) + .section .text.SetScrapPath,"ax" .globl SetScrapPath SetScrapPath: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1116 jsl 0xe10000 rtl ; GetIndScrap(Word, Ptr) -> void ; tool 0x1416, set 0x16 (ScrapManager) + .section .text.GetIndScrap,"ax" .globl GetIndScrap GetIndScrap: ; --- stash arg0 (in A) --- @@ -14504,7 +15222,7 @@ GetIndScrap: lda 0xE0 pha ; --- arg1 (Ptr, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -14514,6 +15232,7 @@ GetIndScrap: ; ShowClipboard(Word, Rect) -> GrafPortPtr ; tool 0x1516, set 0x16 (ScrapManager) + .section .text.ShowClipboard,"ax" .globl ShowClipboard ShowClipboard: ; --- stash arg0 (in A) --- @@ -14525,7 +15244,7 @@ ShowClipboard: lda 0xE0 pha ; --- arg1 (Rect, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -14537,6 +15256,7 @@ ShowClipboard: ; FFStartSound(Word, Pointer) -> void ; tool 0x0E08, set 0x08 (SoundManager) + .section .text.FFStartSound,"ax" .globl FFStartSound FFStartSound: ; --- stash arg0 (in A) --- @@ -14545,7 +15265,7 @@ FFStartSound: lda 0xE0 pha ; --- arg1 (Pointer, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -14555,6 +15275,7 @@ FFStartSound: ; GetTableAddress(void) -> Pointer ; tool 0x0B08, set 0x08 (SoundManager) + .section .text.GetTableAddress,"ax" .globl GetTableAddress GetTableAddress: ; --- result space (4 bytes) --- @@ -14568,16 +15289,17 @@ GetTableAddress: ; ReadRamBlock(Pointer, Word, Word) -> void ; tool 0x0A08, set 0x08 (SoundManager) + .section .text.ReadRamBlock,"ax" .globl ReadRamBlock ReadRamBlock: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -14590,22 +15312,24 @@ ReadRamBlock: ; SetSoundMIRQV(VoidProcPtr) -> void ; tool 0x1208, set 0x08 (SoundManager) + .section .text.SetSoundMIRQV,"ax" .globl SetSoundMIRQV SetSoundMIRQV: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1208 jsl 0xe10000 rtl ; SetSoundVolume(Word, Word) -> void ; tool 0x0D08, set 0x08 (SoundManager) + .section .text.SetSoundVolume,"ax" .globl SetSoundVolume SetSoundVolume: ; --- stash arg0 (in A) --- @@ -14622,6 +15346,7 @@ SetSoundVolume: ; SetUserSoundIRQV(VoidProcPtr) -> ProcPtr ; tool 0x1308, set 0x08 (SoundManager) + .section .text.SetUserSoundIRQV,"ax" .globl SetUserSoundIRQV SetUserSoundIRQV: ; --- stash arg0 (in A/X) --- @@ -14631,10 +15356,10 @@ SetUserSoundIRQV: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1308 jsl 0xe10000 pla ; result lo -> A @@ -14643,16 +15368,17 @@ SetUserSoundIRQV: ; WriteRamBlock(Pointer, Word, Word) -> void ; tool 0x0908, set 0x08 (SoundManager) + .section .text.WriteRamBlock,"ax" .globl WriteRamBlock WriteRamBlock: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -14665,6 +15391,7 @@ WriteRamBlock: ; FFSetUpSound(Word, Pointer) -> void ; tool 0x1508, set 0x08 (SoundManager) + .section .text.FFSetUpSound,"ax" .globl FFSetUpSound FFSetUpSound: ; --- stash arg0 (in A) --- @@ -14673,7 +15400,7 @@ FFSetUpSound: lda 0xE0 pha ; --- arg1 (Pointer, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -14683,38 +15410,41 @@ FFSetUpSound: ; ReadDOCReg(Pointer) -> void ; tool 0x1808, set 0x08 (SoundManager) + .section .text.ReadDOCReg,"ax" .globl ReadDOCReg ReadDOCReg: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1808 jsl 0xe10000 rtl ; SetDOCReg(Pointer) -> void ; tool 0x1708, set 0x08 (SoundManager) + .section .text.SetDOCReg,"ax" .globl SetDOCReg SetDOCReg: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1708 jsl 0xe10000 rtl ; SFStartUp(Word, Word) -> void ; tool 0x0217, set 0x17 (StandardFile) + .section .text.SFStartUp,"ax" .globl SFStartUp SFStartUp: ; --- stash arg0 (in A) --- @@ -14731,6 +15461,7 @@ SFStartUp: ; SFGetFile(Integer, Integer, Pointer, WordProcPtr, Pointer, SFReplyRecPtr) -> void ; tool 0x0917, set 0x17 (StandardFile) + .section .text.SFGetFile,"ax" .globl SFGetFile SFGetFile: ; --- stash arg0 (in A) --- @@ -14742,22 +15473,22 @@ SFGetFile: lda 6, s pha ; --- arg2 (Pointer, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha ; --- arg3 (WordProcPtr, 4B) --- - lda 18, s + lda 20, s pha lda 20, s pha ; --- arg4 (Pointer, 4B) --- - lda 26, s + lda 28, s pha lda 28, s pha ; --- arg5 (SFReplyRecPtr, 4B) --- - lda 34, s + lda 36, s pha lda 36, s pha @@ -14767,6 +15498,7 @@ SFGetFile: ; SFPGetFile(Integer, Integer, Pointer, WordProcPtr, Pointer, Pointer, VoidProcPtr, SFReplyRecPtr) -> void ; tool 0x0B17, set 0x17 (StandardFile) + .section .text.SFPGetFile,"ax" .globl SFPGetFile SFPGetFile: ; --- stash arg0 (in A) --- @@ -14778,32 +15510,32 @@ SFPGetFile: lda 6, s pha ; --- arg2 (Pointer, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha ; --- arg3 (WordProcPtr, 4B) --- - lda 18, s + lda 20, s pha lda 20, s pha ; --- arg4 (Pointer, 4B) --- - lda 26, s + lda 28, s pha lda 28, s pha ; --- arg5 (Pointer, 4B) --- - lda 34, s + lda 36, s pha lda 36, s pha ; --- arg6 (VoidProcPtr, 4B) --- - lda 42, s + lda 44, s pha lda 44, s pha ; --- arg7 (SFReplyRecPtr, 4B) --- - lda 50, s + lda 52, s pha lda 52, s pha @@ -14813,6 +15545,7 @@ SFPGetFile: ; SFPPutFile(Integer, Integer, Pointer, Pointer, Word, Pointer, VoidProcPtr, SFReplyRecPtr) -> void ; tool 0x0C17, set 0x17 (StandardFile) + .section .text.SFPPutFile,"ax" .globl SFPPutFile SFPPutFile: ; --- stash arg0 (in A) --- @@ -14824,12 +15557,12 @@ SFPPutFile: lda 6, s pha ; --- arg2 (Pointer, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha ; --- arg3 (Pointer, 4B) --- - lda 18, s + lda 20, s pha lda 20, s pha @@ -14837,17 +15570,17 @@ SFPPutFile: lda 26, s pha ; --- arg5 (Pointer, 4B) --- - lda 30, s + lda 32, s pha lda 32, s pha ; --- arg6 (VoidProcPtr, 4B) --- - lda 38, s + lda 40, s pha lda 40, s pha ; --- arg7 (SFReplyRecPtr, 4B) --- - lda 46, s + lda 48, s pha lda 48, s pha @@ -14857,6 +15590,7 @@ SFPPutFile: ; SFPutFile(Integer, Integer, Pointer, Pointer, Word, SFReplyRecPtr) -> void ; tool 0x0A17, set 0x17 (StandardFile) + .section .text.SFPutFile,"ax" .globl SFPutFile SFPutFile: ; --- stash arg0 (in A) --- @@ -14868,12 +15602,12 @@ SFPutFile: lda 6, s pha ; --- arg2 (Pointer, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha ; --- arg3 (Pointer, 4B) --- - lda 18, s + lda 20, s pha lda 20, s pha @@ -14881,7 +15615,7 @@ SFPutFile: lda 26, s pha ; --- arg5 (SFReplyRecPtr, 4B) --- - lda 30, s + lda 32, s pha lda 32, s pha @@ -14891,6 +15625,7 @@ SFPutFile: ; SFGetFile2(Integer, Integer, Word, Ref, WordProcPtr, SFTypeList2Ptr, SFReplyRec2Ptr) -> void ; tool 0x0E17, set 0x17 (StandardFile) + .section .text.SFGetFile2,"ax" .globl SFGetFile2 SFGetFile2: ; --- stash arg0 (in A) --- @@ -14905,22 +15640,22 @@ SFGetFile2: lda 10, s pha ; --- arg3 (Ref, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha ; --- arg4 (WordProcPtr, 4B) --- - lda 22, s + lda 24, s pha lda 24, s pha ; --- arg5 (SFTypeList2Ptr, 4B) --- - lda 30, s + lda 32, s pha lda 32, s pha ; --- arg6 (SFReplyRec2Ptr, 4B) --- - lda 38, s + lda 40, s pha lda 40, s pha @@ -14930,6 +15665,7 @@ SFGetFile2: ; SFMultiGet2(Integer, Integer, Word, Ref, WordProcPtr, SFTypeList2Ptr, MultiReplyPtr) -> void ; tool 0x1417, set 0x17 (StandardFile) + .section .text.SFMultiGet2,"ax" .globl SFMultiGet2 SFMultiGet2: ; --- stash arg0 (in A) --- @@ -14944,22 +15680,22 @@ SFMultiGet2: lda 10, s pha ; --- arg3 (Ref, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha ; --- arg4 (WordProcPtr, 4B) --- - lda 22, s + lda 24, s pha lda 24, s pha ; --- arg5 (SFTypeList2Ptr, 4B) --- - lda 30, s + lda 32, s pha lda 32, s pha ; --- arg6 (MultiReplyPtr, 4B) --- - lda 38, s + lda 40, s pha lda 40, s pha @@ -14969,6 +15705,7 @@ SFMultiGet2: ; SFPGetFile2(Integer, Integer, VoidProcPtr, Word, Ref, WordProcPtr, SFTypeList2Ptr, Pointer, VoidProcPtr, SFReplyRec2Ptr) -> void ; tool 0x1017, set 0x17 (StandardFile) + .section .text.SFPGetFile2,"ax" .globl SFPGetFile2 SFPGetFile2: ; --- stash arg0 (in A) --- @@ -14980,7 +15717,7 @@ SFPGetFile2: lda 6, s pha ; --- arg2 (VoidProcPtr, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -14988,32 +15725,32 @@ SFPGetFile2: lda 18, s pha ; --- arg4 (Ref, 4B) --- - lda 22, s + lda 24, s pha lda 24, s pha ; --- arg5 (WordProcPtr, 4B) --- - lda 30, s + lda 32, s pha lda 32, s pha ; --- arg6 (SFTypeList2Ptr, 4B) --- - lda 38, s + lda 40, s pha lda 40, s pha ; --- arg7 (Pointer, 4B) --- - lda 46, s + lda 48, s pha lda 48, s pha ; --- arg8 (VoidProcPtr, 4B) --- - lda 54, s + lda 56, s pha lda 56, s pha ; --- arg9 (SFReplyRec2Ptr, 4B) --- - lda 62, s + lda 64, s pha lda 64, s pha @@ -15023,6 +15760,7 @@ SFPGetFile2: ; SFPMultiGet2(Integer, Integer, VoidProcPtr, Word, Ref, WordProcPtr, SFTypeList2Ptr, Pointer, VoidProcPtr, MultiReplyPtr) -> void ; tool 0x1517, set 0x17 (StandardFile) + .section .text.SFPMultiGet2,"ax" .globl SFPMultiGet2 SFPMultiGet2: ; --- stash arg0 (in A) --- @@ -15034,7 +15772,7 @@ SFPMultiGet2: lda 6, s pha ; --- arg2 (VoidProcPtr, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -15042,32 +15780,32 @@ SFPMultiGet2: lda 18, s pha ; --- arg4 (Ref, 4B) --- - lda 22, s + lda 24, s pha lda 24, s pha ; --- arg5 (WordProcPtr, 4B) --- - lda 30, s + lda 32, s pha lda 32, s pha ; --- arg6 (SFTypeList2Ptr, 4B) --- - lda 38, s + lda 40, s pha lda 40, s pha ; --- arg7 (Pointer, 4B) --- - lda 46, s + lda 48, s pha lda 48, s pha ; --- arg8 (VoidProcPtr, 4B) --- - lda 54, s + lda 56, s pha lda 56, s pha ; --- arg9 (MultiReplyPtr, 4B) --- - lda 62, s + lda 64, s pha lda 64, s pha @@ -15077,6 +15815,7 @@ SFPMultiGet2: ; SFPPutFile2(Integer, Integer, VoidProcPtr, Word, Ref, Word, Ref, Pointer, VoidProcPtr, SFReplyRec2Ptr) -> void ; tool 0x1117, set 0x17 (StandardFile) + .section .text.SFPPutFile2,"ax" .globl SFPPutFile2 SFPPutFile2: ; --- stash arg0 (in A) --- @@ -15088,7 +15827,7 @@ SFPPutFile2: lda 6, s pha ; --- arg2 (VoidProcPtr, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -15096,7 +15835,7 @@ SFPPutFile2: lda 18, s pha ; --- arg4 (Ref, 4B) --- - lda 22, s + lda 24, s pha lda 24, s pha @@ -15104,22 +15843,22 @@ SFPPutFile2: lda 30, s pha ; --- arg6 (Ref, 4B) --- - lda 34, s + lda 36, s pha lda 36, s pha ; --- arg7 (Pointer, 4B) --- - lda 42, s + lda 44, s pha lda 44, s pha ; --- arg8 (VoidProcPtr, 4B) --- - lda 50, s + lda 52, s pha lda 52, s pha ; --- arg9 (SFReplyRec2Ptr, 4B) --- - lda 58, s + lda 60, s pha lda 60, s pha @@ -15129,6 +15868,7 @@ SFPPutFile2: ; SFPutFile2(Integer, Integer, Word, Ref, Word, Ref, SFReplyRec2Ptr) -> void ; tool 0x0F17, set 0x17 (StandardFile) + .section .text.SFPutFile2,"ax" .globl SFPutFile2 SFPutFile2: ; --- stash arg0 (in A) --- @@ -15143,7 +15883,7 @@ SFPutFile2: lda 10, s pha ; --- arg3 (Ref, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -15151,12 +15891,12 @@ SFPutFile2: lda 22, s pha ; --- arg5 (Ref, 4B) --- - lda 26, s + lda 28, s pha lda 28, s pha ; --- arg6 (SFReplyRec2Ptr, 4B) --- - lda 34, s + lda 36, s pha lda 36, s pha @@ -15166,18 +15906,19 @@ SFPutFile2: ; SFReScan(WordProcPtr, SFTypeList2Ptr) -> void ; tool 0x1317, set 0x17 (StandardFile) + .section .text.SFReScan,"ax" .globl SFReScan SFReScan: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (SFTypeList2Ptr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -15187,6 +15928,7 @@ SFReScan: ; TEStartUp(Word, Word) -> void ; tool 0x0222, set 0x22 (TextEdit) + .section .text.TEStartUp,"ax" .globl TEStartUp TEStartUp: ; --- stash arg0 (in A) --- @@ -15203,50 +15945,53 @@ TEStartUp: ; TEActivate(Handle) -> void ; tool 0x0F22, set 0x22 (TextEdit) + .section .text.TEActivate,"ax" .globl TEActivate TEActivate: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0F22 jsl 0xe10000 rtl ; TEClear(Handle) -> void ; tool 0x1922, set 0x22 (TextEdit) + .section .text.TEClear,"ax" .globl TEClear TEClear: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1922 jsl 0xe10000 rtl ; TEClick(EventRecordPtr, Handle) -> void ; tool 0x1122, set 0x22 (TextEdit) + .section .text.TEClick,"ax" .globl TEClick TEClick: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Handle, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -15256,70 +16001,75 @@ TEClick: ; TECompactRecord(Handle) -> void ; tool 0x2822, set 0x22 (TextEdit) + .section .text.TECompactRecord,"ax" .globl TECompactRecord TECompactRecord: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2822 jsl 0xe10000 rtl ; TECopy(Handle) -> void ; tool 0x1722, set 0x22 (TextEdit) + .section .text.TECopy,"ax" .globl TECopy TECopy: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1722 jsl 0xe10000 rtl ; TECut(Handle) -> void ; tool 0x1622, set 0x22 (TextEdit) + .section .text.TECut,"ax" .globl TECut TECut: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1622 jsl 0xe10000 rtl ; TEDeactivate(Handle) -> void ; tool 0x1022, set 0x22 (TextEdit) + .section .text.TEDeactivate,"ax" .globl TEDeactivate TEDeactivate: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1022 jsl 0xe10000 rtl ; TEGetDefProc(void) -> ProcPtr ; tool 0x2222, set 0x22 (TextEdit) + .section .text.TEGetDefProc,"ax" .globl TEGetDefProc TEGetDefProc: ; --- result space (4 bytes) --- @@ -15333,6 +16083,7 @@ TEGetDefProc: ; TEGetInternalProc(void) -> ProcPtr ; tool 0x2622, set 0x22 (TextEdit) + .section .text.TEGetInternalProc,"ax" .globl TEGetInternalProc TEGetInternalProc: ; --- result space (4 bytes) --- @@ -15346,6 +16097,7 @@ TEGetInternalProc: ; TEGetLastError(Word, Handle) -> Word ; tool 0x2722, set 0x22 (TextEdit) + .section .text.TEGetLastError,"ax" .globl TEGetLastError TEGetLastError: ; --- stash arg0 (in A) --- @@ -15356,7 +16108,7 @@ TEGetLastError: lda 0xE0 pha ; --- arg1 (Handle, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -15367,6 +16119,7 @@ TEGetLastError: ; TEGetRuler(Word, Ref, Handle) -> void ; tool 0x2322, set 0x22 (TextEdit) + .section .text.TEGetRuler,"ax" .globl TEGetRuler TEGetRuler: ; --- stash arg0 (in A) --- @@ -15375,12 +16128,12 @@ TEGetRuler: lda 0xE0 pha ; --- arg1 (Ref, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha ; --- arg2 (Handle, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -15390,23 +16143,24 @@ TEGetRuler: ; TEGetSelection(Pointer, Pointer, Handle) -> void ; tool 0x1C22, set 0x22 (TextEdit) + .section .text.TEGetSelection,"ax" .globl TEGetSelection TEGetSelection: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Pointer, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (Handle, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -15416,6 +16170,7 @@ TEGetSelection: ; TEGetSelectionStyle(TEStylePtr, Handle, Handle) -> Word ; tool 0x1E22, set 0x22 (TextEdit) + .section .text.TEGetSelectionStyle,"ax" .globl TEGetSelectionStyle TEGetSelectionStyle: ; --- stash arg0 (in A/X) --- @@ -15424,17 +16179,17 @@ TEGetSelectionStyle: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Handle, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha ; --- arg2 (Handle, 4B) --- - lda 18, s + lda 20, s pha lda 20, s pha @@ -15445,6 +16200,7 @@ TEGetSelectionStyle: ; TEGetText(Word, Ref, Long, Word, Ref, Handle) -> LongWord ; tool 0x0C22, set 0x22 (TextEdit) + .section .text.TEGetText,"ax" .globl TEGetText TEGetText: ; --- stash arg0 (in A) --- @@ -15456,12 +16212,12 @@ TEGetText: lda 0xE0 pha ; --- arg1 (Ref, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha ; --- arg2 (Long, 4B) --- - lda 18, s + lda 20, s pha lda 20, s pha @@ -15469,12 +16225,12 @@ TEGetText: lda 26, s pha ; --- arg4 (Ref, 4B) --- - lda 30, s + lda 32, s pha lda 32, s pha ; --- arg5 (Handle, 4B) --- - lda 38, s + lda 40, s pha lda 40, s pha @@ -15486,21 +16242,22 @@ TEGetText: ; TEGetTextInfo(Pointer, Word, Handle) -> void ; tool 0x0D22, set 0x22 (TextEdit) + .section .text.TEGetTextInfo,"ax" .globl TEGetTextInfo TEGetTextInfo: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha ; --- arg2 (Handle, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -15510,22 +16267,24 @@ TEGetTextInfo: ; TEIdle(Handle) -> void ; tool 0x0E22, set 0x22 (TextEdit) + .section .text.TEIdle,"ax" .globl TEIdle TEIdle: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0E22 jsl 0xe10000 rtl ; TEInsert(Word, Ref, Long, Word, Ref, Handle) -> void ; tool 0x1A22, set 0x22 (TextEdit) + .section .text.TEInsert,"ax" .globl TEInsert TEInsert: ; --- stash arg0 (in A) --- @@ -15534,12 +16293,12 @@ TEInsert: lda 0xE0 pha ; --- arg1 (Ref, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha ; --- arg2 (Long, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -15547,12 +16306,12 @@ TEInsert: lda 22, s pha ; --- arg4 (Ref, 4B) --- - lda 26, s + lda 28, s pha lda 28, s pha ; --- arg5 (Handle, 4B) --- - lda 34, s + lda 36, s pha lda 36, s pha @@ -15562,18 +16321,19 @@ TEInsert: ; TEKey(EventRecordPtr, Handle) -> void ; tool 0x1422, set 0x22 (TextEdit) + .section .text.TEKey,"ax" .globl TEKey TEKey: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Handle, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -15583,22 +16343,24 @@ TEKey: ; TEKill(Handle) -> void ; tool 0x0A22, set 0x22 (TextEdit) + .section .text.TEKill,"ax" .globl TEKill TEKill: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0A22 jsl 0xe10000 rtl ; TENew(TEParamBlockPtr) -> TERecordHndl ; tool 0x0922, set 0x22 (TextEdit) + .section .text.TENew,"ax" .globl TENew TENew: ; --- stash arg0 (in A/X) --- @@ -15608,10 +16370,10 @@ TENew: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0922 jsl 0xe10000 pla ; result lo -> A @@ -15620,28 +16382,29 @@ TENew: ; TEOffsetToPoint(Long, Long, Long, Handle) -> void ; tool 0x2022, set 0x22 (TextEdit) + .section .text.TEOffsetToPoint,"ax" .globl TEOffsetToPoint TEOffsetToPoint: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Long, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (Long, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha ; --- arg3 (Handle, 4B) --- - lda 24, s + lda 26, s pha lda 26, s pha @@ -15651,6 +16414,7 @@ TEOffsetToPoint: ; TEPaintText(GrafPortPtr, Long, Rect, Word, Handle) -> LongWord ; tool 0x1322, set 0x22 (TextEdit) + .section .text.TEPaintText,"ax" .globl TEPaintText TEPaintText: ; --- stash arg0 (in A/X) --- @@ -15660,17 +16424,17 @@ TEPaintText: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Long, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha ; --- arg2 (Rect, 4B) --- - lda 20, s + lda 22, s pha lda 22, s pha @@ -15678,7 +16442,7 @@ TEPaintText: lda 28, s pha ; --- arg4 (Handle, 4B) --- - lda 32, s + lda 34, s pha lda 34, s pha @@ -15690,22 +16454,24 @@ TEPaintText: ; TEPaste(Handle) -> void ; tool 0x1822, set 0x22 (TextEdit) + .section .text.TEPaste,"ax" .globl TEPaste TEPaste: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1822 jsl 0xe10000 rtl ; TEPointToOffset(Long, Long, Handle) -> LongWord ; tool 0x2122, set 0x22 (TextEdit) + .section .text.TEPointToOffset,"ax" .globl TEPointToOffset TEPointToOffset: ; --- stash arg0 (in A/X) --- @@ -15715,17 +16481,17 @@ TEPointToOffset: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Long, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha ; --- arg2 (Handle, 4B) --- - lda 20, s + lda 22, s pha lda 22, s pha @@ -15737,6 +16503,7 @@ TEPointToOffset: ; TEReplace(Word, Ref, Long, Word, Ref, Handle) -> void ; tool 0x1B22, set 0x22 (TextEdit) + .section .text.TEReplace,"ax" .globl TEReplace TEReplace: ; --- stash arg0 (in A) --- @@ -15745,12 +16512,12 @@ TEReplace: lda 0xE0 pha ; --- arg1 (Ref, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha ; --- arg2 (Long, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -15758,12 +16525,12 @@ TEReplace: lda 22, s pha ; --- arg4 (Ref, 4B) --- - lda 26, s + lda 28, s pha lda 28, s pha ; --- arg5 (Handle, 4B) --- - lda 34, s + lda 36, s pha lda 36, s pha @@ -15773,6 +16540,7 @@ TEReplace: ; TEScroll(Word, Long, Long, Handle) -> void ; tool 0x2522, set 0x22 (TextEdit) + .section .text.TEScroll,"ax" .globl TEScroll TEScroll: ; --- stash arg0 (in A) --- @@ -15781,17 +16549,17 @@ TEScroll: lda 0xE0 pha ; --- arg1 (Long, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha ; --- arg2 (Long, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha ; --- arg3 (Handle, 4B) --- - lda 22, s + lda 24, s pha lda 24, s pha @@ -15801,6 +16569,7 @@ TEScroll: ; TESetRuler(Word, Ref, Handle) -> void ; tool 0x2422, set 0x22 (TextEdit) + .section .text.TESetRuler,"ax" .globl TESetRuler TESetRuler: ; --- stash arg0 (in A) --- @@ -15809,12 +16578,12 @@ TESetRuler: lda 0xE0 pha ; --- arg1 (Ref, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha ; --- arg2 (Handle, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -15824,23 +16593,24 @@ TESetRuler: ; TESetSelection(Pointer, Pointer, Handle) -> void ; tool 0x1D22, set 0x22 (TextEdit) + .section .text.TESetSelection,"ax" .globl TESetSelection TESetSelection: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Pointer, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (Handle, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -15850,6 +16620,7 @@ TESetSelection: ; TESetText(Word, Ref, Long, Word, Ref, Handle) -> void ; tool 0x0B22, set 0x22 (TextEdit) + .section .text.TESetText,"ax" .globl TESetText TESetText: ; --- stash arg0 (in A) --- @@ -15858,12 +16629,12 @@ TESetText: lda 0xE0 pha ; --- arg1 (Ref, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha ; --- arg2 (Long, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -15871,12 +16642,12 @@ TESetText: lda 22, s pha ; --- arg4 (Ref, 4B) --- - lda 26, s + lda 28, s pha lda 28, s pha ; --- arg5 (Handle, 4B) --- - lda 34, s + lda 36, s pha lda 36, s pha @@ -15886,6 +16657,7 @@ TESetText: ; TEStyleChange(Word, TEStylePtr, Handle) -> void ; tool 0x1F22, set 0x22 (TextEdit) + .section .text.TEStyleChange,"ax" .globl TEStyleChange TEStyleChange: ; --- stash arg0 (in A) --- @@ -15894,12 +16666,12 @@ TEStyleChange: lda 0xE0 pha ; --- arg1 (TEStylePtr, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha ; --- arg2 (Handle, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -15909,22 +16681,24 @@ TEStyleChange: ; TEUpdate(Handle) -> void ; tool 0x1222, set 0x22 (TextEdit) + .section .text.TEUpdate,"ax" .globl TEUpdate TEUpdate: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1222 jsl 0xe10000 rtl ; CtlTextDev(Word, Word) -> void ; tool 0x160C, set 0x0C (TextTools) + .section .text.CtlTextDev,"ax" .globl CtlTextDev CtlTextDev: ; --- stash arg0 (in A) --- @@ -15941,16 +16715,17 @@ CtlTextDev: ; ErrWriteBlock(Pointer, Word, Word) -> void ; tool 0x1F0C, set 0x0C (TextTools) + .section .text.ErrWriteBlock,"ax" .globl ErrWriteBlock ErrWriteBlock: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -15963,54 +16738,58 @@ ErrWriteBlock: ; ErrWriteCString(Pointer) -> void ; tool 0x210C, set 0x0C (TextTools) + .section .text.ErrWriteCString,"ax" .globl ErrWriteCString ErrWriteCString: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x210C jsl 0xe10000 rtl ; ErrWriteLine(Pointer) -> void ; tool 0x1B0C, set 0x0C (TextTools) + .section .text.ErrWriteLine,"ax" .globl ErrWriteLine ErrWriteLine: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1B0C jsl 0xe10000 rtl ; ErrWriteString(Pointer) -> void ; tool 0x1D0C, set 0x0C (TextTools) + .section .text.ErrWriteString,"ax" .globl ErrWriteString ErrWriteString: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1D0C jsl 0xe10000 rtl ; GetErrGlobals(void) -> Long ; tool 0x0E0C, set 0x0C (TextTools) + .section .text.GetErrGlobals,"ax" .globl GetErrGlobals GetErrGlobals: ; --- result space (4 bytes) --- @@ -16024,6 +16803,7 @@ GetErrGlobals: ; GetInGlobals(void) -> Long ; tool 0x0C0C, set 0x0C (TextTools) + .section .text.GetInGlobals,"ax" .globl GetInGlobals GetInGlobals: ; --- result space (4 bytes) --- @@ -16037,6 +16817,7 @@ GetInGlobals: ; GetOutGlobals(void) -> Long ; tool 0x0D0C, set 0x0C (TextTools) + .section .text.GetOutGlobals,"ax" .globl GetOutGlobals GetOutGlobals: ; --- result space (4 bytes) --- @@ -16050,6 +16831,7 @@ GetOutGlobals: ; ReadLine(Pointer, Word, Word, Word) -> Word ; tool 0x240C, set 0x0C (TextTools) + .section .text.ReadLine,"ax" .globl ReadLine ReadLine: ; --- stash arg0 (in A/X) --- @@ -16058,10 +16840,10 @@ ReadLine: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 10, s pha @@ -16078,6 +16860,7 @@ ReadLine: ; SetErrGlobals(Word, Word) -> void ; tool 0x0B0C, set 0x0C (TextTools) + .section .text.SetErrGlobals,"ax" .globl SetErrGlobals SetErrGlobals: ; --- stash arg0 (in A) --- @@ -16094,6 +16877,7 @@ SetErrGlobals: ; SetErrorDevice(Word, LongWord) -> void ; tool 0x110C, set 0x0C (TextTools) + .section .text.SetErrorDevice,"ax" .globl SetErrorDevice SetErrorDevice: ; --- stash arg0 (in A) --- @@ -16102,7 +16886,7 @@ SetErrorDevice: lda 0xE0 pha ; --- arg1 (LongWord, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -16112,6 +16896,7 @@ SetErrorDevice: ; SetInGlobals(Word, Word) -> void ; tool 0x090C, set 0x0C (TextTools) + .section .text.SetInGlobals,"ax" .globl SetInGlobals SetInGlobals: ; --- stash arg0 (in A) --- @@ -16128,6 +16913,7 @@ SetInGlobals: ; SetInputDevice(Word, LongWord) -> void ; tool 0x0F0C, set 0x0C (TextTools) + .section .text.SetInputDevice,"ax" .globl SetInputDevice SetInputDevice: ; --- stash arg0 (in A) --- @@ -16136,7 +16922,7 @@ SetInputDevice: lda 0xE0 pha ; --- arg1 (LongWord, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -16146,6 +16932,7 @@ SetInputDevice: ; SetOutGlobals(Word, Word) -> void ; tool 0x0A0C, set 0x0C (TextTools) + .section .text.SetOutGlobals,"ax" .globl SetOutGlobals SetOutGlobals: ; --- stash arg0 (in A) --- @@ -16162,6 +16949,7 @@ SetOutGlobals: ; SetOutputDevice(Word, LongWord) -> void ; tool 0x100C, set 0x0C (TextTools) + .section .text.SetOutputDevice,"ax" .globl SetOutputDevice SetOutputDevice: ; --- stash arg0 (in A) --- @@ -16170,7 +16958,7 @@ SetOutputDevice: lda 0xE0 pha ; --- arg1 (LongWord, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -16180,6 +16968,7 @@ SetOutputDevice: ; StatusTextDev(Word, Word) -> void ; tool 0x170C, set 0x0C (TextTools) + .section .text.StatusTextDev,"ax" .globl StatusTextDev StatusTextDev: ; --- stash arg0 (in A) --- @@ -16196,16 +16985,17 @@ StatusTextDev: ; TextReadBlock(Pointer, Word, Word, Word) -> void ; tool 0x230C, set 0x0C (TextTools) + .section .text.TextReadBlock,"ax" .globl TextReadBlock TextReadBlock: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -16221,16 +17011,17 @@ TextReadBlock: ; TextWriteBlock(Pointer, Word, Word) -> void ; tool 0x1E0C, set 0x0C (TextTools) + .section .text.TextWriteBlock,"ax" .globl TextWriteBlock TextWriteBlock: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Word, 2B) --- lda 8, s pha @@ -16243,54 +17034,58 @@ TextWriteBlock: ; WriteCString(Pointer) -> void ; tool 0x200C, set 0x0C (TextTools) + .section .text.WriteCString,"ax" .globl WriteCString WriteCString: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x200C jsl 0xe10000 rtl ; WriteLine(Pointer) -> void ; tool 0x1A0C, set 0x0C (TextTools) + .section .text.WriteLine,"ax" .globl WriteLine WriteLine: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1A0C jsl 0xe10000 rtl ; WriteString(Pointer) -> void ; tool 0x1C0C, set 0x0C (TextTools) + .section .text.WriteString,"ax" .globl WriteString WriteString: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1C0C jsl 0xe10000 rtl ; VDGGControl(Word, Word) -> void ; tool 0x1D21, set 0x21 (Teletext) + .section .text.VDGGControl,"ax" .globl VDGGControl VDGGControl: ; --- stash arg0 (in A) --- @@ -16307,6 +17102,7 @@ VDGGControl: ; VDInControl(Word, Word) -> void ; tool 0x1C21, set 0x21 (Teletext) + .section .text.VDInControl,"ax" .globl VDInControl VDInControl: ; --- stash arg0 (in A) --- @@ -16323,6 +17119,7 @@ VDInControl: ; VDInConvAdj(Word, Word) -> void ; tool 0x0C21, set 0x21 (Teletext) + .section .text.VDInConvAdj,"ax" .globl VDInConvAdj VDInConvAdj: ; --- stash arg0 (in A) --- @@ -16339,6 +17136,7 @@ VDInConvAdj: ; VDKeyControl(Word, Word) -> void ; tool 0x0D21, set 0x21 (Teletext) + .section .text.VDKeyControl,"ax" .globl VDKeyControl VDKeyControl: ; --- stash arg0 (in A) --- @@ -16355,6 +17153,7 @@ VDKeyControl: ; VDKeySetKCol(Word, Word, Word) -> void ; tool 0x0F21, set 0x21 (Teletext) + .section .text.VDKeySetKCol,"ax" .globl VDKeySetKCol VDKeySetKCol: ; --- stash arg0 (in A) --- @@ -16374,6 +17173,7 @@ VDKeySetKCol: ; VDOutControl(Word, Word) -> void ; tool 0x1921, set 0x21 (Teletext) + .section .text.VDOutControl,"ax" .globl VDOutControl VDOutControl: ; --- stash arg0 (in A) --- @@ -16390,38 +17190,41 @@ VDOutControl: ; BeginUpdate(GrafPortPtr) -> void ; tool 0x1E0E, set 0x0E (WindowManager) + .section .text.BeginUpdate,"ax" .globl BeginUpdate BeginUpdate: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1E0E jsl 0xe10000 rtl ; BringToFront(GrafPortPtr) -> void ; tool 0x240E, set 0x0E (WindowManager) + .section .text.BringToFront,"ax" .globl BringToFront BringToFront: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x240E jsl 0xe10000 rtl ; CheckUpdate(EventRecordPtr) -> Boolean ; tool 0x0A0E, set 0x0E (WindowManager) + .section .text.CheckUpdate,"ax" .globl CheckUpdate CheckUpdate: ; --- stash arg0 (in A/X) --- @@ -16430,10 +17233,10 @@ CheckUpdate: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0A0E jsl 0xe10000 pla ; result -> A @@ -16441,22 +17244,24 @@ CheckUpdate: ; CloseWindow(GrafPortPtr) -> void ; tool 0x0B0E, set 0x0E (WindowManager) + .section .text.CloseWindow,"ax" .globl CloseWindow CloseWindow: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0B0E jsl 0xe10000 rtl ; Desktop(Word, LongWord) -> Pointer ; tool 0x0C0E, set 0x0E (WindowManager) + .section .text.Desktop,"ax" .globl Desktop Desktop: ; --- stash arg0 (in A) --- @@ -16468,7 +17273,7 @@ Desktop: lda 0xE0 pha ; --- arg1 (LongWord, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -16480,6 +17285,7 @@ Desktop: ; DragWindow(Word, Integer, Integer, Word, Rect, GrafPortPtr) -> void ; tool 0x1A0E, set 0x0E (WindowManager) + .section .text.DragWindow,"ax" .globl DragWindow DragWindow: ; --- stash arg0 (in A) --- @@ -16497,12 +17303,12 @@ DragWindow: lda 14, s pha ; --- arg4 (Rect, 4B) --- - lda 18, s + lda 20, s pha lda 20, s pha ; --- arg5 (GrafPortPtr, 4B) --- - lda 26, s + lda 28, s pha lda 28, s pha @@ -16512,22 +17318,24 @@ DragWindow: ; EndUpdate(GrafPortPtr) -> void ; tool 0x1F0E, set 0x0E (WindowManager) + .section .text.EndUpdate,"ax" .globl EndUpdate EndUpdate: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x1F0E jsl 0xe10000 rtl ; FindWindow(GrafPortPtr, Integer, Integer) -> Word ; tool 0x170E, set 0x0E (WindowManager) + .section .text.FindWindow,"ax" .globl FindWindow FindWindow: ; --- stash arg0 (in A/X) --- @@ -16536,10 +17344,10 @@ FindWindow: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Integer, 2B) --- lda 10, s pha @@ -16553,6 +17361,7 @@ FindWindow: ; FrontWindow(void) -> WindowPtr ; tool 0x150E, set 0x0E (WindowManager) + .section .text.FrontWindow,"ax" .globl FrontWindow FrontWindow: ; --- result space (4 bytes) --- @@ -16566,6 +17375,7 @@ FrontWindow: ; GetContentDraw(GrafPortPtr) -> VoidProcPtr ; tool 0x480E, set 0x0E (WindowManager) + .section .text.GetContentDraw,"ax" .globl GetContentDraw GetContentDraw: ; --- stash arg0 (in A/X) --- @@ -16575,10 +17385,10 @@ GetContentDraw: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x480E jsl 0xe10000 pla ; result lo -> A @@ -16587,6 +17397,7 @@ GetContentDraw: ; GetContentOrigin(GrafPortPtr) -> Long ; tool 0x3E0E, set 0x0E (WindowManager) + .section .text.GetContentOrigin,"ax" .globl GetContentOrigin GetContentOrigin: ; --- stash arg0 (in A/X) --- @@ -16596,10 +17407,10 @@ GetContentOrigin: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x3E0E jsl 0xe10000 pla ; result lo -> A @@ -16608,6 +17419,7 @@ GetContentOrigin: ; GetContentRgn(GrafPortPtr) -> RegionHndl ; tool 0x2F0E, set 0x0E (WindowManager) + .section .text.GetContentRgn,"ax" .globl GetContentRgn GetContentRgn: ; --- stash arg0 (in A/X) --- @@ -16617,10 +17429,10 @@ GetContentRgn: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2F0E jsl 0xe10000 pla ; result lo -> A @@ -16629,6 +17441,7 @@ GetContentRgn: ; GetDataSize(GrafPortPtr) -> LongWord ; tool 0x400E, set 0x0E (WindowManager) + .section .text.GetDataSize,"ax" .globl GetDataSize GetDataSize: ; --- stash arg0 (in A/X) --- @@ -16638,10 +17451,10 @@ GetDataSize: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x400E jsl 0xe10000 pla ; result lo -> A @@ -16650,6 +17463,7 @@ GetDataSize: ; GetDefProc(GrafPortPtr) -> LongProcPtr ; tool 0x310E, set 0x0E (WindowManager) + .section .text.GetDefProc,"ax" .globl GetDefProc GetDefProc: ; --- stash arg0 (in A/X) --- @@ -16659,10 +17473,10 @@ GetDefProc: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x310E jsl 0xe10000 pla ; result lo -> A @@ -16671,6 +17485,7 @@ GetDefProc: ; GetFirstWindow(void) -> WindowPtr ; tool 0x520E, set 0x0E (WindowManager) + .section .text.GetFirstWindow,"ax" .globl GetFirstWindow GetFirstWindow: ; --- result space (4 bytes) --- @@ -16684,18 +17499,19 @@ GetFirstWindow: ; GetFrameColor(WindColorPtr, GrafPortPtr) -> void ; tool 0x100E, set 0x0E (WindowManager) + .section .text.GetFrameColor,"ax" .globl GetFrameColor GetFrameColor: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -16705,6 +17521,7 @@ GetFrameColor: ; GetInfoDraw(GrafPortPtr) -> VoidProcPtr ; tool 0x4A0E, set 0x0E (WindowManager) + .section .text.GetInfoDraw,"ax" .globl GetInfoDraw GetInfoDraw: ; --- stash arg0 (in A/X) --- @@ -16714,10 +17531,10 @@ GetInfoDraw: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x4A0E jsl 0xe10000 pla ; result lo -> A @@ -16726,6 +17543,7 @@ GetInfoDraw: ; GetInfoRefCon(GrafPortPtr) -> LongWord ; tool 0x350E, set 0x0E (WindowManager) + .section .text.GetInfoRefCon,"ax" .globl GetInfoRefCon GetInfoRefCon: ; --- stash arg0 (in A/X) --- @@ -16735,10 +17553,10 @@ GetInfoRefCon: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x350E jsl 0xe10000 pla ; result lo -> A @@ -16747,6 +17565,7 @@ GetInfoRefCon: ; GetMaxGrow(GrafPortPtr) -> LongWord ; tool 0x420E, set 0x0E (WindowManager) + .section .text.GetMaxGrow,"ax" .globl GetMaxGrow GetMaxGrow: ; --- stash arg0 (in A/X) --- @@ -16756,10 +17575,10 @@ GetMaxGrow: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x420E jsl 0xe10000 pla ; result lo -> A @@ -16768,6 +17587,7 @@ GetMaxGrow: ; GetNextWindow(GrafPortPtr) -> WindowPtr ; tool 0x2A0E, set 0x0E (WindowManager) + .section .text.GetNextWindow,"ax" .globl GetNextWindow GetNextWindow: ; --- stash arg0 (in A/X) --- @@ -16777,10 +17597,10 @@ GetNextWindow: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2A0E jsl 0xe10000 pla ; result lo -> A @@ -16789,6 +17609,7 @@ GetNextWindow: ; GetPage(GrafPortPtr) -> LongWord ; tool 0x460E, set 0x0E (WindowManager) + .section .text.GetPage,"ax" .globl GetPage GetPage: ; --- stash arg0 (in A/X) --- @@ -16798,10 +17619,10 @@ GetPage: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x460E jsl 0xe10000 pla ; result lo -> A @@ -16810,18 +17631,19 @@ GetPage: ; GetRectInfo(Rect, GrafPortPtr) -> void ; tool 0x4F0E, set 0x0E (WindowManager) + .section .text.GetRectInfo,"ax" .globl GetRectInfo GetRectInfo: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -16831,6 +17653,7 @@ GetRectInfo: ; GetScroll(GrafPortPtr) -> LongWord ; tool 0x440E, set 0x0E (WindowManager) + .section .text.GetScroll,"ax" .globl GetScroll GetScroll: ; --- stash arg0 (in A/X) --- @@ -16840,10 +17663,10 @@ GetScroll: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x440E jsl 0xe10000 pla ; result lo -> A @@ -16852,6 +17675,7 @@ GetScroll: ; GetStructRgn(GrafPortPtr) -> RegionHndl ; tool 0x2E0E, set 0x0E (WindowManager) + .section .text.GetStructRgn,"ax" .globl GetStructRgn GetStructRgn: ; --- stash arg0 (in A/X) --- @@ -16861,10 +17685,10 @@ GetStructRgn: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2E0E jsl 0xe10000 pla ; result lo -> A @@ -16873,6 +17697,7 @@ GetStructRgn: ; GetSysWFlag(GrafPortPtr) -> Boolean ; tool 0x4C0E, set 0x0E (WindowManager) + .section .text.GetSysWFlag,"ax" .globl GetSysWFlag GetSysWFlag: ; --- stash arg0 (in A/X) --- @@ -16881,10 +17706,10 @@ GetSysWFlag: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x4C0E jsl 0xe10000 pla ; result -> A @@ -16892,6 +17717,7 @@ GetSysWFlag: ; GetUpdateRgn(GrafPortPtr) -> RegionHndl ; tool 0x300E, set 0x0E (WindowManager) + .section .text.GetUpdateRgn,"ax" .globl GetUpdateRgn GetUpdateRgn: ; --- stash arg0 (in A/X) --- @@ -16901,10 +17727,10 @@ GetUpdateRgn: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x300E jsl 0xe10000 pla ; result lo -> A @@ -16913,6 +17739,7 @@ GetUpdateRgn: ; GetWControls(GrafPortPtr) -> CtlRecHndl ; tool 0x330E, set 0x0E (WindowManager) + .section .text.GetWControls,"ax" .globl GetWControls GetWControls: ; --- stash arg0 (in A/X) --- @@ -16922,10 +17749,10 @@ GetWControls: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x330E jsl 0xe10000 pla ; result lo -> A @@ -16934,6 +17761,7 @@ GetWControls: ; GetWFrame(GrafPortPtr) -> Word ; tool 0x2C0E, set 0x0E (WindowManager) + .section .text.GetWFrame,"ax" .globl GetWFrame GetWFrame: ; --- stash arg0 (in A/X) --- @@ -16942,10 +17770,10 @@ GetWFrame: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2C0E jsl 0xe10000 pla ; result -> A @@ -16953,6 +17781,7 @@ GetWFrame: ; GetWKind(GrafPortPtr) -> Word ; tool 0x2B0E, set 0x0E (WindowManager) + .section .text.GetWKind,"ax" .globl GetWKind GetWKind: ; --- stash arg0 (in A/X) --- @@ -16961,10 +17790,10 @@ GetWKind: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x2B0E jsl 0xe10000 pla ; result -> A @@ -16972,6 +17801,7 @@ GetWKind: ; GetWMgrPort(void) -> WindowPtr ; tool 0x200E, set 0x0E (WindowManager) + .section .text.GetWMgrPort,"ax" .globl GetWMgrPort GetWMgrPort: ; --- result space (4 bytes) --- @@ -16985,6 +17815,7 @@ GetWMgrPort: ; GetWRefCon(GrafPortPtr) -> LongWord ; tool 0x290E, set 0x0E (WindowManager) + .section .text.GetWRefCon,"ax" .globl GetWRefCon GetWRefCon: ; --- stash arg0 (in A/X) --- @@ -16994,10 +17825,10 @@ GetWRefCon: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x290E jsl 0xe10000 pla ; result lo -> A @@ -17006,6 +17837,7 @@ GetWRefCon: ; GetWTitle(GrafPortPtr) -> Pointer ; tool 0x0E0E, set 0x0E (WindowManager) + .section .text.GetWTitle,"ax" .globl GetWTitle GetWTitle: ; --- stash arg0 (in A/X) --- @@ -17015,10 +17847,10 @@ GetWTitle: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x0E0E jsl 0xe10000 pla ; result lo -> A @@ -17027,6 +17859,7 @@ GetWTitle: ; GrowWindow(Word, Word, Integer, Integer, GrafPortPtr) -> LongWord ; tool 0x1B0E, set 0x0E (WindowManager) + .section .text.GrowWindow,"ax" .globl GrowWindow GrowWindow: ; --- stash arg0 (in A) --- @@ -17047,7 +17880,7 @@ GrowWindow: lda 18, s pha ; --- arg4 (GrafPortPtr, 4B) --- - lda 22, s + lda 24, s pha lda 24, s pha @@ -17059,22 +17892,24 @@ GrowWindow: ; HideWindow(GrafPortPtr) -> void ; tool 0x120E, set 0x0E (WindowManager) + .section .text.HideWindow,"ax" .globl HideWindow HideWindow: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x120E jsl 0xe10000 rtl ; HiliteWindow(Boolean, GrafPortPtr) -> void ; tool 0x220E, set 0x0E (WindowManager) + .section .text.HiliteWindow,"ax" .globl HiliteWindow HiliteWindow: ; --- stash arg0 (in A) --- @@ -17083,7 +17918,7 @@ HiliteWindow: lda 0xE0 pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -17093,38 +17928,41 @@ HiliteWindow: ; InvalRect(Rect) -> void ; tool 0x3A0E, set 0x0E (WindowManager) + .section .text.InvalRect,"ax" .globl InvalRect InvalRect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x3A0E jsl 0xe10000 rtl ; InvalRgn(Handle) -> void ; tool 0x3B0E, set 0x0E (WindowManager) + .section .text.InvalRgn,"ax" .globl InvalRgn InvalRgn: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x3B0E jsl 0xe10000 rtl ; MoveWindow(Integer, Integer, GrafPortPtr) -> void ; tool 0x190E, set 0x0E (WindowManager) + .section .text.MoveWindow,"ax" .globl MoveWindow MoveWindow: ; --- stash arg0 (in A) --- @@ -17136,7 +17974,7 @@ MoveWindow: lda 6, s pha ; --- arg2 (GrafPortPtr, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -17146,6 +17984,7 @@ MoveWindow: ; NewWindow(ParamListPtr) -> WindowPtr ; tool 0x090E, set 0x0E (WindowManager) + .section .text.NewWindow,"ax" .globl NewWindow NewWindow: ; --- stash arg0 (in A/X) --- @@ -17155,10 +17994,10 @@ NewWindow: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x090E jsl 0xe10000 pla ; result lo -> A @@ -17167,6 +18006,7 @@ NewWindow: ; PinRect(Integer, Integer, Rect) -> Point ; tool 0x210E, set 0x0E (WindowManager) + .section .text.PinRect,"ax" .globl PinRect PinRect: ; --- stash arg0 (in A) --- @@ -17181,7 +18021,7 @@ PinRect: lda 10, s pha ; --- arg2 (Rect, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -17193,50 +18033,53 @@ PinRect: ; RefreshDesktop(Rect) -> void ; tool 0x390E, set 0x0E (WindowManager) + .section .text.RefreshDesktop,"ax" .globl RefreshDesktop RefreshDesktop: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x390E jsl 0xe10000 rtl ; SelectWindow(GrafPortPtr) -> void ; tool 0x110E, set 0x0E (WindowManager) + .section .text.SelectWindow,"ax" .globl SelectWindow SelectWindow: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x110E jsl 0xe10000 rtl ; SendBehind(GrafPortPtr, GrafPortPtr) -> void ; tool 0x140E, set 0x0E (WindowManager) + .section .text.SendBehind,"ax" .globl SendBehind SendBehind: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -17246,18 +18089,19 @@ SendBehind: ; SetContentDraw(VoidProcPtr, GrafPortPtr) -> void ; tool 0x490E, set 0x0E (WindowManager) + .section .text.SetContentDraw,"ax" .globl SetContentDraw SetContentDraw: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -17267,6 +18111,7 @@ SetContentDraw: ; SetContentOrigin(Word, Word, GrafPortPtr) -> void ; tool 0x3F0E, set 0x0E (WindowManager) + .section .text.SetContentOrigin,"ax" .globl SetContentOrigin SetContentOrigin: ; --- stash arg0 (in A) --- @@ -17278,7 +18123,7 @@ SetContentOrigin: lda 6, s pha ; --- arg2 (GrafPortPtr, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -17288,6 +18133,7 @@ SetContentOrigin: ; SetContentOrigin2(Word, Word, Word, GrafPortPtr) -> void ; tool 0x570E, set 0x0E (WindowManager) + .section .text.SetContentOrigin2,"ax" .globl SetContentOrigin2 SetContentOrigin2: ; --- stash arg0 (in A) --- @@ -17302,7 +18148,7 @@ SetContentOrigin2: lda 10, s pha ; --- arg3 (GrafPortPtr, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -17312,6 +18158,7 @@ SetContentOrigin2: ; SetDataSize(Word, Word, GrafPortPtr) -> void ; tool 0x410E, set 0x0E (WindowManager) + .section .text.SetDataSize,"ax" .globl SetDataSize SetDataSize: ; --- stash arg0 (in A) --- @@ -17323,7 +18170,7 @@ SetDataSize: lda 6, s pha ; --- arg2 (GrafPortPtr, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -17333,18 +18180,19 @@ SetDataSize: ; SetDefProc(LongProcPtr, GrafPortPtr) -> void ; tool 0x320E, set 0x0E (WindowManager) + .section .text.SetDefProc,"ax" .globl SetDefProc SetDefProc: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -17354,18 +18202,19 @@ SetDefProc: ; SetFrameColor(WindColorPtr, GrafPortPtr) -> void ; tool 0x0F0E, set 0x0E (WindowManager) + .section .text.SetFrameColor,"ax" .globl SetFrameColor SetFrameColor: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -17375,18 +18224,19 @@ SetFrameColor: ; SetInfoDraw(VoidProcPtr, GrafPortPtr) -> void ; tool 0x160E, set 0x0E (WindowManager) + .section .text.SetInfoDraw,"ax" .globl SetInfoDraw SetInfoDraw: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -17396,18 +18246,19 @@ SetInfoDraw: ; SetInfoRefCon(LongWord, GrafPortPtr) -> void ; tool 0x360E, set 0x0E (WindowManager) + .section .text.SetInfoRefCon,"ax" .globl SetInfoRefCon SetInfoRefCon: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -17417,6 +18268,7 @@ SetInfoRefCon: ; SetMaxGrow(Word, Word, GrafPortPtr) -> void ; tool 0x430E, set 0x0E (WindowManager) + .section .text.SetMaxGrow,"ax" .globl SetMaxGrow SetMaxGrow: ; --- stash arg0 (in A) --- @@ -17428,7 +18280,7 @@ SetMaxGrow: lda 6, s pha ; --- arg2 (GrafPortPtr, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -17438,6 +18290,7 @@ SetMaxGrow: ; SetOriginMask(Word, GrafPortPtr) -> void ; tool 0x340E, set 0x0E (WindowManager) + .section .text.SetOriginMask,"ax" .globl SetOriginMask SetOriginMask: ; --- stash arg0 (in A) --- @@ -17446,7 +18299,7 @@ SetOriginMask: lda 0xE0 pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -17456,6 +18309,7 @@ SetOriginMask: ; SetPage(Word, Word, GrafPortPtr) -> void ; tool 0x470E, set 0x0E (WindowManager) + .section .text.SetPage,"ax" .globl SetPage SetPage: ; --- stash arg0 (in A) --- @@ -17467,7 +18321,7 @@ SetPage: lda 6, s pha ; --- arg2 (GrafPortPtr, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -17477,6 +18331,7 @@ SetPage: ; SetScroll(Word, Word, GrafPortPtr) -> void ; tool 0x450E, set 0x0E (WindowManager) + .section .text.SetScroll,"ax" .globl SetScroll SetScroll: ; --- stash arg0 (in A) --- @@ -17488,7 +18343,7 @@ SetScroll: lda 6, s pha ; --- arg2 (GrafPortPtr, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -17498,22 +18353,24 @@ SetScroll: ; SetSysWindow(GrafPortPtr) -> void ; tool 0x4B0E, set 0x0E (WindowManager) + .section .text.SetSysWindow,"ax" .globl SetSysWindow SetSysWindow: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x4B0E jsl 0xe10000 rtl ; SetWFrame(Word, GrafPortPtr) -> void ; tool 0x2D0E, set 0x0E (WindowManager) + .section .text.SetWFrame,"ax" .globl SetWFrame SetWFrame: ; --- stash arg0 (in A) --- @@ -17522,7 +18379,7 @@ SetWFrame: lda 0xE0 pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -17532,6 +18389,7 @@ SetWFrame: ; SetWindowIcons(FontHndl) -> FontHndl ; tool 0x4E0E, set 0x0E (WindowManager) + .section .text.SetWindowIcons,"ax" .globl SetWindowIcons SetWindowIcons: ; --- stash arg0 (in A/X) --- @@ -17541,10 +18399,10 @@ SetWindowIcons: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x4E0E jsl 0xe10000 pla ; result lo -> A @@ -17553,18 +18411,19 @@ SetWindowIcons: ; SetWRefCon(Longint, GrafPortPtr) -> void ; tool 0x280E, set 0x0E (WindowManager) + .section .text.SetWRefCon,"ax" .globl SetWRefCon SetWRefCon: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -17574,18 +18433,19 @@ SetWRefCon: ; SetWTitle(Pointer, GrafPortPtr) -> void ; tool 0x0D0E, set 0x0E (WindowManager) + .section .text.SetWTitle,"ax" .globl SetWTitle SetWTitle: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -17595,18 +18455,19 @@ SetWTitle: ; SetZoomRect(Rect, GrafPortPtr) -> void ; tool 0x380E, set 0x0E (WindowManager) + .section .text.SetZoomRect,"ax" .globl SetZoomRect SetZoomRect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -17616,6 +18477,7 @@ SetZoomRect: ; ShowHide(Boolean, GrafPortPtr) -> void ; tool 0x230E, set 0x0E (WindowManager) + .section .text.ShowHide,"ax" .globl ShowHide ShowHide: ; --- stash arg0 (in A) --- @@ -17624,7 +18486,7 @@ ShowHide: lda 0xE0 pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha @@ -17634,22 +18496,24 @@ ShowHide: ; ShowWindow(GrafPortPtr) -> void ; tool 0x130E, set 0x0E (WindowManager) + .section .text.ShowWindow,"ax" .globl ShowWindow ShowWindow: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x130E jsl 0xe10000 rtl ; SizeWindow(Word, Word, GrafPortPtr) -> void ; tool 0x1C0E, set 0x0E (WindowManager) + .section .text.SizeWindow,"ax" .globl SizeWindow SizeWindow: ; --- stash arg0 (in A) --- @@ -17661,7 +18525,7 @@ SizeWindow: lda 6, s pha ; --- arg2 (GrafPortPtr, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -17671,34 +18535,36 @@ SizeWindow: ; StartDrawing(GrafPortPtr) -> void ; tool 0x4D0E, set 0x0E (WindowManager) + .section .text.StartDrawing,"ax" .globl StartDrawing StartDrawing: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x4D0E jsl 0xe10000 rtl ; StartInfoDrawing(Rect, GrafPortPtr) -> void ; tool 0x500E, set 0x0E (WindowManager) + .section .text.StartInfoDrawing,"ax" .globl StartInfoDrawing StartInfoDrawing: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -17708,6 +18574,7 @@ StartInfoDrawing: ; TaskMaster(Word, WmTaskRecPtr) -> Word ; tool 0x1D0E, set 0x0E (WindowManager) + .section .text.TaskMaster,"ax" .globl TaskMaster TaskMaster: ; --- stash arg0 (in A) --- @@ -17718,7 +18585,7 @@ TaskMaster: lda 0xE0 pha ; --- arg1 (WmTaskRecPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -17729,6 +18596,7 @@ TaskMaster: ; TrackGoAway(Integer, Integer, GrafPortPtr) -> Boolean ; tool 0x180E, set 0x0E (WindowManager) + .section .text.TrackGoAway,"ax" .globl TrackGoAway TrackGoAway: ; --- stash arg0 (in A) --- @@ -17742,7 +18610,7 @@ TrackGoAway: lda 8, s pha ; --- arg2 (GrafPortPtr, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -17753,6 +18621,7 @@ TrackGoAway: ; TrackZoom(Integer, Integer, GrafPortPtr) -> Boolean ; tool 0x260E, set 0x0E (WindowManager) + .section .text.TrackZoom,"ax" .globl TrackZoom TrackZoom: ; --- stash arg0 (in A) --- @@ -17766,7 +18635,7 @@ TrackZoom: lda 8, s pha ; --- arg2 (GrafPortPtr, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -17777,38 +18646,41 @@ TrackZoom: ; ValidRect(Rect) -> void ; tool 0x3C0E, set 0x0E (WindowManager) + .section .text.ValidRect,"ax" .globl ValidRect ValidRect: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x3C0E jsl 0xe10000 rtl ; ValidRgn(Handle) -> void ; tool 0x3D0E, set 0x0E (WindowManager) + .section .text.ValidRgn,"ax" .globl ValidRgn ValidRgn: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x3D0E jsl 0xe10000 rtl ; WindDragRect(VoidProcPtr, Pattern, Integer, Integer, Rect, Rect, Rect, Word) -> LongWord ; tool 0x530E, set 0x0E (WindowManager) + .section .text.WindDragRect,"ax" .globl WindDragRect WindDragRect: ; --- stash arg0 (in A/X) --- @@ -17818,12 +18690,12 @@ WindDragRect: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Pattern, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha @@ -17834,17 +18706,17 @@ WindDragRect: lda 24, s pha ; --- arg4 (Rect, 4B) --- - lda 28, s + lda 30, s pha lda 30, s pha ; --- arg5 (Rect, 4B) --- - lda 36, s + lda 38, s pha lda 38, s pha ; --- arg6 (Rect, 4B) --- - lda 44, s + lda 46, s pha lda 46, s pha @@ -17859,22 +18731,24 @@ WindDragRect: ; ZoomWindow(GrafPortPtr) -> void ; tool 0x270E, set 0x0E (WindowManager) + .section .text.ZoomWindow,"ax" .globl ZoomWindow ZoomWindow: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x270E jsl 0xe10000 rtl ; AlertWindow(Word, Pointer, Ref) -> Word ; tool 0x590E, set 0x0E (WindowManager) + .section .text.AlertWindow,"ax" .globl AlertWindow AlertWindow: ; --- stash arg0 (in A) --- @@ -17885,12 +18759,12 @@ AlertWindow: lda 0xE0 pha ; --- arg1 (Pointer, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha ; --- arg2 (Ref, 4B) --- - lda 16, s + lda 18, s pha lda 18, s pha @@ -17901,6 +18775,7 @@ AlertWindow: ; CompileText(Word, Pointer, Pointer, Word) -> Handle ; tool 0x600E, set 0x0E (WindowManager) + .section .text.CompileText,"ax" .globl CompileText CompileText: ; --- stash arg0 (in A) --- @@ -17912,12 +18787,12 @@ CompileText: lda 0xE0 pha ; --- arg1 (Pointer, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha ; --- arg2 (Pointer, 4B) --- - lda 18, s + lda 20, s pha lda 20, s pha @@ -17932,22 +18807,24 @@ CompileText: ; DrawInfoBar(GrafPortPtr) -> void ; tool 0x550E, set 0x0E (WindowManager) + .section .text.DrawInfoBar,"ax" .globl DrawInfoBar DrawInfoBar: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x550E jsl 0xe10000 rtl ; ErrorWindow(Word, Pointer, Word) -> Word ; tool 0x620E, set 0x0E (WindowManager) + .section .text.ErrorWindow,"ax" .globl ErrorWindow ErrorWindow: ; --- stash arg0 (in A) --- @@ -17958,7 +18835,7 @@ ErrorWindow: lda 0xE0 pha ; --- arg1 (Pointer, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -17972,6 +18849,7 @@ ErrorWindow: ; GetWindowMgrGlobals(void) -> Ptr ; tool 0x580E, set 0x0E (WindowManager) + .section .text.GetWindowMgrGlobals,"ax" .globl GetWindowMgrGlobals GetWindowMgrGlobals: ; --- result space (4 bytes) --- @@ -17985,6 +18863,7 @@ GetWindowMgrGlobals: ; NewWindow2(Pointer, Long, VoidProcPtr, LongProcPtr, Word, Ref, Word) -> WindowPtr ; tool 0x610E, set 0x0E (WindowManager) + .section .text.NewWindow2,"ax" .globl NewWindow2 NewWindow2: ; --- stash arg0 (in A/X) --- @@ -17994,22 +18873,22 @@ NewWindow2: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Long, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha ; --- arg2 (VoidProcPtr, 4B) --- - lda 20, s + lda 22, s pha lda 22, s pha ; --- arg3 (LongProcPtr, 4B) --- - lda 28, s + lda 30, s pha lda 30, s pha @@ -18017,7 +18896,7 @@ NewWindow2: lda 36, s pha ; --- arg5 (Ref, 4B) --- - lda 40, s + lda 42, s pha lda 42, s pha @@ -18032,6 +18911,7 @@ NewWindow2: ; ResizeWindow(Boolean, Rect, GrafPortPtr) -> void ; tool 0x5C0E, set 0x0E (WindowManager) + .section .text.ResizeWindow,"ax" .globl ResizeWindow ResizeWindow: ; --- stash arg0 (in A) --- @@ -18040,12 +18920,12 @@ ResizeWindow: lda 0xE0 pha ; --- arg1 (Rect, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha ; --- arg2 (GrafPortPtr, 4B) --- - lda 14, s + lda 16, s pha lda 16, s pha @@ -18055,22 +18935,24 @@ ResizeWindow: ; StartFrameDrawing(GrafPortPtr) -> void ; tool 0x5A0E, set 0x0E (WindowManager) + .section .text.StartFrameDrawing,"ax" .globl StartFrameDrawing StartFrameDrawing: ; --- stash arg0 (in A/X) --- sta 0xE0 stx 0xE2 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x5A0E jsl 0xe10000 rtl ; TaskMasterDA(Word, WmTaskRecPtr) -> Word ; tool 0x5F0E, set 0x0E (WindowManager) + .section .text.TaskMasterDA,"ax" .globl TaskMasterDA TaskMasterDA: ; --- stash arg0 (in A) --- @@ -18081,7 +18963,7 @@ TaskMasterDA: lda 0xE0 pha ; --- arg1 (WmTaskRecPtr, 4B) --- - lda 8, s + lda 10, s pha lda 10, s pha @@ -18092,6 +18974,7 @@ TaskMasterDA: ; DoModalWindow(EventRecordPtr, VoidProcPtr, VoidProcPtr, VoidProcPtr, Word) -> LongWord ; tool 0x640E, set 0x0E (WindowManager) + .section .text.DoModalWindow,"ax" .globl DoModalWindow DoModalWindow: ; --- stash arg0 (in A/X) --- @@ -18101,22 +18984,22 @@ DoModalWindow: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (VoidProcPtr, 4B) --- - lda 12, s + lda 14, s pha lda 14, s pha ; --- arg2 (VoidProcPtr, 4B) --- - lda 20, s + lda 22, s pha lda 22, s pha ; --- arg3 (VoidProcPtr, 4B) --- - lda 28, s + lda 30, s pha lda 30, s pha @@ -18131,6 +19014,7 @@ DoModalWindow: ; FindCursorCtl(CtlRecHndlPtr, Integer, Integer, GrafPortPtr) -> Word ; tool 0x690E, set 0x0E (WindowManager) + .section .text.FindCursorCtl,"ax" .globl FindCursorCtl FindCursorCtl: ; --- stash arg0 (in A/X) --- @@ -18139,10 +19023,10 @@ FindCursorCtl: ; --- result space (2 bytes) --- pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ; --- arg1 (Integer, 2B) --- lda 10, s pha @@ -18150,7 +19034,7 @@ FindCursorCtl: lda 14, s pha ; --- arg3 (GrafPortPtr, 4B) --- - lda 18, s + lda 20, s pha lda 20, s pha @@ -18161,6 +19045,7 @@ FindCursorCtl: ; GetAuxWindInfo(GrafPortPtr) -> AuxWindInfoPtr ; tool 0x630E, set 0x0E (WindowManager) + .section .text.GetAuxWindInfo,"ax" .globl GetAuxWindInfo GetAuxWindInfo: ; --- stash arg0 (in A/X) --- @@ -18170,10 +19055,10 @@ GetAuxWindInfo: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x630E jsl 0xe10000 pla ; result lo -> A @@ -18182,6 +19067,7 @@ GetAuxWindInfo: ; HandleDiskInsert(Word, Word) -> LongWord ; tool 0x6B0E, set 0x0E (WindowManager) + .section .text.HandleDiskInsert,"ax" .globl HandleDiskInsert HandleDiskInsert: ; --- stash arg0 (in A) --- @@ -18203,6 +19089,7 @@ HandleDiskInsert: ; MWSetMenuProc(VoidProcPtr) -> VoidProcPtr ; tool 0x660E, set 0x0E (WindowManager) + .section .text.MWSetMenuProc,"ax" .globl MWSetMenuProc MWSetMenuProc: ; --- stash arg0 (in A/X) --- @@ -18212,10 +19099,10 @@ MWSetMenuProc: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x660E jsl 0xe10000 pla ; result lo -> A @@ -18224,6 +19111,7 @@ MWSetMenuProc: ; SetMenuProc(VoidProcPtr) -> VoidProcPtr ; tool 0x660E, set 0x0E (WindowManager) + .section .text.SetMenuProc,"ax" .globl SetMenuProc SetMenuProc: ; --- stash arg0 (in A/X) --- @@ -18233,10 +19121,10 @@ SetMenuProc: pea 0 pea 0 ; --- arg0 --- - lda 0xE0 - pha lda 0xE2 pha + lda 0xE0 + pha ldx #0x660E jsl 0xe10000 pla ; result lo -> A @@ -18245,6 +19133,7 @@ SetMenuProc: ; ResizeInfoBar(Word, Word, GrafPortPtr) -> void ; tool 0x6A0E, set 0x0E (WindowManager) + .section .text.ResizeInfoBar,"ax" .globl ResizeInfoBar ResizeInfoBar: ; --- stash arg0 (in A) --- @@ -18256,7 +19145,7 @@ ResizeInfoBar: lda 6, s pha ; --- arg2 (GrafPortPtr, 4B) --- - lda 10, s + lda 12, s pha lda 12, s pha @@ -18266,6 +19155,7 @@ ResizeInfoBar: ; UpdateWindow(Word, GrafPortPtr) -> void ; tool 0x6C0E, set 0x0E (WindowManager) + .section .text.UpdateWindow,"ax" .globl UpdateWindow UpdateWindow: ; --- stash arg0 (in A) --- @@ -18274,7 +19164,7 @@ UpdateWindow: lda 0xE0 pha ; --- arg1 (GrafPortPtr, 4B) --- - lda 6, s + lda 8, s pha lda 8, s pha diff --git a/runtime/src/libc.c b/runtime/src/libc.c index 795d7e6..e2fce58 100644 --- a/runtime/src/libc.c +++ b/runtime/src/libc.c @@ -28,6 +28,7 @@ typedef struct { u16 pCount; u16 refNum; void *pathname; + u16 requestAccess; } __GsosOpenParm; typedef struct { u16 pCount; @@ -229,13 +230,27 @@ int puts(const char *s) { return 0; } -// ---- input stubs ---- +// ---- input ---- // -// getchar reads from the keyboard; real input would route through -// the IIgs Event Manager. Returns -1 (EOF) for now. fgetc/fgets/ -// ungetc are defined further down alongside the FILE-table-backed -// fopen/fread/etc. -int getchar(void) { return -1; /* EOF */ } +// getchar polls the IIgs hardware keyboard register at $C000. Bit 7 +// is the "key ready" strobe; bits 0..6 are the ASCII code. Reading +// $C010 clears the strobe so the next keypress can be detected. This +// blocks until a key is pressed and returns the (7-bit) ASCII value. +// It works in any execution context (raw boot, ProDOS-16, GS/OS app) +// because $C000 is hardware I/O, not toolbox-mediated. +// +// Callers wanting non-blocking input or Event Manager integration +// should call ReadCh/GetNextEvent directly via iigs/toolbox.h. +int getchar(void) { + volatile unsigned char *kbd = (volatile unsigned char *)0xC000; + volatile unsigned char *strb = (volatile unsigned char *)0xC010; + while (((*kbd) & 0x80) == 0) { + // Spin until a key is ready. No yield — single-threaded. + } + int c = (*kbd) & 0x7F; + (void)*strb; // clear strobe + return c; +} // ---- minimal printf ---- @@ -1288,7 +1303,18 @@ FILE *fopen(const char *path, const char *mode) { // → NULL. if (!__gsosAvailable()) return (FILE *)0; if (__buildGSString(path) < 0) return (FILE *)0; - __GsosOpenParm op = { 2, 0, &__gsosPathBuf }; + // pCount=3 covers refNum + pathname + requestAccess. GS/OS 6.0.2 + // Open ($2010) requires requestAccess to be non-zero for any actual + // open; passing only pCount=2 (refNum + pathname) leaves the access + // word indeterminate and the Open silently fails with a "bad access" + // status. requestAccess values: $0001 = read, $0002 = write, + // $0003 = read+write. We pick read or read+write based on the + // mode string. The remaining optional params (resourceNumber, + // accessMode, fileType, auxType, storageType, createDate, modDate, + // optionList) are left out — GS/OS treats their absence as + // "default values". + u16 access = (u16)(wantWrite ? (wantRead ? 3 : 2) : 1); + __GsosOpenParm op = { 3, 0, &__gsosPathBuf, access }; if (gsosOpen(&op) != 0) return (FILE *)0; f->kind = FILE_KIND_GSOS; diff --git a/runtime/src/libgcc.s b/runtime/src/libgcc.s index 8128c08..3bdbe6f 100644 --- a/runtime/src/libgcc.s +++ b/runtime/src/libgcc.s @@ -95,7 +95,41 @@ __mulhi3: ; -------------------------------------------------------------------- .globl __umulhisi3 __umulhisi3: - sta 0xe0 ; multiplier in $e0/$e1 + ; Fast path: if both args fit in 8 bits, use a quarter-square + ; table for 8x8 → 16 (result hi half is always 0). Identity: + ; a*b = T[a+b] - T[|a-b|] where T[k] = floor(k²/4) + ; 511-entry, 2-byte table = 1022 bytes ROM. Fast path is ~55 + ; cyc vs ~150 cyc for the shift-and-add fallback at i ~ 50. + ; Hot in `i*i` patterns where i is a loop counter ≤ 255. + sta 0xe0 ; save arg0 + ora 0x4, s ; OR with arg1 + and #0xff00 ; isolate hi bytes + bne .Lumulhisi_slow ; if either hi byte nonzero, fallback + ; Both args fit in 8 bits — quarter-square path. + lda 0xe0 ; arg0 + clc + adc 0x4, s ; A = a + b + asl a ; A = 2*(a+b) — word index + tax + lda __umulhisi3_qsq, x ; T[a+b] + sta 0xe2 ; stash + lda 0xe0 ; arg0 + sec + sbc 0x4, s ; A = a - b + bpl .Lumulhisi_qsq_pos + ; A negative; negate to get |a-b|. + eor #0xffff + inc a +.Lumulhisi_qsq_pos: + asl a ; A = 2*|a-b| + tax + lda 0xe2 ; T[a+b] + sec + sbc __umulhisi3_qsq, x ; T[a+b] - T[|a-b|] + ldx #0 ; result hi half = 0 + rtl +.Lumulhisi_slow: + ; Multiplier already at $e0 from the fast-path check above. lda 0x4, s sta 0xe2 ; multiplicand lo in $e2/$e3 stz 0xe4 ; multiplicand hi (initially 0) in $e4/$e5 @@ -369,6 +403,29 @@ __mulsi3: ; Clear running product at $e8/$ea. stz 0xe8 stz 0xea + ; Asymmetric-size swap: the loop iterates based on the multiplier's + ; bit width. If a is large (a_hi != 0) but b is small (b_hi == 0), + ; swap so the small one becomes the multiplier — the early-exit + ; check (lda 0xe0; beq done) then fires sooner. Saves a lot for + ; djb2-style `h * 33` patterns where h grows but the constant + ; multiplier is small. Cost: ~12 cyc unconditional check; benefit: + ; ~10 cyc per saved iter × ~10 iters = 100 cyc. + lda 0xe2 + beq .Lmulsi_no_swap ; a_hi == 0, no need to swap (or already covered by u16 path below) + lda 0xe6 + bne .Lmulsi_no_swap ; b_hi != 0, both large, no benefit + ; Swap (a_lo, a_hi) ↔ (b_lo, b_hi). Both are at DP; XOR-swap or + ; load/store; we use load/store with A scratch since the values are + ; 16 bits each. + lda 0xe0 + ldx 0xe4 + stx 0xe0 + sta 0xe4 + lda 0xe2 + ldx 0xe6 + stx 0xe2 + sta 0xe6 +.Lmulsi_no_swap: ; Fast path: if multiplier's high half ($e2) is 0, we only ; need 16 loop iterations AND we can drop the multiplier-hi ; shift step entirely (lsr $e2 + bcc + ora #$8000) — that step @@ -380,6 +437,41 @@ __mulsi3: ; iteration. lda 0xe2 bne .Lmulsi_full + ; Quarter-square fast path: when BOTH args fit in 8 bits (e2==0 + ; already verified, e6==0, e0<256, e4<256), use the same T[k]=k^2/4 + ; table that __umulhisi3 uses to compute a*b = T[a+b] - T[|a-b|] + ; in ~50 cyc vs the u16 loop's ~150-250 cyc for small multipliers. + ; Common when dotProduct etc. sign-extend small i16 values to i32. + lda 0xe6 + bne .Lmulsi_u16_entry + lda 0xe0 + ora 0xe4 + and #0xff00 + bne .Lmulsi_u16_entry + ; T[a+b] -> $e8 (product lo). + lda 0xe0 + clc + adc 0xe4 + asl a + tax + lda __umulhisi3_qsq, x + sta 0xe8 + ; |a-b| as word index. + lda 0xe0 + sec + sbc 0xe4 + bpl .Lmulsi_qsq_pos + eor #0xffff + inc a +.Lmulsi_qsq_pos: + asl a + tax + lda 0xe8 + sec + sbc __umulhisi3_qsq, x + ldx #0 + rtl +.Lmulsi_u16_entry: ldy #0x10 .Lmulsi_u16_loop: ; Shift multiplier right; bit-out tested for add. Bottom of loop @@ -466,14 +558,14 @@ __ashlsi3: sta 0xe0 ; lo stx 0xe2 ; hi lda 0x4, s - tay ; count -> Y + tay ; count -> Y; sets Z if 0 + beq .Lashlsi_done ; count==0: skip loop .Lashlsi_loop: - cpy #0x0 - beq .Lashlsi_done + ; Per-bit: 7+7+2+3 = 19 cyc (was 25 with cpy/beq/bra). asl 0xe0 rol 0xe2 dey - bra .Lashlsi_loop + bne .Lashlsi_loop .Lashlsi_done: ldx 0xe2 lda 0xe0 @@ -489,13 +581,12 @@ __lshrsi3: stx 0xe2 lda 0x4, s tay -.Llshrsi_loop: - cpy #0x0 beq .Llshrsi_done +.Llshrsi_loop: lsr 0xe2 ror 0xe0 dey - bra .Llshrsi_loop + bne .Llshrsi_loop .Llshrsi_done: ldx 0xe2 lda 0xe0 @@ -512,9 +603,8 @@ __ashrsi3: stx 0xe2 lda 0x4, s tay -.Lashrsi_loop: - cpy #0x0 beq .Lashrsi_done +.Lashrsi_loop: ; CMP #$8000 sets C iff the unsigned value >= 0x8000, i.e. bit 15 ; is set — exactly the sign bit. lda 0xe2 @@ -522,7 +612,7 @@ __ashrsi3: ror 0xe2 ror 0xe0 dey - bra .Lashrsi_loop + bne .Lashrsi_loop .Lashrsi_done: ldx 0xe2 lda 0xe0 @@ -1279,3 +1369,75 @@ longjmp: lda #1 .Llj_done: rtl + +; -------------------------------------------------------------------- +; __umulhisi3_qsq: quarter-square lookup table. +; T[k] = floor(k² / 4) for k ∈ [0, 510]. Used by __umulhisi3's fast +; 8x8 path: a*b = T[a+b] - T[|a-b|]. 511 entries × 2 bytes = 1022 B. +; -------------------------------------------------------------------- +__umulhisi3_qsq: + .short 0x0000, 0x0000, 0x0001, 0x0002, 0x0004, 0x0006, 0x0009, 0x000c + .short 0x0010, 0x0014, 0x0019, 0x001e, 0x0024, 0x002a, 0x0031, 0x0038 + .short 0x0040, 0x0048, 0x0051, 0x005a, 0x0064, 0x006e, 0x0079, 0x0084 + .short 0x0090, 0x009c, 0x00a9, 0x00b6, 0x00c4, 0x00d2, 0x00e1, 0x00f0 + .short 0x0100, 0x0110, 0x0121, 0x0132, 0x0144, 0x0156, 0x0169, 0x017c + .short 0x0190, 0x01a4, 0x01b9, 0x01ce, 0x01e4, 0x01fa, 0x0211, 0x0228 + .short 0x0240, 0x0258, 0x0271, 0x028a, 0x02a4, 0x02be, 0x02d9, 0x02f4 + .short 0x0310, 0x032c, 0x0349, 0x0366, 0x0384, 0x03a2, 0x03c1, 0x03e0 + .short 0x0400, 0x0420, 0x0441, 0x0462, 0x0484, 0x04a6, 0x04c9, 0x04ec + .short 0x0510, 0x0534, 0x0559, 0x057e, 0x05a4, 0x05ca, 0x05f1, 0x0618 + .short 0x0640, 0x0668, 0x0691, 0x06ba, 0x06e4, 0x070e, 0x0739, 0x0764 + .short 0x0790, 0x07bc, 0x07e9, 0x0816, 0x0844, 0x0872, 0x08a1, 0x08d0 + .short 0x0900, 0x0930, 0x0961, 0x0992, 0x09c4, 0x09f6, 0x0a29, 0x0a5c + .short 0x0a90, 0x0ac4, 0x0af9, 0x0b2e, 0x0b64, 0x0b9a, 0x0bd1, 0x0c08 + .short 0x0c40, 0x0c78, 0x0cb1, 0x0cea, 0x0d24, 0x0d5e, 0x0d99, 0x0dd4 + .short 0x0e10, 0x0e4c, 0x0e89, 0x0ec6, 0x0f04, 0x0f42, 0x0f81, 0x0fc0 + .short 0x1000, 0x1040, 0x1081, 0x10c2, 0x1104, 0x1146, 0x1189, 0x11cc + .short 0x1210, 0x1254, 0x1299, 0x12de, 0x1324, 0x136a, 0x13b1, 0x13f8 + .short 0x1440, 0x1488, 0x14d1, 0x151a, 0x1564, 0x15ae, 0x15f9, 0x1644 + .short 0x1690, 0x16dc, 0x1729, 0x1776, 0x17c4, 0x1812, 0x1861, 0x18b0 + .short 0x1900, 0x1950, 0x19a1, 0x19f2, 0x1a44, 0x1a96, 0x1ae9, 0x1b3c + .short 0x1b90, 0x1be4, 0x1c39, 0x1c8e, 0x1ce4, 0x1d3a, 0x1d91, 0x1de8 + .short 0x1e40, 0x1e98, 0x1ef1, 0x1f4a, 0x1fa4, 0x1ffe, 0x2059, 0x20b4 + .short 0x2110, 0x216c, 0x21c9, 0x2226, 0x2284, 0x22e2, 0x2341, 0x23a0 + .short 0x2400, 0x2460, 0x24c1, 0x2522, 0x2584, 0x25e6, 0x2649, 0x26ac + .short 0x2710, 0x2774, 0x27d9, 0x283e, 0x28a4, 0x290a, 0x2971, 0x29d8 + .short 0x2a40, 0x2aa8, 0x2b11, 0x2b7a, 0x2be4, 0x2c4e, 0x2cb9, 0x2d24 + .short 0x2d90, 0x2dfc, 0x2e69, 0x2ed6, 0x2f44, 0x2fb2, 0x3021, 0x3090 + .short 0x3100, 0x3170, 0x31e1, 0x3252, 0x32c4, 0x3336, 0x33a9, 0x341c + .short 0x3490, 0x3504, 0x3579, 0x35ee, 0x3664, 0x36da, 0x3751, 0x37c8 + .short 0x3840, 0x38b8, 0x3931, 0x39aa, 0x3a24, 0x3a9e, 0x3b19, 0x3b94 + .short 0x3c10, 0x3c8c, 0x3d09, 0x3d86, 0x3e04, 0x3e82, 0x3f01, 0x3f80 + .short 0x4000, 0x4080, 0x4101, 0x4182, 0x4204, 0x4286, 0x4309, 0x438c + .short 0x4410, 0x4494, 0x4519, 0x459e, 0x4624, 0x46aa, 0x4731, 0x47b8 + .short 0x4840, 0x48c8, 0x4951, 0x49da, 0x4a64, 0x4aee, 0x4b79, 0x4c04 + .short 0x4c90, 0x4d1c, 0x4da9, 0x4e36, 0x4ec4, 0x4f52, 0x4fe1, 0x5070 + .short 0x5100, 0x5190, 0x5221, 0x52b2, 0x5344, 0x53d6, 0x5469, 0x54fc + .short 0x5590, 0x5624, 0x56b9, 0x574e, 0x57e4, 0x587a, 0x5911, 0x59a8 + .short 0x5a40, 0x5ad8, 0x5b71, 0x5c0a, 0x5ca4, 0x5d3e, 0x5dd9, 0x5e74 + .short 0x5f10, 0x5fac, 0x6049, 0x60e6, 0x6184, 0x6222, 0x62c1, 0x6360 + .short 0x6400, 0x64a0, 0x6541, 0x65e2, 0x6684, 0x6726, 0x67c9, 0x686c + .short 0x6910, 0x69b4, 0x6a59, 0x6afe, 0x6ba4, 0x6c4a, 0x6cf1, 0x6d98 + .short 0x6e40, 0x6ee8, 0x6f91, 0x703a, 0x70e4, 0x718e, 0x7239, 0x72e4 + .short 0x7390, 0x743c, 0x74e9, 0x7596, 0x7644, 0x76f2, 0x77a1, 0x7850 + .short 0x7900, 0x79b0, 0x7a61, 0x7b12, 0x7bc4, 0x7c76, 0x7d29, 0x7ddc + .short 0x7e90, 0x7f44, 0x7ff9, 0x80ae, 0x8164, 0x821a, 0x82d1, 0x8388 + .short 0x8440, 0x84f8, 0x85b1, 0x866a, 0x8724, 0x87de, 0x8899, 0x8954 + .short 0x8a10, 0x8acc, 0x8b89, 0x8c46, 0x8d04, 0x8dc2, 0x8e81, 0x8f40 + .short 0x9000, 0x90c0, 0x9181, 0x9242, 0x9304, 0x93c6, 0x9489, 0x954c + .short 0x9610, 0x96d4, 0x9799, 0x985e, 0x9924, 0x99ea, 0x9ab1, 0x9b78 + .short 0x9c40, 0x9d08, 0x9dd1, 0x9e9a, 0x9f64, 0xa02e, 0xa0f9, 0xa1c4 + .short 0xa290, 0xa35c, 0xa429, 0xa4f6, 0xa5c4, 0xa692, 0xa761, 0xa830 + .short 0xa900, 0xa9d0, 0xaaa1, 0xab72, 0xac44, 0xad16, 0xade9, 0xaebc + .short 0xaf90, 0xb064, 0xb139, 0xb20e, 0xb2e4, 0xb3ba, 0xb491, 0xb568 + .short 0xb640, 0xb718, 0xb7f1, 0xb8ca, 0xb9a4, 0xba7e, 0xbb59, 0xbc34 + .short 0xbd10, 0xbdec, 0xbec9, 0xbfa6, 0xc084, 0xc162, 0xc241, 0xc320 + .short 0xc400, 0xc4e0, 0xc5c1, 0xc6a2, 0xc784, 0xc866, 0xc949, 0xca2c + .short 0xcb10, 0xcbf4, 0xccd9, 0xcdbe, 0xcea4, 0xcf8a, 0xd071, 0xd158 + .short 0xd240, 0xd328, 0xd411, 0xd4fa, 0xd5e4, 0xd6ce, 0xd7b9, 0xd8a4 + .short 0xd990, 0xda7c, 0xdb69, 0xdc56, 0xdd44, 0xde32, 0xdf21, 0xe010 + .short 0xe100, 0xe1f0, 0xe2e1, 0xe3d2, 0xe4c4, 0xe5b6, 0xe6a9, 0xe79c + .short 0xe890, 0xe984, 0xea79, 0xeb6e, 0xec64, 0xed5a, 0xee51, 0xef48 + .short 0xf040, 0xf138, 0xf231, 0xf32a, 0xf424, 0xf51e, 0xf619, 0xf714 + .short 0xf810, 0xf90c, 0xfa09, 0xfb06, 0xfc04, 0xfd02, 0xfe01 + diff --git a/screenshots/frame.png b/screenshots/frame.png new file mode 100644 index 0000000..052783d --- /dev/null +++ b/screenshots/frame.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:051573cbf726c8f39f6ad9ce3cf8fb49f5282be228845bb50b13887d0c0a5fc8 +size 2713 diff --git a/screenshots/heavyRelocs.png b/screenshots/heavyRelocs.png new file mode 100644 index 0000000..7c8cb7d --- /dev/null +++ b/screenshots/heavyRelocs.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a03562283da21b9f13cf2a3ff9587673514c31b6b5f6b1bcc40e7974e75d362 +size 1144 diff --git a/screenshots/helloBeep.png b/screenshots/helloBeep.png new file mode 100644 index 0000000..7c8cb7d --- /dev/null +++ b/screenshots/helloBeep.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a03562283da21b9f13cf2a3ff9587673514c31b6b5f6b1bcc40e7974e75d362 +size 1144 diff --git a/screenshots/helloText.png b/screenshots/helloText.png new file mode 100644 index 0000000..175a071 --- /dev/null +++ b/screenshots/helloText.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d6493cceac2d2993468ca4d656bc7d7fe113104e2a625d716b7c017a4bf14698 +size 2053 diff --git a/screenshots/helloWindow.png b/screenshots/helloWindow.png new file mode 100644 index 0000000..fbe6ee7 --- /dev/null +++ b/screenshots/helloWindow.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1f317fd54d488e3f8990122da944c29080c9a5b27e82ab891e8f98aac71e0b08 +size 1898 diff --git a/screenshots/minicad.png b/screenshots/minicad.png new file mode 100644 index 0000000..60c19f3 --- /dev/null +++ b/screenshots/minicad.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81a59ee363dbe66546fe56bd7570757886ab0526a99be4839387c73c009849ce +size 3803 diff --git a/screenshots/orcaFrame.png b/screenshots/orcaFrame.png new file mode 100644 index 0000000..82fa727 --- /dev/null +++ b/screenshots/orcaFrame.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd3af6c9cf30cba535258a79097d70dc454052299c32923d278bbe6af2436a40 +size 1847 diff --git a/screenshots/orcaFrameLike.png b/screenshots/orcaFrameLike.png new file mode 100644 index 0000000..757cdeb --- /dev/null +++ b/screenshots/orcaFrameLike.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:08243cbf6f9d31d3a29dc50b3e9f98e278777b13ab361e30fdd8687247cac256 +size 1203 diff --git a/screenshots/orcaMiniCadLike.png b/screenshots/orcaMiniCadLike.png new file mode 100644 index 0000000..9898b4c --- /dev/null +++ b/screenshots/orcaMiniCadLike.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a3378f00c133c0754db525b4b8d1215ba1ddcb515ff5b52a0ec5a561d1ba307 +size 2891 diff --git a/screenshots/orcaReversiLike.png b/screenshots/orcaReversiLike.png new file mode 100644 index 0000000..757cdeb --- /dev/null +++ b/screenshots/orcaReversiLike.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:08243cbf6f9d31d3a29dc50b3e9f98e278777b13ab361e30fdd8687247cac256 +size 1203 diff --git a/screenshots/qdProbe.png b/screenshots/qdProbe.png new file mode 100644 index 0000000..d560a07 --- /dev/null +++ b/screenshots/qdProbe.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c9f01c81966a4b6508f086ed8a9d3e54b3694e60643cec97ed33a516b5065823 +size 14278 diff --git a/screenshots/reversi.png b/screenshots/reversi.png new file mode 100644 index 0000000..d6048b4 --- /dev/null +++ b/screenshots/reversi.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f09749b0d2605f9f6bfac1e9f8629f84753ad0c3c65805bb228a415171973ba8 +size 3936 diff --git a/scripts/benchCyclesPrecise.sh b/scripts/benchCyclesPrecise.sh index 3a875c3..874fb3a 100755 --- a/scripts/benchCyclesPrecise.sh +++ b/scripts/benchCyclesPrecise.sh @@ -38,6 +38,12 @@ benchInputs() { dotProduct) echo 'dotProduct(va, vb, 4)';; popcount) echo 'popcount(0x12345678UL)';; crc32) echo 'crc32((const unsigned char *)"hello", 5)';; + globalArrSum) echo 'globalArrSum(50)';; + globalArrFill) echo '(globalArrFill(50), 0)';; + globalArr8Sum) echo 'globalArr8Sum(50)';; + bubbleSort) echo '(bubbleSort(bsBuf, 16), 0)';; + strLen) echo 'strLen("The quick brown fox jumps over the lazy dog!")';; + djb2Hash) echo 'djb2Hash("hello world")';; *) echo "/* unknown */";; esac } @@ -52,6 +58,12 @@ benchExtern() { dotProduct) echo 'extern long dotProduct(const short *a, const short *b, unsigned int n); static const short va[] = {1,2,3,4}; static const short vb[] = {5,6,7,8};';; popcount) echo 'extern int popcount(unsigned long x);';; crc32) echo 'extern unsigned long crc32(const unsigned char *p, unsigned int n);';; + globalArrSum) echo 'extern unsigned short globalArrSum(unsigned short n); extern unsigned short globalArr[100];';; + globalArrFill) echo 'extern void globalArrFill(unsigned short n); extern unsigned short globalArrF[100];';; + globalArr8Sum) echo 'extern unsigned short globalArr8Sum(unsigned short n); extern unsigned char globalArr8[100];';; + bubbleSort) echo 'extern void bubbleSort(short *a, unsigned short n); static short bsBuf[16] = {7,3,1,9,4,5,8,2,6,0,15,11,13,10,14,12};';; + strLen) echo 'extern unsigned short strLen(const char *s);';; + djb2Hash) echo 'extern unsigned long djb2Hash(const char *s);';; *) echo '';; esac } @@ -69,6 +81,12 @@ benchIters() { dotProduct) echo 200;; popcount) echo 500;; crc32) echo 200;; + globalArrSum) echo 100;; + globalArrFill) echo 100;; + globalArr8Sum) echo 100;; + bubbleSort) echo 50;; + strLen) echo 200;; + djb2Hash) echo 50;; *) echo 100;; esac } diff --git a/scripts/genToolbox.py b/scripts/genToolbox.py index c6f50ae..85f9b08 100644 --- a/scripts/genToolbox.py +++ b/scripts/genToolbox.py @@ -31,7 +31,7 @@ import re import sys from pathlib import Path -ORCA_DIR = Path("/tmp/orca-headers") +ORCA_DIR = Path("/home/scott/claude/llvm816/tools/orca-c/ORCACDefs") OUT_HEADER = Path("/home/scott/claude/llvm816/runtime/include/iigs/toolbox.h") OUT_ASM = Path("/home/scott/claude/llvm816/runtime/src/iigsToolbox.s") @@ -297,6 +297,11 @@ def emit(decls): # Generate asm body. sLines.append(f"; {name}({', '.join(argTypes) or 'void'}) -> {retType}") sLines.append(f"; tool 0x{tool:04X}, set 0x{tool & 0xFF:02X} ({TOOLSET_NAME.get(tool & 0xFF, '?')})") + # One section per wrapper so link816's --gc-sections can + # drop the ~880 wrappers the user's demo doesn't reference. + # Without this the entire 45 KB toolbox.s gets linked into + # every binary. + sLines.append(f"\t.section .text.{name},\"ax\"") sLines.append(f"\t.globl {name}") sLines.append(f"{name}:") @@ -310,6 +315,11 @@ def emit(decls): # scratch; stx scratch+2'. void-arg functions skip this entirely # — emitting a phantom `pha` for arg0 corrupts the dispatcher's # stack frame (caught when GetTick crashed under Loader). + # + # No PBR-bank workaround here anymore: the backend now emits a + # proper R_W65816_BANK16 relocation on the high half of &symbol + # so the OMF Loader patches it with our actual placement bank + # at load time. See feedback_pointer_constant_bank_zero.md. scratchDP = 0xE0 # libcall scratch zone if argInfo: sLines.append(f"\t; --- stash arg0 (in A{'/X' if firstArgIs32 else ''}) ---") @@ -323,8 +333,15 @@ def emit(decls): for _ in range((retSize + 1) // 2): sLines.append(f"\tpea 0") - # Push args in Pascal order (L-to-R, but each multi-byte value - # pushed lo-word first then hi-word per ORCA convention). + # Push args in Pascal order (L-to-R). For multi-byte values + # the toolbox expects HIGH word first then LOW word (matches + # ORCA-C's PushLong macro: `pea ^addr ; pea addr`). After + # the two pushes, memory at (S+1..S+4) is in little-endian + # long-value order (byte 0 low at lowest address) so a + # `pull long` / 32-bit indirect read sees the value + # correctly. Earlier "lo first then hi" emission left the + # high word at the wrong stack offset and the toolbox saw + # garbage (NewHandle returned NULL for a $900-byte request). # Tracker: how many bytes have we pushed beyond the original # caller-stack so all stack-arg loads need to add (pushed) to # their original offset. @@ -332,13 +349,14 @@ def emit(decls): # arg0 first (if any args). if argInfo: sLines.append(f"\t; --- arg0 ---") - sLines.append(f"\tlda 0x{scratchDP:02X}") - sLines.append(f"\tpha") - pushedBytes += 2 if firstArgIs32: + # HIGH word first (Long convention). sLines.append(f"\tlda 0x{scratchDP + 2:02X}") sLines.append(f"\tpha") pushedBytes += 2 + sLines.append(f"\tlda 0x{scratchDP:02X}") + sLines.append(f"\tpha") + pushedBytes += 2 # arg1, arg2, ... — each loaded from caller stack at original # offset + pushedBytes. @@ -357,10 +375,15 @@ def emit(decls): pushedBytes += 2 stackArgOffset += 2 elif size == 4: - # Load lo, push; load hi, push. - sLines.append(f"\tlda {stackArgOffset + pushedBytes}, s") + # Long: push HIGH word first, then LOW word (ORCA + # PushLong convention; same fix as the arg0 Long path). + # HI is at caller offset (stackArgOffset + 2); LO at + # stackArgOffset. After the HI PHA, both halves' + # current stack-rel offsets shift +2. + sLines.append(f"\tlda {stackArgOffset + pushedBytes + 2}, s") sLines.append(f"\tpha") pushedBytes += 2 + # LO at original offset stackArgOffset; current = +pushedBytes. sLines.append(f"\tlda {stackArgOffset + pushedBytes}, s") sLines.append(f"\tpha") pushedBytes += 2 diff --git a/scripts/installCadius.sh b/scripts/installCadius.sh new file mode 100755 index 0000000..81bbfb6 --- /dev/null +++ b/scripts/installCadius.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# installCadius.sh - clone, build, and install the Brutal Deluxe cadius +# ProDOS-disk tool into tools/cadius/cadius. Demo + runViaFinder +# scripts default to this location. +# +# Usage: bash scripts/installCadius.sh +# Idempotent: skips clone if source dir already present; skips build +# if the binary is already in place. + +set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" +SRC_DIR="$PROJECT_ROOT/tools/cadius-src" +DEST_DIR="$PROJECT_ROOT/tools/cadius" +DEST_BIN="$DEST_DIR/cadius" + +if [ -x "$DEST_BIN" ]; then + echo "cadius already installed at $DEST_BIN" + exit 0 +fi + +mkdir -p "$DEST_DIR" + +if [ ! -d "$SRC_DIR/.git" ]; then + rm -rf "$SRC_DIR" + git clone --depth 1 https://github.com/mach-kernel/cadius "$SRC_DIR" +fi + +(cd "$SRC_DIR" && make) + +cp "$SRC_DIR/bin/release/cadius" "$DEST_BIN" +chmod +x "$DEST_BIN" +echo "installed: $DEST_BIN" +"$DEST_BIN" 2>&1 | head -1 diff --git a/scripts/probeHelloWindow.sh b/scripts/probeHelloWindow.sh new file mode 100755 index 0000000..f7f9352 --- /dev/null +++ b/scripts/probeHelloWindow.sh @@ -0,0 +1,161 @@ +#!/usr/bin/env bash +# probeHelloWindow.sh - headless run of demos/helloWindow that dumps +# the step markers ($70..$72, written via MARK_AT = STA long, bank-0 +# explicit) and the gDiag[] capture buffer (discovered from the .map) +# so we can see what NewWindow ($090E) actually returns at the +# toolbox-dispatcher level. +# +# Captures: +# $70 = end-of-main marker ($99 = ran to completion) +# $71 = step marker (last value reached: $10..$19) +# $72 = NewWindow C-level result ($01/$02 = success, $EE = NULL) +# gDiag[0/1] = paramLength readback ($4C if parm ptr is good) +# gDiag[2/3] = result-space LOW word (window-ptr lo) +# gDiag[4/5] = result-space HIGH word (window-ptr hi) +# gDiag[6] = P byte at JSL return (bit 0 = carry) +# gDiag[7] = $AA if probe ran to completion + +set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" + +OMF="$PROJECT_ROOT/demos/helloWindow.omf" +SRC="$PROJECT_ROOT/demos/helloWindow.c" +MAP="$PROJECT_ROOT/demos/helloWindow.map" +if [ ! -f "$OMF" ] || [ "$SRC" -nt "$OMF" ]; then + bash "$PROJECT_ROOT/demos/build.sh" helloWindow >/dev/null +fi + +GDIAG_HEX=$(awk '$2 == "gDiag" {print $1; exit}' "$MAP") +[ -n "$GDIAG_HEX" ] || { echo "gDiag not found in $MAP" >&2; exit 2; } +GDIAG=$((GDIAG_HEX)) +echo "gDiag at $(printf '0x%06x' $GDIAG)" + +CADIUS=${CADIUS:-$PROJECT_ROOT/tools/cadius/cadius} +SYSDISK=${SYSDISK:-$PROJECT_ROOT/tools/gsos/sys602.po} + +[ -x "$CADIUS" ] || { echo "cadius not found: $CADIUS" >&2; exit 2; } +[ -f "$SYSDISK" ] || { echo "sysdisk not found: $SYSDISK" >&2; exit 2; } +command -v mame >/dev/null || { echo "mame not in PATH" >&2; exit 2; } + +WORK=$(mktemp -d -t probe.XXXXXX) +trap 'rm -rf "$WORK"' EXIT + +cp "$SYSDISK" "$WORK/disk.po" +"$CADIUS" CREATEVOLUME "$WORK/data.po" DATA 800KB >/dev/null +cp "$OMF" "$WORK/HELLO#B30000" +"$CADIUS" ADDFILE "$WORK/data.po" /DATA "$WORK/HELLO#B30000" >/dev/null + +cat > "$WORK/launch.lua" <> "$WORK/launch.lua" <<'LUA' +local cpu = manager.machine.devices[":maincpu"] +local mem = cpu.spaces["program"] +local nat = manager.machine.natkeyboard +local frame = 0 +local idx = 1 + +local function get_field(port, name) + local p = manager.machine.ioport.ports[port] + if p == nil then return nil end + return p.fields[name] +end +local key_cmd = get_field(":macadb:KEY3", "Command / Open Apple") +local function press(f) if f then f:set_value(1) end end +local function release(f) if f then f:set_value(0) end end + +local steps = { + {3300, function() nat:post("D") end}, + {3540, function() press(key_cmd) end}, + {3546, function() nat:post("o") end}, + {3600, function() release(key_cmd) end}, + {4200, function() nat:post("H") end}, + {4500, function() press(key_cmd) end}, + {4506, function() nat:post("o") end}, + {4560, function() release(key_cmd) end}, + {7000, function() nat:post(" ") end}, + {7500, function() nat:post(" ") end}, + {8000, function() nat:post(" ") end}, + {9000, function() + for a = 0x70, 0x7f do + print(string.format("MARK $%02x = %02x", a, mem:read_u8(a))) + end + print(string.format("MARK $96 (event type) = %02x", mem:read_u8(0x96))) + print(string.format("MARK $97 (loop iters lo) = %02x", mem:read_u8(0x97))) + print(string.format("MARK $93 (sizeof gWp) = %02x = %d", + mem:read_u8(0x93), mem:read_u8(0x93))) + print(string.format("A post-JSL = $%04x (lo=%02x hi=%02x)", + mem:read_u8(0x90) | (mem:read_u8(0x91)*256), + mem:read_u8(0x90), mem:read_u8(0x91))) + local pbr = mem:read_u8(0x73) + -- The OMF Loader places our segment at offset $0000 within bank + -- $PBR (not at $1000 like our text-base). The cRELOC mechanism + -- patches all symbolic abs-16 stores to (segPlacedBase + offsetRef) + -- = ($0000 + symbol_offset_within_segment) = link_addr - text_base. + -- So runtime_address(sym) = pbr*0x10000 + (link_addr - text_base). + local TEXT_BASE = 0x1000 + local base = pbr * 0x10000 + (GDIAG - TEXT_BASE) + print(string.format("PBR = $%02x; gDiag at $%06x", pbr, base)) + for i = 0, 15 do + print(string.format("gDiag[%d] = %02x", i, mem:read_u8(base + i))) + end + -- Cross-check: read sanity bytes at the same offset in bank 0 + -- and bank 8 to find where DBR-rel stores actually land. + -- Search every bank from $00..$FF for $5A at offset $6F5D. + for bank = 0, 0xff do + local v = mem:read_u8(bank*0x10000+0x6F5D) + if v == 0x5a then + print(string.format("*** bank %02x HAS $5A at $6F5D ***", bank)) + end + end + for _, bank in ipairs({0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}) do + print(string.format("bank %02x: $%06x = %02x (gDiag+e) $%06x = %02x (s2) $%06x = %02x (s1)", + bank, + bank*0x10000+0x6F5C, mem:read_u8(bank*0x10000+0x6F5C), + bank*0x10000+0x6F5D, mem:read_u8(bank*0x10000+0x6F5D), + bank*0x10000+0x6F4E, mem:read_u8(bank*0x10000+0x6F4E))) + end + -- Dump the runtime operand bytes of the symbolic `sta gDiag+0` + -- at .bin offset $387. With text-base=$1000, that's runtime + -- $08:$1387 (PBR + .bin offset + text-base). If the Loader + -- re-applied the cRELOC with a different segPlacedBase, the + -- operand bytes will differ from what the linker wrote. + local probeBase = 0x081000 + for ofs = 0x380, 0x39f, 0x10 do + local row = string.format("$08:%04x:", ofs) + for j = 0, 15 do + row = row .. string.format(" %02x", mem:read_u8(probeBase + ofs - 0x1000 + j)) + end + print(row) + end + print(string.format("test $704E: $08=%02x $00=%02x", + mem:read_u8(0x08704E), mem:read_u8(0x00704E))) + print(string.format("test $7060: $08=%02x $00=%02x", + mem:read_u8(0x087060), mem:read_u8(0x007060))) + print(string.format("test $70FF: $08=%02x $00=%02x", + mem:read_u8(0x0870FF), mem:read_u8(0x0070FF))) + for b = 0, 0xff do + if mem:read_u8(b*0x10000+0x704E) == 0xAB then + print(string.format("*** $AB at bank %02x:$704e ***", b)) + end + end + manager.machine:exit() + end}, +} +emu.register_frame_done(function() + frame = frame + 1 + while idx <= #steps and frame >= steps[idx][1] do + steps[idx][2]() + idx = idx + 1 + end +end) +LUA + +OUT=$(timeout 220 mame apple2gs -rompath "$PROJECT_ROOT/tools/mame/roms" \ + -window -nothrottle -sound none \ + -seconds_to_run 180 -flop3 "$WORK/disk.po" -flop4 "$WORK/data.po" \ + -autoboot_script "$WORK/launch.lua" &1) + +echo "$OUT" | grep -E "^(MARK|gDiag|bank|PBR|\*\*\*|\\\$08|test|A post)" diff --git a/scripts/probeQdStartup.sh b/scripts/probeQdStartup.sh new file mode 100755 index 0000000..8d87689 --- /dev/null +++ b/scripts/probeQdStartup.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash +# probeQdStartup.sh - boot qdProbe.omf under GS/OS, dump the per-phase +# markers ($80..$86) plus SHR row 0/1/2 byte signatures. +# +# Tells us WHICH startup call (QDStartUp / EMStartUp / WindStartUp) +# happened, and whether any of them wipe the pre-existing SHR markers. + +set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" + +CADIUS="${CADIUS:-$PROJECT_ROOT/tools/cadius/cadius}" +SYSDISK="${SYSDISK:-$PROJECT_ROOT/tools/gsos/sys602.po}" +OMF="$PROJECT_ROOT/demos/qdProbe.omf" +[ -f "$OMF" ] || bash "$PROJECT_ROOT/demos/build.sh" qdProbe >/dev/null + +WORK=$(mktemp -d -t qdProbe.XXXXXX) +trap 'rm -rf "$WORK"' EXIT + +cp "$SYSDISK" "$WORK/disk.po" +"$CADIUS" CREATEVOLUME "$WORK/data.po" DATA 800KB >/dev/null +cp "$OMF" "$WORK/HELLO#B30000" +"$CADIUS" ADDFILE "$WORK/data.po" /DATA "$WORK/HELLO#B30000" >/dev/null + +cat > "$WORK/launch.lua" <<'LUA' +local cpu = manager.machine.devices[":maincpu"] +local mem = cpu.spaces["program"] +local nat = manager.machine.natkeyboard +local frame = 0; local idx = 1 +local function gf(p,n) local pp = manager.machine.ioport.ports[p]; return pp and pp.fields[n] end +local kcmd = gf(":macadb:KEY3", "Command / Open Apple") +local function press(f) if f then f:set_value(1) end end +local function release(f) if f then f:set_value(0) end end +local steps = { + {3300, function() nat:post("D") end}, + {3540, function() press(kcmd) end}, + {3546, function() nat:post("o") end}, + {3600, function() release(kcmd) end}, + {4200, function() nat:post("H") end}, + {4500, function() press(kcmd) end}, + {4506, function() nat:post("o") end}, + {4560, function() release(kcmd) end}, + {8500, function() + for a = 0x70, 0x87 do + local v = mem:read_u8(a) + if v ~= 0 then + print(string.format("DP[0x%02x]=%02x", a, v)) + end + end + -- SHR row sentinel sample (bytes 0..2 of rows 0/1/2) + local function rowSample(off) + local s = "" + for i=0,3 do s = s .. string.format(" %02x", mem:read_u8(0xE12000 + off + i)) end + return s + end + print("SHR-row0:" .. rowSample(0)) + print("SHR-row1:" .. rowSample(160)) + print("SHR-row2:" .. rowSample(320)) + print("SHR-row5:" .. rowSample(800)) + print("SHR-row10:" .. rowSample(1600)) + -- Count any other non-zero pixels (excluding our intentional rows 0/1/2). + local count = 0 + for o = 480, 31999 do + if mem:read_u8(0xE12000 + o) ~= 0 then count = count + 1 end + end + print(string.format("SHR-rest-nonzero=%d", count)) + local scb0 = mem:read_u8(0xE19D00) + print(string.format("SHR-SCB0=%02x", scb0)) + manager.machine:exit() + end}, +} +emu.register_frame_done(function() + frame = frame + 1 + while idx <= #steps and frame >= steps[idx][1] do + steps[idx][2](); idx = idx + 1 + end +end) +LUA + +timeout 200 mame apple2gs -rompath "$PROJECT_ROOT/tools/mame/roms" \ + -window -nothrottle -sound none \ + -seconds_to_run 180 -flop3 "$WORK/disk.po" -flop4 "$WORK/data.po" \ + -autoboot_script "$WORK/launch.lua" &1 | \ + grep -E "DP|SHR-|MAME" || true diff --git a/scripts/runInMameWithGsosStub.sh b/scripts/runInMameWithGsosStub.sh index 4083c86..39e077b 100755 --- a/scripts/runInMameWithGsosStub.sh +++ b/scripts/runInMameWithGsosStub.sh @@ -26,7 +26,11 @@ SECS=3 # 23-byte stub bytes (see runtime/src/iigsGsosStub.s for source). # Hand-assembled to avoid relying on llvm-mc tracking M-flag state. -STUB_HEX="0848 a309 85e4 a000 00e2 20a9 4291 e4c2 2068 28a9 0000 6b" +# `lda 7,s` (a3 07) reads the parm-block offset from its position in +# the new wrapper layout: PEA 0 + PHA leaves bytes at (S+1..S+4) as +# (off_lo, off_hi, bank, pad). After JSL (3 bytes) + stub PHP (1) + +# stub PHA (2), offset sits at (S+7, S+8). +STUB_HEX="0848 a307 85e4 a000 00e2 20a9 4291 e4c2 2068 28a9 0000 6b" LUA_CHECKS="" EXPECT_LIST=() diff --git a/scripts/runViaFinder.sh b/scripts/runViaFinder.sh index 51c820f..764d59c 100755 --- a/scripts/runViaFinder.sh +++ b/scripts/runViaFinder.sh @@ -37,7 +37,7 @@ done shift PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" -CADIUS=${CADIUS:-/tmp/cadius/cadius} +CADIUS=${CADIUS:-$PROJECT_ROOT/tools/cadius/cadius} SYSDISK=${SYSDISK:-$PROJECT_ROOT/tools/gsos/sys602.po} [ -x "$CADIUS" ] || { echo "cadius not found at $CADIUS" >&2; exit 2; } diff --git a/scripts/smokeTest.sh b/scripts/smokeTest.sh index 488e30d..d3c54ef 100755 --- a/scripts/smokeTest.sh +++ b/scripts/smokeTest.sh @@ -395,9 +395,10 @@ if [ -x "$CLANG" ]; then int mul(int a, int b) { return a * b; } EOF "$CLANG" --target=w65816 -O2 -S "$cFile4" -o "$sMulFile" - if ! grep -qF "jsl __mulhi3" "$sMulFile"; then + # Accept either jsl or jml — tail-call peephole may convert. + if ! grep -qE "(jsl|jml) __mulhi3" "$sMulFile"; then cat "$sMulFile" >&2 - die "expected jsl __mulhi3" + die "expected jsl or jml __mulhi3" fi # Note: the original SPAdj-miscompile guard (which asserted specific # offsets like `lda 6,s` for arg b after one PHA) was tied to the @@ -1203,12 +1204,14 @@ EOF expect_lo=$(printf '%02x' $((mulhi3_addr & 0xff))) expect_mid=$(printf '%02x' $(((mulhi3_addr >> 8) & 0xff))) expect_hi=$(printf '%02x' $(((mulhi3_addr >> 16) & 0xff))) - # Hexdump mul's first 32 bytes and look for the JSL pattern. + # Hexdump mul's first 32 bytes and look for the JSL (0x22) or JML + # (0x5C) pattern. Tail-call peephole may convert JSL→JML when mul's + # body is just `return a * b`. if ! od -An -tx1 -N 32 -j "$mul_off" "$binLinkFile" \ | tr -s ' \n' ' ' \ - | grep -qE " 22 ${expect_lo} ${expect_mid} ${expect_hi}( |$)"; then + | grep -qE " (22|5c) ${expect_lo} ${expect_mid} ${expect_hi}( |$)"; then od -An -tx1 -N 32 -j "$mul_off" "$binLinkFile" >&2 - die "link816: mul's JSL operand does not point at __mulhi3 (expected 22 ${expect_lo} ${expect_mid} ${expect_hi})" + die "link816: mul's JSL/JML operand does not point at __mulhi3 (expected 22/5c ${expect_lo} ${expect_mid} ${expect_hi})" fi # Soft-float runtime: compile runtime/src/softFloat.c, then link a @@ -2198,6 +2201,41 @@ EOF fi rm -f "$cU64File" "$oU64File" "$binU64File" + log "check: MAME runs mul16to32(0xFFFF,0xFFFF) → 0xFFFE0001 (PEA peephole JSL-uses-A)" + cMulSF="$(mktemp --suffix=.c)" + oMulSF="$(mktemp --suffix=.o)" + binMulSF="$(mktemp --suffix=.bin)" + # Both args same constant — clang's SDAG CSEs them. Before the + # PEA peephole fix, the second `lda #0xffff` got elided (the + # peephole treated JSL's implicit-def $a as "A dead" without + # checking implicit-use $a), leaving A uninitialized going + # into the callee → wrong product. + cat > "$cMulSF" <<'EOF' +__attribute__((noinline)) void switchToBank2(void) { + __asm__ volatile ("sep #0x20\n.byte 0xa9,0x02\npha\nplb\nrep #0x20\n"); +} +__attribute__((noinline)) unsigned long mul16to32(unsigned short a, unsigned short b) { + return (unsigned long)a * (unsigned long)b; +} +int main(void) { + unsigned long r = mul16to32(0xFFFF, 0xFFFF); // expect 0xFFFE0001 + switchToBank2(); + *(volatile unsigned long *)0x5000 = r; + while (1) {} +} +EOF + "$CLANG" --target=w65816 -O2 -ffunction-sections -c \ + "$cMulSF" -o "$oMulSF" + "$PROJECT_ROOT/tools/link816" -o "$binMulSF" --text-base 0x1000 \ + "$oCrt0F" "$oLibcF" "$oSfF" "$oSdF" "$oLibgccFile" "$oMulSF" \ + >/dev/null 2>&1 + if ! bash "$PROJECT_ROOT/scripts/runInMame.sh" "$binMulSF" --check \ + 0x025000=0001 0x025002=fffe \ + >/dev/null 2>&1; then + die "MAME: mul16to32(0xFFFF, 0xFFFF) != 0xFFFE0001 (PEA peephole regression)" + fi + rm -f "$cMulSF" "$oMulSF" "$binMulSF" + log "check: MAME runs addOff(p,1) p[0]+=p[1] → 12 (StackSlotCleanup killed-Y respect)" cAofFile="$(mktemp --suffix=.c)" oAofFile="$(mktemp --suffix=.o)" @@ -6180,7 +6218,7 @@ fi # # Manual repro after fix: # GSOS_FILE_SMOKE=1 bash scripts/smokeTest.sh -CADIUS=${CADIUS:-/tmp/cadius/cadius} +CADIUS=${CADIUS:-$PROJECT_ROOT/tools/cadius/cadius} SYSDISK=${SYSDISK:-$PROJECT_ROOT/tools/gsos/sys602.po} if [ "${GSOS_FILE_SMOKE:-0}" = "1" ] \ && [ -x "$CLANG" ] && [ -x "$CADIUS" ] && [ -f "$SYSDISK" ] \ diff --git a/scripts/snapDemo.sh b/scripts/snapDemo.sh new file mode 100755 index 0000000..228be05 --- /dev/null +++ b/scripts/snapDemo.sh @@ -0,0 +1,95 @@ +#!/usr/bin/env bash +# snapDemo.sh - boot a demo OMF in MAME and capture multiple SHR +# snapshots while it runs. Useful for verifying that a demo's window +# is actually drawn (vs the headless test which only checks the $99 +# end-marker at $00:0070). +# +# Usage: bash scripts/snapDemo.sh [snap-frame-list] +# Default snap frames: 4800,5000,5200,5500,6000,6500. +# Optional env: SYSDISK=path/to/sys602.po (or other ProDOS .po). +# +# Snapshots land in a TMPDIR-rooted snapdir; the path is echoed at +# the end. The work disk image and Finder navigation script are +# cleaned up via trap. + +set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" + +[ $# -ge 1 ] || { echo "usage: $0 [frames]" >&2; exit 2; } +BASE="$1" +FRAMES="${2:-4800,5000,5200,5500,6000,6500}" + +CADIUS="${CADIUS:-$PROJECT_ROOT/tools/cadius/cadius}" +SYSDISK="${SYSDISK:-$PROJECT_ROOT/tools/gsos/sys602.po}" +OMF="$PROJECT_ROOT/demos/${BASE}.omf" + +[ -x "$CADIUS" ] || { echo "cadius not found: $CADIUS" >&2; exit 2; } +[ -f "$SYSDISK" ] || { echo "sysdisk not found: $SYSDISK" >&2; exit 2; } +[ -f "$OMF" ] || { echo "OMF not found: $OMF (run demos/build.sh $BASE first)" >&2; exit 2; } +command -v mame >/dev/null || { echo "mame not in PATH" >&2; exit 2; } + +WORK=$(mktemp -d -t snapDemo.XXXXXX) +SNAPDIR=$(mktemp -d -t snapDemoOut.XXXXXX) +trap 'rm -rf "$WORK"' EXIT + +cp "$SYSDISK" "$WORK/disk.po" +"$CADIUS" CREATEVOLUME "$WORK/data.po" DATA 800KB >/dev/null +cp "$OMF" "$WORK/HELLO#B30000" +"$CADIUS" ADDFILE "$WORK/data.po" /DATA "$WORK/HELLO#B30000" >/dev/null + +# Build lua steps[] entries for each requested snap frame. +SNAP_STEPS="" +for f in ${FRAMES//,/ }; do + SNAP_STEPS="${SNAP_STEPS} {${f}, function() manager.machine.video:snapshot(); print(string.format(\"SNAP-FRAME=${f}\")) end}, +" +done + +cat > "$WORK/launch.lua" <= steps[idx][1] do + steps[idx][2](); idx = idx + 1 + end +end) +LUA + +timeout 200 mame apple2gs -rompath "$PROJECT_ROOT/tools/mame/roms" \ + -window -nothrottle -sound none \ + -snapshot_directory "$SNAPDIR" \ + -seconds_to_run 180 -flop3 "$WORK/disk.po" -flop4 "$WORK/data.po" \ + -autoboot_script "$WORK/launch.lua" &1 | \ + grep -E "MAME-READ|SHR-|SNAP-" || true +echo "snaps in: $SNAPDIR" +find "$SNAPDIR" -name '*.png' | sort diff --git a/src/link816/link816.cpp b/src/link816/link816.cpp index 2f3afc8..be6b8d4 100644 --- a/src/link816/link816.cpp +++ b/src/link816/link816.cpp @@ -116,6 +116,13 @@ static constexpr uint8_t R_W65816_IMM16 = 2; static constexpr uint8_t R_W65816_IMM24 = 3; static constexpr uint8_t R_W65816_PCREL8 = 4; static constexpr uint8_t R_W65816_PCREL16 = 5; +// Bank byte of a 24-bit absolute address. Patches 2 bytes: +// byte 0 = (target >> 16) & 0xFF, byte 1 = 0. Used for the high +// half of `&symbol` 32-bit pointers so the bank tracks the actual +// OMF Loader segment placement at runtime. cRELOC emission uses +// ByteCnt=2 BitShift=16 so the Loader patches with +// (segPlacedBase + offsetRef) >> 16. +static constexpr uint8_t R_W65816_BANK16 = 6; // ---------------------------------------------------------------- Helpers @@ -321,7 +328,8 @@ struct Layout { struct Imm24Site { uint32_t patchOff; // offset within text image (== patchAddr - textBase) uint32_t offsetRef; // offset within text image of target symbol - uint8_t byteCnt; // 2 = IMM16, 3 = IMM24 + uint8_t byteCnt; // 2 = IMM16 or BANK16, 3 = IMM24 + uint8_t bitShift; // 0 for IMM16/IMM24, 16 for BANK16 }; static std::vector gImm24Sites; static uint32_t gTextBaseForSites = 0; @@ -363,6 +371,27 @@ static void applyReloc(std::vector &buf, uint32_t off, // (3). Imm24Site struct is reused — emitOmf will // emit cRELOC ByteCnt=2 for this. s.byteCnt = 2; + s.bitShift = 0; + gImm24Sites.push_back(s); + } + } + break; + case R_W65816_BANK16: + // 2-byte patch: byte 0 = bank of target, byte 1 = 0 (pad). + // The Loader's cRELOC pass overwrites these bytes with + // (segPlacedBase + offsetRef) >> 16 at load time, so at runtime + // the value reflects the actually-placed bank. + buf[off] = static_cast((target >> 16) & 0xFF); + buf[off + 1] = 0; + if (gRecordSites) { + uint32_t targetBank = target & 0xFF0000; + uint32_t baseBank = gTextBaseForSites & 0xFF0000; + if (targetBank == baseBank) { + Imm24Site s; + s.patchOff = patchAddr - gTextBaseForSites; + s.offsetRef = target - gTextBaseForSites; + s.byteCnt = 2; + s.bitShift = 16; gImm24Sites.push_back(s); } } @@ -389,6 +418,7 @@ static void applyReloc(std::vector &buf, uint32_t off, s.patchOff = patchAddr - gTextBaseForSites; s.offsetRef = target - gTextBaseForSites; s.byteCnt = 3; + s.bitShift = 0; gImm24Sites.push_back(s); } } @@ -1487,23 +1517,28 @@ int main(int argc, char **argv) { if (!mapPath.empty()) linker.writeMap(mapPath); if (!debugOutPath.empty()) linker.writeDebugSidecar(debugOutPath); if (!relocOutPath.empty()) { - // Sidecar binary format (v2): + // Sidecar binary format (v3): // u32 count - // { u32 patchOff; u32 offsetRef; u8 byteCnt; u8 pad[3]; } × count + // { u32 patchOff; u32 offsetRef; u8 byteCnt; u8 bitShift; + // u8 pad[2]; } × count // Both offsets are within the segment image (== link-time addr - // minus textBase). byteCnt = 2 for IMM16, 3 for IMM24. - // Consumed by omfEmit --relocs to emit cRELOC opcodes. + // minus textBase). byteCnt = 2 for IMM16 or BANK16, 3 for IMM24. + // bitShift = 0 normally, 16 for BANK16 (so the Loader patches + // with the bank byte instead of the offset). v2 used pad[0]=0 + // for byteCnt 2/3, so v3 is backwards-compatible: pad[0] was + // always 0 then, equivalent to bitShift=0. std::ofstream rf(relocOutPath, std::ios::binary); if (!rf) die("cannot open '" + relocOutPath + "' for writing"); uint32_t count = (uint32_t)gImm24Sites.size(); rf.write(reinterpret_cast(&count), 4); for (const auto &s : gImm24Sites) { uint32_t po = s.patchOff, off = s.offsetRef; - uint8_t bc = s.byteCnt, pad[3] = {0, 0, 0}; + uint8_t bc = s.byteCnt, bs = s.bitShift, pad[2] = {0, 0}; rf.write(reinterpret_cast(&po), 4); rf.write(reinterpret_cast(&off), 4); rf.write(reinterpret_cast(&bc), 1); - rf.write(reinterpret_cast(pad), 3); + rf.write(reinterpret_cast(&bs), 1); + rf.write(reinterpret_cast(pad), 2); } } // Multi-segment: write per-segment images + manifest if there's diff --git a/src/link816/omfEmit.cpp b/src/link816/omfEmit.cpp index 30690c4..c9f5e0a 100644 --- a/src/link816/omfEmit.cpp +++ b/src/link816/omfEmit.cpp @@ -46,6 +46,7 @@ struct RelocSite { uint16_t patchOff; uint16_t offsetRef; uint8_t byteCnt; + uint8_t bitShift; // 0 for offset relocs, 16 for BANK16 }; } // close namespace std::vector gReloc24Sites; @@ -110,16 +111,33 @@ static std::vector emitOneSeg(const std::vector &image, uint32_t org, uint16_t segNum, uint16_t kind, - const std::string &name) { + const std::string &name, + uint32_t bssSize = 0, + uint32_t bssGap = 0) { std::vector body; - if (!image.empty()) { + // Combined image: caller's LCONST data + zero-padding to bss-start + // offset + bssSize zero bytes. We embed BSS-as-zeros in the LCONST + // rather than relying on RESSPC zero-fill, because the GS/OS Loader's + // ExpressLoad fast path doesn't reliably honor RESSPC for KIND=CODE + // segments — writes past image.size() (= into RESSPC) were silently + // lost (they went to GS/OS-owned memory). Embedding BSS as zeros + // forces the Loader to allocate enough memory and read it from the + // file. Caller passes bssGap = bytes of padding between LCONST and + // BSS so BSS lands at the link-layout address (link816 page-aligns + // bss-start up from rodata-end). + std::vector combined; + combined.reserve(image.size() + bssGap + bssSize); + combined.insert(combined.end(), image.begin(), image.end()); + combined.insert(combined.end(), bssGap, 0); + combined.insert(combined.end(), bssSize, 0); + if (!combined.empty()) { // LCONST opcode 0xF2: takes a NUMLEN-byte count followed by N // literal bytes. With NUMLEN=4 (standard for v2.1), the count // field is 4 bytes. Verified empirically against real /SYSTEM/ // START on GS/OS 6.0.2: every segment uses 0xF2 + 4-byte count. body.push_back(0xF2); // LCONST opcode - put32(body, static_cast(image.size())); - body.insert(body.end(), image.begin(), image.end()); + put32(body, static_cast(combined.size())); + body.insert(body.end(), combined.begin(), combined.end()); } // cRELOC opcodes (0xF5): one per IMM24 reloc site. Format per // Merlin32's BuildOMFFile: @@ -135,7 +153,7 @@ static std::vector emitOneSeg(const std::vector &image, for (const auto &s : ::gReloc24Sites) { body.push_back(0xF5); body.push_back(s.byteCnt); // ByteCnt (2 or 3) - body.push_back(0); // BitShift + body.push_back(s.bitShift); // BitShift (0 or 16) put16(body, s.patchOff); // OffsetPatch put16(body, s.offsetRef); // OffsetReference } @@ -161,7 +179,12 @@ static std::vector emitOneSeg(const std::vector &image, constexpr uint16_t DISPNAME = 44; const uint16_t DISPDATA = static_cast( DISPNAME + loadName.size() + segName.size()); - const uint32_t LENGTH = static_cast(image.size()); + // LENGTH = in-memory segment size = LCONST data size (BSS already + // appended as zeros to `combined` above). RESSPC = 0 because the + // BSS bytes are part of LCONST — the Loader's normal LCONST processing + // allocates and fills the memory. Tried RESSPC > 0 first, but the + // ExpressLoad fast path doesn't honor RESSPC for CODE-KIND segments. + const uint32_t LENGTH = static_cast(combined.size()); const uint32_t BYTECNT = DISPDATA + static_cast(body.size()); const uint32_t RESSPC = 0; // BANKSIZE = 0x10000 — segment fits in one 64KB bank. @@ -296,10 +319,12 @@ static std::vector emitDpStackSeg(uint32_t length, uint16_t segNum) { static std::vector emitOMF(const std::vector &image, uint32_t entryOffset, const std::string &name, - uint32_t stackSize = 0) { + uint32_t stackSize = 0, + uint32_t bssSize = 0, + uint32_t bssGap = 0) { if (stackSize == 0) { return emitOneSeg(image, entryOffset, /*org*/0, /*segNum*/1, - /*kind*/0x1000, name); + /*kind*/0x1000, name, bssSize, bssGap); } // DP/Stack segment ordering: Apple's `makedirect` reference utility // assigns the DP/Stack as SEGNUM 1 (its own object); when linked @@ -309,7 +334,7 @@ static std::vector emitOMF(const std::vector &image, // sets DP and SP appropriately when entering our code. auto dpSeg = emitDpStackSeg(stackSize, /*segNum*/1); auto codeSeg = emitOneSeg(image, entryOffset, /*org*/0, /*segNum*/2, - /*kind*/0x1000, name); + /*kind*/0x1000, name, bssSize, bssGap); std::vector out; out.insert(out.end(), dpSeg.begin(), dpSeg.end()); out.insert(out.end(), codeSeg.begin(), codeSeg.end()); @@ -356,13 +381,15 @@ static std::vector emitOmfExpressLoad( const std::vector &image, uint32_t entryOffset, const std::string &userSegName, - uint32_t stackSize = 0) { + uint32_t stackSize = 0, + uint32_t bssSize = 0, + uint32_t bssGap = 0) { // Step 1: build the user segment using KIND=0x1000 (CODE|PRIV). // Same KIND emitOMF uses for single-segment apps. Verified // Loader-launchable via the Finder smoke path. auto userSeg = emitOneSeg(image, entryOffset, /*org*/0, /*segNum*/2, - /*kind*/0x1000, userSegName); + /*kind*/0x1000, userSegName, bssSize, bssGap); // Step 2: figure out the file offsets we'll need to bake into the // load script. We don't know the ExpressLoad segment's total size @@ -431,8 +458,12 @@ static std::vector emitOmfExpressLoad( put16(elData, 2); // Header info entry for the user segment. + // data length = LCONST data size in the file. emitOneSeg embeds + // bssGap bytes of zero padding + bssSize bytes of BSS-as-zeros in + // the LCONST after the caller's image, so the on-disk data is + // image.size() + bssGap + bssSize bytes. put32(elData, userDataOff); // data offset in file - put32(elData, (uint32_t)image.size()); // data length + put32(elData, (uint32_t)image.size() + bssGap + bssSize); // data length // cRELOC opcodes (if any) are emitted by emitOneSeg directly after // the LCONST data and before the END opcode. Tell ExpressLoad // where they live so the Loader can apply them — without this the @@ -444,7 +475,7 @@ static std::vector emitOmfExpressLoad( } else { const uint32_t crelocBytesPerSite = 7; // 0xF5 + 1+1+2+2 const uint32_t crelocOff = - userDataOff + (uint32_t)image.size(); + userDataOff + (uint32_t)image.size() + bssGap + bssSize; const uint32_t crelocLen = crelocBytesPerSite * (uint32_t)gReloc24Sites.size(); put32(elData, crelocOff); @@ -700,8 +731,10 @@ int main(int argc, char **argv) { } // Load reloc list, if provided. - // Sidecar v2 layout: u32 count + 12 bytes per entry - // { u32 patchOff; u32 offsetRef; u8 byteCnt; u8 pad[3]; } + // Sidecar v3 layout: u32 count + 12 bytes per entry + // { u32 patchOff; u32 offsetRef; u8 byteCnt; u8 bitShift; u8 pad[2]; } + // v2 used pad[3]=0 — v3 keeps the same size by repurposing pad[0] as + // bitShift. v2 sidecars are read transparently (bitShift = pad[0]=0). if (!relocFile.empty()) { auto raw = readFile(relocFile); if (raw.size() < 4) die("--relocs file too small"); @@ -720,14 +753,18 @@ int main(int argc, char **argv) { uint32_t offRef = (uint32_t)raw[off+4] | ((uint32_t)raw[off+5] << 8) | ((uint32_t)raw[off+6] << 16) | ((uint32_t)raw[off+7] << 24); uint8_t byteCnt = raw[off+8]; + uint8_t bitShift = raw[off+9]; if (patchOff > 0xFFFF || offRef > 0xFFFF) die("reloc site out of 16-bit range — segment too large?"); if (byteCnt != 2 && byteCnt != 3) die("reloc site byteCnt=" + std::to_string(byteCnt) + " (must be 2 or 3)"); + if (bitShift != 0 && bitShift != 16) + die("reloc site bitShift=" + std::to_string(bitShift) + " (must be 0 or 16)"); RelocSite s; s.patchOff = (uint16_t)patchOff; s.offsetRef = (uint16_t)offRef; s.byteCnt = byteCnt; + s.bitShift = bitShift; gReloc24Sites.push_back(s); } } @@ -786,9 +823,25 @@ int main(int argc, char **argv) { name = (dot == std::string::npos) ? base_n : base_n.substr(0, dot); } + // Pull BSS info from the link816 .map. We embed BSS as zero bytes + // in the LCONST data so the OMF Loader allocates and fills the + // memory directly (RESSPC zero-fill was unreliable via ExpressLoad + // for KIND=CODE segs). link816 page-aligns __bss_start upward + // from rodata-end so there's typically a gap; we pad with zeros. + uint32_t bssSize = 0, bssStart = 0, bssGap = 0; + auto bssSizeIt = syms.find("__bss_size"); + auto bssStartIt = syms.find("__bss_start"); + if (bssSizeIt != syms.end()) bssSize = bssSizeIt->second; + if (bssStartIt != syms.end()) bssStart = bssStartIt->second; + if (bssStart >= base) { + uint32_t bssOffInImage = bssStart - base; + if (bssOffInImage > image.size()) + bssGap = bssOffInImage - (uint32_t)image.size(); + } + auto blob = expressload - ? emitOmfExpressLoad(image, entryOff, name, stackSize) - : emitOMF(image, entryOff, name, stackSize); + ? emitOmfExpressLoad(image, entryOff, name, stackSize, bssSize, bssGap) + : emitOMF(image, entryOff, name, stackSize, bssSize, bssGap); std::ofstream f(output, std::ios::binary); if (!f) die("cannot open '" + output + "' for writing"); f.write(reinterpret_cast(blob.data()), blob.size()); diff --git a/src/llvm/lib/Target/W65816/AsmParser/W65816AsmParser.cpp b/src/llvm/lib/Target/W65816/AsmParser/W65816AsmParser.cpp index 70deade..18d48f6 100644 --- a/src/llvm/lib/Target/W65816/AsmParser/W65816AsmParser.cpp +++ b/src/llvm/lib/Target/W65816/AsmParser/W65816AsmParser.cpp @@ -377,6 +377,16 @@ bool W65816AsmParser::parseInstruction(ParseInstructionInfo &Info, // If there are no operands, we're done (covers nop, rts, rtl, clc, etc. // and the implied-accumulator forms handled above). if (getLexer().is(AsmToken::EndOfStatement)) { + // Bare shorthand for accumulator-implied shift/rotate/inc/dec. + // The canonical 65816 syntax is `asl a` / `inc a`, but most + // assemblers accept the bare mnemonic. Inject the A register + // operand so the matcher routes to the ASL_A / INA / etc. def. + StringRef Lower = Name.lower(); + if (Lower == "asl" || Lower == "lsr" || Lower == "rol" || + Lower == "ror" || Lower == "inc" || Lower == "dec") { + SMLoc EOS = getLexer().getTok().getLoc(); + Operands.push_back(W65816Operand::createReg(W65816::A, EOS, EOS)); + } Parser.Lex(); return false; } diff --git a/src/llvm/lib/Target/W65816/CMakeLists.txt b/src/llvm/lib/Target/W65816/CMakeLists.txt index b192f7e..e2b7879 100644 --- a/src/llvm/lib/Target/W65816/CMakeLists.txt +++ b/src/llvm/lib/Target/W65816/CMakeLists.txt @@ -42,6 +42,7 @@ add_llvm_target(W65816CodeGen W65816StackRelToImg.cpp W65816StackSlotMerge.cpp W65816TargetMachine.cpp + W65816UnLSR.cpp W65816AsmPrinter.cpp W65816MCInstLower.cpp diff --git a/src/llvm/lib/Target/W65816/MCTargetDesc/W65816AsmBackend.cpp b/src/llvm/lib/Target/W65816/MCTargetDesc/W65816AsmBackend.cpp index c2ec7d9..c9e0875 100644 --- a/src/llvm/lib/Target/W65816/MCTargetDesc/W65816AsmBackend.cpp +++ b/src/llvm/lib/Target/W65816/MCTargetDesc/W65816AsmBackend.cpp @@ -65,6 +65,14 @@ public: case W65816::fixup_24: Width = 3; break; + case W65816::fixup_bank16: + // Patch 2 bytes with (bank, 0) where bank = (Value >> 16) & 0xFF. + // The OMF cRELOC at load time supersedes this static patch with + // the actual placed bank; this branch is the in-static-link + // value when target and patch are in the same segment. + Data[Offset] = static_cast((Value >> 16) & 0xff); + Data[Offset + 1] = 0; + return; default: // Generic FK_Data_* kinds are already handled by the generic code // in the object writer; nothing to patch here. @@ -107,6 +115,7 @@ public: {"fixup_24", 0, 24, 0}, {"fixup_8_pcrel", 0, 8, 0}, {"fixup_16_pcrel", 0, 16, 0}, + {"fixup_bank16", 0, 16, 0}, }; // clang-format on static_assert(std::size(Infos) == W65816::NumTargetFixupKinds, diff --git a/src/llvm/lib/Target/W65816/MCTargetDesc/W65816ELFObjectWriter.cpp b/src/llvm/lib/Target/W65816/MCTargetDesc/W65816ELFObjectWriter.cpp index cd63baa..7d76193 100644 --- a/src/llvm/lib/Target/W65816/MCTargetDesc/W65816ELFObjectWriter.cpp +++ b/src/llvm/lib/Target/W65816/MCTargetDesc/W65816ELFObjectWriter.cpp @@ -57,6 +57,7 @@ protected: case W65816::fixup_24: return 3; // R_W65816_IMM24 case W65816::fixup_8_pcrel: return 4; // R_W65816_PCREL8 case W65816::fixup_16_pcrel: return 5; // R_W65816_PCREL16 + case W65816::fixup_bank16: return 6; // R_W65816_BANK16 case FK_Data_1: return IsPCRel ? 4 : 1; case FK_Data_2: return IsPCRel ? 5 : 2; case FK_Data_4: return 3; // truncated to IMM24 (we have diff --git a/src/llvm/lib/Target/W65816/MCTargetDesc/W65816FixupKinds.h b/src/llvm/lib/Target/W65816/MCTargetDesc/W65816FixupKinds.h index d724bce..f0f0652 100644 --- a/src/llvm/lib/Target/W65816/MCTargetDesc/W65816FixupKinds.h +++ b/src/llvm/lib/Target/W65816/MCTargetDesc/W65816FixupKinds.h @@ -29,6 +29,11 @@ enum Fixups { fixup_8_pcrel, // 16-bit PC-relative fixup (long branch / BRL). fixup_16_pcrel, + // 16-bit fixup that materialises (bankByte, 0) of a 24-bit target + // address into 2 little-endian bytes. Used for the high half of a + // 32-bit pointer constant: `ldx #@bank(symbol)` so &symbol's bank + // byte tracks the OMF Loader's actual placement at runtime. + fixup_bank16, // Marker LastTargetFixupKind, diff --git a/src/llvm/lib/Target/W65816/MCTargetDesc/W65816MCAsmInfo.cpp b/src/llvm/lib/Target/W65816/MCTargetDesc/W65816MCAsmInfo.cpp index 2237658..940cdbb 100644 --- a/src/llvm/lib/Target/W65816/MCTargetDesc/W65816MCAsmInfo.cpp +++ b/src/llvm/lib/Target/W65816/MCTargetDesc/W65816MCAsmInfo.cpp @@ -27,6 +27,13 @@ W65816MCAsmInfo::W65816MCAsmInfo(const Triple &TT) { AlignmentIsInBytes = false; UsesELFSectionDirectiveForBSS = true; + // Recognize the 65xx-traditional `$XX` hex prefix and `%bbb` binary + // prefix. Without this the lexer emits a bare `$` Dollar token + // (which parseExpression treats as the current PC) and silently + // assembles `lda $42` to `lda 0` (caught hand-testing 2026-05-14). + // C-style `0x42` continues to work. + UseMotorolaIntegers = true; + SupportsDebugInformation = true; // C++ exceptions use the SJLJ model. Selecting SJLJ here makes diff --git a/src/llvm/lib/Target/W65816/MCTargetDesc/W65816MCCodeEmitter.cpp b/src/llvm/lib/Target/W65816/MCTargetDesc/W65816MCCodeEmitter.cpp index 27267c2..f8bbf2c 100644 --- a/src/llvm/lib/Target/W65816/MCTargetDesc/W65816MCCodeEmitter.cpp +++ b/src/llvm/lib/Target/W65816/MCTargetDesc/W65816MCCodeEmitter.cpp @@ -66,6 +66,9 @@ class W65816MCCodeEmitter : public MCCodeEmitter { unsigned encodeImm16(const MCInst &MI, unsigned OpIdx, SmallVectorImpl &Fixups, const MCSubtargetInfo &STI) const; + unsigned encodeImm16Bank(const MCInst &MI, unsigned OpIdx, + SmallVectorImpl &Fixups, + const MCSubtargetInfo &STI) const; unsigned encodeAddr8(const MCInst &MI, unsigned OpIdx, SmallVectorImpl &Fixups, const MCSubtargetInfo &STI) const; @@ -160,6 +163,12 @@ unsigned W65816MCCodeEmitter::encodeImm16(const MCInst &MI, unsigned OpIdx, return encodeOperand(MI, OpIdx, 2, W65816::fixup_16, Fixups); } +unsigned W65816MCCodeEmitter::encodeImm16Bank(const MCInst &MI, unsigned OpIdx, + SmallVectorImpl &Fixups, + const MCSubtargetInfo &STI) const { + return encodeOperand(MI, OpIdx, 2, W65816::fixup_bank16, Fixups); +} + unsigned W65816MCCodeEmitter::encodeAddr8(const MCInst &MI, unsigned OpIdx, SmallVectorImpl &Fixups, const MCSubtargetInfo &STI) const { diff --git a/src/llvm/lib/Target/W65816/W65816.h b/src/llvm/lib/Target/W65816/W65816.h index 62f9086..69c8ce7 100644 --- a/src/llvm/lib/Target/W65816/W65816.h +++ b/src/llvm/lib/Target/W65816/W65816.h @@ -124,6 +124,14 @@ FunctionPass *createW65816SjLjFinalize(); // zext that a SDAG-level combine would key off. See W65816NarrowI32Mul.cpp. FunctionPass *createW65816NarrowI32Mul(); +// Post-LSR IR pass: detect pointer-walking loops over GlobalAddress +// bases and rewrite to forward-counter + indexed GEP form. LSR's +// transform is faster for pointer-arg loops (single ptr increment per +// iter via [dp],Y), but for global-array access the W65816 has cheap +// `lda , X` indexed addressing that we'd rather use. See +// W65816UnLSR.cpp. +FunctionPass *createW65816UnLSR(); + // Post-RA, pre-PEI pass: rewrite high-traffic i16 FrameIndex accesses // to use IMG8..15 DP slots ($C0..$CE) instead of stack-rel spills. // Picks K = (number of free IMG8..15) hottest FIs and rewrites their diff --git a/src/llvm/lib/Target/W65816/W65816AsmPrinter.cpp b/src/llvm/lib/Target/W65816/W65816AsmPrinter.cpp index d13d0dd..f063a4b 100644 --- a/src/llvm/lib/Target/W65816/W65816AsmPrinter.cpp +++ b/src/llvm/lib/Target/W65816/W65816AsmPrinter.cpp @@ -301,6 +301,25 @@ void W65816AsmPrinter::emitInstruction(const MachineInstr *MI) { EmitToStreamer(*OutStreamer, Ldx); return; } + case W65816::LDAi16imm_bank: { + // Bank-byte materialization for the HIGH half of a `&symbol` 32-bit + // pointer. At runtime crt0 sets $00:00BE = PBR (placement bank) + // and $00:00BF = 0 (pad), so `lda $BE` in 16-bit M reads the 16-bit + // value $00PBR — exactly the bank|pad word we want. + // + // Why not a fixup_bank16 reloc that the OMF Loader patches? Tried + // first; the Loader's cRELOC `BitShift=16` mechanism doesn't track + // the placed bank (segPlacedBase appears 16-bit-only in the formula + // it actually uses). `lda $BE` is also 2 bytes vs 3 for `lda #imm` + // so this is a size win too. The symbol operand on the pseudo is + // ignored — only the SDNode's value-type matters, which is i16 + // bank|pad. + MCInst Lda; + Lda.setOpcode(W65816::LDA_DP); + Lda.addOperand(MCOperand::createImm(0xBE)); + EmitToStreamer(*OutStreamer, Lda); + return; + } case W65816::LDAi16imm: { // Peek at the next non-debug MI for two peephole patterns: // (1) LDAi16imm 0 + STAabs $g -> STZ_Abs $g (saves 3B) @@ -322,23 +341,30 @@ void W65816AsmPrinter::emitInstruction(const MachineInstr *MI) { if (IsZero && It != MI->getParent()->end() && It->getOpcode() == W65816::STAabs && It->getOperand(0).isReg() && It->getOperand(0).isKill()) { - MCInst Stz; - Stz.setOpcode(W65816::STZ_Abs); - Stz.addOperand(lowerOperand(It->getOperand(1), MCInstLowering)); - EmitToStreamer(*OutStreamer, Stz); - SkipNextStaAbs = true; - return; + // Only collapse to STZ when the address fits in 16 bits. STZ + // has no long-form (24-bit) variant — STZ_Abs is DBR-relative + // 3-byte and would drop a non-zero bank byte. When the user + // writes `*(uint16 *)0xE19E00UL = 0` we MUST keep the + // LDA #0 + STA_Long pair so the bank-explicit form survives. + bool AddrFitsIn16 = !It->getOperand(1).isImm() || + (It->getOperand(1).getImm() & 0xFF0000) == 0; + if (AddrFitsIn16) { + MCInst Stz; + Stz.setOpcode(W65816::STZ_Abs); + Stz.addOperand(lowerOperand(It->getOperand(1), MCInstLowering)); + EmitToStreamer(*OutStreamer, Stz); + SkipNextStaAbs = true; + return; + } } // PEA peephole: LDAi16imm + PUSH16 -> PEA. Safe iff A is dead - // after the PUSH16 — the next instruction must redefine A (so the - // value PUSH16 read is genuinely dead). We use modifiesRegister - // which handles both explicit defs and implicit-defs (e.g. JSL - // clobbers A as part of the calling convention). Falls through - // to a normal LDA #imm; PHA pair if A might be live afterward. - // Note: physreg use-kill flags on PUSH16's implicit-$a are not - // reliably set at AsmPrinter time, so we can't gate on them - // directly; checking the next instruction's def-set is robust. + // after the PUSH16 — the next instruction must redefine A WITHOUT + // reading A first. JSL has implicit-def $a (caller-save) AND + // implicit-use $a when A is an arg (the W65816 calling convention). + // The peephole must NOT fire when the next op USES A: dropping + // the LDA would leave A undefined going into the callee. Same + // shape as the PEI peephole below. if (It != MI->getParent()->end() && It->getOpcode() == W65816::PUSH16) { auto It2 = std::next(It); while (It2 != MI->getParent()->end() && It2->isDebugInstr()) ++It2; @@ -346,7 +372,8 @@ void W65816AsmPrinter::emitInstruction(const MachineInstr *MI) { if (It2 != MI->getParent()->end()) { const TargetRegisterInfo *TRI = MI->getParent()->getParent()->getSubtarget().getRegisterInfo(); - if (It2->modifiesRegister(W65816::A, TRI)) + if (It2->modifiesRegister(W65816::A, TRI) && + !It2->readsRegister(W65816::A, TRI)) ADead = true; } else { // PUSH16 is the last instruction in the BB. A is dead at @@ -451,18 +478,35 @@ void W65816AsmPrinter::emitInstruction(const MachineInstr *MI) { return; } case W65816::LDAabs: { + // Same bank-byte detection as STAabs above. `*(uint16 *)0xE19E00UL` + // needs LDA_Long; `*(uint16 *)0x5000` stays DBR-relative. + const MachineOperand &AddrOp = MI->getOperand(1); + bool UseLong = false; + if (AddrOp.isImm() && (AddrOp.getImm() & 0xFF0000) != 0) + UseLong = true; MCInst Lda; - Lda.setOpcode(W65816::LDA_Abs); - Lda.addOperand(lowerOperand(MI->getOperand(1), MCInstLowering)); + Lda.setOpcode(UseLong ? W65816::LDA_Long : W65816::LDA_Abs); + Lda.addOperand(lowerOperand(AddrOp, MCInstLowering)); EmitToStreamer(*OutStreamer, Lda); return; } case W65816::STAabs: { // STAabs is (outs), (ins Acc16:$src, addr:$addr). The MC STA_Abs // takes only $addr; $src lives in the implicit A. + // + // If the address is an immediate with a non-zero bank byte (e.g. + // `*(uint16 *)0xE19E00UL = v` for an SHR palette write), emit + // STA_Long (4-byte, bank-explicit) instead of STA_Abs (3-byte, + // DBR-relative). Without this the bank byte gets dropped and + // the store lands in whatever bank DBR happens to be — wrong for + // any IIgs hardware region outside bank 0. + const MachineOperand &AddrOp = MI->getOperand(1); + bool UseLong = false; + if (AddrOp.isImm() && (AddrOp.getImm() & 0xFF0000) != 0) + UseLong = true; MCInst Sta; - Sta.setOpcode(W65816::STA_Abs); - Sta.addOperand(lowerOperand(MI->getOperand(1), MCInstLowering)); + Sta.setOpcode(UseLong ? W65816::STA_Long : W65816::STA_Abs); + Sta.addOperand(lowerOperand(AddrOp, MCInstLowering)); EmitToStreamer(*OutStreamer, Sta); return; } @@ -601,6 +645,36 @@ void W65816AsmPrinter::emitInstruction(const MachineInstr *MI) { EmitToStreamer(*OutStreamer, Rep); return; } + case W65816::LDA8absX: { + // i8 indexed-global load: SEP #0x20 ; LDA , X ; REP #0x20 + // X holds the index (set up by CopyToReg before this MI). + MCInst Sep; Sep.setOpcode(W65816::SEP); + Sep.addOperand(MCOperand::createImm(0x20)); + EmitToStreamer(*OutStreamer, Sep); + MCInst Lda; + Lda.setOpcode(W65816::LDA_AbsX); + Lda.addOperand(lowerOperand(MI->getOperand(0), MCInstLowering)); + EmitToStreamer(*OutStreamer, Lda); + MCInst Rep; Rep.setOpcode(W65816::REP); + Rep.addOperand(MCOperand::createImm(0x20)); + EmitToStreamer(*OutStreamer, Rep); + return; + } + case W65816::STA8absX: { + // i8 indexed-global store: SEP #0x20 ; STA , X ; REP #0x20 + // A holds the value, X holds the index. + MCInst Sep; Sep.setOpcode(W65816::SEP); + Sep.addOperand(MCOperand::createImm(0x20)); + EmitToStreamer(*OutStreamer, Sep); + MCInst Sta; + Sta.setOpcode(W65816::STA_AbsX); + Sta.addOperand(lowerOperand(MI->getOperand(0), MCInstLowering)); + EmitToStreamer(*OutStreamer, Sta); + MCInst Rep; Rep.setOpcode(W65816::REP); + Rep.addOperand(MCOperand::createImm(0x20)); + EmitToStreamer(*OutStreamer, Rep); + return; + } case W65816::STA8abs: case W65816::STA8long: { // STA_Abs / STA_Long are 16-bit when M=0, 8-bit when M=1. Pure-i8 diff --git a/src/llvm/lib/Target/W65816/W65816BranchExpand.cpp b/src/llvm/lib/Target/W65816/W65816BranchExpand.cpp index 7fc390b..fd6b5c0 100644 --- a/src/llvm/lib/Target/W65816/W65816BranchExpand.cpp +++ b/src/llvm/lib/Target/W65816/W65816BranchExpand.cpp @@ -245,6 +245,74 @@ static bool splitMultiBranchMBBs(MachineFunction &MF, // when the branches were emitted by the W65816 SELECT_CC inserter or // by codegenprepare on an `br i1 %c, label %X, label %X` IR shape. // Returns true if any MI was deleted. +// Invert a conditional branch when its taken-target equals the +// immediately-following MBB in layout order. Pattern: +// +// MBB ends with: +// Bxx CondTarget +// BRA UncondTarget +// next-laid-out MBB == CondTarget +// +// Rewrite to (no BRA, fall through to CondTarget which is the next MBB): +// +// Bxx_inverted UncondTarget +// +// +// Common pattern: tight loops `beq exit ; bra loop` where the exit +// block is placed right after the loop body. After this, the backedge +// becomes a single `bne loop` (3 cyc taken) instead of `beq exit + bra +// loop` (6 cyc when looping). sumOfSquares hits this 50× per call. +static bool invertCondToFallThrough(MachineFunction &MF, + const TargetInstrInfo *TII) { + bool Changed = false; + auto MBBIt = MF.begin(); + while (MBBIt != MF.end()) { + MachineBasicBlock &MBB = *MBBIt; + auto NextMBB = std::next(MBBIt); + ++MBBIt; + if (NextMBB == MF.end()) { + continue; + } + auto T = MBB.getFirstTerminator(); + if (T == MBB.end()) { + continue; + } + unsigned CondOpc = T->getOpcode(); + unsigned InvOpc = invertedConditional(CondOpc); + if (InvOpc == 0) { + continue; + } + if (T->getNumOperands() < 1 || !T->getOperand(0).isMBB()) { + continue; + } + MachineBasicBlock *CondTarget = T->getOperand(0).getMBB(); + auto N = std::next(T); + if (N == MBB.end()) { + continue; + } + unsigned UncondOpc = N->getOpcode(); + if (UncondOpc != W65816::BRA && UncondOpc != W65816::BRL) { + continue; + } + if (N->getNumOperands() < 1 || !N->getOperand(0).isMBB()) { + continue; + } + MachineBasicBlock *UncondTarget = N->getOperand(0).getMBB(); + if (CondTarget != &*NextMBB) { + continue; + } + if (CondTarget == UncondTarget) { + continue; + } + T->setDesc(TII->get(InvOpc)); + T->getOperand(0).setMBB(UncondTarget); + N->eraseFromParent(); + Changed = true; + } + return Changed; +} + + static bool dropDeadConditionalsToBRATarget(MachineFunction &MF) { bool Changed = false; for (auto &MBB : MF) { @@ -276,6 +344,10 @@ bool W65816BranchExpand::runOnMachineFunction(MachineFunction &MF) { const auto *TII = STI.getInstrInfo(); bool AnyChanged = false; + // Step -1: invert Bxx + BRA when cond target is the next MBB. Saves + // 3 cyc per backedge in tight loops (sumOfSquares 50 iters: -150 cyc). + AnyChanged |= invertCondToFallThrough(MF, TII); + // Step 0: drop dead conditionals (Bxx X immediately followed by BRA X // — both edges to the same MBB). Cheap and removes false-positive // candidates from the distance-based expansion below. diff --git a/src/llvm/lib/Target/W65816/W65816ISelLowering.cpp b/src/llvm/lib/Target/W65816/W65816ISelLowering.cpp index a261bb1..ad3ff9d 100644 --- a/src/llvm/lib/Target/W65816/W65816ISelLowering.cpp +++ b/src/llvm/lib/Target/W65816/W65816ISelLowering.cpp @@ -314,6 +314,23 @@ W65816TargetLowering::W65816TargetLowering(const TargetMachine &TM, setOperationAction(ISD::TRUNCATE, MVT::i8, Custom); setOperationAction(ISD::LOAD, MVT::i32, Custom); setOperationAction(ISD::STORE, MVT::i32, Custom); + // Also Custom for i16/i8 LOAD/STORE in ptr32 mode so LowerLoad/ + // LowerStore can fold Wide32(Wrapper, WrapperBank) of the same + // global (or a raw GlobalAddress) to a plain abs-16 access + // (DBR-relative). Without this, every `g` access for a + // same-segment global goes through the 14-byte [dp],y + // indirect-long path even though the bank is implicit in DBR. + setOperationAction(ISD::STORE, MVT::i16, Custom); + setOperationAction(ISD::STORE, MVT::i8, Custom); + setOperationAction(ISD::LOAD, MVT::i16, Custom); + setOperationAction(ISD::LOAD, MVT::i8, Custom); + // ZEXTLOAD i16-from-i8 also Custom — the DAG combiner folds + // (zext (load i8 @g)) into one zextload SDNode, so we need to + // apply the same global-address fold there. SEXTLOAD/EXTLOAD + // already have Expand actions from earlier setLoadExtAction + // calls; leave those alone (Custom would require parallel + // tablegen patterns we don't have). + setLoadExtAction(ISD::ZEXTLOAD, MVT::i16, MVT::i8, Custom); setOperationAction(ISD::SETCC, MVT::i32, Custom); setOperationAction(ISD::BR_CC, MVT::i32, Custom); setOperationAction(ISD::SELECT_CC, MVT::i32, Custom); @@ -536,6 +553,20 @@ static SDValue extractWide32Lo(SelectionDAG &DAG, const SDLoc &DL, SDValue X) { if (auto *C = dyn_cast(X)) { return DAG.getConstant(C->getZExtValue() & 0xFFFFu, DL, MVT::i16); } + // For un-lowered GlobalAddress / ExternalSymbol nodes (which reach + // here when the store-lowering runs before LowerOperation has split + // the constant into a Wide32 pair), emit a fresh Wrapper / WrapperBank + // pair directly. getTargetExtractSubreg on a GlobalAddress node + // produces a malformed result (no sub-reg info on a non-register). + if (auto *GA = dyn_cast(X)) { + SDValue T = DAG.getTargetGlobalAddress(GA->getGlobal(), DL, MVT::i16, + GA->getOffset()); + return DAG.getNode(W65816ISD::Wrapper, DL, MVT::i16, T); + } + if (auto *ES = dyn_cast(X)) { + SDValue T = DAG.getTargetExternalSymbol(ES->getSymbol(), MVT::i16); + return DAG.getNode(W65816ISD::Wrapper, DL, MVT::i16, T); + } if (SDValue Half = lookThroughRegSeq(X, llvm::sub_lo)) return Half; return DAG.getTargetExtractSubreg(llvm::sub_lo, DL, MVT::i16, X); @@ -544,6 +575,15 @@ static SDValue extractWide32Hi(SelectionDAG &DAG, const SDLoc &DL, SDValue X) { if (auto *C = dyn_cast(X)) { return DAG.getConstant((C->getZExtValue() >> 16) & 0xFFFFu, DL, MVT::i16); } + if (auto *GA = dyn_cast(X)) { + SDValue T = DAG.getTargetGlobalAddress(GA->getGlobal(), DL, MVT::i16, + GA->getOffset()); + return DAG.getNode(W65816ISD::WrapperBank, DL, MVT::i16, T); + } + if (auto *ES = dyn_cast(X)) { + SDValue T = DAG.getTargetExternalSymbol(ES->getSymbol(), MVT::i16); + return DAG.getNode(W65816ISD::WrapperBank, DL, MVT::i16, T); + } if (SDValue Half = lookThroughRegSeq(X, llvm::sub_hi)) return Half; return DAG.getTargetExtractSubreg(llvm::sub_hi, DL, MVT::i16, X); @@ -816,6 +856,58 @@ SDValue W65816TargetLowering::LowerLoad(SDValue Op, return DAG.getMergeValues({Val, NewChain}, DL); } + // Same fold as LowerStore: a Wide32 ptr built from Wrapper + + // WrapperBank of the same global, OR a raw GlobalAddress, lets us + // emit an abs-16 (DBR-relative) load (LDA / LDA8abs) instead of + // the slower [dp],Y indirect-long. Our globals are in the load + // segment that crt0 pins to DBR. + SDValue FoldedLo; + if (auto *GA = dyn_cast(Ptr)) { + FoldedLo = DAG.getNode(W65816ISD::Wrapper, DL, MVT::i16, + DAG.getTargetGlobalAddress(GA->getGlobal(), DL, MVT::i16, + GA->getOffset())); + } else if (auto *ES = dyn_cast(Ptr)) { + FoldedLo = DAG.getNode(W65816ISD::Wrapper, DL, MVT::i16, + DAG.getTargetExternalSymbol(ES->getSymbol(), MVT::i16)); + } else if (Ptr.getNode()->isMachineOpcode() && + Ptr.getMachineOpcode() == TargetOpcode::REG_SEQUENCE) { + SDValue PLo, PHi; + for (unsigned i = 1; i + 1 < Ptr.getNumOperands(); i += 2) { + if (auto *CIdx = dyn_cast(Ptr.getOperand(i + 1))) { + if (CIdx->getZExtValue() == llvm::sub_lo) PLo = Ptr.getOperand(i); + else if (CIdx->getZExtValue() == llvm::sub_hi) PHi = Ptr.getOperand(i); + } + } + if (PLo && PHi && + PLo.getOpcode() == W65816ISD::Wrapper && + PHi.getOpcode() == W65816ISD::WrapperBank) { + SDValue WLo = PLo.getOperand(0); + SDValue WHi = PHi.getOperand(0); + auto *GLo = dyn_cast(WLo); + auto *GHi = dyn_cast(WHi); + auto *ELo = dyn_cast(WLo); + auto *EHi = dyn_cast(WHi); + bool SameGlobal = (GLo && GHi && GLo->getGlobal() == GHi->getGlobal() && + GLo->getOffset() == GHi->getOffset()); + bool SameExtern = (ELo && EHi && + StringRef(ELo->getSymbol()) == EHi->getSymbol()); + if (SameGlobal || SameExtern) + FoldedLo = PLo; + } + } + if (FoldedLo) { + EVT MemVT = Ld->getMemoryVT(); + ISD::LoadExtType ExtType = Ld->getExtensionType(); + if (ExtType == ISD::NON_EXTLOAD && MemVT == Op.getValueType()) { + return DAG.getLoad(Op.getValueType(), DL, Chain, FoldedLo, + Ld->getPointerInfo(), + Ld->getAlign(), + Ld->getMemOperand()->getFlags()); + } + return DAG.getExtLoad(ExtType, DL, Op.getValueType(), Chain, FoldedLo, + MemVT, Ld->getMemOperand()); + } + // ptr16 mode: address is i16, let the default selection handle it. if (Ptr.getValueType() != MVT::i32) return SDValue(); @@ -823,8 +915,14 @@ SDValue W65816TargetLowering::LowerLoad(SDValue Op, EVT MemVT = Ld->getMemoryVT(); SDVTList VTs = DAG.getVTList(MVT::i16, MVT::Other); SDValue Ops[] = { Chain, Ptr }; + // memVT for the LD_PTR memintrinsic must match MMO's size (i8 vs + // i16) — getMemIntrinsicNode asserts memvt.getStoreSize() <= MMO + // size. Pre-fix this branch hardcoded i16 because only i32-result + // LOADs reached here. Now that LOAD i16/i8 are Custom too (so the + // global-fold can fire), byte loads via i32 ptrs land here with + // MemVT=i8 and a 1-byte MMO. SDValue LdNode = DAG.getMemIntrinsicNode(W65816ISD::LD_PTR, DL, VTs, Ops, - MVT::i16, Ld->getMemOperand()); + MemVT, Ld->getMemOperand()); SDValue Val = LdNode; // Byte memory access: mask the high byte for zextload, leave anyext. if (MemVT == MVT::i8) { @@ -1109,6 +1207,65 @@ SDValue W65816TargetLowering::LowerStore(SDValue Op, return StHi; } + // Optimization: if the store goes through a global address (raw + // GlobalAddress/ExternalSymbol, or a Wide32 built from Wrapper + + // WrapperBank of the same symbol), lower to a plain i16/i8 store + // through a single Wrapper@symbol so the tablegen pattern + // (store Acc8/Acc16, (W65816Wrapper tglobaladdr:$g)) + // selects STA8abs / STAabs (DBR-relative). Our globals live in + // the load segment that crt0 pins to DBR, so abs-16 reaches them. + // This avoids the 14-byte [dp],y indirect-long path AND re-enables + // the STZ peephole that the indirect path defeats. + SDValue FoldedLo; + if (auto *GA = dyn_cast(Ptr)) { + FoldedLo = DAG.getNode(W65816ISD::Wrapper, DL, MVT::i16, + DAG.getTargetGlobalAddress(GA->getGlobal(), DL, MVT::i16, + GA->getOffset())); + } else if (auto *ES = dyn_cast(Ptr)) { + FoldedLo = DAG.getNode(W65816ISD::Wrapper, DL, MVT::i16, + DAG.getTargetExternalSymbol(ES->getSymbol(), MVT::i16)); + } else if (Ptr.getNode()->isMachineOpcode() && + Ptr.getMachineOpcode() == TargetOpcode::REG_SEQUENCE) { + SDValue PLo, PHi; + for (unsigned i = 1; i + 1 < Ptr.getNumOperands(); i += 2) { + if (auto *CIdx = dyn_cast(Ptr.getOperand(i + 1))) { + if (CIdx->getZExtValue() == llvm::sub_lo) PLo = Ptr.getOperand(i); + else if (CIdx->getZExtValue() == llvm::sub_hi) PHi = Ptr.getOperand(i); + } + } + if (PLo && PHi && + PLo.getOpcode() == W65816ISD::Wrapper && + PHi.getOpcode() == W65816ISD::WrapperBank) { + SDValue WLo = PLo.getOperand(0); + SDValue WHi = PHi.getOperand(0); + auto *GLo = dyn_cast(WLo); + auto *GHi = dyn_cast(WHi); + auto *ELo = dyn_cast(WLo); + auto *EHi = dyn_cast(WHi); + bool SameGlobal = (GLo && GHi && GLo->getGlobal() == GHi->getGlobal() && + GLo->getOffset() == GHi->getOffset()); + bool SameExtern = (ELo && EHi && + StringRef(ELo->getSymbol()) == EHi->getSymbol()); + if (SameGlobal || SameExtern) + FoldedLo = PLo; + } + } + if (FoldedLo) { + // Preserve memVT — original may be a truncating store (e.g., + // i16 value into i8 memory). getStore picks memVT from Val's + // type, which can mismatch the original MachineMemOperand size. + if (MemVT == Val.getValueType()) { + return DAG.getStore(Chain, DL, Val, FoldedLo, + St->getPointerInfo(), St->getAlign(), + St->getMemOperand()->getFlags()); + } + return DAG.getTruncStore(Chain, DL, Val, FoldedLo, MemVT, + St->getMemOperand()); + } + + // No i32 ptr → nothing for us to do; let the default ISD::STORE + // path handle it. (Also avoids accidentally wrapping an i16 ptr + // store into ST_PTR below, whose ptr operand must be i32.) if (Ptr.getValueType() != MVT::i32) return SDValue(); @@ -1418,20 +1575,20 @@ SDValue W65816TargetLowering::LowerShift(SDValue Op, SelectionDAG &DAG) const { bool IsI32 = Op.getValueType() == MVT::i32; - // Inline i32 shift-by-small-constant. The libcall path is ~300+ cyc; - // unrolling N i16 ops (N <= 4) plus carry propagation runs in ~20-80 - // cyc. popcount, BigInt-style code, and CRC routines all hit this. - // Larger N falls through to the libcall — the unrolled cost grows - // linearly while the libcall is constant. Cutoff chosen empirically: - // N=4 expands to ~32 i16 ops, comparable to the libcall's overhead. - // SRA needs an arithmetic-fill shift on the high half (i16 SRA by 1 - // is tablegen-supported); the low half is filled from the high's - // departing bit just like SRL. + // Inline i32 shift-by-small-constant. The libcall path is ~140 cyc + // (post-tightening); unrolling N i16 ops plus carry propagation runs + // in ~30-90 cyc. popcount, djb2-style hashes, BigInt-style code, and + // CRC routines all hit this. Larger N falls through to the libcall — + // the unrolled cost grows linearly while the libcall is constant. + // Cutoff at N=5 chosen empirically: djb2's `(h << 5) + h` is the + // common one that benefits. SRA needs an arithmetic-fill shift on + // the high half (i16 SRA by 1 is tablegen-supported); the low half is + // filled from the high's departing bit just like SRL. if (IsI32) { if (auto *C = dyn_cast(Amount)) { uint64_t N = C->getZExtValue(); unsigned Op0 = Op.getOpcode(); - if (N >= 1 && N <= 4 && + if (N >= 1 && N <= 5 && (Op0 == ISD::SHL || Op0 == ISD::SRL || Op0 == ISD::SRA)) { SDLoc DL(Op); SDValue X = Op.getOperand(0); @@ -1505,14 +1662,16 @@ SDValue W65816TargetLowering::LowerGlobalAddress(SDValue Op, EVT PtrVT = Op.getValueType(); // i16 in ptr16 mode, i32 in ptr32 mode if (PtrVT == MVT::i32) { // i32 GlobalAddress: build Wide32 from (i16 offset, i16 bank). - // The i16 offset goes through W65816ISD::Wrapper as before — IMM16 - // cRELOC rewrites the offset under Loader. The bank half is set to - // 0 here, but crt0Gsos's $BE-init or a future per-pointer bank - // relocation can be threaded through. TODO: wire bank cRELOC. + // Lo = Wrapper(target) → fixup_16 (offset bytes) + // Hi = WrapperBank(target) → fixup_bank16 (bank byte + 0 pad) + // The linker / OMF Loader patch both halves so the runtime + // pointer reflects the actual placed segment, not the link-time + // text-base. Resolves the long-standing "ldx #0 is hardcoded" + // bug that broke toolbox-call pointer args. SDValue OffTgt = DAG.getTargetGlobalAddress(GA->getGlobal(), DL, MVT::i16, GA->getOffset()); SDValue Lo = DAG.getNode(W65816ISD::Wrapper, DL, MVT::i16, OffTgt); - SDValue Hi = DAG.getConstant(0, DL, MVT::i16); + SDValue Hi = DAG.getNode(W65816ISD::WrapperBank, DL, MVT::i16, OffTgt); return buildWide32(DAG, DL, Lo, Hi); } SDValue Tgt = DAG.getTargetGlobalAddress(GA->getGlobal(), DL, PtrVT, @@ -1528,7 +1687,7 @@ SDValue W65816TargetLowering::LowerExternalSymbol(SDValue Op, if (PtrVT == MVT::i32) { SDValue OffTgt = DAG.getTargetExternalSymbol(ES->getSymbol(), MVT::i16); SDValue Lo = DAG.getNode(W65816ISD::Wrapper, DL, MVT::i16, OffTgt); - SDValue Hi = DAG.getConstant(0, DL, MVT::i16); + SDValue Hi = DAG.getNode(W65816ISD::WrapperBank, DL, MVT::i16, OffTgt); return buildWide32(DAG, DL, Lo, Hi); } SDValue Tgt = DAG.getTargetExternalSymbol(ES->getSymbol(), PtrVT); @@ -2134,6 +2293,60 @@ W65816TargetLowering::PerformDAGCombine(SDNode *N, return DAG.getTruncStore(St->getChain(), DL, St->getValue(), I16Ptr, MemVT, St->getMemOperand()); } + // Global+i16-idx fast path for STORES (companion to the LOAD + // branch below). Ptr = REG_SEQUENCE(ADDC(Wrapper, idx), ADDE(...)). + // Rewrite to CopyToReg($a, val) + CopyToReg($x, idx) + STA_AbsX. + if ((MemVT == MVT::i16 || MemVT == MVT::i8) && + Ptr.getNode() && Ptr.isMachineOpcode() && + Ptr.getMachineOpcode() == TargetOpcode::REG_SEQUENCE) { + SDValue Lo = lookThroughRegSeq(Ptr, llvm::sub_lo); + if (Lo && Lo.getOpcode() == ISD::ADDC) { + auto lookThroughExtractSubLo = [](SDValue V) -> SDValue { + if (V.getNode() && V.isMachineOpcode() && + V.getMachineOpcode() == TargetOpcode::EXTRACT_SUBREG) { + SDValue Src = V.getOperand(0); + if (Src.isMachineOpcode() && + Src.getMachineOpcode() == TargetOpcode::REG_SEQUENCE) { + if (SDValue X = lookThroughRegSeq(Src, llvm::sub_lo)) + return X; + } + } + return V; + }; + SDValue A = lookThroughExtractSubLo(Lo.getOperand(0)); + SDValue B = lookThroughExtractSubLo(Lo.getOperand(1)); + auto isWrapperGlobal = [](SDValue V) { + if (V.getOpcode() != W65816ISD::Wrapper) return false; + unsigned Op = V.getOperand(0).getOpcode(); + return Op == ISD::TargetGlobalAddress || + Op == ISD::TargetExternalSymbol; + }; + SDValue Sym, Idx; + if (isWrapperGlobal(A)) { Sym = A.getOperand(0); Idx = B; } + else if (isWrapperGlobal(B)) { Sym = B.getOperand(0); Idx = A; } + if (Sym && Idx.getValueType() == MVT::i16) { + SelectionDAG &DAG = DCI.DAG; + SDLoc DL(N); + SDValue Chain = St->getChain(); + SDValue Val = St->getValue(); + // STA8absX copies $a register at i16 width (M=0); the SEP + // wraps narrow it. Promote i8 stored value to i16. + if (Val.getValueType() == MVT::i8) + Val = DAG.getNode(ISD::ANY_EXTEND, DL, MVT::i16, Val); + SDValue Glue; + SDValue C1 = DAG.getCopyToReg(Chain, DL, W65816::X, Idx, Glue); + Glue = C1.getValue(1); + SDValue C2 = DAG.getCopyToReg(C1, DL, W65816::A, Val, Glue); + Glue = C2.getValue(1); + SDVTList StaVTs = DAG.getVTList(MVT::Other, MVT::Glue); + unsigned Opc = (MemVT == MVT::i8) ? W65816::STA8absX + : W65816::STA_AbsX; + SDNode *Sta = DAG.getMachineNode(Opc, DL, StaVTs, + {Sym, C2, Glue}); + return SDValue(Sta, 0); + } + } + } } // i8 const-addr → STA8long (timm pattern); i16 const-addr → // STAabs (timm pattern, DBR-relative). Wrap as TargetConstant so @@ -2167,6 +2380,84 @@ W65816TargetLowering::PerformDAGCombine(SDNode *N, Ld->getChain(), I16Ptr, MemVT, Ld->getMemOperand()); } + // Global+i16-idx fast path: Ptr is REG_SEQUENCE produced by + // LowerI32Bin from `(add (Wrapper sym) (zext i16 idx))`. + // sub_lo = ADDC(Wrapper, idx) — operands are TargetExtractSubreg + // wrapping each side's Wide32 + // sub_hi = ADDE(0, 0, carry) — ignored (idx fits in 16 bits, + // so any carry stays in bank) + // Rewrite the LOAD to a CopyToReg($x, idx) + LDA_AbsX(sym) + // sequence. Saves ~45 bytes / ~70 cyc vs the 24-bit [dp],Y deref. + // Correct under the data-bank invariant (DBR = global's bank). + if ((MemVT == MVT::i16 || MemVT == MVT::i8) && + Ptr.getNode() && Ptr.isMachineOpcode() && + Ptr.getMachineOpcode() == TargetOpcode::REG_SEQUENCE) { + SDValue Lo = lookThroughRegSeq(Ptr, llvm::sub_lo); + if (Lo && Lo.getOpcode() == ISD::ADDC) { + auto lookThroughExtractSubLo = [](SDValue V) -> SDValue { + if (V.getNode() && V.isMachineOpcode() && + V.getMachineOpcode() == TargetOpcode::EXTRACT_SUBREG) { + SDValue Src = V.getOperand(0); + if (Src.isMachineOpcode() && + Src.getMachineOpcode() == TargetOpcode::REG_SEQUENCE) { + if (SDValue X = lookThroughRegSeq(Src, llvm::sub_lo)) + return X; + } + } + return V; + }; + SDValue A = lookThroughExtractSubLo(Lo.getOperand(0)); + SDValue B = lookThroughExtractSubLo(Lo.getOperand(1)); + auto isWrapperGlobal = [](SDValue V) { + if (V.getOpcode() != W65816ISD::Wrapper) return false; + unsigned Op = V.getOperand(0).getOpcode(); + return Op == ISD::TargetGlobalAddress || + Op == ISD::TargetExternalSymbol; + }; + SDValue Sym, Idx; + if (isWrapperGlobal(A)) { Sym = A.getOperand(0); Idx = B; } + else if (isWrapperGlobal(B)) { Sym = B.getOperand(0); Idx = A; } + if (Sym && Idx.getValueType() == MVT::i16) { + SelectionDAG &DAG = DCI.DAG; + SDLoc DL(N); + SDValue Chain = Ld->getChain(); + SDValue Glue; + SDValue NewChain = DAG.getCopyToReg(Chain, DL, W65816::X, Idx, + Glue); + Glue = NewChain.getValue(1); + SDVTList LdaVTs = DAG.getVTList(MVT::Other, MVT::Glue); + unsigned Opc = (MemVT == MVT::i8) ? W65816::LDA8absX + : W65816::LDA_AbsX; + SDNode *Lda = DAG.getMachineNode(Opc, DL, LdaVTs, + {Sym, NewChain, Glue}); + SDValue LdaChain = SDValue(Lda, 0); + SDValue LdaGlue = SDValue(Lda, 1); + // Read A as the original LOAD's result VT directly. For + // i8 LOAD with i8 VT: read i8. For i8 LOAD with i16 VT + // (zext/sext): read i16 (high byte is whatever was in $a + // before — wrong for zext, fine for sext, depends on the + // M=8 LDA behavior). M=8 LDA only writes the low byte of + // $a, leaving the high byte intact. Safe wrt liveness + // because we're reading $a immediately after SEP/REP + // around the load, but the high byte is now whatever + // pre-LDA value $a held — for zext we must mask it. + SDValue Val = DAG.getCopyFromReg(LdaChain, DL, W65816::A, + VT, LdaGlue); + SDValue Chain2 = Val.getValue(1); + if (MemVT == MVT::i8 && VT == MVT::i16) { + if (Ld->getExtensionType() == ISD::ZEXTLOAD) { + Val = DAG.getNode(ISD::AND, DL, MVT::i16, Val, + DAG.getConstant(0xFF, DL, MVT::i16)); + } else if (Ld->getExtensionType() == ISD::SEXTLOAD) { + Val = DAG.getNode(ISD::SIGN_EXTEND_INREG, DL, MVT::i16, + Val, DAG.getValueType(MVT::i8)); + } + // EXTLOAD: high byte don't-care, leave alone. + } + return DAG.getMergeValues({Val, Chain2}, DL); + } + } + } } // Only the i8 const-addr path has dedicated tablegen patterns // (LDA8long); skip i16 const-addr loads (no LDAabs imm pattern) diff --git a/src/llvm/lib/Target/W65816/W65816InstrFormats.td b/src/llvm/lib/Target/W65816/W65816InstrFormats.td index cca71c5..cbc7fd9 100644 --- a/src/llvm/lib/Target/W65816/W65816InstrFormats.td +++ b/src/llvm/lib/Target/W65816/W65816InstrFormats.td @@ -99,6 +99,18 @@ def imm16 : Operand { let DecoderMethod = "decodeImm16"; } +// Like imm16, but the encoder emits a fixup_bank16 instead of fixup_16 +// so the linker / OMF Loader patches the operand with (bankByte, 0) of +// the resolved symbol. Used for the high half of `&symbol` 32-bit +// pointer constants — see LDA_Imm16_Bank below. +def imm16_bank : Operand { + let ParserMatchClass = W65816ImmOp<"Imm16">; + let OperandType = "OPERAND_IMMEDIATE"; + let Type = i16; + let EncoderMethod = "encodeImm16Bank"; + let DecoderMethod = "decodeImm16"; +} + def addrDP : Operand { let ParserMatchClass = W65816AddrOp<"AddrDP">; let OperandType = "OPERAND_MEMORY"; @@ -183,6 +195,21 @@ class InstImm16 op, string mnem> let Inst{23-8} = imm; } +// Parallel to InstImm16 but the operand uses the imm16_bank class so +// the encoder attaches a fixup_bank16. Marked isCodeGenOnly so the +// asm matcher never picks it (hand-written .s can't currently express +// a "bank-of-symbol" reference; bring that in via syntax like +// `lda #^foo` later if needed). +class InstImm16Bank op, string mnem> + : W65816Inst<(outs), (ins imm16_bank:$imm), !strconcat(mnem, "\t#$imm")> { + let Size = 3; + let isCodeGenOnly = 1; + bits<16> imm; + bits<24> Inst; + let Inst{7-0} = op; + let Inst{23-8} = imm; +} + class InstDP op, string mnem> : W65816Inst<(outs), (ins addrDP:$addr), !strconcat(mnem, "\t$addr")> { let Size = 2; @@ -267,9 +294,15 @@ class InstDPY op, string mnem> // `(dp)` reads/writes through the pointer at DP+offset. 0x92/0xb2 // `(dp), y` same, then adds Y to form the data address. 0x91/0xb1 // `(dp, x)` adds X to dp first, then dereferences. 0x81/0xa1 +// +// `${addr}` (with curly braces) is the tablegen-recognized form of +// an operand placeholder; with bare `$addr ` you need a trailing +// space to delimit the placeholder from `)` / `]`, which then leaks +// into the printed output as `(0x42 )`. The curly form delimits +// cleanly and round-trips without the cosmetic space. class InstDPInd op, string mnem> : W65816Inst<(outs), (ins addrDP:$addr), - !strconcat(mnem, "\t($addr )")> { + !strconcat(mnem, "\t(${addr})")> { let Size = 2; bits<8> addr; bits<16> Inst; @@ -279,7 +312,7 @@ class InstDPInd op, string mnem> class InstDPIndY op, string mnem> : W65816Inst<(outs), (ins addrDP:$addr), - !strconcat(mnem, "\t($addr ), y")> { + !strconcat(mnem, "\t(${addr}), y")> { let Size = 2; bits<8> addr; bits<16> Inst; @@ -289,7 +322,7 @@ class InstDPIndY op, string mnem> class InstDPIndX op, string mnem> : W65816Inst<(outs), (ins addrDP:$addr), - !strconcat(mnem, "\t($addr , x)")> { + !strconcat(mnem, "\t(${addr}, x)")> { let Size = 2; bits<8> addr; bits<16> Inst; @@ -303,7 +336,35 @@ class InstDPIndX op, string mnem> // through a function-pointer slot. class InstAbsInd op, string mnem> : W65816Inst<(outs), (ins addrAbs:$addr), - !strconcat(mnem, "\t($addr )")> { + !strconcat(mnem, "\t(${addr})")> { + let Size = 3; + bits<16> addr; + bits<24> Inst; + let Inst{7-0} = op; + let Inst{23-8} = addr; +} + +// Absolute indexed-indirect-X: `JMP (addr, X)` (opcode 0x7C). Adds X +// to addr first, then reads the 16-bit pointer at that location and +// jumps there. Useful for jump tables when the base address is known +// at assembly time. +class InstAbsIndX op, string mnem> + : W65816Inst<(outs), (ins addrAbs:$addr), + !strconcat(mnem, "\t(${addr}, x)")> { + let Size = 3; + bits<16> addr; + bits<24> Inst; + let Inst{7-0} = op; + let Inst{23-8} = addr; +} + +// Absolute long-indirect: `JMP [addr]` (opcode 0xDC). Reads a 24-bit +// pointer from absolute address `addr` and jumps to that full bank+ +// offset address. Square brackets distinguish from the 16-bit +// indirect form. +class InstAbsIndLong op, string mnem> + : W65816Inst<(outs), (ins addrAbs:$addr), + !strconcat(mnem, "\t[${addr}]")> { let Size = 3; bits<16> addr; bits<24> Inst; @@ -317,7 +378,7 @@ class InstAbsInd op, string mnem> // syntax — round parens are reserved for 16-bit indirection. class InstDPIndLong op, string mnem> : W65816Inst<(outs), (ins addrDP:$addr), - !strconcat(mnem, "\t[$addr ]")> { + !strconcat(mnem, "\t[${addr}]")> { let Size = 2; bits<8> addr; bits<16> Inst; @@ -327,7 +388,7 @@ class InstDPIndLong op, string mnem> class InstDPIndLongY op, string mnem> : W65816Inst<(outs), (ins addrDP:$addr), - !strconcat(mnem, "\t[$addr ], y")> { + !strconcat(mnem, "\t[${addr}], y")> { let Size = 2; bits<8> addr; bits<16> Inst; diff --git a/src/llvm/lib/Target/W65816/W65816InstrInfo.td b/src/llvm/lib/Target/W65816/W65816InstrInfo.td index f678d8a..4416a1b 100644 --- a/src/llvm/lib/Target/W65816/W65816InstrInfo.td +++ b/src/llvm/lib/Target/W65816/W65816InstrInfo.td @@ -23,6 +23,13 @@ def SDT_W65816CallSeqStart : SDCallSeqStart<[SDTCisVT<0, i16>, def SDT_W65816CallSeqEnd : SDCallSeqEnd<[SDTCisVT<0, i16>, SDTCisVT<1, i16>]>; def SDT_W65816Wrapper : SDTypeProfile<1, 1, [SDTCisSameAs<0, 1>, SDTCisPtrTy<0>]>; +// Wrapper for the BANK byte of a 24-bit address (high half of a 32-bit +// pointer constant). Result is i16: low byte = bank, high byte = 0 +// pad. The MC encoder emits a fixup_bank16 so the linker / OMF Loader +// fills in the actual bank at load time, tracking whatever the GS/OS +// Loader chose for our segment. +def SDT_W65816WrapperBank : SDTypeProfile<1, 1, [SDTCisVT<0, i16>, + SDTCisVT<1, i16>]>; def SDT_W65816Cmp : SDTypeProfile<0, 2, [SDTCisSameAs<0, 1>, SDTCisInt<0>]>; // (CMP allows both i16 and i8 operands.) @@ -47,6 +54,7 @@ def W65816callseq_end : [SDNPHasChain, SDNPOptInGlue, SDNPOutGlue]>; def W65816Wrapper : SDNode<"W65816ISD::Wrapper", SDT_W65816Wrapper>; +def W65816WrapperBank : SDNode<"W65816ISD::WrapperBank", SDT_W65816WrapperBank>; // Comparison: produces a Glue value (carrying processor flags). def W65816cmp : SDNode<"W65816ISD::CMP", SDT_W65816Cmp, [SDNPOutGlue]>; @@ -243,6 +251,20 @@ def : Pat<(i16 (W65816Wrapper tglobaladdr:$g)), def : Pat<(i16 (W65816Wrapper texternalsym:$s)), (LDAi16imm texternalsym:$s)>; +// Materialise the BANK byte of a global / external symbol into A. +// Same encoding as LDAi16imm (a plain `lda #imm`), but the AsmPrinter +// expansion attaches a fixup_bank16 to the immediate so the linker +// patches it with (bank, 0) of the resolved symbol — and OMF cRELOC +// updates it at Loader time to the actual placed bank. +let hasSideEffects = 0, mayLoad = 0, mayStore = 0, isReMaterializable = 1 in +def LDAi16imm_bank : W65816Pseudo<(outs Acc16:$dst), (ins i16imm:$imm), + "# LDAi16imm_bank $dst, $imm", []>; + +def : Pat<(i16 (W65816WrapperBank tglobaladdr:$g)), + (LDAi16imm_bank tglobaladdr:$g)>; +def : Pat<(i16 (W65816WrapperBank texternalsym:$s)), + (LDAi16imm_bank texternalsym:$s)>; + // 8-bit add/sub of an immediate. let Constraints = "$src = $dst", hasSideEffects = 0, mayLoad = 0, mayStore = 0 in { @@ -279,6 +301,16 @@ def LDA8abs : W65816Pseudo<(outs Acc8:$dst), (ins i32imm:$addr), // section (must appear after ANDi16imm is defined). def LDA8long : W65816Pseudo<(outs Acc8:$dst), (ins i32imm:$addr), "# LDA8long $dst, $addr", []>; +// LDA8absX: i8 indexed global load. Sibling of LDA_AbsX for the +// i16 case; produced by the PerformDAGCombine i8 path when a global +// array's byte-element access has been recovered into (load (add +// Wrapper, i16-idx)) form. AsmPrinter expands to: +// SEP #0x20 ; LDA , X ; REP #0x20 +// idx is in $x at entry (set up by CopyToReg); the loaded value +// arrives in $a implicitly (matches LDA_AbsX's shape). +let Defs = [A], Uses = [X] in +def LDA8absX : W65816Pseudo<(outs), (ins i32imm:$addr), + "# LDA8absX $addr", []>; } let mayStore = 1, hasSideEffects = 0, mayLoad = 0 in { def STA8abs : W65816Pseudo<(outs), (ins Acc8:$src, i32imm:$addr), @@ -290,6 +322,12 @@ def STA8abs : W65816Pseudo<(outs), (ins Acc8:$src, i32imm:$addr), // physical address. See the (store Acc8, (iPTR imm)) pattern. def STA8long : W65816Pseudo<(outs), (ins Acc8:$src, i32imm:$addr), "# STA8long $src, $addr", []>; +// STA8absX: i8 indexed global store (sibling of STA_AbsX for i16). +// AsmPrinter emits SEP/REP wrap around STA , X. +// $a holds the byte, $x holds the index. +let Uses = [A, X] in +def STA8absX : W65816Pseudo<(outs), (ins i32imm:$addr), + "# STA8absX $addr", []>; } def : Pat<(i8 (load (W65816Wrapper tglobaladdr:$g))), (LDA8abs tglobaladdr:$g)>; @@ -346,21 +384,15 @@ def : Pat<(store Acc16:$src, (W65816Wrapper tglobaladdr:$g)), (STAabs Acc16:$src, tglobaladdr:$g)>; def : Pat<(store Acc16:$src, (W65816Wrapper texternalsym:$s)), (STAabs Acc16:$src, texternalsym:$s)>; -// Store via a constant-int address (`*(volatile uint16 *)0x5000 = v`). -// Lowers to STAabs (0x8D, DBR-relative) — DELIBERATELY asymmetric with the -// i8 case (STA8long, bank-explicit). Rationale: most 65816 MMIO is i8 -// (e.g. `*(uint8*)0xC035`) where users expect bank=0 always. Const-int -// i16 is mostly used as a DBR-relative idiom in test code that switches -// DBR and verifies a write lands in the new bank. Switching i16 to -// bank-explicit broke 10+ existing tests with no real-world i16 MMIO -// use case to justify it. Users who need bank-explicit i16 should -// declare a global or split into two i8 stores. +// Const-int address stores route through STAabs; AsmPrinter detects +// at emit time whether the constant has a non-zero bank byte and +// emits STA_Long (4 bytes, bank-explicit) for those, STA_Abs (3 +// bytes, DBR-relative) for the bank-0 ones. Splitting the pattern +// in TableGen via ImmLeaf is brittle around `imm` vs `timm` (ptr32 +// codegen alternates between ConstantSDNode and TargetConstantSDNode); +// the AsmPrinter dispatch is simpler and uniform. def : Pat<(store Acc16:$src, (iPTR imm:$addr)), (STAabs Acc16:$src, (i32 imm:$addr))>; -// Under ptr32 the i16/i32 const-addr stores emerge with TargetConstant -// pointers (the PerformDAGCombine on STORE rewrites the ConstantSDNode -// into a TargetConstant to bypass LowerI32Constant's REG_SEQUENCE -// expansion). Match `timm` so STAabs fires. def : Pat<(store Acc16:$src, (iPTR timm:$addr)), (STAabs Acc16:$src, (i32 timm:$addr))>; @@ -1309,6 +1341,15 @@ def XBA : InstImplied<0xEB, "xba"> { let mayLoad = 0; let mayStore = 0; } def WAI : InstImplied<0xCB, "wai">; def STP : InstImplied<0xDB, "stp">; +// BRK / COP — software interrupts. Both are 2-byte instructions +// (opcode + signature byte). The CPU pushes the return address + +// status flags and vectors through the BRK/COP handler at +// $00FFE6/$00FFE4 (native mode). Signature byte is available to +// the handler via the pushed PC. We never select these from IR; +// they exist purely so hand-written runtime/inline asm can use them. +def BRK : InstImm8<0x00, "brk">; +def COP : InstImm8<0x02, "cop">; + // WDM (William D Mensch) — reserved 2-byte NOP-equivalent. Useful as // a debugger / emulator hook: MAME's apple2gs CPU traps on WDM and a // Lua plugin can dispatch on the operand byte. CPU-side, it acts as @@ -1337,12 +1378,17 @@ def PEI_DP : InstDP<0xD4, "pei">; // explicitly once we have 8-bit patterns. def LDA_Imm8 : InstImm8<0xA9, "lda"> { let MHigh = 1; let DecoderNamespace = "W65816MHigh"; let isCodeGenOnly = 1; let Defs = [A]; } def LDA_Imm16 : InstImm16<0xA9, "lda"> { let MLow = 1; let Defs = [A]; } +// Same opcode/encoding as LDA_Imm16, but the operand emits a fixup_bank16 +// so the linker / OMF Loader fills in (bankByte, 0) of the symbol. +// Used by the LDAi16imm_bank pseudo for materializing the high half of +// a 32-bit `&symbol` pointer constant. +def LDA_Imm16_Bank : InstImm16Bank<0xA9, "lda"> { let MLow = 1; let Defs = [A]; } def LDA_DP : InstDP<0xA5, "lda">; def LDA_Abs : InstAbs<0xAD, "lda">; def LDA_Long : InstAbsLong<0xAF, "lda">; -def LDA_DPX : InstDPX<0xB5, "lda">; -def LDA_AbsX : InstAbsX<0xBD, "lda">; -def LDA_AbsY : InstAbsY<0xB9, "lda">; +def LDA_DPX : InstDPX<0xB5, "lda"> { let Defs = [A]; let Uses = [X]; } +def LDA_AbsX : InstAbsX<0xBD, "lda"> { let Defs = [A]; let Uses = [X]; } +def LDA_AbsY : InstAbsY<0xB9, "lda"> { let Defs = [A]; let Uses = [Y]; } def LDA_DPInd : InstDPInd <0xB2, "lda">; def LDA_DPIndY : InstDPIndY<0xB1, "lda">; def LDA_DPIndX : InstDPIndX<0xA1, "lda">; @@ -1358,9 +1404,9 @@ def LDA_LongX : InstAbsLongX<0xBF, "lda">; def STA_DP : InstDP<0x85, "sta">; def STA_Abs : InstAbs<0x8D, "sta">; def STA_Long : InstAbsLong<0x8F, "sta">; -def STA_DPX : InstDPX<0x95, "sta">; -def STA_AbsX : InstAbsX<0x9D, "sta">; -def STA_AbsY : InstAbsY<0x99, "sta">; +def STA_DPX : InstDPX<0x95, "sta"> { let Uses = [A, X]; } +def STA_AbsX : InstAbsX<0x9D, "sta"> { let Uses = [A, X]; } +def STA_AbsY : InstAbsY<0x99, "sta"> { let Uses = [A, Y]; } def STA_DPInd : InstDPInd <0x92, "sta">; def STA_DPIndY : InstDPIndY<0x91, "sta">; def STA_DPIndX : InstDPIndX<0x81, "sta">; @@ -1412,6 +1458,13 @@ def ADC_Abs : InstAbs<0x6D, "adc">; def ADC_DPX : InstDPX<0x75, "adc">; def ADC_AbsX : InstAbsX<0x7D, "adc">; def ADC_AbsY : InstAbsY<0x79, "adc">; +def ADC_Long : InstAbsLong<0x6F, "adc">; +def ADC_LongX : InstAbsLongX<0x7F, "adc">; +def ADC_DPInd : InstDPInd<0x72, "adc">; +def ADC_DPIndY : InstDPIndY<0x71, "adc">; +def ADC_DPIndX : InstDPIndX<0x61, "adc">; +def ADC_DPIndLong : InstDPIndLong<0x67, "adc">; +def ADC_DPIndLongY : InstDPIndLongY<0x77, "adc">; //------------------------------------------------------------------------- SBC def SBC_Imm8 : InstImm8<0xE9, "sbc"> { let MHigh = 1; let DecoderNamespace = "W65816MHigh"; let isCodeGenOnly = 1; } @@ -1421,6 +1474,13 @@ def SBC_Abs : InstAbs<0xED, "sbc">; def SBC_DPX : InstDPX<0xF5, "sbc">; def SBC_AbsX : InstAbsX<0xFD, "sbc">; def SBC_AbsY : InstAbsY<0xF9, "sbc">; +def SBC_Long : InstAbsLong<0xEF, "sbc">; +def SBC_LongX : InstAbsLongX<0xFF, "sbc">; +def SBC_DPInd : InstDPInd<0xF2, "sbc">; +def SBC_DPIndY : InstDPIndY<0xF1, "sbc">; +def SBC_DPIndX : InstDPIndX<0xE1, "sbc">; +def SBC_DPIndLong : InstDPIndLong<0xE7, "sbc">; +def SBC_DPIndLongY : InstDPIndLongY<0xF7, "sbc">; //------------------------------------------------------------------------- CMP def CMP_Imm8 : InstImm8<0xC9, "cmp"> { let MHigh = 1; let mayLoad=0; let mayStore=0; let DecoderNamespace = "W65816MHigh"; let isCodeGenOnly = 1; } @@ -1430,6 +1490,13 @@ def CMP_Abs : InstAbs<0xCD, "cmp"> { let mayStore = 0; } def CMP_DPX : InstDPX<0xD5, "cmp"> { let mayStore = 0; } def CMP_AbsX : InstAbsX<0xDD, "cmp"> { let mayStore = 0; } def CMP_AbsY : InstAbsY<0xD9, "cmp"> { let mayStore = 0; } +def CMP_Long : InstAbsLong<0xCF, "cmp"> { let mayStore = 0; } +def CMP_LongX : InstAbsLongX<0xDF, "cmp"> { let mayStore = 0; } +def CMP_DPInd : InstDPInd<0xD2, "cmp"> { let mayStore = 0; } +def CMP_DPIndY : InstDPIndY<0xD1, "cmp"> { let mayStore = 0; } +def CMP_DPIndX : InstDPIndX<0xC1, "cmp"> { let mayStore = 0; } +def CMP_DPIndLong : InstDPIndLong<0xC7, "cmp"> { let mayStore = 0; } +def CMP_DPIndLongY : InstDPIndLongY<0xD7, "cmp"> { let mayStore = 0; } //---------------------------------------------------------------- CPX/CPY def CPX_Imm8 : InstImm8<0xE0, "cpx"> { let XHigh = 1; let mayLoad=0; let mayStore=0; let DecoderNamespace = "W65816XHigh"; let isCodeGenOnly = 1; } @@ -1446,21 +1513,53 @@ def AND_Imm8 : InstImm8<0x29, "and"> { let MHigh = 1; let mayLoad=0; let maySt def AND_Imm16 : InstImm16<0x29, "and"> { let MLow = 1; let mayLoad=0; let mayStore=0; } def AND_DP : InstDP<0x25, "and"> { let mayStore = 0; } def AND_Abs : InstAbs<0x2D, "and"> { let mayStore = 0; } +def AND_DPX : InstDPX<0x35, "and"> { let mayStore = 0; } +def AND_AbsX : InstAbsX<0x3D, "and"> { let mayStore = 0; } +def AND_AbsY : InstAbsY<0x39, "and"> { let mayStore = 0; } +def AND_Long : InstAbsLong<0x2F, "and"> { let mayStore = 0; } +def AND_LongX : InstAbsLongX<0x3F, "and"> { let mayStore = 0; } +def AND_DPInd : InstDPInd<0x32, "and"> { let mayStore = 0; } +def AND_DPIndY : InstDPIndY<0x31, "and"> { let mayStore = 0; } +def AND_DPIndX : InstDPIndX<0x21, "and"> { let mayStore = 0; } +def AND_DPIndLong : InstDPIndLong<0x27, "and"> { let mayStore = 0; } +def AND_DPIndLongY : InstDPIndLongY<0x37, "and"> { let mayStore = 0; } def ORA_Imm8 : InstImm8<0x09, "ora"> { let MHigh = 1; let mayLoad=0; let mayStore=0; let DecoderNamespace = "W65816MHigh"; let isCodeGenOnly = 1; } def ORA_Imm16 : InstImm16<0x09, "ora"> { let MLow = 1; let mayLoad=0; let mayStore=0; } def ORA_DP : InstDP<0x05, "ora"> { let mayStore = 0; } def ORA_Abs : InstAbs<0x0D, "ora"> { let mayStore = 0; } +def ORA_DPX : InstDPX<0x15, "ora"> { let mayStore = 0; } +def ORA_AbsX : InstAbsX<0x1D, "ora"> { let mayStore = 0; } +def ORA_AbsY : InstAbsY<0x19, "ora"> { let mayStore = 0; } +def ORA_Long : InstAbsLong<0x0F, "ora"> { let mayStore = 0; } +def ORA_LongX : InstAbsLongX<0x1F, "ora"> { let mayStore = 0; } +def ORA_DPInd : InstDPInd<0x12, "ora"> { let mayStore = 0; } +def ORA_DPIndY : InstDPIndY<0x11, "ora"> { let mayStore = 0; } +def ORA_DPIndX : InstDPIndX<0x01, "ora"> { let mayStore = 0; } +def ORA_DPIndLong : InstDPIndLong<0x07, "ora"> { let mayStore = 0; } +def ORA_DPIndLongY : InstDPIndLongY<0x17, "ora"> { let mayStore = 0; } def EOR_Imm8 : InstImm8<0x49, "eor"> { let MHigh = 1; let mayLoad=0; let mayStore=0; let DecoderNamespace = "W65816MHigh"; let isCodeGenOnly = 1; } def EOR_Imm16 : InstImm16<0x49, "eor"> { let MLow = 1; let mayLoad=0; let mayStore=0; } def EOR_DP : InstDP<0x45, "eor"> { let mayStore = 0; } def EOR_Abs : InstAbs<0x4D, "eor"> { let mayStore = 0; } +def EOR_DPX : InstDPX<0x55, "eor"> { let mayStore = 0; } +def EOR_AbsX : InstAbsX<0x5D, "eor"> { let mayStore = 0; } +def EOR_AbsY : InstAbsY<0x59, "eor"> { let mayStore = 0; } +def EOR_Long : InstAbsLong<0x4F, "eor"> { let mayStore = 0; } +def EOR_LongX : InstAbsLongX<0x5F, "eor"> { let mayStore = 0; } +def EOR_DPInd : InstDPInd<0x52, "eor"> { let mayStore = 0; } +def EOR_DPIndY : InstDPIndY<0x51, "eor"> { let mayStore = 0; } +def EOR_DPIndX : InstDPIndX<0x41, "eor"> { let mayStore = 0; } +def EOR_DPIndLong : InstDPIndLong<0x47, "eor"> { let mayStore = 0; } +def EOR_DPIndLongY : InstDPIndLongY<0x57, "eor"> { let mayStore = 0; } def BIT_Imm8 : InstImm8<0x89, "bit"> { let MHigh = 1; let mayLoad=0; let mayStore=0; let DecoderNamespace = "W65816MHigh"; let isCodeGenOnly = 1; } def BIT_Imm16 : InstImm16<0x89, "bit"> { let MLow = 1; let mayLoad=0; let mayStore=0; } def BIT_DP : InstDP<0x24, "bit"> { let mayStore = 0; } def BIT_Abs : InstAbs<0x2C, "bit"> { let mayStore = 0; } +def BIT_DPX : InstDPX<0x34, "bit"> { let mayStore = 0; } +def BIT_AbsX : InstAbsX<0x3C, "bit"> { let mayStore = 0; } //---------------------------------------------------------------- INC/DEC def INA : InstImplied<0x1A, "inc a"> { let mayLoad = 0; let mayStore = 0; } @@ -1485,14 +1584,22 @@ def ASL_A : InstImplied<0x0A, "asl a"> { let mayLoad = 0; let mayStore = 0; def LSR_A : InstImplied<0x4A, "lsr a"> { let mayLoad = 0; let mayStore = 0; } def ROL_A : InstImplied<0x2A, "rol a"> { let mayLoad = 0; let mayStore = 0; } def ROR_A : InstImplied<0x6A, "ror a"> { let mayLoad = 0; let mayStore = 0; } -def ASL_DP : InstDP<0x06, "asl">; -def ASL_Abs : InstAbs<0x0E, "asl">; -def LSR_DP : InstDP<0x46, "lsr">; -def LSR_Abs : InstAbs<0x4E, "lsr">; -def ROL_DP : InstDP<0x26, "rol">; -def ROL_Abs : InstAbs<0x2E, "rol">; -def ROR_DP : InstDP<0x66, "ror">; -def ROR_Abs : InstAbs<0x6E, "ror">; +def ASL_DP : InstDP<0x06, "asl">; +def ASL_Abs : InstAbs<0x0E, "asl">; +def ASL_DPX : InstDPX<0x16, "asl">; +def ASL_AbsX : InstAbsX<0x1E, "asl">; +def LSR_DP : InstDP<0x46, "lsr">; +def LSR_Abs : InstAbs<0x4E, "lsr">; +def LSR_DPX : InstDPX<0x56, "lsr">; +def LSR_AbsX : InstAbsX<0x5E, "lsr">; +def ROL_DP : InstDP<0x26, "rol">; +def ROL_Abs : InstAbs<0x2E, "rol">; +def ROL_DPX : InstDPX<0x36, "rol">; +def ROL_AbsX : InstAbsX<0x3E, "rol">; +def ROR_DP : InstDP<0x66, "ror">; +def ROR_Abs : InstAbs<0x6E, "ror">; +def ROR_DPX : InstDPX<0x76, "ror">; +def ROR_AbsX : InstAbsX<0x7E, "ror">; //---------------------------------------------------------------- Transfers // Defs/Uses metadata is critical: without it, machine-cp doesn't see @@ -1552,9 +1659,11 @@ def BVC : InstPCRel8<0x50, "bvc">; let isBranch = 1, isTerminator = 1, isBarrier = 1, mayLoad = 0, mayStore = 0 in { def BRA : InstPCRel8<0x80, "bra">; def BRL : InstPCRel16<0x82, "brl">; -def JMP_Abs : InstAbs<0x4C, "jmp">; -def JMP_AbsInd : InstAbsInd<0x6C, "jmp">; -def JML_Long : InstAbsLong<0x5C, "jml">; +def JMP_Abs : InstAbs<0x4C, "jmp">; +def JMP_AbsInd : InstAbsInd<0x6C, "jmp">; +def JMP_AbsIndX : InstAbsIndX<0x7C, "jmp">; +def JMP_AbsIndLong : InstAbsIndLong<0xDC, "jmp">; +def JML_Long : InstAbsLong<0x5C, "jml">; } //---------------------------------------------------------------- Calls @@ -1609,6 +1718,12 @@ def EOR_StackRel : InstStackRel<0x43, "eor">; // Stack-relative indirect indexed-Y: deref a pointer spilled at S+off. def LDA_StackRelIndY : InstStackRelIndY<0xB3, "lda">; def STA_StackRelIndY : InstStackRelIndY<0x93, "sta">; +def ADC_StackRelIndY : InstStackRelIndY<0x73, "adc">; +def SBC_StackRelIndY : InstStackRelIndY<0xF3, "sbc">; +def CMP_StackRelIndY : InstStackRelIndY<0xD3, "cmp">; +def AND_StackRelIndY : InstStackRelIndY<0x33, "and">; +def ORA_StackRelIndY : InstStackRelIndY<0x13, "ora">; +def EOR_StackRelIndY : InstStackRelIndY<0x53, "eor">; // Pseudo: conditional-increment of the hi half of an i32 spilled to a // pair of stack-rel slots. Emitted by W65816I32IncFold when the diff --git a/src/llvm/lib/Target/W65816/W65816NarrowI32Mul.cpp b/src/llvm/lib/Target/W65816/W65816NarrowI32Mul.cpp index e4357fd..f2e1292 100644 --- a/src/llvm/lib/Target/W65816/W65816NarrowI32Mul.cpp +++ b/src/llvm/lib/Target/W65816/W65816NarrowI32Mul.cpp @@ -25,6 +25,7 @@ //===---------------------------------------------------------------------===// #include "W65816.h" +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/ScalarEvolution.h" #include "llvm/InitializePasses.h" @@ -151,7 +152,7 @@ bool W65816NarrowI32Mul::runOnFunction(Function &F) { }; FunctionCallee Callee = getUmulhisi3(*M); - SmallVector MaybeDead; + SmallPtrSet MaybeDeadSet; for (BinaryOperator *BO : Worklist) { IRBuilder<> B(BO); Value *AOp = BO->getOperand(0); @@ -162,12 +163,13 @@ bool W65816NarrowI32Mul::runOnFunction(Function &F) { BO->replaceAllUsesWith(Call); BO->eraseFromParent(); // If the original operands were zext/sext nodes, they may now be - // dead. Add them to the cleanup worklist. - if (auto *I = dyn_cast(AOp)) MaybeDead.push_back(I); - if (auto *I = dyn_cast(BOp)) MaybeDead.push_back(I); + // dead. Add to a SET — `mul %x, %x` would push the same node + // twice, and the cleanup loop would then double-free. + if (auto *I = dyn_cast(AOp)) MaybeDeadSet.insert(I); + if (auto *I = dyn_cast(BOp)) MaybeDeadSet.insert(I); } // Cleanup: any extension that's now use-less can be deleted. - for (Instruction *I : MaybeDead) { + for (Instruction *I : MaybeDeadSet) { if (I->use_empty() && (isa(I) || isa(I) || isa(I))) { I->eraseFromParent(); diff --git a/src/llvm/lib/Target/W65816/W65816StackRelToImg.cpp b/src/llvm/lib/Target/W65816/W65816StackRelToImg.cpp index d78d6ed..e3a1633 100644 --- a/src/llvm/lib/Target/W65816/W65816StackRelToImg.cpp +++ b/src/llvm/lib/Target/W65816/W65816StackRelToImg.cpp @@ -139,14 +139,16 @@ bool W65816StackRelToImg::runOnMachineFunction(MachineFunction &MF) { // be from FP not SP and the PHP-wrap +1 adjustment differs. if (MF.getFrameInfo().hasVarSizedObjects()) return false; - // 2. Bail if the function has any non-IMG-safe call. + // 2. Bail if the function has any non-IMG-safe call (would clobber + // our IMG0..7 promotions) or is recursive (same). Tried allowing + // IMG8..15 + ImgCalleeSave fallback for these cases (gained 12 + // inst on evalAt), but broke sprintf and fib due to subtle + // interactions with ImgCalleeSave's slot allocation. Reverted. StringRef SelfName = MF.getName(); for (MachineBasicBlock &MBB : MF) { for (MachineInstr &MI : MBB) { if (!MI.isCall()) continue; if (!isImgSafeCall(MI)) return false; - // Skip self-recursion too — caller-save semantics would lose - // values across the recursive call. for (const MachineOperand &MO : MI.operands()) { StringRef Name; if (MO.isGlobal()) Name = MO.getGlobal()->getName(); @@ -156,6 +158,7 @@ bool W65816StackRelToImg::runOnMachineFunction(MachineFunction &MF) { } } } + uint8_t imgBase = 0xD0; // 3. Count stack-rel accesses per offset. CRITICAL: the stack // pointer shifts during the function due to PHP/PLP (+1 byte) and @@ -287,11 +290,11 @@ bool W65816StackRelToImg::runOnMachineFunction(MachineFunction &MF) { if (AccessCount.empty()) return false; - // 3b. Scan for existing DP-immediate usage in $D0..$DE. Regalloc / - // backend may have already used these slots (via STX_DP / STA_DP / - // LDA_DP with imm in 0xD0..0xDE) for spills or COPY-via-DP patterns. - // Don't double-use those slots. - auto dpImmInRange = [](const MachineInstr &MI) -> int { + // 3b. Scan for existing DP-immediate usage in [imgBase..imgBase+0xE]. + // Regalloc / backend may have already used these slots (via STX_DP / + // STA_DP / LDA_DP) for spills or COPY-via-DP patterns. Don't + // double-use those slots. + auto dpImmInRange = [&](const MachineInstr &MI) -> int { unsigned Op = MI.getOpcode(); switch (Op) { case W65816::LDA_DP: case W65816::STA_DP: @@ -302,8 +305,8 @@ bool W65816StackRelToImg::runOnMachineFunction(MachineFunction &MF) { case W65816::STZ_DP: if (MI.getNumOperands() >= 1 && MI.getOperand(0).isImm()) { int64_t I = MI.getOperand(0).getImm(); - if (I >= 0xD0 && I <= 0xDE && (I & 1) == 0) - return static_cast((I - 0xD0) / 2); // 0..7 + if (I >= imgBase && I <= imgBase + 0xE && (I & 1) == 0) + return static_cast((I - imgBase) / 2); // 0..7 } break; } @@ -358,13 +361,14 @@ bool W65816StackRelToImg::runOnMachineFunction(MachineFunction &MF) { // Skip already-used DP slots ($D0..$DE). while (NextDpIdx < 8 && UsedDp.test(NextDpIdx)) ++NextDpIdx; if (NextDpIdx >= 8) break; - OffsetToDp[Off] = static_cast(0xD0 + 2 * NextDpIdx); + OffsetToDp[Off] = static_cast(imgBase + 2 * NextDpIdx); ++NextDpIdx; } // 6. Rewrite each access site. (OffsetToDp may be empty — phases // 2-5 still run as standalone peepholes.) const W65816Subtarget &STI = MF.getSubtarget(); const W65816InstrInfo *TII = STI.getInstrInfo(); + const TargetRegisterInfo *TRI = STI.getRegisterInfo(); bool Changed = false; for (auto &P : OffsetToDp) { int64_t LogicalOff = P.first; @@ -767,20 +771,50 @@ bool W65816StackRelToImg::runOnMachineFunction(MachineFunction &MF) { // ALSO: check A is dead after Stas.back(). Any A-use before A-redef // would see A=0 from the LDA; without the LDA, A is undef. bool aDead = false; - auto AScan = std::next(Stas.back()); - while (AScan != MBB.end()) { - if (AScan->isDebugInstr()) { ++AScan; continue; } - bool usesA = false, defsA = false; - for (const MachineOperand &MO : AScan->operands()) { - if (MO.isReg() && MO.getReg() == W65816::A) { - if (MO.isDef()) defsA = true; - else if (MO.isUse()) usesA = true; + // A-dead scan: walks forward from Stas.back(), looking for an + // A-redef before any A-use. If MBB ends without resolution, + // recurse one level into all successors — each successor must + // define A as its first A-touch. + auto scanAUntilEnd = [&](MachineBasicBlock::iterator Cur, + MachineBasicBlock &CurrMBB) -> int { + // Returns: 1=A dead (defined before any use), -1=A used, + // 0=unresolved (reached end of MBB). + while (Cur != CurrMBB.end()) { + if (Cur->isDebugInstr()) { ++Cur; continue; } + bool usesA = false, defsA = false; + for (const MachineOperand &MO : Cur->operands()) { + if (MO.isReg() && MO.getReg() == W65816::A) { + // isUse and isDef can BOTH be true on tied-def operands + // (the input side of an in-place modify like ASLA16 has + // isUse=true on the tied operand AND its def-mate + // produces a separate isDef operand). Check both flags + // independently — a tied-def instruction USES A before + // it DEFs A, so we must consider it a use. + if (MO.isUse()) usesA = true; + if (MO.isDef()) defsA = true; + } } + if (Cur->isCall()) defsA = true; // caller-save + // Use BEFORE def matters: if A is read by this instruction + // (even as part of a tied-def chain), the prior LDA #K's + // value is consumed and we can't drop it. + if (usesA) return -1; + if (defsA) return 1; + ++Cur; } - if (AScan->isCall()) defsA = true; - if (defsA) { aDead = true; break; } - if (usesA) break; // A used before redef - ++AScan; + return 0; + }; + int aResult = scanAUntilEnd(std::next(Stas.back()), MBB); + if (aResult == 1) { + aDead = true; + } else if (aResult == 0) { + // Unresolved in this MBB — check all successors. + bool allSuccDead = !MBB.succ_empty(); + for (MachineBasicBlock *Succ : MBB.successors()) { + int r = scanAUntilEnd(Succ->begin(), *Succ); + if (r != 1) { allSuccDead = false; break; } + } + if (allSuccDead) aDead = true; } if (!aDead) continue; // Rewrite all STAs to STZ. @@ -1216,5 +1250,214 @@ bool W65816StackRelToImg::runOnMachineFunction(MachineFunction &MF) { } } + // Phase 10: tail-call commutative libcalls in trivial wrapper functions. + // + // For functions whose entire body is essentially `helper(a, b); return;` + // where `helper` is a commutative libgcc multiply (__umulhisi3, __mulhi3), + // the codegen unnecessarily marshals args (PHA + LDA-from-shifted-offset). + // Since multiply is commutative, the caller's positions (A=a, 4,s=b) + // already satisfy the callee's contract. + // + // Pattern: + // REP 48 + // PHA ; pushes A (= arg0) + // LDA_StackRel ; reads arg1 (off = 4 + 2 = 6 post-PHA) + // JSLpseudo32 @helper + // PLY ; cleanup PHA + // RTL + // + // Replace with: + // REP 48 + // JML_Long @helper ; tail-call; helper's RTL returns to OUR caller + // + // 2 inst total — beats Calypsi's 4 for mul16to32. + { + if (MF.size() == 1) { // single MBB only — full function fits + MachineBasicBlock &MBB = MF.front(); + // Collect non-debug ops. + SmallVector Ops; + for (MachineInstr &MI : MBB) { + if (!MI.isDebugInstr()) Ops.push_back(&MI); + } + // Need exactly: REP, (PHA|PUSH16), LDA_StackRel, JSL, PLY, RTL. + if (Ops.size() == 6 && + Ops[0]->getOpcode() == W65816::REP && + (Ops[1]->getOpcode() == W65816::PHA || + Ops[1]->getOpcode() == W65816::PUSH16) && + Ops[2]->getOpcode() == W65816::LDA_StackRel && + Ops[3]->getOpcode() == W65816::JSLpseudo32 && + Ops[4]->getOpcode() == W65816::PLY && + Ops[5]->getOpcode() == W65816::RTL) { + // JSL target must be a commutative 16x16-multiply helper. + bool isCommutativeMul = false; + for (MachineOperand &MO : Ops[3]->operands()) { + StringRef Name; + if (MO.isGlobal()) Name = MO.getGlobal()->getName(); + else if (MO.isSymbol()) Name = MO.getSymbolName(); + else continue; + if (Name == "__umulhisi3" || Name == "__mulhi3") { + isCommutativeMul = true; + break; + } + break; + } + // LDA_StackRel offset should be 6 (caller's arg1 at 4,s, +2 for PHA). + bool offsetOK = Ops[2]->getNumOperands() >= 1 && + Ops[2]->getOperand(0).isImm() && + Ops[2]->getOperand(0).getImm() == 6; + if (isCommutativeMul && offsetOK) { + // Build JML_Long @helper to replace the JSL. + MachineOperand TargetMO = Ops[3]->getOperand(0); // copy + DebugLoc DL = Ops[3]->getDebugLoc(); + // Insert JML_Long before the JSL. + BuildMI(MBB, Ops[3], DL, TII->get(W65816::JML_Long)) + .add(TargetMO); + // Erase PHA, LDA_StackRel, JSL, PLY, RTL. + Ops[1]->eraseFromParent(); + Ops[2]->eraseFromParent(); + Ops[3]->eraseFromParent(); + Ops[4]->eraseFromParent(); + Ops[5]->eraseFromParent(); + Changed = true; + } + } + } + } + + // Phase 11: PHP-wrap-aware STZ peephole. + // + // SDAG emits `PHP ; LDA #0 ; PLP ; STA $X` to write 0 to a DP slot + // while preserving flags from an earlier flag-setter (typically an + // ORA-then-BEQ pattern). Since STZ_DP $X writes 0 without touching + // A or flags, the whole wrap collapses to `STZ_DP $X`. Saves 4 + // inst per occurrence. + // + // Safety: A must be dead after the STA. Use the same successor- + // aware scan as Phase 6. + { + auto scanAUntilEnd2 = [&](MachineBasicBlock::iterator Cur, + MachineBasicBlock &CurrMBB) -> int { + while (Cur != CurrMBB.end()) { + if (Cur->isDebugInstr()) { ++Cur; continue; } + bool usesA = false, defsA = false; + for (const MachineOperand &MO : Cur->operands()) { + if (MO.isReg() && MO.getReg() == W65816::A) { + if (MO.isDef()) defsA = true; + else if (MO.isUse()) usesA = true; + } + } + if (Cur->isCall()) defsA = true; + if (defsA) return 1; + if (usesA) return -1; + ++Cur; + } + return 0; + }; + for (MachineBasicBlock &MBB : MF) { + SmallVector Dead; + SmallVector, 4> NewStz; + for (auto It = MBB.begin(); It != MBB.end(); ++It) { + if (It->getOpcode() != W65816::PHP) continue; + auto Lda = std::next(It); + while (Lda != MBB.end() && Lda->isDebugInstr()) ++Lda; + if (Lda == MBB.end()) continue; + if (Lda->getOpcode() != W65816::LDA_Imm16 && + Lda->getOpcode() != W65816::LDAi16imm) + continue; + if (Lda->getNumOperands() < 2 || !Lda->getOperand(1).isImm()) continue; + if (Lda->getOperand(1).getImm() != 0) continue; + auto Plp = std::next(Lda); + while (Plp != MBB.end() && Plp->isDebugInstr()) ++Plp; + if (Plp == MBB.end() || Plp->getOpcode() != W65816::PLP) continue; + auto Sta = std::next(Plp); + while (Sta != MBB.end() && Sta->isDebugInstr()) ++Sta; + if (Sta == MBB.end() || Sta->getOpcode() != W65816::STA_DP) continue; + if (Sta->getNumOperands() < 1 || !Sta->getOperand(0).isImm()) continue; + int64_t StaAddr = Sta->getOperand(0).getImm(); + // Check A-dead after the STA. + bool aDead = false; + int r = scanAUntilEnd2(std::next(Sta), MBB); + if (r == 1) aDead = true; + else if (r == 0) { + bool allSuccDead = !MBB.succ_empty(); + for (MachineBasicBlock *Succ : MBB.successors()) { + int sr = scanAUntilEnd2(Succ->begin(), *Succ); + if (sr != 1) { allSuccDead = false; break; } + } + if (allSuccDead) aDead = true; + } + if (!aDead) continue; + Dead.push_back(&*It); // PHP + Dead.push_back(&*Lda); + Dead.push_back(&*Plp); + Dead.push_back(&*Sta); + NewStz.push_back({&*Sta, StaAddr}); + } + // Insert STZ_DP before each dead STA (Sta is in NewStz). + for (auto &P : NewStz) { + MachineInstr *Sta = P.first; + DebugLoc DL = Sta->getDebugLoc(); + BuildMI(MBB, Sta, DL, TII->get(W65816::STZ_DP)) + .addImm(P.second); + } + for (MachineInstr *MI : Dead) { + MI->eraseFromParent(); + Changed = true; + } + } + } + + // DP-shift-fold: `LDA_DP X ; LSRA16/ASLA16 ; STA_DP X (same X)` folds + // to `LSR_DP/ASL_DP X` (DP-RMW form) when A is dead after the STA. + // Same semantics, shorter and cheaper. popcount's i32 SRL by 1 hits + // the LSRA case once per iteration; the slot-A is dead after when the + // next op is an LDA-style $a-defining load. + for (MachineBasicBlock &MBB : MF) { + SmallVector ToErase; + for (auto It = MBB.begin(); It != MBB.end();) { + auto Lda = It++; + if (Lda->getOpcode() != W65816::LDA_DP) continue; + if (Lda->getNumOperands() < 1 || !Lda->getOperand(0).isImm()) continue; + int64_t DpAddr = Lda->getOperand(0).getImm(); + auto Shift = std::next(Lda); + while (Shift != MBB.end() && Shift->isDebugInstr()) ++Shift; + if (Shift == MBB.end()) continue; + unsigned ShiftOp = Shift->getOpcode(); + unsigned DpShiftOp = 0; + if (ShiftOp == W65816::LSRA16) { + DpShiftOp = W65816::LSR_DP; + } else if (ShiftOp == W65816::ASLA16) { + DpShiftOp = W65816::ASL_DP; + } else { + continue; + } + auto Sta = std::next(Shift); + while (Sta != MBB.end() && Sta->isDebugInstr()) ++Sta; + if (Sta == MBB.end() || Sta->getOpcode() != W65816::STA_DP) continue; + if (Sta->getNumOperands() < 1 || !Sta->getOperand(0).isImm()) continue; + if (Sta->getOperand(0).getImm() != DpAddr) continue; + // A is dead after Sta iff the next non-debug op defines $a without + // reading it. Conservative: bail if no clear def or if A is read. + auto Next = std::next(Sta); + while (Next != MBB.end() && Next->isDebugInstr()) ++Next; + if (Next == MBB.end()) continue; + if (Next->isBranch() || Next->isReturn() || Next->isCall() || + Next->isInlineAsm()) continue; + bool reads = Next->readsRegister(W65816::A, TRI); + bool defs = Next->modifiesRegister(W65816::A, TRI); + if (reads || !defs) continue; + // Apply: insert LSR_DP/ASL_DP at Lda's position, erase the triplet. + BuildMI(MBB, Lda, Lda->getDebugLoc(), TII->get(DpShiftOp)) + .addImm(DpAddr); + ToErase.push_back(&*Lda); + ToErase.push_back(&*Shift); + ToErase.push_back(&*Sta); + } + for (MachineInstr *MI : ToErase) { + MI->eraseFromParent(); + Changed = true; + } + } + return Changed; } diff --git a/src/llvm/lib/Target/W65816/W65816StackSlotCleanup.cpp b/src/llvm/lib/Target/W65816/W65816StackSlotCleanup.cpp index 56b42c5..0e41f9d 100644 --- a/src/llvm/lib/Target/W65816/W65816StackSlotCleanup.cpp +++ b/src/llvm/lib/Target/W65816/W65816StackSlotCleanup.cpp @@ -301,14 +301,15 @@ static bool tryEliminateLoadAfterStore(MachineBasicBlock &MBB, } }; // Walk past further STAfi pseudos (spill stores) — they preserve - // A's flags. Only walk past STAfi specifically; STA_DP and - // pointer-indirect stores have inserter-driven expansions that - // can introduce flag-touching ops, and walking past those broke - // a printf smoke test. + // A's flags. Also walk past STA_DP (plain `sta $dp` doesn't touch + // P). Don't walk past STA_DPIndLongY / STA8fi / etc., whose + // inserter expansions introduce SEP/REP and mutate the M flag + // (that's what broke printf historically). auto NextIt = std::next(MI.getIterator()); while (NextIt != MBB.end()) { if (NextIt->isDebugInstr()) { ++NextIt; continue; } if (NextIt->getOpcode() == W65816::STAfi) { ++NextIt; continue; } + if (NextIt->getOpcode() == W65816::STA_DP) { ++NextIt; continue; } break; } if (NextIt == MBB.end() || NextIt->isBranch() || NextIt->isReturn()) @@ -316,6 +317,34 @@ static bool tryEliminateLoadAfterStore(MachineBasicBlock &MBB, if (!NextIt->definesRegister(W65816::P, TRI) && !opSetsNZ(NextIt->getOpcode())) return false; + // Eliding the LDA leaves $a "dead per verifier" because STAfi's + // tablegen Defs = [A] is a stale over-approximation (the asm + // actually preserves A via PHA/lda/sta/PLA bracket for IMG/X/Y + // sources, and trivially for $a sources — see W65816InstrInfo.td + // and eliminateFrameIndex). Strip the stale implicit-def $a from + // walked-past STAfis (any source) and clear any kill flag on the + // source operand when source is $a, so the verifier sees $a as + // still alive through the chain. We're post-regalloc so this + // doesn't affect regalloc's decisions — only the verifier and any + // downstream passes that read the annotation. + auto stripStaleAdef = [](MachineInstr &MI2) { + if (MI2.getOpcode() != W65816::STAfi) return; + if (MI2.getNumOperands() < 1 || !MI2.getOperand(0).isReg()) return; + if (MI2.getOperand(0).getReg() == W65816::A) { + MI2.getOperand(0).setIsKill(false); + } + for (unsigned i = MI2.getNumOperands(); i-- > 0;) { + const MachineOperand &MO = MI2.getOperand(i); + if (MO.isReg() && MO.isImplicit() && MO.isDef() && + MO.getReg() == W65816::A) { + MI2.removeOperand(i); + return; + } + } + }; + for (auto FixIt = StaMI.getIterator(); FixIt != MI.getIterator(); ++FixIt) { + stripStaleAdef(*FixIt); + } MI.eraseFromParent(); return true; } @@ -1095,6 +1124,27 @@ bool W65816StackSlotCleanup::runOnMachineFunction(MachineFunction &MF) { break; } } + // LDAfi $a, slotB, 0 — final reload before a DPF0 stage. The + // LDAptr32 inserter emits this shape per pointer half: + // LDAfi $a, srcSlot ; STAfi $a, freshSlot ; [other STAfi] + // LDAfi $a, freshSlot ; STA_DP $E0 + // Pass -2c can elide the round-trip by retargeting the final LDAfi + // to read srcSlot (=SlotA) directly, dropping the LDA+STA pair. + // The final LDAfi is a pure A-write so dropping the earlier Lda1 + // can't break any intervening A-reader. + if (Opc == W65816::LDAfi) { + if (MI.getNumOperands() >= 3 && + MI.getOperand(0).isReg() && + MI.getOperand(0).getReg() == W65816::A && + MI.getOperand(1).isFI() && + MI.getOperand(1).getIndex() == SlotB && + MI.getOperand(2).isImm() && + MI.getOperand(2).getImm() == 0) { + OpfiTarget = &MI; + RewriteIdx = 1; + break; + } + } ++It2; } if (!OpfiTarget) continue; @@ -1757,6 +1807,186 @@ bool W65816StackSlotCleanup::runOnMachineFunction(MachineFunction &MF) { } } + // Pass 1h: collapse dead TAX/TXA bridge around DPF0 staging. When + // SpillToX bridges one of the LDAptr32 inserter's STAfi/LDAfi pairs + // (saving 6 cyc), then Pass -2c collapses the OTHER pair entirely, + // the TAX/TXA bridge becomes pure overhead. Pattern: + // + // LDAfi $a, slotA, 0 ; (1) load ptr_hi (originally for X-bridge) + // TAX ; (2) X = ptr_hi + // LDAfi $a, slotB, 0 ; (3) load ptr_lo (the Pass -2c rewrite target) + // STA_DP imm1 ; (4) $E0 = ptr_lo + // TXA ; (5) recover ptr_hi to A + // STA_DP imm2 ; (6) $E2 = ptr_hi + // + // Reorder to drop the bridge: + // + // LDAfi $a, slotB, 0 ; (3) load ptr_lo + // STA_DP imm1 ; (4) $E0 = ptr_lo + // LDAfi $a, slotA, 0 ; (1) load ptr_hi (moved down) + // STA_DP imm2 ; (6) $E2 = ptr_hi + // + // Saves 2 instructions (~6 cyc) per LDAptr32 expansion. Safe iff X + // is dead after TXA (no read before redef). Common in tight loops + // that deref two pointers per iter (memcmp, strcpy, dotProduct). + for (MachineBasicBlock &MBB : MF) { + SmallVector Ldas; + for (MachineInstr &MI : MBB) { + if (MI.getOpcode() == W65816::LDAfi) { + Ldas.push_back(&MI); + } + } + SmallPtrSet ErasedH; + for (MachineInstr *Lda1 : Ldas) { + if (ErasedH.count(Lda1)) { + continue; + } + int SlotA = matchAccSlotOp(*Lda1, W65816::LDAfi); + if (SlotA == NO_SLOT_MATCH) { + continue; + } + auto It = std::next(Lda1->getIterator()); + if (!advancePastDebug(MBB, It)) { + continue; + } + // Optional `ADCEfi $a (tied), slot, 0` between Lda1 and TAX. + // strcpy emits `LDAfi hi_part ; ADCEfi $a, $stack.9 ; TAX` to + // compute ptr_hi via carry-propagation from a prior ADCfi (lo). + // The ADCEfi's carry-in comes from an earlier ADCfi; intervening + // LDA/STA preserve C, so reordering this pair past STA_DP is safe. + MachineInstr *MaybeAdcE = nullptr; + if (It->getOpcode() == W65816::ADCEfi && + It->getNumOperands() >= 4 && + It->getOperand(0).isReg() && + It->getOperand(0).getReg() == W65816::A) { + MaybeAdcE = &*It; + ++It; + if (!advancePastDebug(MBB, It)) { + continue; + } + } + if (It->getOpcode() != W65816::TAX) { + continue; + } + MachineInstr *Tax = &*It; + ++It; + if (!advancePastDebug(MBB, It)) { + continue; + } + int SlotB = matchAccSlotOp(*It, W65816::LDAfi); + if (SlotB == NO_SLOT_MATCH || SlotB == SlotA) { + continue; + } + MachineInstr *Lda2 = &*It; + ++It; + if (!advancePastDebug(MBB, It)) { + continue; + } + if (It->getOpcode() != W65816::STA_DP) { + continue; + } + MachineInstr *Sta1 = &*It; + ++It; + if (!advancePastDebug(MBB, It)) { + continue; + } + if (It->getOpcode() != W65816::TXA) { + continue; + } + MachineInstr *Txa = &*It; + ++It; + if (!advancePastDebug(MBB, It)) { + continue; + } + if (It->getOpcode() != W65816::STA_DP) { + continue; + } + MachineInstr *Sta2 = &*It; + // Verify X is dead after Txa within this MBB. Tighter check + // than just "until branch/return": if we reach end of MBB or a + // branch without seeing an X-read or X-def, look at successor + // MBBs. X is dead iff no successor's livein set includes X. + // Critical for tight loops (strLen, byte-walk loops) where the + // loop terminator is a branch back to the same MBB. + bool XDeadAfter = true; + bool MustCheckSuccessors = false; + auto checkIt = std::next(Sta2->getIterator()); + while (checkIt != MBB.end()) { + if (checkIt->isDebugInstr()) { + ++checkIt; + continue; + } + if (checkIt->readsRegister(W65816::X, TRI)) { + XDeadAfter = false; + break; + } + if (checkIt->modifiesRegister(W65816::X, TRI)) { + // X redefined before any read — dead range ended. + break; + } + if (checkIt->isCall() || checkIt->isInlineAsm()) { + XDeadAfter = false; + break; + } + if (checkIt->isBranch() || checkIt->isReturn()) { + // Hit the terminator without redef — defer to successor + // liveins to determine if X is live-out. + MustCheckSuccessors = true; + break; + } + ++checkIt; + } + if (checkIt == MBB.end()) { + MustCheckSuccessors = true; + } + if (XDeadAfter && MustCheckSuccessors) { + // X is dead iff no successor lists it as a livein. + for (MachineBasicBlock *Succ : MBB.successors()) { + if (Succ->isLiveIn(W65816::X)) { + XDeadAfter = false; + break; + } + } + } + if (!XDeadAfter) { + continue; + } + // Apply: move Lda1 (and optional ADCEfi) to between Sta1 and + // Sta2, then erase Tax/Txa. Splicing both to Sta2's iterator + // preserves their relative order — second splice ends up nearer + // Sta2, so Lda1 first then MaybeAdcE. + MBB.splice(Sta2->getIterator(), &MBB, Lda1->getIterator()); + if (MaybeAdcE) { + MBB.splice(Sta2->getIterator(), &MBB, MaybeAdcE->getIterator()); + } + Tax->eraseFromParent(); + Txa->eraseFromParent(); + ErasedH.insert(Lda1); + Changed = true; + } + } + + // Pass 1z: re-run Pass 1's load-after-store elimination after Pass 1h. + // Pass 1h's splice may have created newly-adjacent STAfi+LDAfi pairs + // when the moved instructions exposed a producer (e.g., ADCfi) whose + // result was already in A at the LDAfi point. Common in strcpy's + // pointer-arithmetic: `ADCfi $a, lo_off ; STAfi $a, slot ; LDAfi $a, + // slot ; STA_DP` collapses to `ADCfi ; STAfi ; STA_DP` after the LDA + // is recognised as redundant. + for (MachineBasicBlock &MBB : MF) { + SmallVector Stores; + for (MachineInstr &MI : MBB) { + if (MI.getOpcode() == W65816::STAfi) { + Stores.push_back(&MI); + } + } + for (MachineInstr *StaMI : Stores) { + if (tryEliminateLoadAfterStore(MBB, *StaMI, TRI)) { + Changed = true; + } + } + } + // Pass 2: dead stores (STAfi to slot followed by another STAfi to // the same slot with no intervening read). This catches the // arg0_lo "preserve" spill that the regalloc emits even though the diff --git a/src/llvm/lib/Target/W65816/W65816TargetMachine.cpp b/src/llvm/lib/Target/W65816/W65816TargetMachine.cpp index c6281ac..01ef1aa 100644 --- a/src/llvm/lib/Target/W65816/W65816TargetMachine.cpp +++ b/src/llvm/lib/Target/W65816/W65816TargetMachine.cpp @@ -108,6 +108,7 @@ public: } bool addInstSelector() override; + void addIRPasses() override; void addPreRegAlloc() override; void addPostRegAlloc() override; void addPreEmitPass() override; @@ -139,6 +140,16 @@ TargetPassConfig *W65816TargetMachine::createPassConfig(PassManagerBase &PM) { return new W65816PassConfig(*this, PM); } +void W65816PassConfig::addIRPasses() { + TargetPassConfig::addIRPasses(); + // After LSR: undo LSR's pointer-walking transform for global-array + // loops, where the W65816's `lda , X` indexed addressing is + // cheaper than the 24-bit `[dp],Y` deref LSR produces. Doesn't + // affect pointer-arg loops (where LSR's transform is genuinely + // faster) — the pass only matches `phi ptr [GlobalAddress, ...]`. + addPass(createW65816UnLSR()); +} + void W65816PassConfig::addISelPrepare() { // SjLjEHPrepare ran in addPassesToHandleExceptions just before this; // our finalize pass inserts an actual setjmp at function entry + diff --git a/src/llvm/lib/Target/W65816/W65816UnLSR.cpp b/src/llvm/lib/Target/W65816/W65816UnLSR.cpp new file mode 100644 index 0000000..8451bec --- /dev/null +++ b/src/llvm/lib/Target/W65816/W65816UnLSR.cpp @@ -0,0 +1,313 @@ +//===-- W65816UnLSR.cpp - Undo LSR for global-array pointer-walks --------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===---------------------------------------------------------------------===// +// +// Post-LSR IR pass. LSR converts `for (i; i, X` is 3 bytes / 5 cyc DBR-relative. The +// LDA_AbsX SDAG combine recognizes `(load (add Wrapper, idx))` but +// LSR has destroyed that shape. +// +// This pass detects the shape and converts back: introduce a forward +// counter PHI (0, 1, 2, ...), replace loads/stores through the pointer +// PHI with indexed GEPs `getelementptr T, @global, %i`. The old pointer +// PHI becomes dead and is DCE'd. The existing count-down counter PHI +// stays as the loop control. +// +// Restrictions: +// * Pointer PHI's initial value must be a `GlobalAddress` (otherwise +// it might point at a non-DBR-bank object, and our combine doesn't +// fire / produces wrong code). +// * Pointer PHI must have exactly two incoming values (header + latch). +// * Pointer PHI's only uses must be the stride GEP and loads/stores. +// * Stride must be a positive constant. +// * The loop must have an existing trip-count counter so we don't +// introduce extra register pressure. +// +//===---------------------------------------------------------------------===// + +#include "W65816.h" +#include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/Analysis/LoopInfo.h" +#include "llvm/Analysis/ScalarEvolution.h" +#include "llvm/InitializePasses.h" +#include "llvm/IR/Constants.h" +#include "llvm/IR/Function.h" +#include "llvm/IR/IRBuilder.h" +#include "llvm/IR/InstIterator.h" +#include "llvm/IR/Instructions.h" +#include "llvm/IR/Module.h" +#include "llvm/Pass.h" +#include "llvm/Support/Debug.h" + +using namespace llvm; + +#define DEBUG_TYPE "w65816-un-lsr" + +namespace llvm { +void initializeW65816UnLSRPass(PassRegistry &); +} + +namespace { + +class W65816UnLSR : public FunctionPass { +public: + static char ID; + W65816UnLSR() : FunctionPass(ID) {} + + StringRef getPassName() const override { + return "W65816 undo LSR pointer-walk for global-array access"; + } + + void getAnalysisUsage(AnalysisUsage &AU) const override { + AU.addRequired(); + AU.setPreservesCFG(); + } + + bool runOnFunction(Function &F) override; + +private: + bool processLoop(Loop *L); +}; + +} // namespace + +char W65816UnLSR::ID = 0; + +INITIALIZE_PASS_BEGIN(W65816UnLSR, DEBUG_TYPE, + "W65816 undo LSR for global-array", false, false) +INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass) +INITIALIZE_PASS_END(W65816UnLSR, DEBUG_TYPE, + "W65816 undo LSR for global-array", false, false) + +FunctionPass *llvm::createW65816UnLSR() { return new W65816UnLSR(); } + +bool W65816UnLSR::runOnFunction(Function &F) { + if (F.hasOptNone()) + return false; + LoopInfo &LI = getAnalysis().getLoopInfo(); + bool Changed = false; + for (Loop *L : LI) { + Changed |= processLoop(L); + // Recurse into nested loops. + SmallVector Worklist(L->begin(), L->end()); + while (!Worklist.empty()) { + Loop *Sub = Worklist.pop_back_val(); + Changed |= processLoop(Sub); + Worklist.append(Sub->begin(), Sub->end()); + } + } + return Changed; +} + +bool W65816UnLSR::processLoop(Loop *L) { + BasicBlock *Header = L->getHeader(); + BasicBlock *Latch = L->getLoopLatch(); + if (!Latch) + return false; + // Single-block loops are fine (header == latch). + + // Find a pointer PHI whose initial value is a GlobalAddress and whose + // latch-incoming is a constant-stride GEP off itself. + SmallVector Candidates; + for (PHINode &PN : Header->phis()) { + if (!PN.getType()->isPointerTy()) continue; + if (PN.getNumIncomingValues() != 2) continue; + Candidates.push_back(&PN); + } + + bool Changed = false; + for (PHINode *PtrPHI : Candidates) { + // Identify which incoming is from the preheader vs the latch. + Value *InitVal = nullptr; + Value *StepVal = nullptr; + for (unsigned i = 0; i < PtrPHI->getNumIncomingValues(); ++i) { + BasicBlock *Pred = PtrPHI->getIncomingBlock(i); + Value *Inc = PtrPHI->getIncomingValue(i); + if (L->contains(Pred)) + StepVal = Inc; + else + InitVal = Inc; + } + if (!InitVal || !StepVal) continue; + + // InitVal must be a GlobalAddress (GlobalVariable). Could relax to + // any constant base, but globals are the only case our combine + // handles correctly. + auto *InitGV = dyn_cast(InitVal); + if (!InitGV) continue; + + // StepVal must be a `getelementptr i8, %PtrPHI, ConstantInt`. + auto *StepGEP = dyn_cast(StepVal); + if (!StepGEP) continue; + if (StepGEP->getPointerOperand() != PtrPHI) continue; + if (StepGEP->getNumIndices() != 1) continue; + auto *StrideCI = dyn_cast(StepGEP->getOperand(1)); + if (!StrideCI) continue; + int64_t StrideBytes = StrideCI->getSExtValue(); + if (StrideBytes <= 0) continue; + // Determine element type for the indexed GEP. Walk all loads/ + // stores through PtrPHI; require they all access the same primitive + // type whose size equals StrideBytes (typical: i16 array → stride 2). + Type *ElemTy = nullptr; + SmallVector Accesses; + bool ok = true; + for (User *U : PtrPHI->users()) { + if (U == StepGEP) continue; + if (auto *LD = dyn_cast(U)) { + if (LD->getPointerOperand() != PtrPHI) { ok = false; break; } + Type *T = LD->getType(); + if (!T->isIntegerTy()) { ok = false; break; } + if (!ElemTy) ElemTy = T; + else if (ElemTy != T) { ok = false; break; } + Accesses.push_back(LD); + continue; + } + if (auto *ST = dyn_cast(U)) { + if (ST->getPointerOperand() != PtrPHI) { ok = false; break; } + Type *T = ST->getValueOperand()->getType(); + if (!T->isIntegerTy()) { ok = false; break; } + if (!ElemTy) ElemTy = T; + else if (ElemTy != T) { ok = false; break; } + Accesses.push_back(ST); + continue; + } + // Any other use → bail. + ok = false; + break; + } + if (!ok || !ElemTy || Accesses.empty()) continue; + Module &M = *Header->getModule(); + const DataLayout &DL = M.getDataLayout(); + uint64_t ElemBytes = DL.getTypeAllocSize(ElemTy); + if ((int64_t)ElemBytes != StrideBytes) continue; + + // We have a clean global-array pointer-walk. Build a forward + // counter PHI starting at 0, incrementing by 1. Replace the + // pointer-PHI's loads/stores with `GEP ElemTy, @global, %i`. + LLVMContext &Ctx = Header->getContext(); + IntegerType *I16 = Type::getInt16Ty(Ctx); + IRBuilder<> B(&Header->front()); + PHINode *Counter = B.CreatePHI(I16, 2, "unlsr.i"); + BasicBlock *Preheader = L->getLoopPreheader(); + if (!Preheader) continue; + Counter->addIncoming(ConstantInt::get(I16, 0), Preheader); + // Build the counter increment in the latch, just before the + // terminator. + IRBuilder<> BL(Latch->getTerminator()); + Value *CounterNext = BL.CreateAdd(Counter, ConstantInt::get(I16, 1), + "unlsr.i.next"); + Counter->addIncoming(CounterNext, Latch); + + // Replace each load/store with a GEP-then-load/store. + for (Instruction *Acc : Accesses) { + IRBuilder<> BA(Acc); + Value *Idx = Counter; + // GEP type is i16 elem, idx is i16. + Value *Addr = BA.CreateGEP(ElemTy, InitGV, Idx, "unlsr.addr"); + if (auto *LD = dyn_cast(Acc)) { + LD->setOperand(LoadInst::getPointerOperandIndex(), Addr); + } else if (auto *ST = dyn_cast(Acc)) { + ST->setOperand(StoreInst::getPointerOperandIndex(), Addr); + } + } + // Erase the now-unused step GEP and pointer PHI. + if (StepGEP->use_empty()) StepGEP->eraseFromParent(); + if (PtrPHI->use_empty()) PtrPHI->eraseFromParent(); + + // Try to eliminate the count-down LSR counter (`%lsr.iv = phi i16 + // [%n, preheader], [%lsr.iv.next, latch]; %lsr.iv.next = add %lsr.iv, + // -1; %exitcond = icmp eq %lsr.iv.next, 0`). Replace the exit + // comparison with `icmp eq %unlsr.i.next, %n`, then erase the + // count-down chain. Saves one i16 PHI + dec + cmp per loop. + for (PHINode &LSR : Header->phis()) { + if (&LSR == Counter) continue; + if (!LSR.getType()->isIntegerTy(16)) continue; + if (LSR.getNumIncomingValues() != 2) continue; + // Identify preheader vs latch incomings. + Value *LsrInit = nullptr; + Value *LsrStep = nullptr; + for (unsigned i = 0; i < LSR.getNumIncomingValues(); ++i) { + BasicBlock *Pred = LSR.getIncomingBlock(i); + if (L->contains(Pred)) LsrStep = LSR.getIncomingValue(i); + else LsrInit = LSR.getIncomingValue(i); + } + if (!LsrInit || !LsrStep) continue; + // %lsr.iv.next must be `add %lsr.iv, -1`. + auto *LsrStepBO = dyn_cast(LsrStep); + if (!LsrStepBO || LsrStepBO->getOpcode() != Instruction::Add) continue; + Value *OtherOp = nullptr; + if (LsrStepBO->getOperand(0) == &LSR) OtherOp = LsrStepBO->getOperand(1); + else if (LsrStepBO->getOperand(1) == &LSR) OtherOp = LsrStepBO->getOperand(0); + if (!OtherOp) continue; + auto *DecCI = dyn_cast(OtherOp); + if (!DecCI || !DecCI->isMinusOne()) continue; + // %lsr.iv.next typically has 2 uses: the icmp exit comparison and + // the PHI back-edge (LSR.users includes LsrStepBO as the latch + // incoming). Allow that; find the icmp among the uses. + ICmpInst *ExitCmp = nullptr; + bool extraUse = false; + for (User *U : LsrStepBO->users()) { + if (U == &LSR) continue; + if (auto *IC = dyn_cast(U)) { + if (ExitCmp) { extraUse = true; break; } + ExitCmp = IC; + continue; + } + extraUse = true; + break; + } + if (extraUse || !ExitCmp) continue; + if (ExitCmp->getPredicate() != ICmpInst::ICMP_EQ && + ExitCmp->getPredicate() != ICmpInst::ICMP_NE) continue; + Value *CmpOther = nullptr; + if (ExitCmp->getOperand(0) == LsrStepBO) + CmpOther = ExitCmp->getOperand(1); + else if (ExitCmp->getOperand(1) == LsrStepBO) + CmpOther = ExitCmp->getOperand(0); + if (!CmpOther) continue; + auto *CmpZero = dyn_cast(CmpOther); + if (!CmpZero || !CmpZero->isZero()) continue; + bool lsrOnlyIncrUse = true; + for (User *U : LSR.users()) { + if (U == LsrStepBO) continue; + lsrOnlyIncrUse = false; break; + } + if (!lsrOnlyIncrUse) continue; + // CounterNext was inserted just before the latch terminator, but + // ExitCmp may live higher in the block (originally placed there + // by LSR). Move CounterNext to just before ExitCmp so it + // dominates the cmp's use. + if (auto *CounterNextI = dyn_cast(CounterNext)) + CounterNextI->moveBefore(ExitCmp->getIterator()); + // Replace exit comparison: icmp eq %unlsr.i.next, %lsrInit. + ExitCmp->setOperand(0, CounterNext); + ExitCmp->setOperand(1, LsrInit); + // RAUW each value with undef before erasing — they have a mutual + // reference (PHI → BO via latch-incoming, BO → PHI via add operand). + Type *I16T = LSR.getType(); + LSR.replaceAllUsesWith(UndefValue::get(I16T)); + LsrStepBO->replaceAllUsesWith(UndefValue::get(I16T)); + LsrStepBO->eraseFromParent(); + LSR.eraseFromParent(); + break; + } + + Changed = true; + } + return Changed; +}