Definition of Terms
Program - a set of instructions that tells the computer to perform a particular task. Programming – refers to the process of designing and creating computer programs. Programming Language - a software tool that facilitates the translation of human instructions to a form that computers can understand. Programmer - a person who can design, create, and maintain computer programs. Algorithm - a step by step solution of a problem.
Levels of Programming Languages 1. High-level Languages - these are languages that are easy to learn and understand because of their english-like instructions or commands. Examples of languages that are under this category are COBOL, Visual BASIC, FoxPro, and HTML. 2. Middle-level Languages - these are languages that have the basic features of a high-level language and the functionalism of symbolic language like Assembly language. Example of language that is under this category is C++. 3. Symbolic Languages - these are languages that uses mnemonic codes in representing instructions or commands. Example of a language under this category is Assembly language. 4. Machine Language - a language more understandable to machine than to human. It uses a pattern of 0 and 1 to represent instructions.
Steps in Program Development 1. Understand the problem. Determine the input, output, and processing requirements of the program.
2. Create a solution that might solve the problem. Solution can be represented in a form of a flowchart, pseudocode, or narrative statement. 3. Translate the solution into a computer program using a programming language that you are very familiar with. 4. Encode the program. 5. Test and debug the program. 6. Document your program for future references. Must include: * Source Code * Data Structures used * Sample Output
What is Assembly Language ? Assembly Language is the fastest and most efficient programming language in any computer. It allows programmers to unravel and make use of the hardware’s features than any existing languages.
Advantages of Using Assembly Language 1. The executable code is smaller than those created in other programming languages. 2. Naturally, if the executable program is small, the program can be loaded in the computer memory faster. 3. Assembly language have a better control of the peripheral than other programming languages. 4. The executable code is more efficient than those created in other programming languages.
When To Use Assembly Language 1. To do something that is impossible or awkward with High-level language. 2. To speed-up a slow program. 3. To design a program to be as small as possible. 4. To control peripheral devices in a more efficient manner 5. For enjoyment.
The Assembly Language Programmer 1. Must have good organizational skills. 2. Must have that sort of personality that enjoys attending to details. 3. Must be able to read and understand reference manuals. 4. Needs good arithmetic skills, especially with other numbering systems like hexadecimal numbers. 5. Must be familiar with computer’s basic architecture. 6. Must have patience and persistence. 7. Must be obsessive.
Processing Assembly Language Programs
Softwares to be used: 1. Editors – refer to programs that can be used to create or edit assembly language programs. Programs like EDIT or NOTEPAD can be used for this purpose. Example: EDIT myprog.asm NOTEPAD myprog.asm 2. Assemblers – refers to programs that translate an assembly language program into its equivalent machine language program. Borland’s Turbo Assembler or Microsoft’s Micro Assembler can be used for this purpose. Example: TASM myprog MASM myprog 3. Linkers – refer to programs that produce executable program from a compiled assembly language program. Borland’s TLINK and Microsoft’s LINK can be used for this purpose.
Example:
TLINK myprog or LINK myprog
Creating a Batch Program for Compiling and Running Assembly Language Programs Steps: 1. Run Edit.com or Notepad.exe. 2. From editor window, type: c:\tasm\bin\tasm %1 c:\tasm\bin\tlink %1 %1 3. Save as T.Bat
Program Structure
;====================
; Program Name :
; Date Created:
; Author:
;====================
; Environment Settings .PROCESSOR .MODEL <type> .STACK <size in bytes >
;====================
; Variable Declaration Section .DATA < variable and constants >
;====================
; Main Program .CODE Start: ; Prepare DS register Mov AX, @Data Mov DS, AX ; Main Section <instruction> <instruction> ……. Exit: Mov AH, 4ch Int 21h End Start
Program Structure
Where:
.PROCESSOR is a keyword that tells the compiler to apply instruction set of the specified processor. Typical entries are: .286, .386, .and 486.
.STACK is a compiler-related command used when preparing the size of the stack in bytes.
.MODEL is a compiler-related instructions which specifies the size of the application. Typical sizes are: TINY, SMALL, LARGE, and HUGE
.DATA is a compiler-related instruction used to indicate the start of the DATA section.
.CODE is a compiler-related instruction used to indicate the start of the main program.
; is a symbol used when specifying program remarks or comments
Mov, Int , and End are examples of assembly language instructions
Example:
; ======================
; Program Nme: Print.ASM
; Date Created: June 28, 2011
; Author : Juan Dela Cruz
;=======================
DOSSEG . 286 .MODEL small .STACK 200
;=======================
.DATA txt DB “Computer$”
; ====================== .CODE Start: ; Prepare DS register Mov AX, @Data Mov DS,AX ; Main Section ; Print Text Mov AH,9 Lea DX, txt Int 21h Exit: Mov AH, 4ch Int 21h End Start
; ======================
I/O Instructions
Printing Text Mov AH, 9 Lea DX, <variable> Int 21h
where:
Mov - an instruction that assigns value to a variable or register.
Lea - an instruction that loads actual address of a variable to a register or another variable.
Int - is an instruction that calls a particular program. Such program maybe an OS program or program from ROM’s BIOS ( Basic I/O System )
Typical entries are: 10h and 21h <var_name> is a variable previously declared from the program’s data section that contains the text to be printed.
AH & DX are register names for accumulator and data register. When printing text AH must be set to 9.
Example:
Mov AH, 9 Lea DX, txt Int 21h
Accepting Character Inputs Mov AH, 1 Int 21h where: Mov - is an instruction that assigns value to a variable or register. Int -is an instruction that calls a particular program. Such program maybe an OS program or program from ROM’s BIOS ( Basic I/O System ) <var_name> is a variable previously declared from the program’s data section that will receive the inputted character. AH & AL are register names for accumulator.
*When accepting character inputs AH must be set to 1 or 7.
Example: a. Mov AH, 1 Int 21h b. Mov AH, 7 Int 21h Mov answer, AL
Clearing the screen
Mov AH, 6 Mov AL, 0 Mov BH, <color> Mov CH, <r1> Mov CL, <c1> Mov DH, <r2> Mov DL, <c2> Int 10h where:
<color> - an integer value representing the background color and foreground color to be applied for the section of screen to be erased. AH, AL,BH, CH,CL,DH,DL are register names for accumulator., count, data, and base registers. <r1> and <c1> screen coordinate that specifies the upper left corner of the section to be erased.
<r2> and <c2> screen coordinate that specifies the lower right corner of the section to be erased. Int 10h is the interrupt number to call a BIOS video proram that clears the screen.
Example: Mov AH, 6 Mov AL, 0 Mov BH, 15 Mov CH, 0 Mov CL, 0 Mov DH, 50 Mov DL, 79 Int 10h
Cursor Positioning Mov AH, 2 Mov BL, <page> Mov DH, <row> Mov DL, <col> Int 10h
where:
<page> is an integer value representing the page to be used.
AH, AL,BL, DH,DL are register names for accumulator., data, and base registers.
<row> and <col> screen coordinate that specifies the new position of the cursor.
Int 10h is the interrupt number to call a BIOS video program that clears the screen. Example: Mov AH, 2 Mov BH, 0 Mov DH, 10 Mov DL, 25 Int 10h Mov AH, 9 Lea DX , txt Int 21h
You May Also Find These Documents Helpful
-
The first language and its rules I will describe is Visual Basic. Visual Basic has a few different rules and they are described on Microsoft’s website in a document. This document is called (“Visual Basic Naming Rules”) and they read as such:…
- 878 Words
- 4 Pages
Good Essays -
3) A declarative language is a language in which you tell the computer what to do not how.…
- 360 Words
- 2 Pages
Satisfactory Essays -
The words that make up a high level programming language are known as what? Keywords…
- 738 Words
- 3 Pages
Good Essays -
A declarative language is a type of programming language where you describe what goal a task has, but without writing the code to accomplish the task. HTML, SQL and Prolog are all examples of declarative languages. Procedural programming is a list or set of instructions telling a computer what to do step by step and how to perform from the first code to the second code. Procedural programming languages include C, Go, Fortran, Pascal, and BASIC.…
- 383 Words
- 2 Pages
Good Essays -
Procedural language is a type of computer programming language that specifies a series of well-structured steps and procedures within its programming context to compose a program. It contains a systematic order of statements, functions and commands to complete a computational task or program. It is also known as imperative language. Advantages of procedural language is easy to read program code, easy maintainable program code as various procedures can be debugged in isolation, and code is more flexible as you can change a specific procedure that gets implemented across the program.…
- 240 Words
- 1 Page
Satisfactory Essays -
Language: May be spoken, written or signed. Sounds or symbols are grouped together to form meaningful words. Symbols or words are grouped together to form meaningful phrases.…
- 1800 Words
- 8 Pages
Good Essays -
Language: Something which is used in communication. This can be either in the written form or spoken form. Though this is not just verbal; language can refer to any form of communicating messages to one another in order to be understood, such as sign language and body language.…
- 925 Words
- 4 Pages
Good Essays -
* Language- Is a way in which you communicate with words or set of symbols that can be spoken, written or signed.…
- 1959 Words
- 8 Pages
Powerful Essays -
Language: names and words which describe things and join them together, different languages come from different regions or countries some are more similar to each other than others. Structured communication with rules that allow them to convey anything…
- 447 Words
- 2 Pages
Satisfactory Essays -
Language is a set of symbols either spoken; written or signed that can be used and understood between people. Language can be quit abstract. Linguist also suggest that the main feature of a language is a series of roles that users have to understand and use, at first children cannot use the rules, toddlers begin just pointing at an object and saying one word but after a while they start to learn how to construct sentences. Language can be a sound, signal or gesture.…
- 415 Words
- 2 Pages
Satisfactory Essays -
artificial intelligence (AI) - a computer or machine that has been created to think like a human.…
- 540 Words
- 3 Pages
Good Essays -
Language can be defined as being made up of socially shared rules that include the following:…
- 542 Words
- 3 Pages
Satisfactory Essays -
Copyright © 2012 Pearson Education, Inc. 0-5 Terminology • Machine instruction: An instruction (or command) encoded as a bit pattern d) d d tt recognizable by the CPU • Machine language: The set of all instructions recognized by a machine Copyright © 2012 Pearson Education, Inc. 0-6 3 Machine Language Philosophies • Reduced Instruction Set Computing (RISC) – Few, simple, efficient, and fast instructions – Examples: PowerPC from Apple/IBM/Motorola and ARM • Complex Instruction Set Computing (CISC) –…
- 783 Words
- 4 Pages
Satisfactory Essays -
The term language refers to an understood, systematic arrangement of signs, symbols and gestures used to communicate.…
- 1023 Words
- 30 Pages
Good Essays -
A language is a system for communicating ideas and feelings using sounds, conventional symbols, signs or marks. Any means of communicating ideas, specifically, human speech, and the expression of ideas by the voice and sounds and the written and spoken methods of combining words to create meaning used by a particular group of people. It is the code we all use to express ourselves and communicate to others..…
- 376 Words
- 2 Pages
Satisfactory Essays