User Tools

Site Tools


format

Differences

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

Link to this comparison view

format [2018/03/31 13:19]
127.0.0.1 external edit
format [2018/04/17 16:21] (current)
tbest3112 Added syntax highlighting
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.txt ยท Last modified: 2018/04/17 16:21 by tbest3112