*** empty log message ***
This commit is contained in:
		
							parent
							
								
									1b36afae36
								
							
						
					
					
						commit
						9c93cbdfaa
					
				
					 52 changed files with 1383 additions and 0 deletions
				
			
		
							
								
								
									
										25
									
								
								mach/i86/libem/adi.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								mach/i86/libem/adi.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,25 @@ | |||
| .define .adi | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! #bytes in cx , top of stack in ax | ||||
| .adi: | ||||
| 	pop     bx              ! return address | ||||
| 	cmp     cx,2 | ||||
| 	jne     1f | ||||
| 	pop     cx | ||||
| 	add     ax,cx | ||||
| 	jmp     bx | ||||
| 1: | ||||
| 	cmp     cx,4 | ||||
| 	jne     9f | ||||
| 	pop     dx | ||||
| 	pop     cx | ||||
| 	add     ax,cx | ||||
| 	pop     cx | ||||
| 	adc     dx,cx | ||||
| 	push    dx | ||||
| 	jmp     bx | ||||
| 9: | ||||
| 	mov     ax,EODDZ | ||||
| 	push    ax | ||||
| 	jmp     .trp | ||||
							
								
								
									
										15
									
								
								mach/i86/libem/and.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								mach/i86/libem/and.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,15 @@ | |||
| .define	.and | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! #bytes in cx | ||||
| .and: | ||||
| 	pop	bx		! return address | ||||
| 	mov	di,sp | ||||
| 	add	di,cx | ||||
| 	sar	cx,1 | ||||
| 1: | ||||
| 	pop	ax | ||||
| 	and	ax,(di) | ||||
| 	stos | ||||
| 	loop	1b | ||||
| 	jmp	bx | ||||
							
								
								
									
										37
									
								
								mach/i86/libem/cii.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								mach/i86/libem/cii.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,37 @@ | |||
| .define .cii | ||||
| 
 | ||||
| .cii: | ||||
|         ! $Header$ | ||||
| 	pop     di              ! return address | ||||
| 				! pop     cx, dest. size | ||||
| 				! pop     bx, src. size | ||||
| 				! ax is first word of source | ||||
| 	cmp     bx,cx | ||||
| 	je      8f | ||||
| 	cmp     bx,2 | ||||
| 	je      1f | ||||
| 	cmp     bx,4 | ||||
| 	jne     7f | ||||
| 	cmp     cx,2 | ||||
| 	jne     9f | ||||
| 	pop     dx | ||||
| 8: | ||||
| 	jmp     di | ||||
| 7:      cmp     bx,1 | ||||
| 	jne     9f | ||||
| 	cmp     cx,2 | ||||
| 	jne     9f | ||||
| 	cbw | ||||
| 	jmp     8b | ||||
| 1: | ||||
| 	cmp     cx,4 | ||||
| 	jne     9f | ||||
| 	cwd | ||||
| 	push    dx | ||||
| 	jmp     di | ||||
| 9: | ||||
| 	push    ax              ! push low source | ||||
| 	mov     ax,EILLINS | ||||
| 	push    ax | ||||
| 	jmp     .fat | ||||
| 	jmp     bx | ||||
							
								
								
									
										18
									
								
								mach/i86/libem/cms.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								mach/i86/libem/cms.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,18 @@ | |||
| .define .cms | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! #bytes in cx | ||||
| .cms: | ||||
| 	pop     bx              ! return address | ||||
| 	mov     dx,sp | ||||
| 	mov     si,dx | ||||
| 	add     dx,cx | ||||
| 	mov     di,dx | ||||
| 	add     dx,cx | ||||
| 	sar     cx,1 | ||||
| 	repe cmps | ||||
| 	je      1f | ||||
| 	inc     cx | ||||
| 1: | ||||
| 	mov     sp,dx | ||||
| 	jmp     bx | ||||
							
								
								
									
										25
									
								
								mach/i86/libem/cmu4.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								mach/i86/libem/cmu4.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,25 @@ | |||
| .define .cmu4 | ||||
| 
 | ||||
| .cmu4: | ||||
|         ! $Header$ | ||||
| 	pop     bx              ! return address | ||||
| 	xor     ax,ax | ||||
| 	pop     cx | ||||
| 	pop     dx | ||||
| 	pop     si | ||||
| 	pop     di | ||||
| 	cmp     di,dx | ||||
| 	ja      1f | ||||
| 	jb      2f | ||||
| 	cmp     si,cx | ||||
| 	ja      1f | ||||
| 	je      3f | ||||
| 2: | ||||
| 	dec     ax | ||||
| 3: | ||||
| 	jmp     bx | ||||
| 1: | ||||
| 	inc     ax | ||||
| 	jmp     bx | ||||
| 
 | ||||
| 	ret | ||||
							
								
								
									
										14
									
								
								mach/i86/libem/com.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								mach/i86/libem/com.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,14 @@ | |||
| .define	.com | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! #bytes in cx | ||||
| .com: | ||||
| 	pop	bx		! return address | ||||
| 	mov	di,sp | ||||
| 	sar	cx,1 | ||||
| 1: | ||||
| 	not	(di) | ||||
| 	inc	di | ||||
| 	inc	di | ||||
| 	loop	1b | ||||
| 	jmp	bx | ||||
							
								
								
									
										23
									
								
								mach/i86/libem/csa2.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								mach/i86/libem/csa2.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,23 @@ | |||
| .define .csa2 | ||||
| 
 | ||||
| .csa2: | ||||
|         ! $Header$ | ||||
| 				! si, descriptor address | ||||
| 				! bx, index | ||||
| 	mov     dx,(si)         ! default | ||||
| 	sub     bx,2(si) | ||||
| 	cmp     bx,4(si) | ||||
| 	ja      1f | ||||
| 	sal     bx,1 | ||||
| 	mov     bx,6(bx)(si) | ||||
| 	test    bx,bx | ||||
| 	jnz     2f | ||||
| 1: | ||||
| 	mov     bx,dx | ||||
| 	test    bx,bx | ||||
| 	jnz     2f | ||||
| 	mov     ax,ECASE | ||||
| 	push    ax | ||||
| 	jmp     .fat | ||||
| 2: | ||||
| 	jmp     bx | ||||
							
								
								
									
										26
									
								
								mach/i86/libem/csb2.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								mach/i86/libem/csb2.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,26 @@ | |||
| .define .csb2 | ||||
| 
 | ||||
