User Tools

Site Tools


format

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
format [2018/03/31 13:19] – external edit 127.0.0.1format [2024/01/05 00:22] (current) – external edit 127.0.0.1
Line 26: Line 26:
   * <xx><xx><xx><xx> - unrecognised   * <xx><xx><xx><xx> - unrecognised
 \\  The following code will examine the last four bytes of an open file and determine what format it is:\\  \\  The following code will examine the last four bytes of an open file and determine what format it is:\\ 
 +<code bb4w>
       PTR#in%=EXT#in%-4:FOR A%=0 TO 3:buffer%?A%=BGET#in%:NEXT       PTR#in%=EXT#in%-4:FOR A%=0 TO 3:buffer%?A%=BGET#in%:NEXT
       type%=0                                       :REM unknown       type%=0                                       :REM unknown
Line 34: Line 35:
       IF(!buffer% AND &FFFF0000)=&FF0D0000 :type%=2 :REM 6502 format       IF(!buffer% AND &FFFF0000)=&FF0D0000 :type%=2 :REM 6502 format
       IF!buffer%=&FFFF000D                 :type%=1 :REM 80/86 format       IF!buffer%=&FFFF000D                 :type%=1 :REM 80/86 format
 +</code>
 Here **in%** is the handle of the file that has been opened, **buffer%** is a pointer to a four byte **DIM**ensioned block of memory, **A%** is a temporary variable and on exit **type%** contains the file type.\\ \\  Note that in some circumstances it is legitimate to //append// data to the end of a BBC BASIC program file. In that case this method of determining the format will not work, since the last four bytes of the file will not be the last four bytes of the program. Here **in%** is the handle of the file that has been opened, **buffer%** is a pointer to a four byte **DIM**ensioned block of memory, **A%** is a temporary variable and on exit **type%** contains the file type.\\ \\  Note that in some circumstances it is legitimate to //append// data to the end of a BBC BASIC program file. In that case this method of determining the format will not work, since the last four bytes of the file will not be the last four bytes of the program.
format.1522502362.txt.gz · Last modified: 2024/01/05 00:17 (external edit)