Go to Stephen's Entry Page

Go to TI pages: TI Book front page |   Articles Index page |    TI Resources Page |   PC99 Review |   PC99 Programs

contact- please use subject="pc99 page" to avoid spam trap!

This page contains articles on the TI99/4a. There is a brief linked index to help you find something useful.

The sevens problem solutions: Extended Basic   | c99   | Turbo Pascal   | 9900 Machine Code

Computers available in 1982 and 1984 |     How to make a basic program unLISTable

Why use old computers? |     NEW 2019: 40 column mode in XB

R A M B L E S
by Stephen Shaw
Written for TI*MES April 1990. (Issue 28)
Welcome to another Rambles, which includes bits and pieces for all owners. Even a bit that at first sight you may feel is not appropriate to you is still worth a quick scan...
------------------
A small portion of this article has been duplicated in TI*MES 29 and a further part will appear in TI*MES 30. This article will be removed when the full contents have been republished elsewhere on this site, but I will then put in a holding page here with links to the new locations.

We are starting this issue with a test which is valid in any language and that includes CONSOLE ONLY OWNERS. I have an answer to this test in Basic and know it can be done. It is an interesting test for programmers in other languages, and is certainly suitable for c99 and Pascal.
Here we go...
If I write 7^2, that means SEVEN SQUARED, or put another way,
SEVEN TO THE POWER OF TWO,
also 7 * 7.

Equally 7^3 is SEVEN TO THE POWER OF THREE or 7 * 7 * 7.
Get the idea? OK. Your test is to write a program, in any language, which will determine the first power of seven which has a result containing six sevens in succession-eg "777777". Clue: The result has MORE than 15 digits!
To make checking easy, your program should print the result:
"SEVEN TO THE POWER OF N IS" where of course N is the first power that gives a result matching our requirements, and also of course giving the actual result.
Programmers in the faster languages may wish to determine if there is a second power of seven with six consecutive sevens in it- and will need to adjust their algorithm slightly to avoid an error message...
Acknowledgement to ACE magazine for this excellent programming test.
Return to top of page
---------------------------
Mark Wills is interested in hearing from all our members to find out WHY they still use such a vintage computer. Me first:
[This was written in 1990]
Way way back, when I first thought of buying a computer, I had a very good think about what I wanted one for, what I might need one for, and so on, prioritising everything. There was only one choice then available- the TI99/4, which at that time had not yet been released in a UK version! I waited for the UK version, and bought a fully expanded system- one of my prime uses was for data, and I saw no future in trying to use a cassette for data!
Many years later, looking back to my original requirements, I still find the TI99/4 (now with an A) to be the best suited to my requirements-
A friendly operating system.
Good educational software.
Very rugged construction.
Good choice of languages to learn and use.
Capable of everything I want! in games and utilities.
The competition is actually very thin on the ground in 1990- Atari ST, Amiga and PC seems to be about it. The PC in many ways would be a very retrograde step, and the ST and Amiga require a dedicated monitor for worthwhile results, and are by no means so friendly or easy to program as the TI.
I really dont fancy trying to write a 500k program, or prepare 256 colour graphics! And a slow machine with limited ram makes you learn to program effectively, to do in 16k what other people might take 200k for!
I have a stack of things still to do with this vintage computer, books to read, programs to convert or write, languages to learn and experiment with, many commercial utilities to come to grips with. About another twenty years worth I guess...
Why move on to fresh pastures when this one still has so much to offer!
---------------------------

SOLUTION TO PUZZLE RE POWER OF 7
100 P$="" :: N$="1" :: P=0
110 CARRY=0 :: FOR F=LEN(N$) TO 1 STEP -1
120 V=VAL(SEG$(N$,F,1))*7+CARRY
130 CARRY=INT(V/10) :: V=V-CARRY*10
140 P$=STR$(V)&P$ :: NEXT F
150 IF CARRY<>0 THEN P$=STR$(CARRY)&P$
160 P=P+1 :: N$=P$ :: P$="" :: PRINT P;"
";N$
170 Z=POS(N$,"777777",1)
180 IF Z<1 THEN 110

