Computer System Architecture Dept. of Info. Of Computer Chap. 6 Programming the Basic Computer 6-1 Chap. 6 Programming the Basic Computer n 6-1 Introduction.

Slides:



Advertisements
Similar presentations
Cpe 252: Computer Organization1 Lo’ai Tawalbeh Programming The Basic Computer Chapter 6:
Advertisements

1 System Programming System Software, pp Chia-Hui Chang, Assistant Professor Dept. of Computer Science & Information Engineering National Central.
Instruction Set Architecture & Design
Chih-Hung Wang Chapter 2: Assembler (Part-1) 參考書目 Leland L. Beck, System Software: An Introduction to Systems Programming (3rd), Addison-Wesley, 1997.
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
Chih-Hung Wang Chapter 1: Background (Part-1) 參考書目 Leland L. Beck, System Software: An Introduction to Systems Programming (3rd), Addison-Wesley, 1997.
Assembler (Basic Functions)
Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009
April 14, 2007CCSC-Central Plains Region1 Use of a Simulator and an Assembler in Teaching Input-Output Processing and Interrupt Handling Soe Than Department.
Chapter 6: Programming The Basic Computer CPIT 210
4-1 Chapter 4 - The Instruction Set Architecture Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring.
Computer System Architecture ESGD2204
Machine Instruction Characteristics
4-1 Chapter 4 - The Instruction Set Architecture Department of Information Technology, Radford University ITEC 352 Computer Organization Principles of.
Chapter No 5 Basic Computer Organization And Design.
Eng. Mohammed Timraz Electronics & Communication Engineer University of Palestine Faculty of Engineering and Urban planning Software Engineering Department.
Bus Architecture Memory unit AR PC DR E ALU AC INPR 16-bit Bus IR TR
4-1 Chapter 4 - The Instruction Set Architecture Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles.
Computer System Architecture © Korea Univ. of Tech. & Edu. Dept. of Info. & Comm. Chap. 7 Microprogrammed Control 7-1 Chap. 7 Microprogrammed Control (Control.
Exam2 Review Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.
Lecture 14 Today’s topics MARIE Architecture Registers Buses
Chapter # 6 PROGRAMING THE BASIC COMPUTER.
PROGRAMMING THE BASIC COMPUTER
1 Purpose of This Chapter In this chapter we introduce a basic computer and show how its operation can be specified with register transfer statements.
Computer Organization CSC 405 (VSC) Very Simple Computer.
5-6 Memory Ref. Instruction
COMPILERS CLASS 22/7,23/7. Introduction Compiler: A Compiler is a program that can read a program in one language (Source) and translate it into an equivalent.
Instruction.
Ch5. 기본 컴퓨터의 구조와 설계.
October 1, 2003Serguei A. Mokhov, 1 SOEN228, Winter 2003 Revision 1.2 Date: October 25, 2003.
Assembly Language Programming of 8085 BY Prof. U. V. THETE Dept. of Computer Science YMA.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Introduction A computer system includes both hardware and software. The designer should be familiar with both of them. This chapter introduces some basic.
1 M. Morris Mano Computer System Architecture Chapter 6: Programming the Basic Computer 박 찬식 교육관 325 호,
CPS4200 System Programming Spring 1 Systems Programming Chapter 1 Background I.
1 Chapter 1: Introduction Appendix A: Binary and Hexadecimal Tutorial Assembly Language for Intel-Based Computers, 3rd edition Kip R. Irvine.
PROGRAMMING THE BASIC COMPUTER
Basic Computer Organization and Design
PROGRAMMING THE BASIC COMPUTER
Assembly Language Programming of 8085
Microprocessor T. Y. B. Sc..
PROGRAMMING THE BASIC COMPUTER
8086 Microprocessor.
Computer Organization and Design
BASIC COMPUTER ORGANIZATION AND DESIGN
Computer Architecture and Organization Miles Murdocca and Vincent Heuring Chapter 4 – The Instruction Set Architecture.
INDEX UNIT-III PPT SLIDES
BASIC COMPUTER ORGANIZATION AND DESIGN
BASIC COMPUTER ORGANIZATION AND DESIGN
Introduction to Assembly Language
BIC 10503: COMPUTER ARCHITECTURE
By: A. H. Abdul Hafez CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU
Assembler CASE Tool.
PROGRAMMING THE BASIC COMPUTER
Programming The Basic Computer
Chap. 6 Programming the Basic Computer
CSCE Fall 2013 Prof. Jennifer L. Welch.
Programming The Basic Computer
Chapter 8 Central Processing Unit
MARIE: An Introduction to a Simple Computer
Shift & Rotate Instructions)
By: A. H. Abdul Hafez Computer Architecture and Organization: L06: Stored program and Instruction code.
PROGRAMMING THE BASIC COMPUTER
CSCE Fall 2012 Prof. Jennifer L. Welch.
Process.
Chapter 6 Programming the basic computer
COMPUTER ORGANIZATION AND ARCHITECTURE
Computer Architecture Assembly Language
Chapter 7 Microprogrammed Control
Presentation transcript:

