Diff for /np2/i286x/Attic/egcmem.x86 between versions 1.2 and 1.3

version 1.2, 2004/01/30 14:33:27 version 1.3, 2004/01/31 08:34:40
Line 1 Line 1
 ; egc - asm version  ; egc - asm version
 ;  ;
 ; asm version: egcasm.asm + egc.cpp  ; asm version: egcasm.asm + egc.c
   
 %include 'x86/np2asm.inc'  %include 'x86/np2asm.inc'
   
Line 11  section .bss Line 11  section .bss
         extern  _gdcs          extern  _gdcs
         extern  _egc          extern  _egc
         extern  _vramupdate          extern  _vramupdate
           global  _egc_src
           global  _egc_data
           global  _egc_dst
           global  _egc_pat
   
           global  _egcshift
   
           global  @egca_read@4
           global  @egca_write@8
           global  @egca_read_w@4
           global  @egca_write_w@8
   
           global  egc_read
           global  egc_write
           global  egc_read_w
           global  egc_write_w
   
   
         _egc_src        resd    2          _egc_src        resd    2
           _egc_data       resd    2
           _egc_dst        resd    2
           _egc_pat        resd    2
   
 VIDEOMEMORY             equ             _mem  VIDEOMEMORY             equ             _mem
   
Line 40  egcmask_db db 001h, 003h, 007h, 00fh, 01 Line 60  egcmask_db db 001h, 003h, 007h, 00fh, 01
   
 vramoffset      dd      VRAM_B, VRAM_R, VRAM_G, VRAM_E  vramoffset      dd      VRAM_B, VRAM_R, VRAM_G, VRAM_E
   
 _egc_dst        dd      0, 0  
 _egc_xdst       dd      0, 0  
 _egc_data       dd      0, 0  
   
   
   
 section .text  section .text
   
                 global  _egcshift  
   
                 global  _egca_read  
                 global  _egca_read_w  
                 global  _egca_write  
                 global  _egca_write_w  
   
                                 align   16                                  align   16
 _egcshift:              mov             eax, [_egc + egc_t.leng]  _egcshift:              mov             eax, [_egc + egc_t.leng]
                                 and             eax, 0fffh                                  and             eax, 0fffh
                                 inc             eax                                  inc             eax
                                 mov             [_egc + egc_t.remain], eax                                  mov             [_egc + egc_t.remain], eax
   
                                 mov             eax, [_egc + egc_t.sft]                                  mov             eax, [_egc + egc_t.sft]
                                 mov             edx, _egc + egc_t.buf                           ; offset                                  mov             edx, _egc + egc_t.buf
                                 test    ah, 10h                                  test    ah, 10h
                                 je              egsft_dircalced                                  je              egsft_dircalced
                                 add             edx, 512 + 3                                            ; jne ¤خب¦                                  add             edx, 512 + 3
 egsft_dircalced:  egsft_dircalced:mov             [_egc + egc_t.inptr], edx
                                 mov             [_egc + egc_t.inptr], edx  
                                 mov             [_egc + egc_t.outptr], edx                                  mov             [_egc + egc_t.outptr], edx
                                 mov             edx, 0                                  and             dword [_egc + egc_t.stack], byte 0
                                 mov             [_egc + egc_t.stack], edx                                  and             edx, byte 1
                                 setnz   dl  
   
                                 mov             ah, al                                                          ; al = srcbit                                  mov             ah, al                                                          ; al = srcbit
                                 shr             ah, 4                                                           ; ah = dstbit                                  shr             ah, 4                                                           ; ah = dstbit
                                 and             ax, 0f0fh                                  and             ax, 0f0fh
                                 mov             [_egc + egc_t.srcbit], al                                  mov             [_egc + egc_t.srcbit], al
                                 mov             [_egc + egc_t.dstbit], ah                                  mov             [_egc + egc_t.dstbit], ah
   
                                 and             ax, 0707h                                  and             ax, 0707h
                                 sub             al, ah                                                  ; al = srcbit - dstbit                                  sub             al, ah                                                  ; al = srcbit - dstbit
                                 je              short egsft_funcrst                             ; srcbit == dstbit                                  je              short egsft_funcrst                             ; srcbit == dstbit
                                 jc              short egsft_difm                                  jc              short egsft_difm
                                                                                                                 ; srcbit > dstbit                                  add             edx, byte 4                                             ; srcbit > dstbit
                                 add             edx, 4  
                                 jmp             short egsft_difcal                                  jmp             short egsft_difcal
 egsft_difm:                                                                                             ; srcbit < dstbit  egsft_difm:             add             edx, byte 2                                             ; srcbit < dstbit
                                 add             edx, 2  
                                 add             al, 8                                  add             al, 8
 egsft_difcal:  egsft_difcal:   mov             [_egc + egc_t.sft8bitl], al
                                 mov             [_egc + egc_t.sft8bitl], al  
                                 dec             al                                                              ; +-- al = 8 - al                                  dec             al                                                              ; +-- al = 8 - al
                                 xor             al, 7                                                   ; +                                  xor             al, 7                                                   ; +
                                 mov             [_egc + egc_t.sft8bitr], al                                  mov             [_egc + egc_t.sft8bitr], al
 egsft_funcrst:  egsft_funcrst:  mov             [_egc + egc_t.func], edx
                                 mov             [_egc + egc_t.func], edx  
                                 ret                                  ret
   
   
   
                                 align   16                                  align   4
 egcsftb_upn_sub:  egcsftb_upn_sub:
                                 movzx   eax, byte [_egc + egc_t.dstbit]                                  movzx   eax, byte [_egc + egc_t.dstbit]
                                 cmp             al, 8                                  cmp             eax, byte 8
                                 jae             short estb_upns_of                                  jae             short estb_upns_of
                                   test    eax, eax
                                 test    al, al  
                                 jne             short estb_upns_db                                  jne             short estb_upns_db
                                 sub             dword [_egc + egc_t.remain], 8  
                                 jnc             short estb_upns_cal  
   
                                   sub             dword [_egc + egc_t.remain], byte 8
                                   jnc             short estb_upns_cal
                                 xor             edx, edx                                  xor             edx, edx
                                 xchg    edx, [_egc + egc_t.remain]                                  xchg    edx, [_egc + egc_t.remain]
                                 add             edx, 8 - 1                                  add             edx, byte (8 - 1)
                                 mov             al, [egcmask_ub + edx]                                  mov             al, byte [egcmask_ub + edx]
                                 jmp             short estb_upns_msk                                  jmp             short estb_upns_msk
   
 estb_upns_of:   and             byte [_egc + egc_t.dstbit], 7  estb_upns_of:   and             byte [_egc + egc_t.dstbit], 7
                                 mov             byte [_egc + egc_t.srcmask + ebx], 0                                  mov             byte [_egc + egc_t.srcmask + ebx], 0
                                 ret                                  ret
   
 estb_upns_db:  estb_upns_db:   mov             byte [_egc + egc_t.dstbit], 0
                                 mov             byte [_egc + egc_t.dstbit], 0  
                                 mov             edx, 8                                  mov             edx, 8
                                 sub             edx, eax                                  sub             edx, eax
                                 sub             [_egc + egc_t.remain], edx                                  sub             [_egc + egc_t.remain], edx
Line 132  estb_upns_db: Line 129  estb_upns_db:
 estb_upns_dbof:  estb_upns_dbof:
                                 xor             edx, edx                                  xor             edx, edx
                                 xchg    edx, [_egc + egc_t.remain]                                  xchg    edx, [_egc + egc_t.remain]
                                 not             edx                                                     ; edx = mask start                                  neg             edx                                                     ; edx = mask start
                                 mov             al, [egcmask_ua + eax + edx*8]                                  mov             al, [egcmask_ua + eax + edx*8]
   
 estb_upns_msk:  estb_upns_msk:
                                 mov             [_egc + egc_t.srcmask + ebx], al                                  mov             [_egc + egc_t.srcmask + ebx], al
 estb_upns_cal:  
                                 mov             edx, [_egc + egc_t.outptr]  estb_upns_cal:  mov             edx, [_egc + egc_t.outptr]
                                 mov             al, [edx + 0]                                  mov             al, [edx + 0]
                                 mov             [_egc_src + ebx + 0], al                                  mov             [_egc_src + ebx + 0], al
                                 mov             al, [edx + 4]                                  mov             al, [edx + 4]
Line 155  estb_upns_cal: Line 151  estb_upns_cal:
 ; **---4-- -----8-- ------  ; **---4-- -----8-- ------
 ; out -> ax <<< (src - dst) -> al  ; out -> ax <<< (src - dst) -> al
   
                                 align   16                                  align   4
 egcsftb_upl_sub:  egcsftb_upl_sub:
                                 movzx   eax, byte [_egc + egc_t.dstbit]                                  movzx   eax, byte [_egc + egc_t.dstbit]
                                 cmp             al, 8                                  cmp             al, 8
Line 187  estb_upls_db: Line 183  estb_upls_db:
 estb_upls_dbof:  estb_upls_dbof:
                                 xor             edx, edx                                  xor             edx, edx
                                 xchg    edx, [_egc + egc_t.remain]                                  xchg    edx, [_egc + egc_t.remain]
                                 not             edx                                                     ; edx = mask start                                  neg             edx                                                     ; edx = mask start
                                 mov             al, [egcmask_ua + eax + edx*8]                                  mov             al, [egcmask_ua + eax + edx*8]
   
 estb_upls_msk:  estb_upls_msk:
