Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2.programmer > #323

Re: advice on updating text screen from basic?

From mmphosis@macgui.com ( mmphosis)
Newsgroups comp.sys.apple2.programmer
Subject Re: advice on updating text screen from basic?
Date 2012-07-11 00:05 +0000
Organization Mac GUI
Message-ID <mmphosis-1341965123@macgui.com> (permalink)
References <1c3a6089-1ca6-4ad5-9ee5-44db21ecbeca@googlegroups.com>

Show all headers | View raw


You are right that Applesoft BASIC is actually reasonably fast at printing a
single line of characters.

There are numerous ways to speed things up.  Initialize everything that you
need before hand.  Keep all the action within one line at the beginning of
the program.  Use variables instead of numbers, except for zero.  Initialize
the variables you use the most first.

I don't know what the display is going to contain for your game, so I hazard
to guess, but...  You don't need to call the scroll routine if you print
forty characters at a time.  An empty line could be just an array containing
a single carriage return.  ie. L$(0)=CHR$(13)  You may be able to optimize
some lines by ending them with a carriage return. ie.  L$(27) = "WWWWW>O" +
CHR$(13).  Don't actually update any of the lines but keep all of the arrays
of the strings for the content of your game.  Keep large numeric arrays of
the scenery that index to the strings.

1  GOSUB 9: FOR Q = 0 TO T STEP 0 : FOR I = 0 TO M: PRINT L$(I);: NEXT I,Q
9  DIM L$(50)
100  LET I = 0:T = 1
110  LET L = 3:S = 59
120  LET W = 39:M = 50
130  FOR I = 0 TO M
140  HTAB 1: PRINT I;
150  FOR J = 0 TO W
160  LET C =  INT ( RND (1) * L)
170  LET C$ =  CHR$ (C * 17 + S)
180  LET L$(I) = L$(I) + C$
190  NEXT J,I
200  LET I = 0
210  PRINT  FRE (0)
220  POKE 49238,0: POKE 49234,0
230  POKE 49232,0
240  VTAB 24: HTAB 1
250  RETURN

Back to comp.sys.apple2.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

advice on updating text screen from basic? aiiadict@gmail.com - 2012-07-10 10:58 -0700
  Re: advice on updating text screen from basic? David Schmidt <schmidtd@my-deja.com> - 2012-07-10 16:05 -0400
  Re: advice on updating text screen from basic? mmphosis@macgui.com ( mmphosis) - 2012-07-11 00:05 +0000
    Re: advice on updating text screen from basic? Michael J. Mahon <mjmahon@aol.com> - 2012-07-10 19:53 -0500

csiph-web