EGFX · BASIC REFERENCEALPHA · USE AT YOUR OWN RISK
Function reference
Using PROCegcall
PROCegcall sends a 64-byte request block through MOS OSWORD &C0. Bytes 0 and 1 contain the sent and returned lengths. Bytes 2–5 contain the EG signature and version. Byte 5 selects the function. Bytes 8–21 carry the common parameters; bytes 22–63 carry inline text or function-specific data. Clear byte 7 before the call; EGFX returns &A5 there when it has accepted the request.
Each call from BASIC costs about 1.7 centiseconds before EGFX draws anything, so a frame that makes 30 calls cannot exceed about 2 frames per second. Batch where you can (34, 42), keep the dirty begin (38) and redraw only what changed. The Breakout measuring page shows a BASIC game reaching about 4.7 fps this way. Beyond that, move the hot loop to assembly.
Build and run
With the beta release, load egfx.ssd as the B-em disc image, and keep the disc file SPRITES unchanged. Build the EGFX image with bash tools/build.sh and run a profile with bash tools/run.sh master. BASIC is for experimentation, quick layout and testing; use Assembly for game-quality performance.
Functions
- 0 · INITInitialise EGFX.
- 1 · BEGINBegin a frame.
- 2 · SPRITEDraw a masked sprite.
- 3 · EMITCreate particles.
- 4 · PARTICLESAnimate particles.
- 5 · TRAILDraw a fading trail.
- 6 · PRESENTPresent the frame.
- 7 · TEXTDraw text.
- 8 · RESETFXReset effects.
- 9 · DOTDraw a dot.
- 10 · LINEDraw a line.
- 11 · WORLD_INITInitialise a world.
- 12 · WORLD_UPLOADUpload world data.
- 13 · WORLD_BEGINBegin a world frame.
- 14 · WORLD_ACTORSSubmit actors.
- 15 · WORLD_ENDFinish a world frame.
- 16 · RESOURCE_INITInitialise sprite resources.
- 17 · RESOURCE_UPLOADUpload sprite data.
- 18 · RESOURCE_READYValidate resources.
- 19 · SNAKE_INITCreate a sprite snake.
- 20 · SNAKE_STEPMove a sprite snake.
- 21 · SNAKE_DRAWDraw a sprite snake.
- 22 · CIRCLEDraw a circle.
- 23 · XOR_SPRITEXOR a sprite.
- 24 · CIRCLE_EXDraw a filled or outline circle.
- 25 · POLYGONDraw a polygon.
- 26 · BEZIERDraw a Bézier curve.
- 27 · PROGRESS_BARDraw a progress bar.
- 28 · BANNERDraw a text banner.
- 29 · TILE_INITInitialise a tile map.
- 30 · TILE_UPLOADUpload tile IDs.
- 31 · TILE_DRAWDraw a tile-map viewport.
- 32 · TILE_RESTORERestore a tile region.
- 33 · RESOURCE_ROMUse a companion ROM.
- 34 · SPRITE_BATCHDraw a sprite batch.
- 35 · SPRITE_ROM_ONCEDraw one companion-ROM sprite.
- 36 · COMPACT_INITPrepare sideways RAM for a compact pack.
- 37 · COMPACT_SPRITEDraw a compact EGSP v3 sprite.
- 38 · SET_MODE / DIRTY BEGINBegin a frame without clearing (Master).
- 39 · FAST_SIN_Q7Fast sine.
- 40 · FAST_COS_Q7Fast cosine.
- 41 · PIXELPlot one pixel.
- 42 · LINE_BATCHDraw up to eight lines.
- 43 · EGOV_VALIDATEValidate an overlay.