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

📄 procvid.asm

📁 十七种模拟器源代码 非常有用的作课程设计不可缺少的
💻 ASM
📖 第 1 页 / 共 5 页
字号:
    add edi,2
    loop .loop
    pop edx
    pop esi
    add esi,288*2*4
    dec edx
    jnz near .next
    cmp byte[newengen],0
    je .noneweng
    cmp byte[nggposng],5
    jne .noneweng
    mov edx,PrevPicture
    mov ecx,64*56
.loop2
    mov ax,[edx]
    mov bx,ax
    and ax,0111111111100000b
    and bx,0000000000011111b
    shl ax,1
    or bx,ax
    mov [edx],bx
    add edx,2
    loop .loop2
.noneweng
    popad
    ret

GetPicture:
    mov cl,[CurPictureVal]
    cmp [PrevPictureVal],cl
    jne .notskip
    ret
.notskip
    mov [PrevPictureVal],cl
    mov edx,PrevPicture
    mov ecx,64*56*2
.loop
    mov byte[edx],0
    inc edx
    loop .loop
    mov edx,fnamest+1
    call Open_File
    jc near .nodraw2
    mov bx,ax
    xor cx,cx
    xor dx,dx
    call File_Seek_End
    shl edx,16
    mov dx,ax
    cmp edx,266879+64*56*2
    je .draw
    cmp edx,398643+64*56*2
    je .draw
    cmp edx,400692+64*56*2
    je .draw
    cmp edx,275071+64*56*2
    je .draw
    jmp .nodraw
.draw
    sub edx,64*56*2
    mov ax,dx
    shr edx,16
    mov cx,dx
    mov dx,ax
    call File_Seek
    mov ecx,64*56*2
    mov edx,PrevPicture
    call Read_File
.nodraw
    call Close_File
.nodraw2
    ; convert to 1:5:5:5
    cmp byte[newengen],0
    je .noneweng
    cmp byte[nggposng],5
    jne .noneweng
    mov edx,PrevPicture
    mov ecx,64*56
.loop2
    mov ax,[edx]
    mov bx,ax
    and ax,1111111111000000b
    and bx,0000000000011111b
    shr ax,1
    or bx,ax
    mov [edx],bx
    add edx,2
    loop .loop2
.noneweng
    ; draw border
    mov esi,75*2+9*288*2
    add esi,[vidbuffer]
    mov edx,58
.ploopa
    mov ecx,66
    push esi
.ploopb
    mov word[esi],0FFFFh
    add esi,2
    loop .ploopb
    pop esi
    add esi,288*2
    dec edx
    jnz .ploopa
    ; draw picture
    mov esi,76*2+10*288*2
    add esi,[vidbuffer]
    mov edx,56
    mov edi,PrevPicture
.ploopa2
    mov ecx,64
    push esi
.ploopb2
    mov ax,[edi]
    mov word[esi],ax
    add esi,2
    add edi,2
    loop .ploopb2
    pop esi
    add esi,288*2
    dec edx
    jnz .ploopa2
    ret

NEWSYM drawfillboxsc
    push eax
    push ebx
    mov edx,fnamest+1
    call Open_File
    jc near .nodraw
    mov bx,ax
    call Close_File
    pop ebx
    ; draws a 10x10 filled box according to position bl and color dl
    xor eax,eax
    mov al,11
    mul bl
    mov esi,76+94*288
    add esi,[vidbuffer]
    add esi,eax
    mov ecx,10
    mov al,176
    cmp [newestfileloc],bl
    jne .next
    mov al,208
.next
    push esi
    push ecx
    mov ecx,10
    call drawhline
    pop ecx
    pop esi
    add esi,288
    dec ecx
    jnz .next
    pop eax
    ret
.nodraw
    pop ebx
    pop eax
    ret

