chipd16.asm

来自「开放源码的编译器open watcom 1.6.0版的源代码」· 汇编 代码 · 共 1,168 行 · 第 1/3 页

ASM
1,168
字号
        pop     bx
        pop     bp
        ret
label61:
        fdivp_sti 7, 6
        pop     bx
        pop     bp
        ret
label62:
        fdivr_sti 7, 6
        pop     bx
        pop     bp
        ret
label63:
        fdivrp_sti 7, 6
        pop     bx
        pop     bp
        ret
__fdiv_fpr      ENDP


__fdivp_sti_st    PROC NEAR
                                ; for calling from mem routines
        sub     sp, STACK_SIZE
        mov     bp,sp
        fdivp_sti 1, 0
        ret
__fdivp_sti_st    ENDP

__fdivrp_sti_st   PROC NEAR
                                ; for calling from mem routines
        sub     sp, STACK_SIZE
        mov     bp,sp
        fdivrp_sti 1, 0
        ret
__fdivrp_sti_st   ENDP

public  __fdiv_chk
        defpe   __fdiv_chk
        push    bp
        sub     sp, STACK_SIZE
        mov     bp,sp
        fdivrp_sti 1, 0
        pop     bp
        ret
__fdiv_chk      ENDP

;;; FDIV_M32 - FDIV m32real FIX
;;
;;      Input : Value of the m32real in the top of STACK
;;
;;      Output: Result of FDIV in ST

        PUBLIC  __fdiv_m32
        defpe   __fdiv_m32

        push    eax                             ; save eax
        push    bp
        mov     bp,sp
        mov     ax, [bp + MEM_OPERAND + 2]      ; check for
        and     ax, SINGLE_NAN                  ; NaN
        cmp     ax, SINGLE_NAN                  ;
        je      memory_divide_m32               ;

        f_stsw  ax                              ; get status word
        and     ax, 3800h                       ; get top of stack
        je      spill_fpstack                   ; is FP stack full?
        fld     dword ptr[bp + MEM_OPERAND]     ; load m32real in ST
        call    __fdivp_sti_st                    ; do actual divide
        jmp     m32_ok                          ; return
spill_fpstack:
        fxch
        sub     sp, SPILL_SIZE          ; make temp space
        mov     bp,sp
        fstp    tbyte ptr[bp ]                  ; save user's ST(1)
        fld     dword ptr[bp + SPILL_MEM_OPERAND] ; load m32 real
        call    __fdivp_sti_st                    ; do actual divide
        fld     tbyte ptr[bp]                   ; restore user's ST(1)
                                                ;sp is adjusted by fdivp fn
        fxch
        add     sp, SPILL_SIZE
m32_ok:
        pop     bp
        pop     eax
        ret     4
memory_divide_m32:
        fdiv    dword ptr[bp + MEM_OPERAND]     ; do actual divide
        pop     bp
        pop     eax
        ret     4

__fdiv_m32        ENDP


;;; FDIV_M64 - FDIV m64real FIX
;;
;;      Input : Value of the m64real in the top of STACK
;;
;;      Output: Result of FDIV in ST

        PUBLIC  __fdiv_m64
        defpe   __fdiv_m64

        push    eax                             ; save eax
        push    bp
        mov     bp,sp
        mov     ax, [bp + MEM_OPERAND + 6]      ; check for
        and     ax, SINGLE_NAN                  ; NaN
        cmp     ax, SINGLE_NAN                  ;
        je      memory_divide_m64               ;

        f_stsw  ax                              ; get status word
        and     ax, 3800h                       ; get top of stack
        je      spill_fpstack_m64               ; is FP stack full?
        fld     qword ptr[bp + MEM_OPERAND]     ; load m64real in ST
        call    __fdivp_sti_st                    ; do actual divide
        jmp     m64_ok                          ; return
spill_fpstack_m64:
        fxch
        sub     sp, SPILL_SIZE          ; make temp space
        mov     bp,sp
        fstp    tbyte ptr[bp]                   ; save user's ST(1)
        fld     qword ptr[bp + SPILL_MEM_OPERAND] ; load m64real
        call    __fdivp_sti_st                    ; do actual divide
        fld     tbyte ptr[bp]                   ; restore user's ST(1)
                                                ;sp is adjusted by fdivp fn
        fxch
        add     sp, SPILL_SIZE
m64_ok:
        pop     bp
        pop     eax
        ret     8
