aboutsummaryrefslogtreecommitdiff
path: root/forth/forth/avr/xdump.fs
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2018-09-29 01:02:00 +0200
committerDimitri Sokolyuk <demon@dim13.org>2018-09-29 01:02:00 +0200
commit79cabd5b1c8bcd9f50dc49e77776e713a57dff48 (patch)
tree6eb73857e9c174610839291cf05a02d77fc82b8c /forth/forth/avr/xdump.fs
parent247df3bb9d4c89d4e5ff18dcc23ba1c9532f28c0 (diff)
parent110a6411bae421260476eacf6173897c1d1f4b8a (diff)
Merge branch 'master' of dim13.org:elegoo
Diffstat (limited to 'forth/forth/avr/xdump.fs')
-rw-r--r--forth/forth/avr/xdump.fs45
1 files changed, 45 insertions, 0 deletions
diff --git a/forth/forth/avr/xdump.fs b/forth/forth/avr/xdump.fs
new file mode 100644
index 0000000..e8a4d93
--- /dev/null
+++ b/forth/forth/avr/xdump.fs
@@ -0,0 +1,45 @@
+\ *********************************************************************
+\ *
+\ Filename: xdump.txt *
+\ FlashForth: 5.0 *
+\ MCU ATmega *
+\ Application: *
+\ *
+\ Author: Mikael Nordman *
+\ *
+\ *********************************************************************
+\ FlashForth is licensed acording to the GNU General Public License*
+\ *********************************************************************
+
+-xdump
+marker -xdump
+
+\ Display the contents of raw FLASH memory,
+\ given the starting address and length.
+\ The address is a raw address without mapping
+\ Displays in hex notation and printable ASCII.
+\ xdump expects base to be hex.
+\
+
+: ud.r <# 1- for # next #s #> type ;
+: u.2 $ff and 0 2 ud.r space ;
+: xx@ 2dup x@ dup ;
+
+\ Extended Memory Dump.
+\
+: xdump ( d.addr +n -- )
+ rot $fffe and \ start on even address
+ rot rot $10 u/ \ number of rows to print
+ for
+ cr 2dup 6 ud.r
+ [char] : emit space \ display row addr
+ $8 for
+ xx@ u.2 #8 rshift u.2 2 m+
+ next
+ -$10 m+ \ wind back the addr
+ $8 for \ print ASCII
+ xx@ >pr emit >< >pr emit 2 m+
+ next
+ next
+ 2drop cr ;
+