Address:

Copyright 1994 by I.A.Bogoiavlenski and A.A.Pechnikov

Five Years Experience of Architecture and Assembly Language Introduction Course for the First Year Students

Iouri A.Bogoiavlenski, Andrew A.Pechnikov Petrozavodsk State University



Table of contents

Abstract
Introduction
Lectures topics
Laboratories organization
The set of laboratory tasks
Laboratory tasks and beacons
Semi-supervised principle
Strengthening of the Motivation
Program, written on yet unknown language
Specially structured reference textbook
Discomfort feeling creation
Using of a leadership
Observations
References
Current contact addresses

Abstract

Set of computer architecture concepts is a fundamental achievement of the modern applied mathematics. Moreover, properties of an architecture are inherited by almost all programming tools and environments in explicit or implicit forms. It means that early learning of the concepts will be very useful to form students' practical programming competence. On the other hand, problem of the concepts teaching for the first year students is rather difficult and requires special approaches and techniques. Our approach is based on some empirical psychological methods to strengthen students motivation and on special organization of lectures and labs. We also use brief, specially structured, reference textbook, which demonstrates to students that the architecture and the instruction set are not very complex, when they are structured. We discuss in the article our practical experience in the teaching field, techniques and some observations.

Introduction

The Architecture and Assembly Language (AAL) Introduction Course is read in Petrozavodsk State University for the first year students at Industrial Division of Mathematical Faculty from 1989 by Department of Computer Science. Now the course is included as the first section of the course of Introduction to Computing in the Bachelor Curricula in Computer Science/Applied Mathematics [Pech,93], which supports ACM/IEEE-CS recommendations [Comp,91, Denn,89] and is in action since autumn 1993.

The second section of the Introduction Course is a common introduction to programming. This section covers bases of a text editor, operating system (now it is MS DOS) and main concepts of programming with Pascal. The two sections are read simultaneously during first (autumn) semester and presents the first part of the Introduction Course.

The second part of the Introduction includes studying of algorithms and data structures with C language programming in C++ environment. The part is lectured during second (spring) semester of the first year.

As a rule, the AAL course is read for third or fourth year students. For some reasons we prefer to include essential part of the AAL course into the Introduction Course.

First, set of concepts, connected with AAL, is a fundamental achievement of modern applied mathematics. Any knowledge and skills of programmer will not be sound without possessing of computer architecture culture. Professional's ability of self-teaching is strongly restricted by the absence of student's proper skills.

Second, third/fourth years students acquire knack to resolve programming problems without taking into account the architecture considerations after two, three years of programming experience with high level languages. It leads both to forming in the students mind not completely notions about programming, and low motivation and receptivity of the students to study AAL. Additional reason for low motivation is the increasing number of the third/fourth years students, who works part-time and/or try to get a steady job (the phenomena take place not only in Russia [Denn,92]).

Our experience shows, that the motivation and the receptivity of AAL studying are essentially higher for first year students. Most part of them intuitively feel that it is important for their professional formation to understand, how a computer really works on the hardware level. That's why the AAL course is very popular among the students. The experience also shows, that the students, who were introduced in AAL from the first year, study high level languages easier and demonstrate deeper competence in process of problems solving.

Third, subject, called Bases of Informatics, has been common school subject since 1985 in Russia, thanks to of Academician A.P.Ershov's activity [Ershov,82]. That is why almost any first year student has elementary programming experience, which is enough for AAL study to begin with.

We have choose for teaching the Intel 8088/8086 central processors architecture by the following reasons. First, the architecture is simple enough for study. Second, it allows to demonstrate real complexity of computers architecture. Third, it is a kernel of Intel CPU family.

Lectures topics

There are 15 lectures in the course. The following topics are choose with aim to cover main AAL ideas.

