Assembly Language Uses Easy-to-remember Instructions Called ____________________.

History of Computers

Computers have evolved from their introduction in the 1950s with very few computers, through the 1960s with very large, expensive computers, to the 1970s with cheaper, smaller computers. In the mid-1970's the first microcomputers, also called personal computers, appeared in the marketplace. In a very short amount of time these devices have become a permanent part of how we do business today. Regardless of the type, computers share some basic elements. History of Computers, Convenient Lookup Tables

There are many different types of programming languages. We will review the following general types of programming languages: 1. machine languages, 2. assembly languages, 3. procedure-oriented languages, and 4. object-oriented languages. History of Programming Languages, History of Programming Languages - poster

Machine language is a language that uses bits/bytes to form instructions to communicate with a computer. Each computer has its own instruction set (set of instructions it understands). Machine language uses binary numbering, which is a number system using 1's and 0's to represent data (base two). Each digit in binary is commonly called a bit (short for binary digit); and eight bits form a byte. Each character entered into the computer will be represented by a unique code consisting of 1's and 0's. ASCII (American Standard Code for Information Interchange) is a popular data representation code using bits to represent numbers, letters, and symbols. Because of all the 1's and 0's, programming in machine language is very tedious and prone to committing errors. The Second Book Of Machine Language

Assembly language is a language using mnemonics in place of 1's and 0's. Mnemonics are symbols used to represent the actual machine language instructions. Since the only instructions that the computer understands are machine language instructions, an assembler is required to convert the assembly language code to machine code before being executed by the computer. Note that each assembly language instruction is translated into one machine language instruction. It is easy to see that programming in assembly language is preferred to programming in machine language; however programming in assembly language can also be very tedious.

Procedure-oriented languages allow the programmer to use instructions that more closely resemble the English language. Still the only instructions that the computer can understand are machine language instructions, therefore a compiler is required to convert the high-level code to machine code before being executed by the computer. Unlike assembly language, each high-level language instruction may produce many machine code instructions. The emphasis of high-level procedure-oriented languages is on accomplishing a task. The programmer determines and controls the order in which the computer will process the instructions. The order of execution of these instructions is extremely important and should be well designed. A design methodology called top-down design is typically used with procedure-oriented programs. Top-down design begins with a general statement describing the purpose of the program. This purpose is then broken down into smaller, more manageable tasks, and eventually into the actual high-level procedure-oriented language instructions. Some popular procedure-oriented languages include COBOL, BASIC, Pascal, and C. High-level procedure-oriented languages are a vast improvement over machine and assembly languages.

Object-oriented languages view a problem solution as a set of interacting objects, where high-level procedure-oriented languages view the problem solution as a set of ordered steps. Like procedure-oriented languages, object-oriented languages require a compiler to convert the high-level instructions into machine code, and each high-level object-oriented language instruction may produce many machine language code instructions. Unlike procedure-oriented languages, with object-oriented languages a design methodology called OOD (Object-Oriented Design) is used. OOD, like top-down design, begins with a statement describing the purpose of the program, however unlike top-down design the programmer then divides the program into one or more objects. Objects in an object-oriented program may take on many forms, examples being menus, options buttons, and command buttons. Objects may also take on real-life meanings, such as an employee, date, and a time card. Some popular object-oriented languages include Visual Basic.NET, C++, and Java. One main advantage of object-oriented languages over procedure-oriented languages include allowing a programmer to use familiar objects to solve a problem. Then because these objects are viewed as independent units, they may be used in more than one application with little or no modification. Object-Oriented Programming Using C++, Object-Oriented Software, Object-Oriented language basics


Computer System Components

There are two basic computer system categories: 1) hardware and 2) software. Anything that you can touch or see is the hardware, such as the monitor, the computer case, all of the components inside the case, etc. The software is the instructions that run the computer applications.

1. Hardware components include:

  • central processing unit (CPU)
  • main memory (MM)
  • secondary storage
  • input/output devices

Central Processing Unit (CPU)--"computer brain":

  • CU (Control Unit):
    • Fetches and decodes instructions
    • Controls flow of information in and out of MM
    • Controls operation of internal CPU components
  • PC (program counter): points to next instruction to be executed
  • IR (instruction register): holds instruction currently being executed
  • ALU (arithmetic logic unit): carries out all arithmetic and logical operations
  • ACC (accumulator): holds results from ALU
Main Memory (RAM - volatile data):
  • Ordered sequence of cells (memory cells)
  • Directly connected to CPU
  • All programs load into main memory before execution
  • All data brought into main memory before any manipulation
  • When computer power turned off, all data in main memory is lost
Secondary storage ("permanent" data):
  • Hard disks
  • Floppy disks
  • Zip disks
  • CD/DVD-ROMs
  • Tapes
  • Flash/thumb/jump drives
Input/Output (I/O) Devices:
Input:
  • Keyboard
  • Mouse
  • Secondary storage
Output:
  • Monitor
  • Printer
  • Secondary storage
2. Software components include (programs that do specific tasks):
Two Types:
  1. System programs control the computer (i.e., operating system and services)

  2. Examples of operating system services:
    • Memory management
    • Input/output
    • Activities
    • Storage management
  3. Application programs perform a specific task (run by operating system)

  4. Examples of Application programs:
    • Word processors
    • Spreadsheets
    • Games

Language of a Computer

Machine language: language of a computer

  • Digital signals: sequences of 0s and 1s
  • Binary digit (bit): digit 0 or 1
  • Binary code: sequence of 0s and 1s
  • Byte: sequence of eight bits
    Binary Units
    Unit Symbol Bits/Bytes
    Byte 8 bits
    Kilobyte KB 210 bytes = 1024 bytes
    Megabyte MB 210 KB = 220 bytes
    Gigabyte GB 210 MB = 230 bytes
    Terabyte TB 210 GB = 240 bytes
