File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / d / entry / suba.s
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Sun Jul 28 12:24:19 2019 UTC (6 years, 11 months ago) by root
Branches: bsd, MAIN
CVS tags: v12b, v121, HEAD
Power 6/32 Unix version 1.2b



/*		SUBA (subtract address) test				*/
/*									*/
/*Test name = suba							*/
/*Description =								*/
/*	This test checks 'suba' instruction as follows:		*/
/*sub		dif		result		N Z V C (flags)		*/
/*___		___		______		_______________		*/
/*0x7f		0x7f		0x00		0 1 0 1			*/
/*0xff		0x01		0x02		0 0 0 0			*/
/*0x01		0xff		0xfe		1 0 0 1			*/
/*0x81		0x7f		0xfe		1 0 1 0			*/
/*0x81		0x80		0xff		1 0 0 0			*/
/*0x7f		0x81		0x02		0 0 1 1			*/
/*									*/
/*									*/

/*									*/
/*									*/
/*	constants definition for 'subx' tests.				*/
/*									*/

	.set	SB1,0x11111f7f/*+127, highest +ve number, byte	*/
	.set	SW1,0x111f7fff
	.set	SL1,0x7fffffff
	.set	MB1,0x11111f7f/* +127 */
	.set	MW1,0x111f7fff
	.set	ML1,SL1
	.set	RB1,0x11111f00
	.set	RW1,0x111f0000
	.set	RL1,0x00000000
	.set	SB2,0xff	/* -1 */
	.set	SW2,0xffff
	.set	SL2,0xffffffff
	.set	MB2,0x01	/* +1 */
	.set	MW2,0x0001
	.set	ML2,0X00000001
	.set	RB2,0x00000002	/* +2 */
	.set	RW2,RB2
	.set	RL2,RB2
	.set	SB3,MB2		/* +1 */
	.set	SW3,MW2
	.set	SL3,ML2
	.set	MB3,0xff		/* -1 */
	.set	MW3,0xffff
	.set	ML3,0xffffffff
	.set	RB3,0x000000fe	/* -2 */
	.set	RW3,0x0000fffe
	.set	RL3,0Xfffffffe
	.set	SB4,0x81	/* -127 */
	.set	SW4,0x8001
	.set	SL4,0x80000001
	.set	MB4,0x7f	/* 127 */
	.set	MW4,0x7fff
	.set	ML4,0x7fffffff
	.set	RB4,0xfe		/* -2 */
	.set	RW4,0xfffe
	.set	RL4,0xfffffffe
	.set	SB5,SB4	/* -127 */
	.set	SW5,SW4
	.set	SL5,SL4
	.set	MB5,0x80	/* -128 */
	.set	MW5,0x8000
	.set	ML5,0x80000000
	.set	RB5,0xff		/* -1 */
	.set	RW5,0xffff
	.set	RL5,0xffffffff
	.set	SB6,0x7f/* +127 */
	.set	SW6,0x7fff
	.set	SL6,0x7fffffff
	.set	MB6,SB4		/* -127 */
	.set	MW6,SW4
	.set	ML6,SL4
	.set	RB6,0x02
	.set	RW6,0x02
	.set	RL6,0x02

	.set	INITB,0x11111f55/* initialization values for 3 operand */
	.set	INITW,0x111f5555
	.set	INITL,0X55555555
	
/*									*/
/*	Syst.s - Constants						*/
/*									*/
	.set	IPL,8
	.set	HIGH,31
	.set	ZERO,0
	.set	ONES,0xffffffff
	.set	N,8
	.set	Z,4
	.set	V,2
	.set	C,1
	.set	T,16
	.set	IV,32
	.set	FU,64
	.set	DV,128
	.set	PSWMASK,0x003f


	.globl	_sub_a
_sub_a:
sl1:
	callf	$4,_setjmp	/* save context for error return */
	movab	sl1,_stpc	/* save address of subtest start */
	movl	$1,_subtst	/* subtest number */
	movl	$2,_no_opr	/* number of operands in use */
	movl	$SL1,_opr	/* first operand */
	movl	$ML1,_opr + 4	/* second operand */
0:	
	movl	$SL1,sub	/*first operand				*/
	movl	$ML1,dif	/*second operand			*/
	bicpsw	$PSWMASK	/*PSW = 0				*/
	bispsw	$(N|V|C)	/* these flags ON			*/
	suba	sub,dif		/* try 'sub' instruction mem to mem	*/
	jgtr	e1		/*error if N = 0			*/
	jeql	e1		/*error if Z = 1			*/
	jvc	e1		/*error if V = 0			*/
	jcc	e1		/*error if C = 0			*/
	jmp	1f
