ASSEMBLY REFERENCEALPHA · USE AT YOUR OWN RISK
Assembly function reference
ABI v1: every function is reachable through OSWORD &C0, or directly at JSR &8100 + 3×function with the EGFX slot selected.
Transport
OSWORD &C0 is recommended: it works on the host or an Acorn 6502 parasite without sharing pointers. Set X/Y to the request block and call JSR &FFF1. The block is 64 bytes: +2/+3 is the EG signature; +4 transport version 1; +5 function number; +7 acknowledgement, cleared before the call and answered with &A5; +8..+21 parameters; +22..+63 inline NUL-terminated text. Functions 0–10 and 22–23 report ACTIVE in +6; the rest report status 0 (success) or 1 (error).
Direct callers must save MOS ROM state, select the EGFX slot through &FE30 (and the &F4 shadow), dispatch, then restore state even when the call is rejected. Calls clobber A, X, Y and zero page &70..&77, and must not be made from IRQ handlers. Primitive parameters live in the fixed block &2A00..&2A0D.
Primitives 0–10
| # | Function | Parameters | Usage |
|---|
| 0 | INIT | none | Select backend; reset effects. |
| 1 | BEGIN | none | Select and clear the 20 KB drawing page (see 38 for a dirty begin). |
| 2 | SPRITE | PX/PY, IMAGE | Masked 16×16 frame of the registered EGSP v3 resource, via the compact renderer; clips all edges. |
| 3 | EMIT | PX/PY, AMOUNT, FLAGS bit 0 | Seed the 64-particle pool. |
| 4 | PARTICLES | FLAGS bit 0 | Advance and draw particles. |
| 5 | TRAIL | PX/PY | Append to the 32-entry ring. |
| 6 | PRESENT | none | Wait vsync; flip the Master shadow page. |
| 7 | TEXT | STR, PX/PY | Aligned opaque 8×8 text. |
| 8 | RESETFX | none | Clear particle, trail and counter state. |
| 9 | DOT | PX/PY, COLOUR 0–3 | Plot 2×2 point. |
| 10 | LINE | PX/PY, LX/LY, COLOUR | Bounded integer line. |
World extension 11–15
Optional: requires explicitly granted writable SWRAM and extra metadata.
| # | Function | Parameters | Usage |
|---|
| 11 | WORLD_INIT | BANK, SEED, WIDTH/HEIGHT | Initialise a world backend. |
| 12 | WORLD_UPLOAD | OFFSET, COUNT, DATA | Upload world data blocks. |
| 13 | WORLD_BEGIN | CAMERA/STATUS | Begin a world frame. |
| 14 | WORLD_ACTORS | COUNT, ACTORS | Submit actor records. |
| 15 | WORLD_END | none | Finish the world frame; legacy HP/XP UI adapter. |
Disk resources and snakes 16–21
| # | Function | Parameters | Usage |
|---|
| 16 | RESOURCE_INIT | BANK, FRAMES | Initialise sprite resources. |
| 17 | RESOURCE_UPLOAD | OFFSET, COUNT, DATA | Upload sprite and mask bytes. |
| 18 | RESOURCE_READY | none | Validate resources. |
| 19 | SNAKE_INIT | ID, LENGTH, GAP, IMAGE, CUSTOM | Create a sprite snake. |
| 20 | SNAKE_STEP | ID, HEAD X/Y | Move a sprite snake. |
| 21 | SNAKE_DRAW | ID | Draw a sprite snake. |
Shapes and UI 22–28
| # | Function | Parameters | Usage |
|---|
| 22 | CIRCLE | PX/PY, COLOUR, FLAGS, RADIUS | Integer outline or filled circle. |
| 23 | XOR_SPRITE | PX/PY, IMAGE | Reserved: acknowledged but draws nothing in 0.6. |
| 24 | POLYGON | COUNT, FILL, COLOUR, POINTS | Bounded polygon, 3–8 vertices, optional fill. |
| 25 | ARC | PX/PY, RADIUS, COLOUR, FLAGS, ANGLES | Arc segment, angles 0–255 clockwise, optional fill. |
| 26 | BEZIER | DEGREE, STEPS, COLOUR, CONTROLS | Bézier curve. |
| 27 | PROGRESS_BAR | X/Y, WIDTH/HEIGHT, FG/BG, VALUE/MAX, TITLE | Titled progress bar. |
| 28 | BANNER | X/Y, WIDTH, BG, TEXT | Text banner. |
Tile maps 29–32
| # | Function | Parameters | Usage |
|---|
| 29 | TILE_INIT | COLUMNS/ROWS, WRAP | Initialise a tile map. |
| 30 | TILE_UPLOAD | OFFSET, COUNT, TILES | Upload tile IDs. |
| 31 | TILE_DRAW | CAMERA, VIEWPORT, FLAGS | Draw a tile-map viewport. |
| 32 | TILE_RESTORE | REGION | Restore a tile-aligned region. |
Companion packs and compact sprites 33–38
| # | Function | Parameters | Usage |
|---|
| 33 | RESOURCE_ROM | BANK, PAGE | Register a read-only companion sprite ROM. |
| 34 | SPRITE_BATCH | COUNT, RECORDS | Draw up to 8 sprites per call. |
| 35 | COMPANION_SPRITE | X/Y, IMAGE, COLOUR, FLAGS, BANK, PAGE | Transient companion sprite draw; leaves active backends ready. |
| 36 | COMPACT_INIT | BANK (8), LENGTH (9–10) | Probe a writable bank and reset upload; follow with 17 then 18. |
| 37 | COMPACT_SPRITE | PX/PY, IMAGE, FLAGS (14), BANK (16), PAGE (17) | Draw an EGSP v3 frame (2–32 px) from SWRAM or a companion ROM, with optional mirror/rotate. |
| 38 | SET_MODE | MODE (8): 0–6, or &FF | Select the compact video mode; &FF is the Master dirty begin (hidden page, no clear). |
Fast trigonometry 39–40
Also direct JSR vectors: FAST_SIN_Q7=&8175, FAST_COS_Q7=&8178. A = phase byte 0–255; the result is a signed Q7 byte, −127..127.
| # | Function | Parameters | Usage |
|---|
| 39 | FAST_SIN_Q7 | phase | Signed Q7 sine in block byte 8. |
| 40 | FAST_COS_Q7 | phase | Signed Q7 cosine in block byte 8. |
Pixel, batching and overlays 41–43
| # | Function | Parameters | Usage |
|---|
| 41 | PIXEL | PX/PY, COLOUR 0–3 | Plot one opaque pixel; status replied. |
| 42 | LINE_BATCH | up to 8 lines, common colour | Experimental ordered line batching; validated before drawing. |
| 43 | EGOV_VALIDATE | image at &2C00; reply 8–10 | Validate an EGOV overlay in the Master window. No OS calls. |
Full parameter offsets for every function are documented on its BASIC reference page - the OSWORD block is identical for both languages.