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

📄 lib86.txt

📁 操作系统设计与实现源码
💻 TXT
📖 第 1 页 / 共 5 页
字号:


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			src/lib/i86/em/adi.s	 	 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

00000	.define .adi
00001	
00002	        .text
00003	.adi:
00004	        pop     bx 
00005	        cmp     cx,#2
00006	        jne     1f
00007	        pop     cx
00008	        add     ax,cx
00009	        jmp     (bx)
00010	1:
00011	        cmp     cx,#4
00012	        jne     9f
00013	        pop     dx
00014	        pop     cx
00015	        add     ax,cx
00016	        pop     cx
00017	        adc     dx,cx
00018	        push    dx
00019	        jmp     (bx)
00020	9:
00021	.extern .trpilin
00022	        push    bx
00023	        jmp     .trpilin

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			src/lib/i86/em/and.s	 	 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

00100	.define .and
00101	
00102	        ! #bytes in cx
00103	        ! save di; it might be a register variable
00104	
00105	        .text
00106	.and:
00107	        pop     bx              ! return address
00108	        mov     dx,di
00109	        mov     di,sp
00110	        add     di,cx
00111	        sar     cx,#1
00112	1:
00113	        pop     ax
00114	        and     ax,(di)
00115	        stos
00116	        loop    1b
00117	        mov     di,dx
00118	        jmp     (bx)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			src/lib/i86/em/blm.s	 	 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

00200	.define .blm
00201	.text
00202	
00203	        ! cx: count in words
00204	.blm:
00205	        mov     bx,sp
00206	        mov     ax,si
00207	        mov     dx,di
00208	        mov     di,2(bx)
00209	        mov     si,4(bx)
00210	        rep
00211	        mov
00212	        mov     si,ax
00213	        mov     di,dx
00214	        ret     4

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			src/lib/i86/em/cii.s	 	 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

00300	.define .cii
00301	
00302	.text
00303	.cii:
00304	        pop     bx              ! return address
00305	                                ! pop     cx, dest. size
00306	                                ! pop     dx, src. size
00307	                                ! ax is first word of source
00308	        cmp     dx,#1
00309	        jne     2f
00310	        cbw
00311	        mov     dx,#2
00312	2:
00313	        cmp     dx,cx
00314	        je      8f
00315	        cmp     dx,#2
00316	        je      1f
00317	        cmp     dx,#4
00318	        jne     9f
00319	        cmp     cx,#2
00320	        jne     9f
00321	        pop     dx
00322	8:
00323	        jmp     (bx)
00324	1:
00325	        cmp     cx,#4
00326	        jne     9f
00327	        cwd
00328	        push    dx
00329	        jmp     (bx)
00330	9:
00331	        push    ax              ! push low source
00332	EILLINS = 18
00333	.extern .fat
00334	        mov     ax,#EILLINS
00335	        push    ax
00336	        jmp     .fat

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			src/lib/i86/em/cmi4.s	 	 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

00400	.define .cmi4
00401	
00402	.text
00403	.cmi4:
00404	        pop     bx              ! return address
00405	        pop     cx
00406	        pop     dx
00407	        pop     ax
00408	        push    si
00409	        mov     si,sp
00410	        xchg    bx,2(si)
00411	        pop     si
00412	        cmp     bx,dx
00413	        jg      1f
00414	        jl      2f
00415	        cmp     ax,cx
00416	        ja      1f
00417	        je      3f
00418	2:
00419	        mov     ax,#-1
00420	        ret
00421	3:
00422	        xor     ax,ax
00423	        ret
00424	1:
00425	        mov     ax,#1
00426	        ret

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			src/lib/i86/em/cms.s	 	 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

00500	.define .cms
00501	
00502	        ! #bytes in cx
00503	        .text
00504	.cms:
00505	        pop     bx              ! return address
00506	        mov     dx,sp
00507	        push    si
00508	        push    di
00509	        mov     si,dx
00510	        add     dx,cx
00511	        mov     di,dx
00512	        add     dx,cx
00513	        sar     cx,#1
00514	        repe
00515	        cmp
00516	        je      1f
00517	        inc     cx
00518	1:
00519	        pop     di
00520	        pop     si
00521	        mov     sp,dx
00522	        jmp     (bx)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			src/lib/i86/em/cmu4.s	 	 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

00600	.define .cmu4
00601	
00602	.text
00603	.cmu4:
00604	        pop     bx              ! return address
00605	        pop     cx
00606	        pop     dx
00607	        pop     ax
00608	        push    si
00609	        mov     si,sp
00610	        xchg    bx,2(si)
00611	        pop     si
00612	        cmp     bx,dx
00613	        ja      1f
00614	        jb      2f
00615	        cmp     ax,cx
00616	        ja      1f
00617	        je      3f
00618	2:
00619	        mov     ax,#-1
00620	        ret
00621	3:
00622	        xor     ax,ax
00623	        ret
00624	1:
00625	        mov     ax,#1
00626	        ret

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			src/lib/i86/em/com.s	 	 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

00700	.define .com
00701	
00702	        ! #bytes in cx
00703	        .text
00704	.com:
00705	        mov     bx,sp
00706	        inc     bx
00707	        inc     bx
00708	        sar     cx,#1
00709	1:
00710	        not     (bx)
00711	        inc     bx
00712	        inc     bx
00713	        loop    1b
00714	        ret

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			src/lib/i86/em/csa2.s	 	 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