Newly added 2023!
Two solutions from TI*MES 29 by John Seager, plus one from 1990 by John Murphy, not submitted to TI*MES .


Solutions in more difficult languages will follow shortly

RAMBLES
for TI*MES 30 / September 1990 (Issue 30)
==================================
Return to top of page

ANCIENT HISTORY
Our local library regularly sells off unwanted books and recently cleared their old computer books (including Townsends TI99/4A book). I picked up two product guides from 1982 and 1984.
I bought my first TI back in 1981, so the '82 book is a good record of what I had to choose from- the TI was just changing from 99/4 to 99/4a. Comparing the 1984 and 1982 books, only the ZX81 was still available two years later- pick any other computer in 81 or 82, and you would have been orphaned by 84!
Here was the scene in 82:
The TI99/4A was selling (for a day or so, the price started to crash downwards from here on!) at 399 pounds! Seen as competition, and producing a price reduction later, was the 4k VIC20 at 185 (22x23 char display!). Here are the more well know 1982 consoles in price order:
5k VIC20 (22x23 display) 185.00
8k OSI C1P with 8k basic, 250.00
12k Acorn ATOM with only intger basic and mono o/p. 250.00
16k Video Genie EG3003 with 12k basic and 64x16 display. 289.00
4k AIM 65 with a 20 x 1 (One) display! and 1k basic, 315.00
32k Acorn Proton (forerunner of BBC-B) 335.00
8k Commodore Pet 4008 with 8k basic. and mono monitor 378.00
32k ATARI 400 with rubber keyboard. 395.00
16k TI99/4A for 399.00
4k TANDY TRS80/1 incl tv and recorder. 430.00
By the time the 1984 book came out, the TI99/4A had been withdrawn, and the Dragon, which Boots had switched to selling, and which some TI owners rather too quickly switched to, had just been withdrawn as the liquidator was called in! Of the 1984 computers, apart from the price drops and improved specs, it is interesting to look around the computer stores and see that some are still commercially supported, and indeed, much to Commodores chagrin, one the C64 is still earning large sums of money, six years on! Properly supported could the TI have kept going as the C64 has? You betcha! The 1984 computers...
A real curiosity to start- anyone remember the 4k Tandy MC10 at 70.00- it had no program editing facilities!!! If you wanted to alter a program after typing it in, you had to type it in again. Made debugging a chore!

48k Spectrum 130.00
16k Colour Genie 168.00
48k Alphatronic 170.00
64k Commodore 64 199.00
48k Lynx 225.00
64k Dragon 225.00
20k CGL (Sord) M5 150.00
48k Oric Atmos 170.00
16k Spectravideo SV318 186.00
32k Acorn Electron 199.00
64k Amstrad CPC464 incl grn monitor 229.00
64k Atari 800XL. 250.00

At this time you could have picked up a TI99/4A for around 50 or less.
There were others which did not last long enough to make it into either book, and of course others which were well outside this sort of price range.
Return to top of page
=====================================

Did you ever want to make an Extended Basic program unlistable and unalterable but still playable and saveable? This is a bit of fun programming to see how to exploit the way our computer stores its programs!
Original programs from Tidewater Newsletter, Ken Woodcock- I took them from WORDPLAY June 1990:
Your computer stores all the basic program lines in one block, and then in a separate block, a line number table, which identifies where in memory each line number can be found- the line number table is in numeric order, the actual program lines are stored in the order you enter them, which may not be in numeric order! The first byte of the Line Number Table tells the computer how long the line is in bytes- this is only used to list the program or to handle editting functions, when running a zero value byte terminates each program line and the LNT is only used to locate the start of the program line.
To make a program unlistable all you need do is change all the length bytes in the LNT! The following program will set all length bytes to zero! and requires XB and 32k.
First load your program. If it uses lines 1 and 2, resequence it! Then MERGE in (or type in) the following code:
1 CALL INIT :: CALL PEEK(-31
952,A,B,C,D):: SL=C*256+D-65
539 :: EL=A*256+B-65536 :: F
OR X=SL TO EL STEP -4 :: CAL
L PEEK(X,E,F,G,H):: ADD=G*25
6+H-65536 :: PRINT E*256+F

