MICROPROCESSOR SYSTEMS 1: Course Introduction This lecture serves to introduce the topics of assembly language and the microprocessor Motorola 68000 family and to explain the advantages of a low-level programming approach.
On completing this lecture, in addition to getting acquainted with general aspects of this course, you will be able to:
Distinguish between high-level and low-level programming languages;
Discuss the advantages of the low-level approach;
Discuss the advantages of the 68000 series for teaching purpose.
What is Microprocessor Systems 1?
To use a particular computer, programmers must provide commands that ultimately define a series of machine instructions. Codes can be written in a high-level language, in the intermediate symbolic code of assembly language, or directly in machine language.
An introduction to a “bare” computer system without compilers and operating systems Most of you know how to program and write algorithms, but you might not know how to manage the computer hardware. This task is usually accomplished by the Operating System (OS) which monitors the control, access and use of the resources of the machine. The OS is an “expert” in how the machine is put together, what kind of hardware is in it, what commands have to be issued to perform the correct action. It presents a uniform interface to the programmer who wants to write a program to solve a specific problem.
A bare machine does not have an OS. You, the programmer, have deal with the intricacy of the hardware yourself.
When you write a program in an high level language (C, C++, Java,…) your statements are converted into a low level code called machine code. Machine code instructions are then executed based on the actual hardware (the silicon) in the machine. A program called compiler is responsible for the conversion of the high level description of your algorithm into machine code. You normally use a text editor to write your code, run it through a compiler that produces a file containing the machine code that the OS takes and executes for you.
A bare computer does not have a compiler either.
We have such machine for you: a bare machine in a box with a power supply and a reset switch, a serial cable connected to a PC equipped with a development system. You will write code on the PC, the code is then translated to machine code and sent into the target machine where it gets executed. You will eventually debug this code.
We look at the basic structure or architecture of a typical microprocessor, the Motorola 68000 From a software developers’ point of view, the 68000 is a very elegant processor. The 6800 is the Central Processing Unit (CPU) of the overall microprocessor system you will be using.
We look at the resources available for performing computations Programmers are generally interested in programming: getting the algorithm together, writing the code, and getting it run. But you have to take a wider view of computing as you become a professional developer. For instance, you have to think at the overall performance: the speed, resources, memory and energy consumption.
1.2 Assembly Language This is a very low-level language assembly language predates high level languages. When you write a program in C you have to specify exactly what to do. Assembly language and C share the property that the programmer orders the machine exactly what to do. The mind that you bring in programming in C is the same mind that you will bring to programming in assembly. However, the set of instructions you can force the machine to do is much more restricted in assembly than in C.
Each statement is [almost] exactly equivalent to one machine instruction A machine instruction is the lowest level operation that can be executed by the 68000 hardware. In the late 1940s it was considered that only a few number of computer machines would be needed in the world. It was seen that programming would consist of writing machine instructions. Programming was considered a very skilled operation and programmers had to write directly in machine code. Hence the introduction of assembly was a big step forward in terms ability to write and read programs.
Why learn assembly language? Programmers use high level languages to increase their personnel efficiency in developing software. When we get back down to the level of assembly language, the productivity of functionalities delivered to the end user is very low. So you may wonder why we should learn assembly.
Assembly allows you to learn about the machine itself. An appreciation of the machine is very important for you when writing in high level languages.
Speed: if you want to write a program for which time is a major issue, you need to consider the resources that it uses: processor instructions, memory, and access to the bus.
Assembly language helps you understand precisely the process at the machine level and it gives you an exposure to how a computer is organised.
A machine instruction is obeyed directly by machine’s hardware Because instructions are issued directly to the silicon in the machine they have to follow exactly what the machine is capable of executing.
As well as writing programs, you will find out how a computer system can interact with objects and mechanisms in the outside world - i.e. external to the computer The task of interacting with the outside world involves some part of hardware and another part of software. The hardware side is the responsibility of interfaces, often called peripherals because they are peripheral to the core computer.
Input/Output, or “IO” programming You will learn how the outside world, coming in or out of the computer, looks like in the world of computer programming and how you write programs that deal with it. This is called I/O programming.
You will be given a fast, brief, introduction to some aspects of the hardware of the computer — no knowledge of electronics necessary! Knowledge of the hardware of a computer helps you understand the origin of some of the limitations of the computer’s performances. They most typically come from the bus. The CPU is a component that executes instructions. The memory is another component that stores information. Peripheral interfaces are special-purpose devices to mediate I/O operations. They are all connected via a bus that carries information: it is a bundle of cables, like a highway where information travels. The bus has a limited speed which determines its ability to carry information. Since there is a high time cost in getting information from the memory to the processor via the bus, programmers try to keep as much information in the CPU as possible. However, the processor is a special-purpose device dedicated in executing instructions, not storing them. But what you can do is to have the processor store a tiny piece of a program, perhaps the piece of a program that is frequently used, that you can easily access. This can dramatically speed up program execution. That is called the cache. The 68000 doesn’t have one, unfortunately, but we will look at techniques to overcome this limitation.
A microprocessor is a collection of circuits packaged on a small silicon chip. It contains the basic instruction logic for a computer and the circuitry to interact with the external environment.
The 68000 is the base member of a family of microprocessors - 68010, 68020, 68030, 68040, 68060 (?) The Motorola 68000 is one of a series of 16-bit microprocessors introduced in 1979. The Motorola 68000 family has been chosen to illustrate microprocessor systems because it is an excellent device for teaching purpose.
The 68000 has a comprehensive and elegant Instruction Set, relatively easy to learn. Students are usually able to absorb its mnemonics, and then make use of its variable-size operations and powerful addressing mode.
The 68000 offers interesting interfacing features including non-multiplexed asynchronous address and data buses, prioritized vectored interrupt and DMA.
The 68000 supports real-time programming and multiprocessing environments.
The 6800 provides protection for operation systems.
The 6800 supports a wide range of data structures required by compiler writers and high-level language programmers.
The 68000 is still produced and widely used. It continues to form the basis for a large number of commercial systems. The latest versions are embedded inside other machines like mobile phones, cars, etc. For instance, Texas Instrument uses the 68000 in its high-end graphing calculators TI89, TI92 and Voyage 200.
The 68000 is a kind of ‘CISC’ - a Complex Instruction Set Computer one of the factors influencing the architecture CISC microprocessors is the desire to help compiler writers by providing complex instruction sets. This is called closing the semantic gap (i.e. reducing the difference between high-level and low level languages). By complex instructions we mean instructions that carry out multi-step operations in a single machine-level instruction.
review of binary and hexadecimal arithmetic;
the Von Neumann machine;
the programmer’s model of the MC68000;
data representation: integers, characters, signed representations, arrays;
The course runs for all eleven weeks of the first semester and comprises three lectures and one tutorial per week, with a two-hour practical in each of the last seven weeks. Total contact time is thirty three hours of lectures, eleven hours tutorials and fourteen hours of practical sessions giving 58 hours in total.
Practicals will be marked for Continuous Assessment, which will be worth up to 20% of your course mark
The course work is a very important part of the course. The only way to learn about the computer is to use it - if you don't use it, you won't learn anything.
You are required to attend practicals and obtain a pass mark in Continuous Assessment. Failure to do so may result in the return of N/ S grades, withholding of results and/or a denial of permission to sit the Examination.
This course is intended to enable students to design and develop programs and program ‘architectures’, to test and debug programs and to analyse and modify their execution behaviour, based on a thorough familiarity with the low-level architecture of a computer. Concepts such as RISC/CISC architectures, register sets, addressing modes, data structures, subroutines, [informal] high-level to low-level language translation techniques, polling, interrupt priorities, asynchronous producer-consumer systems are introduced.
A. Clements;68000 Family Assembly Language; PWS Publishing Company; 1994; ISBN 0-534-93275-4 (Recommended, or similar, not mandatory).
Dr. Mike Brady, Microprocessor Systems 1, dept. of Computer Science, Trinity College Dublin: http://www.tcd.ie/Engineering/Courses/BAI/JS_Subjects/3D1/.
Look on the Web at http://www.mee.tcd.ie/~assambc/3D1.