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

📄 lib86.t

📁 操作系统设计与实现源码
💻 T
📖 第 1 页 / 共 5 页
字号:
01400	.define .dvi401401	01402	yl=601403	yh=801404	xl=1001405	xh=1201406	01407	.text01408	.dvi4:01409	        push    si01410	        push    di01411	        mov     si,sp           ! copy of sp01412	        mov     bx,yl(si)01413	        mov     ax,yh(si)01414	        cwd01415	        mov     di,dx01416	        cmp     dx,ax01417	        jne     7f01418	        and     dx,dx01419	        jge     1f01420	        neg     bx01421	        je      7f01422	1:01423	        xor     dx,dx01424	        mov     cx,xl(si)01425	        mov     ax,xh(si)01426	        and     ax,ax01427	        jge     2f01428	        neg     ax01429	        neg     cx01430	        sbb     ax,dx01431	        not     di01432	2:01433	        div     bx01434	        xchg    ax,cx01435	        div     bx              ! cx = high abs(result), ax=low abs(result)01436	9:01437	        and     di,di01438	        jge     1f01439	        neg     cx01440	        neg     ax01441	        sbb     cx,#001442	1:01443	                        ! cx is high order result01444	                        ! ax is low order result.Ep 10 src/lib/i86/em/dvi4.s01445	        mov     dx,cx01446	        pop     di01447	        pop     si01448	        ret     8       ! result in ax/dx01449	01450	7:01451	        push    dx              ! sign of y01452	        mov     di,ax01453	        xor     bx,bx01454	        and     di,di01455	        jge     1f01456	        neg     di01457	        neg     yl(si)01458	        sbb     di,bx01459	1:01460	        mov     ax,xl(si)01461	        mov     dx,xh(si)01462	        and     dx,dx01463	        jge     1f01464	        neg     dx01465	        neg     ax01466	        sbb     dx,bx01467	        not     -2(si)01468	1:01469	        mov     cx,#1601470	1:01471	        shl     ax,#101472	        rcl     dx,#101473	        rcl     bx,#101474	        cmp     di,bx01475	        ja      3f01476	        jb      2f01477	        cmp     yl(si),dx01478	        jbe     2f01479	3:01480	        loop    1b01481	        jmp     1f01482	2:01483	        sub     dx,yl(si)01484	        sbb     bx,di01485	        inc     ax01486	        loop    1b01487	1:01488	        pop     di              ! di=sign of result,ax= result01489	        jmp     9b.Op 11 src/lib/i86/em/dvu4.s++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++			src/lib/i86/em/dvu4.s	 	 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++01500	.define .dvu401501	01502	yl=601503	yh=801504	xl=1001505	xh=1201506	01507	.text01508	.dvu4:01509	        push    si01510	        push    di01511	        mov     si,sp           ! copy of sp01512	        mov     bx,yl(si)01513	        mov     ax,yh(si)01514	        or      ax,ax01515	        jne     7f01516	        xor     dx,dx01517	        mov     cx,xl(si)01518	        mov     ax,xh(si)01519	        div     bx01520	        xchg    ax,cx01521	        div     bx01522	9:01523	                        ! cx is high order result01524	                        ! ax is low order result01525	        mov     dx,cx01526	        pop     di01527	        pop     si01528	        ret     8       ! result in ax/dx01529	01530	7:01531	        mov     di,ax01532	        xor     bx,bx01533	        mov     ax,xl(si)01534	        mov     dx,xh(si)01535	        mov     cx,#1601536	1:01537	        shl     ax,#101538	        rcl     dx,#101539	        rcl     bx,#101540	        cmp     di,bx01541	        ja      3f01542	        jb      2f01543	        cmp     yl(si),dx01544	        jbe     2f01545	3:01546	        loop    1b01547	        jmp     9b01548	2:01549	        sub     dx,yl(si)01550	        sbb     bx,di01551	        inc     ax01552	        loop    1b01553	        jmp     9b.Ep 12 src/lib/i86/em/error.s++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++			src/lib/i86/em/error.s	 	 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++01600	.define .error01601	.define .Xtrp01602	01603	        ! ax is trap number01604	        ! all registers must be saved01605	        ! because return is possible01606	        ! May only be called with error no's <1601607	.text01608	.error:01609	        push bp01610	        push si01611	        push di01612	        push dx01613	        push cx01614	        push bx01615	        push ax01616	        mov  cx,ax01617	        mov  bx,#101618	        sal  bx,cl01619	.extern .ignmask01620	.extern .trp01621	        test bx,.ignmask01622	        jne  2f01623	        call    .trp01624	2:01625	        pop  ax01626	        pop  bx01627	        pop  cx01628	        pop  dx01629	        pop  di01630	        pop  si01631	        pop  bp01632	        ret01633	01634	.Xtrp:01635	        cmp     ax,#1601636	        jge     1f01637	        call    .error01638	        ret01639	1:01640	        jmp     .trp.Op 13 src/lib/i86/em/exg.s++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++			src/lib/i86/em/exg.s	 	 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++01700	.define .exg01701	01702	        ! #bytes in cx01703	.text01704	.exg:01705	        push    di01706	        mov     sp,di01707	        add     di,#401708	        mov     bx,di01709	        add     bx,cx01710	        sar     cx,#101711	1:01712	        mov     ax,(bx)01713	        xchg    ax,(di)01714	        mov     (bx),ax01715	        add     di,#201716	        add     bx,#201717	        loop    1b01718	2:01719	        pop     di01720	        ret++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++			src/lib/i86/em/fat.s	 	 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++01800	.define .fat01801	.text01802	01803	.fat:01804	.extern .trp01805	.extern .stop01806	        call    .trp01807	        call    .stop01808	        ! no return++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++			src/lib/i86/em/fp8087.s	 	 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++01900	.define .adf4, .adf8, .sbf4, .sbf8, .mlf4, .mlf8, .dvf4, .dvf801901	.define .ngf4, .ngf8, .fif4, .fif8, .fef4, .fef801902	.define .cif4, .cif8, .cuf4, .cuf8, .cfi, .cfu, .cff4, .cff801903	.define .cmf4, .cmf801904	.sect .text; .sect .rom; .sect .data; .sect .bss01905	01906	!       $Header: fp8087.s,v 1.2 89/11/28 12:51:35 ceriel Exp $01907	01908	!       Implement interface to floating point package for Intel 808701909	.Ep 14 src/lib/i86/em/fp8087.s01910	        .sect .rom01911	one:01912	        .data2  101913	two:01914	        .data2  201915	bigmin:01916	        .data2  0, -3276801917	01918	        .sect .text01919	.adf4:01920	        mov     bx,sp01921	        wait01922	        flds    2(bx)01923	        wait01924	        fadds   6(bx)01925	        wait01926	        fstps   6(bx)01927	        wait01928	        ret01929	.adf8:01930	        mov     bx,sp01931	        wait01932	        fldd    2(bx)01933	        wait01934	        faddd   10(bx)01935	        wait01936	        fstpd   10(bx)01937	        wait01938	        ret01939	01940	.sbf4:01941	        mov     bx,sp01942	        wait01943	        flds    6(bx)01944	        wait01945	        fsubs   2(bx)01946	        wait01947	        fstps   6(bx)01948	        wait01949	        ret01950	01951	.sbf8:01952	        mov     bx,sp01953	        wait01954	        fldd    10(bx)01955	        wait01956	        fsubd   2(bx)01957	        wait01958	        fstpd   10(bx)01959	        wait01960	        ret01961	01962	.mlf4:01963	        mov     bx,sp01964	        wait01965	        flds    2(bx)01966	        wait01967	        fmuls   6(bx)01968	        wait01969	        fstps   6(bx).Op 15 src/lib/i86/em/fp8087.s01970	        wait01971	        ret01972	.mlf8:01973	        mov     bx,sp01974	        wait01975	        fldd    2(bx)01976	        wait01977	        fmuld   10(bx)01978	        wait01979	        fstpd   10(bx)01980	        wait01981	        ret01982	01983	.dvf4:01984	        mov     bx,sp01985	        wait01986	        flds    6(bx)01987	        wait01988	        fdivs   2(bx)01989	        wait01990	        fstps   6(bx)01991	        wait01992	        ret01993	01994	.dvf8:01995	        mov     bx,sp01996	        wait01997	        fldd    10(bx)01998	        wait01999	        fdivd   2(bx)02000	        wait02001	        fstpd   10(bx)02002	        wait02003	        ret02004	02005	.ngf4:02006	        mov     bx,sp02007	        wait02008	        flds    2(bx)02009	        wait02010	        fchs02011	        wait02012	        fstps   2(bx)02013	        wait02014	        ret02015	02016	.ngf8:02017	        mov     bx,sp02018	        wait02019	        fldd    2(bx)02020	        wait02021	        fchs02022	        wait02023	        fstpd   2(bx)02024	        wait02025	        ret02026	02027	.fif4:02028	        mov     bx,sp02029	        push    bx              ! make room for FP status word.Ep 16 src/lib/i86/em/fp8087.s02030	        wait02031	        flds    4(bx)02032	        wait02033	        fmuls   8(bx)           ! multiply02034	        wait02035	        fld     st              ! copy result02036	        wait02037	        ftst                    ! test sign; handle negative separately02038	        wait02039	        fstsw   -2(bx)02040	        wait02041	        mov     ax,-2(bx)02042	        sahf                    ! result of test in condition codes02043	        jb      1f02044	        frndint                 ! this one rounds (?)02045	        wait02046	        fcom    st(1)           ! compare with original; if <=, then OK02047	        wait02048	        fstsw   -2(bx)02049	        wait02050	        mov     ax,-2(bx)02051	        sahf02052	        jbe     2f02053	        fisubs  one             ! else subtract 102054	        wait02055	        jmp     2f02056	1:                              ! here, negative case02057	        frndint                 ! this one rounds (?)02058	        wait02059	        fcom    st(1)           ! compare with original; if >=, then OK02060	        wait02061	        fstsw   -2(bx)02062	        wait02063	        mov     ax,-2(bx)02064	        sahf02065	        jae     2f02066	        fiadds  one             ! else add 102067	        wait02068	2:02069	        fsub    st(1),st        ! subtract integer part02070	        wait02071	        mov     bx,2(bx)02072	        fstps   (bx)02073	        wait02074	        fstps   4(bx)02075	        wait02076	        pop     bx02077	        ret02078	02079	.fif8:02080	        mov     bx,sp02081	        push    bx              ! make room for FP status word02082	        wait02083	        fldd    4(bx)02084	        wait02085	        fmuld   12(bx)          ! multiply02086	        wait02087	        fld     st              ! and copy result02088	        wait02089	        ftst                    ! test sign; handle negative separately.Op 17 src/lib/i86/em/fp8087.s02090	        wait02091	        fstsw   -2(bx)02092	        wait02093	        mov     ax,-2(bx)02094	        sahf                    ! result of test in condition codes02095	        jb      1f02096	        frndint                 ! this one rounds (?)02097	        wait02098	        fcom    st(1)           ! compare with original; if <=, then OK02099	        wait02100	        fstsw   -2(bx)02101	        wait02102	        mov     ax,-2(bx)02103	        sahf02104	        jbe     2f02105	        fisubs  one             ! else subtract 102106	        wait02107	        jmp     2f02108	1:                              ! here, negative case02109	        frndint                 ! this one rounds (?)02110	        wait02111	        fcom    st(1)           ! compare with original; if >=, then OK02112	        wait02113	        fstsw   -2(bx)02114	        wait02115	        mov     ax,-2(bx)02116	        sahf02117	        jae     2f02118	        fiadds  one             ! else add 102119	        wait02120	2:02121	        fsub    st(1),st        ! subtract integer part02122	        mov     bx,2(bx)02123	        fstpd   (bx)02124	        wait02125	        fstpd   8(bx)02126	        wait02127	        pop     bx02128	        ret02129	02130	.fef4:02131	                                ! this could be simpler, if only the02132	                                ! fxtract instruction was emulated properly02133	        mov     bx,sp02134	        mov     ax,6(bx)02135	        and     ax,#07760002136	        je      1f              ! zero exponent02137	        mov     cx,#702138	        shr     ax,cl02139	        sub     ax,#12602140	        mov     cx,ax           ! exponent in cx02141	        mov     ax,6(bx)02142	        and     ax,#010017702143	        or      ax,#0037400     ! load -1 exponent02144	        mov     dx,4(bx)02145	        mov     bx,2(bx)02146	        mov     4(bx),ax

⌨️ 快捷键说明

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