Line 215  estb_upls_cal: Line 211  estb_upls_cal:
 ; ******-- -4------ --8----- --  ; ******-- -4------ --8----- --
 ; out -> ax >>> (dst - src) -> ah  ; out -> ax >>> (dst - src) -> ah
   
                                 align   16                                  align   4
 egcsftb_upr_sub:  egcsftb_upr_sub:
                                 movzx   eax, byte [_egc + egc_t.dstbit]                                  movzx   eax, byte [_egc + egc_t.dstbit]
                                 cmp             al, 8                                  cmp             al, 8
Line 247  estb_uprs_db: Line 243  estb_uprs_db:
 estb_uprs_dbof:  estb_uprs_dbof:
                                 xor             edx, edx                                  xor             edx, edx
                                 xchg    edx, [_egc + egc_t.remain]                                  xchg    edx, [_egc + egc_t.remain]
                                 not             edx                                                     ; edx = mask start                                  neg             edx                                                     ; edx = mask start
                                 mov             al, [egcmask_ua + eax + edx*8]                                  mov             al, [egcmask_ua + eax + edx*8]
 estb_uprs_msk:  estb_uprs_msk:
                                 mov             [_egc + egc_t.srcmask + ebx], al                                  mov             [_egc + egc_t.srcmask + ebx], al
Line 270  estb_uprs_cal: Line 266  estb_uprs_cal:
   
   
   
                                 align   16                                  align   4
 egcsftb_dnn_sub:  egcsftb_dnn_sub:
                                 movzx   eax, byte [_egc + egc_t.dstbit]                                  movzx   eax, byte [_egc + egc_t.dstbit]
                                 cmp             al, 8                                  cmp             al, 8
Line 302  estb_dnns_db: Line 298  estb_dnns_db:
 estb_dnns_dbof:  estb_dnns_dbof:
                                 xor             edx, edx                                  xor             edx, edx
                                 xchg    edx, [_egc + egc_t.remain]                                  xchg    edx, [_egc + egc_t.remain]
                                 not             edx                                                     ; edx = mask start                                  neg             edx                                                     ; edx = mask start
                                 mov             al, [egcmask_da + eax + edx*8]                                  mov             al, [egcmask_da + eax + edx*8]
   
 estb_dnns_msk:  estb_dnns_msk:
Line 326  estb_dnns_cal: Line 322  estb_dnns_cal:
 ;             ----- ---8---- ---3--**  ;             ----- ---8---- ---3--**
 ; out -> ax >>> (dst - src) -> ah  ; out -> ax >>> (dst - src) -> ah
   
                                 align   16                                  align   4
 egcsftb_dnl_sub:  egcsftb_dnl_sub:
                                 movzx   eax, byte [_egc + egc_t.dstbit]                                  movzx   eax, byte [_egc + egc_t.dstbit]
                                 cmp             al, 8                                  cmp             al, 8
Line 358  estb_dnls_db: Line 354  estb_dnls_db:
 estb_dnls_dbof:  estb_dnls_dbof:
                                 xor             edx, edx                                  xor             edx, edx
                                 xchg    edx, [_egc + egc_t.remain]                                  xchg    edx, [_egc + egc_t.remain]
                                 not             edx                                                     ; edx = mask start                                  neg             edx                                                     ; edx = mask start
                                 mov             al, [egcmask_da + eax + edx*8]                                  mov             al, [egcmask_da + eax + edx*8]
   
 estb_dnls_msk:  estb_dnls_msk:
Line 386  estb_dnls_cal: Line 382  estb_dnls_cal:
 ;      --- -----8-- -----6-- ---*****  ;      --- -----8-- -----6-- ---*****
 ; out -> ax <<< (dst - src) -> al  ; out -> ax <<< (dst - src) -> al
   
                                 align   16                                  align   4
 egcsftb_dnr_sub:  egcsftb_dnr_sub:
                                 movzx   eax, byte [_egc + egc_t.dstbit]                                  movzx   eax, byte [_egc + egc_t.dstbit]
                                 cmp             al, 8                                  cmp             al, 8
Line 419  estb_dnrs_db: Line 415  estb_dnrs_db:
 estb_dnrs_dbof:  estb_dnrs_dbof:
                                 xor             edx, edx                                  xor             edx, edx
                                 xchg    edx, [_egc + egc_t.remain]                                  xchg    edx, [_egc + egc_t.remain]
                                 not             edx                                                     ; edx = mask start                                  neg             edx                                                     ; edx = mask start
                                 mov             al, [egcmask_da + eax + edx*8]                                  mov             al, [egcmask_da + eax + edx*8]
   
 estb_dnrs_msk:  estb_dnrs_msk:
Line 441  estb_dnrs_cal: Line 437  estb_dnrs_cal:
                                 mov             [_egc_src + ebx + 6], al                                  mov             [_egc_src + ebx + 6], al
                                 ret                                  ret
   
   
 ; -------------------------------------------------------------------------  ; -------------------------------------------------------------------------
   
 %macro  egcsft_byte             1  %macro  egcsft_byte             1
                                 mov             ebx, ebp  
                                 mov             byte [_egc + egc_t.srcmask + ebx], 0ffh                                  mov             byte [_egc + egc_t.srcmask + ebx], 0ffh
                                 mov             eax, 8                                  mov             eax, 8
                                 sub             al, [_egc + egc_t.dstbit]                                  sub             al, [_egc + egc_t.dstbit]
Line 465  estb_dnrs_cal: Line 461  estb_dnrs_cal:
   
   
 %macro  egcsft_word_up  1  %macro  egcsft_word_up  1
                                 xor             ebx, ebx                                  ; ebx == 0
                                 mov             word [_egc + egc_t.srcmask], 0ffffh                                  mov             word [_egc + egc_t.srcmask], 0ffffh
                                 mov             eax, 16                                  lea             eax, [ebx + 16]
                                 sub             al, [_egc + egc_t.dstbit]                                  sub             al, byte [_egc + egc_t.dstbit]
                                 cmp             [_egc + egc_t.stack], eax                                  cmp             [_egc + egc_t.stack], eax
                                 jc              short %%dstbitover                                  jc              short %%dstbitover
                                 sub             [_egc + egc_t.stack], eax                                  sub             [_egc + egc_t.stack], eax
                                 call    %1                                  call    %1
                                 cmp             [_egc + egc_t.remain], ebx                                  cmp             dword [_egc + egc_t.remain], ebx
                                 je              short %%uplhlf                                  je              short %%uplhlf
                                 inc             ebx                                  inc             ebx
                                 call    %1                                  call    %1
                                 cmp             dword [_egc + egc_t.remain], 0                                  dec             ebx
                                   cmp             [_egc + egc_t.remain], ebx
                                 je              near _egcshift                                  je              near _egcshift
                                 ret                                  ret
 %%dstbitover:   mov             word [_egc + egc_t.srcmask], bx  %%dstbitover:   mov             word [_egc + egc_t.srcmask], bx
Line 488  estb_dnrs_cal: Line 485  estb_dnrs_cal:
   
   
 %macro  egcsft_word_dn  1  %macro  egcsft_word_dn  1
                                 xor             ebx, ebx                                  ; ebx == 0
                                 mov             word [_egc + egc_t.srcmask], 0ffffh                                  mov             word [_egc + egc_t.srcmask], 0ffffh
                                 mov             eax, 16                                  lea             eax, [ebx + 16]
                                 sub             al, [_egc + egc_t.dstbit]                                  sub             al, [_egc + egc_t.dstbit]
                                 cmp             [_egc + egc_t.stack], eax                                  cmp             [_egc + egc_t.stack], eax
                                 jc              short %%dstbitover                                  jc              short %%dstbitover
Line 516  estb_dnrs_cal: Line 513  estb_dnrs_cal:
   
   
   
                                   align   4
                                 align   16  
 egcsftb_upn0:   egcsft_byte             egcsftb_upn_sub  egcsftb_upn0:   egcsft_byte             egcsftb_upn_sub
                                 align   16                                  align   4
 egcsftb_upl0:   egcsft_byte             egcsftb_upl_sub  egcsftb_upl0:   egcsft_byte             egcsftb_upl_sub
                                 align   16                                  align   4
 egcsftb_upr0:   egcsft_byte             egcsftb_upr_sub  egcsftb_upr0:   egcsft_byte             egcsftb_upr_sub
   
                                 align   16                                  align   4
 egcsftb_dnn0:   egcsft_byte             egcsftb_dnn_sub  egcsftb_dnn0:   egcsft_byte             egcsftb_dnn_sub
                                 align   16                                  align   4
 egcsftb_dnl0:   egcsft_byte             egcsftb_dnl_sub  egcsftb_dnl0:   egcsft_byte             egcsftb_dnl_sub
                                 align   16                                  align   4
 egcsftb_dnr0:   egcsft_byte             egcsftb_dnr_sub  egcsftb_dnr0:   egcsft_byte             egcsftb_dnr_sub
   
                                 align   16  
                                   align   4
 egcsftw_upn0:   egcsft_word_up  egcsftb_upn_sub  egcsftw_upn0:   egcsft_word_up  egcsftb_upn_sub
                                 align   16                                  align   4
 egcsftw_upl0:   egcsft_word_up  egcsftb_upl_sub  egcsftw_upl0:   egcsft_word_up  egcsftb_upl_sub
                                 align   16                                  align   4
 egcsftw_upr0:   egcsft_word_up  egcsftb_upr_sub  egcsftw_upr0:   egcsft_word_up  egcsftb_upr_sub
   
                                 align   16                                  align   4
 egcsftw_dnn0:   egcsft_word_dn  egcsftb_dnn_sub  egcsftw_dnn0:   egcsft_word_dn  egcsftb_dnn_sub
                                 align   16                                  align   4
 egcsftw_dnl0:   egcsft_word_dn  egcsftb_dnl_sub  egcsftw_dnl0:   egcsft_word_dn  egcsftb_dnl_sub
                                 align   16                                  align   4
 egcsftw_dnr0:   egcsft_word_dn  egcsftb_dnr_sub  egcsftw_dnr0:   egcsft_word_dn  egcsftb_dnr_sub
   
   
 section .data  section .rdata
   
 egcsft_proc             dd              egcsftw_upn0,   egcsftw_dnn0  egcsft_proc             dd              egcsftw_upn0,   egcsftw_dnn0
                                 dd              egcsftw_upr0,   egcsftw_dnr0                                  dd              egcsftw_upr0,   egcsftw_dnr0
