For I = 1 To 50:Print :Next I ''CLEAR

For Y = 0 To 15
  SETXY(1,Y+2)
  Print Hex$(Y) "_"
  For X = 0 To 15
    SETXY(X*3+4,1)
    Print "_" Hex$(X)
'    SETFGC(X)
'    SETBGC(X+1)
    SETXY(X*3+5,Y+2)
    Print (Chr$(Y*16+X))
  Next X
Next Y
'SETFGC(7)
'SETBGC(0)

Sub SETFGC(C As INTEGER)
  Local CC As INTEGER
  Local T As STRING
  CC=C And 7
  T=Chr$(27)+"[3"+Str$(CC)+"m"
  Print T;
End Sub

Sub SETBGC(C As INTEGER)
  Local CC As INTEGER
  Local T As STRING
  CC=C And 7
  T=Chr$(27)+"[4"+Str$(CC)+"m"
  Print T;
End Sub

Sub SETXY(X As INTEGER, Y As INTEGER)
  Local T As STRING
  T=Chr$(27)+ "["+ Str$(Y)+ ";"+ Str$(X)+ "H"
  Print T;
End Sub
