← EGFX function index

EGFX · FUNCTION 37ALPHA · USE AT YOUR OWN RISK

COMPACT_SPRITE

Draw a compact EGSP v3 sprite.

The general sprite renderer. It reads any EGSP v3 pack (square 2, 4, 8, 16 or 32-pixel frames) from a writable bank loaded with function 36 or directly from a companion ROM, and checks the header, frame and pack extent on every call. MODE 1 frames at a 4-pixel-aligned X, untransformed and fully visible, use the fast screen-byte blitter; everything else uses the pixel-run blitter. Mask bits 00 write the colour (black included), so an all-black opaque frame works as an eraser. BASIC: PROCegcompact(x%,y%,frame%,flags%,bank%,page%).

Parameters

NameBytesDescription
PX/PY8–11signed 16-bit position; clips to 320×256
IMAGE12frame number
FLAGS14&10 mirror X, &20 mirror Y, &40 rotate 90° clockwise
BANK16source slot
PAGE17header page, &80–&BF

BASIC example

Tested listing: ex37.bas, run in B-em on a Master 128. Append the EGFX helpers from gfx-basic.bas (the build does this for you), and put the Breakout EGASSETS.rom (with the beta release) in slot 7 where the example draws from &81/&87.

10 MODE 1:HIMEM=&2400:PROCeginit
20 PROCegbegin
30 PROCegcompact(100,100,0,0,7,&87)
40 PROCegcompact(140,100,4,0,7,&81):PROCegcompact(140,120,4,&20,7,&81)
50 PROCegtext("FN37 OK",8,8):PROCegpresent
60 END

Assembly

        LDA #37 : STA block+5      ; function
        LDA #0  : STA block+7      ; clear ACK
        LDA #&C0 : LDX #block MOD 256 : LDY #block DIV 256
        JSR &FFF1                  ; OSWORD &C0; block+7 = &A5 on success

← Function index