NEWSYM drawfillboxsc16b
    push eax
    push ebx
    mov edx,fnamest+1
    call Open_File
    jc near .nodraw
    mov bx,ax
    call Close_File
    pop ebx
    ; draws a 10x10 filled box according to position bl and color dl
    xor eax,eax
    mov al,11
    mul bl
    mov esi,76*2+94*288*2
    add esi,[vidbuffer]
    add esi,eax
    add esi,eax
    mov ecx,10
    mov ax,[saveselect.allgrn]
    cmp [newestfileloc],bl
    jne .next
    mov ax,[saveselect.allgrnb]
.next
    push esi
    push ecx
    mov ecx,10
    call drawhline16b
    pop ecx
    pop esi
    add esi,288*2
    dec ecx
    jnz .next
    pop eax
    ret
.nodraw
    pop ebx
    pop eax
    ret

NEWSYM drawbox
    ; draws a box according to position bl and color dl
    xor eax,eax
    mov al,11
    mul bl
    mov esi,75+93*288
    add esi,[vidbuffer]
    add esi,eax
    mov al,dl
    push esi
    mov ecx,12
    call drawhline
    pop esi
    push esi
    mov ecx,12
    call drawvline
    pop esi
    push esi
    add esi,11
    mov ecx,12
    call drawvline
    pop esi
    add esi,11*288
    mov ecx,12
    call drawhline
    ret

NEWSYM drawbox16b
    ; draws a box according to position bl and color dx
    xor eax,eax
    mov al,11
    mul bl
    mov esi,75*2+93*288*2
    add esi,[vidbuffer]
    add esi,eax
    add esi,eax
    mov ax,dx
    push esi
    mov ecx,12
    call drawhline16b
    pop esi
    push esi
    mov ecx,12
    call drawvline16b
    pop esi
    push esi
    add esi,11*2
    mov ecx,12
    call drawvline16b
    pop esi
    add esi,11*288*2
    mov ecx,12
    call drawhline16b
    ret

%macro drawfillboxhelp 2
    mov bl,%1
    mov byte[fnamest+eax],%2
    call drawfillboxsc
%endmacro

%macro drawfillboxhelp16b 2
    mov bl,%1
    mov byte[fnamest+eax],%2
    call drawfillboxsc16b
%endmacro


NEWSYM saveselect
    mov byte[f3menuen],1
    mov byte[ForceNonTransp],1
    cmp byte[ForceNewGfxOff],0
    jne .nong16b
    cmp byte[cbitmode],0
    je .nong16b
%ifdef __MSDOS__
    call GetScreen
%endif
.nong16b
    cmp dword[MessageOn],0
    je .nochangem
    mov dword[MessageOn],1
.nochangem
    mov al,[newengen]
    mov byte[newengen],0
    push eax
    call copyvid
    pop eax
    mov [newengen],al
    call StopSound
    cmp byte[soundon],0
    je .nosound
    mov byte[csounddisable],1
    ;cmp byte[OSPort],1
    ;ja .nosound
%ifdef __MSDOS__
    push es
    mov es,[sbselec]
    mov edi,[sbpmofs]
    mov ecx,320
.loopa
    mov dword[es:edi],0
    add edi,4
    dec ecx
    jnz .loopa
    pop es
%endif
.nosound
    cmp byte[cbitmode],1
    je near .16b
    call saveselectpal
    ; draw a small blue box with a white border
    mov esi,70+70*288
    add esi,[vidbuffer]
    mov ecx,150
    mov al,70
.loop
    mov byte[esi],144
    inc esi
    loop .loop
    add esi,288-150
    dec al
    mov ecx,150
    jnz .loop
    ; draw filled boxes for existing files
    mov eax,[statefileloc]
    mov bl,byte[fnamest+eax]
    push ebx
    call DetermineNewest
%ifdef __LINUX__
    drawfillboxhelp 0,'t'
%else
    drawfillboxhelp 0,'T'
