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