; ============================================================================
; demo.gp -- GP language demo: a WeatherSTAR-style icon sheet.
; Exercises every primitive: polygon (the 30-vert sun from the bench
; harnesses), ROM-float vertex prescale, pattern-mode gradient fill, arcs,
; lines, circles, rect frames, flood fill.
;
; Coordinates: x = 0..767 (horizontal), y = 0..479 (vertical) for ALL ops.
; (Memory is addr = base + y*768 + x; the ROM docs' "column" is this y.)
; Colours are logopal.txt palette indices.
; ============================================================================

NAVY   = 6
WHITE  = 2
GOLD   = 12
ORANGE = 80
TEAL   = 25
RED    = 44
GREEN  = 74
SKY0   = 100                  ; first step of the blue ramp in logopal

CL NAVY                       ; clear field to navy
FC NAVY                       ; frame interior stays navy
EX 3 3
RA 12 12 756 468              ; outer white frame

; ---- the sun: 30-vert polygon, prescaled x0.55 through the ROM float lib --
CO GOLD                       ; stroke
FC ORANGE                     ; interior
EX 0 0                        ; poly extents inflate the bbox: keep tight
TR 40 30                      ; nudge into the top-left panel
VP 148 124                    ; prescale pivot = sun centre
VS 0.55
PL 149 12  171 36  203 21  209 52  252 46  242 79  278 88  257 113  283 135  249 147  267 180  229 181  229 215  194 204  179 231  151 211  122 235  110 203  68 214  70 182  29 181  47 149  12 136  43 113  20 87  57 78  48 45  88 51  92 21  129 36
VZ
TR 0 0

; ---- gradient sky band: pattern-mode polygon (stepped, from the tile) ------
PG 1 16 SKY0 1                ; horizontal bands, 16 steps, base SKY0
MO P
WR 0
PL 300 40 730 40 730 200 300 200
MO S

; ---- pie wedges + ringed circle --------------------------------------------
CO RED
FC RED
EX 200 200                    ; ext >= half box -> solid sector
AR 40 280 200 440 0 90
CO TEAL
FC TEAL
AR 40 280 200 440 180 60
CO WHITE
FC NAVY
EX 6 6                        ; 6px annulus ring
CI 320 360 70                 ; circle sugar -> ellipse box

; ---- lines: thick + thin ----------------------------------------------------
CO GOLD
EX 3 3
LI 430 280 590 440
EX 1 1
LI 430 440 590 280

; ---- thin ellipse outline over the sky band ---------------------------------
; MO N = plain mode: stroke only, interior preserved. (In MO S the ellipse
; FILLS its interior with the FC colour via frame byte +$27.)
MO N
EX 1 1
CO WHITE
EL 460 60 700 180

; ---- half-size sun: the +$16 integer ladder works on FC12 polys too --------
; SC -2 = divide by 2, anchored at the vertex bbox-min; TR is added UNSCALED,
; so final position = bbox-min(12,12) + TR. Same 30 verts, no float prescale.
MO S
CO GOLD
FC ORANGE
EX 0 0
TR 600 325
SC -2
PL 149 12  171 36  203 21  209 52  252 46  242 79  278 88  257 113  283 135  249 147  267 180  229 181  229 215  194 204  179 231  151 211  122 235  110 203  68 214  70 182  29 181  47 149  12 136  43 113  20 87  57 78  48 45  88 51  92 21  129 36
SC 1
TR 0 0

; ---- flood fill: recolour the margin outside the frame ----------------------
CO GREEN
WR 0
FL 4 8                        ; seed in the border margin
