extrn .getusr, .setusr, .broom, .ldem, .dos extrn .advance, b.cnt, b.eof ; @dma equ 26 @rdseq equ 20 ; ; Read into buffer hl^ until less than 128 bytes free or eof ; Carry for eof or read error. ; Reset pointers for any extra portion not read ; Assumes no access via wtptr, i.e. input only buffer ; This code assumes buffer size to be a multiple of 128 bytes, ; so that single reads never need to "wrap around" the buffer. ; a,f .bload:: mov a,m ani b.eof; check for eof stc rnz call .getusr push psw mov a,m ani 01fh call .setusr push b ! push d ! push h bload1: call .broom mov a,c ! ani 80h ! ora b jz bload3; < 128 bytes free inx h ! inx h mov c,m ! inx h ! mov b,m; get size inx h ! call .ldem; get fcb, point to cnt mov a,d ! ora e ! stc jz bload3; error, no fcb specified push d; save fcb, point to cnt inx h ! inx h; rptr inx h ! inx h; wptr (to buffer) call .ldem ! dad d; form access address xchg mvi a,@dma call .dos pop d; get fcb mvi a,@rdseq call .dos jnz bload2; exit, eof or error pop d ! push d; else advance pointers lxi h,b.cnt ! dad d mov a,m ! adi 128 ! mov m,a inx h mov a,m ! aci 0 ! mov m,a; advance cnt inx h ! inx h ! inx h; point to wptr call .advance pop h ! push h jmp bload1; repeat until full/eof bload2: pop h ! push h mov a,m ! ori b.eof ! mov m,a; mark eof found bload3: pop h ! pop d ! pop b xthl; get entry user to h push psw; save error flag mov a,h call .setusr; restore entry user pop psw pop h ret