|
|
| version 1.1, 2005/02/08 09:19:00 | version 1.2, 2005/03/11 15:12:57 |
|---|---|
| Line 18 section .bss | Line 18 section .bss |
| global _egcshift | global _egcshift |
| global @memegc_rd8@4 | global @egc_readbyte@4 |
| global @memegc_wr8@8 | global @egc_writebyte@8 |
| global @memegc_rd16@4 | global @egc_readword@4 |
| global @memegc_wr16@8 | global @egc_writeword@8 |
| global egc_read | global egc_read |
| global egc_write | global egc_write |
| Line 36 section .bss | Line 36 section .bss |
| VIDEOMEMORY equ _mem | VIDEOMEMORY equ _mem |
| section .data | section .rdata |
| egcmask_ua db 0ffh, 07fh, 03fh, 01fh, 00fh, 007h, 003h, 001h | egcmask_ua db 0ffh, 07fh, 03fh, 01fh, 00fh, 007h, 003h, 001h |
| db 0feh, 07eh, 03eh, 01eh, 00eh, 006h, 002h, 000h | db 0feh, 07eh, 03eh, 01eh, 00eh, 006h, 002h, 000h |
| Line 71 _egcshift: mov eax, [_egc + egc_t.leng | Line 71 _egcshift: mov eax, [_egc + egc_t.leng |
| mov eax, [_egc + egc_t.sft] | mov eax, [_egc + egc_t.sft] |
| mov edx, _egc + egc_t.buf | mov edx, _egc + egc_t.buf |
| test ah, 10h | test ah, 10h |
| je egsft_dircalced | je short .dircalced |
| add edx, 512 + 3 | add edx, 512 + 3 |
| egsft_dircalced:mov [_egc + egc_t.inptr], edx | .dircalced: mov [_egc + egc_t.inptr], edx |
| mov [_egc + egc_t.outptr], edx | mov [_egc + egc_t.outptr], edx |
| and dword [_egc + egc_t.stack], byte 0 | and dword [_egc + egc_t.stack], byte 0 |
| and edx, byte 1 | and edx, byte 1 |
| Line 84 egsft_dircalced:mov [_egc + egc_t.inptr | Line 84 egsft_dircalced:mov [_egc + egc_t.inptr |
| 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 .funcrst ; srcbit == dstbit |
| jc short egsft_difm | jc short .difm |
| add edx, byte 4 ; srcbit > dstbit | add edx, byte 4 ; srcbit > dstbit |
| jmp short egsft_difcal | jmp short .difcal |
| egsft_difm: add edx, byte 2 ; srcbit < dstbit | .difm: add edx, byte 2 ; srcbit < dstbit |
| add al, 8 | add al, 8 |
| egsft_difcal: mov [_egc + egc_t.sft8bitl], al | .difcal: 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: mov [_egc + egc_t.func], edx | .funcrst: mov [_egc + egc_t.func], edx |
| ret | ret |
| Line 159 egcsftb_upl_sub: | Line 159 egcsftb_upl_sub: |
| test al, al | test al, al |
| jne short estb_upls_db | jne short estb_upls_db |
| sub dword [_egc + egc_t.remain], 8 | sub dword [_egc + egc_t.remain], byte 8 |
| jnc short estb_upls_cal | jnc short estb_upls_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, [egcmask_ub + edx] |
| jmp short estb_upls_msk | jmp short estb_upls_msk |
| Line 221 egcsftb_upr_sub: | Line 221 egcsftb_upr_sub: |
| jne short estb_uprs_db | jne short estb_uprs_db |
| inc dword [_egc + egc_t.outptr] | inc dword [_egc + egc_t.outptr] |
| sub dword [_egc + egc_t.remain], 8 | sub dword [_egc + egc_t.remain], byte 8 |
| jnc short estb_uprs_cal | jnc short estb_uprs_cal |
| xchg eax, [_egc + egc_t.remain] | xchg eax, [_egc + egc_t.remain] |
| add eax, 8 - 1 | add eax, byte (8 - 1) |
| mov al, [egcmask_ub + eax] | mov al, [egcmask_ub + eax] |
| jmp short estb_uprs_msk | jmp short estb_uprs_msk |
| Line 274 egcsftb_dnn_sub: | Line 274 egcsftb_dnn_sub: |
| test al, al | test al, al |
| jne short estb_dnns_db | jne short estb_dnns_db |
| sub dword [_egc + egc_t.remain], 8 | sub dword [_egc + egc_t.remain], byte 8 |
| jnc short estb_dnns_cal | jnc short estb_dnns_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_db + edx] | mov al, [egcmask_db + edx] |
| jmp short estb_dnns_msk | jmp short estb_dnns_msk |
| Line 330 egcsftb_dnl_sub: | Line 330 egcsftb_dnl_sub: |
| test al, al | test al, al |
| jne short estb_dnls_db | jne short estb_dnls_db |
| sub dword [_egc + egc_t.remain], 8 | sub dword [_egc + egc_t.remain], byte 8 |
| jnc short estb_dnls_cal | jnc short estb_dnls_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_db + edx] | mov al, [egcmask_db + edx] |
| jmp short estb_dnls_msk | jmp short estb_dnls_msk |
| Line 391 egcsftb_dnr_sub: | Line 391 egcsftb_dnr_sub: |
| test al, al | test al, al |
| jne short estb_dnrs_db | jne short estb_dnrs_db |
| dec dword [_egc + egc_t.outptr] | dec dword [_egc + egc_t.outptr] |
| sub dword [_egc + egc_t.remain], 8 | sub dword [_egc + egc_t.remain], byte 8 |
| jnc short estb_dnrs_cal | jnc short estb_dnrs_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_db + edx] | mov al, [egcmask_db + edx] |
| jmp short estb_dnrs_msk | jmp short estb_dnrs_msk |
| Line 664 eow_setdat: mov ecx, _egc_data | Line 664 eow_setdat: mov ecx, _egc_data |
| ; make pattern... | ; make pattern... |
| egc_opesub: mov al, [_egc + egc_t.fgbg + 1] | egc_opesub: mov al, [_egc + egc_t.fgbg + 1] |
| and al, 60h | and al, 60h |
| jpe short eo_opesrc | jpe short .opesrc |
| mov edx, _egc + egc_t.bgc | mov edx, _egc + egc_t.bgc |
| cmp al, 20h | cmp al, 20h |
| je short eo_loadvram | je short .loadvram |
| mov edx, _egc + egc_t.fgc | mov edx, _egc + egc_t.fgc |
| jmp short eo_loadvram | jmp short .loadvram |
| eo_opesrc: mov al, [_egc + egc_t.ope + 1] | .opesrc: mov al, [_egc + egc_t.ope + 1] |
| and al, 3 | and al, 3 |
| cmp al, 1 | cmp al, 1 |
| mov edx, _egc_src | mov edx, _egc_src |
| je short eo_loadvram | je short .loadvram |
| mov edx, _egc + egc_t.patreg | mov edx, _egc + egc_t.patreg |
| eo_loadvram: mov ax, [VIDEOMEMORY + ebp + VRAM_R] | .loadvram: mov ax, [VIDEOMEMORY + ebp + VRAM_R] |
| shl eax, 16 | shl eax, 16 |
| mov ax, [VIDEOMEMORY + ebp + VRAM_B] | mov ax, [VIDEOMEMORY + ebp + VRAM_B] |
| mov [_egc_dst + 0], eax | mov [_egc_dst + 0], eax |
| Line 692 eo_loadvram: mov ax, [VIDEOMEMORY + ebp | Line 692 eo_loadvram: mov ax, [VIDEOMEMORY + ebp |
| mov cl, 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 |
| egc_ope80: add cl, cl | .ope80: add cl, cl |
| jnc short egc_ope40 | jnc short .ope40 |
| mov eax, [edx + 0] | mov eax, [edx + 0] |
| and eax, [_egc_src + 0] | and eax, [_egc_src + 0] |
| and eax, [_egc_dst + 0] | and eax, [_egc_dst + 0] |
| Line 703 egc_ope80: add cl, cl | Line 703 egc_ope80: add cl, cl |
| and eax, [_egc_dst + 4] | and eax, [_egc_dst + 4] |
| or edi, eax | or edi, eax |
| egc_ope40: add cl, cl | .ope40: add cl, cl |
| jnc short egc_ope20 | jnc short .ope20 |
| mov eax, [edx + 0] | mov eax, [edx + 0] |
| not eax | not eax |
| and eax, [_egc_src + 0] | and eax, [_egc_src + 0] |
| Line 716 egc_ope40: add cl, cl | Line 716 egc_ope40: add cl, cl |
| and eax, [_egc_dst + 4] | and eax, [_egc_dst + 4] |
| or edi, eax | or edi, eax |
| egc_ope20: add cl, cl | .ope20: add cl, cl |
| jnc short egc_ope10 | jnc short .ope10 |
| mov eax, [_egc_dst + 0] | mov eax, [_egc_dst + 0] |
| not eax | not eax |
| and eax, [edx + 0] | and eax, [edx + 0] |
| Line 729 egc_ope20: add cl, cl | Line 729 egc_ope20: add cl, cl |
| and eax, [_egc_src + 4] | and eax, [_egc_src + 4] |
| or edi, eax | or edi, eax |
| egc_ope10: add cl, cl | .ope10: add cl, cl |
| jnc short egc_ope08 | jnc short .ope08 |
| mov eax, [edx + 0] | mov eax, [edx + 0] |
| or eax, [_egc_dst + 0] | or eax, [_egc_dst + 0] |
| not eax | not eax |
| Line 742 egc_ope10: add cl, cl | Line 742 egc_ope10: add cl, cl |
| and eax, [_egc_src + 4] | and eax, [_egc_src + 4] |
| or edi, eax | or edi, eax |
| egc_ope08: add cl, cl | .ope08: add cl, cl |
| jnc short egc_ope04 | jnc short .ope04 |
| mov eax, [_egc_src + 0] | mov eax, [_egc_src + 0] |
| not eax | not eax |
| and eax, [edx + 0] | and eax, [edx + 0] |
| Line 755 egc_ope08: add cl, cl | Line 755 egc_ope08: add cl, cl |
| and eax, [_egc_dst + 4] | and eax, [_egc_dst + 4] |
| or edi, eax | or edi, eax |
| egc_ope04: add cl, cl | .ope04: add cl, cl |
| jnc short egc_ope02 | jnc short .ope02 |
| mov eax, [edx + 0] | mov eax, [edx + 0] |
| or eax, [_egc_src + 0] | or eax, [_egc_src + 0] |
| not eax | not eax |
| Line 768 egc_ope04: add cl, cl | Line 768 egc_ope04: add cl, cl |
| and eax, [_egc_dst + 4] | and eax, [_egc_dst + 4] |
| or edi, eax | or edi, eax |
| egc_ope02: add cl, cl | .ope02: add cl, cl |
| jnc short egc_ope01 | jnc short .ope01 |
| mov eax, [_egc_src + 0] | mov eax, [_egc_src + 0] |
| or eax, [_egc_dst + 0] | or eax, [_egc_dst + 0] |
| not eax | not eax |
| Line 781 egc_ope02: add cl, cl | Line 781 egc_ope02: add cl, cl |
| and eax, [edx + 4] | and eax, [edx + 4] |
| or edi, eax | or edi, eax |
| egc_ope01: add cl, cl | .ope01: add cl, cl |
| jnc short egc_ope00 | jnc short .ope00 |
| mov eax, [edx + 0] | mov eax, [edx + 0] |
| or eax, [_egc_src + 0] | or eax, [_egc_src + 0] |
| or eax, [_egc_dst + 0] | or eax, [_egc_dst + 0] |
| Line 794 egc_ope01: add cl, cl | Line 794 egc_ope01: add cl, cl |
| not eax | not eax |
| or edi, eax | or edi, eax |
| egc_ope00: ret | .ope00: ret |
| ; ---- byte access | ; ---- byte access |
| align 16 | align 16 |
| @memegc_rd8@4: | @egc_readbyte@4: |
| egc_read: pushad | egc_read: pushad |
| mov ebx, ecx | mov ebx, ecx |
| and ebx, byte 1 | and ebx, byte 1 |
| Line 867 egcr_raw: mov al, [VIDEOMEMORY + ebp] | Line 867 egcr_raw: mov al, [VIDEOMEMORY + ebp] |
| align 16 | align 16 |
| @memegc_wr8@8: | @egc_writebyte@8: |
| egc_write: pushad | egc_write: pushad |
| mov dh, dl | mov dh, dl |
| egc_write_m: mov ebx, ecx | egc_write_m: mov ebx, ecx |
| Line 937 egcw_ed: popad | Line 937 egcw_ed: popad |
| ; ---- word access | ; ---- word access |
| align 16 | align 16 |
| @memegc_rd16@4: | @egc_readword@4: |
| egc_read_w: test cl, 1 | egc_read_w: test cl, 1 |
| jne near egcrw_odd | jne near egcrw_odd |
| pushad | pushad |
| Line 1021 egcrw_oddr: inc ecx | Line 1021 egcrw_oddr: inc ecx |
| align 16 | align 16 |
| @memegc_wr16@8: | @egc_writeword@8: |
| egc_write_w: test cl, 1 | egc_write_w: test cl, 1 |
| jne near egcww_odd | jne near egcww_odd |
| pushad | pushad |