00800	.define .csa2
00801	
00802	.text
00803	.csa2:
00804	                                ! bx, descriptor address
00805	                                ! ax, index
00806	        mov     dx,(bx)         ! default
00807	        sub     ax,2(bx)
00808	        cmp     ax,4(bx)
00809	        ja      1f
00810	        sal     ax,#1
00811	        add     bx,ax
00812	        mov     bx,6(bx)
00813	        test    bx,bx
00814	        jnz     2f
00815	1:
00816	        mov     bx,dx
00817	        test    bx,bx
00818	        jnz     2f
00819	ECASE = 20
00820	.extern .fat
00821	        mov     ax,#ECASE
00822	        push    ax
00823	        jmp     .fat
00824	2:
00825	        jmp     (bx)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			src/lib/i86/em/csa4.s	 	 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

00900	.sect .text; .sect .rom; .sect .data; .sect .bss
00901	.define .csa4
00902	
00903	.sect .text
00904	.csa4:
00905	                                ! bx, descriptor address
00906	                                ! ax, dx: index
00907	        mov     cx,(bx)         ! default
00908	        sub     ax,2(bx)
00909	                                ! ignore high order word; if non-zero, the
00910	                                ! case descriptor would not fit anyway
00911	        cmp     ax,6(bx)
00912	        ja      1f
00913	2:
00914	        sal     ax,#1
00915	        add     bx,ax
00916	        mov     bx,10(bx)
00917	        test    bx,bx
00918	        jnz     2f
00919	1:
00920	        mov     bx,cx
00921	        test    bx,bx
00922	        jnz     2f
00923	ECASE = 20
00924	.extern .fat
00925	        mov     ax,#ECASE
00926	        push    ax
00927	        jmp     .fat
00928	2:
00929	        jmp     (bx)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			src/lib/i86/em/csb2.s	 	 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

01000	.define .csb2
01001	
01002	.text
01003	.csb2:
01004	                                !bx, descriptor address
01005	                                !ax,  index
01006	        mov     dx,(bx)
01007	        mov     cx,2(bx)
01008	1:
01009	        add     bx,#4
01010	        dec     cx
01011	        jl      4f
01012	        cmp     ax,(bx)
01013	        jne     1b
01014	        mov     bx,2(bx)
01015	2:
01016	        test    bx,bx
01017	        jnz     3f
01018	ECASE = 20
01019	.extern .fat
01020	        mov     ax,#ECASE
01021	        push    ax
01022	        jmp     .fat
01023	3:
01024	        jmp     (bx)
01025	4:
01026	        mov     bx,dx
01027	        jmp     2b

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			src/lib/i86/em/csb4.s	 	 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

01100	.sect .text; .sect .rom; .sect .data; .sect .bss
01101	.define .csb4
01102	
01103	.sect .text
01104	.csb4:
01105	                                !bx: descriptor address
01106	                                !ax, dx:  index
01107	        push    (bx)            ! default
01108	        mov     cx,2(bx)        ! count (ignore high order word, the descriptor
01109	                                ! would not fit anyway)
01110	1:
01111	        add     bx,#6
01112	        dec     cx
01113	        jl      4f
01114	        cmp     ax,(bx)
01115	        jne     1b
01116	        cmp     dx,2(bx)
01117	        jne     1b
01118	        pop     bx
01119	        mov     bx,4(bx)
01120	2:
01121	        test    bx,bx
01122	        jnz     3f
01123	ECASE = 20
01124	.extern .fat
01125	        mov     ax,#ECASE
01126	        push    ax
01127	        jmp     .fat
01128	3:
01129	        jmp     (bx)
01130	4:
01131	        pop     bx
01132	        jmp     2b

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			src/lib/i86/em/cuu.s	 	 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

01200	.define .ciu
01201	.define .cui
01202	.define .cuu
01203	
01204	.text
01205	.ciu:
01206	.cui:
01207	.cuu:
01208	        pop     bx              ! return address
01209	                                ! pop     cx, dest. size
01210	                                ! pop     dx, source size
01211	                                ! ax is low word of source
01212	        cmp     dx,cx
01213	        je      8f
01214	        cmp     dx,#2
01215	        je      1f
01216	        cmp     dx,#4
01217	        jne     9f
01218	        cmp     cx,#2
01219	        jne     9f
01220	        pop     dx
01221	8:
01222	        jmp     (bx)
01223	1:
01224	        cmp     cx,#4
01225	        jne     9f
01226	        xor     dx,dx
01227	        push    dx
01228	        jmp     (bx)
01229	9:
01230	        push    ax              ! to help debugging ?
01231	EILLINS = 18
01232	.extern .fat
01233	        mov     ax,#EILLINS
01234	        push    ax
01235	        jmp     .fat

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			src/lib/i86/em/dup.s	 	 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

01300	.define .dup
01301	
01302	        ! #bytes in cx
01303	        .text
01304	.dup:
01305	        pop     bx              ! return address
01306	        mov     ax,si
01307	        mov     dx,di
01308	        mov     si,sp
01309	        sub     sp,cx
01310	        mov     di,sp
01311	        sar     cx,#1
01312	        rep
01313	        mov
01314	        mov     si,ax
01315	        mov     di,dx
01316	        jmp     (bx)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			src/lib/i86/em/dvi4.s	 	 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

01400	.define .dvi4
01401	
01402	yl=6
01403	yh=8
01404	xl=10
01405	xh=12
01406	
01407	.text
01408	.dvi4:
01409	        push    si
01410	        push    di
01411	        mov     si,sp           ! copy of sp
01412	        mov     bx,yl(si)
01413	        mov     ax,yh(si)
01414	        cwd
01415	        mov     di,dx
01416	        cmp     dx,ax
01417	        jne     7f
01418	        and     dx,dx
01419	        jge     1f
01420	        neg     bx
01421	        je      7f
01422	1:
01423	        xor     dx,dx
01424	        mov     cx,xl(si)
01425	        mov     ax,xh(si)
01426	        and     ax,ax
01427	        jge     2f
01428	        neg     ax
01429	        neg     cx

⌨️ 快捷键说明

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