VolksForth/8080/CPM/cpmfiles/include.fb

1 line
9.0 KiB
Plaintext
Raw Normal View History

\ include for stream sources for cp/m phz 30aug23 \ load screen phz 02sep23 onlyforth dos also forth definitions : idos-error? ( n -- f ) 0<> ; : iread-seq ( dosfcb -- f ) $14 bdosa idos-error? ; : cr+ex@ ( fcb -- cr+256*ex ) dup &34 + c@ swap &14 + c@ $100 * + ; : cr+ex! ( cr+256*ex fcb -- ) >r $100 u/mod r@ &14 + c! r> &34 + c! ; 1 7 +thru \ fib /fib #fib eolf? phz 07mai23 context @ dos also context ! $50 constant /tib variable tibeof tibeof off $1a constant ctrl-z : eolf? ( c -- f ) \ f=-1: not yet eol; store c and continue \ f=0: eol but not yet eof; return line and flag continue \ f=1: eof: return line and flag eof tibeof off dup #lf = IF drop 0 exit THEN ctrl-z = IF tibeof on 1 ELSE -1 THEN ; \ incfile incpos inc-fgetc phz 02sep23 variable incfile variable increc variable rec-offset $80 constant dmabuf | $ff constant dmabuf-last : readrec ( fcb -- f ) dup cr+ex@ increc ! rec-offset off dmabuf dma! drive iread-seq ; : inc-fgetc ( -- c ) rec-offset @ b/rec u< 0= IF incfile @ readrec IF ctrl-z exit THEN THEN rec-offset @ dmabuf + c@ 1 rec-offset +! ;