| .csb2: | ||||
|         ! $Header$ | ||||
| 				!si, descriptor address | ||||
| 				!dx,  index | ||||
| 	lods | ||||
| 	xchg    ax,bx           ! default | ||||
| 	lods | ||||
| 	xchg    ax,cx           ! number of cases | ||||
| 1: | ||||
| 	dec     cx | ||||
| 	jl      2f | ||||
| 	lods | ||||
| 	cmp     ax,dx | ||||
| 	lods | ||||
| 	jne     1b | ||||
| 	xchg    ax,bx | ||||
| 2: | ||||
| 	test    bx,bx | ||||
| 	jnz     3f | ||||
| 	mov     ax,ECASE | ||||
| 	push    ax | ||||
| 	jmp     .fat | ||||
| 3: | ||||
| 	jmp     bx | ||||
							
								
								
									
										35
									
								
								mach/i86/libem/cuu.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								mach/i86/libem/cuu.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,35 @@ | |||
| .define .ciu | ||||
| .define .cui | ||||
| .define .cuu | ||||
| 
 | ||||
| .ciu: | ||||
| .cui: | ||||
| .cuu: | ||||
|         ! $Header$ | ||||
| 	pop     di              ! return address | ||||
| 				! pop     cx, dest. size | ||||
| 				! pop     bx, source size | ||||
| 				! ax is low word of source | ||||
| 	cmp     bx,cx | ||||
| 	je      8f | ||||
| 	cmp     bx,2 | ||||
| 	je      1f | ||||
| 	cmp     bx,4 | ||||
| 	jne     9f | ||||
| 	cmp     cx,2 | ||||
| 	jne     9f | ||||
| 	pop     dx | ||||
| 8: | ||||
| 	jmp     di | ||||
| 1: | ||||
| 	cmp     cx,4 | ||||
| 	jne     9f | ||||
| 	xor     dx,dx | ||||
| 	push    dx | ||||
| 	jmp     di | ||||
| 9: | ||||
| 	push    ax              ! to help debugging ? | ||||
| 	mov     ax,EILLINS | ||||
| 	push    ax | ||||
| 	jmp     .fat | ||||
| 	jmp     bx | ||||
							
								
								
									
										12
									
								
								mach/i86/libem/dup.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								mach/i86/libem/dup.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | |||
| .define	.dup | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! #bytes in cx | ||||
| .dup: | ||||
| 	pop	bx		! return address | ||||
| 	mov	si,sp | ||||
| 	sub	sp,cx | ||||
| 	mov	di,sp | ||||
| 	sar	cx,1 | ||||
| 	rep movs | ||||
| 	jmp	bx | ||||
							
								
								
									
										35
									
								
								mach/i86/libem/dvi.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								mach/i86/libem/dvi.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,35 @@ | |||
| .define .dvi | ||||
| 
 | ||||
|         ! $Header$ | ||||
|         ! #bytes in ax | ||||
| .dvi: | ||||
|         pop     bx              ! return address | ||||
|         cmp     ax,2 | ||||
|         jne     1f | ||||
|         pop     ax | ||||
|         cwd | ||||
|         pop     cx | ||||
|         idiv    cx | ||||
|         push    ax | ||||
|         jmp     bx | ||||
| 1: | ||||
|         cmp     ax,4 | ||||
|         jne     9f | ||||
|         pop     ax | ||||
|         pop     dx | ||||
|         pop     si | ||||
|         pop     di | ||||
|         push    bx | ||||
|         push    di | ||||
|         push    si | ||||
|         push    dx | ||||
|         push    ax | ||||
|         call   .dvi4 | ||||
|         pop     bx | ||||
|         push    cx | ||||
|         push    ax | ||||
|         jmp     bx | ||||
| 9: | ||||
|         mov     ax,EODDZ | ||||
|         push    ax | ||||
|         jmp     .trp | ||||
							
								
								
									
										85
									
								
								mach/i86/libem/dvi4.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								mach/i86/libem/dvi4.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,85 @@ | |||
| .define .dvi4 | ||||
| 
 | ||||
| yl=2 | ||||
| yh=4 | ||||
| xl=6 | ||||
| xh=8 | ||||
| 
 | ||||
| .dvi4: | ||||
|         ! $Header$ | ||||
| 	mov     si,sp           ! copy of sp | ||||
| 	mov     bx,yl(si) | ||||
| 	mov     ax,yh(si) | ||||
| 	cwd | ||||
| 	mov     di,dx | ||||
| 	cmp     dx,ax | ||||
| 	jne     7f | ||||
| 	and     dx,dx | ||||
| 	jge     1f | ||||
| 	neg     bx | ||||
| 	je      7f | ||||
| 1: | ||||
| 	xor     dx,dx | ||||
| 	mov     cx,xl(si) | ||||
| 	mov     ax,xh(si) | ||||
| 	and     ax,ax | ||||
| 	jge     2f | ||||
| 	neg     ax | ||||
| 	neg     cx | ||||
| 	sbb     ax,dx | ||||
| 	not     di | ||||
| 2: | ||||
| 	div     bx | ||||
| 	xchg    ax,cx | ||||
| 	div     bx              ! cx = high abs(result), ax=low abs(result) | ||||
| 9: | ||||
| 	and     di,di | ||||
| 	jge     1f | ||||
| 	neg     cx | ||||
| 	neg     ax | ||||
| 	sbb     cx,0 | ||||
| 1: | ||||
| 			! cx is high order result | ||||
| 			! ax is low order result | ||||
| 	ret     8 | ||||
| 
 | ||||
| 7: | ||||
| 	push    dx              ! sign of y | ||||
| 	mov     di,ax | ||||
| 	xor     bx,bx | ||||
| 	and     di,di | ||||
| 	jge     1f | ||||
| 	neg     di | ||||
| 	neg     yl(si) | ||||
| 	sbb     di,bx | ||||
| 1: | ||||
| 	mov     ax,xl(si) | ||||
| 	mov     dx,xh(si) | ||||
| 	and     dx,dx | ||||
| 	jge     1f | ||||
| 	neg     dx | ||||
| 	neg     ax | ||||
| 	sbb     dx,bx | ||||
| 	not     -2(si) | ||||
| 1: | ||||
| 	mov     cx,16 | ||||
| 1: | ||||
| 	shl     ax,1 | ||||
| 	rcl     dx,1 | ||||
| 	rcl     bx,1 | ||||
| 	cmp     di,bx | ||||
| 	ja      3f | ||||
| 	jb      2f | ||||
| 	cmp     yl(si),dx | ||||
| 	jbe     2f | ||||
| 3: | ||||
| 	loop    1b | ||||
| 	jmp     1f | ||||
| 2: | ||||
| 	sub     dx,yl(si) | ||||
| 	sbb     bx,di | ||||
| 	inc     ax | ||||
| 	loop    1b | ||||
| 1: | ||||
| 	pop     di              ! di=sign of result,ax= result | ||||
| 	jmp     9b | ||||
							
								
								
									
										35
									
								
								mach/i86/libem/dvu.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								mach/i86/libem/dvu.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,35 @@ | |||
