← Assembly guide

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

#FunctionParametersUsage
0INITnoneSelect backend; reset effects.
1BEGINnoneSelect and clear the 20 KB drawing page (see 38 for a dirty begin).
2SPRITEPX/PY, IMAGEMasked 16×16 frame of the registered EGSP v3 resource, via the compact renderer; clips all edges.
3EMITPX/PY, AMOUNT, FLAGS bit 0Seed the 64-particle pool.
4PARTICLESFLAGS bit 0Advance and draw particles.
5TRAILPX/PYAppend to the 32-entry ring.
6PRESENTnoneWait vsync; flip the Master shadow page.
7TEXTSTR, PX/PYAligned opaque 8×8 text.
8RESETFXnoneClear particle, trail and counter state.
9DOTPX/PY, COLOUR 0–3Plot 2×2 point.
10LINEPX/PY, LX/LY, COLOURBounded integer line.

World extension 11–15

Optional: requires explicitly granted writable SWRAM and extra metadata.

#FunctionParametersUsage
11WORLD_INITBANK, SEED, WIDTH/HEIGHTInitialise a world backend.
12WORLD_UPLOADOFFSET, COUNT, DATAUpload world data blocks.
13WORLD_BEGINCAMERA/STATUSBegin a world frame.
14WORLD_ACTORSCOUNT, ACTORSSubmit actor records.
15WORLD_ENDnoneFinish the world frame; legacy HP/XP UI adapter.

Disk resources and snakes 16–21

#FunctionParametersUsage
16RESOURCE_INITBANK, FRAMESInitialise sprite resources.
17RESOURCE_UPLOADOFFSET, COUNT, DATAUpload sprite and mask bytes.
18RESOURCE_READYnoneValidate resources.
19SNAKE_INITID, LENGTH, GAP, IMAGE, CUSTOMCreate a sprite snake.
20SNAKE_STEPID, HEAD X/YMove a sprite snake.
21SNAKE_DRAWIDDraw a sprite snake.

Shapes and UI 22–28

#FunctionParametersUsage
22CIRCLEPX/PY, COLOUR, FLAGS, RADIUSInteger outline or filled circle.
23XOR_SPRITEPX/PY, IMAGEReserved: acknowledged but draws nothing in 0.6.
24POLYGONCOUNT, FILL, COLOUR, POINTSBounded polygon, 3–8 vertices, optional fill.
25ARCPX/PY, RADIUS, COLOUR, FLAGS, ANGLESArc segment, angles 0–255 clockwise, optional fill.
26BEZIERDEGREE, STEPS, COLOUR, CONTROLSBézier curve.
27PROGRESS_BARX/Y, WIDTH/HEIGHT, FG/BG, VALUE/MAX, TITLETitled progress bar.
28BANNERX/Y, WIDTH, BG, TEXTText banner.

Tile maps 29–32

#FunctionParametersUsage
29TILE_INITCOLUMNS/ROWS, WRAPInitialise a tile map.
30TILE_UPLOADOFFSET, COUNT, TILESUpload tile IDs.
31TILE_DRAWCAMERA, VIEWPORT, FLAGSDraw a tile-map viewport.
32TILE_RESTOREREGIONRestore a tile-aligned region.

Companion packs and compact sprites 33–38

#FunctionParametersUsage
33RESOURCE_ROMBANK, PAGERegister a read-only companion sprite ROM.
34SPRITE_BATCHCOUNT, RECORDSDraw up to 8 sprites per call.
35COMPANION_SPRITEX/Y, IMAGE, COLOUR, FLAGS, BANK, PAGETransient companion sprite draw; leaves active backends ready.
36COMPACT_INITBANK (8), LENGTH (9–10)Probe a writable bank and reset upload; follow with 17 then 18.
37COMPACT_SPRITEPX/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.
38SET_MODEMODE (8): 0–6, or &FFSelect 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.

#FunctionParametersUsage
39FAST_SIN_Q7phaseSigned Q7 sine in block byte 8.
40FAST_COS_Q7phaseSigned Q7 cosine in block byte 8.

Pixel, batching and overlays 41–43

#FunctionParametersUsage
41PIXELPX/PY, COLOUR 0–3Plot one opaque pixel; status replied.
42LINE_BATCHup to 8 lines, common colourExperimental ordered line batching; validated before drawing.
43EGOV_VALIDATEimage at &2C00; reply 8–10Validate 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.