home *** CD-ROM | disk | FTP | other *** search
/ Old Hackers Atari User Group Newsletter / Old_Hackers_Atari_User_Group_Newsletter_OHJF92A.atr / hturbo.txt < prev    next >
Text File  |  2023-02-26  |  8KB  |  1 lines

  1. ¢()()()()()()()()()()()()()()()()()()()¢¢ (This is an old article, full of info¢and well worth reprinting today. Ye Ol¢Editor)¢¢         TURBO-BASIC¢           THE FIRST REPORT¢              By Ken Ward¢                The    Norwich   Users¢Group¢Norwich, England¢Febuary, 1987¢¢The  biggest  problem we've had in the¢past  was with alternative BASIC's for¢the  Atari  has  been  the  cost.  OSS¢produced   an   excellent   range   of¢language  cartridges,  but  they  have¢been very expensive.  Now, Turbo-BASIC¢has  changed  all  that.   It's  a low¢cost, (found in any Users Cub Library,¢Editor)  extended BASIC which not only¢offers   a   fantastic  range  of  new¢commands,  but also speeds up all your¢existing Atari BASIC programs.¢¢When  we  offered  it  as  part of the¢"World  of  Atari"  collection, we had¢only  had time for a quick look at it.¢Here is a our first report.¢¢TESTING ITS SPEED¢¢Turbo-BASIC  flies!  It runs all Atari¢BASIC  programs  3  to 5 times faster!¢To try to assess the speed difference,¢we ran a simple test program:¢¢          10   FOR   X=0   TO   2:POKE¢18+X,0:NEXT X¢          20 FOR X=1 TO 1000¢          30 KEN=1256*22/7¢          40 NEXT X¢          50 7 PK(18)¢¢This  program  was tried in both Atari¢and  Turbo BASICs, with different line¢30's.   In most cases, Turbo BASIC was¢at  least  3  times  faster.   We also¢tagged  the  routine to the front of a¢lengthy  program,  and  a GOSUB to the¢end  of the program as line 30.  Turbo¢BASIC   came   out  of  this  test  an¢incredible 11 times faster!!¢¢In  fact,  its  speed  seems to be the¢main problem you'll have running Atari¢BASIC  programs  in  Turbo  BASIC!  In¢some  programs,  you  will have to add¢delay loops to slow it down!¢¢PROBLEMS WITH BAD PROGRAMMING¢¢I  have  come  across one program that¢was a bit of trouble, but that was due¢to   poor   programming   (which   was¢surprising,    because   it   was   an¢"A.N.A.L.O.G." program).¢¢In  the  initializing  section  of the¢program  there was the usual modifying¢of the display list by using:¢¢         ¢DLIST=PEEK(560)+256*PEEK(561)¢¢and then at the end of the init he had¢added   another   mod.    By   POKEing¢directly  into  where the display list¢would have been in Atari BASIC instead¢of using the DLIST pointer!¢¢The other problem was more intriguing.¢ It centered around aloop like this:¢¢          10     POKE     764,255:POKE¢53279,10¢          20 IF PEEK(764)=20 THEN 100¢          30 IF PEEK(764)=20 THEN 200¢          40   IF  PEEK(53279)=5  THEN¢300¢          50   IF  PEEK(53279)=4  THEN¢400¢          60 GOTO 10¢¢It  worked  OK  in  Atari BASIC but in¢Turbo  it  popped  straight out of the¢loops  at  line  40,  even  though the¢SELECT  key  had not been touched!  We¢found  that  adding a short delay loop¢at  line  15  allowed the loop to work¢correctly,  as  did POKEing 53279 with¢8in  line  10,  which  is  the correct¢value to clear the CONSOLE keys.¢¢TURBO BASIC MEMORY MAP¢¢Turbo BASIc is a full 16K of code, yet¢it  gives  you  another  1.5K  of free¢memory over Atari BASIC!¢¢The  bulk  of  Turbo  BASIc  is hidden¢under  the Operating System ROM at the¢top of memory.  The VBLANK routine has¢been  modified  to  flip  between  the¢twinned memory blocks, allowing access¢to both areas.¢¢The  rest  of  Turbo BASIc sits in the¢block      from     8320($2080)     to¢13864($9018).   This  is  in  the area¢normally  used  by  DOS(and  DUP  when¢loaded),   which  explains  why  after¢calling  DOS  you  cannot  go  back to¢Turbo  BASIC...which  in turn explains¢why  DOS  commands  have been added to¢the language.¢¢Note     that     because    of    the¢re-arrangement  of  memory,  the  area¢occupied  by  the  screen  and display¢list  at  the  top,  and  the variable¢tables, etc. at the bottom, are in new¢positions.    Providing  you  use  the¢pointers  to  find their new locations¢you'll be OK.¢¢FORMATTING DISKS¢¢The  only  useful  DOS command that is¢missing  from  Turbo  BASIC is FORMAT.¢However,  if you do get stuck and need¢to   format   another  disk,  the  XIO¢commands still work.¢¢XIO  254,#1,0,0,"D:"  formats  in  the¢default  drive  format.  If you have a¢1050  and you need to format in single¢density, use 253.¢¢CHANGING VARIABLE NAMES¢¢The  major  problem I've found with my¢own  programs isthat I have been using¢variable  names  that  are commands in¢Turbo  BASIC!   Names like MOVE, TEXT,¢DIR,  MOD,  DEC, and HEX$ are among my¢favorites.!   And, of course, it means¢I've  had to rename them to stop Turbo¢BASIC erroring out.¢¢Going  through  the programs modifying¢every occurrance of a name can be time¢consuming  if  there is a lot of them.¢One way out is to use a word processor¢in "Search and Replace" mode, but that¢means  LISTing  the  program  out  and¢booting in the word processor.  Again,¢time   consuming.    In  the  end,  it¢prompted  me to write my first routine¢in Turbo BASIC.¢¢Type  in  the  program  and LIST it to¢disk.   You  then load the program you¢need  to  modify,  ENTER  the  Renamer¢routine, and run it with G.32000.¢¢HOW IT WORKS¢¢In  line  32070  we find the length of¢the  variable table and dimension KEN$¢accordingly.   The next two lines fill¢KEN$ with complete list of variables.¢¢The  end  of  a  variable is marked by¢being  an inverse character, so in the¢next   loo,   which   prints  all  the¢variables  onto  the  screen, we check¢for   an  inverse  character  at  line¢32120,  and convert it before printing¢it.   If there are a lot of variables,¢use  CONTROL-1  to freeze/unfreeze the¢screen.¢¢You  are  then  asked for the variable¢you  want  to rename.  Include the '('¢if  it's an array, and the '$' if it's¢a string.¢¢By  printing  the name you've typed in¢and   positioning  the  cursor  before¢getting an input, saves you the bother¢of  typing in the complete name.  Just¢modify  one  or  two  letters  and hit¢RETURN.¢¢A  check is then made to make sure the¢names  are  the  same  length.   (This¢subroutine     only    modifies    the¢particular  name - it doens't re-write¢the complete variable table).¢¢The  last character of our first input¢is  then  inversed  before  using  the¢INSTR  command to find its position in¢the variable table.  If X= then you've¢tried   to   modify  a  variable  that¢doesn't exist!¢¢If  all is well, the last character of¢the  new name is inversed before using¢the  MOVE command to move the new name¢into the table area.¢¢And,  that's all there is to it. Don't¢forget the programs you modify must be¢SAVEd  files.   LISTed files won't put¢the  names  into the variable table in¢the  first place - the lines will just¢error out.¢¢We haven't bothered with TYPO codes on¢this one - the easiest way to check it¢is  to  run  it by itself(after you've¢LISTed   out   a   copy  to  disk,  of¢course!).    After   you've   run  the¢program,  LIST  it  on  the  screen to¢check the changed names.¢¢32000 REM ************************¢32010 REM * VARIABLE RENAMER FOR *¢32020 REM * USE WITH TURBO BASIC *¢32030 REM * KEN WARD 8TH JAN 87  *¢32040 REM * NORWICH USERS GROUP  *¢32050 REM ************************¢32060 REM¢32070             CLR             :CLS¢:N=DPEEK(132)-DPEEK(130):DIM¢KEN$(N),VAR$(30),NXT$(30)¢32080        KEN$="        ":KEN$(N)="¢":KEN$(2)=KEN$¢32090 MOVE DPEEK(130),ADR(KEN$),N¢32100 POSITION 2,0¢32110 FOR X=1 TO LEN(KEN$)¢32120   Y=ASC(KEN$(X,X)):IF Y>127 THEN¢Y=7-128:? CHR$(Y):GOTO 32140¢32130   ? CHR$(Y);¢32140 NEXT X¢32150  ?  "What  is  the  name  of the¢variable   you":?   "want   to  rename¢";:INPUT VAR$¢32160  ?  "Please  type  in new name -¢REMEMBER   -":?  "name  must  be  same¢length!":?     "      ";VAR$;:POSITION¢2,PEEK(84)¢32170           INPUT          NXT$:IF¢LEN(NXT$)<>LEN(VAR$)  THEN ? "<-":GOTO¢32160¢32180¢Y=ASC(VAR$(LEN(VAR$)))+128:VAR$(LEN(VA¢$))=CHR$(Y)¢32190 X=INSTR(KEN$,VAR$):IF X=0 THEN ?¢"<-":GOTO 32150¢32200¢Y=ASC(NXT$(LEN(NXT$)))+128:NXT$(LEN(NX¢$))=CHR$(Y)¢32210                             MOVE¢ADR(NXT$),DPEEK(130)+X-1,LEN(NXT$)¢¢ ......****......*****.......****.....¢¢                                      ¢