Radices, Binary Arithmetic. Memory, Segmentation, Registers.
First Introduction to the Assembly Language. Symbolic names, Attributes, Named Objects.
Format of the Assembly Language Instruction Allocating Data The Assembling Process and Listing Procedures, Parameter Passing
Why and How to Comment a Program Machine Instruction Structure.
Byte ModR/M. Addressing Modes. Separate Assembling, Object Modules, External
Names. String Instructions.

Laboratories organization

The set of laboratory tasks

Each student has one scheduled two hour lab per week for the assembly language and two hour lab per week for the second section of the Introduction Course. The tasks are divided into 3 parts.

The first part is introduction and predefined for either learning interaction with the working environments or for inductive leaning simple base AAL notions. This part includes 4 tasks:

T1.1 Enter, compile, link and run ready, well-commented program for output on the screen consequently 4 text strings via DOS function N 9.
T1.2 Enter, compile, link and run under debugger ready, well-commented program for output on the screen one of 4 text stings (from T1) via DOS function N9. The number of string should be input from the keyboard in answer on prompt via DOS function N 1. There is simple flow control error in the program and a student should find it with debugger and correct.
T1.3 Enter, compile, link and run under debugger ready, uncommented program. The program computes sum of ten numbers using loop by register CX. Register BX is used as index of numbers. A student should understand the program running it command by command with debugger and add to the text good comments.
T1.4 Enter, compile, link and run under debugger ready, well-commented program for input into RAM buffer ASCII codes of only digital keys of the keyboard. If any other key is pressed, then the program outputs the error message. A student should observe with debugger the buffer filling process and presentation of digital symbols in symbolic, decimal and hexadecimal forms.

The second part is predefined for intensive training and consolidation of the techniques, received by a student during execution the first part tasks. The part consist from the following tasks:

T2.1 Develop, debug and test program for computing sum of any quantity of numbers, containing only one digit. Numbers are input from the keyboard. The sum should be observed via debugger. The appropriate parts of previous tasks should be used as prototypes.
T2.2 Enhance T2.1 to compute sum of multidigital numbers, fitting in the word . The program should recognize the integer overflow.
T2.3 Enhance T2.2 to output computed sum on the screen.
T2.4 Develop, debug and test program for finding minimal and maximal values of integer words array for signed and unsigned interpretations of the words. The array should be any length and should be input from the keyboard. Results should be output on the screen. The appropriate parts of previous tasks should be used as prototypes.

The third part is predefined for learning nested procedures and parameter passing through stack techniques. The part consist from the following tasks:

T3.1 Enter, compile, link and run under debugger ready, well-commented program, where a procedure organization with parameter passing through stack is demonstrated. A student should observe via the debugger the stack behavior during the process of parameter passing.
T3.2 Redevelop the program from T2.3 using nested procedures techniques.
T3.3 Redevelop the program from T2.4 using nested procedures techniques.

The fourth part is predefined for learning separate assembling and object modules techniques using the link editor. The part consist from the following tasks:

T4.1 Redevelop the program from T3.2 using separate assembling and object modules techniques.
T4.2 Redevelop the program from T3.3 using separate assembling and object modules techniques.

Laboratory tasks and beacons

We carefully develop lab tasks. Some of the first lab tasks are intended to understand with a debugger and to modify pre-written programs. Each task represents a well commented program, containing some beacons [Davies,93] of assembly language programming. The role of the beacons in generation and comprehension of programs is widely discussed among psychologists, who studied models and theories of programming activity. In the course of lectures the role of the beacons for program understanding and the importance of good comments are permanently underlined by the lecturers. We explain students, that techniques, showed in the beacons, are building blocs for their future programs.

After fulfilling the first tasks, student must develop and debug some programs based on previously made tasks. Sequence of the tasks is aimed to widen the beacons using and developing the own students beacons. You can see below some examples of Assembly Language beacons.

