

Task

Display the string       Goodbye, World!       on a GUI object   (alert box, plain window, text area, etc.).



Related task

   Hello world/Text


DEFINE PTR="CARD"
 
BYTE FUNC AtasciiToInternal(CHAR c)
  BYTE c2
 
  c2=c&$7F
  IF c2<32 THEN
    RETURN (c+64)
  ELSEIF c2<96 THEN
    RETURN (c-32)
  FI
RETURN (c)
 
PROC CharOut(CARD x BYTE y CHAR c)
  BYTE i,j,v
  PTR addr
 
  addr=$E000+AtasciiToInternal(c)*8;
  FOR j=0 TO 7
  DO
    v=Peek(addr)
    i=8
    WHILE i>0
    DO
      IF (v&1)=0 THEN
        Color=0
      ELSE
        Color=1
      FI
      Plot(x+i-1,y+j)
 
      v=v RSH 1
      i==-1
    OD
    addr==+1
  OD
RETURN
 
PROC TextOut(CARD x BYTE y CHAR ARRAY text)
  BYTE i
 
  FOR i=1 TO text(0)
  DO
    CharOut(x,y,text(i))
    x==+8
  OD
RETURN
 
PROC Frame(CARD x BYTE y,width,height)
  Color=1
  Plot(x,y)
  DrawTo(x+width-1,y)
  DrawTo(x+width-1,y+height-1)
  DrawTo(x,y+height-1)
  DrawTo(x,y)
RETURN
 
PROC Main()
  BYTE CH=$02FC,COLOR1=$02C5,COLOR2=$02C6
  BYTE i,x,y,width=[122],height=[10]
 
  Graphics(8+16)
  COLOR1=$0C
  COLOR2=$02
 
  FOR i=1 TO 10
  DO
    x=Rand(320-width)
    y=Rand(192-height)
    Frame(x,y,width,height)
    TextOut(x+1,y+1,"Goodbye, World!")
  OD
 
  DO UNTIL CH#$FF OD
  CH=$FF
RETURN