[comp.sys.cbm] Dynamic Keyboard program entry

nickerso@dalcsug.UUCP (Scott William Nickerson) (01/14/88)

     This article is meant to  be  a  companion  to  the  article  on  killing
wordwrap on the c-64 screen in BASIC.  One of my fellow students Geoff  Seeley
submitted a routine which will enter programs from text files on disk as I did
not include one with my original article.  The routine which I  am  submitting
here will work without requiring that the line numbers be  of  any  particular
value and is also self-destructive when it's task is completed.
     This article  gives  a  short  routine  which  reads  a  program  from  a
sequential disk file and enters it into the computer's memory as if the  lines
were typed from the keyboard.  This routine  first  prompts  the  user  for  a
filename which should be  present  on  the  disk.   For  efficiency  no  error
handling is performed so if you enter a name which is  not  on  the  disk  the
program will bomb.
     Each line of the sequential file should be  numbered  and  these  numbers
must be greater than 6.  As the routine loads in the program  lines  you  will
see them appearing at the top of your screen.  Once  the  file  is  completely
read the routine will remove itself  leaving  only  the  finished  program  in
memory.  You may then save it in a normal fashion.

Here is the Dynamic Keyboard Routine:


0 input"enter seq file name";f$:open8,8,8,"0:"+f$+",s,r"
1 poke152,8:printchr$(147);
2 ifstthenclose8:goto5
3 get#8,a$:printa$;:ifa$<>chr$(13)then2
4 print"goto1":poke631,19:poke632,13:poke633,13:poke198,3:end
5 printchr$(147);:fori=0to6:printi:next:poke198,9:poke631,19:poke639,147
6 fori=632to638:pokei,13:next:end


     This routine works very well and can  be  used  for  entering  any  Basic
programs exchanged as text files.  You will have  to  check  for  any  special
format characters which may  not  transmit  properly.   This  problem  can  be
avoided if instead of using print strings such as ?"[clr]"  in  your  programs
you use ?chr$(147).  If you use this 'more readable' convention  you  will  be
able to exchange Basic programs with no problem as text  files  through  mail,
news, or just over a modem to a friend.


                                              Scott Nickerson
                                             (nickerso@dalcsug)