Code covered by the BSD License  

Highlights from
Extended Brookshear Machine emulator and assembler

image thumbnail
from Extended Brookshear Machine emulator and assembler by David Young
Emulator and assembler for a simple computer, a teaching aid for computer science courses.

nibbles2byte(x, y)
function a = nibbles2byte(x, y)
%NIBBLES2BYTE converts two nibbles to a byte
%   A = NIBBLES2BYTE(X, Y) converts two nibbles X and Y to a memory address
%   or a byte of data. Assumes X and Y have all bits 0 except possibly the
%   bottom 4.

%   Copyright 2008 University of Sussex and David Young

a = bitor(bitshift(x, 4), y);

end

Contact us at files@mathworks.com