;	Task 1.4
;	Group:
;	Date:
;	Author:
;	Program for Input of Digit Keycodes into Memory Buffer
;
;____ Beacon 1 Standard Starting _____________________________ ;
DOSSEG	; Standard order of the segments
.MODEL SMALL	; Standard segments names
.STACK 200H	; Stack segment
.DATA	; Data segment start
;
;____ END of Beacon 1 _________________________________________ ;
INPBUFF DB	200 DUP(?)	; Buffer
MESS1	DB	'Not digit. Repeat.',13,10,"$"
MESS2	DB	'Digit! Good.',13,10,'$'
PROMPT DB	'Enter a digit, my friend.',13,10,'$'

.CODE	; Code segment start
PROGRAM_START:	; Begin

MOV	AX,@data	; Load value
MOV	DS,AX	; to Data Segment Register
;
;____ Beacon 2 Input of Digit Keycodes into Memory Buffer _____ ;
SUB	BX,BX
INPTFROMKBD:
MOV	DX,OFFSET PROMPT ; Load offset of prompt message
MOV	AH,9	; Define DOS function for text output
INT	21H	; and invoke it

MOV	AH,01H	; Define DOS function for
INT	21H	; and invoke it

CMP     AL,"@"  ; Is it termination code ?
JE	STOP	; YES - to termination
CMP	AL,"0"	; Is it less then code of 0 ?
JB	PRTMESS1	; YES - to output of Error Message
CMP	AL,"9"	; Is it greater then code of 9 ?
JA	PRTMESS1	; YES - to output of Error Message
MOV	INPBUFF[BX],AL ; move current code to buffer INPBUFF
INC	BX	; increment pointer of the buffer in BX by1
MOV	DX,OFFSET MESS2 ; Load offset of success message
MOV	AH,9	; Define DOS function for text output
INT	21H	; and invoke it
JMP	INPTFROMKBD	; to input of new code
PRTMESS1:	; Output of error message
MOV	DX,OFFSET MESS1
MOV	AH,9
INT	21H
JMP	INPTFROMKBD
;
;____ END of Beacon 2 _________________________________________ ;
STOP:
MOV	AH,4CH	; Define DOS function for
INT	21H	; terminate the program, invoke it
END	PROGRAM_START ; End of source module with
; the entry point for link editor

; startup point for Link Editor

Semi-supervised principle

We use special organization of the labs, aimed to recognize and support leaders among the students. The labs planning is flexible and we call it semi-supervised. The tasks T1.1 and T1.2 are strictly supervised. More over, all students work synchronously, by the whole class at once, during the labs. They execute teacher's oral instructions, for studying of examples of using an editor, an assembler and a debugger in order to receive stable skills of interaction with the working environments. Analogous technique is used, for instance in Temple University, Philadelphia [Weiner,89]. D.J.Weiner marks, that the technique "allows much more material to be covered". We support the consideration and mark that, additionally, the technique allows to recognize students mistakes and their reasons "on the fly" at the terminal.

Labs become semi-supervised, after task T1.2, in the sense, that students develop the programs in accordance with their individual speeds and abilities (but not at their own schedule). However, students can obtain additional computer time out of the labs schedule, if it is needed. During the 15 weeks a student is required to understand with a debugger five prewritten and to develop personally at least seven assembly language programs for passing final semester test.

Strengthening of the Motivation

The problem of AAL teaching for the first year students is rather difficult. The original interest of the students to AAL studying is a combination of child's desire to decompose a thing (in our case a computer) with aim to understand "how does it work", and of vague feeling, that AAL will be useful in the future professional activity. Both of them belongs to essential, deep-laid human motivations, and therefore are good base for development different methods of strengthening of the motivation. We should mark, that using only high level languages in the introduction course eliminates the first, child motivation.

In general, the motivation strengthening methods should satisfy, support and develop both sources of the motivation. Students are supposed to believe:
- that AAL is not very hard domain;
- that the Assembly language is usual, although a bit more specific, programming language;
- that his/her understanding of computer inner mechanisms is increasing rather quickly;
- that receiving knowledge is helpful right now.