| .define .dvu | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! #bytes in ax | ||||
| .dvu: | ||||
| 	pop     bx              ! return address | ||||
| 	cmp     ax,2 | ||||
| 	jne     1f | ||||
| 	pop     ax | ||||
| 	xor     dx,dx | ||||
| 	pop     cx | ||||
| 	div     cx | ||||
| 	push    ax | ||||
| 	jmp     bx | ||||
| 1: | ||||
| 	cmp     ax,4 | ||||
| 	jne     9f | ||||
| 	pop     ax | ||||
| 	pop     dx | ||||
| 	pop     si | ||||
| 	pop     di | ||||
| 	push    bx | ||||
| 	push    di | ||||
| 	push    si | ||||
| 	push    dx | ||||
| 	push    ax | ||||
| 	call   .dvu4 | ||||
| 	pop     bx | ||||
| 	push    cx | ||||
| 	push    ax | ||||
| 	jmp     bx | ||||
| 9: | ||||
| 	mov     ax,EODDZ | ||||
| 	push    ax | ||||
| 	jmp     .trp | ||||
							
								
								
									
										49
									
								
								mach/i86/libem/dvu4.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								mach/i86/libem/dvu4.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,49 @@ | |||
| .define .dvu4 | ||||
| 
 | ||||
| yl=2 | ||||
| yh=4 | ||||
| xl=6 | ||||
| xh=8 | ||||
| 
 | ||||
| .dvu4: | ||||
|         ! $Header$ | ||||
| 	mov     si,sp           ! copy of sp | ||||
| 	mov     bx,yl(si) | ||||
| 	mov     ax,yh(si) | ||||
| 	or      ax,ax | ||||
| 	jne     7f | ||||
| 	xor     dx,dx | ||||
| 	mov     cx,xl(si) | ||||
| 	mov     ax,xh(si) | ||||
| 	div     bx | ||||
| 	xchg    ax,cx | ||||
| 	div     bx | ||||
| 9: | ||||
| 			! cx is high order result | ||||
| 			! ax is low order result | ||||
| 	ret     8 | ||||
| 
 | ||||
| 7: | ||||
| 	mov     di,ax | ||||
| 	xor     bx,bx | ||||
| 	mov     ax,xl(si) | ||||
| 	mov     dx,xh(si) | ||||
| 	mov     cx,16 | ||||
| 1: | ||||
| 	shl     ax,1 | ||||
| 	rcl     dx,1 | ||||
| 	rcl     bx,1 | ||||
| 	cmp     di,bx | ||||
| 	ja      3f | ||||
| 	jb      2f | ||||
| 	cmp     yl(si),dx | ||||
| 	jbe     2f | ||||
| 3: | ||||
| 	loop    1b | ||||
| 	jmp     9b | ||||
| 2: | ||||
| 	sub     dx,yl(si) | ||||
| 	sbb     bx,di | ||||
| 	inc     ax | ||||
| 	loop    1b | ||||
| 	jmp     9b | ||||
							
								
								
									
										30
									
								
								mach/i86/libem/error.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								mach/i86/libem/error.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,30 @@ | |||
| .define .error | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! ax is trap number | ||||
| 	! all registers must be saved | ||||
| 	! because return is possible | ||||
| 	! May only be called with error no's <16 | ||||
| .error: | ||||
| 	push bp | ||||
| 	push si | ||||
| 	push di | ||||
| 	push dx | ||||
| 	push cx | ||||
| 	push bx | ||||
| 	push ax | ||||
| 	mov  cx,ax | ||||
| 	mov  bx,1 | ||||
| 	sal  bx,cl | ||||
| 	test bx,(.ignmask) | ||||
| 	jne  2f | ||||
| 	call    .trp | ||||
| 2: | ||||
| 	pop  ax | ||||
| 	pop  bx | ||||
| 	pop  cx | ||||
| 	pop  dx | ||||
| 	pop  di | ||||
| 	pop  si | ||||
| 	pop  bp | ||||
| 	ret | ||||
							
								
								
									
										20
									
								
								mach/i86/libem/exg.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								mach/i86/libem/exg.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,20 @@ | |||
| .define .exg | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! #bytes in cx | ||||
| .exg: | ||||
| 	pop     bx              ! return address | ||||
| 	mov     dx,cx | ||||
| 	mov     si,sp | ||||
| 	sub     sp,cx | ||||
| 	mov     di,sp | ||||
| 	rep movs | ||||
| 	mov     si,sp | ||||
| 	mov     di,sp | ||||
| 	add     di,dx | ||||
| 	add     di,dx | ||||
| 	mov     cx,dx | ||||
| 	sar     cx,1 | ||||
| 	rep movs | ||||
| 	mov     sp,si | ||||
| 	jmp     bx | ||||
							
								
								
									
										42
									
								
								mach/i86/libem/fakfp.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								mach/i86/libem/fakfp.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,42 @@ | |||
| .define .mlf,.dvf,.ngf,.adf,.sbf,.cmf,.zrf,.fif,.fef | ||||
| .define .mlf8,.dvf8,.ngf8,.adf8,.sbf8,.cmf8,.zrf8,.fif8,.fef8 | ||||
| .define .mlf4,.dvf4,.ngf4,.adf4,.sbf4,.cmf4,.zrf4,.fif4,.fef4 | ||||
| .define .cif,.cfi,.cuf,.cfu,.cff | ||||
| 
 | ||||
| .mlf: | ||||
| .dvf: | ||||
| .ngf: | ||||
| .adf: | ||||
| .sbf: | ||||
| .cmf: | ||||
| .zrf: | ||||
| .fif: | ||||
| .fef: | ||||
| .mlf4: | ||||
| .dvf4: | ||||
| .ngf4: | ||||
| .adf4: | ||||
| .sbf4: | ||||
| .cmf4: | ||||
| .zrf4: | ||||
| .fif4: | ||||
| .fef4: | ||||
| .mlf8: | ||||
| .dvf8: | ||||
| .ngf8: | ||||
| .adf8: | ||||
| .sbf8: | ||||
| .cmf8: | ||||
| .zrf8: | ||||
| .fif8: | ||||
| .fef8: | ||||
| .cif: | ||||
| .cfi: | ||||
| .cuf: | ||||
| .cfu: | ||||
| .cff: | ||||
|         ! $Header$ | ||||
| 	pop     bx              ! return address | ||||
| 	mov     ax,EILLINS | ||||
| 	push    ax | ||||
| 	jmp     .fat | ||||
							
								
								
									
										7
									
								
								mach/i86/libem/fat.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								mach/i86/libem/fat.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,7 @@ | |||
