aboutsummaryrefslogtreecommitdiff
path: root/unix/portkit/ishift.s.68000
blob: cfd6d7e9e4188ac658eced4c1e499b89ebd660c7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|# IAND, IOR, ISHIFT -- Bitwise boolean integer functions for the NCAR
|# package.  The shift function must rotate the bits left and around
|# if the nbits to shift argument is positive, and zero fill at the left
|# if the shift is negative (right shift).
|#
|# (SUN/UNIX MC68xxx version)

|# AND -- Bitwise boolean AND: C = AND (A, B)
	.text
	.globl	_iand_
_iand_:
	movl	sp@(4),a0
	movl	a0@,d0
	movl	sp@(8),a0
	andl	a0@,d0
	rts
	

|# OR -- Bitwise boolean OR: C = OR (A, B)
	.text
	.globl	_ior_
_ior_:
	movl	sp@(4),a0
	movl	a0@,d0
	movl	sp@(8),a0
	orl	a0@,d0
	rts


|# ISHIFT -- Bitwise shift:  C = ISHIFT (A, NBITS), +=left
	.text
	.globl	_ishift_
_ishift_:
	movl	sp@(4),a0
	movl	a0@,d0
	movl	sp@(8),a0
	movl	a0@,d1
	blt	L1
	roll	d1,d0		|# left rotate (high bits come in at right)
	rts
L1:
	negl	d1
	lsrl	d1,d0		|# logical shift right (zero at left)
	rts