e1:	movpsl	_actual		/* actual = psl maybe incorrect */
	bbs	$0,_scoplp,0b	/* if set scope loop on error */
	movl	$2,_ercode	/* error code flag failure */
	jmp	*badrtn
1:	bicpsw	$Z
	cmpl	$RL1,dif	/*dif = expected ?			*/
	jeql	sl2		/* if no error continue */
	bbs	$0,_scoplp,0b	/* if set scope loop on error */
	movl	$1,_ercode	/* error code data miscompare */
	movl	dif,_actual	/* actual data */
	movl	$RL1,_expected	/* expected data */
	jmp	*badrtn

sl2:
	bbs	$0,_force_lp,0b	/* if set loop on error */
as2:	callf	$4,_setjmp	/* save context for error return */
	movab	as2,_stpc	/* save address of subtest start */
	movl	$2,_subtst	/* subtest number */
	movl	$2,_no_opr	/* number of operands in use */
	movl	$SL2,_opr	/* first operand */
	movl	$ML2,_opr + 4	/* second operand */
0:	movl	$SL2,r5		/*first operand				*/
	movl	$ML2,dif	/*second operand			*/
	bicpsw	$PSWMASK	/*PSW = 0				*/
	bispsw	$(N|Z|V)	/* these flags ON			*/
	suba	r5,dif		/* try 'sub' instruction reg to mem	*/
	jgtr	e2		/*error if N = 0			*/
	jneq	e2		/*error if Z = 0			*/
	jvc	e2		/*error if V = 0			*/
	jcs	e2		/*error if C = 1			*/
	jmp	1f
e2:	movpsl	_actual		/* actual = psl maybe incorrect */
	bbs	$0,_scoplp,0b	/* if set scope loop on error */
	movl	$2,_ercode	/* error code flag failure */
	jmp	*badrtn
1:	bicpsw	$Z
	cmpl	$RL2,dif	/*dif = expected ?			*/
	jeql	sl3		/* if no error continue */
	bbs	$0,_scoplp,0b	/* if set scope loop on error */
	movl	$1,_ercode	/* error code data miscompare */
	movl	dif,_actual	/* actual data */
	movl	$RL2,_expected	/* expected data */
	jmp	*badrtn



sl3:
	bbs	$0,_force_lp,0b	/* if set loop on error */
as3:	callf	$4,_setjmp	/* save context for error return */
	movab	as3,_stpc	/* save address of subtest start */
	movl	$3,_subtst	/* subtest number */
	movl	$2,_no_opr	/* number of operands in use */
	movl	$SL3,_opr	/* first operand */
	movl	$ML3,_opr + 4	/* second operand */
0:	movl	$ML3,r5		/*second operand			*/
	bicpsw	$PSWMASK	/*PSW = 0				*/
	bispsw	$(V|Z|C)	/* these flags ON			*/
	suba	$SL3,r5		/* try 'sub' instruction data to reg	*/
	jlss	e3		/*error if N = 1			*/
	jneq	e3		/*error if Z = 0			*/
	jvc	e3		/*error if V = 0			*/
	jcc	e3		/*error if C = 0			*/
	jmp	1f
e3:	movpsl	_actual		/* actual = psl maybe incorrect */
	bbs	$0,_scoplp,0b	/* if set scope loop on error */
	movl	$2,_ercode	/* error code flag failure */
	jmp	*badrtn
1:	bicpsw	$Z
	cmpl	$RL3,r5		/*dif = expected ?			*/
	jeql	sl4		/* if no error continue */
	bbs	$0,_scoplp,0b	/* if set scope loop on error */
	movl	$1,_ercode	/* error code data miscompare */
	movl	r5,_actual	/* actual data */
	movl	$RL3,_expected	/* expected data */
	jmp	*badrtn
	
sl4:
	bbs	$0,_force_lp,0b	/* if set loop on error */
as4:	callf	$4,_setjmp	/* save context for error return */
	movab	as4,_stpc	/* save address of subtest start */
	movl	$4,_subtst	/* subtest number */
	movl	$2,_no_opr	/* number of operands in use */
	movl	$SL4,_opr	/* first operand */
	movl	$ML4,_opr + 4	/* second operand */