| .define .fat | ||||
| 
 | ||||
| .fat: | ||||
|         ! $Header$ | ||||
| 	call    .trp | ||||
| 	call    .stop | ||||
| 	! no return | ||||
							
								
								
									
										7
									
								
								mach/i86/libem/gto.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								mach/i86/libem/gto.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,7 @@ | |||
| .define .gto | ||||
| 
 | ||||
| .gto: | ||||
|         ! $Header$ | ||||
| 	mov     bp,4(bx) | ||||
| 	mov     sp,2(bx) | ||||
| 	jmp     (bx) | ||||
							
								
								
									
										15
									
								
								mach/i86/libem/iaar.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								mach/i86/libem/iaar.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,15 @@ | |||
| .define .iaar | ||||
| 
 | ||||
| .iaar: | ||||
|         ! $Header$ | ||||
| 	pop     bx | ||||
| 	pop     dx | ||||
| 	cmp     dx,2 | ||||
| 	jne     .unknown | ||||
| 	pop     si      ! descriptor address | ||||
| 	pop     ax      ! index | ||||
| 	pop     di      ! array base | ||||
| 	sub     ax,(si) | ||||
| 	mul     4(si) | ||||
| 	add     di,ax | ||||
| 	jmp     bx | ||||
							
								
								
									
										13
									
								
								mach/i86/libem/ilar.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								mach/i86/libem/ilar.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,13 @@ | |||
| .define .ilar | ||||
| 
 | ||||
| .ilar: | ||||
|         ! $Header$ | ||||
| 	pop     bx | ||||
| 	pop     dx | ||||
| 	cmp     dx,2 | ||||
| 	jne     .unknown | ||||
| 	pop     di      ! descriptor address | ||||
| 	pop     ax      ! index | ||||
| 	pop     si      ! array base | ||||
| 	push    bx | ||||
| 	jmp    .lar2 | ||||
							
								
								
									
										29
									
								
								mach/i86/libem/inn.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								mach/i86/libem/inn.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,29 @@ | |||
| .define .inn | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! #bytes in cx | ||||
| 	! bit # in ax | ||||
| .inn: | ||||
| 	pop     bx              ! return address | ||||
| 	xor     dx,dx | ||||
| 	xor     si,si | ||||
| 	mov     di,8 | ||||
| 	div     di | ||||
| 	mov     di,sp | ||||
| 	add     di,ax | ||||
| 	cmp     ax,cx | ||||
| 	xchg    ax,dx | ||||
| 	xchg    ax,si           ! ax:=si,si:=dx,does not change carry | ||||
| 	jae     1f | ||||
| 	movb    dl,bits(si) | ||||
| 	testb   (di),dl | ||||
| 	jz      1f | ||||
| 	inc     ax | ||||
| 1: | ||||
| 	add     sp,cx | ||||
| 	! ax is result | ||||
| 	jmp     bx | ||||
| 
 | ||||
| 	.data | ||||
| bits: | ||||
| 	.byte 1,2,4,8,16,32,64,128 | ||||
							
								
								
									
										15
									
								
								mach/i86/libem/ior.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								mach/i86/libem/ior.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,15 @@ | |||
| .define	.ior | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! #bytes in cx | ||||
| .ior: | ||||
| 	pop	bx		! return address | ||||
| 	mov	di,sp | ||||
| 	add	di,cx | ||||
| 	sar	cx,1 | ||||
| 1: | ||||
| 	pop	ax | ||||
| 	or	ax,(di) | ||||
| 	stos | ||||
| 	loop	1b | ||||
| 	jmp	bx | ||||
							
								
								
									
										13
									
								
								mach/i86/libem/isar.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								mach/i86/libem/isar.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,13 @@ | |||
| .define .isar | ||||
| 
 | ||||
| .isar: | ||||
|         ! $Header$ | ||||
| 	pop     bx | ||||
| 	pop     dx | ||||
| 	cmp     dx,2 | ||||
| 	jne     .unknown | ||||
| 	pop     si      ! descriptor address | ||||
| 	pop     ax      ! index | ||||
| 	pop     di      ! array base | ||||
| 	push    bx | ||||
| 	jmp    .sar2 | ||||
							
								
								
									
										23
									
								
								mach/i86/libem/lar2.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								mach/i86/libem/lar2.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,23 @@ | |||
| .define .lar2 | ||||
| 
 | ||||
| .lar2: | ||||
|         ! $Header$ | ||||
| 	pop     bx              ! return address | ||||
| 				! di, descriptor address | ||||
| 				! ax, index | ||||
| 				! si, base address | ||||
| 	sub     ax,(di) | ||||
| 	mov     cx,4(di) | ||||
| 	imul    cx | ||||
| 	add     si,ax | ||||
| 	sar     cx,1 | ||||
| 	jnb     1f | ||||
| 	xorb    ah,ah | ||||
| 	lodsb | ||||
| 	push    ax | ||||
| 	jmp     bx | ||||
| 1: | ||||
| 	sub     sp,4(di) | ||||
| 	mov     di,sp | ||||
| 	rep movs | ||||
| 	jmp     bx | ||||
							
								
								
									
										19
									
								
								mach/i86/libem/loi.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								mach/i86/libem/loi.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,19 @@ | |||
| .define .loi | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! #bytes in cx | ||||
| 	! source address in si | ||||
| .loi: | ||||
| 	pop     bx | ||||
| 	mov     dx,cx | ||||
| 	sar     cx,1 | ||||
| 	jnb     1f | ||||
| 	xorb    ah,ah | ||||
| 	lodsb | ||||
| 	push    ax | ||||
| 	jmp     bx | ||||
| 1: | ||||
| 	sub     sp,dx | ||||
| 	mov     di,sp | ||||
| 	rep movs | ||||
| 	jmp     bx | ||||
							
								
								
									
										27
									
								
								mach/i86/libem/mli.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								mach/i86/libem/mli.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,27 @@ | |||
