📄 dosintrf.asm
字号:
out dx,al mov al,208 mov dx,03C8h out dx,al inc dx mov al,50 out dx,al mov al,25 out dx,al xor al,al out dx,al ret; ** init video mode functions **NEWSYM initvideo ; Returns 1 in videotroub if trouble occurs jmp dosinitvideoNEWSYM deinitvideo mov al,[previdmode] mov ah,0 int 10h ret; ** copy video mode functions **NEWSYM DrawScreen ; In-game screen render w/ triple buffer check jmp DosDrawScreenNEWSYM vidpastecopyscr ; GUI screen render; jmp dosvidpastecopyscr pushad movzx eax,byte[cvidmode] cmp byte[GUI16VID+eax],1 jne .no16bconv mov eax,[vidbuffer] mov ecx,224*288 mov edx,ecx sub ecx,288 dec edx.loop movzx ebx,byte[eax+edx] mov bx,[GUICPC+ebx*2] mov [eax+edx*2],bx dec edx dec ecx jnz .loop.no16bconv popad jmp DosDrawScreenB; ** Video Mode Variables **SECTION .data; Total Number of Video ModesNEWSYM NumVideoModes, dd 19; GUI Video Mode Names - Make sure that all names are of the same length; and end with a NULL terminatorNEWSYM GUIVideoModeNamesdb '256x224x8B MODEQ',0 ; 0db '256x240x8B MODEQ',0 ; 1db '256x256x8B MODEQ',0 ; 2db '320x224x8B MODEX',0 ; 3db '320x240x8B MODEX',0 ; 4db '320x256x8B MODEX',0 ; 5db '640x480x16B VESA1',0 ; 6db '320x240x8B VESA2',0 ; 7db '320x240x16B VESA2',0 ; 8db '320x480x8B VESA2',0 ; 9db '320x480x16B VESA2',0 ; 10db '512x384x8B VESA2',0 ; 11db '512x384x16B VESA2',0 ; 12db '640x400x8B VESA2',0 ; 13db '640x400x16B VESA2',0 ; 14db '640x480x8B VESA2',0 ; 15db '640x480x16B VESA2',0 ; 16db '800x600x8B VESA2',0 ; 17db '800x600x16B VESA2',0 ; 18; Video Mode Feature Availability (1 = Available, 0 = Not Available); Left side starts with Video Mode 0; 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8NEWSYM GUI16VID, db 0,0,0,0,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1 ; 16-bit modeNEWSYM GUISLVID, db 0,0,1,0,0,1,1,0,0,1,1,0,0,0,0,1,1,1,1 ; ScanlinesNEWSYM GUIHSVID, db 0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0 ; Half/Quarter ScanlinesNEWSYM GUII2VID, db 0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,1 ; DOS InterpolationNEWSYM GUIEAVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0 ; DOS EagleNEWSYM GUITBVID, db 0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1 ; DOS Triple BufferingNEWSYM GUIFSVID, db 0,0,0,0,0,0,0,1,1,1,1,0,0,1,1,1,1,0,0 ; DOS FullscreenNEWSYM GUIWSVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0 ; DOS WidescreenNEWSYM GUISSVID, db 0,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,1,1,1 ; DOS SmallscreenNEWSYM GUI2xVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0 ; 2xSaI/Super EnginesNEWSYM GUIM7VID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0 ; Hires Mode 7NEWSYM GUIHQ2X, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; (Hq2x Filter)NEWSYM GUINTVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; (NTSC Filter)SECTION .text; ****************************; Input Device Stuff; ****************************; Variables related to Input Device Routines:; pl1selk,pl1startk,pl1upk,pl1downk,pl1leftk,pl1rightk,pl1Xk,; pl1Ak,pl1Lk,pl1Yk,pl1Bk,pl1Rk; (Change 1 to 2,3,4 for other players); Each of these variables contains the corresponding key pressed value; for the key data; pressed[]; - This is an array of pressed/released data (bytes) where the; corresponding key pressed value is used as the index. The value; for each entry is 0 for released and 1 for pressed. Also, when; writing keyboard data to this array, be sure to first check if; the value of the array entry is 2 or not. If it is 2, do not write 1; to that array entry. (however, you can write 0 to it); As an example, to access Player 1 L button press data, it is; done like : pressed[pl1Lk]; The 3 character key description of that array entry is accessed by the; GUI through ScanCodeListing[pl1Lk*3]; Note: When storing the input device configuration of a dynamic input; device system (ie. Win9x) rather than a static system (ie. Dos), it; is best to store in the name of the device and relative button; assignments in the configuration file, then convert it to ZSNES'; numerical corresponding key format after reading from it. And then; convert it back when writing to it back.NEWSYM UpdateDevices ; One-time input device init call DosUpdateDevices retNEWSYM JoyRead call DOSJoyRead 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 SetInputDevice ; 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,36,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,0CCh,0CDh,0CEh,0CFh,0,0,0,82h,83h,0 ret.2ndjoyst SetDefaultKey 0,0,0E8h,0E9h,0EAh,0EBh,0,0,0,84h,85h,0 ret.no2buttons cmp bl,3 jne near .no4buttons SetDefaultKey 0,0,0CCh,0CDh,0CEh,0CFh,84h,85h,0,82h,83h,0 ret.no4buttons cmp bl,4 jne near .no6buttons SetDefaultKey 0,0,0CCh,0CDh,0CEh,0CFh,84h,85h,86h,82h,83h,87h ret.no6buttons cmp bl,5 jne near .skip8b SetDefaultKey 081h,080h,0CCh,0CDh,0CEh,0CFh,84h,85h,87h,82h,83h,86h ret.skip8b cmp bl,6 jne near .nosw1 SetDefaultKey 0C9h,0C8h,0D4h,0D5h,0D6h,0D7h,08Ch,089h,08Eh,08Bh,088h,08Fh ret.nosw1 cmp bl,7 jne near .nosw2 SetDefaultKey 0C9h+8,0C8h+8,0D4h+8,0D5h+8,0D6h+8,0D7h+8,08Ch+8,089h+8,08Eh+8,08Bh+8,088h+8,08Fh+8 ret.nosw2 cmp bl,8 jne near .nosw3 SetDefaultKey 0C9h+8*2,0C8h+8*2,0D4h+8*2,0D5h+8*2,0D6h+8*2,0D7h+8*2,08Ch+8*2,089h+8*2,08Eh+8*2,08Bh+8*2,088h+8*2,08Fh+8*2 ret.nosw3 cmp bl,9 jne near .nosw4 SetDefaultKey 0C9h+8*3,0C8h+8*3,0D4h+8*3,0D5h+8*3,0D6h+8*3,0D7h+8*3,08Ch+8*3,089h+8*3,08Eh+8*3,08Bh+8*3,088h+8*3,08Fh+8*3 ret.nosw4 cmp bl,10 jne near .nogrip0 SetDefaultKey 0CAh,0CBh,0F0h,0F1h,0F2h,0F3h,0A9h,0ABh,0ACh,0A8h,0AAh,0AEh ret.nogrip0 cmp bl,11 jne near .nogrip1 SetDefaultKey 0CAh+8,0CBh+8,0F0h+4,0F1h+4,0F2h+4,0F3h+4,0A9h+8,0ABh+8,0ACh+8,0A8h+8,0AAh+8,0AEh+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 retSECTION .data; Total Number of Input DevicesNEWSYM NumInputDevices, dd 17; Input Device NamesNEWSYM GUIInputNamesdb 'NONE ',0db 'KEYBOARD ',0db '2BUTTONJOYSTICK ',0db '4BUTTONJOYSTICK ',0db '6BUTTONJOYSTICK ',0db '8BUTTONJOYSTICK ',0db 'SIDEWINDERPAD1 ',0db 'SIDEWINDERPAD2 ',0db 'SIDEWINDERPAD3 ',0db 'SIDEWINDERPAD4 ',0db 'GAMEPAD PRO P0 ',0db 'GAMEPAD PRO P1 ',0db 'PARALLEL LPT1 P1',0db 'PARALLEL LPT1 P2',0db 'PARALLEL LPT1 P3',0db 'PARALLEL LPT1 P4',0db 'PARALLEL LPT1 P5',0; GUI Description codes for each corresponding key pressed valueNEWSYM ScanCodeListing db '---','ESC',' 1 ',' 2 ',' 3 ',' 4 ',' 5 ',' 6 ' db ' 7 ',' 8 ',' 9 ',' 0 ',' - ',' = ','BKS','TAB' db ' Q ',' W ',' E ',' R ',' T ',' Y ',' U ',' I ' db ' O ',' P ',' [ ',' ] ','RET','CTL',' A ',' S ' db ' D ',' F ',' G ',' H ',' J ',' K ',' L ',' : ' db ' " ',' ~ ','LSH',' \ ',' Z ',' X ',' C ',' V ' db ' B ',' N ',' M ',' , ',' . ',' / ','RSH',' * ' db 'ALT','SPC','CAP','F1 ','F2 ','F3 ','F4 ','F5 ' db 'F6 ','F7 ','F8 ','F9 ','F10','NUM','SCR','HOM' db 'UP ','PGU',' - ','LFT',' 5 ','RGT',' + ','END' db 'DWN','PGD','INS','DEL',' ',' ',' ','F11' db 'F12',' ',' ',' ',' ',' ',' ',' ' db ' ',' ',' ',' ',' ',' ',' ',' ' db ' ',' ',' ',' ',' ',' ',' ',' ' db ' ',' ',' ',' ',' ',' ',' ',' ' db ' ',' ',' ',' ',' ',' ',' ',' ' ; Joystick Stuff, Port 201h (80h) db 'JB7','JB8','JB1','JB2','JB3','JB4','JB5','JB6' db 'SWA','SWB','SWC','SWX','SWY','SWZ','SWL','SWR' db 'S2A','S2B','S2C','S2X','S2Y','S2Z','S2L','S2R' db 'S3A','S3B','S3C','S3X','S3Y','S3Z','S3L','S3R' db 'S4A','S4B','S4C','S4X','S4Y','S4Z','S4L','S4R' db 'GRR','GRB','GRY','GRG','GL1','GL2','GR1','GR2' db 'G2R','G2B','G2Y','G2G','2L1','2L2','2R1','2R2' db 'G3R','G3B','G3Y','G3G','3L1','3L2','3R1','3R2' db 'G4R','G4B','G4Y','G4G','4L1','4L2','4R1','4R2' db 'SWS','SWM','GSL','GST','JUP','JDN','JLF','JRG' db 'S2S','S2M','2SL','2ST','SWU','SWD','SWL','SWR' db 'S3S','S3M','3SL','3ST','S2U','S2D','S2L','S2R' db 'S4S','S4M','4SL','4ST','S3U','S3D','S3L','S3R' db 'J2U','J2D','J2L','J2R','S4U','S4D','S4L','S4R' db 'GRU','GRD','GRL','GRR','G2U','G2D','G2L','G2R' db 'G3U','G3D','G3L','G3R','G4U','G4D','G4L','G4R' ; Joystick Stuff, Port 209h (100h) db 'JB7','JB8','JB1','JB2','JB3','JB4','JB5','JB6' db 'SWA','SWB','SWC','SWX','SWY','SWZ','SWL','SWR' db 'S2A','S2B','S2C','S2X','S2Y','S2Z','S2L','S2R' db 'S3A','S3B','S3C','S3X','S3Y','S3Z','S3L','S3R' db 'S4A','S4B','S4C','S4X','S4Y','S4Z','S4L','S4R' db 'GRR','GRB','GRY','GRG','GL1','GL2','GR1','GR2' db 'G2R','G2B','G2Y','G2G','2L1','2L2','2R1','2R2' db 'G3R','G3B','G3Y','G3G','3L1','3L2','3R1','3R2' db 'G4R','G4B','G4Y','G4G','4L1','4L2','4R1','4R2' db 'SWS','SWM','GSL','GST','JUP','JDN','JLF','JRG' db 'S2S','S2M','2SL','2ST','SWU','SWD','SWL','SWR' db 'S3S','S3M','3SL','3ST','S2U','S2D','S2L','S2R' db 'S4S','S4M','4SL','4ST','S3U','S3D','S3L','S3R' db 'J2U','J2D','J2L','J2R','S4U','S4D','S4L','S4R' db 'GRU','GRD','GRL','GRR','G2U','G2D','G2L','G2R' db 'G3U','G3D','G3L','G3R','G4U','G4D','G4L','G4R' ; Extra Stuff (180h) (Parallel Port) db 'PPB','PPY','PSL','PST','PUP','PDN','PLT','PRT' db 'PPA','PPX','PPL','PPR',' ',' ',' ',' ' db 'P2B','P2Y','P2S','P2T','P2U','P2D','P2L','P2R' db 'P2A','P2X','P2L','P2R',' ',' ',' ',' ' db 'P3B','P3Y','P3S','P3T','P3U','P3D','P3L','P3R' db 'P3A','P3X','P3L','P3R',' ',' ',' ',' ' db 'P4B','P4Y','P4S','P4T','P4U','P4D','P4L','P4R' db 'P4A','P4X','P4L','P4R',' ',' ',' ',' ' db 'P5B','P5Y','P5S','P5T','P5U','P5D','P5L','P5R' db 'P5A','P5X','P5L','P5R',' ',' ',' ',' 'SECTION .bssNEWSYM ZSNESBase, resd 1TempVarSeek resd 1SECTION .text; ****************************; Mouse Stuff; ****************************NEWSYM Init_Mouse ; return non-zero if successful mov eax,00h int 33h cmp ax,0 je .nomouse mov eax,07h mov ecx,0 mov edx,255 int 33h mov eax,08h mov ecx,0 mov edx,223 int 33h mov eax,0Fh mov ecx,8 mov edx,8 int 33h mov eax,04h mov ecx,0 mov edx,0 int 33h mov ax,1.nomouse retNEWSYM Get_MouseData ; Returns both pressed and coordinates mov eax,03h int 33h ; bx : bit 0 = left button, bit 1 = right button ; cx = Mouse X Position, dx = Mouse Y Position retNEWSYM Set_MouseXMax ; Sets the X boundaries (ecx = left, edx = right) mov eax,07h int 33h retNEWSYM Set_MouseYMax ; Sets the Y boundaries (ecx = left, edx = right) mov eax,08h int 33h retNEWSYM Set_MousePosition ; Sets Mouse Position (x:cx,y:dx) mov eax,04h int 33h retNEWSYM Get_MousePositionDisplacement ; returns x,y displacement in pixel in cx,dx mov eax,0Bh int 33h retNEWSYM MouseWindow ret; ****************************; Sound Stuff; ****************************NEWSYM StopSound retNEWSYM StartSound retNEWSYM Check60hz ; Call the timer update function here ret
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -