VolksForth/msdos/dos.fb

1 line
18 KiB
Plaintext
Raw Normal View History

2017-04-23 22:25:49 +00:00
\ 28 jun 88 DOS loads higher level file functions which go beyond including a screen file. Calls to MS-DOS are implemented and used for directory manipulation. These functions may not work for versions before MS-DOS 3.0. \ MS-DOS file handli 28 jun 88 Onlyforth \needs Assembler 2 loadfrom asm.scr : fswap isfile@ fromfile @ isfile ! fromfile ! ; $80 Constant dta | : COMSPEC ( -- string ) [ dos ] $2C @ ( DOS-environment:seg) 8 ds@ filename &60 lmove filename counted &60 min filename place filename ; 1 &12 +thru .( MS-DOS functions loaed ) cr Onlyforth \ moving blocks ks 04 okt 87 | : full? ( -- flag ) prev BEGIN @ dup @ 0= UNTIL 6 + @ 0< ; : used? ( blk -- f ) block count b/blk 1- swap skip nip 0<> ; | : (copy ( from to -- ) full? IF save-buffers THEN isfile@ fromfile @ - IF dup used? Abort" target block not empty" THEN dup isfile@ core? IF prev @ emptybuf THEN isfile@ 0= IF offset @ + THEN isfile@ rot fromfile @ (block 6 - 2! update ; \ moving blocks ks 04 okt 87 | : blkmove ( from to quan -- ) 3 arguments save-buffers >r over r@ + over u> >r 2dup u< r> and IF r@ r@ d+ r> 0 ?DO -1 -2 d+ 2dup (copy LOOP ELSE r> 0 ?DO 2dup (copy 1 1 d+ LOOP THEN save-buffers 2drop ; : copy ( from to -- ) 1 blkmove ; : convey ( blk1 blk2 to.blk -- ) 3 arguments >r 2dup swap - >r fswap dup capacity 1- > isfile@ 0<> and fswap r> r@ + capacity 1- > isfile@ 0<> and or >r 1+ over - dup 0> not r> or Abort" nein" r> swap blkmove ;