code: drawterm

ref: c9f4e6f1cfa96e6a12b23801e16f8e0fe36a266d
dir: /posix-mips/tas.s/

View raw version
#include <machine/regdef.h>

.globl tas
.ent tas 2

tas:
.set noreorder
1:
	ori	t1, zero, 12345	/* t1 = 12345 */
	ll	t0, (a0)		/* t0 = *a0 */
	sc	t1, (a0)		/* *a0 = t1 if *a0 hasn't changed; t1=success */
	beq	t1, zero, 1b		/* repeat if *a0 did change */
	nop

	j $31				/* return */
	or	v0, t0, zero		/* set return value on way out */

.set reorder
.end tas