qdosmsq:traps:trap_3:shdr

Differences

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

Link to this comparison view

qdosmsq:traps:trap_3:shdr [2009/05/27 16:41] (current)
george.gwilt created
Line 1: Line 1:
 +====== FS_HEADS/​IOF_SHDR ======
 +
 +
 +This trap sets a file header.
 +
 +^Call Parameters^^Return Parameters^^
 +|D0.B|$46|D0.L|Error return.|
 +|D1.L| |D1.W|Length of header set.|
 +|D3.W|Timeout |D3.L|Preserved.|
 +|A0.L|Channel ID |A0.L|Preserved.|
 +|A1.L|Base of header definition|A1.L|End of header definition.|
 +===== Errors =====
 +
 +|ERR_NC|Not complete.|
 +|ERR_NO|Channel not open.|
 +
 +
 +===== Notes =====
 +  * All registers not shown above are not used on entry and are preserved on exit.
 +  * This trap sets the first 14 bytes of the file header.
 +  * Note that if this trap is dealing with a purely serial device the length of header in D1.W will be a spurious 15.
 +  * The format of a header is given [[qdosmsq:​traps:​trap_3:​rhdr|here]]. ​
 +
 +===== Example =====
 +The example below shows the use of this trap call to increase the dataspace of a program by $1000 bytes. It is assumed that A0 contains the file's ID and that a 64-byte buffer is at buf(A6).
 +
 +<​code>​
 +datsp   ​moveq ​  #​fs_headr,​d0 ​   ; $47
 +        moveq   #​64,​d2 ​         ; Space for 64-byte header
 +        moveq   #​-1,​d3 ​         ; Timeout
 +        lea     ​buf(a6),​a1 ​     ; Buffer
 +        trap    #3              ; Read header
 +        tst.l   ​d0 ​             ; OK . .
 +        bne     ​error ​          ; . . no!
 +        add.l   #​$1000,​buf+6(a6) ; Add $1000 to the dataspace
 +        moveq   #​fs_heads,​d0 ​   ; $46
 +        lea     ​buf(a6),​a1 ​     ; Reset the header base address
 +        trap    #3              ; Write header
 +        tst.l   ​d0 ​             ; OK . .
 +        bne     ​error ​          ; . . no!        ​
 +        ​
 +</​code>​
 +
  
  • qdosmsq/traps/trap_3/shdr.txt
  • Last modified: 2009/05/27 16:41
  • by george.gwilt