\ �������������� �����������������        �������� �.�.

[UNDEFINED] C>S
[IF]
: C>S ( c -- n )  0xFF AND [ 0x7F INVERT ] LITERAL XOR 0x80 + ;
[THEN]

[UNDEFINED] QCMOVE
[IF]
: QCMOVE CMOVE ;
[THEN]

BASE @ HEX

\ : REL! ( ADDR' ADDR  --  )
\        TUCK - SWAP ! ;

: REL@ ( ADDR -- ADDR' )
         DUP @ + ;

  FALSE VALUE OPT?
\   TRUE VALUE OPT?

  084 VALUE J_COD

: SET-OPT TRUE TO OPT? ;

: DIS-OPT FALSE TO OPT? ;

INLINEVAR
[IF]
0x20 VALUE MM_SIZE

0 VALUE OFF-EBP

0 VALUE OFF-EAX

0 VALUE :-SET

0 VALUE J-SET

0 VALUE LAST-HERE

0x44 CELLS DUP CONSTANT OpBuffSize

CREATE OP0 HERE >T DUP , 0 , SWAP ALLOT

DUP OpBuffSize + CELL- CONSTANT OPLast

CELL+ DUP CONSTANT OP1
CELL+ DUP CONSTANT OP2
CELL+ DUP CONSTANT OP3
CELL+ DUP CONSTANT OP4
CELL+ DUP CONSTANT OP5
CELL+ DUP CONSTANT OP6
CELL+ DUP CONSTANT OP7
CELL+ DUP CONSTANT OP8

DROP

: SetOP ( -- )
 OP0 OP1 OpBuffSize CELL- CMOVE>
 DP @ OP0 !
;

: ToOP0 ( OPn -- )
     OP0 OpBuffSize CELL- QCMOVE ;

0x11 CELLS DUP CONSTANT JpBuffSize

CREATE JP0 HERE DUP , OVER ALLOT


DUP ROT ERASE 

CELL+ DUP CONSTANT JP1


CELL+ DUP CONSTANT JP2


CELL+ DUP CONSTANT JP3


CELL+ DUP CONSTANT JP4

DROP

[THEN]

: ClearJpBuff JP0 JpBuffSize ERASE ;

:  J@ 1+   REL@    CELL+ ;

: SJ@ 1+ DUP C@ C>S + 1+ ;

: J_@
        DUP C@ F0 
           AND 70 = IF   SJ@ ELSE
        DUP C@ EB = IF   SJ@ ELSE
        DUP C@ E9 = IF    J@ ELSE
        DUP W@ F0FF
         AND 800F = IF 1+ J@ ELSE
        HEX U. 1 ." J_@ ERR" ABORT
        THEN  THEN THEN THEN  
;

: SetJP ( -- )
 JP0 JpBuffSize + CELL- @  DUP         
 IF J_@
 THEN
\  DP @ UMIN 
 J-SET UMAX TO J-SET
 JP0 JP1 JpBuffSize CELL- CMOVE>
 DP @ JP0 ! ;

\ : ToJP0 ( OPn -- )
\     JP0 JpBuffSize CELL- QCMOVE
\ JP0 JpBuffSize + CELL- 0!  ;

: ?SET DP @
       DUP LAST-HERE <> IF DUP TO :-SET DUP TO J-SET THEN
       DUP    OP0 @ U< IF OP0 0! THEN
       DUP    OP1 @ U< IF OP1 0! THEN
       DUP    JP0 @ U< IF JP0 0! THEN
              JP1 @ U< IF JP1 0! THEN
;

: SHORT? ( n -- -129 < n < 128 )
  0x80 + 0x100 U<
;

M\ VECT DTST

: EVEN-EAX OFF-EAX
   IF      M\ 1000 DTST
 SetOP OFF-EAX DUP SHORT?  
     IF    0408D W, C, 
     ELSE  0808D W,  ,
     THEN   \  LEA   EAX,  OFF-EBP [EAX]
     0 TO OFF-EAX
       M\ 1001 DTST
   THEN
;

0 VALUE ?48C,

: 48C -1 TO ?48C, ;
: 48COFF 0 TO ?48C, ;

0 VALUE CC?
: CC?ON -1 TO CC? ; IMMEDIATE
: CC?OFF 0 TO CC? ; IMMEDIATE

: EVEN-EBP OFF-EBP 
     CC? IF ." EBP=" OFF-EBP H. THEN    
   IF
\     CC? IF ." EBP=" OFF-EBP H. THEN    
    SetOP  OFF-EBP  ?48C, IF  48 C, THEN
    06D8D W, C, \   LEA   ebp,  OFF-EBP [EBP]
      0 TO OFF-EBP
   THEN
;

: +>OFF-EBP ( C -- )
   C>S OFF-EBP + TO OFF-EBP ;

: ADD|XOR|OR|AND=  ( W -- FLAG )
   CASE
  DUP 4503 <> IF   \ ADD EAX, X2 [EBP]
  DUP 450B <> IF   \  OR
  DUP 4523 <> IF   \ AND
  DUP 4533 <> IF   \ XOR
             DROP FALSE EXIT
  DUPENDCASE DROP TRUE ;

: DUP3B?[EBP]  ( W -- W FLAG )
   CASE
  DUP 0E7C4 AND 04500 <> IF      \ 010X.X101 00XX.X0XX
\ ADD|OR|ADC|SBB|AND|SUB|XOR|CMP  _L | E_X | X [EBP]  , _L | E_X | X [EBP]

  DUP  E7FD AND  4589 <> IF  \ 010X.X101 1000.10X1
\ MOV  X [EBP], E(ABCD)X | E(ABCD)X , X [EBP]
\   DUP           5503 <> IF \ ADD   EDX , 0 [EBP]

  DUP  EFFF AND  6DDB <> IF  \ FLD | FSTP     EXTENDED 0 [EBP]

  DUP            45DB <> IF  \ FILD DWORD FC [EBP]
  DUP            65F7 <> IF  \  MUL  X [EBP]
  DUP            6DF7 <> IF  \ IMUL  X [EBP]
  DUP           04587 <> IF  \ XCHG EAX , X [EBP]
             FALSE EXIT
  DUPENDCASE TRUE ;

: DUP3B?      ( W -- W FLAG )
   CASE
\  11XX.X000 1000.0011
   DUP C7FF AND  C083 <> IF \ ADD|OR|ADC|SBB|AND|SUB|XOR|CMP  EAX, # X
   DUP          0478B <> IF \ MOV  EAX, X [EDI]
   DUP          0588B <> IF \ MOV  EBX, X [EAX]
   DUP          0508B <> IF \ MOV  EDX, X [EAX]


   DUP          0588D <> IF \ LEA  EBX, X [EAX]
   DUP          0508D <> IF \ LEA  EDX, X [EAX]
   DUP          05089 <> IF \ MOV X [EAX], EDX

   DUP          0F8C1 <> IF \ SAR  EAX, # X
   DUP          0E0C1 <> IF \ SHL  EAX, # X

   DUP          0E8C1 <> IF \ SHR  EAX, # X
   DUP          0408D <> IF \ LEA  EAX , X [EAX]
   DUP          0408B <> IF \ MOV  EAX , X [EAX]
             FALSE EXIT
  DUPENDCASE TRUE ;

: DUP2B?      ( W -- W FLAG )
   CASE
  DUP 0E4C5 AND 0C001 <> IF
\ ADD|OR|ADC|SBB|AND|SUB|XOR|CMP  E_X , E_X

\  DUP           01801 <> IF  \ ADD  [EAX], EBX 
 
  DUP           01001 <> IF  \ ADD  [EAX], EDX 
  DUP            0003 <> IF  \ ADD  EAX, [EAX]

  DUP 0C0FF AND  C085 <> IF \ TEST E__ , E__

\ 110X.X0XX  1000.10X1   
  DUP 0E4FC AND 0C088 <> IF \  MOV    E(ABCD)X , E(ABCD)X | (ABCD)L , (ABCD)L

\ 00XX.X0XX  1000.100X

  DUP 0C4FE AND 00088 <> IF \  MOV  [E(ABCD)X] , E(ABCD)X | (ABCD)(HL)
  DUP           0008B <> IF \ MOV EAX, [EAX]
  DUP            028B <> IF \ MOV EAX, [EDX]
  DUP            188B <> IF \ MOV EBX, [EAX]
  DUP           0C78B <> IF \ MOV EAX,  EDI
  DUP           0F88B <> IF \ MOV EDI,  EAX
  DUP           0C88B <> IF \ MOV ECX , EAX 
  DUP           0D18B <> IF \ MOV EDX , ECX 
\ 111X.X0XX  1101.00XX
  DUP 0E4FC AND 0E0D0 <> IF \  S(AH)(LR)  (ABCD)L | E(ABCD)X,  CL | 1
  DUP           0C0DD <> IF \ FFREE ST

  DUP  F0FF AND  C0D9 <> IF \  FLD     ST(X)  | FXCH    ST(X)
\     1100.XXXX.1101.1001

  DUP  FAFF AND  E0D9 <> IF \  FCHS|FABS|FTST|FXAM
\     1110.0X0X.1101.1001
  DUP  E8FF AND  E8D9 <> IF \ FLD1 FLDL2T FLDL2E FLDPI FLDLG2 FLDLN2 FLDZ ???
\     1110.1XXX.1101.1001

  DUP  F0FF AND  F0D9 <> IF   \ F2XM1 FYL2X FPTAN FPATAN
\     1111.XXXX.1101.1001    \ FXTRACT FPREM1  FDECSTP FINCSTP
                             \ FPREM   FYL2XP1 FSQRT   FSINCOS
                             \ FRNDINT FSCALE  FSIN    FCOS
  DUP  E8FF AND  20DB <> IF \  FLD     EXTENDED [E_X]  | FST  EXTENDED [E_X]
\   001X.0XXX.1101.1011

  DUP  E8FF AND  00DD <> IF \  FLD    DOUBLE [E_X]  | FST  DOUBLE [E_X]
\   000X.0XXX.1101.1101

  DUP  F0FF AND  C0DE <> IF \  FADDP   ST(X) | FMULP   ST(X)
  DUP  E0FF AND  E0DE <> IF \  FSUBRP  ST(X) | FSUBP   ST(X)
\     111X.XXXX.1101.1110  \  FDIVRP  ST(X) | FDIVP   ST(X)

  DUP            00FF <> IF \ INC [EAX]
\   DUP 0C0FF <> IF \ INC  EAX
\   DUP 0C3FF <> IF \ INC  EBX
\   DUP 0C8FF <> IF \ DEC  EAX
  DUP           0D0F7 <> IF \ NOT EAX
  DUP           0D1F7 <> IF \ NOT ECX
  DUP           0D8F7 <> IF \ NEG EAX
  DUP           0D9F7 <> IF \ NEG ECX 
  DUP           0DAF7 <> IF \ NEG EDX
  DUP           0E9F7 <> IF \ IMUL ECX
  DUP           0F1F7 <> IF \  DIV ECX
  DUP           0F9F7 <> IF \ IDIV ECX
             FALSE EXIT
  DUPENDCASE TRUE ;

: DUP6B?      ( W -- W FLAG )
   CASE
\ X00X.X101 1000.10X1
  DUP   67FD AND 0589 <> IF  \ MOV X {[EBP]}, E(ACDB)X | E(ACDB)X , X {[EBP]}

  DUP   C3FF AND C081 <> IF \ ADD|OR|ADC|SBB|AND|SUB|XOR|CMP  EAX, # X

  DUP           00501 <> IF    \ ADD  X , EAX
  DUP            0503 <> IF \ ADD  EAX,  X 
  DUP            053B <> IF \ CMP  EAX,  X
  DUP            873B <> IF \ CMP  EAX,  X [EDI]
  DUP            F281 <> IF \ XOR  EDX , # 80000000
  DUP            928D <> IF \ LEA  EDX , [EDX+80000000H]

\  DUP   0589 <> IF \ MOV X , EAX
\  DUP   058B <> IF \ MOV EAX,  X
  DUP            808B <> IF \ MOV EAX, X [EAX]
  DUP            808D <> IF \ LEA EAX, X [EAX]
  DUP            8703 <> IF \ MOV EAX, X [EDI]

  DUP            878B <> IF \ MOV EAX, X [EDI]
  DUP            878D <> IF \ LEA EAX, X [EDI]
  DUP             0C7 <> IF \ MOV [EAX], # X
  DUP            05FF <> IF \ INC X

\  DUP  FCFF AND C0C7 <> IF \ MOV EAX|EBX|ECX|EDX, # X
             FALSE EXIT
  DUPENDCASE TRUE ;

: DUP5B?      ( C -- C FLAG )


  DUP   0C7 AND   5 =    \  ADD|OR|ADC|SBB|AND|SUB|XOR|CMP  EAX, # X
  OVER  0FC AND 0B8 = OR \  MOV EAX|EBX|ECX|EDX, # X
  OVER  0FD AND 0A1 = OR \  MOV EAX, X  | X , EAX
;

: DUP7B?      ( N -- N FLAG )
\ XX00.0101 0000.0100 1000.10X1
  DUP  3FFFFD AND 050489 =    \  MOV   X [EAX*_] , EAX  | MOV EAX , X [EAX*_]
\ XX00.0101 0000.0100 1000.1X01
  OVER 3FFFFB AND 050489 = OR \  MOV   X [EAX*_] , EAX  | LEA EAX , X [EAX*_]

;

 0 VALUE TTTT

\ 0 VALUE ZZZZ \ VECT VVV 

: ?ChEAX  ( ADDR --  FALSE | TRUE )
   CASE
   DUP C@
   DUP       B8 <> IF   \  MOV  EAX, # X 
   DUP       A1 <> IF   \  MOV  EAX,   X 
   DROP
   DUP W@
\   DUP ADD|XOR|OR|AND= 0= IF
   DUP     C033 <> IF   \  XOR  EAX, EAX
   DUP     C031 <> IF   \  XOR  EAX, EAX
   DUP     D889 <> IF   \  MOV  EAX, EBX

   38FF AND
   DUP  008B <> IF   \  MOV  EAX, ___
   DUP  008D <> IF   \  LEA  EAX, ___
             2DROP TRUE EXIT
  DUPENDCASE 2DROP FALSE ;

: ^?EAX=  ( ADDR --  FALSE | TRUE )
\ FALSE 
   DUP ?ChEAX IF DROP TRUE EXIT THEN
   DUP W@
   DUP  00F9
   AND  0089 <> IF 2DROP FALSE EXIT THEN
\ LEA MOV
   CASE
   FF00 AND
   DUP 0100 AND
       0100 <> IF   \  MOV  EAX, 

   DUP  C200 <> IF   \  MOV  EAX, EDX
   DUP  D800 <> IF   \  MOV  EAX, EBX
   DROP
   DUP @ FFFF00 AND

   DUP   240400 <> IF   \  MOV  EAX,   [ESP]
   DUP   244400 <> IF   \  MOV  EAX, X [ESP]
   DUP   95048B <> IF   \ 8B0495F0065A00        MOV     EAX , 5A06F0 [EDX*4]
             2DROP TRUE EXIT
  DUPENDCASE 2DROP FALSE ;

\   DUP   8B00 =     \  MOV  EAX, [EAX]

: OP_SIZE ( OP - n )
  DUP IF THEN  DUP CELL- @ SWAP @ -
;

: OPexcise ( OPX -- )
      DUP OP0 = IF @ DP ! OP1 ToOP0 EXIT THEN
      >R
      R@ CELL- @ R@ @  DP @ R@ CELL- @ - CMOVE

      R@ OP_SIZE NEGATE
      R@ OP0 DO DUP I +! CELL +LOOP 
      ALLOT      
      R@ CELL+ R@ OpBuffSize CELL- R> - OP0 + QCMOVE
;
: ?OPlast  ( OPX -- OPX flag )
     DUP OP0 OpBuffSize + CELL- CELL- U> ;

: XX_STEP ( OPX -- OPX+CELL FALSE | { OPX | FALSE } TRUE )
\ �������� �� �� ���������  EAX
     ?OPlast
     IF DROP FALSE TRUE EXIT THEN
     DUP @
     DUP  :-SET U< IF 2DROP FALSE TRUE EXIT THEN
     C@ 
   CASE
     DUP 3D <> IF   \ CMP EAX, # X
     DUP 3B <> IF   \ CMP E_X , X
     DUP A3 <> IF   \ MOV X , EAX
     DUP B9 <> IF   \ MOV ECX , # X
     DUP BA <> IF   \ MOV EDX , # X
     DUP BB <> IF   \ MOV EBX , # X
     DUP 50 <> IF   \ PUSH EAX
     DROP
     DUP @ W@
     DUP 04FF AND 04C7 <> IF \ MOV 4444 , # 5555
     DUP 40FE AND 0088 <> IF \ MOV   [EAX] , DL 
     DUP 4D89 <> IF \ MOV 4 [EBP] , ECX 
     DUP 558B <> IF \ MOV EDX , FC [EBP]
     DUP 4C8B <> IF \ MOV ECX , FC [E__] [E__] 
     DUP 648D <> IF \ LEA  ESP , 8 [ESP] 
     DUP 34FF AND 04FF <> IF \ INC 0 [ESP]
     DUP C00B <> IF \ OR  EAX, EAX
     DUP D00B <> IF \ OR  EDX, EAX
     DUP D02B <> IF \ SUB EDX, EAX
   DUP 0401 <> IF \ ADD [E_X] 
     DUP 06FD  \ CMP X [EBP], # Z   \ CMP 44444, # 55555
     AND 0481 <> IF
     DUP FFFD
     AND 4589 = 
       IF   OVER @ 2+ C@ OP0 @  2+ C@ =
         IF  DROP TRUE 
             EXIT
         THEN
         458B = IF DROP FALSE TRUE EXIT THEN
             CELL+ FALSE EXIT
       THEN
     2DROP
     FALSE TRUE EXIT
  DUPENDCASE  DROP CELL+ FALSE ;

: ?EDX_[EBP]   ( OPX -  FLAG )
  DUP @   @ FFFFFF AND 
  DUP  24048B =  \  8B0424		MOV     EAX , [ESP] 
        IF 2DROP FALSE EXIT THEN
  FFFF AND

  DUP  458B XOR     \  8B4500	      MOV     EAX , 0 [EBP] 
  OVER 4589 XOR OR  \ OPX N F MOV     FC [EBP] , EAX 
0=      IF DROP 
            @ 2+ C@ OP0 @ 2+ C@ =
            EXIT
        THEN
  NIP
  DUP  ADD|XOR|OR|AND=
        IF DROP FALSE EXIT THEN
  DUP  E8C1  =   \  C1E819            SHR     EAX , 19
        IF DROP FALSE EXIT THEN
  DUP  418D  =   \  8D41FF            LEA     EAX , FF [ECX]
        IF DROP FALSE EXIT THEN
  DUP  408D  =   \  8D40FF            LEA     EAX , FF [EAX]
        IF DROP FALSE EXIT THEN
  DUP  878D  =   \  8D873C100000      LEA     EAX , 103C [EDI]
        IF DROP FALSE EXIT THEN
  DUP  D0F7  =   \  F7D0	      NOT     EAX 
        IF DROP FALSE EXIT THEN
  DUP  D8F7  =   \  F7D8	      NEG     EAX 
        IF DROP FALSE EXIT THEN
  DUP  C123  =   \  23C1              AND     EAX , ECX
        IF DROP FALSE EXIT THEN

  DUP  C033  =    \       XOR     EAX , EAX   
        IF DROP FALSE EXIT THEN

  DUP  808D  =   \  8D8024475A00	LEA     EAX , 5A4724  [EAX] 
        IF DROP FALSE EXIT THEN
       		
  DUP  088B  =   \  MOV     ECX , [EAX] 
        IF DROP FALSE EXIT THEN

  DUP  C00B  =   \  0BC0         OR      EAX , EAX
        IF DROP FALSE EXIT THEN

  DUP  488D  =   \ 8D4820		LEA     ECX , 20 [EAX] 
        IF DROP FALSE EXIT THEN

  DUP  E0D3  =   \ D3E0           SHL     EAX , CL
        IF DROP FALSE EXIT THEN

  FF AND
  DUP  A1    =  \  A1047A5800        MOV     EAX , 587A04
        IF DROP FALSE EXIT THEN
  DUP  58    =  \        58         POP     EAX
        IF DROP FALSE EXIT THEN
  DUP  B9    =  \  B907000000 MOV    ECX , # 7
        IF DROP FALSE EXIT THEN
  DROP TRUE
;

: MOV_EDX_[EBP]  ( OPX - OPX' FALSE | FLAG TRUE )
        ?OPlast  IF DROP FALSE TRUE EXIT THEN
  DUP @ :-SET U< IF DROP FALSE TRUE EXIT THEN
  DUP @ ?ChEAX 0= IF CELL+ FALSE EXIT THEN
  DUP  ?EDX_[EBP] 0= IF CELL+ FALSE EXIT THEN
  DUP @ W@
  
  DUP 448B =              \ MOV     EAX , 4 [EDX] [EAX*4] 
        IF DROP CELL+ FALSE EXIT THEN

  DUP 1489 =              \ MOV     59C2E4 [EAX*4] , EDX 
        IF DROP CELL+ FALSE EXIT THEN
  DUP 8BCA =              \ MOV     ECX , EDX 
        IF DROP CELL+ FALSE EXIT THEN  
  DUP FFFD AND 5589 =              \ OPX N F
        IF DROP @ 2+ C@  OP0 @ 2+ C@ = TRUE EXIT
        THEN
  2DROP FALSE  TRUE
;

: OPresize ( OPX n -- )
  DUP >R
  OVER OP0 ?DO DUP I +! CELL +LOOP 
  ALLOT
  @ DUP  R> +  DUP DP @ - NEGATE MOVE
;

: OPinsert ( OPX n -- )
  DUP >R
  2DUP OPresize DROP
  DUP 
  DUP CELL + OVER OP0
  [ HERE DROP ]
  -  OpBuffSize CELL- - NEGATE MOVE
  R> SWAP +!
;

VARIABLE ?~EAX
VARIABLE SAVE-?~EAX
: ?~EAX{ ( FLAG -- )
 ?~EAX @  SAVE-?~EAX ! ?~EAX ! ;

: }?~EAX (  -- )
   SAVE-?~EAX @ ?~EAX ! ;


: EAX>EBX0  ( OPX - OPX' FLAG )


  DUP OP0 = IF  TRUE EXIT THEN
  DUP @ W@

  DUP 508B =  \ MOV     EDX , [EAX+4] 
        IF DROP CELL- FALSE EXIT THEN
  DUP 088B = \ 	MOV     ECX , [EAX] 
        IF DROP CELL- FALSE EXIT THEN
  DUP 098B = \ 	MOV     ECX , [ECX] 
        IF DROP CELL- FALSE EXIT THEN
  DUP 4D8B = \ 	MOV     ECX , [EBP] 
        IF DROP CELL- FALSE EXIT THEN
  DUP 5589 = \  MOV     0 [EBP] , EDX 
        IF DROP CELL- FALSE EXIT THEN
  DUP C88B = \ 	MOV     ECX , EAX
        IF DROP CELL- FALSE EXIT THEN
  DUP 0889 = \ 	MOV     [EAX] , ECX 
        IF DROP CELL- FALSE EXIT THEN
  DUP 1089 = \ 	MOV     [EAX] , EDX 
        IF DROP CELL- FALSE EXIT THEN
  DUP 4889 = \ 	MOV     4 [EAX] , ECX 
        IF DROP CELL- FALSE EXIT THEN
  DUP 408D =              \ LEA     EAX , 1 [EAX] 
        IF DROP
           58 OVER @ 1+ C!  CELL- TRUE EXIT
        THEN

  DUP 808D =              \ LEA     EAX , 1 [EAX] 
        IF DROP
           98 OVER @ 1+ C!  CELL- TRUE EXIT
        THEN
  DUP 008B =     \ MOV     EAX , [EAX] 
        IF DROP
           18  OVER @ 1+ C!  CELL- TRUE EXIT
        THEN

  DUP C18B =     \ MOV     EAX , ECX 
        IF DROP
           D9  OVER @ 1+ C!  CELL- TRUE EXIT
        THEN

  DUP 458B =       \ MOV     EAX , [EBP+X] 
        IF DROP
           5D  OVER @ 1+ C!  CELL- TRUE EXIT
        THEN

  DROP
  DUP @ @  FFFFFF AND

  DUP 8D0489 =     \ MOV     X [ECX*4] , EAX 
        IF DROP CELL- FALSE EXIT THEN

  DUP 24048B =              \ MOV     EAX , [ESP] 
        IF DROP
           1C OVER @ 1+ C!  CELL- TRUE EXIT
        THEN
  DUP 240C8B =              \ MOV     ECX , [ESP] 
        IF DROP CELL- FALSE EXIT THEN
\ BASE @ >R HEX DUP U. R> BASE !
  FF AND
  DUP   3B =       \ CMP
        IF DROP CELL- FALSE EXIT THEN
 HEX  U. U. ." EAX>EBX0" ABORT
;

: EAX>EBX  ( OPX - OPX' FLAG )


  DUP OP0 = IF  TRUE EXIT THEN
  DUP @ W@ \ ." #=" DUP U.

  DUP 508B =     \ MOV     EDX , [EAX+4] 
        IF DROP
           53  OVER @ 1+ C!  CELL- FALSE EXIT
        THEN

  DUP 083B = \ 	CMP     ECX , [EAX] 
        IF DROP
           0B  OVER @ 1+ W!  CELL- FALSE EXIT
        THEN

  DUP C83B = \ 	CMP     ECX , EAX 
        IF DROP
           CB  OVER @ 1+ W!  CELL- FALSE EXIT
        THEN

  DUP C13B = \ 	CMP     EAX , ECX 
        IF DROP
           D9  OVER @ 1+ W!  CELL- FALSE EXIT
        THEN

  DUP 088B = \ 	MOV     ECX , [EAX] 
        IF DROP
           0B  OVER @ 1+ C!  CELL- FALSE EXIT
        THEN
  DUP 458B =       \ MOV     EAX , [EBP+X] 
        IF DROP
           5D  OVER @ 1+ C!  CELL- FALSE EXIT
        THEN
  DUP 098B = \ 	MOV     ECX , [ECX] 
        IF DROP CELL- FALSE EXIT THEN

  DUP 4D8B = \ 	MOV     ECX , [EBP] 
        IF DROP CELL- FALSE EXIT THEN

  DUP 5589 = \  MOV     0 [EBP] , EDX 
        IF DROP CELL- FALSE EXIT THEN

  DUP C88B = \ 	MOV     ECX , EAX
        IF DROP
           CB  OVER @ 1+ C!  CELL- FALSE EXIT
        THEN

  DUP 0889 = \ 	MOV     [EAX] , ECX 
        IF DROP
           0B  OVER @ 1+ C!  CELL- FALSE EXIT
        THEN

  DUP 1089 = \ 	MOV     [EAX] , EDX 
        IF DROP
           13  OVER @ 1+ C!  CELL- FALSE EXIT
        THEN
  DUP 4889 = \ 	MOV     4 [EAX] , ECX 
        IF DROP
           4B  OVER @ 1+ C!  CELL- FALSE EXIT
        THEN
  DUP 4589 =     \ OPX N F  MOV     FC [EBP] , EAX 
        IF DROP
           5D OVER @ 1+ C!  CELL- FALSE EXIT
        THEN
  DUP 408D =              \ LEA     EAX , 1 [EAX] 
        IF DROP
           5B OVER @ 1+ C!  CELL- FALSE EXIT
        THEN

  DUP 808D =              \ LEA     EAX , X [EAX] 
        IF DROP
           9B OVER @ 1+ C!  CELL- FALSE EXIT
        THEN
  DUP 008B =     \ MOV     EAX , [EAX] 
        IF DROP
           1B OVER @ 1+ C!  CELL- FALSE EXIT
        THEN

  DUP C18B =     \ MOV     EAX , ECX 
        IF DROP
           D9  OVER @ 1+ C!  CELL- FALSE EXIT
        THEN


  DUP D8F7 =       \ NEG     EAX 
        IF DROP
           DB OVER @ 1+ C!  CELL- FALSE EXIT
        THEN

  DROP
  DUP @ @  FFFFFF AND

  DUP 8D0489 =     \ MOV     X [ECX*4] , EAX 
        IF DROP
           1C OVER @ 1+ C!  CELL-  FALSE EXIT
        THEN

  DUP 24048B =              \ MOV     EAX , [ESP] 
        IF DROP
           1C OVER @ 1+ C!  CELL-  FALSE EXIT
        THEN
  DUP 240C8B =              \ MOV     ECX , [ESP] 
        IF DROP CELL- FALSE EXIT THEN
  DUP 24442B =        \ SUB     EAX , [ESP+4] 
        IF DROP
           5C OVER @ 1+ C!  CELL- FALSE EXIT
        THEN

HEX  U. U. ." EAX>EBX" ABORT
;


M\  VARIABLE VPPP : PPPP DUP VPPP @ <> IF 0 @ THEN ;

TRUE VALUE  ~BR-OPT

\ : SSSSSS ;
\ TRUE VALUE ?C-JMP
 FALSE VALUE ?C-JMP

\ $ - ���ޖ��ș �� ������ܙ ۣ������� ��ߣ��, �љ����۳��ؖ�
\ ���ܖ� �ș����

: OPT-RULES  ( ADDR  -- ADDR' FLAG )
 TRUE
;

: -EVEN-EBP
     OP0 @ :-SET U< IF EXIT THEN
     OP0 @ @ FFFFFF AND 06D8D48 =  \  LEA   ebp,  OFF-EBP [EBP]
     IF  OP0 @ 2+ C@ +>OFF-EBP
         OP1 ToOP0
        -3 ALLOT EXIT
     THEN ;

: OPT_  ( -- )
  BEGIN
\   M\ -D DTST
 OPT-RULES UNTIL
\   M\ -F DTST
  EVEN-EAX  ;

: DO_OPT   ( ADDR -- ADDR' )
  OPT? IF OPT_ THEN ;

: INLINE?  ( CFA -- CFA FLAG )
  DUP         BEGIN
  2DUP
  MM_SIZE -   U> 0= IF  DROP FALSE  EXIT THEN
  DUP C@      \  CFA CFA+OFF N'
  DUP   0C3    = IF 2DROP  TRUE EXIT THEN  \ RET
  DUP5B?         M_WL DROP 5 + REPEAT
\ 0100.X0XX
  DUP   0F4
  AND    40    = M_WL DROP 1+  REPEAT \ INC|DEC  E(ACDB)X

  DUP   099    = M_WL DROP 1+  REPEAT  \ CDQ
\ 1110.11XX
OS\ DUP FC
OS\ AND EC    = M_WL DROP 1+  REPEAT  \ IN|OUT  EAX AL, DX | DX, EAX EL
  DROP
  DUP W@      \  CFA CFA+OFF N'

  DUP3B?[EBP]    M_WL DROP 3 +  REPEAT
  DUP3B?         M_WL DROP 3 +  REPEAT
  DUP 06D8D    = M_WL DROP 3 +  REPEAT \ LEA  EBP, OFF-EBP [EBP]
  DUP 0C583    = M_WL DROP 3 +  REPEAT \ ADD  EBP, # OFF-EBP
  DUP 0ED83    = M_WL DROP 3 +  REPEAT \ SUB  EBP, # X
  DUP2B?         M_WL DROP 2+   REPEAT
  DUP  C58B    = M_WL DROP 2+   REPEAT \ MOV EAX,  EBP

\  DUP 0E3FF   = M_WL DROP 2+   REPEAT   \ JMP  EBX
  DUP6B?         M_WL DROP 6 +  REPEAT
  DUP 45C7  =   M_WL  DROP 7 +  REPEAT  \ MOV     X [EBP] , # X

  DROP
  DUP @
  DUP 0424448B = M_WL DROP 4 + REPEAT
  DUP 0424448D = M_WL DROP 4 + REPEAT
  DUP 8BE08B5B =
   IF OVER 3 + 2@         \ 1 TO TTTT
            E3FF046D 8D00458B  D=   \ RP!  
           IF 2DROP TRUE EXIT THEN
   THEN  
  FFFFFF AND
  DUP   C09D0F = M_WL DROP 3 + REPEAT \ SETGE  AL
  DUP   C09E0F = M_WL DROP 3 + REPEAT \ SETLE  AL
  DUP   90048D = M_WL DROP 3 + REPEAT \ LEA  EAX , [EAX] [EDX*4] 
  DUP   02048D = M_WL DROP 3 + REPEAT \ LEA  EAX, [EDX] [EAX] 

\ CMPXCHG [EAX] , AL| EAX
\ LSS     EAX , [EAX]
\ BTR     [EAX] , EAX
\ LFS     EAX , [EAX]
\ LGS     EAX , [EAX]
\ MOVZX   EAX , BYTE|WORD  PTR [EAX]
\ 0000.0000 1011.1XXX 0000.1111
  DUP FFF8FF 
  AND 00B00F = M_WL DROP 3 + REPEAT \ MOVZX  EAX, WORD PTR [EAX]

  DUP 20488B = M_WL DROP 3 +  REPEAT \ MOV  ECX , [EAX+20H]
  DUP 20488D = M_WL DROP 3 +  REPEAT \ LEA  ECX , [EAX+20H]

  DUP 85448B = M_WL DROP 4 + REPEAT \ MOV    EAX, X [EBP] [EAX*4]
  DUP 02048D = M_WL DROP 4 + REPEAT \ LEA     EAX , [EDX] [EAX] 
\ XX00.0101 0000.0100 1000.1XX1
  DUP7B?       WHILE DROP 7 + REPEAT
 2DROP  FALSE
;

: MACRO? INLINE? ;

\  �����������������

: CC,  CC? IF ." C=" DUP H. THEN C, ;
: WW,  CC? IF ." W=" DUP H. THEN W, ;
: SS,  CC? IF ." S=" DUP H. THEN  , ;

: +EBP DUP C@ C>S OFF-EBP + CC,    1+ ;

: 1_,_STEP SetOP DROP DUP C@ CC,    1+ ;

: 2_,_STEP SetOP DROP DUP W@ WW,    2+ ;

: 3_,_STEP  2_,_STEP DUP C@ CC,    1+ ;

: 4_,_STEP_           DUP @  SS, CELL+ ;

: 4_,_STEP SetOP DROP 4_,_STEP_ ;

: 5_,_STEP  1_,_STEP 4_,_STEP_ ;

: 6_,_STEP  2_,_STEP 4_,_STEP_ ;

: 7_,_STEP  3_,_STEP 4_,_STEP_ ;

: 1A_,_STEP 1_,_STEP DUP @ + DP @ - SS, CELL+ ;

: 2A_,_STEP 2_,_STEP DUP @ + DP @ - SS, CELL+ ;

: _INLINE,  (  CFA  --  )
\  ." ^" DUP H.
              BEGIN
  DO_OPT

   DUP @      \  CFA  N'
   CC? IF ." D=" DUP H. THEN
  DUP 8BE08B5B = DUP
  IF DROP OVER 3 + 2@ E3FF046D 8D00458B  D=  \ RP!  
  THEN          M_WL DROP   SetOP
                    8B C, E0 C,          \  MOV  ESP,    EAX
                    DROP 'DROP
                 REPEAT
  FF AND      \  CFA  N'
  DUP   0C3 = IF 2DROP     EXIT THEN  \ RET

  DUP5B?      M_WL  5_,_STEP  REPEAT \ ADD EAX, # X

\ 010X.XXXX
  DUP E0 AND 40 = M_WL 1_,_STEP REPEAT  \ INC|DEC|PUSH|POP  E_X

\ FS: GS: D16: A16: INSB INSD OUTSB OUTSD
\ 0110.X1XX
  DUP   F4 AND 64 = M_WL  1_,_STEP      REPEAT

  DUP   099 = M_WL  1_,_STEP      REPEAT  \ CDQ

OS\ DUP FC
OS\ AND EC = M_WL   1_,_STEP  REPEAT  \ IN|OUT  EAX AL, DX | DX, EAX EL

\  DUP   0BB = M_WL  5_,_STEP     REPEAT  \ MOV EBX, # X
\  JO JNO JB JAE JE JNE JBE JA JS JNS JP JNP JL JGE JLE JG
\ 0111.XXXX
  DUP  F0 AND 70 = M_WL  2_,_STEP     REPEAT

  DUP   0E9 = M_WL 1A_,_STEP      REPEAT  \  JMP
  DROP
  DUP W@
   CC? IF ." W@=" DUP H. DP @ H. THEN
  DUP3B?[EBP]  M_WL  2_,_STEP +EBP REPEAT
  DUP3B?       M_WL  3_,_STEP      REPEAT
  DUP2B?       M_WL  2_,_STEP      REPEAT
  DUP 0C48B =  M_WL  2_,_STEP   REPEAT  \ MOV EAX , ESP
  DUP  C58B =  M_WL EVEN-EBP 2_,_STEP   REPEAT  \ MOV EAX,  EBP

  DUP 06D8D = M_WL DROP DUP 2 + C@ +>OFF-EBP
                     3 +
                     CC? IF DUP 44 DUMP CR THEN
                      REPEAT  \ LEA  EBP, OFF-EBP [EBP]

  DUP 0C583 = M_WL DROP DUP 2 + C@ +>OFF-EBP
                     3 + REPEAT  \ ADD  EBP, # OFF-EBP

  DUP 0ED83 = M_WL DROP DUP 2 + C@ C>S NEGATE +>OFF-EBP
                     3 + REPEAT  \ SUB  EBP, # OFF-EBP

  DUP 0C483 = M_WL  3_,_STEP     REPEAT  \ ADD  ESP, # X
  DUP6B?      M_WL  6_,_STEP      REPEAT  \ MOV  EAX,  # X
  DUP 0E3FF = M_WL EVEN-EBP 2_,_STEP REPEAT  \ JMP  EBX
\  DUP 0D3FF = M_WL EVEN-EBP 2_,_STEP REPEAT  \ CALL EBX

\ DUP 0E2FF = M_WL EVEN-EBP 2_,_STEP REPEAT  \ JMP  EDX
  DUP 0D2FF = M_WL EVEN-EBP 2_,_STEP REPEAT  \ CALL EDX
  DUP 810F  = M_WL 2A_,_STEP      REPEAT  \ JO [ESP]
  DUP 45C7  = M_WL 2_,_STEP +EBP 4_,_STEP_  REPEAT  \ MOV     X [EBP] , # X
  DROP
  DUP @
  DUP 0424448B = M_WL DROP   SetOP       \  MOV  EAX, 4 [ESP]
                    8B C, 04 C, 24 C,    \  MOV  EAX,   [ESP]
                    4 +
                 REPEAT

  DUP 0424448D = M_WL DROP   SetOP       \  LEA  EAX, 4 [ESP]
                    8B C, C4 C,          \  MOV  EAX,    ESP
                    4 +
                 REPEAT

  FFFFFF AND
  DUP 240401 = M_WL 3_,_STEP      REPEAT \ ADD [ESP] , EAX
  DUP C09D0F = M_WL 3_,_STEP      REPEAT \ SETGE  AL
  DUP C09E0F = M_WL 3_,_STEP      REPEAT \ SETLE  AL

\ CMPXCHG [EAX] , AL| EAX
\ LSS     EAX , [EAX]
\ BTR     [EAX] , EAX
\ LFS     EAX , [EAX]
\ LGS     EAX , [EAX]
\ MOVZX   EAX , BYTE|WORD  PTR [EAX]
\ 0000.0000 1011.1XXX 0000.1111
  DUP FFF8FF
  AND 00B00F = M_WL 3_,_STEP      REPEAT
  DUP 244403 = M_WL 4_,_STEP      REPEAT \ ADD  EAX, X [ESP]
  DUP 24442B = M_WL 4_,_STEP      REPEAT \ SUB  EAX, X [ESP]
  DUP 85448B = M_WL 3_,_STEP +EBP REPEAT \ MOV  EAX, X [EBP] [EAX*4]
  DUP 24048B = M_WL 3_,_STEP      REPEAT \ MOV  EAX, 0 [ESP]
  DUP 20488B = M_WL 3_,_STEP      REPEAT \ MOV  ECX , [EAX+20H]
  DUP 20488D = M_WL 3_,_STEP      REPEAT \ LEA  ECX , [EAX+20H]
  DUP 021C8D = M_WL 3_,_STEP      REPEAT \ LEA  EBX, [EDX] [EAX]
  DUP 02048D = M_WL 3_,_STEP      REPEAT \ LEA  EAX, [EDX] [EAX] 
  DUP 85048D = M_WL 7_,_STEP      REPEAT \ LEA  EAX, X [EAX*4]
  DUP 45048D = M_WL 7_,_STEP      REPEAT \ LEA  EAX, X [EAX*2]
  DUP 90048D = M_WL 3_,_STEP      REPEAT \ LEA  EAX , [EAX] [EDX*4] 
  DUP 2404FF = M_WL 3_,_STEP      REPEAT \ INC [ESP]
  DUP 18B60F = M_WL 3_,_STEP      REPEAT \ MOVZX EBX, BYTE PTR [EAX]
  DUP7B?      WHILE 7_,_STEP      REPEAT
 ." @COD, ERROR" ABORT
;

: OPT_CLOSE
   EVEN-EBP DP @ TO LAST-HERE ;

:  OPT_INIT   ?SET  -EVEN-EBP
  ;

: INLINE, ( CFA --  )   OPT_INIT  _INLINE, OPT_CLOSE ;

: MACRO, INLINE, ;
: XC_J
    J_COD FE AND 4 = IF EXIT THEN
    J_COD DUP 0x8 AND
    IF  3
    ELSE 5
    THEN  XOR TO J_COD ;

:  ?BR-OPT-RULES ( cfa -- cfa' flag )
\ ZZZZ IF ." z=" OP1 @ @ U. THEN
     TRUE  ;

: BR-EVEN-EAX OFF-EAX
   IF   M\ 1002 DTST
       SetOP
      5 C, OFF-EAX ,
      0 TO OFF-EAX
         M\ 1003 DTST
   THEN
;
: ?BR-OPT
     BEGIN BEGIN  M\ -9 DTST
                 ?BR-OPT-RULES
           UNTIL  M\ -7 DTST
                  ['] NOOP OPT-RULES NIP
     UNTIL        BR-EVEN-EAX
   M\ -5 DTST
\ ZZZZ IF ." B=" DUP U. THEN
        OP0 @ :-SET U<
        IF    SetOP 0xC00B W,    \ OR EAX, EAX
              EXIT
        THEN
        OP0 @ C@  
        \ 00XX.X101
        DUP   C7 AND 05 <>  \  ADD|OR|ADC|SBB|AND|SUB|XOR|CMP EAX, # X
\       OVER  3D <> AND   \ ~ CMP EAX, # X
        OVER  40 <> AND   \ DEC     EAX
        OVER  48 <> AND   \ INC     EAX
        OVER  3B <> AND   \ CMP
        OVER  0B <> AND   \ OR

        NIP
        OP0 @  W@
        DUP  4000  OR  ADD|XOR|OR|AND= INVERT
        OVER C01B  <> AND  \ SBB EAX, EAX
        OVER D02B  <> AND  \ SUB EDX, EAX
        OVER 4539  <> AND  \ CMP X [EBP], EAX
\        OVER 103B  <> AND  \ CMP EDX , [EAX] 
\        OVER 453B  <> AND  \ CMP EAX , X [EBP]
\        OVER 053B  <> AND  \ CMP EAX , X
        OVER C083  <> AND  \ ADD EAX , # X
        OVER C203  <> AND  \ ADD EAX , EDX
        OVER C133  <> AND  \ XOR EAX , ECX 
        OVER F8C1  <> AND  \ SAR EAX ,   X
        OVER 7D83  <> AND  \ CMP X [EBP], # Z
        OVER 3D81  <> AND  \ CMP 44444, # 55555
        OVER 3C81  <> AND  \ CMP   X [EAX*4] ,  # 55555
        OVER 7C81  <> AND  \ CMP X [ESP] , # X
        OVER 3D83  <> AND  \ CMP 44444, # 0
        OVER 3C83  <> AND  \ CMP [ESP], # 0
\        OVER C20B  <> AND  \  OR EAX , EDX
        NIP
        OP0 @  @ FFFFFF AND 240433 XOR \ XOR     EAX , [ESP]
        AND
        AND
        IF    SetOP 0xC00B W,    \ OR EAX, EAX
        THEN
\       DP @ TO :-SET
;

: ??BR-OPT
  OPT?  IF OPT_INIT
 ?BR-OPT
   M\ -B DTST
 OPT_CLOSE
       THEN ;
: ???BR-OPT
  OPT? 0= IF  C00B W,    \ OR EAX, EAX
  THEN
    FALSE TO ~BR-OPT  'DROP ??BR-OPT INLINE,
     TRUE TO ~BR-OPT
   OPT?
  IF   OPT_INIT
   OP0 @ W@ C00B = DUP >R IF OP0 OPexcise THEN
      ['] NOOP ?BR-OPT DROP
\         SetOP 0xC00B W,    \ OR EAX, EAX 
    OP0 @ W@ C00B = R> 0= AND IF OP0 OPexcise THEN
      OPT_CLOSE
  THEN
;

: OPT   ( -- )  ['] NOOP DO_OPT DROP  ;

: FORLIT, ( N -- )
CR ." LIT=" DUP H. DP @ H. 
  'DUP _INLINE, DP @ H.
   SetOP 0B8 C, , OPT DP @ H. ;

: FRLIT,
 OPT_INIT  FORLIT, OPT_CLOSE  ;

: CON>LIT ( CFA -- CFA TRUE | FALSE )    
                  OPT? 0= IF TRUE EXIT THEN ?SET
               MM_SIZE 0= IF TRUE EXIT THEN
                 DUP C@ 0E8 <> IF TRUE EXIT THEN
                 
                 DUP 1+  REL@ CELL+ 
                 DUP   CREATE-CODE  = 
                 IF  DROP OPT_INIT 5 + [>T] FORLIT, FALSE OPT_CLOSE EXIT
                 THEN
                 
                 DUP     USER-CODE  =
                 IF  DROP  OPT_INIT 'DUP _INLINE,
                   SetOP  878D W, 5 + @ , OPT   FALSE  OPT_CLOSE  EXIT
                 THEN

                 DUP     USER-VALUE-CODE  =
                 IF  DROP  OPT_INIT 'DUP _INLINE,
                   SetOP  878B W, 5 + @ , OPT   FALSE  OPT_CLOSE  EXIT
                 THEN

                 DUP  CONSTANT-CODE  =
                 IF  DROP  OPT_INIT 5 + DUP 5 +  REL@ 
                     TOVALUE-CODE CELL- =
                    IF   'DUP _INLINE, SetOP 0A1 C, [>T] , OPT
                    ELSE    @  FORLIT, 
                    THEN   FALSE  OPT_CLOSE  EXIT
                 THEN
                 DUP 1+ REL@ CELL+ DOES-CODE =
                 IF  5 +         \ CFA
                     SWAP 5 + OPT_INIT FORLIT, 
                     TRUE     OPT_CLOSE EXIT
                 THEN
                 DUP  TOUSER-VALUE-CODE =
                 IF  DROP  OPT_INIT
                     SetOP  8789 W, CELL- @ , OPT 
                     'DROP _INLINE,
                     FALSE  OPT_CLOSE  EXIT
                 THEN
                  TOVALUE-CODE =
                 IF  OPT_INIT
                     SetOP  A3 C,  CELL- [>T] ,   OPT
                     'DROP _INLINE,
                     FALSE  OPT_CLOSE  EXIT
                 THEN
  TRUE
;

 TRUE VALUE J_OPT?

 
BASE !