To fulfill this task we use some empirical psychological techniques to strengthen the inner motivation of the students.

Program, written on yet unknown language

We suggest students to find and correct an error in simple, pre-written, detailed commented assembly language program, already at the second lab class. A student should understand the program with a debugger and correct it, using his/her school programming experience. Five years ago only two or three students out of twelve could do it without explanations; this year only two students needed this explanations. Most of the students were surprised, that they had independently performed correction of program, written on yet unknown language. This shows the students that AAL is not so difficult.

Specially structured reference textbook

We use a special approach to textbooks and references guides, recommended for students. There are a lot of good textbooks with detailed, step by step, explanation and examples on Intel processors architecture and the assembly language in Russian language now, for example [Abel,92, Dao,88 Nort,92, Scan,89]. We recommend students to use any of them. Unfortunately, the textbooks are usually huge and it makes them difficult to use as integrated references guide. Therefore we have prepared the reference book [Centr,11], containing all the knowledge, required for the dealing with the architecture, in concise and structured form (about 120 pages). Every student owns a book.

The book is specially structured to demonstrate to student, that AAL is not very complex. The special short contents of the book takes only two pages and allows students to observe the structure of AAL area in whole and to find easily needed divisions. The short content looks like this:

Short Content

Index of Instructions	5
Full Contents	7
Tables and Figures	14
Introduction	15
Processors and Computers	18

CPU Intel 8086/8088 System Environment	20
RAM	22
I/O Devices	26
BUS	28

Architecture of Intel 8086/8088	30
Processor Structure	31
Multiprocessing	33
Differences between 8086 and 8088	34
RAM Organization and Segmentation	35
Registers	41
Interrupts	49

Instruction Set	62
Interpretation of RAM Access Units	62
What Is an Instruction	65
Instruction Structure	65
Instruction Description Format	70

Moving data Instructions	74
General	74
Input/Output	76
Addresses Loading	77
Flags	78

Arithmetic Instructions	80
Add, Subtract, Compare	80
Multiply, Divide	83
Increment, Decrement, Complement 86
Sign Extensions	87
Decimal Corrections	88

Bit Instructions	91
Logic Instructions	91
Shifts	93
Rotates	95

String Instructions	97

Flow Control Instructions	103
Procedures	103
Jumps and Loops	105

Interrupts Handling	109
Processor Control	110
Undefined Instruction Codes	115
Abbreviations	116
ASCII Code Table	119
References	120
The book has a pocket format and allows us not to give the lectures in detail. By the reason, we have more freedom for picking out main concepts and for thorough discussion of examples. We believe, that frequent use of the book helps students either to put in the active memory knowledge, which is necessary for programming with the assembly language, or to form a good style for references books usage.

The approach has the following advantages:

Discomfort feeling creation

We read some of the lectures asynchronous with the labs to create for the students discomfort feeling, intentionally. The target of the asynchronization is to create understanding explosions during the course. The asynchronous lectures are one or two first lectures of each part of the course (now it consists of four the parts).

Due to origin motivation and first successes in AAL understanding, the students begin trying to eliminate the feeling by different means. This strengthen their learning activity, the independent work, and the interaction between lectures and labs processes. As usual, the students make much more deeper experiments with programs by a debugger, read the textbooks more carefully, and ask more different questions.

It is very interesting to observe this struggle of an intellect for inner comfort and the searched means. It is natural, that the harder work may be the cause of the understanding explosion. The explosions once more show the students, that they are able to learn AAL. In its turn, the motivation is increased by the demonstration.

Using of a leadership

The task T1.2 allows us previously to divide students into two groups. The students, who have performed the task without help of instructor are treated as potential members of leading group. Rest student are treated as members of usual group.

Then different teaching strategies is used inside each of the group. The lab tasks are given for members of leading group in more complex versions and with less explanation. Members of usual groups receive standard versions of the tasks and are under more strict control.

