Difference between revisions of "TI BASIC"

From Ninerpedia
Jump to navigation Jump to search
(add use of alpha lock tip)
(add demonstration of POS to give month number)
Line 14: Line 14:


The use of key unit 3 tells the computer to treat the alpha lock as if it were down whilst the program is running, unless we reset.  Use of key unit 0 has no effect on alpha lock status. Key unit 5 will reset normal operation.
The use of key unit 3 tells the computer to treat the alpha lock as if it were down whilst the program is running, unless we reset.  Use of key unit 0 has no effect on alpha lock status. Key unit 5 will reset normal operation.
==Month number using POS==
Extract a month number, 1 to 12, when the first three letters of any month are entered.
100 INPUT "MONTH?":M$
110 M=(POS("JANFEBMARAPRMAYJ
UNJULAUGSEPOCTNOVDEC",M$,1)+
2)/3
120 IF M<>INT(M) THEN 100
130 PRINT "MONTH NUMBER IS
";M


[[Category:Programming language]]
[[Category:Programming language]]
[[Category:Programming]]

Revision as of 18:18, 13 October 2014

(Page requires expansion)

See How a BASIC program is stored in the computers memory

AND OR

One omission from TI Basic is the lack of logical operators such as AND and OR used for example in expressions such as IF V<8 AND W>4 THEN 120 ELSE 240. TI Basic programmers instead used mathematical operators to replace logical operators.

Check Alpha Lock

A program using the joysticks requires the alpha lock is UP, a relic of the TI99/4 days.

If your program requires the alpha lock to be DOWN for input etc you can instruct the console:

Insert a dummy line CALL KEY(3, Z, Z)

The use of key unit 3 tells the computer to treat the alpha lock as if it were down whilst the program is running, unless we reset. Use of key unit 0 has no effect on alpha lock status. Key unit 5 will reset normal operation.

Month number using POS

Extract a month number, 1 to 12, when the first three letters of any month are entered.

100 INPUT "MONTH?":M$
110 M=(POS("JANFEBMARAPRMAYJ
UNJULAUGSEPOCTNOVDEC",M$,1)+
2)/3
120 IF M<>INT(M) THEN 100
130 PRINT "MONTH NUMBER IS 
";M