0:	movl	$SL4,r6		/*first operand				*/
	movl	$ML4,r5		/*second operand			*/
	bicpsw	$PSWMASK	/*PSW = 0				*/
	bispsw	$Z		/* these flags ON			*/
	suba	r6,r5		/* try 'sub' instruction reg to reg	*/
	jlss	e4		/*error if N = 1			*/
	jneq	e4		/*error if Z = 0			*/
	jvs	e4		/*error if V = 1			*/
	jcs	e4		/*error if C = 1			*/
	jmp	1f
e4:	movpsl	_actual		/* actual = psl maybe incorrect */
	bbs	$0,_scoplp,0b	/* if set scope loop on error */
	movl	$2,_ercode	/* error code flag failure */
	jmp	*badrtn
1:	bicpsw	$Z
	cmpl	$RL4,r5		/*dif = expected ?			*/
	jeql	sl5		/* if no error continue */
	bbs	$0,_scoplp,0b	/* if set scope loop on error */
	movl	$1,_ercode	/* error code data miscompare */
	movl	r5,_actual	/* actual data */
	movl	$RL4,_expected	/* expected data */
	jmp	*badrtn


sl5:
	bbs	$0,_force_lp,0b	/* if set loop on error */
as5:	callf	$4,_setjmp	/* save context for error return */
	movab	as5,_stpc	/* save address of subtest start */
	movl	$5,_subtst	/* subtest number */
	movl	$2,_no_opr	/* number of operands in use */
	movl	$SL5,_opr	/* first operand */
	movl	$ML5,_opr + 4	/* second operand */
0:	movl	$ML5,dif
	bicpsw	$PSWMASK	/*PSW = 0				*/
	bispsw	$(V|Z)		/* these flags ON			*/
	suba	$SL5,dif	/* try 'sub' instruction data to mem	*/
	jlss	e5		/*error if N = 1			*/
	jneq	e5		/*error if Z = 0			*/
	jvc	e5		/*error if V = 0			*/
	jcs	e5		/*error if C = 1			*/
	jmp	1f
e5:	movpsl	_actual		/* actual = psl maybe incorrect */
	bbs	$0,_scoplp,0b	/* if set scope loop on error */
	movl	$2,_ercode	/* error code flag failure */
	jmp	*badrtn
1:	bicpsw	$Z
	cmpl	$RL5,dif	/*dif = expected ?			*/
	jeql	sl6		/* if no error continue */
	bbs	$0,_scoplp,0b	/* if set scope loop on error */
	movl	$1,_ercode	/* error code data miscompare */
	movl	r5,_actual	/* actual data */
	movl	$RL5,_expected	/* expected data */
	jmp	*badrtn



sl6:
	bbs	$0,_force_lp,0b	/* if set loop on error */
as6:	callf	$4,_setjmp	/* save context for error return */
	movab	as6,_stpc	/* save address of subtest start */
	movl	$5,_subtst	/* subtest number */
	movl	$2,_no_opr	/* number of operands in use */
	movl	$SL6,_opr	/* first operand */
	movl	$ML6,_opr + 4	/* second operand */
0:	movl	$SL6,sub	/*first operand				*/
	movl	$ML6,dif	/*second operand			*/
	bicpsw	$PSWMASK	/*PSW = 0				*/
	bispsw	$(Z|C|N)	/* these flags ON			*/
	suba	sub,dif	/* try 'sub' instruction		*/
	jgtr	e6		/*error if N = 0			*/
	jneq	e6		/*error if Z = 0			*/
	jvs	e6		/*error if V = 1			*/
	jcc	e6		/*error if C = 0			*/
	jmp	1f
e6:	movpsl	_actual		/* actual = psl maybe incorrect */
	bbs	$0,_scoplp,0b	/* if set scope loop on error */
	movl	$2,_ercode	/* error code flag failure */
	jmp	*badrtn
1:	bicpsw	$Z
	cmpl	$RL6,dif	/*dif = expected ?			*/
	jeql	aldn		/* if no error continue */
	bbs	$0,_scoplp,0b	/* if set scope loop on error */
	movl	$1,_ercode	/* error code data miscompare */
	movl	r5,_actual	/* actual data */
	movl	$RL5,_expected	/* expected data */
	jmp	*badrtn



aldn:	bbs	$0,_force_lp,0b	/* if set loop on error */
	jmp	*return


/*									*/
/*	Variables							*/
/*									*/
	.align	2
min:	.space	4
dif:	.space	4
sub:	.space	4

/*	End of file							*/



unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.