2 CALL LOAD(ADD-1,0):: NEXT
X :: STOP :: !@P-


Now RUN the amended program. Now in command mode type in 1 [enter], 2 [enter] to remove the extra lines. Now save using a different file name if to disk or a different tape if to cassette!!!
And you can now RUN the program, no trouble- try it.
BUT... what happens if you try typing EDIT 100 or LIST?

What... you saved the amended program over your original? Not to worry you can get it back.
We could alter all the length bytes to the maximum possible, which would certainly allow the program to be LISTed again (change the value 0 in line 2 above to 255), but editting could still be problematical, so lets reset the length bytes to what they should be!
Looking for a zero byte is a start, but not the end, as a zero byte may also occur in certain cases in the program line. The simplest thing to do is to look for a zero byte, then look at the line number table to see if the value obtained is an actual start of a program line. So lets do it...
First load the corrupted program- you cannot list it to see if it uses lines 1 to 6, so RESequence it for safety! then MERGE in the following lines:
1 CALL INIT :: CALL PEEK(-31
952,A,B,C,D):: SL=C*256+D-65
539 :: EL=A*256+B-65536 :: F
OR X=SL TO EL STEP -4 :: CAL
L PEEK(X,E,F,G,H):: ADD=G*25
6+H-65536 :: PRINT E*256+F

2 I=1 :: CALL PEEK(ADD-1,V
):: IF V THEN 6
3 CALL PEEK(ADD+I,V,W):: I
F V THEN I=I+1 :: GOTO 3

4 FOR Y=SL TO EL STEP -4 ::
CALL PEEK(Y,E,E,E,F):: IF E
*256+F-65536=ADD+I+2 OR W=0
OR ADD+I>-3 THEN CALL L
OAD(ADD-1,I+1):: GOTO 6

5 NEXT Y :: I=I+1 :: GOTO 3
6 NEXT X :: STOP :: !@P-

Some of those lines are a little long by the way- when your console honks at you to say it wont take any more characters THANK YOU, you press ENTER, then bring the line back with EDIT N or N (FCTN X), move the cursor to the end of the line and carry on typing.
Run this amended program- it takes a little longer this time!!! and when it has finished your program is uncorrupted, lines 1 to 6 can be removed and the program saved, listable and editable.
Too slow? From an anonymous author, a machine code fix! This comes from the Sydney News Digest of July 1990 and requires assembly WITHOUT the C option:
* PROGRAM TO REENTER LINE
* LENGTH VALUES TO A BASIC PROG
* author wishes to be anon
* FROM TISHUG JULY 90
*
* RUNS ONLY FROM XB+32K
* load corrupted program into xb
* CALL INIT
* CALL LOAD("DSKn.FILENAME")
* CALL LINK("UNFIX")
*

       DEF  UNFIX
       AORG >2500
UNFIX  LWPI USRWS
       MOV  @>8330,R1
       MOV  @>8332,R2
       C    R1,R2
       JHE  FIN
*
       INC  R2
       S    R1,R2
       SRL  R2,1
       CI   R2,BUFMAX
       JGT  FIN
*
       SRL  R2,1
       MOV  R2,@BUFLEN
       INCT R1
       LI   R4,BUFF
*
LOOP   MOVB *R1+,*R4+
       MOVB *R1+,*R4
       DEC  R4
       DEC  *R4
       INCT R4
       INCT R1
       DEC  R2
       JNE  LOOP
       LI   R5,>FFE8
AGAIN  MOV  @BUFLEN,R3
       LI   R2,ZERO
       LI   R1,BUFF
       DECT R1
*
NEXT   INCT R1
       C    *R1,*R2
       JL   SKIP
       MOV  R1,R2
SKIP   DEC  R3
       JNE  NEXT
*
       MOV  *R2,R6
       MOV  *R1,*R2
       S    R6,R5
       DEC  R5
       SWPB R5
       MOVB R5,*R6
       MOV  R6,R5
       DEC  @BUFLEN
       JNE  AGAIN
*
FIN    LWPI >83E0
       CLR  R0
       MOVB R0,@>837C
       RT  
*
USRWS  BSS  32
BUFLEN BSS  2
ZERO   DATA >0000
BUFMAX EQU  >1800
BUFF   BSS  BUFMAX
*
       END   

