_fileopen:
MOV.L R2,R5 ; Set the value of R2 (open mode) in R5.
MOV.L #PARM,R2 ; Set the address of the parameter block in R2.
MOV.L R1,4h:5[R2] ; Set the value of R1 (first address of the
; filename) in R2 + 4 bytes.
MOV.B R5,2h:5[R2] ; Set the value of R5 in R2 + 2 bytes (open mode).
MOV.L #01250000h,R1 ; Set the function code of FOPEN in R1.
MOV.L #SIM_IO,R5 ; Set the address of the system call in R5.
JSR R5 ; System call
NOP
MOV.L #PARM,R2 ; Set the address of the parameter block in R3.
MOV.B 1h:5[R2],R1 ; Set the value of R2 + 1 byte (file number) in R1.
MOV.B R1,[R3] ; Set the value of R1 in the location pointed to
; by R3 (file number pointer).
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 2 ; Parameter block area
|