FCLOSE


Closes a file.

[Function Code (R1 Register)]

[Parameter Block (R2 Register)]

[Parameters]

Parameter

Description

Execution result (output)

0: Terminated normally

-1: Error

File number (input)

Number that is returned when a file is opened

[Detailed Description]

Closes a file.

[Example]

_fileclose:
        MOV.L       #PARM,R2        ; Set the address of the parameter block in R2.
        MOV.B       R1,1h:5[R2]  ; Set the value of R1 (file number) in R2 + 1 bytes.
        MOV.L       #01060000h,R1   ; Set the function code of FCLOSE in R1.
        MOV.L       #SIM_IO,R3      ; Set the address of the system call in R3.
        JSR         R3              ; System call
        NOP
        MOV.L       #PARM,R2  ; Set the address of the parameter block in R2.
        MOV.B       [R2],R1   ; Set the first byte of R2 (result of execution) in R1.
        RTS                   ; Return to the address where the function was called.
 
         .SECTION  B,DATA,ALIGN=4
PARM:       .BLKL   1               ; Parameter block area