xref: /csrg-svn/sys/tahoe/align/Awrite_byte.c (revision 45699)
1*45699Sbostic /*	Awrite_byte.c	1.2	90/12/04	*/
229642Ssam 
3*45699Sbostic #include	"align.h"
429642Ssam 
529642Ssam write_byte (infop,byte, where)
629642Ssam process_info	*infop;
729642Ssam long		byte;
829642Ssam struct oprnd 	*where;
929642Ssam /*
1029642Ssam /*	Put the 'byte' at the given address in
1129642Ssam /*	tahoe's memory.
1229642Ssam /*
1329642Ssam /*	1. Only the least significant byte is written.
1429642Ssam /*
1529642Ssam /**************************************************/
1629642Ssam {
1729642Ssam 	register struct operand_des *look_at;
1829642Ssam 
1929642Ssam 	look_at = &Table[opCODE].operand[last_operand];
2029642Ssam 	if (! (look_at->add_modes & NOVF))
2129642Ssam 		if (byte > 0x7f || byte < -0x80) overflow_1;
2229642Ssam 	if (!(where->mode & W)) exception(infop, ILL_ADDRMOD);
2329642Ssam 	switch (where->mode & ADDFIELD)	/* Mask out R/W bits */
2429642Ssam 	{
2529642Ssam 	case Add:
2629642Ssam 		put_byte(infop, byte, where->address);
2729642Ssam 		break;
2829642Ssam 	case Dir:
2929642Ssam 		Replace (infop, where->reg_number, byte);
3029642Ssam 		break;
3129642Ssam 	case SPmode:
3229642Ssam 		where->mode = where->mode & ~SPmode | Add;
3329642Ssam 		write_longword (infop, byte, where);
3429642Ssam 		break;
3529642Ssam 	default:
3629642Ssam 		printf("Unknown destination in write_byte (alignment code)\n");
3729642Ssam 	};
3829642Ssam }
39