In    -
Out   FakeFreeSpace
Type  Module

Define Module
 Name   Legacy_FSControl49Support
 Author Justin Fletcher
 Vectors
  FSControlV  fscontrol
 End Vectors
End Module

>fscontrol
   TEQ     r0,#49            ; is it read free space ?
   MOVNE   pc,link
   STMFD   (sp)!,{r3-r4,link}  ; Stack registers
   XSWI    "XOS_FSControl",55  ; 64-bit version instead
   LDMVSFD (sp)!,{r3-r4,pc}  ; caused an error, so fall back to normal
   MOV     r14,#1<<31        ; our lie about free space (31 bits)
   TEQ     r1,#0             ; check the free space high
   TSTEQ   r0,r14            ; check top but set in lower 32 bits
   SUBNE   r0,r14,#1
   MOV     r1,r2             ; largest object is still one word
   TEQ     r4,#0             ; check the disc size high
   TSTEQ   r3,r14            ; check top but set in lower 32 bits
   MOVEQ   r2,r3
   SUBNE   r2,r14,#1
   LDMFD   (sp)!,{r3-r4,link,pc} ; claim