Line 557  egcsft_proc  dd  egcsftw_upn0, egcsftw_d Line 554  egcsft_proc  dd  egcsftw_upn0, egcsftw_d
   
 section .text  section .text
   
 ; --------------------------------------------------------------------------  
   
 %macro          CPUSRC2DATA             0                          ; ebx:ext dx:data esi:func
                                 mov             ebx, [_egc + egc_t.inptr]  egcope_shift:   mov             ecx, [_egc + egc_t.inptr]
                                 xor             eax, eax                                  xor             eax, eax
                                 test    byte [_egc + egc_t.sft + 1], 10h                                  test    byte [_egc + egc_t.sft + 1], 10h
                                 setnz   al                                  setz    al
                                 sub             ebx, eax  
                                 mov             [ebx + 0], dx  
                                 mov             [ebx + 4], dx  
                                 mov             [ebx + 8], dx  
                                 mov             [ebx +12], dx  
                                 cmp             dword [_egc + egc_t.stack], 16  
                                 ja              short %%cpusrc2d_end  
                                 lea             eax, [eax*2 - 1]  
                                 sub             [_egc + egc_t.inptr], eax  
                                 cmp             esi, byte 6                                  cmp             esi, byte 6
                                 jae             short %%cpusrc2d_byte                                  jae             short eosft_byte
                                   lea             ecx, [ecx + eax - 1]
                                   mov             [ecx + 0], dx
                                   mov             [ecx + 4], dx
                                   mov             [ecx + 8], dx
                                   mov             [ecx +12], dx
                                   lea             eax, [eax*2 - 1]
   
   shiftinput_w:   cmp             dword [_egc + egc_t.stack], byte 16
                                   ja              short eosw_callsub
                                   add             [_egc + egc_t.inptr], eax
                                 cmp             byte [_egc + egc_t.srcbit], 0                                  cmp             byte [_egc + egc_t.srcbit], 0
                                 je              short %%cpusrc2d_w1                                  je              short eosw_stkadd
                                 xor             edx, edx                                  xor             edx, edx
                                 xchg    [_egc + egc_t.srcbit], dl                                  xchg    dl, [_egc + egc_t.srcbit]
                                 cmp             dl, 8                                  cmp             dl, 8
                                 jb              short %%cpusrc2d_w0                                  jc              short eosw_stksub
                                 sub             [_egc + egc_t.outptr], eax                                  add             [_egc + egc_t.outptr], eax
 %%cpusrc2d_w0:  sub             [_egc + egc_t.stack], edx  eosw_stksub:    sub             [_egc + egc_t.stack], edx
 %%cpusrc2d_w1:  add             dword [_egc + egc_t.stack], 16  eosw_stkadd:    add             dword [_egc + egc_t.stack], byte 16
                                 sub             [_egc + egc_t.inptr], eax                                  add             [_egc + egc_t.inptr], eax
                                 jmp             short %%cpusrc2d_end  eosw_callsub:   jmp             dword [egcsft_proc + esi*4]
 %%cpusrc2d_byte:                                  align   4
   eosft_byte:             mov             [ecx + 0], dl
                                   mov             [ecx + 4], dl
                                   mov             [ecx + 8], dl
                                   mov             [ecx +12], dl
                                   lea             eax, [eax*2 - 1]
   
   shiftinput_b:   cmp             dword [_egc + egc_t.stack], byte 16
                                   ja              short eosb_callsub
                                   add             [_egc + egc_t.inptr], eax
                                 cmp             byte [_egc + egc_t.srcbit], 0                                  cmp             byte [_egc + egc_t.srcbit], 0
                                 je              short %%cpusrc2d_b1                                  je              short eosb_stkadd
                                 btr             word [_egc + egc_t.srcbit], 3                                  btr             word [_egc + egc_t.srcbit], 3
                                 jc              short %%cpusrc2d_end                                  jc              short eosb_callsub
                                 xor             edx, edx                                  xor             edx, edx
                                 xchg    [_egc + egc_t.srcbit], dl                                  xchg    dl, [_egc + egc_t.srcbit]
                                 sub             [_egc + egc_t.stack], edx                                  sub             [_egc + egc_t.stack], edx
 %%cpusrc2d_b1:  add             dword [_egc + egc_t.stack], 8  eosb_stkadd:    add             [_egc + egc_t.stack], byte 8
                                 align   4  eosb_callsub:   jmp             dword [egcsft_proc + esi*4]
 %%cpusrc2d_end: push    ecx                                                                     ; ver0.28  
                                 call    dword [egcsft_proc + esi*4]  
                                 pop             ecx  
 %endmacro  
   
                                 align   16  
 egcopecxx:              CPUSRC2DATA  
 egcope_xx:              ; making pattern...                                                     ; ver0.28                          ; ebx:ext ebp:addr dx:data esi:func
                                 mov             dl, [_egc + egc_t.fgbg + 1]  egc_mod:                mov             ax, [_egc + egc_t.mask]
                                 and             dl, 60h                                  mov             [_egc + egc_t.mask2], ax
                                 je              short egca_ww_srcp0                                  mov             al, [_egc + egc_t.ope + 1]
                                 cmp             dl, 40h                                  and             al, 18h
                                 mov             edx, _egc + egc_t.bgc                           ; !!!                                  jpe             short eow_setdat
                                 jc              short egca_ww_srcpe                                  cmp             al, 10h
                                 jne             short egca_ww_srcp0                                  je              short eow_setpat
                                 mov             edx, _egc + egc_t.fgc                           ; !!!  
                                 jmp             short egca_ww_srcpe  eow_setsrc:             mov             al, [_egc + egc_t.ope + 1]
                                 align   4                                  test    al, 4
 egca_ww_srcp0:  mov             al, [_egc + egc_t.ope + 1]                      ; ver0.29                                  je              short eow_srcnf
                                   call    egcope_shift
   eow_srcnf:              mov             ax, [_egc + egc_t.srcmask]
                                   and             [_egc + egc_t.mask2], ax
                                   call    egc_opesub
                                   mov             ecx, _egc_data
                                   mov             [ecx + 0], esi
                                   mov             [ecx + 4], edi
                                   ret
   
   eow_setpat:             mov             al, [_egc + egc_t.fgbg + 1]
                                   and             al, 60h
                                   jpe             short eow_setpatsft
                                   mov             edx, _egc + egc_t.bgc
                                   cmp             al, 40h
                                   jne             short eow_store
                                   mov             edx, _egc + egc_t.fgc
                                   jmp             short eow_store
   
   eow_setpatsft:  call    egcope_shift
                                   mov             ax, [_egc + egc_t.srcmask]
                                   and             [_egc + egc_t.mask2], ax
                                   mov             edx, _egc_src
   eow_store:              mov             esi, [edx + 0]
                                   mov             edi, [edx + 4]
                                   mov             ecx, _egc_data
                                   mov             [ecx + 0], esi
                                   mov             [ecx + 4], edi
                                   ret
   
   eow_setdat:             mov             ecx, _egc_data
                                   mov             [ecx + 0], dx
                                   mov             [ecx + 2], dx
                                   mov             [ecx + 4], dx
                                   mov             [ecx + 6], dx
                                   ret
   
   
   
   
   
   
                                   ; !!! ¤¢¤ب¤ا¥¹¥؟¥أ¥¯¤ٍ»بحر¤¹¤ë¤³¤ب
                                   ; make pattern...
   egc_opesub:             mov             al, [_egc + egc_t.fgbg + 1]
                                   and             al, 60h
                                   jpe             short eo_opesrc
                                   mov             edx, _egc + egc_t.bgc
                                   cmp             al, 20h
                                   je              short eo_loadvram
                                   mov             edx, _egc + egc_t.fgc
                                   jmp             short eo_loadvram
   
   eo_opesrc:              mov             al, [_egc + egc_t.ope + 1]
                                 and             al, 3                                  and             al, 3
                                 dec             al                                  cmp             al, 1
                                 je              near same_srcpat                                  mov             edx, _egc_src
                                   je              short eo_loadvram
                                 mov             edx, _egc + egc_t.patreg                                  mov             edx, _egc + egc_t.patreg
   
 egca_ww_srcpe:  eo_loadvram:    mov             eax, [edx + 0]
                                 and             ecx, 0fffffffeh                                  mov             [_egc_pat + 0], eax
                                 mov             ax, [VIDEOMEMORY + ecx + VRAM_R]                                  mov             eax, [edx + 4]
                                   mov             [_egc_pat + 4], eax
   
                                   and             ebp, 0fffffffeh
                                   mov             ax, [VIDEOMEMORY + ebp + VRAM_R]
                                 shl             eax, 16                                  shl             eax, 16
                                 mov             ax, [VIDEOMEMORY + ecx + VRAM_B]                                  mov             ax, [VIDEOMEMORY + ebp + VRAM_B]
                                 mov             [_egc_dst + 0], eax                                  mov             [_egc_dst + 0], eax
                                 not             eax                                  mov             ax, [VIDEOMEMORY + ebp + VRAM_E]
                                 mov             [_egc_xdst + 0], eax  
                                 mov             ax, [VIDEOMEMORY + ecx + VRAM_E]  
                                 shl             eax, 16                                  shl             eax, 16
                                 mov             ax, [VIDEOMEMORY + ecx + VRAM_G]                                  mov             ax, [VIDEOMEMORY + ebp + VRAM_G]
                                 mov             [_egc_dst + 4], eax                                  mov             [_egc_dst + 4], eax
                                 not             eax  
                                 mov             [_egc_xdst + 4], eax  
   
                                 xor             esi, esi                                  xor             esi, esi
                                 xor             edi, edi                                  xor             edi, edi
                                 mov             bl, byte [_egc + egc_t.ope]                                  mov             cl, byte [_egc + egc_t.ope]
   
                                 ; pat = [edx]   src = _egc_src  dst = _egc_dst                                  ; pat = [edx]   src = _egc_src  dst = _egc_dst
 egca_ww_ope80s:  egc_ope80:              add             cl, cl
                                 shl             bl, 1                                  jnc             short egc_ope40
                                 jnc             short egca_ww_ope80e                                  mov             eax, [edx + 0]
                                 mov             eax, [edx]  
                                 and             eax, [_egc_src + 0]                                  and             eax, [_egc_src + 0]
                                 and             eax, [_egc_dst + 0]                                  and             eax, [_egc_dst + 0]
                                 or              esi, eax                                  or              esi, eax
