📄 procvid.asm
字号:
;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach );;http://www.zsnes.com;http://sourceforge.net/projects/zsnes;https://zsnes.bountysource.com;;This program is free software; you can redistribute it and/or;modify it under the terms of the GNU General Public License;version 2 as published by the Free Software Foundation.;;This program is distributed in the hope that it will be useful,;but WITHOUT ANY WARRANTY; without even the implied warranty of;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the;GNU General Public License for more details.;;You should have received a copy of the GNU General Public License;along with this program; if not, write to the Free Software;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.%include "macros.mac"EXTSYM BGMA,V8Mode,antienab,cacheud,cbitmode,ccud,cfield,cgram,coladdb,coladdgEXTSYM coladdr,curblank,curfps,cvidmode,delay,extlatch,En2xSaIEXTSYM gammalevel,hirestiledat,ignor512,latchx,latchy,maxbr,ForceNewGfxOffEXTSYM newengen,nextframe,objptr,pressed,prevpal,res512switch,resolutnEXTSYM romispal,scaddtype,scanlines,selcA000,t1cc,vcache4b,vesa2_bposEXTSYM spritetablea,vesa2_clbit,vesa2_gpos,vesa2_rpos,vesa2red10EXTSYM vidbuffer,vram,KeyStateSelct,soundonEXTSYM bg1objptr,DecompAPtr,HalfTransB,HalfTransCEXTSYM DrawScreen,MMXSupportEXTSYM Get_MouseData,Get_MousePositionDisplacement,GUIEnableTransp,GUIFontDataEXTSYM StopSound,StartSound,PrevPicture,nggposng,current_zst,newest_zstEXTSYM GetTimeInSeconds,bg3ptr,bg3scroly,bg3scrolx,C4RamEXTSYM genfulladdtab,genfulladdtabng,TimerEnable,ShowTimer,debugdisble,GUIOnEXTSYM FilteredGUI,HalfTrans,SmallMsgText,Mode7HiRes,mosenng,mosszngEXTSYM intrlng,mode7hr,newgfx16b,vesa2_clbitng,vesa2_clbitng2,CSStatusEXTSYM CSStatus2,CSStatus3,CSStatus4,SpecialLine,Clear2xSaIBuffer,vidbufferofsb,bg1scrolyEXTSYM MovieProcessing,MovieFrameStr,GetMovieFrameStr,mouse1lh,mouse2lhEXTSYM MovieDisplayFrame,SloMo,MouseCount,device2,LoadPictureEXTSYM zst_determine_newest,newestfiledate,zst_exists,ClockBox,SSAutoFire%ifndef __MSDOS__EXTSYM MouseMoveX,MouseMoveY,MouseButtons,MultiMouseProcess,mouse%elseEXTSYM SB_blank,vsyncon,Triplebufen,granadd,Palette0,smallscreenon,ScreenScale,vesa2selecEXTSYM displayfpspal,superscopepal,saveselectpal%endif%ifdef __UNIXSDL__EXTSYM numlockptr%endif%ifdef __MSDOS__%include "video/2xsaimmx.inc"%endif%include "video/copyvid.inc"SECTION .text;*******************************************************; ShowVideo Processes & displays video;*******************************************************NEWSYM showvideo push esi push edi push edx push ebx push ebp inc byte[ccud] mov bl,[ccud] cmp byte[cacheud],bl je .noinc mov byte[ccud],0.noinc call copyvid mov eax,[KeyStateSelct] test byte[pressed+eax],1 jz .nosavesel call saveselect.nosavesel xor ecx,ecx pop ebp pop ebx pop edx pop edi pop esi retNEWSYM SwapMouseButtons test bl,3 jpe .noswap xor bl,3.noswap retNEWSYM processmouse1 push esi push edi push edx push ebx%ifndef __MSDOS__ cmp byte[MouseCount],1 jle .nomultimouse pushad mov byte[mouse],0 call MultiMouseProcess popad mov bx,[MouseButtons] cmp byte[mouse1lh],1 jne .notlefthanded1 call SwapMouseButtons.notlefthanded1 mov [mousebuttons],bx mov cx,[MouseMoveX] mov dx,[MouseMoveY] jmp .mousestuff.nomultimouse%endif call Get_MouseData cmp byte[mouse1lh],1 jne .notlefthanded2 call SwapMouseButtons.notlefthanded2 mov [mousebuttons],bx call Get_MousePositionDisplacement.mousestuff mov word[mousexpos],0 cmp cx,0 je .noxchange mov byte[mousexdir],0 cmp cx,0 jge .noneg mov byte[mousexdir],1 neg cx.noneg mov [mousexpos],cx.noxchange mov word[mouseypos],0 cmp dx,0 je .noychange mov byte[mouseydir],0 cmp dx,0 jge .noneg2 mov byte[mouseydir],1 neg dx.noneg2 mov [mouseypos],dx.noychange xor ecx,ecx pop ebx pop edx pop edi pop esi retNEWSYM processmouse2 push esi push edi push edx push ebx%ifndef __MSDOS__ cmp byte[MouseCount],1 jle .nomultimouse pushad mov byte[mouse],1 call MultiMouseProcess popad mov bx,[MouseButtons+2] jmp .mousestuff.nomultimouse%endif call Get_MouseData.mousestuff cmp byte[mouse2lh],1 jne .notlefthanded call SwapMouseButtons.notlefthanded mov [mousebuttons],bx cmp byte[device2],2 jne .ss push eax mov eax,[SSAutoFire] cmp byte[pressed+eax],0 pop eax je .noautosw cmp byte[ssautoswb],1 je .ss xor byte[ssautosw],20h mov byte[ssautoswb],1 mov dword[Msgptr],.ssautoen cmp byte[ssautosw],0 jne .nononauto mov dword[Msgptr],.ssautodi.nononauto mov eax,[MsgCount] mov [MessageOn],eax jmp .ss.noautosw mov byte[ssautoswb],0.ss%ifndef __MSDOS__ cmp byte[MouseCount],1 jle .nomultimouse2 mov cx,[MouseMoveX+2] mov dx,[MouseMoveY+2] jmp .mousestuff2.nomultimouse2%endif call Get_MousePositionDisplacement.mousestuff2 cmp byte[device2],3 je .le cmp byte[device2],4 je .le cmp byte[device2],2 jne .ss2.le add word[mousexloc],cx test word[mousexloc],8000h jz .nowrapleft mov word[mousexloc],0.nowrapleft cmp word[mousexloc],255 jbe .nowrapright mov word[mousexloc],255.nowrapright mov ax,[mousexloc] add ax,40 mov [latchx],ax mov byte[extlatch],40h.ss2 mov word[mousexpos],0 cmp cx,0 je .noxchange mov byte[mousexdir],0 cmp cx,0 jge .noneg mov byte[mousexdir],1 neg cx.noneg mov [mousexpos],cx.noxchange cmp byte[device2],3 je .le2 cmp byte[device2],4 je .le2 cmp byte[device2],2 jne .ss3.le2 add word[mouseyloc],dx test word[mouseyloc],8000h jz .nowrapup mov word[mouseyloc],0.nowrapup cmp word[mouseyloc],223 jbe .nowrapdown mov word[mouseyloc],223.nowrapdown mov ax,[mouseyloc] mov [latchy],ax.ss3 mov word[mouseypos],0 cmp dx,0 je .noychange mov byte[mouseydir],0 cmp dx,0 jge .noneg2 mov byte[mouseydir],1 neg dx.noneg2 mov [mouseypos],dx.noychange xor ecx,ecx pop ebx pop edx pop edi pop esi retSECTION .data.ssautoen db 'AUTOFIRE ENABLED.',0.ssautodi db 'AUTOFIRE DISABLED.',0NEWSYM ssautosw, db 20hNEWSYM mousexloc, dw 128NEWSYM mouseyloc, dw 112SECTION .bssNEWSYM ssautoswb, resb 1NEWSYM mousebuttons, resw 1NEWSYM mousexpos, resw 1NEWSYM mousexdir, resb 1NEWSYM mouseypos, resw 1NEWSYM mouseydir, resb 1NEWSYM mousechan, resb 1SECTION .text;*******************************************************; Output Hex Outputs the hex in al @ esi;*******************************************************NEWSYM outputhex push edi push esi push eax push ebx push ecx push esi mov edi,FontData xor ebx,ebx mov bl,al shr bl,4 shl ebx,3 add edi,ebx add edi,8 mov cl,8.loopa mov ah,[edi] mov ch,8.loopb test ah,80h jz .nowrite mov byte[esi],128 mov byte[esi+289],192.nowrite shl ah,1 inc esi dec ch jnz .loopb add esi,280 inc edi dec cl jnz .loopa pop esi add esi,8 mov edi,FontData xor ebx,ebx mov bl,al and bl,0Fh shl ebx,3 add edi,ebx add edi,8 mov cl,8.loopa2 mov ah,[edi] mov ch,8.loopb2 test ah,80h jz .nowrite2 mov byte[esi],128 mov byte[esi+289],192.nowrite2 shl ah,1 inc esi dec ch jnz .loopb2 add esi,280 inc edi dec cl jnz .loopa2 pop ecx pop ebx pop eax pop esi pop edi retOutputText16b: cmp byte[ForceNonTransp],1 je near OutText16bnt cmp byte[GUIEnableTransp],0 je near OutText16bnt ; output text in edi to esi push ebx push eax mov cl,9.loopa mov ch,9 xor eax,eax cmp cl,1 je .not1 mov al,[edi] shl eax,1.not1 xor ebx,ebx cmp cl,9 je .loopb mov bl,[edi-1].loopb test ax,100h jz .nowrite push eax and word[esi],dx shr word[esi],1 and word[esi+75036*4],dx shr word[esi+75036*4],1 ror edx,16 add word[esi],dx add word[esi+75036*4],dx ror edx,16 pop eax jmp .nowrite2.nowrite test bx,100h jz .nowrite2 and word[esi],dx shr word[esi],1 and word[esi+75036*4],dx shr word[esi+75036*4],1.nowrite2 shl ax,1 shl bx,1 add esi,2 dec ch jnz .loopb add esi,279*2 inc edi dec cl jnz .loopa pop eax pop ebx retOutText16bnt: ; output text in edi to esi push ebx push eax mov cl,9.loopa mov ch,9 xor eax,eax cmp cl,1 je .not1 mov al,[edi] shl eax,1.not1 xor ebx,ebx cmp cl,9 je .loopb mov bl,[edi-1].loopb test ax,100h jz .nowrite mov word[esi],0FFFFh mov word[esi+75036*4],0FFFFh jmp .nowrite2.nowrite test bx,100h jz .nowrite2 and word[esi],dx and word[esi+75036*4],dx shr word[esi],1 shr word[esi+75036*4],1.nowrite2 shl ax,1 shl bx,1 add esi,2 dec ch jnz .loopb add esi,279*2 inc edi dec cl jnz .loopa pop eax pop ebx retNEWSYM outputhex16 push edi push esi push eax push ebx push ecx push edx push esi mov dx,[vesa2_clbitng] ror edx,16 mov dx,[vesa2_clbitng] shr dx,1 ror edx,16 mov edi,FontData xor ebx,ebx mov bl,al shr bl,4 shl ebx,3 add edi,ebx add edi,8 call OutputText16b pop esi add esi,16 mov edi,FontData xor ebx,ebx mov bl,al and bl,0Fh shl ebx,3 add edi,ebx add edi,8 call OutputText16b pop edx pop ecx pop ebx pop eax pop esi pop edi retSECTION .dataNEWSYM ASCII2Font db 00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h db 00h,00h,00h,00h,00h,00h,00h,00h,00h,30h,00h,00h,00h,00h,00h,00h db 00h,3Eh,33h,31h,3Fh,37h,2Fh,3Dh,3Ah,3Bh,35h,38h,39h,25h,28h,29h db 01h,02h,03h,04h,05h,06h,07h,08h,09h,0Ah,2Eh,40h,2Ah,32h,2Bh,36h db 3Ch,0Bh,0Ch,0Dh,0Eh,0Fh,10h,11h,12h,13h,14h,15h,16h,17h,18h,19h db 1Ah,1Bh,1Ch,1Dh,1Eh,1Fh,20h,21h,22h,23h,24h,2Ch,34h,2Dh,42h,26h db 41h,0Bh,0Ch,0Dh,0Eh,0Fh,10h,11h,12h,13h,14h,15h,16h,17h,18h,19h db 1Ah,1Bh,1Ch,1Dh,1Eh,1Fh,20h,21h,22h,23h,24h,43h,00h,44h,27h,00h db 0Dh,1Fh,0Fh,0Bh,0Bh,0Bh,0Bh,0Dh,0Fh,0Fh,0Fh,13h,13h,13h,0Bh,0Bh db 0Fh,0Bh,0Bh,19h,19h,19h,1Fh,1Fh,23h,19h,1Fh,0Dh,10h,23h,1Ah,10h db 0Bh,4Eh,4Fh,50h,51h,52h,53h,54h,55h,56h,57h,58h,59h,5Ah,5Bh,5Ch db 5Dh,5Eh,5Fh,60h,61h,62h,63h,64h,65h,66h,67h,68h,69h,6Ah,6Bh,6Ch db 6Dh,6Eh,6Fh,70h,71h,72h,73h,74h,75h,76h,77h,78h,79h,7Ah,7Bh,7Ch db 7Dh,7Eh,7Fh,80h,81h,82h,83h,84h,85h,86h,87h,88h,89h,8Ah,8Bh,8Ch db 00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h,00h db 00h,00h,00h,00h,00h,00h,00h,4Dh,4Ch,4Bh,4Ah,45h,46h,47h,48h,49hNEWSYM FontData; bitmap 8x8 font ; char, offset for ASCII2Font db 0,0,0,0,0,0,0,0 ; ' ', 00 db 01111100b,11000110b,11001110b,11010110b ; 0, 01 db 11100110b,11000110b,01111100b,00000000b db 00011000b,00111000b,01111000b,00011000b ; 1, 02 db 00011000b,00011000b,01111110b,00000000b db 01111100b,11000110b,00001100b,00011000b ; 2, 03 db 00110000b,01100110b,11111110b,00000000b db 01111100b,11000110b,00000110b,00111100b ; 3, 04 db 00000110b,11000110b,01111100b,00000000b db 00111100b,01101100b,11001100b,11111110b ; 4, 05 db 00001100b,00001100b,00001100b,00000000b db 11111110b,11000000b,11000000b,11111100b ; 5, 06 db 00000110b,11000110b,01111100b,00000000b db 00111100b,01100000b,11000000b,11111100b ; 6, 07 db 11000110b,11000110b,01111100b,00000000b db 11111110b,11000110b,00000110b,00001100b ; 7, 08 db 00011000b,00011000b,00011000b,00000000b db 01111100b,11000110b,11000110b,01111100b ; 8, 09 db 11000110b,11000110b,01111100b,00000000b db 01111100b,11000110b,11000110b,01111110b ; 9, 0A db 00000110b,11000110b,01111100b,00000000b db 00111000b,01101100b,11000110b,11111110b ; A, 0B db 11000110b,11000110b,11000110b,00000000b db 11111100b,11000110b,11000110b,11111100b ; B, 0C db 11000110b,11000110b,11111100b,00000000b db 01111100b,11000110b,11000000b,11000000b ; C, 0D db 11000000b,11000110b,01111100b,00000000b db 11111100b,11000110b,11000110b,11000110b ; D, 0E db 11000110b,11000110b,11111100b,00000000b db 11111110b,11000000b,11000000b,11111000b ; E, 0F db 11000000b,11000000b,11111110b,00000000b db 11111110b,11000000b,11000000b,11111000b ; F, 10 db 11000000b,11000000b,11000000b,00000000b db 01111100b,11000110b,11000000b,11000000b ; G, 11 db 11001110b,11000110b,01111100b,00000000b db 11000110b,11000110b,11000110b,11111110b ; H, 12 db 11000110b,11000110b,11000110b,00000000b db 00111100b,00011000b,00011000b,00011000b ; I, 13 db 00011000b,00011000b,00111100b,00000000b db 00011110b,00001100b,00001100b,00001100b ; J, 14 db 00001100b,11001100b,00111100b,00000000b db 11001100b,11011000b,11110000b,11100000b ; K, 15 db 11110000b,11011000b,11001100b,00000000b db 11000000b,11000000b,11000000b,11000000b ; L, 16 db 11000000b,11000000b,11111110b,00000000b db 11000110b,11101110b,11111110b,11010110b ; M, 17 db 11000110b,11000110b,11000110b,00000000b db 11000110b,11100110b,11110110b,11011110b ; N, 18 db 11001110b,11000110b,11000110b,00000000b db 01111100b,11000110b,11000110b,11000110b ; O, 19 db 11000110b,11000110b,01111100b,00000000b db 11111100b,11000110b,11000110b,11111100b ; P, 1A db 11000000b,11000000b,11000000b,00000000b db 01111100b,11000110b,11000110b,11000110b ; Q, 1B db 11010110b,11001110b,01111110b,00000000b db 11111100b,11000110b,11000110b,11111100b ; R, 1C db 11001100b,11000110b,11000110b,00000000b db 01111100b,11000110b,11000000b,01111100b ; S, 1D db 00000110b,11000110b,01111100b,00000000b db 01111110b,00011000b,00011000b,00011000b ; T, 1E db 00011000b,00011000b,00011000b,00000000b db 11000110b,11000110b,11000110b,11000110b ; U, 1F db 11000110b,11000110b,01111100b,00000000b db 11000110b,11000110b,11000110b,11000110b ; V, 20 db 01101100b,00111000b,00010000b,00000000b db 11000110b,11000110b,11000110b,11010110b ; W, 21 db 11010110b,11111110b,01101100b,00000000b db 11000110b,01101100b,00111000b,00010000b ; X, 22 db 00111000b,01101100b,11000110b,00000000b db 11001100b,11001100b,01111000b,00110000b ; Y, 23 db 00110000b,00110000b,00110000b,00000000b db 11111100b,10001100b,00011000b,00110000b ; Z, 24 db 01100000b,11000100b,11111100b,00000000b db 00000000b,00000000b,00000000b,11111110b ; -, 25 db 00000000b,00000000b,00000000b,00000000b db 00000000b,00000000b,00000000b,00000000b ; _, 26 db 00000000b,00000000b,11111110b,00000000b db 01110000b,11011100b,00000110b,00000000b ; ~, 27 db 00000000b,00000000b,00000000b,00000000b db 00000000b,00000000b,00000000b,00000000b ; ., 28 db 00000000b,00110000b,00110000b,00000000b db 00000010b,00000100b,00001000b,00010000b ; /, 29 db 00100000b,01000000b,10000000b,00000000b db 00001100b,00011000b,00110000b,01100000b ; <, 2A db 00110000b,00011000b,00001100b,00000000b db 01100000b,00110000b,00011000b,00001100b ; >, 2B db 00011000b,00110000b,01100000b,00000000b db 00111000b,00100000b,00100000b,00100000b ; [, 2C db 00100000b,00100000b,00111000b,00000000b db 00111000b,00001000b,00001000b,00001000b ; ], 2D db 00001000b,00001000b,00111000b,00000000b db 00000000b,00011000b,00011000b,00000000b ; :, 2E db 00011000b,00011000b,00000000b,00000000b db 00011000b,00100100b,00011000b,00111010b ; &, 2F db 01000100b,01000110b,00111010b,00000000b ; Arrow, 30 ; #, 31 (, 3A {, 43 ; =, 32 ), 3B }, 44 ; ", 33 @, 3C Up,45 ; \, 34 ', 3D Dn,46 ; *, 35 !, 3E Lt,47 ; ?, 36 $, 3F Rt,48 ; %, 37 ;, 40 Bk,49 ; +, 38 `, 41 .5,4A ; ,, 39 ^, 42
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -