;*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

;Exit:
; R0 - error or corrupt
; R1 - corrupt

.Entry_ADFFlush
 STMFD   R13!, {R12, R14}
 ADR     R12, VARS

 ADD     R0, R12, #Current_File_Mounted - VARS
 LDRB    R1, [R0]			;get first byte of filename
 TEQ     R1, #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

 LDMFD   R13!, {R12, R14}		;YES
B       Entry_ADFSave			;save the file

 ._error
 MOV     R14, #1 << 31
 ADDS    R14, R14, R14			;set V
LDMFD   R13!, {R12, PC}