📄 copyvid.inc
字号:
dec byte[lineleft] add edi,128 ; 512 + 128 = 640 add esi,32 ; There are 32 extra pixels in the buffer used ; for clipping xor eax,eax xor ebx,ebx mov edx,[spritetablea].drawloop ; process EAGLE on the bottom line ; process the first pixel ; copy to the left pixel mov al,[esi] mov [edx],al ; draw the right pixel depending on the pixels right & below mov al,[esi+1] mov ah,al mov bx,[esi+288] cmp ebx,eax je .matchf mov al,[esi].matchf mov [edx+1],al inc esi add edx,2 ; Start drawing the in-between pixels mov ecx,256-2 mov bx,[esi+287].lineloopd ; draw the left pixel depending on the pixels left & below mov al,[esi-1] mov ah,al cmp ebx,eax je .matchlp mov al,[esi].matchlp mov [edx],al ; draw the right pixel depending on the pixels right & below mov al,[esi+1] mov ah,al mov bx,[esi+288] cmp ebx,eax je .matchrp mov al,[esi].matchrp mov [edx+1],al ;increment the addresses add edx,2 inc esi dec ecx jnz .lineloopd ; process the last pixel ; draw the left pixel depending on the pixels left & below mov al,[esi-1] mov ah,al mov bx,[esi+287] cmp ebx,eax je .matchl mov al,[esi].matchl mov [edx],al ; copy to the right pixel mov al,[esi] mov [edx+1],al inc esi sub edx,510 mov ecx,128.copyloop mov eax,[edx] mov [es:edi],eax add edx,4 add edi,4 dec ecx jnz .copyloop xor eax,eax ; process EAGLE on the upper line add edi,128 add esi,32 mov edx,[spritetablea] ; process the first pixel ; copy to the left pixel mov al,[esi] mov [edx],al ; draw the right pixel depending on the pixels right & above mov al,[esi+1] mov ah,al mov bx,[esi-288] cmp ebx,eax je .matchf2 mov al,[esi].matchf2 mov [edx+1],al inc esi add edx,2 ; Start drawing the in-between pixels mov ecx,256-2 mov bx,[esi-289].lineloopd2 ; draw the left pixel depending on the pixels left & above mov al,[esi-1] mov ah,al cmp ebx,eax je .matchlp2 mov al,[esi].matchlp2 mov [edx],al ; draw the right pixel depending on the pixels right & below mov al,[esi+1] mov ah,al mov bx,[esi-288] cmp ebx,eax je .matchrp2 mov al,[esi].matchrp2 mov [edx+1],al ;increment the addresses add edx,2 inc esi dec ecx jnz .lineloopd2 ; process the last pixel ; draw the left pixel depending on the pixels left & above mov al,[esi-1] mov ah,al mov bx,[esi-289] cmp ebx,eax je .matchl2 mov al,[esi].matchl2 mov [edx],al ; copy to the right pixel mov al,[esi] mov [edx+1],al inc esi sub edx,510 mov ecx,128.copyloop2 mov eax,[edx] mov [es:edi],eax add edx,4 add edi,4 dec ecx jnz .copyloop2 xor eax,eax sub esi,256 ; move esi back to left side of the line add edi,128 dec byte[lineleft] jnz near .drawloop ; copy the last line directly mov ecx,128.drawlast mov al,[esi] mov ah,al shl eax,16 mov al,[esi] mov ah,al mov [es:edi],eax add esi,byte 2 add edi,4 dec ecx jnz .drawlast ret;*******************************************************; Copy VESA2 512x384x8b Copies buffer to 512x384x8bVBE2;*******************************************************NEWSYM copyvesa2512x384x8b cmp byte[curblank],40h jne .startcopy ret.startcopy cmp byte[smallscreenon],1 je near .smallscreen cmp byte[ForceNewGfxOff],0 jne .nong16b cmp byte[newengen],0 jne near copyvesa2512x384x8ng.nong16b mov dword[ignor512],0 push es mov byte[.lastrep],0 mov ax,[vesa2selec] mov es,ax mov esi,[vidbuffer] mov byte[.scratio],61 ; 60.6695 cmp word[resolutn],224 jne .res239 mov byte[.scratio],72 ; 72.4286.res239 mov edi,[VidStartDraw] add esi,16+256+32 xor eax,eax mov ebx,hirestiledat+1 mov dl,[resolutn] dec dl dec dl xor dh,dh.loopa mov al,[ebx] mov [.p512],al cmp byte[Triplebufen],1 je .ignorehr cmp al,1 je near .yeshires.ignorehr mov ecx,128.a mov al,[esi+1] mov ah,al shl eax,16 mov al,[esi] mov ah,al mov [es:edi],eax add esi,byte 2 add edi,4 dec ecx jnz .a.returnloop cmp byte[.lastrep],1 je .no2 sub dh,[.scratio] jnc .no2 add dh,100 sub esi,256 mov al,[.p512] mov [ebx],al inc dl dec ebx mov byte[.lastrep],1 jmp .yes2.no2 mov byte[.lastrep],0 add esi,32.yes2 inc ebx dec dl jnz .loopa pop es cmp byte[Triplebufen],1 je .ignorehr2 xor byte[res512switch],1.ignorehr2 ret.yeshires mov byte[ebx],0 test byte[res512switch],1 jnz .rightside mov ecx,256.b mov al,[esi] inc esi mov [es:edi],al add edi,byte 2 dec ecx jnz .b jmp .returnloop.rightside mov ecx,256.b2 mov al,[esi] inc esi mov [es:edi+1],al add edi,byte 2 dec ecx jnz .b2 jmp .returnloop.smallscreen push es mov ax,[vesa2selec] mov es,ax mov esi,[vidbuffer] mov edi,[VidStartDraw] add esi,16+256+32 add edi,72*512+128 cmp byte[resolutn],224 jne .ssres239 add edi,8*512.ssres239 xor eax,eax mov dl,[resolutn] dec dl dec dl cmp byte[MMXSupport],1 je .ssloopb.ssloopa mov ecx,64 rep movsd add esi,32 add edi,128*2 dec dl jnz .ssloopa jmp .done.ssloopb mov ecx,16 MMXStuff add esi,32 add edi,128*2 dec dl jnz .ssloopb emms.done pop es retSECTION .bss.scratio resb 1.lastrep resb 1.p512 resb 1SECTION .textNEWSYM copyvesa2512x384x8ng push es mov byte[.lastrep],0 mov ax,[vesa2selec] mov es,ax mov esi,[vidbuffer] mov byte[.scratio],61 ; 60.6695 cmp word[resolutn],224 jne .res239 mov byte[.scratio],72 ; 72.4286.res239 mov edi,[VidStartDraw] add esi,16+256+32 xor eax,eax mov ebx,1 mov dl,[resolutn] dec dl dec dl xor dh,dh.loopa cmp dword[ignor512],0 je .a2 cmp byte[BGMA+ebx],5 je near .hires cmp byte[BGMA+ebx],6 je near .hires.a2 mov ecx,128.a mov al,[esi+1] mov ah,al shl eax,16 mov al,[esi] mov ah,al mov [es:edi],eax add esi,byte 2 add edi,4 dec ecx jnz .a.returnloop cmp byte[.lastrep],1 je .no2 sub dh,[.scratio] jnc .no2 add dh,100 sub esi,256 mov al,[.p512] mov [ebx],al inc dl dec ebx mov byte[.lastrep],1 jmp .yes2.no2 mov byte[.lastrep],0 add esi,32.yes2 inc ebx dec dl jnz near .loopa pop es mov dword[ignor512],0 ret.hires mov ecx,256.b mov al,[esi] mov ah,[esi+75036] inc esi mov [es:edi],ax add edi,byte 2 dec ecx jnz .b jmp .returnloopSECTION .bss.scratio resb 1.lastrep resb 1.p512 resb 1SECTION .text;*******************************************************; Copy VESA2 320x240x16b Copies buffer to 320x240x16bVB2;*******************************************************;copyvesa2320x240x16bgui:; cmp byte[curblank],40h; jne .startcopy; ret;.startcopy; cmp byte[ScreenScale],1; je near .scalescreen; push es; mov ax,[vesa2selec]; mov es,ax; mov esi,[vidbuffer]; mov edi,32*2 ; Draw @ Y from 9 to 247; cmp word[resolutn],224; jne .res239; mov edi,8*320*2+32*2;.res239; add edi,[VidStartDraw]; add esi,16+256+32; xor eax,eax; mov dl,[resolutn]; sub dl,2;.loopa; mov ecx,256; xor eax,eax;.loopa2; mov al,[esi]; inc esi; mov bx,[GUICPC+eax*2]; mov [es:edi],bx; add edi,byte 2; dec ecx; jnz .loopa2; add esi,32; add edi,128; dec dl; jnz .loopa; pop es; ret;.scalescreen; push es; mov ax,[vesa2selec]; mov es,ax; mov esi,[vidbuffer]; xor edi,edi; cmp word[resolutn],224; jne .res239b; mov edi,8*320*2;.res239b; add edi,[VidStartDraw]; add esi,16+256+32; xor eax,eax; mov dl,[resolutn]; sub dl,2;.loopab; mov ecx,64; xor eax,eax;.loopbb; mov al,[esi]; mov bx,[GUICPC+eax*2]; mov [es:edi],bx; mov [es:edi+2],bx; mov al,[esi+1]; mov bx,[GUICPC+eax*2]; mov [es:edi+4],bx; mov al,[esi+2]; mov bx,[GUICPC+eax*2]; mov [es:edi+6],bx; mov al,[esi+3]; mov bx,[GUICPC+eax*2]; mov [es:edi+8],bx; add esi,4; add edi,10; dec ecx; jnz .loopbb; add esi,32; dec dl; jnz .loopab; pop es; retNEWSYM copyvesa2320x240x16b; cmp byte[vesa2red10],1; jne .notbr; call ConvertToAFormat;.notbr; je near copyvesa2320x240x16br cmp byte[curblank],40h jne .startcopy ret.startcopy push es mov ax,[vesa2selec] mov es,ax mov esi,[vidbuffer] mov edi,320*2+32*2 cmp word[resolutn],224 jne .res239 add edi,8*320*2.res239 add edi,[VidStartDraw] add esi,16*2+256*2+16*2+16*2 xor eax,eax mov dl,[resolutn] dec dl dec dl cmp byte[ScreenScale],1 je near .fullscreen FilterTest .interpolate cmp byte[MMXSupport],1 je near .loopb.loopa mov ecx,256/4*2 rep movsd add esi,16*2+16*2 add edi,32*2+32*2 dec dl jnz .loopa jmp .done.loopb mov ecx,256/16*2 MMXStuff add esi,16*2+16*2 add edi,32*2+32*2 dec dl jnz .loopb emms jmp .done.fullscreen sub edi,32*2.fsloopa mov ecx,256/4.fsloopb mov eax,[esi] mov [es:edi],ax mov [es:edi+2],eax add esi,byte 4 add edi,byte 6 movsd dec ecx jnz .fsloopb add esi,16*2+16*2 dec dl jnz .fsloopa jmp .done.interpolate SSInterpLineH add esi,16*2+16*2 add edi,32*2+32*2 dec dl jnz .interpolate.done pop es ret%endifSECTION .bssNEWSYM rescompareng, resd 1NEWSYM nextdrawallng, resd 1NEWSYM prevcol0ng, resd 1NEWSYM numbytelng, resd 1NEWSYM lineleft, resd 1NEWSYM lineleft2, resd 1bankpos resd 1SECTION .text%ifdef __MSDOS__;*******************************************************; Copy VESA2 320x480x16b Copies buffer to 320x480x16bVB2;*******************************************************;NEWSYM copyvesa2320x480x16bgui; cmp byte[curblank],40h; jne .startcopy; ret;.startcopy; push es; mov ax,[vesa2selec]; mov es,ax; mov esi,[vidbuffer]; mov edi,32*2 ; Draw @ Y from 9 to 247; cmp word[resolutn],224; jne .res239; mov edi,8*320*2+32*2;.res239; add edi,[VidStartDraw]; add esi,16+256+32; xor eax,eax; mov dl,[resolutn]; sub dl,2; cmp byte[scanlines],3; je near .halfscanlines; cmp byte[scanlines],2; je near .quarterscanlines; cmp byte[scanlines],1; je near .scanlines;.loopa; mov ecx,256; xor eax,eax;.a; mov al,[esi]; mov bx,[GUICPC+eax*2]; mov [es:edi],bx; inc esi; add edi,byte 2; dec ecx; jnz .a; sub esi,256; add edi,64*2; mov ecx,256; xor eax,eax;.a2; mov al,[esi]; mov bx,[GUICPC+eax*2]; mov [es:edi],bx; inc esi; add edi,byte 2; dec ecx; jnz .a2; add esi,32; add edi,64*2; dec dl; jnz .loopa; pop es; ret;;.scanlines;.loopab; mov ecx,256; xor eax,eax;.ab; mov al,[esi]; mov bx,[GUICPC+eax*2]; mov [es:edi],bx; inc esi; add edi,byte 2; dec ecx; jnz .ab;.returnb; add esi,32; add edi,64*2+320*2; dec dl; jnz .loopab; pop es; ret;;.halfscanlines;.loopabh; mov ecx,256; xor eax,eax;.abh; mov al,[esi]; mov bx,[GUICPC+eax*2]; mov [es:edi],bx; inc esi; add edi,byte 2; dec ecx; jnz .abh; add edi,64*2; mov ecx,128; sub esi,256;.abh2; mov al,[esi+1]; mov bx,[GUICPC+eax*2]; mov al,[esi]; shl ebx,16; mov bx,[GUICPC+eax*2]; and ebx,[vesa2_clbitng2]; shr ebx,1; mov [es:edi],ebx; add esi,byte 2; add edi,4; dec ecx; jnz .abh2; add esi,32; add edi,64*2; dec dl; jnz .loopabh; pop es; ret;;.quarterscanlines;.loopabhq; mov ecx,256; xor eax,eax;.abhq; mov al,[esi]; mov bx,[GUICPC+eax*2]; mov [es:edi],bx; inc esi; add edi,byte 2; dec ecx; jnz .abhq; add edi,64*2; mov ecx,128; sub esi,256;.abh2q; mov al,[esi+1]; mov bx,[GUICPC+eax*2]; mov al,[esi]; shl ebx,16; mov bx,[GUICPC+eax*2]; and ebx,[vesa2_clbitng2]; shr ebx,1; mov eax,ebx; and eax,[vesa2_clbitng2]; shr eax,1; add ebx,eax; mov [es:edi],ebx; xor eax,eax; add esi,byte 2; add edi,4; dec ecx; jnz .abh2q; add esi,32; add edi,64*2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -