Everything

FPUTC


Writes 1 byte of data to 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

Beginning address of output buffer (input)

Beginning address of the buffer that contains output data

[Detailed Description]

-

Writes 1 byte of data to a file.

[Example]

_fcharput:
        MOV.L       R2,R5           ; Set the value of R2 (file number) in R5.
        MOV.L       #PARM,R2        ; Set the address of the parameter block in R2.
        MOV.L       #IO_BUF,R4      ; Set the address of the output buffer in R4.
        MOV.L       R4,4h:5[R2]     ; Set the value of R4 (output buffer) in R2 + 4 bytes.
        MOV.B       R1,[R4]         ; Set the value of R1 (output character) in the 
                                    ; location pointed to by R4 (output buffer).
        MOV.B       R5,1h:5[R2]  ; Set the value of R5 in R2 + 1 bytes (file number).
        MOV.L       #01280000h,R1   ; Set the function code of FPUTC in R1.
        MOV.L       #SIM_IO,R3      ; Set the address of the system call in R3.
        JSR         R3              ; System call
        NOP
        MOV.L       #PARM,R1  ; Set the address of the parameter block in R1.
        MOV.B       [R1],R1   ; Set the first byte of R1 (result of execution) in R1.
        RTS                   ; Return to the address where the function was called.
 
         .SECTION  B,DATA,ALIGN=4
PARM:       .BLKL   2               ; Parameter block area
         .SECTION  B_1,DATA
IO_BUF:     .BLKL   1               ; Input/output buffer