Computer System Architecture Dept. of Info. Of Computer Chap. 6 Programming the Basic Computer 6-1 Chap. 6 Programming the Basic Computer n 6-1 Introduction  Translate user-oriented symbolic program (alphanumeric character set) into binary programs recognized by the hardware  25 Instruction Set of the basic computer l Memory Reference Instruction l Register Reference Instruction l Input-output Instruction n 6-2 Machine Language  Program Categories l 1) Binary Code(Machine Language) »Program Memory 의 내용 : Tab. 6-2 l 2) Octal or Hexadecimal Code »Binary Code 와 동일 : Tab. 6-3 l 3) Symbolic Code : Tab. 6-4 »Assembly Language : Tab. 6-5 l 4) High Level Language »C, Fortran,.. : Tab 6-6 * Tab. 6-4 와 차이점 Pseudoinstruction, Label 사용 가능

Computer System Architecture Dept. of Info. Of Computer Chap. 6 Programming the Basic Computer 6-2 n 6-3 Assembly Language  The rules for writing assembly language program l Documented and published in manuals(from the computer manufacturer)  Rules of the Assembly Language l Each line of an assembly language program is arranged in three columns »1) Label field : empty or symbolic address »2) Instruction field : machine instruction or pseudoinstruction »3) Comment field : empty or comment l Symbolic Address(Label field) »One, two, or three, but not more than three alphanumeric characters »The first character must be a letter; the next two may be letters or numerals »A symbolic address is terminated by a comma(recognized as a label by the assembler) l Instruction Field »1) A memory-reference instruction(MRI) n Ex) ADD OPR(direct address MRI), ADD PTR I(indirect address MRI) »2) A register-reference or input-output instruction(non-MRI) n Ex) CLA(register-reference), INP(input-output) »3) A pseudoinstruction with( ORG N ) or without( END ) an operand : Tab. 6-7 n Pseudoinstruction 은 Machine Instruction 이 아니고 Assembler 에게 필요한 정보만 제공 Field Label Instruction Comment

Computer System Architecture Dept. of Info. Of Computer Chap. 6 Programming the Basic Computer 6-3 l Comment field »Comment filed must be preceded by a slash(recognized by assembler as comment)  An Example Program : Tab. 6-8 l 83 - ( - 23 ) = 83 + ( 2’s Complement of -23) =  Translation to Binary : Tab. 6-9 l Assembler = the translation of the symbolic(= assembly) program into binary l Address Symbol Table = Hexadecimal address of symbolic address »MIN = 106, SUB = 107, DIF = 108  Two Pass Assembler : in next Sec. 6-4 l 1) 1st scan pass : generate user defined address symbol table l 2) 2nd scan pass : binary translation n 6-4 The Assembler  Source Program Object Code Binary Code Ex) LDA SUB 1) SUB = 107 2) 2107 교과서에서는 같은 의미로 사용됨 Assembler (Compiler) Linker asm a96 a51 c(cpp) for pas obj bin exe com hex Library 또는 외부 함수를 사용하여 Relocation

Computer System Architecture Dept. of Info. Of Computer Chap. 6 Programming the Basic Computer 6-4  Representation of Symbolic Program in Memory : Tab l Line of Code : PL3, LDA SUB I (Carriage return) »The assembler recognizes a CR code as the end of a line of code  Two Pass Assembler l 1) 1st pass : Generate user- defined address symbol table »Flowchart of first pass : Fig. 6-1 »Address Symbol Table for Program in Tab. 6-8 : Tab Fig. 6-1 Flowchart for first pass of assembler

Computer System Architecture Dept. of Info. Of Computer Chap. 6 Programming the Basic Computer 6-5 l 2) 2nd pass : Binary translation » 다음의 4 개의 Table 을 참고하여 Instruction Format 에 의한 Binary Code 형성 (Pseudoinstruction Table, MRI Table, Non-MRI Table, Address Symbol Table) »Flowchart of second pass : Fig. 6-2 »Binary Code translation 예제 : Tab. 6-9 의 Content »Error Diagnostics n Check for possible errors in the symbolic program n Ex) Invalid Machine Code Error Pseudoinstruction, MRI, non-MRI 에 속하지 않음 I Opcode Address …. … Error Fig. 6-2 Flowchart for second pass of assembler Tab. 6-9 에서의 Contents 를 결정 이 경우는 Hand Assemble

Computer System Architecture Dept. of Info. Of Computer Chap. 6 Programming the Basic Computer 6-6 n 6-5 Program Loops  Program Loops l A sequence of instructions that are executed many times  Example of program loop l Sum of 100 integer numbers »Fortran l Symbolic Program : Tab 6-13 »Address 150 부터 100 개의 Data 를 더하기 DIMENSION A(100) INTEGER SUM, A SUM = 0 DO 3 J = 1, SUM = SUM + A(J) Tab Symbolic Program to Add 100 numbers Data

