[OpenBIOS] [PATCH] sparc32: add sbus-intr>cpu for sun4m

Bob Breuer breuerr at mc.net
Mon Aug 22 17:06:42 CEST 2011

Mark Cave-Ayland wrote:
> On 20/08/11 06:11, Bob Breuer wrote:
>> If someone could show how this C snippet might translate into forth:
>>      static const uint8_t map[7] = { 0x32, ... };
>>      return map[sbus_level];
>> then I could just do an array lookup in sun4m-sbus-intr>cpu to make the
>> mapping more obvious.
> Have you tried Leo Brodie's excellent "Starting Forth" book which is now
> available online? Have a look at the "Initializing an Array" section
> here: http://www.forth.com/starting-forth/sf8/sf8.html.

Looking at CREATE, you build up a byte array one byte at a time with
"c," after each byte, and the result is not const, so it's not quite
what I was hoping for... However, I came across hex strings, i.e.
" "(A1 B2)" will directly encode those 2 bytes into a string, which can
be used as a byte array. I kinda like the hex string idea, but what's
your preference?


More information about the OpenBIOS mailing list