A great deal faster! This machine code is for loading with ExBas ONLY! Why do we need to have the length right for editting? 'Cos if the length byte is 255 bytes, when you delete (or edit) the lines, the computer will delete 255 bytes, and if the line is shorter, you are going to lose other data, probably partial lines, which will be very sad!
Oh yes... if the corrupted program comes from elsewhere, after making it listable, take a look for any lines that look like our first two lines above, if they are there you need to remove them or they will make the program unlistable once more!
Return to top of page
====================================
The SEVENS test in issue 28 (page 19) finally provoked some responses,
including one from the USA! In TI*MES 29 we printed results for Basic and ExBas, which have not yet been bettered, below you will find coding in c99, Turbo Pascal, and Assembler. Compare these with the Basic versions and try to follow what they are doing. This way you may pick up something of the languages used! If you have access to the languages key them in and see just how fast they are!
First we have c99 source code from John Seager...
c99 was a shareware language based upon c

/*    S S TEST. 'SEVENS'    */
/*         VERSION 2        */
/*  requires CSUP & PRINTF  */
/* to be loaded at run time */
extern printf();
main()
{
/* declare variables */
int power,carry,count,sevens,i;
int len,temp;
int num[2500];

/* initialise variables */
power=1;
len=0;
num[0]=7;
/* calculate number */
while(1)
{
count=sevens=carry=0; power++;
for(i=0;i<=len;i++)
   {
   temp=num[i]*7+carry;
   num[i]=temp%10;
   carry=temp/10;
      if(num[i]!=7)
         count=0;
         else
         count++;
      if(count>sevens)
         sevens=count;
   }
   if(carry>0)
      {
      len++; num[len]=carry;
      if(num[len]!=7)
         count=0;
         else
         count++;
      if(count>sevens)
sevens=count;
      }

locate(1,1);
printf("checking 7 to the power of %d",power);

/* check for 6 sevens & display if found */
if(sevens==6)
   {
   locate(1,1);
   printf("7 to the power of %d=",power);
   puts(" ");
   locate(3,1);count=0;

   for(i=len;i>=0;i--)
      {
      printf("%d",num[i]);count++;
      if(count==800)
         {
         locate(24,1);puts("any key for next section of number");
         getchar();locate(24,1);puts(" ");
         locate(3,1);

         for(count=0;count<=800;count++)
            {puts(" ");}
         locate(3,1);count=0;
         }
      }

/* continue */
locate(24,1);puts("any key to proceed");
getchar();
locate(1,1);

for(count=0;count<=960;count++)
   {puts(" ");}
   }
if(len==2500)
{exit(0);}
}
}
Return to top of page
======================================
Now for ordinary 9900 machine code, this time from John Stocks...


      DEF SEVAC                 
                                
SEVAC LI 1,1     [NO. OF DIGITS]
      LI 7,7                    
      LI 10,10                  
      MOV 1,@DIG                
      CLR 2      [POWER]        
      CLR 3      [CARRY]        
A     BL @MULT                  
      CI 1,6                    
      JNE A                     
B     BL @MULT                  
      BL @TEST                  
      JMP B                     
                                
MULT  INC 2                     
      CLR 4                     
      LI 0,DIG   [DIGIT STORE]  
C     INC 4         
      MOV *0,5      
      MPY 7,5       
      A 3,6         
      DIV 10,5      
      MOV 5,3       
      MOV 6,*0+     
      C 4,1         
      JNE C         
      CI 3,0        
      JEQ D         
      MOV 3,*0      
      CLR 3         
      INC 1         
D     B *11         
                    
TEST  CLR 4         
      LI 0,DIG-2    
E     CLR 8         
F     AI 4,6        
      C 4,1         
      JGT RTN       
      AI 0,12       
      MOV *0,6      
      C 6,7         
      JNE F         
G     DEC 4         
      CI 4,0        
      JEQ H         
      DECT 0     
      MOV *0,6   
      C 6,7      
      JEQ G      
H     INC 4      
      C 4,1      
      JGT RTN    
      INCT 0     
      MOV *0,6   
      CI 6,7     
      JNE E      
      INC 8      
      CI 8,6     
      JNE H      
      B @PRINT   
