extrn .nilchk, .bfill, .bdump extrn .setusr, .getusr, .ldem, .dos extrn b.wflg; actually b.eof + wrt access ; @close equ 16 ; ; Close buffered write file hl^. Carry for failure ; a,f .bfclose:: call .nilchk ! rc; bad fcb ptr mov a,m ani b.wflg cpi b.wflg rnz; not a write file push b mvi c,01ah call .bfill pop b call .bdump; write the final block call .getusr push psw mov a,m ani 01fh call .setusr pop psw push h inx h ! inx h ! inx h ! inx h call .ldem; get fcb ptr to de (preserves a) mov h,a; save entry user mvi a,@close call .dos inr a; to set error flag mov a,h pop h push psw; save flags call .setusr; restore entry user pop psw rnz; satisfactory close stc; close failure ret