formatting numeric output

[email protected] (J. David Boyd)
Newsgroups gmane.comp.lang.forth.gforth
Message-ID <[email protected]>
Is there an easier way to do this?

I want to format binary output, so I can see the hex-based groupings.

I mean, if I wanted to see hF00 as binary, or 3840d, it would come out as

0000 0000 0000 0000 0000 1111 0000 0000

so I can glance at it, and see that is equates to F 0 0.

The format function I came up with is

: b.s
  dup
  base @ >r binary
  0
  <<#
  # # # # bl hold
  # # # # bl hold
  # # # # bl hold
  # # # # bl hold
  # # # # bl hold
  # # # # bl hold
  # # # # bl hold
  # # # #
  #>
  TYPE SPACE
  #>>
  r> base ! ;

Is there any easier way than this that I am missing?

Thanks!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.