fork download
  1. : iHEX,{ ( "hex-byte hex-byte ... }" ) \ Add bytes in hex to dictionary
  2. BASE @ >R HEX
  3. \ Loop over input
  4. BEGIN
  5. 0.
  6. PARSE-NAME \ Read while parse area has content and not }
  7. DUP IF 2DUP S" }" COMPARE
  8. ELSE FALSE THEN
  9. WHILE
  10. \ Convert to number and add to dictionary
  11. ( 0 name-a name-u ) >NUMBER 2DROP D>S POSTPONE LITERAL POSTPONE C,
  12. REPEAT
  13.  
  14. R> BASE !
  15.  
  16. 2DROP 2DROP ; IMMEDIATE
  17.  
  18. CREATE w
  19.  
  20. 0 VALUE HERE$
  21. : backup-here HERE TO HERE$ ;
  22. : w->here w DP ! ;
  23. : restore-here HERE$ DP ! ;
  24.  
  25. : mypatcher
  26. backup-here w->here
  27. iHEX,{ 03 00 00 00 05 00 00 00 }
  28. restore-here
  29. ;
  30.  
  31. mypatcher
  32. : .TEST2 10 0 ?DO w I + C@ . LOOP CR ;
  33.  
  34. .TEST2
  35.  
Success #stdin #stdout 0s 4300KB
stdin
Standard input is empty
stdout
3 0 0 0 5 0 0 0 5 0