| .define .mli | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! #bytes in ax | ||||
| .mli: | ||||
| 	pop     bx              ! return address | ||||
| 	cmp     ax,2 | ||||
| 	jne     1f | ||||
| 	pop     ax | ||||
| 	pop     cx | ||||
| 	mul     cx | ||||
| 	push    ax | ||||
| 	jmp     bx | ||||
| 1: | ||||
| 	mov     dx,bx | ||||
| 	cmp     ax,4 | ||||
| 	jne     9f | ||||
| 	pop     si | ||||
| 	pop     di | ||||
| 	pop     bx | ||||
| 	pop     ax | ||||
| 	push    dx | ||||
| 	jmp    .mli4 | ||||
| 9: | ||||
| 	mov     ax,EODDZ | ||||
| 	push    ax | ||||
| 	jmp     .trp | ||||
							
								
								
									
										17
									
								
								mach/i86/libem/mli4.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								mach/i86/libem/mli4.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,17 @@ | |||
| .define .mli4 | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! x * y with | ||||
| 	! x.low = si x.high = di | ||||
| 	! y.low = bx y.high = ax | ||||
| 
 | ||||
| .mli4: | ||||
| 	mul     si              ! xl*yh | ||||
| 	mov     cx,ax | ||||
| 	mov     ax,di | ||||
| 	mul     bx              ! xh*yl | ||||
| 	add     cx,ax           ! xh*yl+xl*yh | ||||
| 	mov     ax,si | ||||
| 	mul     bx              ! xl*yl | ||||
| 	add     dx,cx | ||||
| 	ret | ||||
							
								
								
									
										5
									
								
								mach/i86/libem/mon.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mach/i86/libem/mon.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| .define .mon | ||||
| 
 | ||||
| .mon: | ||||
|         ! $Header$ | ||||
| 	call    .stop | ||||
							
								
								
									
										27
									
								
								mach/i86/libem/ngi.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								mach/i86/libem/ngi.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,27 @@ | |||
| .define .ngi | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! #bytes in ax | ||||
| .ngi: | ||||
| 	pop     bx              ! return address | ||||
| 	cmp     ax,2 | ||||
| 	jne     1f | ||||
| 	pop     cx | ||||
| 	neg     cx | ||||
| 	push    cx | ||||
| 	jmp     bx | ||||
| 1: | ||||
| 	cmp     ax,4 | ||||
| 	jne     9f | ||||
| 	pop     dx | ||||
| 	pop     ax | ||||
| 	neg     ax | ||||
| 	neg     dx | ||||
| 	sbb     ax,0 | ||||
| 	push    dx | ||||
| 	push    ax | ||||
| 	jmp     bx | ||||
| 9: | ||||
| 	mov     ax,EODDZ | ||||
| 	push    ax | ||||
| 	jmp     .trp | ||||
							
								
								
									
										22
									
								
								mach/i86/libem/nop.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								mach/i86/libem/nop.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| .define .nop | ||||
| 
 | ||||
| SIO_S           = 0xDA | ||||
| SIO_D           = 0xD8 | ||||
| RXRDY           = 0x02 | ||||
| 
 | ||||
| .nop: | ||||
|         ! $Header$ | ||||
| 	mov     ax,(hol0) | ||||
| 	call    printd | ||||
| !       movb    al,' ' | ||||
| !       call    printc | ||||
| !       mov     ax,sp | ||||
| !       call    printd | ||||
| !1: | ||||
| !       inb     SIO_S | ||||
| !       andb    al,RXRDY | ||||
| !       jz      1b | ||||
| !       inb     SIO_D | ||||
| !       call    printc | ||||
| 	movb    al,'\n' | ||||
| 	jmp     printc | ||||
							
								
								
									
										47
									
								
								mach/i86/libem/print.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								mach/i86/libem/print.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,47 @@ | |||
| .define	printc,printd,prints | ||||
| 
 | ||||
| SIO_D		= 0xD8 | ||||
| SIO_S		= 0xDA | ||||
| TXRDY		= 0x01 | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! argument in ax | ||||
| 	! uses bx | ||||
| prints: | ||||
| 	xchg	ax,bx | ||||
| 1: | ||||
| 	movb	al,(bx) | ||||
| 	inc	bx | ||||
| 	testb	al,al | ||||
| 	jz	2f | ||||
| 	call	printc | ||||
| 	jmp	1b | ||||
| 2: | ||||
| 	ret | ||||
| 
 | ||||
| 	! argument in ax | ||||
| 	! uses cx and dx | ||||
| printd: | ||||
| 	xor	dx,dx | ||||
| 	mov	cx,10 | ||||
| 	div	cx | ||||
| 	test	ax,ax | ||||
| 	jz	1f | ||||
| 	push	dx | ||||
| 	call	printd | ||||
| 	pop	dx | ||||
| 1: | ||||
| 	xchg	ax,dx | ||||
| 	addb	al,'0' | ||||
| 	.errnz	printc - . | ||||
| 
 | ||||
| 	! argument in ax | ||||
| printc: | ||||
| 	push	ax | ||||
| 1: | ||||
| 	inb	SIO_S | ||||
| 	andb	al,TXRDY | ||||
| 	jz	1b | ||||
| 	pop	ax | ||||
| 	outb	SIO_D | ||||
| 	ret | ||||
							
								
								
									
										38
									
								
								mach/i86/libem/printf.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								mach/i86/libem/printf.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,38 @@ | |||
| .define	printf
 | ||||
| 
 | ||||
| printf: | ||||
|         ! $Header$ | ||||
| 	pop	bx		! return address | ||||
| 	xchg	ax,di | ||||
| 	mov	si,sp | ||||
| 1: | ||||
| 	movb	al,(di) | ||||
| 	inc	di | ||||
| 	testb	al,al | ||||
| 	jz	6f | ||||
| 	cmpb	al,'%' | ||||
| 	je	3f | ||||
| 2: | ||||
| 	call	printc | ||||
| 	jmp	1b | ||||
| 3: | ||||
| 	movb	al,(di) | ||||
| 	inc	di | ||||
| 	cmpb	al,'c' | ||||
| 	jne	4f | ||||
| 	lods | ||||
| 	jmp	2b | ||||
| 4: | ||||
| 	cmpb	al,'d' | ||||
| 	jne	5f | ||||
| 	lods | ||||
| 	call	printd | ||||
| 	jmp	1b | ||||
| 5: | ||||
| 	cmpb	al,'s' | ||||
| 	jne	2b | ||||
| 	lods | ||||
| 	call	prints | ||||
| 	jmp	1b | ||||
| 6: | ||||
| 	jmp	bx | ||||
							
								
								
									
										17
									
								
								mach/i86/libem/rck.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								mach/i86/libem/rck.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,17 @@ | |||
