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

📄 dosintrf.asm

📁 linux下的任天堂模拟器代码。供大家参考。
💻 ASM
📖 第 1 页 / 共 2 页
字号:
;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 selcA000,selcB800,selc0040,previdmode,DosExit,EXTSYM V8Mode,getblaster,Force8b,SBHDMAEXTSYM oldhand9s,oldhand9o,interror,oldhand8s,oldhand8o,oldhandSBs,oldhandSBoEXTSYM NoSoundReinit,soundon,DSPDisable,SBInt,PICMaskP,SBIrq,SBHandler,InitSBEXTSYM handler8h,handler9h,init60hz,Interror,init18_2hz,DeInitSPC,GUIinit36_4hzEXTSYM GUIoldhand9s,GUIoldhand9o,GUIoldhand8s,GUIoldhand8o,GUIhandler9hEXTSYM GUIhandler8h,GUIinit18_2hz,dosinitvideoEXTSYM DosDrawScreen,cvidmode,vidbuffer,GUICPC,DosDrawScreenBEXTSYM DosUpdateDevices,DOSJoyRead,pl1contrl,pl2contrl,pl3contrl,pl4contrlEXTSYM pl5contrl,GrayscaleModeEXTSYM pl1upk,pl1downk,pl1leftk,pl1rightk,pl1startk,pl1selkEXTSYM pl1Ak,pl1Bk,pl1Xk,pl1Yk,pl1Lk,pl1RkEXTSYM pl2upk,pl2downk,pl2leftk,pl2rightk,pl2startk,pl2selkEXTSYM pl2Ak,pl2Bk,pl2Xk,pl2Yk,pl2Lk,pl2RkEXTSYM pl3upk,pl3downk,pl3leftk,pl3rightk,pl3startk,pl3selkEXTSYM pl3Ak,pl3Bk,pl3Xk,pl3Yk,pl3Lk,pl3RkEXTSYM pl4upk,pl4downk,pl4leftk,pl4rightk,pl4startk,pl4selkEXTSYM pl4Ak,pl4Bk,pl4Xk,pl4Yk,pl4Lk,pl4RkEXTSYM pl5upk,pl5downk,pl5leftk,pl5rightk,pl5startk,pl5selkEXTSYM pl5Ak,pl5Bk,pl5Xk,pl5Yk,pl5Lk,pl5Rk; NOTE: For timing, Game60hzcall should be called at 50hz or 60hz (depending;   on romispal) after a call to InitPreGame and before DeInitPostGame are;   made.  GUI36hzcall should be called at 36hz after a call GUIInit and;   before GUIDeInit.SECTION .dataNEWSYM dssel, dw 0SECTION .textNEWSYM StartUp    mov    ax,901h             ;enable interrupts    int    31h    mov ax,ds    mov [dssel],ax    mov bx,0A000h    call findselec    mov [selcA000],ax    mov bx,0B800h    call findselec    mov [selcB800],ax    mov bx,0040h    call findselec    mov [selc0040],ax    ; get previous video mode    xor ecx,ecx    push es    mov ax,[selc0040]    mov es,ax    mov al,[es:49h]    mov [previdmode],al    pop es    ; Get base address    mov ax,ds    mov bx,ax    mov eax,0006h    int 31h    jc .FatalError    mov [ZSNESBase+2],cx                ; These variables are used for    mov [ZSNESBase],dx                  ; memory allocation so they can be.FatalError                             ; ignored for non-DOS ports    ret; SystemInit - Initialize all Joystick stuff, load in all configuration data,;   parse commandline data, obtain current directory (One time initialization)NEWSYM SystemInit    ; Be sure to set SBHDMA to a value other than 0 if 16bit sound exists    push es    call getblaster                     ; get set blaster environment    cmp byte[Force8b],1    jne .noforce8b    mov byte[SBHDMA],0.noforce8b    pop es    ret; Find Selector - DOS onlyfindselec:    mov ax, 2    int 31h    jnc .proceed    mov edx, .noselector    call PrintStr    jmp DosExit.proceed    retSECTION .data.noselector db 'Cannot find selector!',10,13,0SECTION .textNEWSYM PrintChar    ; print character at dl, push all modified registers    push eax    mov ah,02h    int 21h    pop eax    retNEWSYM PrintStr          ; Print ASCIIZ string.next    mov al,[edx]    or al,al    jz .finish    push edx    mov dl,al    mov ah,02h    int 21h    pop edx    inc edx    jmp .next.finish    retNEWSYM WaitForKey       ; Wait for a key to be pressed    mov ah,7    int 21h    ; return key in al    ret%macro PressConv 3    cmp byte[pressed+%1],0    je %%nopr    test byte[prval],%2    jnz %%prskip    or byte[prval],%2    mov byte[prres],%3;    mov al,0FFh    jmp .done    jmp %%prskip%%nopr    and byte[prval],%2^0FFh%%prskip%endmacroNEWSYM Check_Key;    xor al,al;    PressConv 75,01h,75;    PressConv 77,02h,77;    PressConv 80,04h,80;    PressConv 72,08h,72;    PressConv 1,80h,27;.done;    ret    ; returns 0 if there are no keys in the keyboard buffer, 0xFF otherwise    mov ah,0Bh    int 21h    retNEWSYM Get_Key;    mov al,[prres];    ret    ; wait if there are no keys in buffer, then return key in al    ; for extended keys, return a 0, then the extended key afterwards    mov ah,07h    int 21h    retNEWSYM Get_Memfree    mov ax,0500h    mov edi,edx    int 31h    retNEWSYM Output_Text       ; Output character (ah=02h) or string (ah=09h)    ; This function usually displays an error message on-screen    cmp ah,02h    je .char    cmp ah,09h    je .string    ret.char    int 21h     ; print dl    ret.string    pushad    call PrintStr       ; print edx    popad    ret; Delay for CX/65536 of a secondNEWSYM delay   in al,61h   and al,10h   mov ah,al.loopa   in al,61h   and al,10h   cmp al,ah   jz .loopa   mov ah,al   dec cx   jnz .loopa   retNEWSYM InitPreGame   ; Executes before starting/continuing a game    ; set up interrupt handler    ; get old handler pmode mode address    ; Process stuff such as sound init, interrupt initialization    cli    mov ax,204h    mov bl,09h    int 31h    jc near interror    mov [oldhand9s],cx    mov [oldhand9o],edx    mov ax,204h    mov bl,08h    int 31h    jc near interror    mov [oldhand8s],cx    mov [oldhand8o],edx    mov al,[GrayscaleMode]    cmp al,[V8Mode]    je .nochangemode    xor byte[V8Mode],1    xor al,al.nochangemode.nofs    cmp byte[NoSoundReinit],1    je .nosound    cmp byte[soundon],0    je .nosound    cmp byte[DSPDisable],1    je .nosound    mov ax,204h    mov bl,[SBInt]    int 31h    jc near Interror    mov [oldhandSBs],cx    mov [oldhandSBo],edx.nosound    sti    retNEWSYM SetupPreGame   ; Executes after pre-game init, can execute multiple                      ; times after a single InitPreGame    ; set new handler    cmp byte[soundon],0    je near .nosound2    cmp byte[DSPDisable],1    je near .nosound2    ; Turn off IRQ through controller    cli    xor dh,dh    mov dl,[PICMaskP]    mov cl,[SBIrq]    and cl,07h    mov al,01h    shl al,cl    mov bl,al    in al,dx    or al,bl    out dx,al    mov ax,205h    mov bl,[SBInt]    mov cx,cs    mov edx,SBHandler    int 31h    jc near interror    ; Turn on IRQ through controller    xor dh,dh    mov dl,[PICMaskP]    mov cl,[SBIrq]    and cl,07h    mov al,01h    shl al,cl    not al    mov bl,al    in al,dx    and al,bl    out dx,al    call InitSB    sti.nosound2    cli    mov ax,205h    mov bl,09h    mov cx,cs           ; Requires CS rather than DS    mov edx,handler9h    int 31h    jc near interror    mov ax,205h    mov bl,08h    mov cx,cs           ; Requires CS rather than DS    mov edx,handler8h    int 31h    jc near interror    call init60hz               ; Set timer to 60/50Hz.nofs2    sti    retNEWSYM DeInitPostGame           ; Called after game is ended    ; de-init interrupt handler    cli    mov cx,[oldhand9s]    mov edx,[oldhand9o]    mov ax,205h    mov bl,09h    int 31h    jc near interror    mov cx,[oldhand8s]    mov edx,[oldhand8o]    mov ax,205h    mov bl,08h    int 31h    jc near interror    call init18_2hz               ; Set timer to 18.2Hz.nofs3    sti    ; DeINITSPC    cmp byte[soundon],0    je .nosoundb    cmp byte[DSPDisable],1    je .nosoundb    call DeInitSPC    mov cx,[oldhandSBs]    mov edx,[oldhandSBo]    mov ax,205h    mov bl,[SBInt]    int 31h    jc near interror.nosoundb    retNEWSYM GUIInit    mov ax,204h    mov bl,09h    int 31h    mov [GUIoldhand9s],cx    mov [GUIoldhand9o],edx    mov ax,204h    mov bl,08h    int 31h    mov [GUIoldhand8s],cx    mov [GUIoldhand8o],edx    mov ax,205h    mov bl,09h    mov cx,cs    mov edx,GUIhandler9h    int 31h    mov ax,205h    mov bl,08h    mov cx,cs    mov edx,GUIhandler8h    int 31h    call GUIinit36_4hz    retNEWSYM GUIDeInit    mov cx,[GUIoldhand9s]    mov edx,[GUIoldhand9o]    mov ax,205h    mov bl,09h    int 31h    mov cx,[GUIoldhand8s]    mov edx,[GUIoldhand8o]    mov ax,205h    mov bl,08h    int 31h    call GUIinit18_2hz    ret; ****************************; Video Stuff; ****************************; ** Palette Functions **NEWSYM displayfpspal    mov al,128    mov dx,03C8h    out dx,al    inc dx    mov al,63    out dx,al    out dx,al    out dx,al    mov al,128+64    mov dx,03C8h    out dx,al    inc dx    mov al,0    out dx,al    out dx,al    out dx,al    retNEWSYM superscopepal    mov al,128+16    mov dx,03C8h    out dx,al    inc dx    mov al,63    out dx,al    xor al,al    out dx,al    out dx,al    retNEWSYM saveselectpal    ; set palette of colors 128,144, and 160 to white, blue, and red    mov al,128    mov dx,03C8h    out dx,al    inc dx    mov al,63    out dx,al    out dx,al    out dx,al    mov al,144    mov dx,03C8h    out dx,al    inc dx    xor al,al    out dx,al    out dx,al    mov al,50    out dx,al    mov al,160    mov dx,03C8h    out dx,al    inc dx    mov al,45    out dx,al    xor al,al    out dx,al    out dx,al    mov al,176    mov dx,03C8h    out dx,al    inc dx    mov al,47    out dx,al    xor al,al    out dx,al

⌨️ 快捷键说明

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