diff options
| -rw-r--r-- | jefs.fs | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -170,6 +170,11 @@ variable disp decimal \ }}} +hex +: >word ffff and ; +: >byte ff and ; +decimal + : not 0= ; : / /mod swap drop ; : mod /mod drop ; @@ -400,6 +405,7 @@ termios TCGETS stdin ioctl ( noname ) swap execute value tty \ it's designed to look like xxd. i like xxd's hex dumps. hex \ blorken +\ is my if broken or is this? : dump-colour ( c -- n ) dup 0= if white else dup 0a = if yellow else dup 20 < if red else @@ -408,16 +414,16 @@ hex then then then then then nip ; \ also blorken -: dump-char ( c -- c ) dup 20 < if drop [ char . ] literal else +: dump-char ( c -- c' ) dup 20 < if drop [ char . ] literal else dup 7e >= if drop [ char . ] literal then then ; decimal -: (dumpchar) ( a -- a+1 ) dup @ dup dump-colour foreground dump-char emit 1+ ; +: (dumpchar) ( a -- a+1 ) dup @ >byte dup dump-colour foreground dump-char emit 1+ ; : (dumpascii) ( a -- ) 16 begin ?dup 0> while swap (dumpchar) swap 1- repeat default foreground drop ; : (dumploc) ( a -- ) (.dword) say ." : " ; -: (d+) ( a -- a+1 ) dup @ dup dump-colour foreground (.byte) say default foreground 1+ ; +: (d+) ( a -- a+1 ) dup @ >byte dup dump-colour foreground (.byte) say default foreground 1+ ; : (dw+) ( a -- a+2 ) (d+) (d+) space ; : (dumphex) ( a -- ) (dw+) (dw+) (dw+) (dw+) (dw+) (dw+) (dw+) (dw+) drop ; |
