📄 joy.asm
字号:
je near .error mov ebx,4 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 ebx,8 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 mov ebx,4 GPProHelp 0002h,1F2h ; left GPProHelp 0004h,1F3h ; right GPProHelp 0008h,1F1h ; down GPProHelp 0010h,1F0h ; up mov ebx,8 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 retSideWinder209: mov al,[NumSWs209] mov [_SWCount],al mov dx,209h 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+154h],0 mov byte[pressed+ebx+155h],0 mov byte[pressed+ebx+156h],0 mov byte[pressed+ebx+157h],0 mov byte[pressed+ebx+108h],0 mov byte[pressed+ebx+109h],0 mov byte[pressed+ebx+10Ah],0 mov byte[pressed+ebx+10Bh],0 mov byte[pressed+ebx+10Ch],0 mov byte[pressed+ebx+10Dh],0 mov byte[pressed+ebx+10Eh],0 mov byte[pressed+ebx+10Fh],0 mov byte[pressed+ebx+148h],0 mov byte[pressed+ebx+149h],0 test ax,02h ; up jz .noup mov byte[pressed+ebx+154h],1.noup test ax,04h ; down jz .nodown mov byte[pressed+ebx+155h],1.nodown test ax,08h ; right jz .noright mov byte[pressed+ebx+157h],1.noright test ax,10h ; left jz .noleft mov byte[pressed+ebx+156h],1.noleft test ax,20h ; A jz .noa mov byte[pressed+ebx+108h],1.noa test ax,40h ; B jz .nob mov byte[pressed+ebx+109h],1.nob test ax,80h ; C jz .noc mov byte[pressed+ebx+10Ah],1.noc test ax,100h ; X jz .nox mov byte[pressed+ebx+10Bh],1.nox test ax,200h ; Y jz .noy mov byte[pressed+ebx+10Ch],1.noy test ax,400h ; Z jz .noz mov byte[pressed+ebx+10Dh],1.noz test ax,800h ; L jz .nol mov byte[pressed+ebx+10Eh],1.nol test ax,1000h ; R jz .nor mov byte[pressed+ebx+10Fh],1.nor test ax,2000h ; start jz .nostart mov byte[pressed+ebx+148h],1.nostart test ax,4000h ; M jz .noselect mov byte[pressed+ebx+149h],1.noselect mov al,[WhichSW] cmp al,[NumSWs209] jbe near .loop ret ;return to calling procedure; Parallel SNES pad reader routines by Karl Stenerud; Original design by Benji York:;%macro PPortHelp 3 mov al, %1 out dx, al mov al, 0F8h out dx, al inc dx in al, dx dec dx and ax, %2 jnz %%nobutton mov byte[pressed+%3], 1%%nobutton%endmacro%macro PPortHelpInv 3 ;needed for the pad 5 mov al, %1 out dx, al mov al, 0F8h out dx, al inc dx in al, dx dec dx and ax, %2 jz %%nobutton ;pad 5 is on pin 11, which is hardware inverted... mov byte[pressed+%3], 1%%nobutton%endmacroGetParallelPlayer1: mov dx, 0378h mov byte[pressed+180h],0 mov byte[pressed+181h],0 mov byte[pressed+182h],0 mov byte[pressed+183h],0 mov byte[pressed+184h],0 mov byte[pressed+185h],0 mov byte[pressed+186h],0 mov byte[pressed+187h],0 mov byte[pressed+188h],0 mov byte[pressed+189h],0 mov byte[pressed+18Ah],0 mov byte[pressed+18Bh],0 PPortHelp 0FAh, 40h, 180h ;Mask 40h (pin 10 of lpt : data for pad 1) PPortHelp 0F9h, 40h, 181h PPortHelp 0F9h, 40h, 182h PPortHelp 0F9h, 40h, 183h PPortHelp 0F9h, 40h, 184h PPortHelp 0F9h, 40h, 185h PPortHelp 0F9h, 40h, 186h PPortHelp 0F9h, 40h, 187h PPortHelp 0F9h, 40h, 188h PPortHelp 0F9h, 40h, 189h PPortHelp 0F9h, 40h, 18Ah PPortHelp 0F9h, 40h, 18Bh retGetParallelPlayer2: mov dx, 0378h mov byte[pressed+190h],0 mov byte[pressed+191h],0 mov byte[pressed+192h],0 mov byte[pressed+193h],0 mov byte[pressed+194h],0 mov byte[pressed+195h],0 mov byte[pressed+196h],0 mov byte[pressed+197h],0 mov byte[pressed+198h],0 mov byte[pressed+199h],0 mov byte[pressed+19Ah],0 mov byte[pressed+19Bh],0 PPortHelp 0FAh, 20h, 190h ;Mask 20h (pin 12 of lpt : data for pad 2) PPortHelp 0F9h, 20h, 191h PPortHelp 0F9h, 20h, 192h PPortHelp 0F9h, 20h, 193h PPortHelp 0F9h, 20h, 194h PPortHelp 0F9h, 20h, 195h PPortHelp 0F9h, 20h, 196h PPortHelp 0F9h, 20h, 197h PPortHelp 0F9h, 20h, 198h PPortHelp 0F9h, 20h, 199h PPortHelp 0F9h, 20h, 19Ah PPortHelp 0F9h, 20h, 19Bh retGetParallelPlayer3: mov dx, 0378h mov byte[pressed+1A0h],0 mov byte[pressed+1A1h],0 mov byte[pressed+1A2h],0 mov byte[pressed+1A3h],0 mov byte[pressed+1A4h],0 mov byte[pressed+1A5h],0 mov byte[pressed+1A6h],0 mov byte[pressed+1A7h],0 mov byte[pressed+1A8h],0 mov byte[pressed+1A9h],0 mov byte[pressed+1AAh],0 mov byte[pressed+1ABh],0 PPortHelp 0FAh, 10h, 1A0h ;Mask 10h (pin 13 of lpt : data for pad 3) PPortHelp 0F9h, 10h, 1A1h PPortHelp 0F9h, 10h, 1A2h PPortHelp 0F9h, 10h, 1A3h PPortHelp 0F9h, 10h, 1A4h PPortHelp 0F9h, 10h, 1A5h PPortHelp 0F9h, 10h, 1A6h PPortHelp 0F9h, 10h, 1A7h PPortHelp 0F9h, 10h, 1A8h PPortHelp 0F9h, 10h, 1A9h PPortHelp 0F9h, 10h, 1AAh PPortHelp 0F9h, 10h, 1ABh retGetParallelPlayer4: mov dx, 0378h mov byte[pressed+1B0h],0 mov byte[pressed+1B1h],0 mov byte[pressed+1B2h],0 mov byte[pressed+1B3h],0 mov byte[pressed+1B4h],0 mov byte[pressed+1B5h],0 mov byte[pressed+1B6h],0 mov byte[pressed+1B7h],0 mov byte[pressed+1B8h],0 mov byte[pressed+1B9h],0 mov byte[pressed+1BAh],0 mov byte[pressed+1BBh],0 PPortHelp 0FAh, 08h, 1B0h PPortHelp 0F9h, 08h, 1B1h ;Mask 08h (pin 15 of lpt : data for pad 4) PPortHelp 0F9h, 08h, 1B2h PPortHelp 0F9h, 08h, 1B3h PPortHelp 0F9h, 08h, 1B4h PPortHelp 0F9h, 08h, 1B5h PPortHelp 0F9h, 08h, 1B6h PPortHelp 0F9h, 08h, 1B7h PPortHelp 0F9h, 08h, 1B8h PPortHelp 0F9h, 08h, 1B9h PPortHelp 0F9h, 08h, 1BAh PPortHelp 0F9h, 08h, 1BBh retGetParallelPlayer5: mov dx, 0378h mov byte[pressed+1c0h],0 mov byte[pressed+1c1h],0 mov byte[pressed+1c2h],0 mov byte[pressed+1c3h],0 mov byte[pressed+1c4h],0 mov byte[pressed+1c5h],0 mov byte[pressed+1c6h],0 mov byte[pressed+1c7h],0 mov byte[pressed+1c8h],0 mov byte[pressed+1c9h],0 mov byte[pressed+1cAh],0 mov byte[pressed+1cBh],0 PPortHelpInv 0FAh, 80h, 1c0h PPortHelpInv 0F9h, 80h, 1c1h ;Mask 80h (pin 11 of lpt : data for pad 5) PPortHelpInv 0F9h, 80h, 1c2h PPortHelpInv 0F9h, 80h, 1c3h PPortHelpInv 0F9h, 80h, 1c4h PPortHelpInv 0F9h, 80h, 1c5h PPortHelpInv 0F9h, 80h, 1c6h PPortHelpInv 0F9h, 80h, 1c7h PPortHelpInv 0F9h, 80h, 1c8h PPortHelpInv 0F9h, 80h, 1c9h PPortHelpInv 0F9h, 80h, 1cAh PPortHelpInv 0F9h, 80h, 1cBh ret%macro SetDefaultKey2 13 mov dword[%1upk],%4 ; Up mov dword[%1downk],%5 ; Down mov dword[%1leftk],%6 ; Left mov dword[%1rightk],%7 ; Right mov dword[%1startk],%3 ; Start mov dword[%1selk],%2 ; Select mov dword[%1Ak],%9 ; A mov dword[%1Bk],%12 ; B mov dword[%1Xk],%8 ; X mov dword[%1Yk],%11 ; Y mov dword[%1Lk],%10 ; L mov dword[%1Rk],%13 ; R%endmacro%macro SetDefaultKey 12 cmp bh,0 jne %%nopl1 SetDefaultKey2 pl1,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12%%nopl1 cmp bh,1 jne %%nopl2 SetDefaultKey2 pl2,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12%%nopl2 cmp bh,2 jne %%nopl3 SetDefaultKey2 pl3,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12%%nopl3 cmp bh,3 jne %%nopl4 SetDefaultKey2 pl4,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12%%nopl4 cmp bh,4 jne %%nopl5 SetDefaultKey2 pl5,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12%%nopl5%endmacroNEWSYM SetInputDevice209 ; bl = device #, bh = player # (0-4) ; Sets keys according to input device selected cmp bl,0 jne near .nozero SetDefaultKey 0,0,0,0,0,0,0,0,0,0,0,0 ret.nozero cmp bl,1 jne near .nokeyb cmp bh,1 ja near .exit cmp bh,1 je near .input2 SetDefaultKey 54,28,72,80,75,77,31,45,32,30,44,46 ret.input2 SetDefaultKey 56,29,37,50,49,51,82,71,73,83,79,81 ret.nokeyb cmp bl,2 jne near .no2buttons xor bl,bl cmp byte[pl1contrl],2 jne .nopl2a inc bl.nopl2a cmp byte[pl2contrl],2 jne .nopl2b inc bl.nopl2b cmp byte[pl3contrl],2 jne .nopl2c inc bl.nopl2c cmp byte[pl4contrl],2 jne .nopl2d inc bl.nopl2d cmp byte[pl5contrl],2 jne .nopl2e inc bl.nopl2e cmp bl,2 jae .2ndjoyst SetDefaultKey 0,0,14Ch,14Dh,14Eh,14Fh,0,0,0,102h,103h,0 ret.2ndjoyst SetDefaultKey 0,0,168h,169h,16Ah,16Bh,0,0,0,104h,105h,0 ret.no2buttons cmp bl,3 jne near .no4buttons SetDefaultKey 0,0,14Ch,14Dh,14Eh,14Fh,104h,105h,0,102h,103h,0 ret.no4buttons cmp bl,4 jne near .no6buttons SetDefaultKey 0,0,14Ch,14Dh,14Eh,14Fh,104h,105h,106h,102h,103h,107h ret.no6buttons cmp bl,5 jne near .skip8b SetDefaultKey 101h,100h,14Ch,14Dh,14Eh,14Fh,104h,105h,107h,102h,103h,106h ret.skip8b cmp bl,6 jne near .nosw1 SetDefaultKey 149h,148h,154h,155h,156h,157h,10Ch,109h,10Eh,10Bh,108h,10Fh ret.nosw1 cmp bl,7 jne near .nosw2 SetDefaultKey 149h+8,148h+8,154h+8,155h+8,156h+8,157h+8,10Ch+8,109h+8,10Eh+8,10Bh+8,108h+8,10Fh+8 ret.nosw2 cmp bl,8 jne near .nosw3 SetDefaultKey 149h+8*2,148h+8*2,154h+8*2,155h+8*2,156h+8*2,157h+8*2,10Ch+8*2,109h+8*2,10Eh+8*2,10Bh+8*2,108h+8*2,10Fh+8*2 ret.nosw3 cmp bl,9 jne near .nosw4 SetDefaultKey 149h+8*3,148h+8*3,154h+8*3,155h+8*3,156h+8*3,157h+8*3,10Ch+8*3,109h+8*3,10Eh+8*3,10Bh+8*3,108h+8*3,10Fh+8*3 ret.nosw4 cmp bl,10 jne near .nogrip0 SetDefaultKey 14Ah,14Bh,170h,171h,172h,173h,129h,12Bh,12Ch,128h,12Ah,12Eh ret.nogrip0 cmp bl,11 jne near .nogrip1 SetDefaultKey 14Ah+8,14Bh+8,170h+4,171h+4,172h+4,173h+4,129h+8,12Bh+8,12Ch+8,128h+8,12Ah+8,12Eh+8 ret.nogrip1 cmp bl,12 jne near .nopp1 SetDefaultKey 182h,183h,184h,185h,186h,187h,189h,188h,18Ah,181h,180h,18Bh ret.nopp1 cmp bl,13 jne near .nopp2 SetDefaultKey 192h,193h,194h,195h,196h,197h,199h,198h,19Ah,191h,190h,19Bh ret.nopp2 cmp bl,14 jne near .nopp3 SetDefaultKey 1A2h,1A3h,1A4h,1A5h,1A6h,1A7h,1A9h,1A8h,1AAh,1A1h,1A0h,1ABh ret.nopp3 cmp bl,15 jne near .nopp4 SetDefaultKey 1B2h,1B3h,1B4h,1B5h,1B6h,1B7h,1B9h,1B8h,1BAh,1B1h,1B0h,1BBh ret.nopp4 cmp bl,16 jne near .nopp5 SetDefaultKey 1C2h,1C3h,1C4h,1C5h,1C6h,1C7h,1C9h,1C8h,1CAh,1C1h,1C0h,1CBh ret.nopp5.exit ret
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -