: iHEX,{ ( "hex-byte hex-byte ... }" ) \ Add bytes in hex to dictionary
BASE @ >R HEX
\ Loop over input
BEGIN
0.
PARSE-NAME \ Read while parse area has content and not }
DUP IF 2DUP S" }" COMPARE
ELSE FALSE THEN
WHILE
\ Convert to number and add to dictionary
( 0 name-a name-u ) >NUMBER 2DROP D>S POSTPONE LITERAL POSTPONE C,
REPEAT
R> BASE !
2DROP 2DROP ; IMMEDIATE
CREATE w
0 VALUE HERE$
: backup-here HERE TO HERE$ ;
: w->here w DP ! ;
: restore-here HERE$ DP ! ;
: mypatcher
backup-here w->here
iHEX,{ 03 00 00 00 05 00 00 00 }
restore-here
;
mypatcher
: .TEST2 10 0 ?DO w I + C@ . LOOP CR ;
.TEST2
OiBpSEVYLHsgKCAiaGV4LWJ5dGUgaGV4LWJ5dGUgLi4uIH0iICkgXCBBZGQgYnl0ZXMgaW4gaGV4IHRvIGRpY3Rpb25hcnkKCUJBU0UgQCA+UiBIRVgKCVwgTG9vcCBvdmVyIGlucHV0CglCRUdJTgoJCTAuCgkJUEFSU0UtTkFNRSBcIFJlYWQgd2hpbGUgcGFyc2UgYXJlYSBoYXMgY29udGVudCBhbmQgbm90IH0KCQlEVVAgSUYgMkRVUCBTIiB9IiBDT01QQVJFCgkJICAgIEVMU0UgRkFMU0UgVEhFTgoJCVdISUxFCgkJXCBDb252ZXJ0IHRvIG51bWJlciBhbmQgYWRkIHRvIGRpY3Rpb25hcnkKCQkoIDAgbmFtZS1hIG5hbWUtdSApID5OVU1CRVIgIDJEUk9QIEQ+UyBQT1NUUE9ORSBMSVRFUkFMIFBPU1RQT05FIEMsCglSRVBFQVQKIAoJUj4gQkFTRSAhCiAKCTJEUk9QIDJEUk9QIDsgSU1NRURJQVRFCgpDUkVBVEUgdwoKMCBWQUxVRSBIRVJFJAo6IGJhY2t1cC1oZXJlIEhFUkUgVE8gSEVSRSQgOwo6IHctPmhlcmUgICAgdyBEUCAhIDsKOiByZXN0b3JlLWhlcmUgSEVSRSQgRFAgISA7Cgo6IG15cGF0Y2hlciAKICBiYWNrdXAtaGVyZSB3LT5oZXJlCiAgaUhFWCx7IDAzIDAwIDAwIDAwIDA1IDAwIDAwIDAwIH0KICByZXN0b3JlLWhlcmUKOwogCm15cGF0Y2hlcgo6IC5URVNUMiAxMCAwID9ETyB3IEkgKyBDQCAuIExPT1AgQ1IgOwoKLlRFU1QyCg==