.IIF NDF RSX RSX = 0 ;Assume RT11 .TITLE FLUSH .ident /000001/ .NLIST BEX, CND .ENABL LC, GBL .LIST MEB ; ; Flush clears the buffer and forces it out. It is a no-op on ; RSX, but is needed in RT11. ; ; FLUSH calling sequence: ; ; MOV FDB,R0 ;R0 -> file data block ; CALL FLUSH ;Do it ; ; On return, all registers are preserved. ; ; Edit history ; 01 01-Aug-79 MM Original edit ; .IF NE RSX .IFTF FLUSH:: .IFT CLC ;Always good return RTS PC ;Do nothing nicely. .IFF .GLOBL SAVREG, $PUTC0 JSR R5,SAVREG ;Save all registers MOV SP,R5 ;So we can mark the stack MOV R0,R1 ;Copy the FDB TST (R1)+ ;R1 -> free count CMP (R1),#512. ;Empty buffer BGE 30$ ;How can I flush nothing? 10$: TST (R1)+ ;Free count equals zero? BLE 20$ ;Close enough, exit loop CLRB @(R1)+ ;Clear the buffer byte INC -(R1) ;Step the buffer pointer DEC -(R1) ;Drop the free count BR 10$ ;Loop some more 20$: JSR PC,$PUTC0 ;Do it 30$: RTS PC ;and return .ENDC .END