Print

From Ninerpedia
Jump to navigation Jump to search

The command PRINT is available in TI Basic and TI Extended Basic, but the underlying coding is different the and two BASICs do not quite do the same thing.

This difference is a cause of difficulties with TI Basic games which use CALL HCHAR to place characters on line 24, and then use a PRINT to scroll them up- for example a scrolling skiing game.

In TI Basic, after you place characters on line 24, the PRINT command will scroll everything upwards. However in Extended Basic the PRINT command FIRST clears line 24 THEN scrolls the screen up- any characters placed on line 24 with CALL HCHAR have been removed.

A further difference is that in TI Basic the scroll affects the "edge characters" at the side while Extended Basic leaves the edge characters where they are,

If you RUN this small program in TI Basic and then in Extended Basic, watch for a different result:


110 FOR T=65 TO 92 
120 CALL HCHAR(24,3,T,20) 
130 PRINT 
140 NEXT T


This difference has caused problems in more recent times as use of a compiler that can use either a TI Basic program or an Extended Basic program makes a possibly harmful choice in some cases and does not do what yuou expect. Not a compiler issue- merely TI changing what a primitive command does.

Now here is a solution for TI Basic and Extended Basic, which uses a "print pending" separator - the PRINT lines in this code have exactly 28 spaces between the quotation marks and a semi colon at the end:

100 PRINT "                                   "; 
110 FOR T=65 TO 92 
120 CALL HCHAR(24,3,T,20) 
130 PRINT "                                   "; 
140 NEXT T


There is also guidance on the use of Extended Basic Print Using.