home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / PROG / MISC / FPC355_2.ZIP / FPCSRC.ZIP / DUMP.SEQ < prev    next >
Encoding:
Text File  |  1990-05-28  |  2.1 KB  |  71 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. DEFER DUMPC@    ' %DUMPC@ IS DUMPC@
  20.  
  21. : .2W   ( n -- )   0 <#   # #   #>   TYPE   SPACE   ;
  22.  
  23. : D.2W   ( addr len -- )   BOUNDS ?DO   I DUMPC@ .2W   LOOP   ;
  24.  
  25. : EMIT.   ( char -- )
  26.    127 AND DUP BL 126 BETWEEN NOT IF DROP '.' THEN EMIT ;
  27.  
  28. : DLN   ( addr --- )
  29.    CR   ." │" DUMPSEG @ 0 <# ':' HOLD # # # # #> TYPE
  30.         DUP 0 <# # # # # #> TYPE ." │ " 8 2DUP D.2W
  31.    OVER + 8 D.2W ." │"   16 BOUNDS
  32.    ?DO   I DUMPC@ EMIT.   LOOP  ." │" ;
  33.  
  34. headerless
  35.  
  36. : .HEAD ( addr len -- addr' len' )
  37.         OVER 15 AND
  38.         CR ." ╒═════════╤"
  39.         49 0 DO ." ═" LOOP ." ╤" 16 0 DO ." ═" LOOP ." ╕"
  40.         CR ." │ SEG:OFF │ "
  41.         16 0 DO DUP I + 15 AND 2 .R SPACE LOOP ." │"
  42.         16 0 DO DUP I + 15 AND 1 .R LOOP DROP  ." │"
  43.         CR ." ╞═════════╪"
  44.         49 0 DO ." ═" LOOP ." ╪" 16 0 DO ." ═" LOOP ." ╡" ;
  45.  
  46. : .FOOT ( --- )
  47.         CR ." ╘═════════╧"
  48.         49 0 DO ." ═" LOOP ." ╧" 16 0 DO ." ═" LOOP ." ╛" CR ;
  49.  
  50. headers
  51.  
  52. : LDUMP         ( SEG addr len -- )
  53.                 ROT DUMPSEG !
  54.                 BASE @ -ROT HEX .HEAD BOUNDS
  55.                 DO      I DLN  KEY? ?LEAVE
  56.             16 +LOOP    BASE !  .FOOT ;
  57.  
  58. : DUMP          ( A1 N1 --- )
  59.                 ?CS: -ROT LDUMP ;
  60.  
  61. : YDUMP         ( A1 N1 --- )
  62.                 YSEG @ -ROT LDUMP ;
  63.  
  64. : XDUMP         ( SEG N1 --- )
  65.                 SWAP +XSEG 0 ROT LDUMP ;
  66.  
  67. : DU            ( addr -- addr+64 )
  68.                 DUP 64 DUMPSEG @ -ROT LDUMP 64 +   ;
  69.  
  70. behead
  71.