Skip to content

amiga: replace magic numbers in startup.S with named constants#2

Merged
reinauer merged 1 commit intoreinauer:mainfrom
codewiz:amiga/startup-readability
Apr 15, 2026
Merged

amiga: replace magic numbers in startup.S with named constants#2
reinauer merged 1 commit intoreinauer:mainfrom
codewiz:amiga/startup-readability

Conversation

@codewiz
Copy link
Copy Markdown
Contributor

@codewiz codewiz commented Apr 13, 2026

Summary

  • Replace hardcoded LVO offsets, Task struct offsets, StackSwap struct layout, and AllocMem flags with named #defines
  • The NDK's own exec/tasks.i and lvo/exec_lib.i use classic Amiga assembler syntax (IFND/SET/STRUCTURE/EQU) that GNU AS doesn't parse, so the defines are inlined at the top of the file with pointers to the NDK headers they came from
  • Generated code is byte-identical to the previous version (verified via objdump -d)

Test plan

  • make amiga builds clean with m68k-amigaos-gcc
  • objdump -d startup.o output matches the previous version byte-for-byte

Use #defines for exec library LVOs, Task struct offsets, StackSwap
struct layout, and AllocMem flags. The NDK's own exec/tasks.i and
lvo/exec_lib.i use classic Amiga assembler syntax (IFND/SET/STRUCTURE
/EQU) that GNU AS doesn't parse, so we redefine just what we need at
the top of the file with a pointer to the NDK headers they came from.

Generated code is byte-identical to the previous version.

Two m68k GAS quirks worth noting for future edits:
  - '|' is the line-comment character, so MEMF_PUBLIC|MEMF_CLEAR must
    be written as MEMF_PUBLIC+MEMF_CLEAR (safe here since the bits
    don't overlap).
  - Parenthesised expressions in immediates (e.g. #(A|B)) don't parse
    cleanly either.
@reinauer reinauer merged commit eb1c034 into reinauer:main Apr 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants