home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols000 / vol024 / cursor.pas < prev    next >
Pascal/Delphi Source File  |  1984-04-29  |  2KB  |  71 lines

  1. (*****************************************************
  2. *
  3. *    SD SALES 8024 XY CURSOR CONTROL PROGRAM
  4. *
  5. *    This is a demo of the SD Sales video board
  6. *  8024 XY cursor control.  The main procedure will
  7. *  be extracted and put in my library for use in future
  8. *  programs that I write. But this prgram demonstrates
  9. *  just how it works. This type of XY cusor positioning
  10. *  is only good for inserting ASCII characters but the
  11. *  8024 has the ability to be programed with graphic
  12. *  characters so this is a good first step.
  13. *
  14. *  Written by Charlie Foster, Dec 80
  15. *  Donated to the Pascal/Z Users Group
  16. *****************************************************)
  17.  
  18.  
  19. PROGRAM XYDEMO;
  20.  
  21. VAR
  22.              X,Y : INTEGER;
  23.           CR,Z : CHAR;
  24.  
  25. PROCEDURE CURSOR (X,Y : INTEGER; Z : CHAR );
  26. (*This subroutine is designed to input the proper series
  27. of characters to the SD SALES Video Board 8024 to give
  28. XY Cursor. It needs ESC=XYZ where Z=character to print.
  29. It has a offset to worry about so this subroutine needs
  30. to take care everything. X=row, Y=column, Z=character  *)
  31.  
  32. VAR
  33.             CODE : STRING 5;    (*gets output to video*)
  34.   C1,C2,C3,C4,C5 : CHAR;    (*elements of CODE*)
  35.  
  36. BEGIN
  37.     Y := Y + 31;        (*add offset*)
  38.     X := X + 31;        (*add offset*)
  39.     C1 := CHR(27);        (*ESC character*)
  40.     C2 := CHR(61);        (* = character*)
  41.     C3 := CHR(X);        (*integer*)
  42.     C4 := CHR(Y);        (*integer*)
  43.     C5 := Z;        (*any ASCII character*)
  44.     CODE := C1;        (*string it all togeather*)
  45.     APPEND(CODE,C2);
  46.     APPEND(CODE,C3);
  47.     APPEND(CODE,C4);
  48.     WRITE(CODE);        (*write position to Video*)
  49.     WRITE(C5);        (*can call anything here*)
  50. END;
  51.  
  52. BEGIN    (* MAIN --This is for demo purposes only *)
  53.  
  54.   REPEAT
  55.     WRITE(CHR(26));        (* clears screen *)
  56.     WRITELN(' ':20, 'CHARLIES CURSOR TEST');
  57.     WRITELN(' ':20, '(to repeat test,hit CR)');
  58.     WRITELN(' ':20, '(to quit, hit control C)');
  59.     WRITELN;
  60.     WRITE ('ENTER row number(1 thru 80)-->  ');
  61.     READLN(X);
  62.     WRITE ('ENTER column number(1 thru 24)-->  ');
  63.     READLN(Y);
  64.     WRITE ('ENTER any ASCII character-->  ');
  65.     READLN(Z);
  66.     CURSOR(X,Y,Z);
  67.     READLN(CR);
  68.     UNTIL Z = '&';
  69. END.
  70.  
  71.