?? k.asm
字號:
; "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman; Ken Silverman's official web site: "http://www.advsys.net/ken"; See the included license file "BUILDLIC.TXT" for license info.; This file has been modified from Ken Silverman's original release.386PEXTRN _kdmasm1 : dwordEXTRN _kdmasm2 : dwordEXTRN _kdmasm3 : dwordEXTRN _kdmasm4 : dwordEXTRN _chainbackcnt : dwordEXTRN _chainbackstart : dwordEXTRN _pcsndptr : dwordEXTRN _samplecount : dwordEXTRN _pcsndbufsiz : dwordEXTRN _oldpctimerhandler : farEXTRN _bufferside : byteEXTRN _qualookup : nearEXTRN _pcsndlookup : nearEXTRN _chain_intr_ : nearEXTRN __GETDS : nearEXTRN preparesndbuf_ : near_DATA SEGMENT BYTE PUBLIC USE32 'DATA'_DATA ENDSDGROUP GROUP _DATACODE SEGMENT BYTE PUBLIC USE32 'CODE'ASSUME cs:CODEPUBLIC monolocomb_monolocomb_: ;eax=temp2,ebx=temp1,ecx=cnt,edx=dat,esi=dasplc,edi=stemp,ebp=dasoff push ebp mov dword ptr ds:[mach1lm+3], ebx ;voloffs1 mov ebx, _kdmasm4 mov dword ptr ds:[mach5lm+2], ebx mov ebx, edx shl ebx, 32-12 sar edx, 12 mov dword ptr ds:[mach3lm+2], ebx ;dasinc mov dword ptr ds:[mach4lm+2], edx ;dasinc mov ebp, esi shl ebp, 32-12 sar esi, 12 xor edx, edx jmp begitlmprebegitlm: cmp _kdmasm1, 0 jz enditlm mov ebx, _kdmasm2 mov dword ptr ds:[mach5lm+2], ebx mov _kdmasm4, ebx mov ebx, _kdmasm3 mov eax, ebx shl ebx, 32-12 sar eax, 12 sub ebp, ebx sbb esi, eax test ecx, ecx jz enditlmbegitlm: ;dl = [(eax>>12)+dasoff]; (QUICK NO MULTIPLY METHOD)mach5lm: mov dl, byte ptr [esi+88888888h] ;dasoff mov ebx, dword ptr [edi] add edi, 4mach1lm: add ebx, dword ptr [edx*4+88888888h] ;voloffs1mach3lm: add ebp, 88888888h ;dasincmach4lm: adc esi, 88888888h ;dasinc mov dword ptr [edi-4], ebx dec ecx ja begitlm ;jump if (no carry (add)) and (not zero (dec))! jc prebegitlmenditlm: shl esi, 12 shr ebp, 32-12 lea eax, [esi+ebp] pop ebp retPUBLIC monohicomb_monohicomb_: ;eax=temp2,ebx=temp1,ecx=cnt,edx=dat,esi=dasplc,edi=stemp,ebp=dasoff push ebp mov ebp, ecx mov dword ptr ds:[mach1hm+3], ebx ;voloffs1 mov ebx, _kdmasm4 mov dword ptr ds:[mach5hm+3], ebx mov ebx, edx shl ebx, 32-12 sar edx, 12 mov dword ptr ds:[mach4hm+2], edx ;dasinc ;mov edx, ebx ;Fake 4-bit counter to save shift ;shr edx, 20 ; ;mov bx, dx ; mov dword ptr ds:[mach3hm+2], ebx ;dasinc mov ecx, esi shl ecx, 32-12 sar esi, 12 ;mov edx, ecx ;Fake 4-bit counter to save shift ;shr edx, 20 ; ;mov cx, dx ; xor edx, edx sub edi, 4 jmp begithmprebegithm: cmp _kdmasm1, 0 jz endithm mov ebx, _kdmasm2 mov dword ptr ds:[mach5hm+3], ebx mov _kdmasm4, ebx mov ebx, _kdmasm3 mov eax, ebx shl ebx, 32-12 sar eax, 12 sub ecx, ebx sbb esi, eax test ebp, ebp jz endithmbegithm: ;edx = _qualookup[((ebp>>19)&0x00001e00)+(bh-bl)]+blmach5hm: mov bx, word ptr [esi+88888888h] mov eax, ecx shr eax, 20 add edi, 4 mov dl, bl mov al, bl sub al, bh adc ah, ah add dl, byte ptr _qualookup[eax] mov ebx, dword ptr [edi]mach1hm: add ebx, dword ptr [edx*4+88888888h] ;voloffs1mach3hm: add ecx, 88888888h ;dasincmach4hm: adc esi, 88888888h ;dasinc dec ebp mov dword ptr [edi], ebx ja begithm ;jump if (no carry (add)) and (not zero (dec))! jc prebegithmendithm: shl esi, 12 shr ecx, 32-12 lea eax, [esi+ecx] pop ebp retPUBLIC stereolocomb_stereolocomb_: ;eax=temp2,ebx=temp1,ecx=cnt,edx=dat,esi=dasplc,edi=stemp,ebp=dasoff push ebp mov dword ptr ds:[mach1ls+3], ebx ;voloffs1 add ebx, 4 mov dword ptr ds:[mach2ls+3], ebx ;voloffs2 mov ebx, _kdmasm4 mov dword ptr ds:[mach5ls+2], ebx mov ebx, edx shl ebx, 32-12 sar edx, 12 mov dword ptr ds:[mach3ls+2], ebx ;dasinc mov dword ptr ds:[mach4ls+2], edx ;dasinc mov ebp, esi shl ebp, 32-12 sar esi, 12 xor edx, edx sub edi, 8 jmp begitlsprebegitls: cmp _kdmasm1, 0 jz enditls mov ebx, _kdmasm2 mov dword ptr ds:[mach5ls+2], ebx mov _kdmasm4, ebx mov ebx, _kdmasm3 mov eax, ebx shl ebx, 32-12 sar eax, 12 sub ebp, ebx sbb esi, eax test ecx, ecx jz enditls jmp begitlsbegitls: add edi, 8 ;dl = [(eax>>12)+dasoff]; (QUICK NO MULTIPLY METHOD)mach5ls: mov dl, byte ptr [esi+88888888h] ;dasoff mov ebx, dword ptr [edi] mov eax, dword ptr [edi+4]mach1ls: add ebx, dword ptr [edx*8+88888888h] ;voloffs1mach2ls: add eax, dword ptr [edx*8+88888888h] ;voloffs2mach3ls: add ebp, 88888888h ;dasinc mov dword ptr [edi], ebxmach4ls: adc esi, 88888888h ;dasinc dec ecx mov dword ptr [edi+4], eax ja begitls ;jump if (no carry (add)) and (not zero (dec))! jc prebegitlsenditls: shl esi, 12 shr ebp, 32-12 lea eax, [esi+ebp] pop ebp retPUBLIC stereohicomb_stereohicomb_: ;eax=temp2,ebx=temp1,ecx=cnt,edx=dat,esi=dasplc,edi=stemp,ebp=dasoff push ebp mov ebp, ecx mov dword ptr ds:[mach1hs+3], ebx ;voloffs1 add ebx, 4 mov dword ptr ds:[mach2hs+3], ebx ;voloffs2 mov ebx, _kdmasm4 mov dword ptr ds:[mach5hs+3], ebx mov ebx, edx shl ebx, 32-12 sar edx, 12 mov dword ptr ds:[mach4hs+2], edx ;dasinc ;mov edx, ebx ;Fake 4-bit counter to save shift ;shr edx, 20 ; ;mov bx, dx ; mov dword ptr ds:[mach3hs+2], ebx ;dasinc mov ecx, esi shl ecx, 32-12 sar esi, 12 ;mov edx, ecx ;Fake 4-bit counter to save shift ;shr edx, 20 ; ;mov cx, dx ; xor edx, edx sub edi, 8 jmp begithsprebegiths: cmp _kdmasm1, 0 jz endiths mov ebx, _kdmasm2 mov dword ptr ds:[mach5hs+3], ebx mov _kdmasm4, ebx mov ebx, _kdmasm3 mov eax, ebx shl ebx, 32-12 sar eax, 12 sub ecx, ebx sbb esi, eax test ebp, ebp jz endithsbegiths: ;edx = _qualookup[((ebp>>19)&0x00001e00)+(bh-bl)]+blmach5hs: mov bx, word ptr [esi+88888888h] mov eax, ecx shr eax, 20 add edi, 8 mov dl, bl mov al, bl sub al, bh adc ah, ah add dl, byte ptr _qualookup[eax] mov eax, dword ptr [edi]mach1hs: mov ebx, dword ptr [edx*8+88888888h] ;voloffs1 add ebx, eax mov eax, dword ptr [edi+4] mov dword ptr [edi], ebxmach2hs: mov ebx, dword ptr [edx*8+88888888h] ;voloffs2 add eax, ebxmach3hs: add ecx, 88888888h ;dasincmach4hs: adc esi, 88888888h ;dasinc dec ebp mov dword ptr [edi+4], eax ja begiths ;jump if (no carry (add)) and (not zero (dec))! jc prebegithsendiths: shl esi, 12 shr ecx, 32-12 lea eax, [esi+ecx] pop ebp retPUBLIC setuppctimerhandler_setuppctimerhandler_: mov dword ptr ds:[pcmach3+2], eax cmp ebx, 65000d jl short skipsetuppc1 mov word ptr ds:[pcmach1+0], 0c381h ;81c300000000 = add ebx, 00000000h mov dword ptr ds:[pcmach1+2], 00000000h mov word ptr ds:[pcmach2+0], 0c98bh ;8bc9 = mov ecx, ecxskipsetuppc1: retPUBLIC pctimerhandler_ pctimerhandler_: push eax mov ax, DGROUP push ds mov ds, ax push edx mov edx, dword ptr _pcsndptr mov al, byte ptr [edx] out 42h, al inc edx mov dword ptr _pcsndptr, edxpcmach1: dec _chainbackcnt ;sampledivpcmach2: jz short pc3 mov al, 20h out 20h, alpcmach3: cmp edx, 88888888h ;pcsndptrend jge short pc1 pop edx pop ds pop eax iretdpc1: xor byte ptr _bufferside, 1 mov eax, _pcsndbufsiz mov edx, _pcsndptr jnz short pc2 sub edx, eax sub edx, eax mov _pcsndptr, edxpc2: add eax, edx mov dword ptr ds:[pcmach3+2], eax sti call preparesndbuf_ pop edx pop ds pop eax iretdpc3: sti cmp edx, dword ptr ds:[pcmach3+2] jl short pc5 xor byte ptr _bufferside, 1 mov eax, _pcsndbufsiz mov edx, _pcsndptr jnz short pc4 sub edx, eax sub edx, eax mov _pcsndptr, edxpc4: add eax, edx mov dword ptr ds:[pcmach3+2], eax sti call preparesndbuf_pc5: mov eax, _chainbackstart mov _chainbackcnt, eax pop edx pop ds pop eax ;Must start interrupt handler like watcom c pushad push ds push es push fs push gs mov ebp, esp cld call __GETDS mov dx, word ptr [_oldpctimerhandler+4] mov eax, dword ptr [_oldpctimerhandler] call _chain_intr_PUBLIC pcbound2char_pcbound2char_: push ebp add ecx, ecx lea eax, [ecx+edi] mov dword ptr ds:[pcmachchar+3], eax xor edi, edi sub edi, ecx xor ecx, ecx xor edx, edx mov ebp, 0ffff0000hstartpcbound2char: mov ebx, dword ptr [esi] mov eax, dword ptr [esi+4] test ebx, ebp jnz short pcboundit1pcboundit1back: mov dl, bh mov dword ptr [esi], 32768 test eax, ebp mov al, byte ptr _pcsndlookup[edx] jnz short pcboundit2pcboundit2back: mov dl, ah mov dword ptr [esi+4], 32768 mov ah, byte ptr _pcsndlookup[edx] add esi, 8pcmachchar: mov word ptr [edi+88888888h], ax add edi, 2 jnc short startpcbound2char pop ebp retpcboundit1: cmp ebx, 80000000h sbb bh, bh jmp short pcboundit1backpcboundit2: cmp eax, 80000000h sbb ah, ah jmp short pcboundit2back ;for(i=0;i<bytespertic;i++) ;{ ; j = (stemp[i]>>8); ; if (j < 0) j = 0; ; if (j > 255) j = 255; ; *charptr++ = (char)j; ;}PUBLIC bound2char_bound2char_: add ecx, ecx lea eax, [ecx+edi] mov dword ptr ds:[machchar+3], eax xor edi, edi sub edi, ecx xor ecx, ecx mov edx, 0ffff0000hstartbound2char: mov ebx, dword ptr [esi] mov eax, dword ptr [esi+4] test ebx, edx jnz short boundchar1boundchar1back: mov dword ptr [esi], 32768 test eax, edx jnz short boundchar2boundchar2back: mov dword ptr [esi+4], 32768 mov al, bh add esi, 8machchar: mov word ptr [edi+88888888h], ax add edi, 2 jnc short startbound2char retboundchar1: cmp ebx, 80000000h sbb bh, bh jmp short boundchar1backboundchar2: cmp eax, 80000000h sbb ah, ah jmp short boundchar2back ;for(i=0;i<bytespertic;i++) ;{ ; j = stemp[i]; ; if (j < 0) j = 0; ; if (j > 65535) j = 65535; ; *shortptr++ = (short)(j^8000h); ;}PUBLIC bound2short_bound2short_: shl ecx, 2 lea eax, [ecx+edi] mov dword ptr ds:[machshort+2], eax xor edi, edi sub edi, ecx xor ecx, ecx mov edx, 0ffff0000hstartbound2short: mov ebx, dword ptr [esi] mov eax, dword ptr [esi+4] test ebx, edx jnz short boundshort1boundshort1back: mov dword ptr [esi], 32768 test eax, edx jnz short boundshort2boundshort2back: shl eax, 16 mov dword ptr [esi+4], 32768 mov ax, bx add esi, 8 xor eax, 80008000hmachshort: mov dword ptr [edi+88888888h], eax add edi, 4 jnc short startbound2short retboundshort1: cmp ebx, 80000000h sbb ebx, ebx jmp short boundshort1backboundshort2: cmp eax, 80000000h sbb eax, eax jmp short boundshort2backCODE ENDSEND
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -