/*REXX*/
/*--- ASAY - AnsiSAY ---- MSDOS/PCDOS/DOSBOX/DOSEMU/Unix/Linux -------*/
/*                                 - 1999 Mark McDonald               */
/* CALL ACLS                       - Clear/Reset Screen               */
/* CALL APOS row,col               - Position Cursor on Screen        */
/* CALL ASAY 2,10,31,"Hello World"                                    */
/*           | |  |        +------- Text to Display                   */
/*           | |  +---------------- Attribute (0-255)                 */
/*           | +------------------- Column (1-80)                     */
/*           +--------------------- Row (1-25)                        */
/*      ASAY 0,0,31,""      Clears screen to White on Blue            */
/*--- Test Code - Displays 80x25 Screen ------------------------------*/
CALL ACLS
CALL ASAY  0,0,0,""
CALL ASAY  1,1,15, "SPF(1) ----------------------- EDIT/ENTRY PANEL --------------------------------"
CALL ASAY  2,1,15, "COMMAND ===>                                                                    "
CALL ASAY  4,1,9 , "PROJECT FILE:                                                                   "
CALL ASAY  5,1,9 , "   DRIVE                                                                        "
CALL ASAY  5,10,15,"===> ";CALL ASAY 5,15,12,"Z:\ROOT"
CALL ASAY  6,1,9 , "   PATH                                                                         "
CALL ASAY  6,10,15,"===>"
CALL ASAY  7,1,9 , "   PATH                                                                         "
CALL ASAY  7,10,15,"===>"
CALL ASAY  8,1,9 , "   PATH                                                                         "
CALL ASAY  8,10,15,"===>"
CALL ASAY  9,1,9 , "   NAME                                                                         "
CALL ASAY  9,10,15,"===>";CALL ASAY 9,15,12,"*.*"
CALL ASAY 10,1,9 , "              (Blank or patter for file selection list)                         "
CALL ASAY 12,1,9 , "SYSTEM CUR DIR: Z:\ROOT                                                         "
CALL ASAY 14,1,9 , "SYSTEM FILE SPECIFICATION:                                                      "
CALL ASAY 15,1,15, "===>                                                                            "
CALL ASAY 17,1,9 , "PROFILE                  (Blank defaults to file extension)                     "
CALL ASAY 17,10,15,"===>"
CALL ASAY 19,1,9 , "MAX RECL                 (1..4096, new profile default = 80 )                   "
CALL ASAY 19,10,15,"===>"
CALL ASAY 20,1,9 , "IMACRO                                                                          "
CALL ASAY 20,10,15,"===>"
CALL ASAY 21,1,9 , "XMACRO                                                                          "
CALL ASAY 21,10,15,"===>"
CALL ASAY 23,1,0,""
T = DATE('N')
CALL ASAY 25,26,10,LEFT(DATE('w'),3)" "WORD(T,2)" "WORD(T,1)", "WORD(T,3)" "LEFT(TIME('N'),5)
CALL ASAY 23,26,9,"Looping/Displaying";CALL ASAY 23,45,15,">>"
DO CNT = 1 TO 10000;CALL ASAY 23,48,14,CNT;END
PULL Z
 CALL ASAY 0,0,31,""
 SAY "HELLO...."
 PULL Z
EXIT                                          ;/* Exit program        */
/*====================================================================*/
/*--- ANSI Reset/Clear Screen ----------------------------------------*/
ACLS: PROCEDURE; T = CHAROUT('','1b'x||'[2J');RETURN
/*--- Position Cursor on Screen Using ANSI Codes ---------------------*/
APOS: PROCEDURE; ARG ROW,COL;
  T = CHAROUT('','1b'x||"["||ROW||";"||COL||"H")
RETURN
/*--- ASAY - Say Using ANSI Codes - (No CRLF After Text) -------------*/
ASAY: PROCEDURE
  PARSE ARG ROW,COL,ATTR,TSTR
  /*--- Set ANSI Codes ---*/
  AF = "30 34 32 36 31 35 33 37 1;30 1;34 1;32 1;36 1;31 1;35 1;33 1;37"
  AB = "40m 44m 42m 46m 41m 45m 43m 47m 5;40m 5;44m 5;42m 5;46m 5;41m 5;45m 5;43m 5;47m"
  ESC = "1b"x||"["                              ;/*Set ESC Code       */
  CF = (ATTR // 16)                             ;/*Calc Fore Color    */
  CB = (((ATTR - CF) / 16) // 128)              ;/*Calc Back Color    */
  FC = WORD(AF,(CF+1)); BC = WORD(AB,(CB+1))    ;/*Det ANSI Color     */
  IF ROW = 0 THEN TSTR = ESC||"2J"              ;/*Clear Screen?      */
  IF ROW <> 0 THEN TSTR = TSTR||ESC||"0m"
  TC = ESC||FC||";"||BC                         ;/*Set ANSI Color     */
  SP = ESC||ROW||";"||COL||"H"                  ;/*Set Position       */
  T = CHAROUT('',SP||TC||TSTR)                  ;/*Send to Screen     */
RETURN