There also exist some additional program specifications for leading students, who develop a program per labs, as a rule, and therefore the students can develop more programs during the course. The students have preferences during final test passing. The leaders shows other students, that it is not very hard to learn AAL, and involve them in competition for the preferences. That is also a motivation's strengthening technique.

Observations

We have observed the following positive influences of early AAL study on the students competence.

1. The students better understand C language constructions. For examples, they consider pointers in connection of known notion of address, or have a good base for understanding memory models, near and far pointers, parameter passing.

2. Number of the students is increased, who undertakes attempts to open protection program, installed on laboratory computers. They feel, that it is not totally impossible for them.

3. The students shows the readiness for more progress in third year course Architecture of Computers. It makes possible to read the course with more depth and breadth.

Acknowledgments. It is our pleasure to express gratitude to N.S. Ruzanova, J.E. Shtivelman, S.M. Krutalevich, O.I. Derbeneva and E.I. Holodkova from Computer Center of the University for carefully supporting of the laboratories. We also thanks the reviewers of the article for useful remarks.

References

Abel Peter
IBM PC Assembler Language and Programming, Moscow, Visshaia Shkola Press, 1992, (translated into Russian)

Bogoiavlenski I.A., Pechnikov A.A.
Strategy of Teaching the Architecture and Assembly Language of IBM PC Compatible Computers for First Year Students of Mathematical Faculty. In Abstracts of Conference "New Information Technologies in Education and Management", Petrozavodsk University Press, 1993, pp. 78-79, (in Russian)

Central Process Units Intel 8086/8088.
The Architecture and the Instruction Set. Programmer's Reference, compiled by I.A. Bogoiavlenski and A.A.Pechnikov, Petrozavodsk University Press, 1992 (in Russian)

Computing Curricula 1991.
Report of the ACM/IEEE-CS Joint Curriculum Task Force, ACM Press, 1991

Dao Lanny V.
Mastering the 8088 microprocessor, Moscow, Mir press, 1988 (translated into Russian)

Davies Simon P.
Models and Theories of programming strategy. Int.J Man-Machine Studies (1993), 39, pp. 237-267

Denning Peter J.
Educating a New Engineer, Communications of the ACM, v.35, N12, December 1992, pp. 83-97

Denning Peter J., Comer Douglas E., Gries David, Mulder Michael C., Tucker Allen B., Turner A. Joe, and Young Paul R.
Computing as a Discipline, Communications of the ACM, v.32, N1, January 1989, pp.9-23

Ershov A.P.
Programming is a second literacy, Pocit e umela intel., 1982, 1, N6, pp.457-471 (in Russian)

Norton Peter, Socha John Peter Norton's
Assembly Language Book for the IBM PC, Moscow, Finansy and Statistica Press, 1992 (translated into Russian)

Pechnikov A.A.
The Bachelor Curricula in Computer Science/Applied Mathematics in Petrozavodsk State University on the Base of Computing Curricula 1991, In Abstracts of conference "New Information Technologies in Education and Management" , Petrozavodsk University Press, 1993, pp. 12-15 (in Russian)

Scanlon Leo J.
IBM PC and XT. Assembly Language, Moscow, Radio i Sviaz Press, 1989 (translated into Russian)

Weiner David J.
Teaching of Assembly Language as a Laboratory Science, SIGCSE Bulletin, v.21, N4, December 1989, pp.60-64

Current contact addresses

Iouri A. Bogoiavlenski
Supervisor of Software Branch
Department of Computer Science
Faculty of Mathematics
Petrozavodsk State University
Lenin St., 33, Petrozavodsk, 185640, Karelia, Email address phone: (81400 [81422 for Finland]) 7.51.39

Andrew A. Pechnikov
First Vice-Rector
Petrozavodsk State University

Lenin St., 33, Petrozavodsk, 185640, Karelia, Email address phone: (81400 [81422 for Finland]) 7.51.39