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.

bmachine
function bmachine
%BMACHINE starts the emulator and assembler GUI
%   BMACHINE starts a graphical user interface to an emulator for the
%   machine described in "Computer Science: An Overview", 10th edition,  by
%   J. Glenn Brookshear (Pearson Education, 2008). The machine is extended
%   with some additional instructions and is equipped with a bitmapped
%   display.
%
%   The emulator is intended as a teaching aid for introductory computer
%   science courses. It may be programmed by entering machine code directly
%   into memory, by writing a file of machine code instructions, or by
%   writing a program in a simple assembly language.
%
%   Details of the machine architecture, instruction set and assembly
%   language are given in the HTML files which can be accessed from the
%   interface. Example programs are available in the examples directory.
%
%   When used for teaching, it may be convenient to start the emulator using
%   a script or shortcut which invokes Matlab with command such as:
%
%       <Matlab path>/matlab.exe /nosplash /nodesktop /minimize /r bmachine
%
%   If the /nodesktop option is in effect, closing the emulator window
%   will exit Matlab.
%
%   This function sets the font size for the emulator to 12 if the screen
%   is reasonably large, to improve accessibility as well as general
%   legibility. 

%   Copyright 2008 University of Sussex and David Young

% Set font size depending on screen size.
p = get(0, 'Screensize');
if p(3) <= 1500 || p(4) <= 920
    fsize = 8;
else
    fsize = 12;
end
set(0, 'DefaultUicontrolFontSize', fsize);
set(0, 'DefaultUipanelFontSize', fsize);

% extend path to <this directory>/bmachine
addpath(fullfile(fileparts(mfilename('fullpath')), 'bmcode'));

% start emulator
bm

end

Contact us at files@mathworks.com