| .define .rck | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! descriptor address in si | ||||
| 	! value in ax, must be left there | ||||
| .rck: | ||||
| 	cmp     ax,(si) | ||||
| 	jl      2f | ||||
| 	cmp     ax,2(si) | ||||
| 	jg      2f | ||||
| 	ret | ||||
| 2: | ||||
| 	push    ax | ||||
| 	mov     ax,ERANGE | ||||
| 	call    .error | ||||
| 	pop     ax | ||||
| 	ret | ||||
							
								
								
									
										35
									
								
								mach/i86/libem/rmi.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								mach/i86/libem/rmi.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,35 @@ | |||
| .define .rmi | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! #bytes in ax | ||||
| .rmi: | ||||
| 	pop     bx              ! return address | ||||
| 	cmp     ax,2 | ||||
| 	jne     1f | ||||
| 	pop     ax | ||||
| 	cwd | ||||
| 	pop     cx | ||||
| 	idiv    cx | ||||
| 	push    dx | ||||
| 	jmp     bx | ||||
| 1: | ||||
| 	cmp     ax,4 | ||||
| 	jne     9f | ||||
| 	pop     ax | ||||
| 	pop     dx | ||||
| 	pop     si | ||||
| 	pop     di | ||||
| 	push    bx | ||||
| 	push    di | ||||
| 	push    si | ||||
| 	push    dx | ||||
| 	push    ax | ||||
| 	call   .rmi4 | ||||
| 	pop     ax | ||||
| 	push    bx | ||||
| 	push    dx | ||||
| 	jmp     ax | ||||
| 9: | ||||
| 	mov     ax,EODDZ | ||||
| 	push    ax | ||||
| 	jmp     .trp | ||||
							
								
								
									
										83
									
								
								mach/i86/libem/rmi4.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								mach/i86/libem/rmi4.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,83 @@ | |||
| .define .rmi4 | ||||
| 
 | ||||
| yl=2 | ||||
| yh=4 | ||||
| xl=6 | ||||
| xh=8 | ||||
| 
 | ||||
| .rmi4: | ||||
|         ! $Header$ | ||||
| 	mov     si,sp           ! copy of sp | ||||
| 	mov     bx,yl(si) | ||||
| 	mov     ax,yh(si) | ||||
| 	cwd | ||||
| 	cmp     dx,ax | ||||
| 	jne     7f | ||||
| 	and     dx,dx | ||||
| 	jge     1f | ||||
| 	neg     bx | ||||
| 	je      7f | ||||
| 1: | ||||
| 	xor     dx,dx | ||||
| 	mov     cx,xl(si) | ||||
| 	mov     ax,xh(si) | ||||
| 	and     ax,ax | ||||
| 	jge     2f | ||||
| 	neg     ax | ||||
| 	neg     cx | ||||
| 	sbb     ax,dx | ||||
| 2: | ||||
| 	div     bx | ||||
| 	xchg    ax,cx | ||||
| 	div     bx              ! dx= result(low), 0=result(high) | ||||
| 	xor     bx,bx | ||||
| 9: | ||||
| 	cmp     xh(si),0 | ||||
| 	jge     1f | ||||
| 	neg     bx | ||||
| 	neg     dx | ||||
| 	sbb     bx,0 | ||||
| 1: | ||||
| 			! bx is high order result | ||||
| 			! dx is low order result | ||||
| 	ret     8 | ||||
| 
 | ||||
| 7: | ||||
| 	mov     di,ax | ||||
| 	xor     bx,bx | ||||
| 	and     di,di | ||||
| 	jge     1f | ||||
| 	neg     di | ||||
| 	neg     yl(si) | ||||
| 	sbb     di,bx | ||||
| 1: | ||||
| 	mov     ax,xl(si) | ||||
| 	mov     dx,xh(si) | ||||
| 	and     dx,dx | ||||
| 	jge     1f | ||||
| 	neg     dx | ||||
| 	neg     ax | ||||
| 	sbb     dx,bx | ||||
| 1: | ||||
| 	mov     cx,16 | ||||
| 1: | ||||
| 	shl     ax,1 | ||||
| 	rcl     dx,1 | ||||
| 	rcl     bx,1 | ||||
| 	cmp     di,bx | ||||
| 	ja      3f | ||||
| 	jb      2f | ||||
| 	cmp     yl(si),dx | ||||
| 	jbe     2f | ||||
| 3: | ||||
| 	loop    1b | ||||
| 		! dx=result(low), bx=result(high) | ||||
| 	jmp     9b | ||||
| 2: | ||||
| 	sub     dx,yl(si) | ||||
| 	sbb     bx,di | ||||
| 	inc     ax | ||||
| 	loop    1b | ||||
| 1: | ||||
| 		! dx=result(low), bx=result(high) | ||||
| 	jmp     9b | ||||
							
								
								
									
										35
									
								
								mach/i86/libem/rmu.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								mach/i86/libem/rmu.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,35 @@ | |||
| .define .rmu | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! #bytes in ax | ||||
| .rmu: | ||||
| 	pop     bx              ! return address | ||||
| 	cmp     ax,2 | ||||
| 	jne     1f | ||||
| 	pop     ax | ||||
| 	xor     dx,dx | ||||
| 	pop     cx | ||||
| 	idiv    cx | ||||
| 	push    dx | ||||
| 	jmp     bx | ||||
| 1: | ||||
| 	cmp     ax,4 | ||||
| 	jne     9f | ||||
| 	pop     ax | ||||
| 	pop     dx | ||||
| 	pop     si | ||||
| 	pop     di | ||||
| 	push    bx | ||||
| 	push    di | ||||
| 	push    si | ||||
| 	push    dx | ||||
| 	push    ax | ||||
| 	call   .rmu4 | ||||
| 	pop     ax | ||||
| 	push    bx | ||||
| 	push    dx | ||||
| 	jmp     ax | ||||
| 9: | ||||
| 	mov     ax,EODDZ | ||||
| 	push    ax | ||||
| 	jmp     .trp | ||||
							
								
								
									
										55
									
								
								mach/i86/libem/rmu4.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								mach/i86/libem/rmu4.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,55 @@ | |||
| .define .rmu4 | ||||
| 
 | ||||
| yl=2 | ||||
| yh=4 | ||||
| xl=6 | ||||
| xh=8 | ||||
| 
 | ||||
