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