All pastes #273355 Raw Edit

Something

public text v1 · immutable
·published 2006-12-09 20:50 UTC
rendered paste body
: parse-digit ( hex-digit -- number )
    dup [char] a >= dup [char] f <= and if
        [char] a - 10 +
    else
        dup [char] A >= dup [char] F <= and if
            [char] A - 10 +
        else
            [char] 0 -
        then
    then ;

: parse-number ( string-addr count -- number )
    0 rot rot
    over + swap do
        16 * i c@ parse-digit +
    loop ;

: store ( addr "hex numbers" -- )
    begin
        bl word count
        dup if
            parse-number over c! 1+
        else
            drop drop drop exit
        then
    again ;

Example:

here dup 4 allot store 1 a1 ff 0
4 dump
  44F204 | 01 A1 FF 00                                      |.¡ÿ.| ok