STRUCTURED PROGRAMMING LANGUAGE STRUCTURED PROGRAMMING LANGUAGE STRUCTURED PROGRAMMING LANGUAGE Copyright by Dennis Baer 1983 25 Miller Road Farmingdale,N.Y. 11735 516-694-5872 This language is dedicated to you, the PROGRAMMER. 1 Structured programming language A Structured Programming Language processor for the MS-DOS family of computers. The instructions for running the processor are on page 51. The following are the statements that make up the Structured Programming language: [ See important note on page 7. ] Statement Page 1. BEGIN 14 2. REAL 16 3. INTEGER 18 4. STRING 19 5. REAL ARRAY 20 6. INTEGER ARRAY 21 7. STRING ARRAY 22 8. PROCEDURE 23 9. COMMENT 25 10. GO 26 11. GO TO 26 12. GOTO 26 13. ONERRGOTO 27 14. RETURN 28 15. INPUT 29 16. LINEIN 30 17. GET [I/O] 31 18. PUT [I/O] 31 19. OUTPUT 32 20. CALL 33 21. FOR 34 22. IF 35 2 Statement Page 23. END 36 24. WHILE 37 25. REPEAT 38 26. ; 39 27. WRITE *Z 10.179-10.180 *I 4-298 4-299 28. CHAIN **Z 10.13-10.14 **I 4-36 29. BEEP *Z 10.5 *I 4-28 30. BLOAD **Z 10.6-10.7 **I 4-29 31. BSAVE **Z 10.8-10.9 **I 4-32 32. CALL [EXTERNAL] *Z 10.10-10.11 *I 4-34 33. CLEAR *Z 10.18 *I 4-44 34. CLOSE **Z 10.19 **I 4-46 35. FILES **Z 10.51 **I 4-97 36. FIELD *Z 10.50 *I 4-94 37. KILL **Z 10.84 **I 4-136 38. NAME **Z 10.108 **I 4-173 39. OPEN **Z 10.115-10.121 **I 4-189,4-194 40. OUT **Z 10.123 **I 4-201 41. DOS 40 42. POKE *Z 10.127 *I 4-214 43. RESET *Z 10.146 *I 4-243 44. RESUME *Z 10.148 *I 4-245 45. RUN **Z 10.152 **I 4-251 46. STOP *Z 10.161 *I 4-270 47. WAIT *Z 10.176 *I 4-290 48. HOME 41 49. DEFSEG 42 3 Statement Page 50. ERROR *Z 10.47-10.48 *I 4-91 51. KEY *Z 10.81-10.83 *I 4-131 52. LSET *Z 10.103 *I 4-163 53. RSET *Z 10.103 *I 4-163 54. RANDOMIZE *Z 10.141 *I 4-236 55. SWAP *Z 10.164 *I 4-277 56. COLOR *Z 10.21-10.22 *I 4-49,4-54 57. DRAW *Z 10.40-10.41 *I 4-79 58. CIRCLE *Z 10.17 *I 4-41 59. GET [GRAPHICS] *Z 10.59-10.61 *I 4-108 60. PUT [GRAPHICS] *Z 10.59-10.61 *I 4-232 61. LINE *Z 10.88-10.89 *I 4-141 62. LOCATE *Z 10.97-10.98 *I 4-155 63. PRESET *Z 10.129 *I 4-228 64. PSET *Z 10.138-10.139 *I 4-228 65. PAINT *Z 10.124 *I 4-203 66. SCREEN *Z 10.155 *I 4-257 67. DATE$ *Z 10.32 *I 4-66 68. TIME$ *Z 10.168-10.169 *I 4-281 69. MID$ *Z 10.106 *I 4-167 70. WIDTH *Z 10.178 *I 4-294 71. COM(N) *Z F.8-F.10 *I 4-56 72. KEY(N) *Z F.8-F.10 *I 4-134 73. ON COM(N) *Z F.8-F.10 *I 4-176 74. ON KEY(N) *Z F.8-F.10 *I 4-182 75. NULL *Z 10.110 76. EOT 43 4 Statement Page 77. Arithmetic assignment 44 78. String assignment 45 79. Labeled statement 46 The following functions are supported in the Structured Programming Language for MS DOS systems. Arithmetic Function Page Page (Z) (I) 1. ABS 10.1 4-21 2. ATN 10.3 4-25 3. CDBL 10.12 4-35 4. CINT 10.16 4-40 5. COS 10.26 4-60 6. CSNG 10.28 4-61 7. EXP 10.49 4-93 8. FIX 10.52 4-99 9. INT 10.80 4-130 10. LOG 10.100 4-159 11. RND 10.151 4-249 12. SGN 10.156 4-260 13. SIN 10.157 4-261 14. SQR 10.160 4-267 15. TAN 10.167 4-280 String function Page Page (Z) (I) 1. ASC 10.2 4-24 2. CHR$ 10.15 4-38 3. CVI 10.30 4-63 4. CVS 10.30 4-63 5 String Function Page Page (Z) (I) 5. CVD 10.30 4-63 6. EOF 10.44 4-86 7. FRE 10.57 4-104 8. HEX$ 10.64 4-115 9. INPUT$ 10.78 4-127 10. INSTR 10.79 4-129 11. LEFT$ 10.85 4-137 12. LEN 10.86 4-138 13. LOC 10.96 4-153 14. LOF 10.99 4-158 15. MID$ 10.105 4-167 16. MKI$ 10.107 4-170 17. MKS$ 10.107 4-170 18. MKD$ 10.107 4-170 19. OCT$ 10.111 4-175 20. RIGHT$ 10.150 4-248 21. SPACE$ 10.158 4-265 22. STR$ 10.162 4-272 23. STRING$ 10.163 4-276 24. VAL 10.172 4-285 Special Functions Page Page (Z) (I) 1. CSRLIN 10.29 4-62 2. FRE 10.57 4-104 3. INP 10.71 4-121 4. LPOS 10.101 4-160 5. PEEK 10.125 4-205 6. POINT 10.126 4-213 6 Special Functions Page Page (Z) (I) 7. POS 10.128 4-215 8. SCREEN 10.154 4-255 9. SPC 10.159 4-266 10. TAB 10.166 4-279 11. VARPTR 10.173 4-286,4-288 12. WIDTH 10.178 4-294 Special Variables 1. ERR 10.46 4-89 2. ERL 10.46 4-89 3. INKEY$ 10.70 4-119 Additional categories Page STATEMENT FORMATS 9 ARITHMETIC OPERATORS 47 STRING OPERATORS 47 LOGICAL OPERATORS 47 COMPARISON OPERATORS 47 IMPLEMENTATION RESTRICTIONS 48 REAL,INTEGER,STRING CONSTANTS 49 APPLICATION NOTES 50 RUNNING THE PROCESSOR 51 ERROR MESSAGES 52 INDEX 56 Note: *Z *I means refer to page in computer manufacturers BASIC manual. **Z **I means refer to page in computer manufacturers BASIC manual but command is slightly different. parentheses must be placed after the key word and before the semicolon. (Z=Zenith,I=IBM) See each statement format from pages 8 through 13. The statement must have variable names that conform to Structured Programming Language standards. If you don't see page references for your computer then consult your BASIC manual. 7 Programs written in the Structured Programming Language are kept in an ASCII text file. Any text editor that can create an ASCII text file for MS DOS can be used to write Structured Programming Language programs. It is a free format block and procedure oriented language that runs in the MS DOS environment. Each computer's implementation of a computer language has its own unique characteristics. In this implementation of the Structured Programming Language, the processor uses the text file of Structured Programming Language statements as input and translates this program to BASIC in an ASCII text file for the particular MS DOS system. The text file can be run by the BASIC interpreter or be compiled by the BASIC compiler after it is loaded into the interpreter workspace and then saved in ASCII format on the users disk drive. This manual is intended to be a reference manual for the MS DOS version of the Structured Programming Language and is not meant to be a tutorial. To get an idea of procedure oriented and block structured languages, you can read books on the ALGOL and PASCAL languages. 8 The following are the statement formats for the Structured Programming Language. 1. BEGIN 2. REAL {,,..........,}; 3. INTEGER {,,..........,}; 4. STRING {,,..........,}; 5. REAL ARRAY () {, (),..........}; 6. INTEGER ARRAY () {, (),..........}; 7. STRING ARRAY () {, (),..........}; 8. PROCEDURE { () }; BEGIN END 9. COMMENT ; [Note: should not contain ' char.] 10. GO