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

📄 joy.asm

📁 linux下的任天堂模拟器代码。供大家参考。
💻 ASM
📖 第 1 页 / 共 3 页
字号:
.noright   mov eax,[JoyY]   cmp eax,[JoyMinY209]   jae .noup   mov byte[pressed+14Ch],1.noup   mov eax,[JoyY]   cmp eax,[JoyMaxY209]   jbe .nodown   mov byte[pressed+14Dh],1.nodown.no1joyst.noanalog   test byte[JoyAltrn],1   jne near .joynotexist   mov dword[pressed+102h],0     ; B1-4   cmp byte[JoyQuant209],0   je .joynotexist   ; Set buttons 1-4   mov dx, 0209h   xor al,al   out dx, al   in al, dx   not al   test al,10h   jz .nob1   mov byte[pressed+102h],1.nob1   test al,20h   jz .nob2   mov byte[pressed+103h],1.nob2   cmp byte[JoyBQuant209],2   je .joynotexist   test al,40h   jz .nob3   mov byte[pressed+104h],1.nob3   test al,80h   jz .nob4   mov byte[pressed+105h],1.nob4.joynotexist   retNEWSYM DOSJoyRead   push edx   push ebx   push ecx   inc byte[JoyAltrn]   and byte[JoyAltrn],3   cmp byte[JoyAltrn],0   jne near .noanalog   ; Clear Joystick buttons and movements   mov word[pressed+86h],0      ; B5-6   mov word[pressed+80h],0      ; B7-8   mov dword[pressed+0CCh],0    ; Up,Down,Left,Right, pl1   mov dword[pressed+0E8h],0    ; Up,Down,Left,Right, pl2   ; Process Joystick(s)   cmp byte[JoyQuant],2   jne near .no2joyst   mov dx,201h   call GetCoords3   ; Set button 5-6 + 2player Control   cmp byte[Buttons6],0   jne near .6button   mov eax,[JoyX2]   cmp eax,[JoyMinX2]   jae .noleft2   mov byte[pressed+0EAh],1.noleft2   mov eax,[JoyX2]   cmp eax,[JoyMaxX2]   jbe .noright2   mov byte[pressed+0EBh],1.noright2   mov eax,[JoyY2]   cmp eax,[JoyMinY2]   jae .noup2   mov byte[pressed+0E8h],1.noup2   mov eax,[JoyY2]   cmp eax,[JoyMaxY2]   jbe .nodown2   mov byte[pressed+0E9h],1.nodown2   jmp .1pcoord.6button   mov eax,[JoyY2]   cmp eax,[JoyMinY2]   jae .nob5   mov byte[pressed+086h],1.nob5   mov eax,[JoyX2]   cmp eax,[JoyMinX2]   jae .nob6   mov byte[pressed+087h],1.nob6   cmp byte[Buttons6],2   jne .no8b   mov eax,[JoyY2]   cmp eax,[JoyMaxY2]   jbe .nob7   mov byte[pressed+80h],1.nob7   mov eax,[JoyX2]   cmp eax,[JoyMaxX2]   jbe .nob8   mov byte[pressed+81h],1.nob8.no8b   jmp .1pcoord.no2joyst   ; Set 1 player control   cmp byte[JoyQuant],1   jne near .no1joyst   mov dx,201h   call GetCoords.1pcoord   mov eax,[JoyX]   cmp eax,[JoyMinX]   jae .noleft   mov byte[pressed+0CEh],1.noleft   mov eax,[JoyX]   cmp eax,[JoyMaxX]   jbe .noright   mov byte[pressed+0CFh],1.noright   mov eax,[JoyY]   cmp eax,[JoyMinY]   jae .noup   mov byte[pressed+0CCh],1.noup   mov eax,[JoyY]   cmp eax,[JoyMaxY]   jbe .nodown   mov byte[pressed+0CDh],1.nodown.no1joyst.noanalog   test byte[JoyAltrn],1   jz .joynotexist   mov dword[pressed+82h],0     ; B1-4   cmp byte[JoyQuant],0   je .joynotexist   ; Set buttons 1-4   mov dx, 0201h   xor al,al   out dx, al   in al, dx   not al   test al,10h   jz .nob1   mov byte[pressed+82h],1.nob1   test al,20h   jz .nob2   mov byte[pressed+83h],1.nob2   cmp byte[JoyBQuant],2   je .joynotexist   test al,40h   jz .nob3   mov byte[pressed+84h],1.nob3   test al,80h   jz .nob4   mov byte[pressed+85h],1.nob4.joynotexist   ; Process Joystick Buttons   cmp byte[JoyQuant209],0   je .no209   call JoyRead209.no209   test byte[JoyAltrn],1   jz near .noport4   cmp byte[NumSWs],0   je .nosw   call SideWinder.nosw   cmp byte[NumSWs209],0   je .nosw209   call SideWinder209.nosw209   test byte[JoyAltrn],2   jz .nogrip209   cmp byte[NumGRiPs],0   je .nogrip   call GamePadPro.nogrip   cmp byte[NumGRiPs209],0   je .nogrip209   call GamePadPro209.nogrip209   test byte[PPad],1   jz .noport1   call GetParallelPlayer1.noport1   test byte[PPad],2   jz .noport2   call GetParallelPlayer2.noport2   test byte[PPad],4   jz .noport3   call GetParallelPlayer3.noport3   test byte[PPad],8   jz .noport4   call GetParallelPlayer4.noport4   test byte[PPad],16   jz .noport5   call GetParallelPlayer5.noport5   cmp byte[JoyAltrn],0   je .nogpp2209   cmp byte[NumGRiPs],2   jne .nogpp2   call GamePadPro2.nogpp2   cmp byte[NumGRiPs209],2   jne .nogpp2209   call GamePadPro2209.nogpp2209   pop ecx   pop ebx   pop edx   ret;bit 1 - left,2 - right,3 - down,4 - up,5 - r1,6 - l1,7 - red,8 - yellow;    9 - green,10 - l2,11 - blue,12 - r2,13 - start,14 - select%macro GPProHelp 2   test eax,%1   jz %%nope   mov byte[pressed+ebx+%2],1%%nope%endmacro;A8=buttons, CA=select/start, F0=movement (inc by 4)GamePadPro:   mov al,0   mov dx,201h   call read_gpp   cmp eax,1   je near .error   xor ebx,ebx   mov byte[pressed+ebx+0F0h],0   mov byte[pressed+ebx+0F1h],0   mov byte[pressed+ebx+0F2h],0   mov byte[pressed+ebx+0F3h],0   mov byte[pressed+ebx+0A8h],0   mov byte[pressed+ebx+0A9h],0   mov byte[pressed+ebx+0AAh],0   mov byte[pressed+ebx+0ABh],0   mov byte[pressed+ebx+0ACh],0   mov byte[pressed+ebx+0ADh],0   mov byte[pressed+ebx+0AEh],0   mov byte[pressed+ebx+0AFh],0   mov byte[pressed+ebx+0CAh],0   mov byte[pressed+ebx+0CBh],0   GPProHelp 0002h,0F2h ; left   GPProHelp 0004h,0F3h ; right   GPProHelp 0008h,0F1h ; down   GPProHelp 0010h,0F0h ; up   GPProHelp 0020h,0AEh ; r1   GPProHelp 0040h,0ACh ; l1   GPProHelp 0080h,0A8h ; red   GPProHelp 0100h,0AAh ; yellow   GPProHelp 0200h,0ABh ; green   GPProHelp 0400h,0ADh ; l2   GPProHelp 0800h,0A9h ; blue   GPProHelp 1000h,0AFh ; r2   GPProHelp 2000h,0CBh ; start   GPProHelp 4000h,0CAh ; select.error   retGamePadPro2:   mov al,1   mov dx,201h   call read_gpp   cmp eax,1   je near .error   mov ebx,4   mov byte[pressed+ebx+0F0h],0   mov byte[pressed+ebx+0F1h],0   mov byte[pressed+ebx+0F2h],0   mov byte[pressed+ebx+0F3h],0   mov ebx,8   mov byte[pressed+ebx+0A8h],0   mov byte[pressed+ebx+0A9h],0   mov byte[pressed+ebx+0AAh],0   mov byte[pressed+ebx+0ABh],0   mov byte[pressed+ebx+0ACh],0   mov byte[pressed+ebx+0ADh],0   mov byte[pressed+ebx+0AEh],0   mov byte[pressed+ebx+0AFh],0   mov byte[pressed+ebx+0CAh],0   mov byte[pressed+ebx+0CBh],0   mov ebx,4   GPProHelp 0002h,0F2h ; left   GPProHelp 0004h,0F3h ; right   GPProHelp 0008h,0F1h ; down   GPProHelp 0010h,0F0h ; up   mov ebx,8   GPProHelp 0020h,0AEh ; r1   GPProHelp 0040h,0ACh ; l1   GPProHelp 0080h,0A8h ; red   GPProHelp 0100h,0AAh ; yellow   GPProHelp 0200h,0ABh ; green   GPProHelp 0400h,0ADh ; l2   GPProHelp 0800h,0A9h ; blue   GPProHelp 1000h,0AFh ; r2   GPProHelp 2000h,0CBh ; start   GPProHelp 4000h,0CAh ; select.error   retSideWinder:  mov al,[NumSWs]  mov [_SWCount],al  mov dx,201h  call _readSideWinder  ;bit 0=error 1=up 2=dn 3=rt 4=lt 5=A 6=B 7=C 8=X 9=Y 10=Z 11=L 12=R 13=St 14=M  ;k....L=L, R=R, start=start, M=select, X=y, Y=x, B=a, A=b  ;sidewinder=snes.loop  mov eax,[_SW1]  xor ebx,ebx  cmp byte[WhichSW],2  jne .noSW2  mov eax,[_SW2]  mov ebx,08h.noSW2  cmp byte[WhichSW],3  jne .noSW3  mov eax,[_SW3]  mov ebx,10h.noSW3  cmp byte[WhichSW],4  jne .noSW4  mov eax,[_SW4]  mov ebx,18h.noSW4  inc byte[WhichSW]  mov byte[pressed+ebx+0D4h],0  mov byte[pressed+ebx+0D5h],0  mov byte[pressed+ebx+0D6h],0  mov byte[pressed+ebx+0D7h],0  mov byte[pressed+ebx+088h],0  mov byte[pressed+ebx+089h],0  mov byte[pressed+ebx+08Ah],0  mov byte[pressed+ebx+08Bh],0  mov byte[pressed+ebx+08Ch],0  mov byte[pressed+ebx+08Dh],0  mov byte[pressed+ebx+08Eh],0  mov byte[pressed+ebx+08Fh],0  mov byte[pressed+ebx+0C8h],0  mov byte[pressed+ebx+0C9h],0  test ax,02h   ; up  jz .noup  mov byte[pressed+ebx+0D4h],1.noup  test ax,04h   ; down  jz .nodown  mov byte[pressed+ebx+0D5h],1.nodown  test ax,08h   ; right  jz .noright  mov byte[pressed+ebx+0D7h],1.noright  test ax,10h   ; left  jz .noleft  mov byte[pressed+ebx+0D6h],1.noleft  test ax,20h   ; A  jz .noa  mov byte[pressed+ebx+088h],1.noa  test ax,40h   ; B  jz .nob  mov byte[pressed+ebx+089h],1.nob  test ax,80h  ; C  jz .noc  mov byte[pressed+ebx+08Ah],1.noc  test ax,100h  ; X  jz .nox  mov byte[pressed+ebx+08Bh],1.nox  test ax,200h  ; Y  jz .noy  mov byte[pressed+ebx+08Ch],1.noy  test ax,400h ; Z  jz .noz  mov byte[pressed+ebx+08Dh],1.noz  test ax,800h ; L  jz .nol  mov byte[pressed+ebx+08Eh],1.nol  test ax,1000h ; R  jz .nor  mov byte[pressed+ebx+08Fh],1.nor  test ax,2000h ; start  jz .nostart  mov byte[pressed+ebx+0C8h],1.nostart  test ax,4000h ; M  jz .noselect  mov byte[pressed+ebx+0C9h],1.noselect  mov al,[WhichSW]  cmp al,[NumSWs]  jbe near .loop  ret                         ;return to calling procedure;A8=buttons, CA=select/start, F0=movement (inc by 4)GamePadPro209:   mov al,0   mov dx,209h   call read_gpp   cmp eax,1   je near .error   xor ebx,ebx   mov byte[pressed+ebx+170h],0   mov byte[pressed+ebx+171h],0   mov byte[pressed+ebx+172h],0   mov byte[pressed+ebx+173h],0   mov byte[pressed+ebx+128h],0   mov byte[pressed+ebx+129h],0   mov byte[pressed+ebx+12Ah],0   mov byte[pressed+ebx+12Bh],0   mov byte[pressed+ebx+12Ch],0   mov byte[pressed+ebx+12Dh],0   mov byte[pressed+ebx+12Eh],0   mov byte[pressed+ebx+12Fh],0   mov byte[pressed+ebx+14Ah],0   mov byte[pressed+ebx+14Bh],0   GPProHelp 0002h,1F2h ; left   GPProHelp 0004h,1F3h ; right   GPProHelp 0008h,1F1h ; down   GPProHelp 0010h,1F0h ; up   GPProHelp 0020h,1AEh ; r1   GPProHelp 0040h,1ACh ; l1   GPProHelp 0080h,1A8h ; red   GPProHelp 0100h,1AAh ; yellow   GPProHelp 0200h,1ABh ; green   GPProHelp 0400h,1ADh ; l2   GPProHelp 0800h,1A9h ; blue   GPProHelp 1000h,1AFh ; r2   GPProHelp 2000h,1CBh ; start   GPProHelp 4000h,1CAh ; select.error   retGamePadPro2209:   mov al,1   mov dx,209h   call read_gpp   cmp eax,1

⌨️ 快捷键说明

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