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

📄 entry.asm

📁 GNU FreeDOS兼容MS DOS很好的东东.
💻 ASM
📖 第 1 页 / 共 2 页
字号:
int21_normalentry:                cli                mov     ss,dx                mov     sp,cx                sti                ;                ; Push the far pointer to the register frame for                ; int21_syscall and remainder of kernel.                ;                                push    si  ; user SS:SP                push    bp                call    _int21_serviceint21_exit:     dec     byte [_InDOS]                ;                ; Recover registers from system call.  Registers and flags                ; were modified by the system call.                ;                int21_exit_nodec:                pop bp      ; get back user stack                pop si%if XCPU >= 386%ifdef WATCOM                sub bp, 4   ; for fs and gs only%else        		sub bp, 6   ; high parts of eax, ebx or ecx, edx%endif        %endif				                cli                mov     ss,si                mov     sp,bpint21_ret:                Restore386Registers		POP$ALL                ;                ; ... and return.                ;                iret;;   end Dos Critical Section 0 thur 7;;dos_crit_sect:                mov     [_Int21AX],ax       ; needed!                push    ax                  ; This must be here!!!                mov     ah,82h              ; re-enrty sake before disk stack                int     2ah                 ; Calling Server Hook!                pop     ax                ret;; Terminate the current process;;       VOID INRPT far;       int27_handler(iregs UserRegs);reloc_call_int27_handler:                ;                ; First convert the memory to paragraphs                ;                add     dx,byte 0fh     ; round up                rcr     dx,1                shr     dx,1                shr     dx,1                shr     dx,1                ;                ; ... then use the standard system call                ;                mov     ax,3100h                jmp     reloc_call_int21_handler  ; terminate through int 21h;;reloc_call_low_int26_handler:                sti                pushf                push    ax                mov     ax,026h                jmp     short int2526reloc_call_low_int25_handler:                sti                pushf                push    ax                mov     ax,025hint2526:                                push    cx                push    dx                push    bx                push    sp                push    bp                push    si                push    di                push    ds                push    es                mov     cx, sp     ; save stack frame                mov     dx, ss                cld                mov     bx, [cs:_DGROUP_]                mov     ds, bx                ; setup our local stack                cli                mov     ss,bx                mov     sp,_disk_api_tos                sti                Protect386Registers        		push	dx		push	cx			; save user stack                push    dx                      ; SS:SP -> user stack                push    cx                push    ax                      ; was set on entry = 25,26                call    _int2526_handler                add     sp, byte 6		pop	cx		pop	dx			; restore user stack                Restore386Registers                ; restore foreground stack here                cli                mov     ss, dx                mov     sp, cx                pop     es                pop     ds                pop     di                pop     si                pop     bp                pop     bx      ; pop off sp value                pop     bx                pop     dx                pop     cx                pop     ax                popf                retf            ; Bug-compatiblity with MS-DOS.                                ; This function is supposed to leave the original                                ; flag image on the stack.CONTINUE        equ     00hRETRY           equ     01hABORT           equ     02hFAIL            equ     03hOK_IGNORE       equ     20hOK_RETRY        equ     10hOK_FAIL         equ     08hPSP_PARENT      equ     16hPSP_USERSP      equ     2ehPSP_USERSS      equ     30h;; COUNT; CriticalError(COUNT nFlag, COUNT nDrive, COUNT nError, struct dhdr FAR *lpDevice);;                global  _CriticalError_CriticalError:                ;                ; Skip critical error routine if handler is active                ;                cmp     byte [_ErrorMode],0                je      CritErr05               ; Jump if equal                mov     ax,FAIL                retn                ;                ; Do local error processing                ;CritErr05:                ;                ; C Entry                ;                push    bp                mov     bp,sp                push    si                push    di                ;                ; Get parameters                ;                mov     ah,byte [bp+4]      ; nFlags                mov     al,byte [bp+6]      ; nDrive                mov     di,word [bp+8]      ; nError                ;                ;       make bp:si point to dev header                ;                mov     si,word [bp+10]     ; lpDevice Offset                mov     bp,word [bp+12]     ; lpDevice segment                ;                ; Now save real ss:sp and retry info in internal stack                ;                cli                mov     es,[_cu_psp]                push    word [es:PSP_USERSS]                push    word [es:PSP_USERSP]                push    word [_MachineId]                push    word [int21regs_seg]                push    word [int21regs_off]                push    word [_user_r+2]                push    word [_user_r]                mov     [critical_sp],sp                ;                ; do some clean up because user may never return                ;                inc     byte [_ErrorMode]                dec     byte [_InDOS]                ;                ; switch to user's stack                ;                mov     ss,[es:PSP_USERSS]                mov     sp,[es:PSP_USERSP]                ;                ; and call critical error handler                ;                int     24h                     ; DOS Critical error handler                ;                ; recover context                ;                cld                cli                mov     bp, [cs:_DGROUP_]                mov     ds,bp                mov     ss,bp                mov     sp,[critical_sp]                pop     word [_user_r]                pop     word [_user_r+2]                pop     word [int21regs_off]                pop     word [int21regs_seg]                pop     word [_MachineId]                mov     es,[_cu_psp]                pop     word [es:PSP_USERSP]                pop     word [es:PSP_USERSS]                mov     bp, sp                mov     ah, byte [bp+4+4]       ; restore old AH from nFlags                sti                             ; Enable interrupts                ;                ; clear flags                ;                mov     byte [_ErrorMode],0                inc     byte [_InDOS]                ;                ; Check for ignore and force fail if not ok                cmp     al,CONTINUE                jne     CritErr10               ; not ignore, keep testing                test    ah,OK_IGNORE                jnz     CritErr10                mov     al,FAIL                ;                ; Check for retry and force fail if not ok                ;CritErr10:                cmp     al,RETRY                jne     CritErr20               ; not retry, keep testing                test    ah,OK_RETRY                jnz     CritErr20                mov     al,FAIL                ;                ; You know the drill, but now it's different.                ; check for fail and force abort if not ok                ;CritErr20:                cmp     al,FAIL                jne     CritErr30               ; not fail, do exit processing                test    ah,OK_FAIL                jnz     CritErr30                mov     al,ABORT                ;                ; OK, if it's abort we do extra processing.  Otherwise just                ; exit.                ;CritErr30:                cmp     al,ABORT                je      CritErrAbort            ; process abortCritErrExit:                xor     ah,ah                   ; clear out top for return                pop     di                pop     si                pop     bp                ret                ;                ; Abort processing.                ;CritErrAbort:                mov     ax,[_cu_psp]                mov     es,ax                cmp     ax,[es:PSP_PARENT]                mov     al,FAIL                jz      CritErrExit                cli                mov     bp,word [_user_r+2]   ;Get frame                mov     ss,bp                mov     bp,word [_user_r]                mov     sp,bp                mov     byte [_ErrorMode],1        ; flag abort                mov     ax,4C00h                mov     [bp+reg_ax],ax                sti                jmp     int21_reentry              ; restart the system call

⌨️ 快捷键说明

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