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

📄 menu.asm

📁 十七种模拟器源代码 非常有用的作课程设计不可缺少的
💻 ASM
📖 第 1 页 / 共 3 页
字号:
        jne .notpng
        call Grab_PNG_Data
	ret
.notpng
    
    mov byte[pressed+1],0
    mov byte[pressed+59],2
    cmp byte[cbitmode],1
    je near .save16b
    mov edi,pcxheader
    mov ecx,128
.clearhead
    mov byte[edi],0
    inc edi
    dec ecx
    jnz .clearhead
    mov byte[pcxheader+0],10
    mov byte[pcxheader+1],5
    mov byte[pcxheader+2],1
    mov byte[pcxheader+3],8
    mov word[pcxheader+8],255
    mov word[pcxheader+10],222
    mov byte[pcxheader.bpline-1],1
    mov word[pcxheader.bpline],256
    cmp byte[resolutn],224
    je .res224ph
    mov word[pcxheader+10],237
.res224ph

    ; get unused filename
    mov byte[.filename+5],'.'
%ifdef __LINUX__
    mov byte[.filename+6],'p'
    mov byte[.filename+7],'c'
    mov byte[.filename+8],'x'
%else
    mov byte[.filename+6],'P'
    mov byte[.filename+7],'C'
    mov byte[.filename+8],'X'
%endif
    mov byte[.filename+9],0
    mov word[picnum],1
.findagain
    mov edx,.filename
    call Open_File
    jc near .nofile
    mov bx,ax
    call Close_File

    inc word[picnum]
    cmp word[picnum],1000
    je .nofile

    mov ax,[picnum]
    xor edx,edx
    mov bx,100
    div bx
    mov cl,al
    mov ax,dx
    xor edx,edx
    mov bx,10
    div bx
    mov esi,.filename+5
    add cl,48
    add al,48
    add dl,48
    cmp cl,48
    je .nohund
    mov byte[esi],cl
    mov byte[esi+1],al
    mov byte[esi+2],dl
    add esi,3
    jmp .finproc
.nohund
    cmp al,48
    je .noten
    mov byte[esi],al
    mov byte[esi+1],dl
    add esi,2
    jmp .finproc
.noten
    mov byte[esi],dl
    inc esi
.finproc
    mov byte[esi],'.'
%ifdef __LINUX__
    mov byte[esi+1],'p'
    mov byte[esi+2],'c'
    mov byte[esi+3],'x'
%else
    mov byte[esi+1],'P'
    mov byte[esi+2],'C'
    mov byte[esi+3],'X'
%endif
    mov byte[esi+4],0
    jmp .findagain
.nofile

    mov edx,.filename
    call Create_File
    ; Save header
    mov bx,ax
    mov ecx,128
    mov edx,pcxheader
    call Write_File
    ; Save picture Data
    mov byte[.rowsleft],223
    cmp byte[resolutn],224
    je .res224p
    mov byte[.rowsleft],238
.res224p
    mov ecx,256
    mov edx,[vidbuffer]
    add edx,16+288
.a
    xor ecx,ecx
    mov esi,edx
    mov edi,mode7tab
    push ebx
    mov ebx,256
.loopp
    mov al,[esi]
    mov [edi],al
    mov ah,al
    and ah,0C0h
    cmp ah,0C0h
    jne .norep
    mov byte[edi],0C1h
    inc edi
    inc ecx
    mov byte[edi],al
.norep
    inc ecx
    inc esi
    inc edi
    dec ebx
    jnz .loopp
    pop ebx
    xor al,al
    push edx
    mov edx,mode7tab
    call Write_File
    pop edx
    add edx,288
    dec byte[.rowsleft]
    jnz .a
    ; Save Palette
    mov ecx,769
    mov edx,[vidbuffer]
    add edx,100000
    call Write_File
    call Makemode7Table
    call Close_File
;    mov dword[Msgptr],.pcxsaved
;    mov eax,[MsgCount]
;    mov [MessageOn],eax
    ret

.save16b
    test byte[pressed+14],1
    jnz near save16b2
    call prepare16b
    mov edi,pcxheader
    mov ecx,128
.clearhead2
    mov byte[edi],0
    inc edi
    dec ecx
    jnz .clearhead2
    ; Initial header = 14 bytes
    mov byte[pcxheader],'B'
    mov byte[pcxheader+1],'M'
    mov dword[pcxheader+2],02A01Ah-768
    mov dword[pcxheader+10],26

    mov dword[pcxheader+14],12
    mov word[pcxheader+18],256
    mov word[pcxheader+20],223
    mov word[pcxheader+22],1
    mov word[pcxheader+24],24

    cmp byte[resolutn],224
    je .res224b
    add dword[pcxheader+2],768*15
    mov word[pcxheader+20],238
