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.

showinstructions
function showinstructions
%SHOWINSTRUCTIONS displays a list of BM instructions
%   SHOWINSTRUCTIONS uses MSGBOX to display a quick-reference list of
%   instructions for the BM.
%
%   There does not seem to be a way to change the font - it would be better
%   larger, and fixed-width.
%
%   It might be nice to use INSTR2STRING to generate the message, for
%   consistency.

%   Copyright 2008 University of Sussex and David Young

msgbox({ ...
    'BM instructions' ...
    '' ...
    '0FFF   No operation' ...
    '1rxy   Load memory[xy] into Rr' ...
    '2rxy   Load value xy into Rr' ...
    '3rxy   Store Rr in memory[xy]' ...
    '40rs   Move Rr to Rs' ...
    '5rst   Add as ints Rs, Rt, put result in Rr' ...
    '6rst   Add as floats Rs, Rt, put result in Rr' ...
    '7rst   OR each bit of Rs, Rt, put result in Rr' ...
    '8rst   AND each bit of Rs, Rt, put result in Rr' ...
    '9rst   XOR each bit of Rs, Rt, put result in Rr' ...
    'Ar0x   Rotate  Rr x bits right' ...
    'Brxy   Jump to xy if Rr equals R0' ...
    'C000   Halt' ...
    'D0rs   Load memory[Rs] into Rr' ...
    'E0rs   Store Rr in memory[Rs]' ...
    'Frxt   Jump to address in Rt if Rr test R0' ...
    '        x=0 means test is equals' ...
    '        x=1 means test is not equal' ...
    '        x=2 means test is greater or equal' ...
    '        x=3 means test is less or equal' ...
    '        x=4 means test is greater than' ...
    '        x=5 means test is less than' ...
    '' ...
    'For full descriptions, click Help' ...
    }, ...
    'Instructions', ...
    'replace');
end

Contact us at files@mathworks.com