memory_divide_m64:
        fdiv    qword ptr[bp + MEM_OPERAND]     ; do actual divide
        pop     bp
        pop     eax
        ret     8

__fdiv_m64        ENDP



;;; FDIVR_M32 - FDIVR m32real FIX
;;
;;      Input : Value of the m32real in the top of STACK
;;
;;      Output: Result of FDIVR in ST

        PUBLIC  __fdiv_m32r
        defpe   __fdiv_m32r
        push    eax                             ; save eax
        push    bp
        mov     bp,sp
        mov     ax, [bp + MEM_OPERAND + 2]      ; check for
        and     ax, SINGLE_NAN                  ; NaN
        cmp     ax, SINGLE_NAN                  ;
        je      memory_divide_m32r              ;

        f_stsw  ax                              ; get status word
        and     ax, 3800h                       ; get top of stack
        je      spill_fpstack_m32r              ; is FP stack full?
        fld     dword ptr[bp + MEM_OPERAND]     ; load m32real in ST
        call    __fdivrp_sti_st                   ; do actual divide
        jmp     m32r_ok                         ; return
spill_fpstack_m32r:
        fxch
        sub     sp, SPILL_SIZE          ; make temp space
        mov     bp,sp
        fstp    tbyte ptr[bp ]                  ; save user's ST(1)
        fld     dword ptr[bp + SPILL_MEM_OPERAND] ; load m32 real
        call    __fdivrp_sti_st                   ; do actual divide
        fld     tbyte ptr[bp]                   ; restore user's ST(1)
                                                ;sp is adjusted by fdivrp fn
        fxch
        add     sp, SPILL_SIZE
m32r_ok:
        pop     bp
        pop     eax
        ret     4
memory_divide_m32r:
        fdivr   dword ptr[bp + MEM_OPERAND]     ; do actual divide
        pop     bp
        pop     eax
        ret     4

__fdiv_m32r       ENDP


;;; FDIVR_M64 - FDIVR m64real FIX
;;
;;      Input : Value of the m64real in the top of STACK
;;
;;      Output: Result of FDIVR in ST

        PUBLIC  __fdiv_m64r
        defpe   __fdiv_m64r
        push    eax                             ; save eax
        push    bp
        mov     bp,sp
        mov     ax, [bp + MEM_OPERAND + 6]      ; check for
        and     ax, SINGLE_NAN                  ; NaN
        cmp     ax, SINGLE_NAN                  ;
        je      memory_divide_m64r              ;

        f_stsw  ax                              ; get status word
        and     ax, 3800h                       ; get top of stack
        je      spill_fpstack_m64r              ; is FP stack full?
        fld     qword ptr[bp + MEM_OPERAND]     ; load m64real in ST
        call    __fdivrp_sti_st                   ; do actual divide
        jmp     m64r_ok                         ; return
spill_fpstack_m64r:
        fxch
        sub     sp, SPILL_SIZE          ; make temp space
        mov     bp,sp
        fstp    tbyte ptr[bp ]                  ; save user's ST(1)
        fld     qword ptr[bp + SPILL_MEM_OPERAND] ; load m64real
        call    __fdivrp_sti_st                   ; do actual divide
        fld     tbyte ptr[bp]                   ; restore user's ST(1)
                                                ;sp is adjusted by fdivrp fn
        fxch
        add     sp, SPILL_SIZE
m64r_ok:
        pop     bp
        pop     eax
        ret     8
memory_divide_m64r:
        fdivr   qword ptr[bp + MEM_OPERAND]     ; do actual divide
        pop     bp
        pop     eax
        ret     8


__fdiv_m64r       ENDP


comment ~****************************************************************

;;; FDIV_M16I - FDIV m16int FIX
;;
;;      Input : Value of the m16int in the top of STACK
;;
;;      Output: Result of FDIV in ST

        PUBLIC  FDIV_M16I
FDIV_M16I       PROC    FAR
        push    eax                             ; save eax
        push    bp
        f_stsw  ax                              ; get status word
        and     ax, 3800h                       ; get top of stack
        je      spill_fpstack_m16i              ; is FP stack full?
        mov     bp,sp
        fild    word ptr[bp + MEM_OPERAND]      ; load m16int in ST
        call    fdivp_sti_st                    ; do actual divide
        jmp     m16i_ok                         ; return
