Hi!
I want to try to read any file byte per byte in assembler. For example, here's BASIC program which reads 10 bytes:
OPEN 1,11,1,â€TESTFILE,S,Râ€
FOR X=1TO10:INPUT#1,A$:PRINT A$:NEXT
CLOSE 1
But I want to read it to end of File (EOF). What a mark has EOF?
'Cause when I'm reading directory in assembler it ends with $00...
But if in data are bytes with $00 value, how to find EOF?
Many thanks for every reply.
MIro
Read page 215 in Compute's 128 Programmer's Guide (http://www.bombjack.org/commodore/books/pdf/Compute%27s_128_Programmer%27s_Guide.pdf). It's all explained there.
there is no specific EOF mark as part of the file data - you should check location $90 aka ST the IEC status byte.
bit7 - dev. not present
bit6 - EOF
bit1 - error during read (usually file not found)
bit0 - error during write (disk full etc.)
your routine should look like:
open file
readbyteloop: read byte
(do whatever)
bit $90
bvc readbyteloop
close file