home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 5 / ctrom5b.zip / ctrom5b / PROGRAM / DIVERSEN / TIPI2A / HELPIO.TPI < prev    next >
Text File  |  1994-09-24  |  14KB  |  653 lines

  1. define menu
  2. # ( -- choice)
  3. # ( valid$ -- )
  4. # Returns the chosen key or 0 if the user escapes from this menu
  5.  0 cursor
  6.  ucase$
  7.  27 chr$ swap$ +$
  8.  begin
  9.   inkey$ ucase$ # valid$ key$
  10.   len instr *
  11.   dup
  12.   if dup drop$ endif drop$
  13.  until
  14.  1 -
  15.  1 cursor
  16. enddef
  17.  
  18. define wait
  19.  begin key until cls
  20. enddef
  21.  
  22.  begin cls
  23. |
  24. |   ╔══════════════════════════════════════════════════════════╗
  25. |   ║          I / O    I N S T R U C T I O N S                ║
  26. |   ╠═════════════╦══════════════╦══════════════╦══════════════╣
  27. |   ║ [A] BEEP    ║ [M] CURSOR   ║ [Y] ISINPUT  ║ [!] PRINTCHR ║
  28. |   ║ [B] BLOAD   ║ [N] DEFSEG   ║ [Z] ISOUTPUT ║ [@] PRINTER  ║
  29. |   ║ [C] BSAVE   ║ [O] EOF      ║ [1] KEY      ║ [#] PRINT$   ║
  30. |   ║ [D] CLOSE   ║ [P] EXTENDED ║ [2] LF       ║ [$] PUTBYTE  ║
  31. |   ║ [E] CLS     ║ [Q] FILEPOS  ║ [3] LOCATE   ║ [%] PUTPORT  ║
  32. |   ║ [F] COLOR   ║ [R] GETBYTE  ║ [4] MOUSE    ║ [^] ROW      ║
  33. |   ║ [G] COLOR?  ║ [S] GETNUM   ║ [5] OPEN     ║ [&] SETVOL   ║
  34. |   ║ [H] COLUMN  ║ [T] GETPORT  ║ [6] OPENCOM  ║ [*] SOUND    ║
  35. |   ║ [I] COMSTAT ║ [U] GETVOL   ║ [7] OUTPORT  ║ [+] VARPTR   ║
  36. |   ║ [J] CONSOLE ║ [V] GET$     ║ [8] PEEK     ║ [|]  |       ║
  37. |   ║ [K] CR      ║ [W] INKEY$   ║ [9] POKE     ║              ║
  38. |   ║ [L] CURRENT ║ [X] INPORT   ║ [0] PRINT    ║              ║
  39. |   ╚═════════════╩══════════════╩══════════════╩══════════════╝
  40.  "abcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*+|" menu dup cls
  41.  case 0 of endof
  42.       1 of
  43. |
  44. |   BEEP
  45. |
  46. |   Data Stack:            --
  47. |   String Stack:          --
  48. |
  49. |   Produces a short beep.
  50. |
  51.         wait
  52.         endof
  53.       2 of
  54. |
  55. |   BLOAD
  56. |
  57. |   Data Stack:           addr count --
  58. |   String Stack:              file$ --
  59. |
  60. |   Loads count bytes of data to addr from file$.
  61. |   Addr is an address in the current segment.
  62. |
  63.         wait
  64.         endof
  65.       3 of
  66. |
  67. |   BSAVE
  68. |
  69. |   Data Stack:            addr count --
  70. |   String Stack:               file$ --
  71. |
  72. |   Saves count bytes from addr to file$. Addr is an
  73. |   address in the current segment.
  74. |
  75.         wait
  76.         endof
  77.       4 of
  78. |
  79. |   CLOSE
  80. |
  81. |   Data Stack:          N --
  82. |   String Stack:          --
  83. |
  84. |   Closes file N. N should be either a 1 or a 2.
  85. |
  86.         wait
  87.         endof
  88.       5 of
  89. |
  90. |   CLS
  91. |
  92. |   Data Stack:            --
  93. |   String Stack:          --
  94. |
  95. |   Clears the screen and places the cursor in the
  96. |   upper left corner.
  97. |
  98.         wait
  99.         endof
  100.       6 of
  101. |
  102. |   COLOR
  103. |
  104. |   Data Stack:        Foreground Background --
  105. |   String Stack:                            --
  106. |
  107. |   Sets the foreground and background colors of the
  108. |   screen for subsequent prints. Colors are as
  109. |   follows: 0 Black, 1 Blue, 2 Green, 3 Cyan, 4 Red,
  110. |   5 Magenta, 6 Brown, 7 Gray, 8 Dark Gray,
  111. |   9 Lt. Blue, 10 Lt. Green, 11 Lt. Cyan,
  112. |   12 Lt. Red, 13 Lt. Magenta, 14 Yellow, 15 White.
  113. |
  114. |   Notes --
  115. |   1) Background colors 8 to 15 result in
  116. |      blinking text.
  117. |
  118.         wait
  119.         endof
  120.       7 of
  121. |
  122. |   COLOR?
  123. |
  124. |   Data Stack:              -- flag
  125. |   String Stack:            --
  126. |
  127. |   Returns TRUE if a color card is detected, FALSE
  128. |   if a monochrome card is detected.
  129. |
  130.         wait
  131.         endof
  132.       8 of
  133. |
  134. |   COLUMN
  135. |
  136. |   Data Stack:              -- col
  137. |   String Stack:            --
  138. |
  139. |   Places the column of the current cursor
  140. |   position on the data stack.
  141. |
  142.         wait
  143.         endof
  144.       9 of
  145. |
  146. |   COMSTAT
  147. |
  148. |   Data Stack:          port -- status
  149. |   String Stack:             --
  150. |
  151. |   Returns the status of a com port. Port should be
  152. |   1 or 2. Status bits as follows:
  153. |   Bit 0 Delta CTS, Bit 1 Delta DSR, Bit 2 RD,
  154. |   Bit 3 Delta receive line signal detect, Bit 4
  155. |   CTS, Bit 5 DSR, Bit 6 Ring Indicator, Bit 7
  156. |   Received line signal detect, Bit 8 Data Ready,
  157. |   Bit 9 Overrun error, Bit 10 Parity Error, Bit 11
  158. |   Framing error, Bit 12 Break detect error, Bit 13
  159. |   Transfer holding register empty, Bit 14 Transfer
  160. |   shift register empty, Bit 15 Time-out,error.
  161. |
  162.         wait
  163.         endof
  164.      10 of
  165. |
  166. |   CONSOLE
  167. |
  168. |   Data Stack:                 -- 0
  169. |   String Stack:               --
  170. |
  171. |   Places the constant 0 on the data stack. The
  172. |   CONSOLE instruction is used for clarity. For
  173. |   example, the sequence CONSOLE ISINPUT is much
  174. |   clearer than 0 ISINPUT.
  175. |
  176.         wait
  177.         endof
  178.      11 of
  179. |
  180. |   CR
  181. |
  182. |   Data Stack:                 --
  183. |   String Stack:               --
  184. |
  185. |   Sends a carriage return to the current output
  186. |   device.
  187. |
  188.         wait
  189.         endof
  190.      12 of
  191. |
  192. |   CURRENT
  193. |
  194. |   Data Stack:               -- -2
  195. |   String Stack:             --
  196. |
  197. |   Places the constant -2 on the data stack.
  198. |   CURRENT is used for clarity. For example,
  199. |   1 CURRENT FILEPOS is much clearer than
  200. |   1 -2 FILEPOS.
  201. |
  202.         wait
  203.         endof
  204.      13 of
  205. |
  206. |   CURSOR
  207. |
  208. |   Data Stack:           N --
  209. |   String Stack:           --
  210. |
  211. |   If N is zero, the cursor will be made invisible.
  212. |   If N is non-zero, the cursor will be made
  213. |   visible. WARNING! Don't execute a 1 CURSOR unless
  214. |   you have already executed at least one 0 CURSOR.
  215. |
  216.         wait
  217.         endof
  218.      14 of
  219. |
  220. |   DEFSEG
  221. |
  222. |   Data Stack:           N --
  223. |   String Stack:           --
  224. |
  225. |   DEFSEG is used to define the data segment used
  226. |   in subsequent PEEK and POKE instructions. If N
  227. |   is -1, the data segment is set back to TIPI's
  228. |   default data segment address.
  229. |
  230.         wait
  231.         endof
  232.      15 of
  233. |
  234. |   EOF
  235. |
  236. |   Data Stack:              -- -1
  237. |   String Stack:            --
  238. |
  239. |   Places the constant -1 on the data stack. EOF is
  240. |   used for clarity. For example, 1 EOF FILEPOS is
  241. |   much clearer than 1 -1 FILEPOS.
  242. |
  243.         wait
  244.         endof
  245.      16 of
  246. |
  247. |   EXTENDED
  248. |
  249. |   Data Stack:               -- n
  250. |   String Stack:             --
  251. |
  252. |   Returns the contents of the system variable
  253. |   EXTENDED. This is used in conjunction with
  254. |   INKEY$. EXTENDED will be 0 if a "normal" key is
  255. |   pressed, 1 if an "extended" key is pressed.
  256. |
  257.         wait
  258.         endof
  259.      17 of
  260. |
  261. |   FILEPOS
  262. |
  263. |   Data Stack:       filenum action -- loc
  264. |   String Stack:                    --
  265. |
  266. |   FILEPOS is used to position and read the value
  267. |   of a file pointer. The filenum is a previously
  268. |   opened file number (1 or 2) and the action is
  269. |   either EOF, CURRENT or a specific location. The
  270. |   number loc returned on the data stack is the
  271. |   location in the file where the next action will
  272. |   occur. EOF moves the pointer to the end of the
  273. |   file, CURRENT keeps it at its current position
  274. |   and any other number moves the pointer to that
  275. |   location in the file.
  276. |
  277.         wait
  278.         endof
  279.      18 of
  280. |
  281. |   GETBYTE
  282. |
  283. |   Data Stack:            filenum -- byte
  284. |   String Stack:                  --
  285. |
  286. |   Gets a single byte from a file whose filenumber
  287. |   is filenum. The file must have been previously
  288. |   opened and filenum must be either 1 or 2.
  289. |
  290.         wait
  291.         endof
  292.      19 of
  293. |
  294. |   GETNUM
  295. |
  296. |   Data Stack:              -- n
  297. |   String Stack:            --
  298. |
  299. |   Gets a number from the current input device.
  300. |
  301.         wait
  302.         endof
  303.      20 of
  304. |
  305. |   GETPORT
  306. |
  307. |   Data Stack:           Port -- Byte
  308. |   String Stack:              --
  309. |
  310. |   Gets a Byte from a serial port. Port may be
  311. |   either 1 or 2, specifying COM1 or COM2.
  312. |
  313.         wait
  314.         endof
  315.      21 of
  316. |
  317. |   GETVOL
  318. |
  319. |   Data Stack:                -- Vol
  320. |   String Stack:              --
  321. |
  322. |   Gets the system sound volume on an HP100LX. Vol
  323. |   may vary from 0 (silent) to 3 (loudest).
  324. |
  325.         wait
  326.         endof
  327.      22 of
  328. |
  329. |   GET$
  330. |
  331. |   Data Stack:                --
  332. |   String Stack:              -- string$
  333. |
  334. |   Gets a string from the current input device.
  335. |
  336.         wait
  337.         endof
  338.      23 of
  339. |
  340. |   INKEY$
  341. |
  342. |   Data Stack:                --
  343. |   String Stack:              -- k$
  344. |
  345. |   Scans the keyboard and returns a one character
  346. |   string. If no key is pressed, k$ is null (""),
  347. |   otherwise k$ is the character whose key was
  348. |   pressed. If an extended key was pressed, the
  349. |   system variable EXTENDED is set to TRUE.
  350. |
  351.         wait
  352.         endof
  353.      24 of
  354. |
  355. |   INPORT
  356. |
  357. |   Data Stack:            Port -- Byte
  358. |   String Stack:               --
  359. |
  360. |   Gets a Byte from a specific hardware port. This
  361. |   is used to read joysticks, etc.
  362. |
  363.         wait
  364.         endof
  365.      25 of
  366. |
  367. |   ISINPUT
  368. |
  369. |   Data Stack:                n --
  370. |   String Stack:                --
  371. |
  372. |   Sets the current input device to n, where n is
  373. |   either file number 1 or 2 or the CONSOLE. The
  374. |   CONSOLE is device 0.
  375. |
  376.         wait
  377.         endof
  378.      26 of
  379. |
  380. |   ISOUTPUT
  381. |
  382. |   Data Stack:                n --
  383. |   String Stack:                --
  384. |
  385. |   Sets the current output device to n, where n is
  386. |   either filenumber 1 or 2, the PRINTER or the
  387. |   CONSOLE. The CONSOLE is device 0 and the
  388. |   PRINTER is device 3.
  389. |
  390.         wait
  391.         endof
  392.      27 of
  393. |
  394. |   KEY
  395. |
  396. |   Data Stack:             -- k
  397. |   String Stack:           --
  398. |
  399. |   Scans the keyboard and returns a keycode. If no
  400. |   key is pressed, k is 0.
  401. |
  402.         wait
  403.         endof
  404.      28 of
  405. |
  406. |   LF
  407. |
  408. |   Data Stack:             --
  409. |   String Stack:           --
  410. |
  411. |   Sends a line feed to the current output device.
  412. |
  413.         wait
  414.         endof
  415.      29 of
  416. |
  417. |   LOCATE
  418. |
  419. |   Data Stack:         row col --
  420. |   String Stack:               --
  421. |
  422. |   Places the cursor at row, col.
  423. |
  424.         wait
  425.         endof
  426.      30 of
  427. |
  428. |   MOUSE
  429. |
  430. |   Data Stack:         AX BX CX DX -- AX BX CX DX
  431. |   String Stack:                   --
  432. |
  433. |   Calls the low-level mouse interupt. See MOUSE.TPI
  434. |   for examples.
  435. |
  436.         wait
  437.         endof
  438.      31 of
  439. |
  440. |   OPEN
  441. |
  442. |   Data Stack:             N --
  443. |   String Stack:       T$ F$ --
  444. |
  445. |   Opens a file. N is the file number and N may be
  446. |   either a 1 or a 2. T$ is the type of open and
  447. |   T$ may be either "I", "O", "A" or "R" which
  448. |   stand for Input, Output, Append or Random
  449. |   respectively. F$ is the name of the file to open.
  450. |
  451.         wait
  452.         endof
  453.      32 of
  454. |
  455. |   OPENCOM
  456. |
  457. |   Data Stack:        Baud Parity Stop Size Port --
  458. |   String Stack:                                 --
  459. |
  460. |   Initializes the serial port. Use settings
  461. |   from the following tables.
  462. |
  463. |       Baud                      Parity
  464. |   Value  Description        Value  Description
  465. |   ------------------        ------------------
  466. |     0     110 baud            0     None
  467. |     1     150 baud            1     Odd
  468. |     2     300 baud            3     Even
  469. |     3     600 baud
  470. |     4    1200 baud
  471. |     5    2400 baud
  472. |     6    4800 baud
  473. |     7    9600 baud
  474. |
  475. |   Stop may be 1 or 2, Port may be 1 or 2, Size may
  476. |   be either 7 or 8 bits.
  477. |
  478.         wait
  479.         endof
  480.      33 of
  481. |
  482. |   OUTPORT
  483. |
  484. |   Data Stack:          Byte Port --
  485. |   String Stack:                  --
  486. |
  487. |   Sends a Byte out to a port. Port should be in
  488. |   the range 0 to 255.
  489. |
  490.         wait
  491.         endof
  492.      34 of
  493. |
  494. |   PEEK
  495. |
  496. |   Data Stack:          Addr -- Byte
  497. |   String Stack:             --
  498. |
  499. |   Places the contents of Addr on the data stack.
  500. |   Addr is an address in the current segment. To
  501. |   change the current segment, use DEFSEG.
  502. |
  503.         wait
  504.         endof
  505.      35 of
  506. |
  507. |   POKE
  508. |
  509. |   Data Stack:           Addr Byte --
  510. |   String Stack:                   --
  511. |
  512. |   Pokes Byte into Addr. Addr is an address in the
  513. |   current segment. To change the current segment,
  514. |   use DEFSEG.
  515. |
  516.         wait
  517.         endof
  518.      36 of
  519. |
  520. |   PRINT
  521. |
  522. |   Data Stack:               n --
  523. |   String Stack:               --
  524. |
  525. |   Prints the number n on the current output
  526. |   device.
  527. |
  528.         wait
  529.         endof
  530.      37 of
  531. |
  532. |   PRINTCHR
  533. |
  534. |   Data Stack:                c --
  535. |   String Stack:                --
  536. |
  537. |   Prints the character whose ASCII code is c on
  538. |   the current output device.
  539. |
  540.         wait
  541.         endof
  542.      38 of
  543. |
  544. |   PRINTER
  545. |
  546. |   Data Stack:               -- 3
  547. |   String Stack:             --
  548. |
  549. |   Places the constant 3 on the data stack. The
  550. |   PRINTER instruction is used for clarity. For
  551. |   example, the sequence PRINTER ISOUTPUT is much
  552. |   clearer than 3 ISOUTPUT.
  553. |
  554.         wait
  555.         endof
  556.      39 of
  557. |
  558. |   PRINT$
  559. |
  560. |   Data Stack:              --
  561. |   String Stack:         a$ --
  562. |
  563. |   Prints the string a$ on the current output
  564. |   device.
  565. |
  566.         wait
  567.         endof
  568.      40 of
  569. |
  570. |   PUTBYTE
  571. |
  572. |   Data Stack:          B F --
  573. |   String Stack:            --
  574. |
  575. |   Outputs byte B to file F.
  576. |
  577.         wait
  578.         endof
  579.      41 of
  580. |
  581. |   PUTPORT
  582. |
  583. |   Data Stack:       Byte ComPort --
  584. |   String Stack:                  --
  585. |
  586. |   Sends a Byte to ComPort 1 or 2
  587. |
  588.         wait
  589.         endof
  590.      42 of
  591. |
  592. |   ROW
  593. |
  594. |   Data Stack:             -- row
  595. |   String Stack:           --
  596. |
  597. |   Places the row of the current cursor position on
  598. |   the data stack.
  599. |
  600.         wait
  601.         endof
  602.      43 of
  603. |
  604. |   SETVOL
  605. |
  606. |   Data Stack:           Vol --
  607. |   String Stack:             --
  608. |
  609. |   Sets the sound volume on an HP100LX. Vol may
  610. |   vary from 0 (silent) to 3 (loudest).
  611. |
  612.         wait
  613.         endof
  614.      44 of
  615. |
  616. |   SOUND
  617. |
  618. |   Data Stack:         freq dur --
  619. |   String Stack:                --
  620. |
  621. |   Plays a sound of a given freq and dur. Frequency
  622. |   is in Hertz and duration is in Milliseconds.
  623. |
  624.         wait
  625.         endof
  626.      45 of
  627. |
  628. |   VARPTR
  629. |
  630. |   Data Stack:           V -- A
  631. |   String Stack:           --
  632. |
  633. |   Places the address of a variable onto the data
  634. |   stack. This may be used to PEEK and POKE values
  635. |   directly into a variable.
  636. |
  637.         wait
  638.         endof
  639.      46 of
  640. |
  641. |     |
  642. |
  643. |   Data Stack:             --
  644. |   String Stack:           --
  645. |
  646. |   Prints the rest of the current line out to the
  647. |   current output device.
  648. |
  649.         wait
  650.         endof
  651.   endcase
  652.  not until
  653.