RTN   B *11      
                 
PRINT MOV 1,14   
      MOV 2,6    
      LI 0,>182  
      LI 2,>E    
      LI 3,TXT1    
      BL @VMBW     
      LI 0,>195    
      LI 2,2       
      LI 3,TXT2    
      BL @VMBW     
      LI 0,>193    
I     CLR 5        
      DIV 10,5     
      MOV 6,1      
      AI 1,>30     
      BL @VSBW     
      DEC 0        
      MOV 5,6      
      CI 6,0       
      JNE I        
                   
      MOV 14,0     
      AI 0,>1BF    
      MOV 14,4     
      INC 4        
      LI 5,DIG     
J     DEC 0        
      DEC 4        
      MOV *5+,1    
      AI 1,>30     
      BL @VSBW     
      CI 4,1       
      JNE J        
      LI 0,>FFFF   
      LI 1,>B      
K     DEC 1        
L     DEC 0        
      CI 0,0       
      JNE L        
      CI 1,0        
      JNE K         
      CLR 0         
      MOVB 0,@>837C 
      LWPI >83E0    
      B @>70        
                    
VSBW  SWPB 0        
      MOVB 0,@>8C02 
      SWPB 0        
      MOVB 0,@>8C02 
      SWPB 1        
      MOVB 1,@>8C04 
      B *11         
                    
VMBW  SWPB 0        
      MOVB 0,@>8C02 
      SWPB 0        
      MOVB 0,@>8C02 
      CLR 4         
M     MOV *3+,1     
      MOVB 1,@>8C04 
      INC 4         
      C 15,2        
      JEQ N         
      SWPB 1        
      MOVB 1,@>8C04 
      INC 4         
      C 4,2                 
      JNE M                 
N     B *11                 
                            
TXT1  TEXT 'SEVEN TO POWER' 
TXT2  TEXT 'IS'         
DIG   BSS 400               
      END                   
====================

Return to top of page
That one will only print one answer, but how many powers of seven will produce the desired result? This program will print only the POWERS not the results, up to a power of ten thousand- thats a lot of digits...

      DEF SEVHI                  
SEVHI LI 1,1     [NO. OF DIGITS] 
      LI 7,7                     
      LI 10,10                   
      LI 9,-2                    
      MOV 1,@DIG                 
      CLR 2      [POWER]         
      CLR 3      [CARRY]         
A     BL @MULT                   
      CI 1,6                     
      JNE A                      
B     BL @MULT                   
      BL @TEST                   
      CI 2,10000                 
      JNE B                      
      MOV 9,0        
      AI 0,3         
      LI 2,10        
      LI 3,TXT-2     
      BL @VMBW       
      DATA >10FF     
                     
MULT  INC 2          
      CLR 4                      
      LI 0,DIG   [DIGIT STORE]   
C     INC 4                      
      MOV *0,5                   
      MPY 7,5       
      A 3,6         
      DIV 10,5      
      MOV 5,3       
      MOV 6,*0+     
      C 4,1         
      JNE C         
      CI 3,0        
      JEQ D         
      MOV 3,*0      
      CLR 3         
      INC 1         
D     B *11         
                    
TEST  CLR 4         
      LI 0,DIG-2    
E     CLR 8         
F     AI 4,6        
      C 4,1         
      JGT RTN       
      AI 0,12       
      MOV *0,6      
      C 6,7         
      JNE F         
G     DEC 4         
      CI 4,0        
      JEQ H         
      DECT 0        
      MOV *0,6      
      C 6,7         
      JEQ G         
H     INC 4         
      C 4,1         
      JGT RTN   
      INCT 0    
      MOV *0,6  
      CI 6,7    
      JNE E     
      INC 8     
      CI 8,6    
      JNE H     
      MOV 11,8  
      BL @PRINT 
      MOV 8,11  
      JMP E     
RTN   B *11     
                
PRINT MOV 11,13 
      MOV 1,14  
      MOV 2,12  
      AI 9,8    
      MOV 9,0   
      MOV 12,6  