%endif
    drawfillboxhelp 1,'1'
    drawfillboxhelp 2,'2'
    drawfillboxhelp 3,'3'
    drawfillboxhelp 4,'4'
    drawfillboxhelp 5,'5'
    drawfillboxhelp 6,'6'
    drawfillboxhelp 7,'7'
    drawfillboxhelp 8,'8'
    drawfillboxhelp 9,'9'
    pop ebx
    mov eax,[statefileloc]
    mov byte[fnamest+eax],bl

    mov esi,75+73*288
    add esi,[vidbuffer]
    mov edi,.stringa
    call OutputGraphicString
    mov esi,75+83*288
    add esi,[vidbuffer]
    mov edi,.stringb
    call OutputGraphicString
    mov esi,75+108*288
    add esi,[vidbuffer]
    mov edi,.stringc
    call OutputGraphicString
    mov esi,75+118*288
    add esi,[vidbuffer]
    mov edi,.stringd
    call OutputGraphicString
    mov esi,75+128*288
    add esi,[vidbuffer]
    mov edi,.stringe
    call OutputGraphicString
    mov al,128
    mov esi,70+70*288
    add esi,[vidbuffer]
    mov ecx,150
    call drawhline
    mov esi,70+70*288
    add esi,[vidbuffer]
    mov ecx,70
    call drawvline
    mov esi,70+139*288
    add esi,[vidbuffer]
    mov ecx,150
    call drawhline
    mov esi,219+70*288
    add esi,[vidbuffer]
    mov ecx,70
    call drawvline
    mov esi,75+93*288
    add esi,[vidbuffer]
    mov ecx,111
    call drawhline
    mov esi,75+104*288
    add esi,[vidbuffer]
    mov ecx,111
    call drawhline
    mov esi,75+94*288
    add esi,[vidbuffer]
    mov bl,11
.nextvline
    mov ecx,10
    push esi
    push ebx
    call drawvline
    pop ebx
    pop esi
    add esi,11
    dec bl
    jnz .nextvline
    mov esi,78+96*288
    add esi,[vidbuffer]
    mov al,1
    call outputchar
    mov bl,9
.nextnumchar
    add esi,11
    inc al
    push ebx
    call outputchar
    pop ebx
    dec bl
    jnz .nextnumchar
    mov byte[curblank],0h
    mov bl,0
    mov ebx,[statefileloc]
    mov al,byte[fnamest+ebx]
%ifdef __LINUX__
    cmp al,'t'
%else
    cmp al,'T'
%endif
    jne .noT
    mov bl,0
    jmp .nexter
.noT
    mov bl,al
    sub bl,48
.nexter
    mov dl,160
    call drawbox
    push ebx
    call copyvid
    pop ebx
    ; wait until esc/enter is pressed
.noesc
    mov dl,128
    call drawbox
    mov ecx,2500
    call delay
    call testpressed8b
    test byte[pressed+1],1
    jnz near .esc
    test byte[pressed+28],1
    jnz near .enter
    mov ecx,2500
    call delay
    call testpressed8b
    test byte[pressed+1],1
    jnz near .esc
    test byte[pressed+28],1
    jnz near .enter
    push ebx
    call copyvid
    pop ebx
    mov ecx,2500
    call delay
    call testpressed8b
    test byte[pressed+1],1
    jnz near .esc
    test byte[pressed+28],1
    jnz near .enter
    mov ecx,2500
    call delay
    call testpressed8b
    test byte[pressed+1],1
    jnz near .esc
    test byte[pressed+28],1
    jnz near .enter
    mov dl,160
    call drawbox
    push ebx
    call copyvid
    pop ebx
    jmp .noesc
.enter
    mov byte[pressed+28],2
    cmp bl,0
    jne .nozero
%ifdef __LINUX__
    mov al,'t'
%else
    mov al,'T'
%endif
    jmp .save
.nozero
    add bl,48
    mov al,bl
.save
    mov ebx,[statefileloc]
    mov byte[fnamest+ebx],al
.esc

    mov eax,pressed
    mov ecx,256
