home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / FFA.ZIP / DUMP.SEQ < prev    next >
Encoding:
Text File  |  1987-12-29  |  1.6 KB  |  54 lines

  1. \ DUMP.SEQ      A simple dump utility      Enhancements by Tom Zimmer
  2.  
  3. DECIMAL
  4.  
  5. \ The dump utility gives you a formatted hex dump with the ascii
  6. \ text corresponding to the bytes on the right hand side of the
  7. \ screen.  In addition you can use the SM word to set a range of
  8. \ memory locations to desired values.  SM displays an address and
  9. \ its contents.  You can go forwards or backwards depending upon
  10. \ which character you type. Entering a hex number changes the
  11. \ contents of the location.  DL can be used to dump a line of
  12. \ text from a screen.
  13.  
  14. VARIABLE DUMPSEG
  15.  
  16. : DUMPC@        ( A1 --- C1 )
  17.                 DUMPSEG @ SWAP C@L ;
  18.  
  19. : .2   ( n -- )   0 <#   # #   #>   TYPE   SPACE   ;
  20.  
  21. : D.2   ( addr len -- )   BOUNDS ?DO   I DUMPC@ .2   LOOP   ;
  22.  
  23. : EMIT.   ( char -- )
  24.    127 AND DUP BL 126 BETWEEN NOT IF DROP ASCII . THEN EMIT ;
  25.  
  26. : DLN   ( addr --- )
  27.    CR   DUP 4 U.R   2 SPACES   8 2DUP D.2
  28.    OVER + 8 D.2 ." |"   16 BOUNDS
  29.    ?DO   I DUMPC@ EMIT.   LOOP  ." |" ;
  30.  
  31. : .HEAD ( addr len -- addr' len' )
  32.         OVER 15 AND   CR 6 SPACES ." \/ " 1+
  33.         15 0 DO DUP I + 15 AND 2 .R SPACE LOOP  SPACE 1-
  34.         16 0 DO DUP I + 15 AND 1 .R LOOP DROP ;
  35.  
  36. : LDUMP         ( addr len -- )
  37.                 BASE @ -ROT HEX .HEAD BOUNDS
  38.                 DO      I DLN  KEY? ?LEAVE
  39.             16 +LOOP    BASE !   ;
  40.  
  41. : DUMP          ( A1 N1 --- )
  42.                 ?CS: DUMPSEG !          LDUMP ;
  43.  
  44. : YDUMP         ( A1 N1 --- )
  45.                 YSEG @ DUMPSEG !        LDUMP ;
  46.  
  47. : XDUMP         ( A1 N1 --- )
  48.                 XSEG @ DUMPSEG !        LDUMP ;
  49.  
  50. : DU            ( addr -- addr+64 )
  51.                 DUP 64 LDUMP 64 +   ;
  52.  
  53.  
  54.