I     CLR 5     
      DIV 10,5  
      MOV 6,1   
      AI 1,>30  
      BL @VSBW  
      DEC 0     
      MOV 5,6   
      CI 6,0    
      JNE I     
      MOV 12,2         
      MOV 14,1         
      MOV 13,11        
      B *11            
                       
VSBW  SWPB 0           
      MOVB 0,@>8C02    
      SWPB 0           
      MOVB 0,@>8C02    
      SWPB 1           
      MOVB 1,@>8C04    
      B *11            
                       
VMBW  SWPB 0           
      MOVB 0,@>8C02    
      SWPB 0           
      MOVB 0,@>8C02    
      CLR 4            
M     MOV *3+,1        
      MOVB 1,@>8C04    
      SWPB 1           
      MOVB 1,@>8C04    
      INC 4            
      C 4,2            
      JNE M            
N     B *11            
                       
TXT   TEXT 'END OF RUN'
                       
DIG   BSS 400          
                       
      END              
=====================
Return to top of page
Turbo Pascal was a commercial language
. And also from
John Stocks is this program for TURBO PASC 99 which is pretty fast for a compiled language...

TXT2  TEXT 'IS'       

PROGRAM SEVPAS;       
                                    
VAR X,POW,MAXDIG,CARRY : INTEGER;   
    DIG : ARRAY[500] OF INTEGER;    
                                    
PROCEDURE PRINT;                    
VAR Z:INTEGER;                      
BEGIN        
WRITELN("SEVEN TO THE POWER OF",POW," IS :");
  WRITELN;                     
  FOR Z:=MAXDIG DOWNTO 1 DO    
  WRITE(SEG(CIS(DIG[Z]),2,1)); 
  WRITELN;                     
  WRITELN                      
END;                           
                               
PROCEDURE SCAN;                
VAR Y,SEV:INTEGER;             
BEGIN                          
  Y:=X;                        
  WHILE DIG[Y]=7 DO            
    Y:=Y-1;                    
  SEV:=0;                      
  Y:=Y+1;                      
  WHILE DIG[Y]=7 DO            
    BEGIN                      
      SEV:=SEV+1;              
      IF SEV>=6 THEN PRINT; 
      Y:=Y+1                   
    END;                       
END;                       
                           
PROCEDURE TEST;            
BEGIN                      
  X:=6;                    
  WHILE X<=MAXDIG DO    
    BEGIN                    
      IF DIG[X]=7 THEN SCAN; 
      X:=X+6                 
    END;                     
END;                         
                             
PROCEDURE MULTIPLY;          
VAR X : INTEGER;             
BEGIN                        
  FOR X:=1 TO MAXDIG DO      
    BEGIN                    
      DIG[X]:=DIG[X]*7+CARRY;
      IF DIG[X]>9 THEN    
        BEGIN                
          CARRY:=DIG[X] DIV 10;   
          DIG[X]:=DIG[X]-10*CARRY 
        END                       
      ELSE CARRY:=0               
    END;                          
  IF CARRY<>0 THEN     
    BEGIN                    
      DIG[MAXDIG+1]:=CARRY;  
      MAXDIG:=MAXDIG+1;      
      CARRY:=0               
    END;                     
  POW:=POW+1                 
END;                         
                             
BEGIN                        
  MAXDIG:=1;                 
  DIG[1]:=1;                 
  POW:=0;                    
  CARRY:=0;                  
  REPEAT                     
    MULTIPLY;                
  UNTIL POW=11;              
  REPEAT                     
    MULTIPLY;                
    TEST;                    
  UNTIL POW=500              
END.                         
==========================
==========================
UPDATE 2011:
             
