⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 copyvid.inc

📁 十七种模拟器源代码 非常有用的作课程设计不可缺少的
💻 INC
📖 第 1 页 / 共 5 页
字号:
    mov ah,[esi+75036]
    mov [es:edi],eax
    add esi,2
    add edi,4
    dec ecx
    jnz .a2
    jmp .returnloop

NEWSYM proceagle
    mov byte[res640],0
    cmp byte[curblank],40h
    jne .startcopy
    ret
.startcopy
    push es
    mov ax,[vesa2selec]
    mov es,ax
    mov esi,[vidbuffer]
    add esi,16+256+32
    mov dl,237
    mov edi,32*2           ; Draw @ Y from 9 to 247
    cmp word[resolutn],224
    jne .res239
    mov edi,8*640+32*2
    add edi,[VidStartDraw]
    mov dl,222
.res239
    call draweagle
    pop es
    ret

NEWSYM draweagle
    ; copies a buffer from esi to es:edi with dl # of lines
    ; This only works under vesa 2 640x480x8b mode
    mov [lineleft],dl

    ; copy the first line directly
    mov ecx,128
.drawnext
    mov al,[esi]
    mov ah,al
    shl eax,16
    mov al,[esi]
    mov ah,al
    mov [es:edi],eax
    add esi,2
    add edi,4
    dec ecx
    jnz .drawnext

    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
    loop .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
    loop .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,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[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 .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,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]
    mov [es:edi],al
    inc esi
    add edi,2
    dec ecx
    jnz .b
    jmp .returnloop
.rightside
    mov ecx,256
.b2
    mov al,[esi]
    mov [es:edi+1],al
    inc esi
    add edi,2
    dec ecx
    jnz .b2
    jmp .returnloop

.scratio db 0
.lastrep db 0
.p512    db 0

NEWSYM 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,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]
    mov [es:edi],ax
    inc esi
    add edi,2
    dec ecx
    jnz .b
    jmp .returnloop

.scratio db 0
.lastrep db 0
.p512    db 0

;*******************************************************
; 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]
    dec dl
    dec dl
.loopa
    mov ecx,256
    xor eax,eax
.loopa2
    mov al,[esi]
    inc esi
    mov bx,[GUICPC+eax*2]
    mov [es:edi],bx
    add edi,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]
    dec dl
    dec dl
.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
    ret

NEWSYM copyvesa2320x240x16b
    cmp byte[vesa2red10],1
    jne .notbr
    call ConvertToAFormat
.notbr
;    je near copyvesa2320x240x16br
    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 ebp,[vidbufferm]
    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*2+256*2+32*2
    add ebp,16*2+256*2+32*2
    xor eax,eax
    mov dl,[resolutn]
    dec dl
    dec dl
    cmp byte[FPUCopy],1
    je .loopb
    cmp byte[FPUCopy],2
    je near .loopc
.loopa
    mov ecx,128
    rep movsd
    add esi,64
    add edi,128
    dec dl
    jnz .loopa
    pop es
    ret
.loopb
    CopyFPU
    CopyFPU
    add esi,64
    add edi,128
    dec dl
    jnz near .loopb
    pop es
    ret
.loopc
    mov ecx,32
    MMXStuff
    add esi,64
    add edi,128
    dec dl
    jnz .loopc
    emms
    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*2+256*2+32*2
    xor eax,eax
    mov dl,[resolutn]
    dec dl
    dec dl
.loopab
    mov ecx,64
.loopbb
    mov eax,[esi]
    mov [es:edi],ax
    mov [es:edi+2],eax
    mov eax,[esi+4]
    mov [es:edi+6],eax
    add esi,8
    add edi,10
    dec ecx
    jnz .loopbb
    add esi,64
    dec dl
    jnz .loopab
    pop es
    ret

NEWSYM palresvalng, dd 0,0
NEWSYM palresvalngb, dd 0,0

%macro copya320x240 0
    mov [es:edi],dx
%endmacro

%macro copyb320x240 0
    mov [es:edi+2],dx
%endmacro
%endif

ALIGN32
NEWSYM rescompareng, dd 0
NEWSYM nextdrawallng, dd 0
NEWSYM prevcol0ng, dd 0
NEWSYM numbytelng, dd 0
NEWSYM lineleft, dd 0
NEWSYM lineleft2, dd 0
bankpos dd 0


%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]
    dec dl
    dec dl
    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,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,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,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,2

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -