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!


Reply via email to