.res224b

    ; get unused filename
    mov byte[.filename2+5],'.'
%ifdef __LINUX__
    mov byte[.filename2+6],'b'
    mov byte[.filename2+7],'m'
    mov byte[.filename2+8],'p'
%else
    mov byte[.filename2+6],'B'
    mov byte[.filename2+7],'M'
    mov byte[.filename2+8],'P'
%endif
    mov byte[.filename2+9],0
    mov word[picnum],1
.findagain2
    mov edx,.filename2
    call Open_File
    jc near .nofile2
    mov bx,ax
    call Close_File

    inc word[picnum]
    cmp word[picnum],1000
    je near .nofile2

    mov ax,[picnum]
    xor edx,edx
    mov bx,100
    div bx
    mov cl,al
    mov ax,dx
    xor edx,edx
    mov bx,10
    div bx
    mov esi,.filename2+5
    add cl,48
    add al,48
    add dl,48
    cmp cl,48
    je .nohund2
    mov byte[esi],cl
    mov byte[esi+1],al
    mov byte[esi+2],dl
    add esi,3
    jmp .finproc2
.nohund2
    cmp al,48
    je .noten2
    mov byte[esi],al
    mov byte[esi+1],dl
    add esi,2
    jmp .finproc2
.noten2
    mov byte[esi],dl
    inc esi
.finproc2
    mov byte[esi],'.'
%ifdef __LINUX__
    mov byte[esi+1],'b'
    mov byte[esi+2],'m'
    mov byte[esi+3],'p'
%else
    mov byte[esi+1],'B'
    mov byte[esi+2],'M'
    mov byte[esi+3],'P'
%endif
    mov byte[esi+4],0
    jmp .findagain2
.nofile2

    mov edx,.filename2
    call Create_File
    ; Save header
    mov bx,ax
    mov ecx,26
    mov edx,pcxheader
    call Write_File
    ; Save picture Data
    mov byte[.rowsleft],223
    mov esi,[vidbuffer]
    add esi,32+288*2*223
    cmp byte[resolutn],224
    je .res224b2
    mov byte[.rowsleft],238
    add esi,288*2*15
.res224b2
    mov [.curdptr],esi
.a2
    mov ecx,256
    mov edi,mode7tab
    mov esi,[.curdptr]
    sub dword[.curdptr],288*2
.b2
    push ecx
    mov ax,[esi]
    mov cl,[vesa2_bpos]
    shr ax,cl
    and ax,1Fh
    shl al,3
    mov byte[edi],al
    mov ax,[esi]
    mov cl,[vesa2_gpos]
    shr ax,cl
    and ax,1Fh
    shl al,3
    mov byte[edi+1],al
    mov ax,[esi]
    mov cl,[vesa2_rpos]
    shr ax,cl
    and ax,1Fh
    shl al,3
    mov byte[edi+2],al
    pop ecx
    add edi,3
    add esi,2
    dec ecx
    jnz .b2
    push edx
    mov ecx,768
    mov edx,mode7tab
    call Write_File
    pop edx
    add edx,288*2
    dec byte[.rowsleft]
    jnz near .a2
    call Makemode7Table
    call Close_File
;    mov dword[Msgptr],.rawsaved
;    mov eax,[MsgCount]
;    mov [MessageOn],eax
    call restore16b
    ret

.pcxsaved db 'SNAPSHOT SAVED TO '
%ifdef __LINUX__
.filename db 'image.pcx',0,0,0,0
%else
.filename db 'IMAGE.PCX',0,0,0,0
%endif
.rawsaved db 'SNAPSHOT SAVED TO '
%ifdef __LINUX__
.filename2 db 'image.bmp',0,0,0,0
%else
.filename2 db 'IMAGE.BMP',0,0,0,0
%endif
.rowsleft db 0
.curdptr dd 0

NEWSYM save16b2
    call prepare16b
    mov byte[pressed+14],2
    push es
    mov edi,pcxheader
    mov ecx,128
