' File: scrnmem.lst
'
' Initial experiments with screen memory
'
'
' This trick works in almost all dialects of BASIC
'
false=(1=0)
true=(0=0)
CLS
'
' Determine base address of screen memory
'
pictbase%=XBIOS(2)
'
'
' terminate%=FALSE
REPEAT
  PRINT AT(2,2);
  INPUT "Line (0-399) ",line%
  INPUT "Column (0-79) ",column%
  IF line%>=0 AND column%>=0 AND line%=<400 AND column%<80
    '
    ' Calculate screen position
    '
    address1%=pictbase%+line%*80+column%
    address2%=address1%+80
    address3%=address2%+80
    '
    ' Write to screen position
    ' Byte and word/long, if even address
    '
    POKE address1%,-1
    IF (address1% AND 1)=0
      DPOKE address2%,-1
      LPOKE address3%,-1
    ENDIF
  ELSE
    terminate%=TRUE
  ENDIF
UNTIL terminate%
