: HEX,{ ( "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
.S CR
\ Convert to number and add to dictionary
( 0 name-a name-u ) >NUMBER 2DROP D>S C,
REPEAT
R> BASE !
2DROP 2DROP ;
: 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 LITERAL POSTPONE C,
REPEAT
R> BASE !
2DROP 2DROP ; IMMEDIATE
CREATE TEST
HEX,{ 00 20 30 40 50 10 20 30 10 20 }
HERE TEST - CONSTANT #TEST
: .TEST #TEST 0 ?DO TEST I + C@ . LOOP CR ;
.TEST
(
0 0 1D677A 2
0 0 1D677D 2
0 0 1D6780 2
0 0 1D6783 2
0 0 1D6786 2
0 0 1D6789 2
0 0 1D678C 2
0 0 1D678F 2
0 0 1D6792 2
0 0 1D6795 2
0 32 48 64 80 16 32 48 16 32
0 0 1D677A 2
0 0 1D677D 2
573754 01 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
)
CREATE w
HEX,{ 01 02 }
w 10 DUMP
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
(
0 0 1D677D 2
3
3 0 0 1D6780 2
3 0
3 0 0 0 1D6783 2
3 0 0
3 0 0 0 0 1D6786 2
3 0 0 0
3 0 0 0 0 0 1D6789 2
3 0 0 0 5
3 0 0 0 5 0 0 1D678C 2
3 0 0 0 5 0
3 0 0 0 5 0 0 0 1D678F 2
3 0 0 0 5 0 0
3 0 0 0 5 0 0 0 0 1D6792 2
3 0 0 0 5 0 0 0
EXCEPTION! CODE:C0000005 ADDRESS:00566828 WORD: EXC:-1073741819 <?WordByAddr
exception>
USER DATA: 001D07D4 THREAD ID: 00001AC0 HANDLER: 0012EEFC
STACK: (5) 7FFD7000 75ABEF6C 001D6774 00000001 001D6774 00000001 [37452445]
RETURN STACK:
0012EED4 : 0056695F EXC:-1073741819
0012EED8 : 00566991 EXC:-1073741819
0012EEDC : 00566A72 EXC:-1073741819
0012EEE0 : 80000001 EXC:-1073741819
0012EEE4 : 7FE2DA41 EXC:-1073741819
0012EEE8 : 00566AC0 EXC:-1073741819
0012EEEC : 00567C26 EXC:-1073741819
0012EEF0 : 00567CE2 EXC:-1073741819
0012EEF4 : 00568371 EXC:-1073741819
0012EEF8 : 0055516C EXC:-1073741819
0012EEFC : 0012EF3C EXC:-1073741819
0012EF00 : 0012FF88 EXC:-1073741819
0012EF04 : 0056819B EXC:-1073741819
0012EF08 : 001D6774 EXC:-1073741819
0012EF0C : 00000006 EXC:-1073741819
0012EF10 : 00000000 EXC:-1073741819
0012EF14 : 00000005 EXC:-1073741819
0012EF18 : 001F1F55 EXC:-1073741819
0012EF1C : 00000005 EXC:-1073741819
0012EF20 : FFFFFFFF EXC:-1073741819
0012EF24 : 00000000 EXC:-1073741819
0012EF28 : 005681EF EXC:-1073741819
0012EF2C : 005683AF EXC:-1073741819
0012EF30 : 0000001C EXC:-1073741819
[...]
0012EF68 : 0012FF80 EXC:-1073741819
0012EF6C : 00567A79 EXC:-1073741819
0012EF70 : 00000004 EXC:-1073741819
0012EF74 : 001F1F56 EXC:-1073741819
0012EF78 : 00567C88 EXC:-1073741819
0012EF7C : 00567CE2 EXC:-1073741819
0012EF80 : 0055516C EXC:-1073741819
0012EF84 : 0012EF94 EXC:-1073741819
0012EF88 : 0012FF88 EXC:-1073741819
0012EF8C : 0056BA34 EXC:-1073741819
0012EF90 : 0055516C EXC:-1073741819
0012EF94 : 0012EFC4 EXC:-1073741819
0012EF98 : 0012FF88 EXC:-1073741819
0012EF9C : 0056807D EXC:-1073741819
0012EFA0 : 00000006 EXC:-1073741819
0012EFA4 : 00000000 EXC:-1073741819
END OF EXCEPTION REPORT
Exception #-1073741819 at: tm.f:61:2:
w 10 DUMP
^ 0xC0000005L ACCESS_VIOLATION
)