home *** CD-ROM | disk | FTP | other *** search
/ Dream 48 / Amiga_Dream_48.iso / Atari / forth / forst.zoo / forst / lib / another.s next >
Text File  |  1990-12-10  |  765b  |  37 lines

  1. ( ANOTHER: duplication of inline code words )
  2. ( use:  another <word name> )
  3.  
  4. decimal
  5.  
  6. : another
  7.   { 6 regs  cfa dest
  8.     headstart headlength
  9.     codesize codestart
  10.     1 local  codeoffset }
  11.  
  12.   head  to cfa
  13.   cfa 4 - w@ 1023 and  to codesize
  14.   
  15.   codesize if
  16.   
  17.     codesize 1 + 2*  to codesize  ( full code size in bytes)
  18.     cfa 5 - -1 traverse  to headstart
  19.     cfa 4 + @  a5 +  to codestart
  20.     cfa 8 + w@ 2+  to headlength
  21.  
  22.     cp @ to codeoffset  
  23.     codestart here codesize cmove  codesize cp +!
  24.     
  25.     headstart there headlength cmove
  26.     headlength hp +!
  27.     
  28.     there 10 - to dest ( point to new cfa)
  29.     codeoffset dest inc ! ( cfa) codeoffset dest ! ( pfa)
  30.  
  31.   else
  32.  
  33.     ." not suitable for duplication"
  34.  
  35.   then
  36. ;
  37.