After only a few years here are some additional Basic solutions to the Sevens Problem: From Dragonstomper in Virginia:
10 DIM A(256)
30 PRINT "7's Problem"
31 A(1)=7
32 WIN=0
33 POWER=1
41 NUMLEN=1
45 POWER = POWER +1
46 PRINT "7 ^"; POWER; "IS:" : :
48 CARRY = 0
49 INAROW = 0
50 FOR I=1 TO NUMLEN
60 A(I) = A(I)*7 + CARRY
70 CARRY = INT(A(I) / 10)
80 A(I) = A(I) - CARRY *10
82 IF A(I) <> 7 THEN 89
83 INAROW = INAROW + 1
84 IF INAROW <> 6 THEN 90
85 WIN = 1 
86 GOTO 90
89 INAROW=0
90 NEXT I
100 A(I) = CARRY
101 IF CARRY = 0 THEN 109
102 NUMLEN = NUMLEN +1
109 H=3
110 FOR I=NUMLEN TO 1 STEP -1
120 CALL HCHAR(23,H,48+A(I))
121 H=H+1
122 IF H<32 THEN 130
123 H=2
124 PRINT :
130 NEXT I
131 PRINT : :
140 IF WIN <> 1 THEN 45
150 PRINT "WINNER IS 7 ^";POWER

--------
  
and from the same source, a faster version:
10 DIM A(256)
30 PRINT "7's Problem"
31 A(1)=7
32 WIN=0
33 POWER=1
41 NC=1
45 POWER = POWER +1
46 PRINT "7 ^"; POWER; "IS:" : :
48 CARRY = 0
49 INAROW = 0
50 FOR I=1 TO NC
60 A(I) = A(I)*7 + CARRY
70 CARRY = INT(A(I) / 1000000000)
80 A(I) = A(I) - CARRY *1000000000
90 NEXT I
100 A(I) = CARRY
101 IF CARRY = 0 THEN 103
102 NC = NC +1
103 H=3
104 FOR I=NC TO 1 STEP -1
105 NUM$ = STR$(A(I))
106 L = LEN(NUM$)
107 IF I=NC THEN 119
108 NP=48
115 FOR J=L TO 8
116 GOSUB 200
118 NEXT J
119 FOR J=1 TO L
120 NP = ASC(SEG$(NUM$,J,1))
121 GOSUB 200
122 NEXT J
130 NEXT I
131 PRINT : :
140 IF WIN <> 1 THEN 45
150 PRINT "WINNER IS 7 ^";POWER
160 END
200 CALL HCHAR(23,H,NP)
221 H=H+1
222 IF H<32 THEN 225
223 H=2
224 PRINT :
225 IF NP = 55 THEN 228
226 INAROW=0
227 GOTO 250
228 INAROW = INAROW + 1
229 IF INAROW <> 6 THEN 250
230 WIN=1
250 RETURN

--------


                      

Many thanks to everyone who has submitted code. Can any of this be made faster? Any more languages?
New 2019- 40 columns in Extended Basic! Requires 32k ram.

Note that 40 column mode will disturb some normal XB use of vdp ram eg sprites.

40 column utility

