\ DUMP.SEQ A simple dump utility Enhancements by Tom Zimmer DECIMAL \ The dump utility gives you a formatted hex dump with the ascii \ text corresponding to the bytes on the right hand side of the \ screen. In addition you can use the SM word to set a range of \ memory locations to desired values. SM displays an address and \ its contents. You can go forwards or backwards depending upon \ which character you type. Entering a hex number changes the \ contents of the location. DL can be used to dump a line of \ text from a screen. VARIABLE DUMPSEG : DUMPC@ ( A1 --- C1 ) DUMPSEG @ SWAP C@L ; : .2 ( n -- ) 0 <# # # #> TYPE SPACE ; : D.2 ( addr len -- ) BOUNDS ?DO I DUMPC@ .2 LOOP ; : EMIT. ( char -- ) 127 AND DUP BL 126 BETWEEN NOT IF DROP ASCII . THEN EMIT ; : DLN ( addr --- ) CR DUMPSEG @ 0 <# ASCII : HOLD # # # # #> TYPE DUP 0 <# # # # # #> TYPE ." | " 8 2DUP D.2 OVER + 8 D.2 ." |" 16 BOUNDS ?DO I DUMPC@ EMIT. LOOP ." |" ; : .HEAD ( addr len -- addr' len' ) OVER 15 AND CR ." SEG:OFFSET \/ " 1+ 15 0 DO DUP I + 15 AND 2 .R SPACE LOOP SPACE 1- 16 0 DO DUP I + 15 AND 1 .R LOOP DROP ; : LDUMP ( addr len -- ) BASE @ -ROT HEX .HEAD BOUNDS DO I DLN KEY? ?LEAVE 16 +LOOP BASE ! CR ; : DUMP ( A1 N1 --- ) ?CS: DUMPSEG ! LDUMP ; : YDUMP ( A1 N1 --- ) YSEG @ DUMPSEG ! LDUMP ; : XDUMP ( SEG N1 --- ) >R XSEG @ + DUMPSEG ! 0 R> LDUMP ; : DU ( addr -- addr+64 ) DUP 64 LDUMP 64 + ;