I have pushed up an update with what, I hope, is a working INPUT. Currently it reads whole lines of text only but should return the next line each time INPUT is called, provided that the file already is open.
In order to access the tape file HEADER, you first send the FIND @5:X command for file X then INPUT @5,9:A$ to fetch the HEADER. At this point the file itself cannot be accessed without doing another FIND @5:X command.
This is why I need to resolve the matter of the header record as this will be crucial to the next stages of development. It is accessed by a number of commands including FIND, HEADER, MARK, OPEN, KILL, READ, WRITE. I have seen the Tektronix specification in the manual and imagine that when the 405x requests the header record it will need to be transmitted in the correct Tek format. The emulator stores the information in the filename in a somewhat different format, so when FIND finds the file, it will need to extract the header information which will need to be stored or converted into Tek header format while the file remains open.
Incidentally, I discovered that the last number in the header information is the number of records allocated. It seems that records can be 128 or 256 bytes long. Will the emulator be expected to support both?
The filename format includes:
xxxxxx MARKed filesize in bytes
MARK records the number of 128 or 256 byte 'records' allocated. Is the intention here to record the actual file size in bytes rather than the number of records?
I have been recovering dozens of Tektronix 4050 series program tapes by reading every block in every file. The 4924 tape drive was introduced with the 4051 in 1975 and replaced a 4923 tape drive which was designed to work with the 4000 series Tektronix terminals. The 4923 tape drive only supported 128 byte blocks and the 4924 tape drive could be configured for either, but the 4924 tape drive default is 256 byte blocks.
None of the 100's of 4050 tape drive programs I have recovered use 128 byte blocks - as the 4051 internal tape drive was designed to support 256 byte blocks - so we don't need to support anything but 256 byte blocks. In addition, I don't think the block size is of any importance as their is no Tek BASIC command that fetches a data block. For my Tape Dump program I use a different company "TransEra" ROM cartridge with data block read and write commands.
The first block on the 4050 tapes I have recovered by reading the all the blocks with my Tape Dump program only uses the HEADER string at the beginning of the block, which can only be read by a 4051 program using the PRINT @x,19: BASIC statement where x=33 for the internal tape drive or x=4924 primary GPIB address for the external tape drive.
The ONLY 4050 programs that have this statement are the ones that read the original tape header and rewrite the header with comments supplied to the program by the user.
The BASIC TLIST command to the internal tape only - reads the file HEADER from each file and lists the information to the 4050 display by default, or can be redirected to PRINT each file HEADER to a GPIB device. Tek BASIC replaces the last number (number of 256 byte blocks in the file - not including the HEADER block) with the calculated file size.
This calculated file size will match the filesize requested with the MARK command which created the file - not the amount of the file that is used.
The TLIST command is really only useful to a user that wants to either remember which file number to open on a previously recorded tape, or is trying to add or replace files on the tape with the MARK command and wants to find the LAST file to use that file number as the starting file number for the MARK command.
I used the 4051 computer for 3 years in the late 1970's, developing programs. When I purchased my vintage 4052 and 4054 computers twenty years later, I couldn't find a 4051. I noticed the 4052 and 4054 computers (introduced in 1979) added several new BASIC commands including a HEADER command. When you run the HEADER command on either the internal tape or 4924 tape, you must run this command immediately after a FIND command and Tektronix PRINTs the file header information for that file exactly like the print in the TLIST - where the filesize is printed in bytes, not number of blocks. However, the file that you have printed the header is no longer open and another FIND command must be issued before the file can be accessed.
I have created the filename for each file on the microSD card in the Emulator in the same byte for byte format as the 4050 tape header with three exceptions:
- The leading space before the filenumber is stripped when the filename saved (and I don't use the file extension)
- The trailing CR and DC3 are stripped when the filename is saved
- The starting location of the number of blocks of the LAST file is shorter by one byte than all the other files
My Emulator code adds the leading space and trailing CR and DC3 to the header string before sending it to the system to match what Tek BASIC documentation on the header format.
Apparently TEK BASIC on the 4054A (the A-Series 4052 and 4054 added the TI 9914 GPIB ASIC and many new BASIC instructions, so the firmware is different than the 4052) does not access the file header before the OLD command, since we don't have that working yet on the Emulator.
I do believe TEK BASIC will access the file header before executing a program READ statement from tape - as Tektronix will need to process each binary data item header for each READ.
Thanks for the updated code - I will test that now and we will see if the INPUT command also requires the header be accessed.
Since the file header is an entire block of 256 bytes - I don't know if Tek BASIC ROM expects to access the header like a user with the special PRINT statement followed by an INPUT command for the ASCII header string after a FIND command, with a subsequent additional FIND command to access the data items based on the data file type, but we will find out
I replace the 4924 5V power supply fuse yesterday and the tape drive appeared to start working and I was able to use the front buttons to fast forward and rewind the tape, but when I turned it off and connected it to my 4052 and turned it on again - it is not working
I don't plan to debug the 4924 issue today.
I hope your updated code for INPUT works on the 4054A. I have prepared a fourth directory on the microSD card with my Adventure game port where the statements that access the 55 data files have been changed to access these files on the emulator. Fingers crossed.