.looppr
    cmp byte[eax],1
    jne .notpr
    mov byte[eax],2
.notpr
    inc eax
    loop .looppr
    %ifdef __MSDOS__
    mov byte[pressed+1],0
    %endif

    mov word[t1cc],0
    mov byte[csounddisable],0
    call StartSound

    call makepal
    mov byte[f3menuen],0
    mov byte[ForceNonTransp],0
    ret

.allred dw 0
.allgrn dw 0
.allgrnb dw 0
.blue   dw 0
.stepb  dw 0

; Start 16-bit stuff here
.16b
    cmp byte[newengen],0
    je .notng
    mov byte[GUIOn],1
.notng
    ; draw shadow behind box
    mov esi,80*2+80*288*2
    add esi,[vidbuffer]
    mov ecx,150
    mov al,70
    mov ah,5
.loop16b2
    mov dx,[esi]
    and dx,[vesa2_clbit]
    shr dx,1
    mov [esi],dx
    add esi,2
    loop .loop16b2
    add esi,288*2-150*2
    dec al
    mov ecx,150
    jnz .loop16b2

    mov ax,018h
    mov cl,[vesa2_rpos]
    shl ax,cl
    mov [.allgrn],ax

    mov ax,25
    mov cl,[vesa2_rpos]
    shl ax,cl
    mov [.allgrnb],ax
    mov ax,12
    mov cl,[vesa2_gpos]
    shl ax,cl
    or [.allgrnb],ax

    mov ax,01Fh
    mov cl,[vesa2_rpos]
    shl ax,cl
    mov [.allred],ax
    mov ax,012h
    mov cl,[vesa2_bpos]
    shl ax,cl
    mov dx,ax
    mov ax,01h
    mov cl,[vesa2_gpos]
    shl ax,cl
    mov bx,ax
    mov ax,01h
    mov cl,[vesa2_rpos]
    shl ax,cl
    or bx,ax

    ; draw a small blue box with a white border
    mov esi,70*2+70*288*2
    add esi,[vidbuffer]
    mov ecx,150
    mov al,70
    mov ah,5
.loop16b
    mov [esi],dx
    add esi,2
    loop .loop16b
    add esi,288*2-150*2
    dec ah
    jnz .nocolinc16b
    add dx,bx
    mov ah,5
.nocolinc16b
    dec al
    mov ecx,150
    jnz .loop16b

    ; draw filled boxes for existing files
    mov eax,[statefileloc]
    mov bl,byte[fnamest+eax]
    push ebx
    call DetermineNewest
%ifdef __LINUX__
    drawfillboxhelp16b 0,'t'
%else
    drawfillboxhelp16b 0,'T'
%endif
    drawfillboxhelp16b 1,'1'
    drawfillboxhelp16b 2,'2'
    drawfillboxhelp16b 3,'3'
    drawfillboxhelp16b 4,'4'
    drawfillboxhelp16b 5,'5'
    drawfillboxhelp16b 6,'6'
    drawfillboxhelp16b 7,'7'
    drawfillboxhelp16b 8,'8'
    drawfillboxhelp16b 9,'9'
    pop ebx
    mov eax,[statefileloc]
    mov byte[fnamest+eax],bl

    mov esi,75*2+73*288*2
    add esi,[vidbuffer]
    mov edi,.stringa
    call OutputGraphicString16b
    mov esi,75*2+83*288*2
    add esi,[vidbuffer]
    mov edi,.stringb
    call OutputGraphicString16b
    mov esi,75*2+108*288*2
    add esi,[vidbuffer]
    mov edi,.stringc
    call OutputGraphicString16b
    mov esi,75*2+118*288*2
    add esi,[vidbuffer]
    mov edi,.stringd
    call OutputGraphicString16b
    mov esi,75*2+128*288*2
    add esi,[vidbuffer]
    mov edi,.stringe
    call OutputGraphicString16b
    mov ax,0FFFFh

⌨️ 快捷键说明

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