Computer System Architecture Dept. of Info. Of Computer Chap. 6 Programming the Basic Computer 6-7 n 6-6 Programming Arithmetic & Logic Operations  Hardware implementation l Operations are implemented in a computer with one machine instruction l Ex) ADD, SUB : 그러나 자리수가 늘어나면 Software subroutine 처리  Software implementation l Operations are implemented by a set of instruction(Subroutine) l Ex) MUL, DIV : 그러나 이와 같은 명령어를 갖는 CPU 도 있음  Multiplication Program l Positive Number Multiplication »X = multiplicand Y = multiplier P = Partial Product Sum »Y 를 AC 에 저장한 후 E 로 Circular Right n E = 1 : P 에 1111 을 더함 n E = 0 : 더하지 않음 X = Y = P = P = P = P = P = Algorithm Fig. 6-3

Computer System Architecture Dept. of Info. Of Computer Chap. 6 Programming the Basic Computer 6-8 Tab Program to Multiply Two Positive numbersFig. 6-3 flowchart for Multiplication Program

Computer System Architecture Dept. of Info. Of Computer Chap. 6 Programming the Basic Computer 6-9  Double Precision Addition : 32 bits l 하위 AL + BL 먼저 수행하여 E 를 상위에 반영 (AH + BH + E)  Logic Operations l Logic Operation 중에서 OR 명령이 없다 ( Tab. 6-1 ) » 추가 하려면 더 길은 Instruction Format 필요 l 해결 방법 : DeMorgan’s theorem » AH AL BH BL CH CL +

Computer System Architecture Dept. of Info. Of Computer Chap. 6 Programming the Basic Computer 6-10  Shift Operations l Logical Shift : Zero must added to the extreme position »Shift Right »Shift Left l Arithmetic Shift Right »Positive ( + = 0 ) »Negative ( - = 1 ) CLE CIR 00 E 00 E CLE CIL 00 E 11 E n 6-7 Subroutines  Subroutine l A set of common instruction that can be used in a program many times l In basic computer, the link between the main program and a subroutine is the BSA instruction(Branch and Save return Address) l Subroutine example : Tab. 6-16

Computer System Architecture Dept. of Info. Of Computer Chap. 6 Programming the Basic Computer 6-11 Subroutine CALL hear X = 102 Y = 105 Tab Program to Demonstrate the use of Subroutines Ex) CIL 4 회 = Mask : AND FFF0 - 결과 = 2340

Computer System Architecture Dept. of Info. Of Computer Chap. 6 Programming the Basic Computer 6-12  Subroutine Parameters & Data Linkage l Parameter(or Argument) Passing »When a subroutine is called, the main program must transfer the data l 2 가지 Parameter Passing 방법 »1) Data transfer through the Accumulator n Used for only single input and single output parameter »2) Data transfer through the Memory n 여러 개의 Operand 전달 가능 n Operand are often placed in memory locations following the CALL l 2 개의 Parameter Passing 예 : Tab »First Operand and Result : Accumulator »Second Operand : Inserted in location following the BSA l BSA 후에 2 개 Operand 예 : Tab »BSA 후에 2 개의 Operand 사용 »Block 전송 Source 와 Destination Address 로 사용 Call 후에 Return Address 를 이용 Tab Program to Demonstrate Parameter Linkage * OR Subroutine First Operand : X = 7B95 Second Operand : BSA 후 = 3AF6

Computer System Architecture Dept. of Info. Of Computer Chap. 6 Programming the Basic Computer 6-13 Tab Subroutine to Move a Block of Data 2 개의 Operand * Block Move Subroutine 메모리 200 번지 부터 16 개의 데이터를 메모리 300 번지로 이동

Computer System Architecture Dept. of Info. Of Computer Chap. 6 Programming the Basic Computer 6-14 n 6-8 Input-Output Programming  One-character I/O l Programmed I/O 방식  Two-character I/O l Two character Packing 1st Char st Char 1st Char 2nd Char Tab Program to input and output One characterTab Subroutine to input and pack Two character

Computer System Architecture Dept. of Info. Of Computer Chap. 6 Programming the Basic Computer 6-15  Store Input Character in Buffer  Compare Two Word Tab Program to store input character in bufferTab Program to compare Two word

Computer System Architecture Dept. of Info. Of Computer Chap. 6 Programming the Basic Computer 6-16  Interrupt Program l Interrupt Condition »Interrupt F/F R = 1 when IEN = 1 and [FGI or FGO = 1] »Save return address at 0000 »Jump to 0001 (Interrupt Start) l Interrupt Service Routine(ISR) »1) Save Register (AC, E) »2) Check Input or Output Flag »3) Input or Output Service Routine »4) Restore Register (AC, E) »5) Interrupt Enable (ION) »6) Return to the running program Modified Fetch Cycle 과 Reset 시에 IEN = 0 이 된다 (p. 158, Fig. 5-15) Interrupt Here