[net.micro.cbm] Question: I/O to 1541 and BASIC tokens

ribl@hou4b.UUCP (R Blechman) (12/11/84)

Question 1: Can any one tell me what values are used for BASIC tokenization?
  (or at least where i can find this out?)

Question 2: Why and when do i have to "initialize" the disk drive.
    for instance...If i do the following:
	10 open 2,8,2,"$"
	20 rem *** perform routine (9000) to prints the directory
	30 rem *** (uses get# to read)
	40 gosub 9000
	50 close 2
	60 end

	then:
		run this program.
		switch disks (to another one that HAS a directory)
		run this program again.
	I get an disk I/O error about the disk being uninitialized.

	I know i can get around this by adding:
	15 open 15,8,15
	20 print#15,"I"
	55 close 15

Question 3: What makes channels "0" and "1" special? The 1541 says that
	they're used for loads and saves, but could someone be more
	specific?

If some of these seem obvious, then please make it so for me too,
since even after having read the commodore documentaion several times
these remain somewhat of a mystery to me.
Thanks,
-ron blechman
hou4b!ribl



	

calway@ecsvax.UUCP (James Calloway) (12/13/84)

I'll take a crack at the first two questions:
1. Where to find list of BASIC tokens. 
See page 120 and 122 of the January 1985 issue of Compute!'s Gazette.

2. When and why to initialize the disk drive.
The initialize command ("i") forces the disk drive to re-read the Block Allocation Map,
which tells the drive which parts of the disk are in use
and which are free.
It is always a good idea to initialize whenever you switch disks,
because the BAM the drive holds in its memory will be that of the
previous disk, and the drive may unwittingly screw up the current disk
because it thinks it still has the previous one.
Normally the drive will automatically initialize itself if it detects
that the disk has a different ID code (the two-character identification
you give the disk when you NEW it for the first time) from that of the previous disk.
If you switch disks and the two have the same ID, you probably will
get a "directory error" when you call the directory because it won't match the BAM that the machine has in memory.
Also, failing to close the channels to the drive before switching disks
may cause problems, although I am not sure of that.

-- 

James  Calloway
The News and Observer
Box 191
Raleigh, N.C. 27602
(919) 829-4570
{akgua,decvax}!mcnc!ecsvax!calway

wjr@utcs.UUCP (William Rucklidge) (12/13/84)

> Question 3: What makes channels "0" and "1" special? The 1541 says that
> 	they're used for loads and saves, but could someone be more
> 	specific?

The special feature of secondary address numbers 0 and 1 is that when a
file is opened using one of these channels, the default file type
is 'PRG'. If any other channel number (except 15) is used, the default
file type is 'SEQ'. These defaults can be overridden, and it is quite
possible to type:
load "seqfile,s",8
which would treat the file 'seqfile' as a normal program file, and load it.

-- 

"You can always put something in a box."
This message brought to you with the aid of the Poslfit Committee.
William Rucklidge	University of Toronto Computing Services
{decvax,ihnp4,utcsrgv,{allegra,linus}!utzoo}!utcs!wjr

gentner@sdcsla.UUCP (Don Gentner) (12/13/84)

> Question 1: Can any one tell me what values are used for BASIC tokenization?
>   (or at least where i can find this out?)

The current (January 1985) issue of Compute!'s Gazette has a table of BASIC
token values on pages 120 and 122.  For example FOR is tokenized as 81(hex).
Exactly what that character will look like when you print it, depends on the
character set you are using and/or your printer.  Check the tables in
Programmer's Reference Manual or your printer manual.

			Don Gentner
			UC, San Diego
			gentner@nprdc or ucbvax!sdcsvax!sdcsla!gentner