umouse

umouse.git
git clone git://git.lenczewski.org/umouse.git
Log | Files | Refs | Submodules | README

dump.fth (1804B)


      1 \ dump.fth - DUMP and friends
      2 
      3 ((
      4 Copyright (c) 2005, 2013
      5 MicroProcessor Engineering
      6 133 Hill Lane
      7 Southampton SO15 5AF
      8 England
      9 
     10 tel: +44 (0)23 8063 1441
     11 fax: +44 (0)23 8033 9691
     12 net: mpe@mpeforth.com
     13      tech-support@mpeforth.com
     14 web: www.mpeforth.com
     15 
     16 From North America, our telephone and fax numbers are:
     17   011 44 23 8063 1441
     18   011 44 23 8033 9691
     19 
     20 
     21 To do
     22 =====
     23 
     24 Change history
     25 ==============
     26 20131220 SFP001 MSP430 Lite conversion.
     27 ))
     28 
     29 \ ***************
     30 \ *! debugtools
     31 \ *T Debug tools
     32 \ ***************
     33 \ *P Some simple debug tools can be found in *\i{dump.fth}.
     34 
     35 : .ASCII        \ b --
     36   $07F AND  DUP $020 $07F WITHIN 0=
     37   IF  DROP $02E  ENDIF  EMIT
     38 ;
     39 
     40 : .BYTE         \ n --
     41   base @ >r hex
     42   0 <# # # #> TYPE
     43   r> base !
     44 ;
     45 
     46 : .WORD         \ n --
     47   base @ >r hex
     48   0 <# # # # # #> TYPE
     49   r> base !
     50 ;
     51 
     52 : .DWORD         \ n --
     53   base @ >r hex
     54   0 <# # # # # [char] : hold # # # # #> TYPE
     55   r> base !
     56 ;
     57 
     58 : dump		\ addr len --
     59 \ *G Display the given block of memory in hex and ASCII.
     60   BASE @ -rot  HEX  bounds ?DO		\ get limits
     61     CR  i .DWORD  i $010 bounds		\ print address
     62     do  space  i c@ .BYTE  loop		\ print byte
     63     2 SPACES  I $010 bounds		\ gap
     64     DO  I c@ .ASCII  LOOP		\ ascii o/p
     65     key? ?LEAVE				\ quit or halt
     66   $010 +LOOP				\ until done
     67   BASE !  CR				\ restore base
     68 ;
     69 
     70 : pdump		\ addr len --
     71 \ *G Display the given block of memory as hex 32 bit words.
     72   BASE @ -rot  HEX
     73   swap -4 and swap  bounds ?DO		\ get limits
     74     CR  i .DWORD  i $010 bounds		\ print address
     75     do  space  i @ .DWORD  cell +loop	\ display word
     76     key? ?LEAVE				\ quit or halt
     77   $010 +LOOP				\ until done
     78   BASE !  CR				\ restore base
     79 ;
     80 
     81 : .S		\ i*x -- i*x
     82 \ *G Display the stack contents
     83   CR ." -- "
     84   DEPTH ?DUP IF
     85     0 swap 1- do
     86       i pick u.  ( key? ?LEAVE )
     87     -1 +loop
     88   ENDIF
     89 ;