;*ADFFlush
;---------
;Save changes to the currently loaded ADF file
;Entry:
; R0 = pointer to command tail
; R1 = no. of parameters
; R12 = pointer to module private word

.Entry_ADFFlush
 STR     R14, [R13, #-4]!
 LDR     R12, [R12, #0]

 ADR     R0, Current_File_Mounted	;filename
 LDRB    R14, [R0]			;get first byte of filename
 TEQ     R14, #0			;do we have a filename?
 ADREQ   R0, Error_FlushFail		;NO, report an error
 BEQ     _error

 LDR     R14, [R12, #ADF_Mounted - VARS]
 TEQ     R14, #2			;is it an APD
 ADREQ   R0, Error_Disc_SaveAPD		;YES,
 BEQ     _error				; |+ report an error

 LDR     R14, [R13], #4			;YES
 B       Entry_ADFSave			;save the file

 ._error
 MOV     R14, #1 << 31
 ADDS    R14, R14, R14			;set V
 LDR     PC, [R13], #4