.clearhead2
    mov byte[edi],0
    inc edi
    dec ecx
    jnz .clearhead2
    ; Initial header = 14 bytes
    mov byte[pcxheader],'B'
    mov byte[pcxheader+1],'M'
    mov dword[pcxheader+2],02A01Ah-256*224*3+512*448*3
    mov dword[pcxheader+10],26
    mov dword[pcxheader+14],12
    mov word[pcxheader+18],512
    mov word[pcxheader+20],448
    mov word[pcxheader+22],1
    mov word[pcxheader+24],24

    ; get unused filename
    mov byte[.filename2+5],'.'
%ifdef __LINUX__
    mov byte[.filename2+6],'b'
    mov byte[.filename2+7],'m'
    mov byte[.filename2+8],'p'
%else
    mov byte[.filename2+6],'B'
    mov byte[.filename2+7],'M'
    mov byte[.filename2+8],'P'
%endif
    mov byte[.filename2+9],0
    mov word[picnum],1
.findagain2
    mov edx,.filename2
    call Open_File
    jc near .nofile2
    mov bx,ax
    call Close_File

    inc word[picnum]
    cmp word[picnum],1000
    je near .nofile2

    mov ax,[picnum]
    xor edx,edx
    mov bx,100
    div bx
    mov cl,al
    mov ax,dx
    xor edx,edx
    mov bx,10
    div bx
    mov esi,.filename2+5
    add cl,48
    add al,48
    add dl,48
    cmp cl,48
    je .nohund2
    mov byte[esi],cl
    mov byte[esi+1],al
    mov byte[esi+2],dl
    add esi,3
    jmp .finproc2
.nohund2
    cmp al,48
    je .noten2
    mov byte[esi],al
    mov byte[esi+1],dl
    add esi,2
    jmp .finproc2
.noten2
    mov byte[esi],dl
    inc esi
.finproc2
    mov byte[esi],'.'
%ifdef __LINUX__
    mov byte[esi+1],'b'
    mov byte[esi+2],'m'
    mov byte[esi+3],'p'
%else
    mov byte[esi+1],'B'
    mov byte[esi+2],'M'
    mov byte[esi+3],'P'
%endif
    mov byte[esi+4],0
    jmp .findagain2
.nofile2

    mov cx,0
    mov edx,.filename2
    call Create_File
    ; Save header
    mov bx,ax
    mov ecx,26
    mov edx,pcxheader
    call Write_File
    ; Save picture Data
    mov dword[.rowsleft],448
    mov ax,[vesa2selec]
    mov es,ax
    mov esi,32*2+640*2*223*2+640*2
    mov [.curdptr],esi
.a2
    mov ecx,512
    mov edi,mode7tab
    mov esi,[.curdptr]
    sub dword[.curdptr],640*2
.b2
    push ecx
    mov ax,[es:esi]
    mov cl,[vesa2_bpos]
    shr ax,cl
    and ax,1Fh
    shl al,3
    mov byte[edi],al
    mov ax,[es:esi]
    mov cl,[vesa2_gpos]
    shr ax,cl
    and ax,1Fh
    shl al,3
    mov byte[edi+1],al
    mov ax,[es:esi]
    mov cl,[vesa2_rpos]
    shr ax,cl
    and ax,1Fh
    shl al,3
    mov byte[edi+2],al
    pop ecx
    add edi,3
    add esi,2
    dec ecx
    jnz .b2
    push edx
    mov ecx,768*2
    mov edx,mode7tab
    call Write_File
    pop edx
    add edx,288*2
    dec dword[.rowsleft]
    jnz near .a2
    call Makemode7Table
    call Close_File
;    mov dword[Msgptr],.rawsaved
;    mov eax,[MsgCount]
;    mov [MessageOn],eax
    pop es
    call restore16b
    ret

.rawsaved db 'SNAPSHOT SAVED TO '
%ifdef __LINUX__
.filename2 db 'image.bmp',0,0,0,0
%else
.filename2 db 'IMAGE.BMP',0,0,0,0
%endif
.rowsleft dd 0
.curdptr dd 0

prepare16b:
   cmp byte[vesa2red10],1
   jne .nored
   cmp byte[cvidmode],5
   jne .nored
   cmp byte[scanlines],1
   je .nored
   cmp byte[smallscreenon],1
   je .nored
   mov byte[vesa2_rpos],10
   mov byte[vesa2_gpos],5
.nored
   ret
restore16b:
   cmp byte[vesa2red10],1
   jne .nored
   mov byte[vesa2_rpos],11
   mov byte[vesa2_gpos],6
.nored
   ret
NEWSYM MenuAsmEnd

⌨️ 快捷键说明

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