'USING MACRO FUNCTIONS
'2D ARRAY WITH BOUNDARY CLIPPING
indexbase 0
int pix[800*600]
'
'SINGLE-LINE MACRO FUNCTION
'macro pix2d(x,y) pix(y*800+x)
'
'MULTI-LINE MACRO RETURNING A UNIQUE VARIABLE
'
macro pix2d int* (v,x,y,  vv)
=============================
  'v  pixel pointer supporting read/write
  'x  horizontal coordinate
  'y  vertical coodinate
  'vv sink pixel
  if x>=0 and x<800 and y>=0 and y<600
    @v=@pix(y*800+x)
  else
    int vv=0xffffffff 'value when out of bounds
    @v=@vv
  end if
end macro
'
'TEST
pix2d(1,20)=0x77aabbcc
print hex pix2d(1,20)
print hex pix2d(800,10)