| .rmu4: | ||||
|         ! $Header$ | ||||
| 	mov     si,sp           ! copy of sp | ||||
| 	mov     bx,yl(si) | ||||
| 	mov     ax,yh(si) | ||||
| 	or      ax,ax | ||||
| 	jne     7f | ||||
| 1: | ||||
| 	xor     dx,dx | ||||
| 	mov     cx,xl(si) | ||||
| 	mov     ax,xh(si) | ||||
| 2: | ||||
| 	div     bx | ||||
| 	xchg    ax,cx | ||||
| 	div     bx | ||||
| 	xor     bx,bx | ||||
| 9: | ||||
| 			! bx is high order result | ||||
| 			! dx is low order result | ||||
| 	ret     8 | ||||
| 
 | ||||
| 7: | ||||
| 	mov     di,ax | ||||
| 	xor     bx,bx | ||||
| 	mov     ax,xl(si) | ||||
| 	mov     dx,xh(si) | ||||
| 	mov     cx,16 | ||||
| 1: | ||||
| 	shl     ax,1 | ||||
| 	rcl     dx,1 | ||||
| 	rcl     bx,1 | ||||
| 	cmp     di,bx | ||||
| 	ja      3f | ||||
| 	jb      2f | ||||
| 	cmp     yl(si),dx | ||||
| 	jbe     2f | ||||
| 3: | ||||
| 	loop    1b | ||||
| 		! dx=result(low), bx=result(high) | ||||
| 	jmp     9b | ||||
| 2: | ||||
| 	sub     dx,yl(si) | ||||
| 	sbb     bx,di | ||||
| 	inc     ax | ||||
| 	loop    1b | ||||
| 1: | ||||
| 		! dx=result(low), bx=result(high) | ||||
| 	jmp     9b | ||||
							
								
								
									
										33
									
								
								mach/i86/libem/rol.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								mach/i86/libem/rol.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,33 @@ | |||
| .define .rol | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! #bytes in ax | ||||
| .rol: | ||||
| 	pop     dx              ! return address | ||||
| 	cmp     ax,2 | ||||
| 	jne     1f | ||||
| 	pop     ax | ||||
| 	pop     cx | ||||
| 	rol     ax,cl | ||||
| 	push    ax | ||||
| 	jmp     dx | ||||
| 1: | ||||
| 	cmp     ax,4 | ||||
| 	jne     9f | ||||
| 	pop     cx | ||||
| 	jcxz    2f | ||||
| 	pop     ax | ||||
| 	pop     bx | ||||
| 3: | ||||
| 	sal     ax,1 | ||||
| 	rcl     bx,1 | ||||
| 	adc     ax,0 | ||||
| 	loop    3b | ||||
| 	push    bx | ||||
| 	push    ax | ||||
| 2: | ||||
| 	jmp     dx | ||||
| 9: | ||||
| 	mov     ax,EODDZ | ||||
| 	push    ax | ||||
| 	jmp     .trp | ||||
							
								
								
									
										34
									
								
								mach/i86/libem/ror.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								mach/i86/libem/ror.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,34 @@ | |||
| .define .ror | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! #bytes in ax | ||||
| .ror: | ||||
| 	pop     dx              ! return address | ||||
| 	cmp     ax,2 | ||||
| 	jne     1f | ||||
| 	pop     ax | ||||
| 	pop     cx | ||||
| 	ror     ax,cl | ||||
| 	push    ax | ||||
| 	jmp     dx | ||||
| 1: | ||||
| 	cmp     ax,4 | ||||
| 	jne     9f | ||||
| 	pop     cx | ||||
| 	jcxz    2f | ||||
| 	neg     cx | ||||
| 	add     cx,32 | ||||
| 	pop     ax | ||||
| 	pop     bx | ||||
| 3: | ||||
| 	sar     bx,1 | ||||
| 	rcr     ax,1 | ||||
| 	loop    3b | ||||
| 	push    bx | ||||
| 	push    ax | ||||
| 2: | ||||
| 	jmp     dx | ||||
| 9: | ||||
| 	mov     ax,EODDZ | ||||
| 	push    ax | ||||
| 	jmp     .trp | ||||
							
								
								
									
										22
									
								
								mach/i86/libem/sar2.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								mach/i86/libem/sar2.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| .define .sar2 | ||||
| 
 | ||||
| .sar2: | ||||
|         ! $Header$ | ||||
| 	pop     bx              ! return address | ||||
| 				! si, descriptor address | ||||
| 				! ax, index | ||||
| 				! di, base address | ||||
| 	sub     ax,(si) | ||||
| 	mov     cx,4(si) | ||||
| 	imul    cx | ||||
| 	add     di,ax | ||||
| 	sar     cx,1 | ||||
| 	jnb     1f | ||||
| 	pop     ax | ||||
| 	stosb | ||||
| 	jmp     bx | ||||
| 1: | ||||
| 	mov     si,sp | ||||
| 	rep movs | ||||
| 	mov     sp,si | ||||
| 	jmp     bx | ||||
							
								
								
									
										27
									
								
								mach/i86/libem/sbi.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								mach/i86/libem/sbi.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,27 @@ | |||
| .define .sbi | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! #bytes in cx , top of stack in ax | ||||
| .sbi: | ||||
| 	pop     bx              ! return subress | ||||
| 	cmp     cx,2 | ||||
| 	jne     1f | ||||
| 	pop     cx | ||||
| 	sub     ax,cx | ||||
| 	neg     ax | ||||
| 	jmp     bx | ||||
| 1: | ||||
| 	cmp     cx,4 | ||||
| 	jne     9f | ||||
| 	pop     dx | ||||
| 	pop     cx | ||||
| 	sub     cx,ax | ||||
| 	mov     ax,cx | ||||
| 	pop     cx | ||||
| 	sbc     cx,dx | ||||
| 	push    cx | ||||
| 	jmp     bx | ||||
| 9: | ||||
| 	mov     ax,EODDZ | ||||
| 	push    ax | ||||
| 	jmp     .trp | ||||
							
								
								
									
										35
									
								
								mach/i86/libem/set.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								mach/i86/libem/set.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,35 @@ | |||
| .define .set | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! #bytes in cx | ||||
| 	! bit # in ax | ||||
| .set: | ||||
| 	pop     bx              ! return address | ||||
| 	xor     dx,dx | ||||
| !ifdef create set | ||||
| 	mov     di,sp | ||||
| 	sub     di,cx | ||||
| 1: | ||||
| 	push    dx | ||||
| 	cmp     sp,di | ||||
| 	ja      1b | ||||
| !endif | ||||
| 	mov     di,8 | ||||
| 	div     di | ||||
| 	cmp     ax,cx | ||||
| 	jae     2f | ||||
| 	mov     di,sp | ||||
| 	add     di,ax | ||||
| 	mov     si,dx | ||||
| 	movb    dl,bits(si) | ||||
| 	orb     (di),dl | ||||
| 	jmp     bx | ||||
| 2: | ||||
| 	push    bx | ||||
| 	mov     ax,ESET | ||||
| 	push    ax | ||||
| 	jmp     .trp | ||||
| 
 | ||||
