SPI Programming Manual (G06.24+, H06.03+, J06.03+)

SPI Programming Examples
SPI Programming Manual427506-006
E-67
Example E-13: Common Declarations for TAL
Examples
Example E-13: Common Declarations for TAL Examples
This TAL code contains common declarations used by the other TAL example
programs.
Source File
SETCDECS
Example E-13. TAL File: SETDECS Supporting Code
?SYMBOLS, INSPECT, NOCODE, NOMAP, NOLMAP, DATAPAGES 64
?NOLIST, SOURCE ZSPITAL
?LIST
--
-- File name: SETCDECS
-- SPI EXAMPLE TAL Common Declarations and variables.
--
LITERAL tkn^1 = 1D '<<' 24 + 1D '<<' 16 + 1D;
LITERAL tkn^2 = 1D '<<' 24 + 1D '<<' 16 + 2D;
LITERAL tkn^3 = 1D '<<' 24 + 1D '<<' 16 + 3D;
LITERAL tkn^4 = 1D '<<' 24 + 1D '<<' 16 + 4D;
LITERAL tkn^5 = 1D '<<' 24 + 1D '<<' 16 + 5D;
LITERAL tkn^6 = 1D '<<' 24 + 1D '<<' 16 + 6D;
LITERAL false = 0,
true = -1;
-- SPI related variables
INT .b1 [0:max^bufsize/2]; ! SPI buffer 1
INT .b2 [0:max^bufsize/2]; ! SPI buffer 2
INT bufsize;
INT err := 0;
INT last^file^err; ! Set by "get^file^error"
INT .ssid [0:5] := ["EXAMPLES", 1, 0 ];
INT(32) tkn^code;
STRUCT tkn^code^def (zspi^ddl^tokencode^def) = tkn^code;
INT .tkn^buffer^i [0:49]; ! For GET and PUT
INT .tkn^value := @tkn^buffer^i; ! For GET and PUT
INT(32) .tkn^value^2 := @tkn^buffer^i; ! For GET and PUT
STRING .tkn^buffer := @tkn^buffer^i '<<' 1; ! For GET and PUT
STRING val;
-- Program misc. variables
INT continue; ! flag
INT line [0:50]; ! output buffer for the home term.
STRING .sline := @line '<<' 1;
STRING .sp; ! String pointer.
INT term; ! The home term’s file number.
INT .termname [0:11]; ! The home term’s name.