home *** CD-ROM | disk | FTP | other *** search
Text File | 1986-09-22 | 1.1 KB | 51 lines | [TEXT/MACA] |
- \ HexUnloader
- \ 11/21/85 jaf
- \ 9/22/86 cdn Generalized to handle a sequence of words to be unloaded
- \ reads code words and creates a source file which when interpreted,
- \ recreates the words from hex codes
- \ Example: " test" createHex
- \ unload' pstart
- \ unload' p;s
- \ doneHex
-
- : writeCR 13 HERE C! HERE 1 write: topFile drop ;
-
- : Unload { baddr blen -- }
- HEX
- blen baddr + baddr -2 AND DO
- 4 0 DO
- j i 4* + @ 0
- <# #s #> write: topFile abort" can't write file"
- HERE 3 BLANKS ASCII , HERE 1+ C!
- HERE 3 write: topFile drop
- LOOP
- writeCR
- 16 +LOOP
- DECIMAL
- 0 HERE !
- ;
-
- \ ( faddr flen -- )
- : createHex
- new: loadFile
- name: topFile
- create: topFile abort" can't open file"
- 'type TEXT 'type MACA set: topFile
- ;
- : doneHex
- remove: loadFile ;
-
- \ ( faddr flen : word -- )
- : Unload' { \ theNFA -- }
- @pfa dup nfa -> theNFA
- latest \ find the pfa of the word following our word
- BEGIN dup pfa lfa @ theNFA >
- WHILE pfa lfa @
- REPEAT
- " Create " write: topFile abort" can't write file"
- theNfa n>count write: topFile drop
- writeCR
- over - Unload
- writeCR
- ;
-