[Coco] Start,end, exec of disk files

Bob Devries devries.bob at gmail.com
Sun Jan 6 20:47:22 EST 2008


Here's a quick BASIC programme to find the START, END and EXEC address of a 
CONTIGUOUS (not multi-block) binary file on disk. It's probably not bullet 
proof, but does check for the existance of the file (line 40) and if the 
file is BIN type (line 50). It prints both the decimal and hex values of 
START, END and EXEC addresses.

10 CLS:PRINT"START, END AND EXEC FINDER"
20 PRINT:INPUT"FILENAME";F$
30 OPEN"D",#1,F$,1:FIELD #1,1 AS A$
40 LF=LOF(1):IF LF=0 THEN CLOSE#1:KILL F$:PRINT"FILE NOT FOUND":END
50 GET #1,1:IF ASC(A$)<>0 THEN CLOSE#1:PRINT"NOT A BINARY FILE":END
60 GET #1,2:LNGTH=ASC(A$)*256
70 GET #1,3:LNGTH=LNGTH+ASC(A$)
80 GET #1,4:START=ASC(A$)*256
90 GET #1,5:START=START+ASC(A$)
100 GET #1,LF-1:EX=ASC(A$)*256
110 GET #1,LF:EX=EX+ASC(A$)
120 PRINT"START = ";START;"$";HEX$(START)
130 EN=START+LNGTH-1
140 PRINT"END   = ";EN;"$";HEX$(EN)
150 PRINT"EXEC  = ";EX;"$";HEX$(EX)

--
Regards, Bob Devries, Dalby, Queensland, Australia

Isaiah 50:4 The sovereign Lord has given me
the capacity to be his spokesman,
so that I know how to help the weary.

website: http://www.home.gil.com.au/~bdevasl
my blog: http://bdevries.invigorated.org/




More information about the Coco mailing list