qdosmsq:traps:trap_3:posa

Differences

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

Link to this comparison view

qdosmsq:traps:trap_3:posa [2009/05/17 17:49] (current)
george.gwilt created
Line 1: Line 1:
 +====== FS_POSAB/​IOF_POSA & FS_POSRE/​IOF_POSR ======
 +
 +
 +These traps position the file pointer.
 +^Trap^Value in D0.B^Action^
 +|FS_POSAB/​IOF_POSA|$42|Position file absolute|
 +|FS_POSRE/​IOF_POSR|$43|Position file relative|
 +
 +^Call Parameters^^Return Parameters^^
 +|D0.B|See above|D0.L|Error return.|
 +|D1.L|File position |D1.L|New file position.|
 +|D3.W|Timeout |D3.L|Preserved.|
 +|A0.L|Channel ID |A0.L|Preserved.|
 +|A1.L| |A1.L|Corrupted.|
 +
 +===== Errors =====
 +
 +
 +|ERR_NC|Not complete.|
 +|ERR_NO|Channel not open.|
 +|ERR_EF|End of file.|
 +
 +
 +===== Notes =====
 +  * All registers not shown above are not used on entry and are preserved on exit.
 +  * The value in D1.L is the absolute position requested for FS_POSAB/​IOF_POSA and is the offset from the current position for FS_POSRE/​IOF_POSR.
 +  * If either trap returns with an off limits error then the pointer is set to the nearest limit (either 0 or the end of the file).
 +  * By setting D1 to 0 and using FS_POSRE/​IOF_POSR the current position of the file can be determined.
 +  * In the case of FS_POSAB/​IOF_POSA if the call is made for a direct sector access channel a special file position flag can be specified in D1. Using $F0FFF0FF returns the sector offset of the first physical sector of the current partition on multiple-partition devices (SMSQ v2.77+), otherwise D1 is unchanged.
 +
 +===== Example =====
 +The example below shows the use of FS_POSRE/​IOF_POSR to find the current position in the file. It is assumed that A0 contains the channel ID.
 +
 +<​code>​
 +pos     ​moveq ​  #​fs_posre,​d0 ​   ; $43
 +        moveq   #​0,​d1 ​          ; To find the current position
 +        moveq   #​-1,​d3 ​         ; Timeout
 +        trap    #3              ; The current position is now in D1.L
 +        tst.l   ​d0 ​             ; OK? . .
 +        bne     ​error ​          ; . . no!
 +</​code>​
 +
  
  • qdosmsq/traps/trap_3/posa.txt
  • Last modified: 2009/05/17 17:49
  • by george.gwilt