Line 651  egca_ww_ope80s: Line 706  egca_ww_ope80s:
                                 and             eax, [_egc_src + 4]                                  and             eax, [_egc_src + 4]
                                 and             eax, [_egc_dst + 4]                                  and             eax, [_egc_dst + 4]
                                 or              edi, eax                                  or              edi, eax
 egca_ww_ope80e:  
                                 shl             bl, 1  egc_ope40:              add             cl, cl
                                 jnc             short egca_ww_ope40e                                  jnc             short egc_ope20
                                 mov             eax, [edx]                                  mov             eax, [edx + 0]
                                 not             eax                                  not             eax
                                 and             eax, [_egc_src + 0]                                  and             eax, [_egc_src + 0]
                                 and             eax, [_egc_dst + 0]                                  and             eax, [_egc_dst + 0]
Line 664  egca_ww_ope80e: Line 719  egca_ww_ope80e:
                                 and             eax, [_egc_src + 4]                                  and             eax, [_egc_src + 4]
                                 and             eax, [_egc_dst + 4]                                  and             eax, [_egc_dst + 4]
                                 or              edi, eax                                  or              edi, eax
 egca_ww_ope40e:  
                                 shl             bl, 1  egc_ope20:              add             cl, cl
                                 jnc             short egca_ww_ope20e                                  jnc             short egc_ope10
                                 mov             eax, [edx]                                  mov             eax, [_egc_dst + 0]
                                   not             eax
                                   and             eax, [edx + 0]
                                 and             eax, [_egc_src + 0]                                  and             eax, [_egc_src + 0]
                                 and             eax, [_egc_xdst + 0]  
                                 or              esi, eax                                  or              esi, eax
                                 mov             eax, [edx + 4]                                  mov             eax, [_egc_dst + 4]
                                   not             eax
                                   and             eax, [edx + 4]
                                 and             eax, [_egc_src + 4]                                  and             eax, [_egc_src + 4]
                                 and             eax, [_egc_xdst + 4]  
                                 or              edi, eax                                  or              edi, eax
 egca_ww_ope20e:  
                                 shl             bl, 1  egc_ope10:              add             cl, cl
                                 jnc             short egca_ww_ope10e                                  jnc             short egc_ope08
                                 mov             eax, [edx]                                  mov             eax, [edx + 0]
                                   or              eax, [_egc_dst + 0]
                                 not             eax                                  not             eax
                                 and             eax, [_egc_src + 0]                                  and             eax, [_egc_src + 0]
                                 and             eax, [_egc_xdst + 0]  
                                 or              esi, eax                                  or              esi, eax
                                 mov             eax, [edx + 4]                                  mov             eax, [edx + 4]
                                   or              eax, [_egc_dst + 4]
                                 not             eax                                  not             eax
                                 and             eax, [_egc_src + 4]                                  and             eax, [_egc_src + 4]
                                 and             eax, [_egc_xdst + 4]  
                                 or              edi, eax                                  or              edi, eax
 egca_ww_ope10e:  
                                 test    bl, 0f0h  
                                 je              egca_ww_ope01e  
                                 not             dword [_egc_src + 0]  
                                 not             dword [_egc_src + 4]  
                                 jmp             egca_ww_ope80s  
 egca_ww_ope01e:  
                                 ret  
   
   
                                 ; ver0.29  
                                 align   4  
 same_srcpat:    and             ecx, 0fffffffeh  
                                 mov             ax, [VIDEOMEMORY + ecx + VRAM_R]  
                                 shl             eax, 16  
                                 mov             ax, [VIDEOMEMORY + ecx + VRAM_B]  
                                 mov             [_egc_dst + 0], eax  
                                 mov             ax, [VIDEOMEMORY + ecx + VRAM_E]  
                                 shl             eax, 16  
                                 mov             ax, [VIDEOMEMORY + ecx + VRAM_G]  
                                 mov             [_egc_dst + 4], eax  
   
                                 xor             esi, esi  egc_ope08:              add             cl, cl
                                 xor             edi, edi                                  jnc             short egc_ope04
                                 mov             bl, byte [_egc + egc_t.ope]  
   
                                 ; src = _egc_src        dst = _egc_dst  
 egca_sm_ope80s: test    bl, 80h  
                                 je              short egca_sm_ope80e  
                                 mov             eax, [_egc_src + 0]                                  mov             eax, [_egc_src + 0]
                                   not             eax
                                   and             eax, [edx + 0]
                                 and             eax, [_egc_dst + 0]                                  and             eax, [_egc_dst + 0]
                                 or              esi, eax                                  or              esi, eax
                                 mov             eax, [_egc_src + 4]                                  mov             eax, [_egc_src + 4]
                                   not             eax
                                   and             eax, [edx + 4]
                                 and             eax, [_egc_dst + 4]                                  and             eax, [_egc_dst + 4]
                                 or              edi, eax                                  or              edi, eax
 egca_sm_ope80e: test    bl, 20h  
                                 je              short egca_sm_ope20e  egc_ope04:              add             cl, cl
                                 mov             eax, [_egc_dst + 0]                                  jnc             short egc_ope02
                                   mov             eax, [edx + 0]
                                   or              eax, [_egc_src + 0]
                                 not             eax                                  not             eax
                                 and             eax, [_egc_src + 0]                                  and             eax, [_egc_dst + 0]
                                 or              esi, eax                                  or              esi, eax
                                 mov             eax, [_egc_dst + 4]                                  mov             eax, [edx + 4]
                                   or              eax, [_egc_src + 4]
                                 not             eax                                  not             eax
                                 and             eax, [_egc_src + 4]                                  and             eax, [_egc_dst + 4]
                                 or              edi, eax                                  or              edi, eax
 egca_sm_ope20e: test    bl, 04h  
                                 je              short egca_sm_ope04e  egc_ope02:              add             cl, cl
                                   jnc             short egc_ope01
                                 mov             eax, [_egc_src + 0]                                  mov             eax, [_egc_src + 0]
                                   or              eax, [_egc_dst + 0]
                                 not             eax                                  not             eax
                                 and             eax, [_egc_dst + 0]                                  and             eax, [edx + 0]
                                 or              esi, eax                                  or              esi, eax
                                 mov             eax, [_egc_src + 4]                                  mov             eax, [_egc_src + 4]
                                   or              eax, [_egc_dst + 4]
                                 not             eax                                  not             eax
                                 and             eax, [_egc_dst + 4]                                  and             eax, [edx + 4]
                                 or              edi, eax                                  or              edi, eax
 egca_sm_ope04e: test    bl, 01h  
                                 je              short egca_sm_ope01e  egc_ope01:              add             cl, cl
                                 mov             eax, [_egc_src + 0]                                  jnc             short egc_ope00
                                   mov             eax, [edx + 0]
                                   or              eax, [_egc_src + 0]
                                 or              eax, [_egc_dst + 0]                                  or              eax, [_egc_dst + 0]
                                 not             eax                                  not             eax
                                 or              esi, eax                                  or              esi, eax
                                 mov             eax, [_egc_src + 4]                                  mov             eax, [edx + 4]
                                   or              eax, [_egc_src + 4]
                                 or              eax, [_egc_dst + 4]                                  or              eax, [_egc_dst + 4]
                                 not             eax                                  not             eax
                                 or              edi, eax                                  or              edi, eax
 egca_sm_ope01e: ret  
   
   egc_ope00:              ret
   
   
                                 align   4  
 egcopec00:              mov             word [_egc + egc_t.srcmask], 0ffffh             ; ver0.29  
 egcope_00:              xor             esi, esi  
                                 mov             edi, esi  
                                 ret  
   
                                 align   4  
 egcopecff:              mov             word [_egc + egc_t.srcmask], 0ffffh             ; ver0.29  
 egcope_ff:              mov             esi, -1  
                                 mov             edi, esi  
                                 ret  
   
                                 align   4  
 egcopecc0:              CPUSRC2DATA  
 egcope_c0:              ; rop:c0 / S*D                                                                  ; ver0.28  
                                 and             ecx, 0fffffffeh  
                                 mov             esi, [_egc_src + 0]  
                                 mov             edi, [_egc_src + 4]  
                                 mov             ax, [VIDEOMEMORY + ecx + VRAM_R]  
                                 shl             eax, 16  
                                 mov             ax, [VIDEOMEMORY + ecx + VRAM_B]  
                                 and             esi, eax  
                                 mov             ax, [VIDEOMEMORY + ecx + VRAM_E]  
                                 shl             eax, 16  
                                 mov             ax, [VIDEOMEMORY + ecx + VRAM_G]  
                                 and             edi, eax  
                                 ret  
   
                                 align   4  
 egcopecf0:              CPUSRC2DATA  
 egcope_f0:              ; rop:f0 / S                                                            ; ver0.28  
                                 mov             esi, [_egc_src + 0]  
                                 mov             edi, [_egc_src + 4]  
                                 ret  
   
                                 align   4  
 egcopecfc:              CPUSRC2DATA  
 egcope_fc:              ; rop:fc / S + (~S*D)                                           ; ver0.28  
                                 and             ecx, 0fffffffeh  
                                 mov             esi, [_egc_src + 0]  
                                 not             esi  
                                 mov             edi, [_egc_src + 4]  
                                 not             edi  
                                 mov             ax, [VIDEOMEMORY + ecx + VRAM_R]  
                                 shl             eax, 16  
                                 mov             ax, [VIDEOMEMORY + ecx + VRAM_B]  
                                 and             esi, eax  
                                 or              esi, [_egc_src + 0]  
                                 mov             ax, [VIDEOMEMORY + ecx + VRAM_E]  
                                 shl             eax, 16  
                                 mov             ax, [VIDEOMEMORY + ecx + VRAM_G]  
                                 and             edi, eax  
                                 or              edi, [_egc_src + 4]  
                                 ret  
   
 section .data  
   
 egcope_func             dd      egcope_00, egcope_xx, egcope_xx, egcope_xx      ; 00  ; ---- byte access
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
   
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx      ; 10  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
   
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx      ; 20  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
   
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx      ; 30  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
   
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx      ; 40  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
   
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx      ; 50  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
   
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx      ; 60  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
   
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx      ; 70  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
   
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx      ; 80  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
   
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx      ; 90  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
   
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx      ; a0  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
   
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx      ; b0  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
   
                                 dd      egcope_c0, egcope_xx, egcope_xx, egcope_xx      ; c0  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
   
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx      ; d0  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
   
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx      ; e0  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
   
                                 dd      egcope_f0, egcope_xx, egcope_xx, egcope_xx      ; f0  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_xx, egcope_xx, egcope_xx, egcope_xx  
                                 dd      egcope_fc, egcope_xx, egcope_xx, egcope_ff  
   
   
                                 ; cpu data copy to srcreg  
                                 dd      egcopec00, egcopecxx, egcopecxx, egcopecxx      ; 00  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
   
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx      ; 10  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
   
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx      ; 20  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
   
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx      ; 30  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
   
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx      ; 40  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
   
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx      ; 50  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
   
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx      ; 60  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
   
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx      ; 70  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
   
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx      ; 80  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
   
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx      ; 90  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
   
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx      ; a0  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
   
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx      ; b0  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
   
                                 dd      egcopecc0, egcopecxx, egcopecxx, egcopecxx      ; c0  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
   
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx      ; d0  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
   
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx      ; e0  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
   
                                 dd      egcopecf0, egcopecxx, egcopecxx, egcopecxx      ; f0  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecxx, egcopecxx, egcopecxx, egcopecxx  
                                 dd      egcopecfc, egcopecxx, egcopecxx, egcopecff  
   
 section .text                                  align   16
   @egca_read@4:
                                 align   4  egc_read:               pushad
 _egca_read:             pushad                                  mov             ebx, ecx
                                   and             ebx, byte 1
                                 cmp             byte [_gdcs + gdcs_t.access], 0                                  cmp             byte [_gdcs + gdcs_t.access], 0
                                 je              short egca_rb_adjed                                  je              short egcr_getvram
                                 add             ecx, VRAM_STEP                                  add             ecx, VRAM_STEP
 egca_rb_adjed:  mov             esi, ecx  egcr_getvram:   mov             ebp, ecx
                                 VRAMPOS esi                                  and             ecx, (VRAM_STEP + 7fffh)
                                 mov             ebp, ecx                                  mov             al, [VIDEOMEMORY + ecx + VRAM_B]
                                 and             ebp, 1                                  mov             ah, [VIDEOMEMORY + ecx + VRAM_R]
                                 mov             al, [VIDEOMEMORY + esi + VRAM_B]                                  mov             dl, [VIDEOMEMORY + ecx + VRAM_G]
                                 mov             ah, [VIDEOMEMORY + esi + VRAM_R]                                  mov             dh, [VIDEOMEMORY + ecx + VRAM_E]
                                 mov             bl, [VIDEOMEMORY + esi + VRAM_G]                                  mov             [_egc + egc_t.lastvram + ebx + 0], al
                                 mov             bh, [VIDEOMEMORY + esi + VRAM_E]                                  mov             [_egc + egc_t.lastvram + ebx + 2], ah
                                 mov             [_egc + egc_t.lastvram + ebp + 0], al                                  mov             [_egc + egc_t.lastvram + ebx + 4], dl
                                 mov             [_egc + egc_t.lastvram + ebp + 2], ah                                  mov             [_egc + egc_t.lastvram + ebx + 6], dh
                                 mov             [_egc + egc_t.lastvram + ebp + 4], bl  
                                 mov             [_egc + egc_t.lastvram + ebp + 6], bh  egcr_setpat:    mov             cl, [_egc + egc_t.ope + 1]
                                 mov             dl, [_egc + egc_t.ope + 1]                                  and             cl, 3
                                 and             dl, 3                                  cmp             cl, 1
                                 cmp             dl, 1                                  jne             short egcr_setsrc
                                 jne             short nostorepat_b                                  mov             [_egc + egc_t.patreg + ebx + 0], al
                                 mov             [_egc + egc_t.patreg + ebp + 0], al                                  mov             [_egc + egc_t.patreg + ebx + 2], ah
                                 mov             [_egc + egc_t.patreg + ebp + 2], ah                                  mov             [_egc + egc_t.patreg + ebx + 4], dl
                                 mov             [_egc + egc_t.patreg + ebp + 4], bl                                  mov             [_egc + egc_t.patreg + ebx + 6], dh
                                 mov             [_egc + egc_t.patreg + ebp + 6], bh  
                                 align   4  egcr_setsrc:    test    byte [_egc + egc_t.ope + 1], 4
 nostorepat_b:   test    byte [_egc + egc_t.ope + 1], 4                                  je              short egcr_shift
                                 je              inputsft_b  
                                 test    byte [_egc + egc_t.ope + 1], 20h                                  test    byte [_egc + egc_t.ope + 1], 20h
                                 jne             short egca_rb_read1                                  jne             short egcr_raw
                                 movzx   ecx, byte [_egc + egc_t.fgbg + 1]                                  movzx   ecx, byte [_egc + egc_t.fgbg + 1]
                                 and             ecx, 3                                  and             ecx, 3
                                 add             esi, [vramoffset + ecx*4]                                  and             ebp, (VRAM_STEP + 7fffh)
                                 mov             al, [VIDEOMEMORY + esi]                                  add             ebp, [vramoffset + ecx*4]
                                 mov             [esp + 28], al                                  jmp             short egcr_raw
                                 popad  
                                 ret  egcr_shift:             mov             esi, [_egc + egc_t.inptr]
                                 align   4                                  mov             [esi + 0], al
 egca_rb_read1:  mov             al, [VIDEOMEMORY + ecx]                                  mov             [esi + 4], ah
                                 mov             [esp + 28], al                                  mov             [esi + 8], dl
                                 popad                                  mov             [esi +12], dh
                                 ret                                  xor             eax, eax
                                 align   4  
 inputsft_b:             mov             edx, [_egc + egc_t.inptr]  
                                 mov             [edx + 0], al  
                                 mov             [edx + 4], ah  
                                 mov             [edx + 8], bl  
                                 mov             [edx +12], bh  
                                 cmp             dword [_egc + egc_t.stack], 16  
                                 ja              short egca_rb_nonstk  
                                 xor             edx, edx  
                                 test    byte [_egc + egc_t.sft + 1], 10h                                  test    byte [_egc + egc_t.sft + 1], 10h
                                 setz    dl                                  setz    al
                                 lea             edx, [edx*2 - 1]                                  lea             eax, [eax*2 - 1]
                                 add             [_egc + egc_t.inptr], edx                                  mov             esi, [_egc + egc_t.func]
                                 cmp             byte [_egc + egc_t.srcbit], 0                                  add             esi, byte 6
                                 je              short egca_rb_adds                                  call    shiftinput_b                                    ;; !!
                                 btr             word [_egc + egc_t.srcbit], 3  
                                 jc              short egca_rb_nonstk  
                                 xor             edx, edx  
                                 xchg    [_egc + egc_t.srcbit], dl  
                                 sub             [_egc + egc_t.stack], edx  
 egca_rb_adds:   add             dword [_egc + egc_t.stack], 8  
 egca_rb_nonstk: mov             edi, ecx  
                                 mov             ecx, [_egc + egc_t.func]  
                                 call    dword [egcsft_proc + ecx*4 + 6*4]  
                                 test    byte [_egc + egc_t.ope + 1], 20h                                  test    byte [_egc + egc_t.ope + 1], 20h
                                 jne             short egca_rb_read0                                  jne             short egcr_raw
                                 movzx   ecx, byte [_egc + egc_t.fgbg + 1]                                  movzx   ecx, byte [_egc + egc_t.fgbg + 1]
                                 and             ecx, 3                                  and             ecx, 3
                                 mov             al, [_egc_src + ecx*2 + ebp]                                  mov             al, [_egc_src + ecx*2 + ebx]
                                 mov             [esp + 28], al                                  mov             [esp + 28], al
                                 popad                                  popad
                                 ret                                  ret
                                 align   4  
 egca_rb_read0:  mov             al, [VIDEOMEMORY + edi]  egcr_raw:               mov             al, [VIDEOMEMORY + ebp]
                                 mov             [esp + 28], al                                  mov             [esp + 28], al
                                 popad                                  popad
                                 ret                                  ret
   
   
                                 align   4                                  align   16
 _egca_read_w:   pushad  @egca_write@8:
   egc_write:              pushad
                                   mov             dh, dl
   egc_write_m:    mov             ebx, ecx
                                   and             ebx, byte 1
                                   and             ecx, 7fffh
                                   mov             ebp, ecx
                                   cmp             byte [_gdcs + gdcs_t.access], 0
                                   jne             short egcw_pln1
                                   or              byte [_gdcs + gdcs_t.grphdisp], 1
                                   or              byte [_vramupdate + ecx], 01h
                                   jmp             short egcw_setpat
   egcw_pln1:              or              byte [_gdcs + gdcs_t.grphdisp], 2
                                   or              byte [_vramupdate + ecx], 02h
                                   add             ebp, VRAM_STEP
   egcw_setpat:    mov             al, [_egc + egc_t.ope + 1]
                                   and             al, 3
                                   cmp             al, 2
                                   jne             short egcw_calc
                                   mov             al, [VIDEOMEMORY + ebp + VRAM_B]
                                   mov             [_egc + egc_t.patreg + ebx + 0], al
                                   mov             al, [VIDEOMEMORY + ebp + VRAM_R]
                                   mov             [_egc + egc_t.patreg + ebx + 2], al
                                   mov             al, [VIDEOMEMORY + ebp + VRAM_G]
                                   mov             [_egc + egc_t.patreg + ebx + 4], al
                                   mov             al, [VIDEOMEMORY + ebp + VRAM_E]
                                   mov             [_egc + egc_t.patreg + ebx + 6], al
   egcw_calc:              mov             esi, [_egc + egc_t.func]
                                   add             esi, byte 6
                                   call    egc_mod
                                   mov             ah, [_egc + egc_t.mask2 + ebx]
                                   test    ah, ah
                                   je              short egcw_ed
                                   mov             dh, ah
                                   not             dh
                                   add             ecx, ebx
                                   mov             dl, [_egc + egc_t.access]
   egcw_wb:                shr             dl, 1
                                   jc              short egcw_wr
                                   and             [VIDEOMEMORY + ebx + VRAM_B], dh
                                   mov             al, [ecx]
                                   and             al, ah
                                   or              [VIDEOMEMORY + ebx + VRAM_B], al
   egcw_wr:                shr             dl, 1
                                   jc              short egcw_wg
                                   and             [VIDEOMEMORY + ebx + VRAM_R], dh
                                   mov             al, [ecx + 2]
                                   and             al, ah
                                   or              [VIDEOMEMORY + ebx + VRAM_R], al
   egcw_wg:                shr             dl, 1
                                   jc              short egcw_we
                                   and             [VIDEOMEMORY + ebx + VRAM_G], dh
                                   mov             al, [ecx + 4]
                                   and             al, ah
                                   or              [VIDEOMEMORY + ebx + VRAM_G], al
   egcw_we:                shr             dl, 1
                                   jc              short egcw_ed
                                   and             [VIDEOMEMORY + ebx + VRAM_E], dh
                                   mov             al, [ecx + 6]
                                   and             al, ah
                                   or              [VIDEOMEMORY + ebx + VRAM_E], al
   egcw_ed:                popad
                                   ret
   
   
   ; ---- word access
   
                                   align   16
   @egca_read_w@4:
   egc_read_w:             test    cl, 1
                                   jne             near egcrw_odd
                                   pushad
                                 cmp             byte [_gdcs + gdcs_t.access], 0                                  cmp             byte [_gdcs + gdcs_t.access], 0
                                 je              short egca_rw_adjed                                  je              short egcrw_getvram
                                 add             ecx, VRAM_STEP                                  add             ecx, VRAM_STEP
 egca_rw_adjed:  egcrw_getvram:  mov             ebp, ecx
                                 mov             esi, ecx                                  and             ecx, (VRAM_STEP + 7fffh)
                                 VRAMPOS esi                                  mov             bx, [VIDEOMEMORY + ecx + VRAM_B]
                                 mov             eax, [VIDEOMEMORY + esi + VRAM_R - 2]                                  mov             dx, [VIDEOMEMORY + ecx + VRAM_R]
                                 mov             ebp, [VIDEOMEMORY + esi + VRAM_E - 2]                                  mov             si, [VIDEOMEMORY + ecx + VRAM_G]
                                 mov              ax, [VIDEOMEMORY + esi + VRAM_B]                                  mov             di, [VIDEOMEMORY + ecx + VRAM_E]
                                 mov              bp, [VIDEOMEMORY + esi + VRAM_G]                                  mov             [_egc + egc_t.lastvram + 0], bx
                                 mov             [_egc + egc_t.lastvram + 0], eax                                  mov             [_egc + egc_t.lastvram + 2], dx
                                 mov             [_egc + egc_t.lastvram + 4], ebp                                  mov             [_egc + egc_t.lastvram + 4], si
                                 mov             dl, [_egc + egc_t.ope + 1]                                  mov             [_egc + egc_t.lastvram + 6], di
                                 and             dl, 3  
                                 cmp             dl, 1  egcrw_setpat:   mov             cl, [_egc + egc_t.ope + 1]
                                 jne             short nostorepat_w                                  and             cl, 3
                                 mov             [_egc + egc_t.patreg + 0], eax                                  cmp             cl, 1
                                 mov             [_egc + egc_t.patreg + 4], ebp                                  jne             short egcrw_setsrc
                                 align   4                                  mov             [_egc + egc_t.patreg + 0], bx
 nostorepat_w:   test    byte [_egc + egc_t.ope + 1], 4                                  mov             [_egc + egc_t.patreg + 2], dx
                                 je              inputsft_w                                  mov             [_egc + egc_t.patreg + 4], si
                                   mov             [_egc + egc_t.patreg + 6], di
   
   egcrw_setsrc:   test    byte [_egc + egc_t.ope + 1], 4
                                   je              short egcrw_shift
   
                                 test    byte [_egc + egc_t.ope + 1], 20h                                  test    byte [_egc + egc_t.ope + 1], 20h
                                 jne             short egca_rw_read1                                  jne             short egcrw_raw
                                 movzx   ecx, byte [_egc + egc_t.fgbg + 1]                                  movzx   ecx, byte [_egc + egc_t.fgbg + 1]
                                 and             ecx, 3                                  and             ecx, 3
                                 add             esi, [vramoffset + ecx*4]                                  and             ebp, (VRAM_STEP + 7fffh)
                                 mov             ax, [VIDEOMEMORY + esi]                                  add             ebp, [vramoffset + ecx*4]
                                 mov             [esp + 28], ax                                  jmp             short egcrw_raw
                                 popad  
                                 ret  egcrw_shift:    mov             ecx, [_egc + egc_t.inptr]
                                 align   4                                  xor             eax, eax
 egca_rw_read1:  mov             ax, [VIDEOMEMORY + ecx]  
                                 mov             [esp + 28], ax  
                                 popad  
                                 ret  
                                 align   4  
 inputsft_w:             mov             edi, ecx  
                                 mov             edx, [_egc + egc_t.inptr]  
                                 xor             ebx, ebx  
                                 test    byte [_egc + egc_t.sft + 1], 10h                                  test    byte [_egc + egc_t.sft + 1], 10h
                                 setnz   bl                                  setz    al
                                 sub             edx, ebx                                  lea             ecx, [ecx + eax - 1]
                                 cmp             dword [_egc + egc_t.stack], 16                                  mov             [ecx + 0], bx
                                 ja              short egca_rw_nonstk                                  mov             [ecx + 4], dx
                                 lea             ebx, [ebx*4 - 2]                                  mov             [ecx + 8], si
                                 sub             [_egc + egc_t.inptr], ebx                                  mov             [ecx +12], di
                                 add             dword [_egc + egc_t.stack], 16                                  lea             eax, [eax*2 - 1]
                                 cmp             byte [_egc + egc_t.srcbit], 0                                  xor             ebx, ebx
                                 je              short egca_rw_nonstk                                  mov             esi, [_egc + egc_t.func]
                                 xor             ecx, ecx                                  call    shiftinput_w                                    ;; !!
                                 xchg    [_egc + egc_t.srcbit], cl  
                                 sub             [_egc + egc_t.stack], cl                ; byte¤ا°ْ¤¤¤ئ¤â¤¤¤¤ب¦  
                                 cmp             cl, 8  
                                 jb              short egca_rw_nonstk  
                                 sar             ebx, 1  
                                 sub             [_egc + egc_t.outptr], ebx  
 egca_rw_nonstk: mov             [edx + 0], ax  
                                 shr             eax, 16  
                                 mov             [edx + 8], bp  
                                 shr             ebp, 16  
                                 mov             [edx + 4], ax  
                                 mov             [edx +12], bp  
                                 mov             ecx, [_egc + egc_t.func]  
                                 call    dword [egcsft_proc + ecx*4]  
                                 test    byte [_egc + egc_t.ope + 1], 20h                                  test    byte [_egc + egc_t.ope + 1], 20h
                                 jne             short egca_rw_read0                                  jne             short egcrw_raw
                                 movzx   ecx, byte [_egc + egc_t.fgbg + 1]                                  movzx   ecx, byte [_egc + egc_t.fgbg + 1]
                                 and             ecx, 3                                  and             ecx, 3
                                 mov             ax, [_egc_src + ecx*2]                                  mov             ax, [_egc_src + ecx*2]
                                 mov             [esp + 28], ax                                  mov             [esp + 28], ax
                                 popad                                  popad
                                 ret                                  ret
                                 align   4  
 egca_rw_read0:  mov             ax, [VIDEOMEMORY + edi]  egcrw_raw:              mov             ax, [VIDEOMEMORY + ebp]
                                 mov             [esp + 28], ax                                  mov             [esp + 28], ax
                                 popad                                  popad
                                 ret                                  ret
   
   
   
                                 align   4                                  align   4
 _egca_write:    pushad  egcrw_odd:              test    byte [_egc + egc_t.sft + 1], 10h
                                 mov             dh, dl                                  jne             short egcrw_oddr
 egca_write_m:   and             ecx, 7fffh                                  call    egc_read
                                 mov             ebp, ecx                                  mov             ah, al
                                 and             ebp, 1                                  inc             ecx
                                 cmp             byte [_gdcs + gdcs_t.access], 0                                  call    egc_read
                                 jne             short egca_wb_pln1                                  dec             ecx
                                 or              byte [_gdcs + gdcs_t.grphdisp], 1                                  xchg    al, ah
                                 or              byte [_vramupdate + ecx], 01h  
                                 jmp             short egca_wb_plned  
 egca_wb_pln1:   or              byte [_gdcs + gdcs_t.grphdisp], 2  
                                 or              byte [_vramupdate + ecx], 02h  
                                 add             ecx, VRAM_STEP  
 egca_wb_plned:  mov             al, [_egc + egc_t.ope + 1]  
                                 and             al, 3  
                                 cmp             al, 2  
                                 jne             short egca_wb_pated  
                                 mov             al, [VIDEOMEMORY + ecx + VRAM_B]  
                                 mov             [_egc + egc_t.patreg + ebp + 0], al  
                                 mov             al, [VIDEOMEMORY + ecx + VRAM_R]  
                                 mov             [_egc + egc_t.patreg + ebp + 2], al  
                                 mov             al, [VIDEOMEMORY + ecx + VRAM_G]  
                                 mov             [_egc + egc_t.patreg + ebp + 4], al  
                                 mov             al, [VIDEOMEMORY + ecx + VRAM_E]  
                                 mov             [_egc + egc_t.patreg + ebp + 6], al  
 egca_wb_pated:  mov             ax, [_egc + egc_t.mask]  
                                 mov             [_egc + egc_t.mask2], ax  
                                 mov             al, [_egc + egc_t.ope + 1]  
                                 and             al, 18h  
                                 je              short egca_wb_dat                                       ; al=00h  
                                 cmp             al, 10h  
                                 jc              short egca_wb_src                                       ; al=08h  
                                                                                                                         ; ver0.28  
                                 ja              short egca_wb_dat                                       ; al=18h  
   
 egca_wb_pat:    mov             al, [_egc + egc_t.fgbg + 1]  
                                 and             al, 60h  
                                 je              short egca_wb_pat0  
                                 cmp             al, 40h  
                                 mov             ebx, _egc + egc_t.bgc                           ; !!!  
                                 jc              short egca_wb_pate  
                                 jne             short egca_wb_pat0  
                                 mov             ebx, _egc + egc_t.fgc                           ; !!!  
 egca_wb_pate:   jmp             egca_wb_srcout  
 egca_wb_pat0:   ; !!!! todo!  
   
                                 mov             ebx, _egc + egc_t.patreg  
                                 jmp             egca_wb_srcout  
   
 egca_wb_dat:    mov             ebx, _egc_data  
                                 mov             [ebx + 0], dx  
                                 mov             [ebx + 2], dx  
                                 mov             [ebx + 4], dx  
                                 mov             [ebx + 6], dx  
                                 jmp             egca_wb_srcout  
   
 egca_wb_src:    mov             esi, [_egc + egc_t.func]  
                                 add             esi, 6  
                                 movzx   eax, byte [_egc + egc_t.ope]  
                                 test    byte [_egc + egc_t.ope + 1], 4  
                                 setne   ah  
                                 push    ecx                                                                     ; ver0.28  
                                 call    dword [egcope_func + eax*4]  
                                 mov             ax, [_egc + egc_t.srcmask]  
                                 and             [_egc + egc_t.mask2], ax  
                                 pop             ecx  
   
                                 mov             [_egc_data + 0], esi  
                                 mov             [_egc_data + 4], edi  
                                 mov             ebx, _egc_data  
   
 egca_wb_srcout:  
                                 mov             ah, [_egc + egc_t.mask2 + ebp]  
                                 test    ah, ah  
                                 je              near egca_wb_ee  
                                 mov             dh, ah  
                                 not             dh  
                                 add             ebx, ebp  
                                 mov             dl, [_egc + egc_t.access]  
                                 shr             dl, 1  
                                 jc              short egca_wb_be  
                                 and             [VIDEOMEMORY + ecx + VRAM_B], dh  
                                 mov             al, [ebx]  
                                 and             al, ah  
                                 or              [VIDEOMEMORY + ecx + VRAM_B], al  
 egca_wb_be:             shr             dl, 1  
                                 jc              short egca_wb_re  
                                 and             [VIDEOMEMORY + ecx + VRAM_R], dh  
                                 mov             al, [ebx + 2]  
                                 and             al, ah  
                                 or              [VIDEOMEMORY + ecx + VRAM_R], al  
 egca_wb_re:             shr             dl, 1  
                                 jc              short egca_wb_ge  
                                 and             [VIDEOMEMORY + ecx + VRAM_G], dh  
                                 mov             al, [ebx + 4]  
                                 and             al, ah  
                                 or              [VIDEOMEMORY + ecx + VRAM_G], al  
 egca_wb_ge:             shr             dl, 1  
                                 jc              short egca_wb_ee  
                                 and             [VIDEOMEMORY + ecx + VRAM_E], dh  
                                 mov             al, [ebx + 6]  
                                 and             al, ah  
                                 or              [VIDEOMEMORY + ecx + VRAM_E], al  
 egca_wb_ee:             popad  
                                 ret                                  ret
   egcrw_oddr:             inc             ecx
                                   call    egc_read
                                   dec             ecx
                                   mov             ah, al
                                   jmp             egc_read
   
   
                                 align   16                                  align   16
 _egca_write_w:  test    ecx, 1                                                          ; ver0.28  @egca_write_w@8:
                                 jne             near egca_writeodd  egc_write_w:    test    cl, 1
                                   jne             near egcww_odd
                                 pushad                                  pushad
                                 and             ecx, 7ffeh                                  xor             ebx, ebx
                                   and             ecx, 7fffh
                                   mov             ebp, ecx
                                 cmp             byte [_gdcs + gdcs_t.access], 0                                  cmp             byte [_gdcs + gdcs_t.access], 0
                                 jne             short egca_ww_pln1                                  jne             short egcww_pln1
                                 or              byte [_gdcs + gdcs_t.grphdisp], 1                                  or              byte [_gdcs + gdcs_t.grphdisp], 1
                                 or              word [_vramupdate + ecx], 0101h                                  or              word [_vramupdate + ecx], 0101h
                                 jmp             short egca_ww_plned                                  jmp             short egcww_setpat
 egca_ww_pln1:   or              byte [_gdcs + gdcs_t.grphdisp], 2  egcww_pln1:             or              byte [_gdcs + gdcs_t.grphdisp], 2
                                 or              word [_vramupdate + ecx], 0202h                                  or              word [_vramupdate + ecx], 0202h
                                 add             ecx, VRAM_STEP                                  add             ebp, VRAM_STEP
 egca_ww_plned:  mov             al, [_egc + egc_t.ope + 1]  egcww_setpat:   mov             al, [_egc + egc_t.ope + 1]
                                 and             al, 3                                  and             al, 3
                                 cmp             al, 2                                  cmp             al, 2
                                 jne             short egca_ww_pated                                  jne             short egcww_calc
                                 mov             ax, [VIDEOMEMORY + ecx + VRAM_B]                                  mov             ax, [VIDEOMEMORY + ebp + VRAM_B]
                                 mov             [_egc + egc_t.patreg + 0], ax                                  mov             [_egc + egc_t.patreg + 0], ax
                                 mov             ax, [VIDEOMEMORY + ecx + VRAM_R]                                  mov             ax, [VIDEOMEMORY + ebp + VRAM_R]
                                 mov             [_egc + egc_t.patreg + 2], ax                                  mov             [_egc + egc_t.patreg + 2], ax
                                 mov             ax, [VIDEOMEMORY + ecx + VRAM_G]                                  mov             ax, [VIDEOMEMORY + ebp + VRAM_G]
                                 mov             [_egc + egc_t.patreg + 4], ax                                  mov             [_egc + egc_t.patreg + 4], ax
                                 mov             ax, [VIDEOMEMORY + ecx + VRAM_E]                                  mov             ax, [VIDEOMEMORY + ebp + VRAM_E]
                                 mov             [_egc + egc_t.patreg + 6], ax                                  mov             [_egc + egc_t.patreg + 6], ax
 egca_ww_pated:  mov             ax, [_egc + egc_t.mask]  egcww_calc              mov             esi, [_egc + egc_t.func]
                                 mov             [_egc + egc_t.mask2], ax                                  call    egc_mod
                                 mov             al, [_egc + egc_t.ope + 1]                                  mov             si, [_egc + egc_t.mask2]
                                 and             al, 18h  
                                 je              short egca_ww_dat  
                                 cmp             al, 10h  
                                 ja              short egca_ww_dat  
                                 je              short egca_ww_pat  
 egca_ww_src:    mov             esi, [_egc + egc_t.func]  
                                 movzx   eax, byte [_egc + egc_t.ope]  
                                 test    byte [_egc + egc_t.ope + 1], 4  
                                 setne   ah  
                                 call    dword [egcope_func + eax*4]  
                                 mov             ax, [_egc + egc_t.srcmask]  
                                 and             [_egc + egc_t.mask2], ax  
                                 mov             [_egc_data + 0], esi  
                                 mov             [_egc_data + 4], edi  
                                 mov             ebx, _egc_data  
                                 jmp             egca_ww_srcout  
                                 align   4  
 egca_ww_dat:    mov             ebx, _egc_data  
                                 mov             [ebx + 0], dx  
                                 mov             [ebx + 2], dx  
                                 mov             [ebx + 4], dx  
                                 mov             [ebx + 6], dx  
                                 jmp             egca_ww_srcout  
                                 align   4  
 egca_ww_pat:    mov             al, [_egc + egc_t.fgbg + 1]  
                                 and             al, 60h  
                                 je              short egca_ww_pat0  
                                 cmp             al, 40h  
                                 mov             ebx, _egc + egc_t.bgc                           ; !!!  
                                 jne             short egca_ww_pat0  
                                 jc              short egca_ww_pate  
                                 mov             ebx, _egc + egc_t.fgc                           ; !!!  
 egca_ww_pate:   jmp             egca_ww_srcout  
                                 align   4  
 egca_ww_pat0:   mov             ebx, [_egc + egc_t.inptr]                       ; ver0.28  
                                 xor             eax, eax  
                                 test    byte [_egc + egc_t.sft + 1], 10h  
                                 setnz   al  
                                 sub             ebx, eax  
                                 mov             [ebx + 0], dx  
                                 mov             [ebx + 4], dx  
                                 mov             [ebx + 8], dx  
                                 mov             [ebx +12], dx  
                                 cmp             dword [_egc + egc_t.stack], 16  
                                 ja              short egca_ww_pwe  
                                 lea             eax, [eax*2 - 1]  
                                 sub             [_egc + egc_t.inptr], eax  
                                 cmp             byte [_egc + egc_t.srcbit], 0  
                                 je              short egca_ww_pw1  
                                 xor             edx, edx  
                                 xchg    [_egc + egc_t.srcbit], dl  
                                 cmp             dl, 8  
                                 jb              short egca_ww_pw0  
                                 sub             [_egc + egc_t.outptr], eax  
 egca_ww_pw0:    sub             [_egc + egc_t.stack], edx  
 egca_ww_pw1:    add             dword [_egc + egc_t.stack], 16  
                                 sub             [_egc + egc_t.inptr], eax  
 egca_ww_pwe:    push    ecx  
                                 mov             ecx, [_egc + egc_t.func]  
                                 call    dword [egcsft_proc + ecx*4]  
                                 pop             ecx  
                                 mov             ebx, _egc_src  
                                 align   4  
 egca_ww_srcout: mov             si, [_egc + egc_t.mask2]  
                                 test    si, si                                  test    si, si
                                 je              near egca_ww_ee                                  je              short egcww_ed
                                 mov             di, si                                  mov             di, si
                                 not             di                                  not             di
                                 mov             dl, [_egc + egc_t.access]                                  mov             dl, [_egc + egc_t.access]
                                 shr             dl, 1  egcww_wb:               shr             dl, 1
                                 jc              short egca_ww_be                                  jc              short egcww_wr
                                 and             [VIDEOMEMORY + ecx + VRAM_B], di                                  and             [VIDEOMEMORY + ebp + VRAM_B], di
                                 mov             ax, [ebx]                                  mov             ax, [ecx + 0]
                                 and             ax, si                                  and             ax, si
                                 or              [VIDEOMEMORY + ecx + VRAM_B], ax                                  or              [VIDEOMEMORY + ebp + VRAM_B], ax
 egca_ww_be:             shr             dl, 1  egcww_wr:               shr             dl, 1
                                 jc              short egca_ww_re                                  jc              short egcww_wg
                                 and             [VIDEOMEMORY + ecx + VRAM_R], di                                  and             [VIDEOMEMORY + ebp + VRAM_R], di
                                 mov             ax, [ebx + 2]                                  mov             ax, [ecx + 2]
                                 and             ax, si                                  and             ax, si
                                 or              [VIDEOMEMORY + ecx + VRAM_R], ax                                  or              [VIDEOMEMORY + ebp + VRAM_R], ax
 egca_ww_re:             shr             dl, 1  egcww_wg:               shr             dl, 1
                                 jc              short egca_ww_ge                                  jc              short egcww_we
                                 and             [VIDEOMEMORY + ecx + VRAM_G], di                                  and             [VIDEOMEMORY + ebp + VRAM_G], di
                                 mov             ax, [ebx + 4]                                  mov             ax, [ecx + 4]
                                 and             ax, si                                  and             ax, si
                                 or              [VIDEOMEMORY + ecx + VRAM_G], ax                                  or              [VIDEOMEMORY + ebp + VRAM_G], ax
 egca_ww_ge:             shr             dl, 1  egcww_we:               shr             dl, 1
                                 jc              short egca_ww_ee                                  jc              short egcww_ed
                                 and             [VIDEOMEMORY + ecx + VRAM_E], di                                  and             [VIDEOMEMORY + ebp + VRAM_E], di
                                 mov             ax, [ebx + 6]                                  mov             ax, [ecx + 6]
                                 and             ax, si                                  and             ax, si
                                 or              [VIDEOMEMORY + ecx + VRAM_E], ax                                  or              [VIDEOMEMORY + ebp + VRAM_E], ax
 egca_ww_ee:             popad  egcww_ed:               popad
                                 ret                                  ret
   
                                 align   16                                  align   4
 egca_writeodd:  test    byte [_egc + egc_t.sft + 1], 10h  egcww_odd:              test    byte [_egc + egc_t.sft + 1], 10h
                                 je              egca_writeoddr                                  jne             short egcww_oddr
                                 push    dword _egca_write                                  call    egc_write
                                 pushad                                  pushad
                                 inc             ecx                                  inc             ecx
                                 mov             dl, dh                                  mov             dl, dh
                                 jmp             egca_write_m                                  jmp             egc_write_m
   egcww_oddr:             push    dword egc_write
 egca_writeoddr: call    _egca_write  
                                 pushad                                  pushad
                                 inc             ecx                                  inc             ecx
                                 mov             dl, dh                                  mov             dl, dh
                                 jmp             egca_write_m                                  jmp             egc_write_m
   
   
         ends          ends
   

Removed from v.1.2  
changed lines
  Added in v.1.3


RetroPC.NET-CVS <cvs@retropc.net>