1*45760Sbostic /*-
2*45760Sbostic * Copyright (c) 1986 The Regents of the University of California.
3*45760Sbostic * All rights reserved.
4*45760Sbostic *
5*45760Sbostic * This code is derived from software contributed to Berkeley by
6*45760Sbostic * Computer Consoles Inc.
7*45760Sbostic *
8*45760Sbostic * %sccs.include.redist.c%
9*45760Sbostic *
10*45760Sbostic * @(#)Awrite_byte.c 7.1 (Berkeley) 12/06/90
11*45760Sbostic */
1229642Ssam
1345699Sbostic #include "align.h"
1429642Ssam
write_byte(infop,byte,where)1529642Ssam write_byte (infop,byte, where)
1629642Ssam process_info *infop;
1729642Ssam long byte;
1829642Ssam struct oprnd *where;
1929642Ssam /*
2029642Ssam /* Put the 'byte' at the given address in
2129642Ssam /* tahoe's memory.
2229642Ssam /*
2329642Ssam /* 1. Only the least significant byte is written.
2429642Ssam /*
2529642Ssam /**************************************************/
2629642Ssam {
2729642Ssam register struct operand_des *look_at;
2829642Ssam
2929642Ssam look_at = &Table[opCODE].operand[last_operand];
3029642Ssam if (! (look_at->add_modes & NOVF))
3129642Ssam if (byte > 0x7f || byte < -0x80) overflow_1;
3229642Ssam if (!(where->mode & W)) exception(infop, ILL_ADDRMOD);
3329642Ssam switch (where->mode & ADDFIELD) /* Mask out R/W bits */
3429642Ssam {
3529642Ssam case Add:
3629642Ssam put_byte(infop, byte, where->address);
3729642Ssam break;
3829642Ssam case Dir:
3929642Ssam Replace (infop, where->reg_number, byte);
4029642Ssam break;
4129642Ssam case SPmode:
4229642Ssam where->mode = where->mode & ~SPmode | Add;
4329642Ssam write_longword (infop, byte, where);
4429642Ssam break;
4529642Ssam default:
4629642Ssam printf("Unknown destination in write_byte (alignment code)\n");
4729642Ssam };
4829642Ssam }
49