loader files
100 CALL PEEK(8196,A) :: IF A<>170 OR A<>121 THEN CALL INIT
110 CALL LOAD(8196,63,216) :: CALL LOAD(16344,66,83,67,82,78,32,50,108,68,73,83,80,76,32,48,190)
120 CALL LOAD(16360,73,78,80,85,84,32,49,36,67,76,83,32,32,32,48,78,70,79,82,84,89,32,48,38)
130 CALL LOAD(12288,8,31,16,0,50,190,0,0,0,0,1,108,51,188,0,0,0,0,0,0,2,12,50,116)
140 CALL LOAD(12312,215,32,47,190,215,32,47,191,13,0,1,108,2,107,2,224,131,224,2,1,240,129,216,1)
150 CALL LOAD(12336,131,212,216,1,140,2,6,193,216,1,140,2,2,1,245,135,216,1,140,2,6,193,216,1)
160 CALL LOAD(12360,140,2,4,96,48,86,2,224,48,0,6,160,48,98,4,224,131,124,2,224,131,224,4,96)
170 CALL LOAD(12384,0,112,4,192,2,1,128,0,4,32,32,32,5,128,2,128,3,192,22,250,4,91,2,1)
180 CALL LOAD(12408,0,1,4,192,4,32,32,12,200,32,131,74,48,36,192,224,48,36,2,67,0,255,2,2)
190 CALL LOAD(12432,255,216,2,34,0,40,6,3,22,252,200,2,48,34,2,1,0,2,4,192,4,32,32,12)
200 CALL LOAD(12456,200,32,131,74,48,36,192,96,48,36,2,65,0,255,6,1,168,1,48,34,4,91,2,224)
210 CALL LOAD(12480,48,0,6,160,48,118,2,1,255,0,216,1,50,189,2,1,0,3,4,192,2,2,50,189)
220 CALL LOAD(12504,4,32,32,20,4,197,209,96,50,189,6,197,2,6,50,190,192,32,48,34,6,160,49,28)
230 CALL LOAD(12528,4,193,192,86,2,33,96,0,4,32,32,32,5,128,6,160,49,28,6,5,19,9,6,193)
240 CALL LOAD(12552,2,33,96,0,4,32,32,32,5,198,5,128,6,5,22,236,4,96,48,86,2,128,3,192)
250 CALL LOAD(12576,21,251,4,91,2,224,48,0,2,2,1,0,2,1,32,0,216,129,50,190,6,2,22,252)
260 CALL LOAD(12600,6,160,48,118,2,1,0,255,192,32,48,34,160,64,2,129,3,192,18,2,2,1,3,192)
270 CALL LOAD(12624,200,1,48,36,4,196,193,64,2,1,32,0,217,1,50,191,2,1,126,0,4,32,32,32)
280 CALL LOAD(12648,2,1,5,0,216,1,131,116,6,160,50,34,216,32,131,117,48,32,4,193,208,96,131,117)
290 CALL LOAD(12672,192,5,2,129,13,0,22,18,2,1,128,0,4,32,32,32,4,224,131,124,4,192,2,1)
300 CALL LOAD(12696,0,3,6,196,216,4,50,190,2,2,50,190,4,32,32,16,4,96,48,86,2,129,7,0)
310 CALL LOAD(12720,22,13,2,1,32,0,217,1,50,191,2,33,96,0,4,32,32,32,6,0,6,4,22,245)
320 CALL LOAD(12744,4,96,49,36,2,129,8,0,22,17,2,1,32,0,217,1,50,191,2,33,96,0,4,32)
330 CALL LOAD(12768,32,32,6,0,6,4,128,32,48,34,18,181,5,132,5,128,4,96,49,86,2,129,9,0)
340 CALL LOAD(12792,22,2,2,1,32,0,2,129,32,0,17,169,217,1,50,191,2,33,96,0,4,32,32,32)
350 CALL LOAD(12816,5,132,5,128,136,0,48,36,18,158,6,0,6,4,4,96,49,86,4,193,2,0,32,0)
360 CALL LOAD(12840,2,2,255,0,4,32,32,28,144,32,131,124,19,26,144,160,131,117,19,243,2,3,0,5)
370 CALL LOAD(12864,6,3,2,1,9,192,6,1,22,254,4,32,32,28,144,32,131,124,19,11,144,160,131,117)
380 CALL LOAD(12888,19,228,4,32,32,28,192,195,22,239,152,32,48,32,131,117,22,220,4,91,2,224,48,0)
390 CALL LOAD(12912,6,160,48,98,2,0,3,0,4,193,4,32,32,32,5,128,2,128,3,192,22,250,2,0)
400 CALL LOAD(12936,224,1,216,0,131,212,6,192,4,32,32,48,2,0,3,32,4,32,32,48,2,0,7,23)
410 CALL LOAD(12960,4,32,32,48,2,0,8,0,2,1,16,0,4,32,32,32,5,128,2,128,8,31,22,250)
420 CALL LOAD(12984,4,96,48,86,0,255,0,32,32)


CALL LINK("FORTY") - start 40 column
CALL LINK("CLS") - 40 column call clear
CALL LINK("DISPL",X,Y,"DISPLAY STRING") - 40 column 'display at'
CALL LINK("INPUT",X,Y,INPUTSTRING$) - 40 column 'accept at'
CALL LOAD(12350,16*(FOREGROUND-1)+(BACKGROUND-1))::CALL LINK("FORTY") - change fore and backround colors in 40 column
CALL LINK("BSCRN") - back to graphics mode

Source: COMPUTER BRIDGE (Volume 3, Number 12, December 1984) Page 2 (St Louis User Group)
Also published in "Dr Tamashiro's TI Travels 1984-1988"

Return to top of page
============