All characters must be encoded into a specific code. For standardization, personal computers (PCs) use seven-bit American Standard Code for Information Interchange (ASCII). Each code actually takes 8 bits, but left-most bit is a 0. Using this scheme, character 'A' is represented as 1000001 or 01000001. The decimal equivalent of 1000001 is 65.

Coding Schemas:
ASCII (American Standard Code for Information Interchange):

  • 128 characters
  • A is encoded as 1000001 (66th character)
  • 3 is encoded as 0110011

Computer Programming Language Evolution

Programming Languages:

  • Early computers programmed in machine language
  • Assembly language instructions use mnemonics (easier)
    Assembler: translates program written in assembly language into machine language
  • High-level languages include: Basic, FORTRAN, COBOL, Pascal, C, C++, and Java
    Compiler: translates program written in high-level language into machine language
    Instruction Examples:
    Assembly Language vs. Machine Language
    Assembly Language Machine Language
    LOAD 100100
    STOR 100010
    MULT 100110
    ADD 100101
    SUB 100011
C++ Program Example:
                  /* This program demos a (very) small C++ program. Name: Date: Course: Algorithm (pseudocode): (used in some homework assignments) Also, be sure to document (comment) your code, see below.  compile: cl SampleProgram.cpp (VS.NET), or bcc32 SampleProgram.cpp (Borland) run: SampleProgram */  #include<iostream> using std::cout; //for cout using std::cin; //for cin using std::endl; //for endl  //initialize constants  //initialize global variables  //prototype functions  int main() {   //initialize local variables    cout << "My first C++ program." << endl;   cout << "The sum of 2 and 3 = "<< 5 << endl;   cout << "7 + 8 = " << 7 + 8 << endl;    cout << "\nPress Enter key to exit...";   cin.get();  // make DOS window stay open    return 0; }                Sample Run:        My first C++ program. The sum of 2 and 3 = 5 7 + 8 = 15      
Sample Program

Compiling and Running a C++ Program

Compiling Source Files and Running Programs:

Borland:

  1. Choose > Start > Run > Type cmd > OK
  2. Navigate to location of source file
    Example: cd c:\testcpp\deitel\ch1
  3. compile command:
    Example: bcc32 SampleProgram.cpp
  4. run command:
    Example: SampleProgram
VS.NET:
  1. Choose > Start > Programs > Microsoft Visual Studio .NET 2??? > Visual Studio .NET Tools > Visual Studio .NET 2??? Command Prompt
  2. Navigate to location of source file
    Example: cd c:\testcpp\deitel\ch1
  3. compile command:
    Example: cl SampleProgram.cpp
  4. run command:
    Example: SampleProgram
VS.NET command-line compiler

***When compiling, don't forget bcc32 (Borland) or cl (VS.NET), and .cpp file extension!
"cl" in VS.NET is lower-case "CL"
***When running, no need to add file exension.

Borland (notice title bar):
Compiling and  Running a C++ Program

VS.NET (notice title bar):
Compiling and  Running a C++ Program


Processing a Program

Code and execute program written in a high-level language (e.g., C++):

  1. Use text editor to create source program
  2. In C++, statements that begin with # symbol called preprocessor directives.
    Processed by program called preprocessor.
  3. Compiler:
    1. Checks program obeys rules (i.e., syntax, BUT not logic), AND...
    2. Translates program into machine language (object program)
  4. Linker: Combines object program with other programs (libraries) provided by SDK to create executable code (Software Development Kit (SDK) may be used to create a program)
  5. Loader: Loads executable program into main memory
  6. Last step: execute program
Processing a C++ Program

Programming Cycle

Problem Solving:

  • Programming requires problem solving:
    • Analyze problem
    • Outline problem requirements
    • Design steps (algorithm) to solve problem
  • Algorithm: Step-by-step solution to problem
Software Lifecycle:
  1. Analyze problem
  2. Design solution (algorithm - independent of language)
  3. Implement algorithm (code)
  4. Test code
  5. Maintenance (modify program when requirements change)

Structured Programming

Structured Design/Programming:

  • Structured design: Dividing problem into smaller subproblems
  • Structured programming: Implementing structured design
  • Structured design also called: top-down design, stepwise refinement, modular programming

Object-Oriented Programming

Object-Oriented Design (OOD)/Programming:

  • Identify objects
  • Specify data and operations to be performed on data
  • Each object consists of data and operations on data
  • Object combines data and operations on data into single unit
  • Programming language that implements OOD called object-oriented programming (OOP) language
  • C++ designed to implement Object-Oriented Design (OOD)
  • OOD is used with structured design

ANSI/ISO STANDARD C++

(Brief) History of C++:

  • C++ evolved from C
  • C++ designed by Bjarne Stroustrup (Father of C++) at Bell Laboratories in early 1980s
  • C++ programs were not always portable from one compiler to another
  • In early 1990s, joint committee--(American National Standard Institution (ANSI) and International Standard Organization (ISO)--established to standardize C++
  • ANSI/ISO standard C++ was officially approved in July, 1998
  • Most recent compilers are compatible with ANSI/ISO standard C++
  • For the most part, standard C++ and ANSI/ISO standard C++ are the same, but...
    ANSI/ISO Standard C++ has some features not available in Standard C++
  • C/C++ Reference

andrewsforood.blogspot.com

Source: https://www.cs.fsu.edu/~cop3014p/lectures/ch1/index.html

0 Response to "Assembly Language Uses Easy-to-remember Instructions Called ____________________."

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel