[Coco] [Color Computer] Question about BASIC coding guidelines

Stan Mooney mrfrosty30701 at yahoo.com
Sat Nov 8 22:49:43 EST 2008


they are indeed stored as literal ASCII representations of the number
you can also increase the speed by converting statements like
       IF A=100 THEN GOTO 1000
                to
       IF A=100 THEN 1000

and
       IF A=150 THEN GOSUB 1200
                to
      IF A=150 GOSUB 1200

the GOTO is unneseccary in a "THEN GOTO" statement and
the THEN is unnecessary in a "THEN GOSUB" statement
(and, of course, all the spaces i put in the examples also waste time and memory--
but i included them to make them easier to read)

laters 
carl


--- On Thu, 10/30/08, James Diffendaffer <jdiffendaffer at yahoo.com> wrote:
From: James Diffendaffer <jdiffendaffer at yahoo.com>
Subject: Re: [Color Computer] [Coco] Question about BASIC coding guidelines
To: ColorComputer at yahoogroups.com
Date: Thursday, October 30, 2008, 2:19 PM










    
            --- In ColorComputer@ yahoogroups. com, shadow at ... wrote:



> Not sure if CoCo BASIC does this or not, but in other TRS-80 BASICs 

> the line numbers for THEN, GOTO, GOSUB, etc are stored as literals.

> 

> Thus "GOTO 1000" takes two more bytes than "GOTO 10".

> 

> This makes a speed difference as well. 



I know some BASICs tokenize the number (store it as a 16bit integer)

which makes the code smaller and faster (ok... if you don't get out of

single digit line numbers it might not be smaller).  I don't remember

what the CoCo does.




      

    
    
	
	 
	
	








	


	
	


      



More information about the Coco mailing list