| 	.data | ||||
| bits: | ||||
| 	.byte   1,2,4,8,16,32,64,128 | ||||
							
								
								
									
										32
									
								
								mach/i86/libem/sli.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								mach/i86/libem/sli.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,32 @@ | |||
| .define .sli | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! #bytes in ax | ||||
| .sli: | ||||
| 	pop     dx              ! return address | ||||
| 	cmp     ax,2 | ||||
| 	jne     1f | ||||
| 	pop     ax | ||||
| 	pop     cx | ||||
| 	sal     ax,cl | ||||
| 	push    ax | ||||
| 	jmp     dx | ||||
| 1: | ||||
| 	cmp     ax,4 | ||||
| 	jne     9f | ||||
| 	pop     cx | ||||
| 	jcxz    2f | ||||
| 	pop     ax | ||||
| 	pop     bx | ||||
| 3: | ||||
| 	sal     ax,1 | ||||
| 	rcl     bx,1 | ||||
| 	loop    3b | ||||
| 	push    bx | ||||
| 	push    ax | ||||
| 2: | ||||
| 	jmp     dx | ||||
| 9: | ||||
| 	mov     ax,EODDZ | ||||
| 	push    ax | ||||
| 	jmp     .trp | ||||
							
								
								
									
										32
									
								
								mach/i86/libem/sri.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								mach/i86/libem/sri.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,32 @@ | |||
| .define .sri | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! #bytes in ax | ||||
| .sri: | ||||
| 	pop     dx              ! return address | ||||
| 	cmp     ax,2 | ||||
| 	jne     1f | ||||
| 	pop     ax | ||||
| 	pop     cx | ||||
| 	sar     ax,cl | ||||
| 	push    ax | ||||
| 	jmp     dx | ||||
| 1: | ||||
| 	cmp     ax,4 | ||||
| 	jne     9f | ||||
| 	pop     cx | ||||
| 	jcxz    2f | ||||
| 	pop     ax | ||||
| 	pop     bx | ||||
| 3: | ||||
| 	sar     bx,1 | ||||
| 	rcr     ax,1 | ||||
| 	loop    3b | ||||
| 	push    bx | ||||
| 	push    ax | ||||
| 2: | ||||
| 	jmp     dx | ||||
| 9: | ||||
| 	mov     ax,EODDZ | ||||
| 	push    ax | ||||
| 	jmp     .trp | ||||
							
								
								
									
										17
									
								
								mach/i86/libem/sti.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								mach/i86/libem/sti.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,17 @@ | |||
| .define .sti | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! #bytes in cx | ||||
| 	! destination address in di | ||||
| .sti: | ||||
| 	pop     bx              ! return address | ||||
| 	sar     cx,1 | ||||
| 	jnb     1f | ||||
| 	pop     ax | ||||
| 	stosb | ||||
| 	jmp     bx | ||||
| 1: | ||||
| 	mov     si,sp | ||||
| 	rep movs | ||||
| 	mov     sp,si | ||||
| 	jmp     bx | ||||
							
								
								
									
										4
									
								
								mach/i86/libem/stop.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								mach/i86/libem/stop.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,4 @@ | |||
| .define .stop | ||||
| .stop: | ||||
|         ! $Header$ | ||||
| 	int     3 | ||||
							
								
								
									
										19
									
								
								mach/i86/libem/strhp.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								mach/i86/libem/strhp.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,19 @@ | |||
| .define	.strhp | ||||
| 
 | ||||
| .strhp: | ||||
|         ! $Header$ | ||||
| 	pop	bx | ||||
| 	pop	ax | ||||
| 	mov	(.reghp),ax | ||||
| 	cmp	ax,(.limhp) | ||||
| 	jb	1f | ||||
| 	add	ax,02000 | ||||
| 	and	ax,~0777 | ||||
| 	mov	(.limhp),ax | ||||
| 	cmp	ax,sp | ||||
| 	jae	2f | ||||
| 1: | ||||
| 	jmp	bx | ||||
| 2: | ||||
| 	mov	ax,EHEAP | ||||
| 	jmp	.fat | ||||
							
								
								
									
										16
									
								
								mach/i86/libem/tail.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								mach/i86/libem/tail.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,16 @@ | |||
| .define	endtext,enddata,endbss | ||||
| .define _end,_etext,_edata | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	.text | ||||
| endtext: | ||||
| _etext: | ||||
| 	.align 2
 | ||||
| 	.data | ||||
| enddata: | ||||
| _edata: | ||||
| 	.align 2
 | ||||
| 	.bss | ||||
| _end: | ||||
| endbss: | ||||
| 	.align 2
 | ||||
							
								
								
									
										15
									
								
								mach/i86/libem/trp.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								mach/i86/libem/trp.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,15 @@ | |||
| .define .trp | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 		! ax is trap number | ||||
| .trp: | ||||
| 	xor     bx,bx | ||||
| 	xchg    bx,(.trppc) | ||||
| 	test    bx,bx | ||||
| 	jz      2f | ||||
| 	push    ax | ||||
| 	call    bx | ||||
| 	pop     ax | ||||
| 	ret | ||||
| 2: | ||||
| 	call    .stop | ||||
							
								
								
									
										7
									
								
								mach/i86/libem/unknown.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								mach/i86/libem/unknown.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,7 @@ | |||
| .define .unknown | ||||
| 
 | ||||
| .unknown: | ||||
|         ! $Header$ | ||||
| 	mov  ax,EILLINS | ||||
| 	push ax | ||||
| 	jmp  .fat | ||||
							
								
								
									
										15
									
								
								mach/i86/libem/xor.s
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								mach/i86/libem/xor.s
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,15 @@ | |||
| .define	.xor | ||||
| 
 | ||||
|         ! $Header$ | ||||
| 	! #bytes in cx | ||||
| .xor: | ||||
| 	pop	bx		! return address | ||||
| 	mov	di,sp | ||||
| 	add	di,cx | ||||
| 	sar	cx,1 | ||||
| 1: | ||||
| 	pop	ax | ||||
| 	xor	ax,(di) | ||||
| 	stos | ||||
| 	loop	1b | ||||
| 	jmp	bx | ||||
		Loading…
	
	Add table
		
		Reference in a new issue