spill_fpstack_m16i:
        fxch
        sub     sp, SPILL_SIZE          ; make temp space
        mov     bp,sp
        fstp    tbyte ptr[bp ]                  ; save user's ST(1)
        fild    word ptr[bp + SPILL_MEM_OPERAND] ; load m16int
        call    fdivp_sti_st                    ; do actual divide
        fld     tbyte ptr[bp]                   ; restore user's ST(1)
                                                ;sp is adjusted by fdivp fn
        fxch
        add     sp, SPILL_SIZE
m16i_ok:
        pop     bp
        pop     eax
        ret

FDIV_M16I       ENDP

;;; FDIV_M32I - FDIV m16int FIX
;;
;;      Input : Value of the m16int in the top of STACK
;;
;;      Output: Result of FDIV in ST

        PUBLIC  FDIV_M32I
FDIV_M32I       PROC    FAR
        push    eax                             ; save eax
        push    bp
        f_stsw  ax                              ; get status word
        and     ax, 3800h                       ; get top of stack
        je      spill_fpstack_m32i              ; is FP stack full?
        mov     bp,sp
        fild    dword ptr[bp + MEM_OPERAND]     ; load m32int in ST
        call    fdivp_sti_st                    ; do actual divide
        jmp     m32i_ok                         ; return
spill_fpstack_m32i:
        fxch
        sub     sp, SPILL_SIZE          ; make temp space
        mov     bp,sp
        fstp    tbyte ptr[bp ]                  ; save user's ST(1)
        fild    dword ptr[bp + SPILL_MEM_OPERAND] ; load m32int
        call    fdivp_sti_st                    ; do actual divide
        fld     tbyte ptr[bp]                   ; restore user's ST(1)
                                                ;sp is adjusted by fdivp fn
        fxch
        add     sp, SPILL_SIZE
m32i_ok:
        pop     bp
        pop     eax
        ret


FDIV_M32I       ENDP


;;; FDIVR_M16I - FDIVR m16int FIX
;;
;;      Input : Value of the m16int in the top of STACK
;;
;;      Output: Result of FDIVR in ST

        PUBLIC  FDIVR_M16I
FDIVR_M16I      PROC    FAR
        push    eax                             ; save eax
        push    bp
        f_stsw  ax                              ; get status word
        and     ax, 3800h                       ; get top of stack
        je      spill_fpstack_m16ir             ; is FP stack full?
        mov     bp,sp
        fild    word ptr[bp + MEM_OPERAND]      ; load m16int in ST
        call    fdivrp_sti_st                   ; do actual divide
        jmp     m16ir_ok                                ; return
spill_fpstack_m16ir:
        fxch
        sub     sp, SPILL_SIZE          ; make temp space
        mov     bp,sp
        fstp    tbyte ptr[bp ]                  ; save user's ST(1)
        fild    word ptr[bp + SPILL_MEM_OPERAND] ; load m16int
        call    fdivrp_sti_st                   ; do actual divide
        fld     tbyte ptr[bp]                   ; restore user's ST(1)
                                                ;sp is adjusted by fdivrp fn
        fxch
        add     sp, SPILL_SIZE
m16ir_ok:
        pop     bp
        pop     eax
        ret


FDIVR_M16I      ENDP


;;; FDIVR_M32I - FDIVR m32int FIX
;;
;;      Input : Value of the m32int in the top of STACK
;;
;;      Output: Result of FDIVR in ST

        PUBLIC  FDIVR_M32I
FDIVR_M32I      PROC    FAR
        push    eax                             ; save eax
        push    bp
        f_stsw  ax                              ; get status word
        and     ax, 3800h                       ; get top of stack
        je      spill_fpstack_m32ir             ; is FP stack full?
        mov     bp,sp
        fild    dword ptr[bp + MEM_OPERAND]     ; load m32int in ST
        call    fdivrp_sti_st                   ; do actual divide
        jmp     m32ir_ok                                ; return
spill_fpstack_m32ir:
        fxch
        sub     sp, SPILL_SIZE          ; make temp space
        mov     bp,sp
        fstp    tbyte ptr[bp ]                  ; save user's ST(1)
        fild    dword ptr[bp + SPILL_MEM_OPERAND] ; load m32int
        call    fdivrp_sti_st                   ; do actual divide
        fld     tbyte ptr[bp]                   ; restore user's ST(1)
                                                ;sp is adjusted by fdivrp fn
        fxch
        add     sp, SPILL_SIZE
m32ir_ok:
        pop     bp
        pop     eax
        ret

FDIVR_M32I      ENDP

************************************************************************~


_TEXT   ENDS

        end

⌨️ 快捷键说明

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