MACHINE CODE SIMULATION by ANTHONY GOODHEW Master's By

Total Page:16

File Type:pdf, Size:1020Kb

MACHINE CODE SIMULATION by ANTHONY GOODHEW Master's By MACHINE CODE SIMULATION by ANTHONY GOODHEW A Master's by Course Dissertation submitted in partial fulfilment of the requirements for the award of a degree of MSc in Computer Education of Loughborough University of Technology, January 1988. Supervisor: Dr H W F English Dept. Engineering Mathematics LUT (Cl Anthony Goodhew 1988 ABSTRACT The teaching of machine architecture and low level languages at all stages of computer studies education has presented certain difficulties since the subject first became examinable in schools. These include the lack of training of teaching staff, suitable low-level languages and specialist computing hardware. One approach is to make the students' normal computer simulate the actions of a simpler machine which can only be programmed with a low level language which has been specially designed to demonstrate the necessary features which are to be taught. The histories of several such simulations are analysed and the specification for a new simulation, for 'A' level Computer Science candidates, is developed and carried through the stages of programming, testing and educational trials. The new simulation allows the student to program in machine code or in an assembly language and demonstrates the connection between the two with an assembler. When the student's program is executed, at a speed controlled by the student, the simulation shows graphically the internal movements of data between registers in the Central Processing Unit while a commentary appears in the upper window to aid the understanding of the fetch-execute cycle. A series of student exercises are provided to gently lead the student through the various features of the simulation. These include arithmetic, control of loops, different addressing modes and subroutines. Acknowledgements I am pleased to acknowledge the assistance given in testing this program by Patrick Doel, Michael Ginns, Duncan Robson, Jane Horton, Mark Twells and Alan Howe. I am also very grateful for the advice provided by my supervisor Dr H English. Declaration I declare that this dissertation is entirely my own work. Contents Abstract Acknowledgements Declaration Chapter 1 Introduction 1 Chapter 2 Review of existing software 4 Chapter 3 ENGINE- a simple computer simulation 11 3.1 The history of ENGINE 11 3.2 The user interface 18 3.3 Using the simulation 18 3.4 Using ENGINE 24 Chapter 4 The development of SIMPLE 26 4.1 The development method 28 4.2 The user interface 31 4.3 Screen display 34 4.4 The storage of the user"s program 40 4.5 The assembler 42 4.6 Procedures and functions in SIMPLE 43 4.7 Procedures and functions in ASSEMBL 47 Chapter 5 Using SIMPLE and the results of testing 48 5.1 Testing the SIMPLE package 50 Chapter 6 Conclusions SS Bibliography 57 Appendices 60 1 Documentation for ENGINE 62 2 Teachers" notes for SIMPLE 74 3 Students' documentation for SIMPLE 93 4 Testers' report form 105 5 Listing of SIMPLE 109 6 Listing of ASSEMBL 133 7 Listing of MAKfi 17 142 8 Listing of MAKhe18 144 Chapter 1 - Introduction The teaching of processor architecture and low-level languages poses difficulties both at GCSE and 'A' level. These include a lack of training and experience of staff, the provision of suitable computing facilities and the choice of a suitable language. Few schools and colleges have sufficient funds to be able to buy special hardware for the teaching of this part of the syllabus so they have to make good use of the available hardware. In many cases this is either 380Z or 480Z computers from RML or BBC computers from Acorn. These contain either Z80 or 6502 processors. Learning to program these devices requires a thorough understanding of the facilities they offer and would take far longer than can usually be devoted to this section of the syllabus. Few teachers would feel capable of undertaking such teaching but if taught any learning would probably have been too specific to the device being used than was intended by the examination syllabus. An additional problem when using the processor of such a computer is that it is very easy to crash the whole system by a simple error in programming while learning the language. One approach to overcome these problems is to design a model computer incorporating the necessary features and leaving out others which are not needed at the level being taught. The main arguments in favour of this approach through a model are: 1) A model computer enables the topics of processor architecture, machine language and assembly language to be given an integrated treatment. 2) The design of all three topics can be pitched at the appropriate level for the capabilities of the students who are to use the simulated computer. PAGE 1 3) The simulated machine can be representative of a range of several actual computers rather than tightly tied to one in particular. 4) Additional educational facilities can be added to the model. 5) Avoidance of the difficulties and complications of real machine code programming by the use of idealised conditions. 6) Overcoming the extra cost of the purchase of additional specialised hardware. 7) The usually over-rapid execution of a machine code program can be controlled allowing insights into processes within the model. 8) Safety nets many be built into the simulation to prevent total system crashes and offer commentaries and diagnostic information as educational aids. 9) Control the level of complexity is possible. The level of difficulty can be incremented slowly. With care the possible disadvantages of simulations can be minimised. These disadvantages are:- 1) Over-simplification to an unacceptable level. 2) Provision of a false perception of reality. 3) The curtailment of real experience of the topic. T O'Shea ~ J Self (1983), P Bishop (1982) in his chapter in Microcomputers in Education, edited by C Smith (1982), S Dunn and V Morgan (1987) and A Keller (1987) all provide more detail on the educational uses of simulations. PAGE 2 The chapters which follow outline several attempts at providing such simulations. Some were devised for younger students in the 14 to 16 age range and are further from reality than those intended for older students, aged 16 to 19, studying for an 'A' level in Computer Science. Later chapters and appendices outline the development of a new simulation, SIMPLE, designed to be of use to these older students. PAGE 3 Chapter 2 Review of existing software At least seven different machine code simulators have been used in British schools. These include:- CG319 from the City and Guilds of London Institute BMC from the Advisory Unit for Computer Based Education in Hatfield CESIL from Computer Education in Schools ENGINE from the North Cambridgeshire Computer Education Group PEEKO-COMPUTER from Acornsoft IMC-2 by Peter Bishop. AMC by Peter Bishop. They vary greatly in their original purpose, level of complexity, target group and the host machines on which they may be executed. CG319 The Revised Mnemonic Code (1968) was a development from an earlier code published in 1964. It defined a low-level code to be used for the teaching of programming for the Certificate in Computer Programming and Information Processing of the City and Guilds of London Institute. This course, coded 319, was widely taught in technical colleges at the time. The participating colleges where expected to provide a simulation of the defined machine on the equipment available within the institution. At this time many such colleges were equipped with IBM 1130 computers with paper-tape or punched card input/output and a printer. The minimum hardware requirement PAGE 4 was a single reader and punch for input/output and a suitable CPU. Such machines often had very little memory, typically 8K words, and the simulator was often written in Fortran or Algol. It was with such a simulator that I was first introduced to programming on a short course for mathematics teachers in 1968. The aim of the simulator was to provide a common language across the country for the purpose of the examinations regardless of the hardware available within the colleges. This meant that students from all over the country could sit the same examination papers and be set language specific questions. It was designed for students aged from 16 to 21. At this time computers were very expensive items of equipment for technical colleges. To overcome the shortage of funds money was transferred from schools' budgets and the colleges were expected to provide computing resources for local schools. In fulfilling these conditions the colleges were expected to provide computer training for the local teachers and then to provide processing of programs produced by school pupils. Many technical colleges began by putting on courses in CG319. In many LEAs CG319 soon became the major teaching language for school aged students. Gradually support materials were developed to aid this teaching and CG319 language specific questions were added to CSE examinations. Examination course-work programming was carried out in CG319. The mnemonic language provided a very wide mixture of instructions. These ranged from simple arithmetic instructions such as ADD, SUB, MLT and DIV, to functions provided as instructions such as SIN, COS and EXP. Nine different jump instructions were provided, including JSR to implement subroutines. LOP even controlled program loops automatically. Direct, immediate and indexed addressing are available but only 1000 store locations were provided. The simulation worked in floating-point denary arithmetic and PAGE 5 was able to provide easily understood answers. It was easier to use than the high level languages available in the early seventies, it gave some insight into the Tetch execute cycle and machine architecture and many versions provided the optional trace facility.
Recommended publications
  • Acorn Electron Android Emulator
    Acorn electron android emulator Continue ElectrEm is the Acorn Electron emulator, an 8bit microcomputer first launched in 1983, which was once the fourth best-selling on the UK market. Although sold as compatible with BBC Micro, the only common component is the 6502 processor. All other compatibility is achieved with a well-documented firmware interface to customize the graphics mode, generate sound, and input the keyboard/joystick. While the number of programs that directly use electron hardware is enough to be incompatible with the BBC's small, Electron is subject to variable bus speeds, making most Electron software run at the wrong speed at the BBC and making the implementation of emulation based on the existing BBC emulator or almost any other 6502 emulation code impractical, if not impossible. ElectrEm strives for first-class simplicity. In general, it is enough to point the emulator on the image of the tape or disk, and it automatically adjusted the emulation equipment in a compatible form, and then will run the program contained in the image. The first phase of significant work on ElectrEm took place between 2000 and 2002. This codebase is now known as electrEm Classic and has been ported to Windows, DOS and Linux, supporting a wide range of graphics release libraries including Allegro, SVGALib, GGI, SDL and DirectX. For personal reasons, there was a break in development. By 2002, a number of problems with the architectural design of the emulator had become apparent. So began a new codebase, which is now called ElectrEm Future. This is actually a re-overlay, so it lacks a lot of testing and still lacks some functionality of the old code.
    [Show full text]
  • Master 512 Technical Guide
    Master 512 Technical Guide by Robin Burton DABS PRESS Master 512 Technical Guide © Robin Burton 1990 Hardware Expansion Projects © Andrew Smith 1990 Master 512 circuit diagram © Acorn Computers Ltd. 1984-1990 ISBN 1-870336-80-1 First edition, first printing September 1990 Editors: Syd Day, Bruce Smith, David Atherton Typesettng and proofreading: L Atherton, J. Horrocks, A. Wygladala Cover Design. Atherton Clare Designs (0204 654207) The publishers wish to acknowledge with gratitude the assistance provided by Acorn Computers Ltd. in the preparation of this book, without whom publication would have been impossible, and for allowing the publication of the Master 512 circuit diagram. The publishers wish also to thank Richard Russell for allowing his BBCBASIC(86) program to be included on the programs disc. MS-DOS is a registered trademark of Microsoft Corporation. IBM is a registered trademark of International Business Machines Inc. DOS Plus, CP/M80, CP/M86, Concurrent CP/M, and GEM are trademarks and registered trademarks of Digital Research Inc. The letters BBC refer to the British Broadcasting Corporation. All other trademarks and registered trademarks referred to in this book are hereby acknowledged as the property of their respective owners. All rights reserved. No part of this book (except for brief excerpts quoted for critical purposes) or any of the computer programs or electronic circuits to which it relates may be reproduced or translated in any form, by any means mechanical electronic or otherwise, without the prior written consent of the copyright holder. Disclaimer: Because neither the author nor the publisher have any control over the way in which the contents of this book or optional programs disc are used, no warranty is given or should be inferred as to the suitability of the advice or programs for any given application.
    [Show full text]
  • The Advanced User Guide for the Acorn Electron
    The Advanced User Guide for the Acorn Electron Adrian C. Dickens BA, Churchill College, Cambridge University Mark A. Holmes BA, Fitzwilliam College, Cambridge University Published by Adder Publishing, Cambridge The “Acorn Electron Advanced User Guide” is published by Adder Publishing for Acornsoft Limited. Acornsoft Limited, Betjeman House, 104 Hills Road, Cambridge, CR2 1LQ, England. Telephone (0223) 316039 ISBN 0907876 17 X Copyright © 1984 Adder Publishing Adder Publishing, PO Box 148, Cambridge, CB1 2EQ ISBN 0 947929 03 7 First published September 1984 Second edition June 2008 The Authors would like to thank Nigel Dickens, Tim Dobson, Steve Furber, Tim Gleeson, David Johnson-Davies, Dr John Horton, Zahid Najam, Mark Plumbley, John Thackeray, Ken Vail, Geoff Vincent, Adrian Warner, Leycester Whewell, Albert Williams and everyone else who helped in the production of this book. All rights reserved. This book is copyright. No part of this book may be copied or stored by any means whatsoever whether mechanical, photographic or electronic, except for private or study use as defined in the Copyright Act. All enquiries should be addressed to the publishers. While every precaution has been taken in the preparation of this book, the publisher assumes no responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of information contained herein. The Authors gratefully acknowledge Acorn Computers Limited for their kind permission to reproduce the complete Electron circuit diagram. The Authors would like to point out that Acorn Computers reserve the right to make improvements in the specification of its products. Therefore the circuit diagram and other contents of this book may not be in complete agreement with the product supplied.
    [Show full text]