EXPERIMENT NINE DEVELOPING MACRO SEQUENCES
|
|
- Aubrey McCarthy
- 6 years ago
- Views:
Transcription
1 EXPERIMENT NINE DEVELOPING MACRO SEQUENCES INTRODUCTION Although not essential to programming, macro sequences relieve the programmer of retyping the same instructions and also allow additional instructions to be placed into memory. This is also accomplished by using procedures and library files if desired. Macros also allow the creation of your own pseudo language for instruction sequences that often appear in programming. A macro is a roll-your-own instruction that contains any number of instructions and up to 32 parameters. The macro becomes a new instruction in the program that can be stored in a disk file and included in all programs if needed. OBJECTIVES 1. Develop macro sequences for common programming tasks such as reading a key or displaying data on the video display. 2. Show how parameters are carried to a macro sequence. 3. Organize macro sequences in a library of macros called an include file. 4. Use local variables in a macro sequence to access local data and jump addresses. PROCEDURE The macro sequence is developed by using the MACRO and statements provided by the assembler. The MACRO statement identifies the start of the macro sequence and the statement identifies the end. Associated with the MACRO sequence is the name of the macro and any parameters that are carried with the macro to the instructions between the MACRO and statements. Example 9-1 shows a simple macro sequence that displays a single character on the video display. Note how the MACRO and statement are used and also how a parameter is carried to the macro. Comments within macro sequences use double semicolons in place of single semicolons. It is important that the name of the macro sequence is a little different so it is not mistakenly used for a label in a program. The first letter of a label can begin with a letter (A-Z) or any of the following 4 special $, _, or?. In this text we use the (underscore) to start a macro. Microsoft suggests that symbol is reserved for future expansions. A dollar sign is used to represent the program counter, and a question mark seems awkward. 1
2 Example 9-1 _DISP MACRO P1 ;;identify start of _DISP macro MOV AH,2 ;;use function 2 to display P1 ;;identify the end of DISP To illustrate the operation of the _DISP macro, a program is written (see Example 9-2) that uses the _DISP macro to display various data on the video display. Note that the source program appears in Example 9-2 (a) and the assembled output is listed in Example 9-2 (b). All statements inserted by use of a macro are preceded by a number (1, 2, etc) to show that the statements are macro statements and to show the level of nesting. In this example, there are no nested macros, so a one is displayed to the left of each expanded macro instruction. Example 9-2 (a) CODE SEGMENT 'code' ;indicate start of code segment ASSUME CS:CODE ;identify CODE as CS _DISP MACRO P1 ;identify start of _DISP macro MOV AH,2 ;;use function 2 to display PI ;identify the end of _DISP PROC FAR ;start main program _DISP 'A' ;display the letter A _DISP 30H ;display the number 0 MOV BL,'Z' ;load BL with a letter Z _DISP BL ;display contents of BL MOV AX,4C00H ;exit to DOS CODE ENDP ENDS END Example 9-2 (b) 0000 CODE SEGMENT 'code' ;indicate start of code segment ASSUME CS:CODE ;identify CODE as CS _DISP MACRO P1 ;identify start of _DISP macro MOV AH,2 ;;use function 2 to display PI INT 21 H ;identify end of _DISP 2
3 0000 PROC FAR ;start main program _DISP 'A' ;display the letter A 0000 B MOV AH, B MOV DL,'A' 0004 CD 21 1 _DISP 30H ;display the number B MOV AH, B MOV DL,30H OOOA CD C B3 5A MOV BL,'Z' ;load BL with a letter Z _DISP BL ;display contents of BL OOOE B MOV AH, A D3 1 MOV DL,BL 0012 CD B8 4C00 MOV AX,4C00H ;exit to DOS 0017 CD ENDP 0019 CODE ENDS END STEP 1: Modify the program listed in Example 9-2 so it displays your name on the video display. Use the _DISP macro to display each letter of your name. Macros are often included in libraries of macros called include files that are loaded into the object program at assembly time. The include file is an ASCII text file created with PWB, but not assembled. In most cases, the file name extension.inc indicates an include file. To invoke an include file for use by a program, the INCLUDE directive is placed at the start of a program with the name of the macro file to include placed to its right. Example 9-3 shows the contents of a file called MACS.INC that contains four macros that are useful in developing programs. Two display data on the video display, one reads a key, and another exits to DOS. Note that this file is not assembled, it is only an ASCII text file that contains macros. Example 9-3 _DISP MACRO P1 ;display Pl macro MOV AH,2 _KEY MACRO ;read key with echo macro MOV AH,1 _STRING MACRO WHERE ;display string DS:DX macro MOV AH,9 3
4 MOV INT DX,OFFSET WHERE 21H _EXIT MACRO ;exit to DOS macro MOV AX,4C00H STEP 2: Store the macros listed in Example 9-3 in a file called MACS.INC. Place this in any directory of your choosing. Now write the program listed in Example 9-4, assemble it and execute it. Example 9-4 uses the MACS.INC file to access the video display, keyboard, and exit to DOS. Make sure to place the correct disk drive and directory with the include statement in Example 9-4. Example 9-4 CODE SEGMENT 'code' ;indicate start of code segment ASSUME CS:CODE ;identify CODE as CS INCLUDE MACS.INC ;include macro file MES1 DB 13,10,10,'Type any key to continue: $' PROC FAR ;start main procedure MOV AX,CS ;make DS = CS MOV DS,AX _STRING MES1 ;display MES1 _KEY ;read a key _DISP 13 ;display carriage return _DISP 10 ;display line feed _EXIT CODE ENDP ENDS END Notice the ease at which the program, in Example 9-4, is written because of the presence of macros and also notice its clarity. The code segment and data segment registers overlap the code and data segments in this example so a single segment is used for the program. This is accomplished by copying the contents of CS into DS. This is required in this program to display the character string MES1. This technique is often used in short programs. STEP 3: Write a program that uses the macro include file of Example 9-3 to display the ASCII contents of memory locations F800:0000 through and including F800:OOFF. Note that this is accomplished by addressing segment F800H with the DS register and then by addressing each location through an indirect register such as SI. An example is MOV AL,[SI] or if the _DISP macro is used directly, _DISP [SI]. Note that _DISP [SI] addresses byte-sized memory because of the way that the _DISP macro is written. Make 4
5 sure to display a few carriage return (13) /line feed (10) combinations before displaying the contents of memory with the STRING macro. In the space provide, write the information displayed when this program is executed. (In many cases this will display the name and address of the BIOS manufacturer.) Using local variables in macros. In many macros a jump must be made within a macro sequence. This requires the use of a local variable, defined with the LOCAL directive. Such a case is listed in the macro of Example 9-5. This macro reads a key from the keyboard without an echo. It ends with carry cleared for a standard ASCII character and with carry set for an extended ASCII character. The extended ASCII character set are characters with the codes 80H-FFH. In addition, it maintains a random number in register BP within the ranges passed to the macro as parameters LO and HI. Example 9-5 _KEYS MACRO LO,HI ; start macro LOCAL K1,K2,K3 ;identify local labels K1: MOV BP,LO-1 ;start BP at LO-1 K2: INC BP ;increment BP CMP BP,HI+1 ;test for above HI JE K1 ;if above HI MOV AH,6 ;read key, no echo MOV DL,-1 K3: JE K2 ; if no key typed OR AL,0 ;test for extended code JNE K3 ;regular ASCII code ;get extended ASCII code STC ;set carry In this example local variables are defined as K1, K2, and K3. It is very important that any variables used within a macro are defined as local. This allows the assembler to insert its own variables, which are unique for each local variable, each time that the macro is invoked. Variables inserted by the assembler are numbered and replace the local variables. STEP 4: Write a program that uses the macro (store the macro in your macro include file) of Example 9-5 to accept and the display random numbers between 1 and 9. Your program should display the character string prompt Press any key to display a random number: before invoking the _KEYS macro. Upon return from _KEYS, BP will contain a random number between 1 and 9 that is converted to an ASCII-coded number (31H-39H) by adding a 30H. This number is then displayed with the _DISP macro listed in Example 5
6 9-3. Repeat this program until the control plus C key (an ASCII 03H) is typed at the prompt. To type control plus C hold down the control key (Ctrl) and then press C. QUESTIONS 9-1. Which assembly language statements delineate a macro sequence? 9-2. How are parameters passed to a macro sequence? 9-3. Where can macro sequences be stored for inclusion in any program? 9-4. What is the purpose of the LOCAL directive? 9-5. What is the purpose of the INCLUDE directive? 9-6. Develop a macro sequence that displays a character string at any memory location. This requires that both the offset and segment addresses are passed to the macro as parameters Develop a macro sequence that identifies your software as yours. This macro must display your name, course number, and other information required to identify the software as yours Develop a macro called _CRLF that displays a carriage return and line feed combination. It may be wise to use the _DISP macro in this macro. This is called nesting. Note that the _DISP macro must appear before being used in the _CRLF macro How is a comment used within a macro sequence? Write a macro sequence that displays a character string that ends with a zero (00H) instead of the customary dollar sign (24H). The segment and offset addresses are parameters passed to this macro. 6
EXPERIMENT TWELVE: USING DISK FILES
EXPERIMENT TWELVE: USING DISK FILES INTRODUCTION Because just about any program ever written requires the use of a disk file to store or retrieve data, this experiment shows how to create, read, write,
More informationExperiment #5. Using BIOS Services and DOS functions Part 1: Text-based Graphics
Experiment #5 Using BIOS Services and DOS functions Part 1: Text-based Graphics 5.0 Objectives: The objective of this experiment is to introduce BIOS and DOS interrupt service routines to be utilized in
More informationExperiment 3 3 Basic Input Output
Experiment 3 3 Basic Input Output Introduction The aim of this experiment is to introduce the use of input/output through the DOS interrupt. Objectives: INT Instruction Keyboard access using DOS function
More informationLecture (09) x86 programming 8
Lecture (09) x86 programming 8 By: Dr. Ahmed ElShafee 1 Basic Input Output System BIOS BIOS refers to a set of procedures or functions that enable the programmer have access to the hardware of the computer.
More informationCOE 205 Lab Manual Experiment N o 12. Experiment N o Using the Mouse
Experiment N o 12 12 Using the Mouse Introduction The mouse is an I/O device that replaces the arrow keys on the keyboard for graphical and text style programs. This experiment shows how to add the mouse
More informationdb "Please enter up to 256 characters (press Enter Key to finish): ",0dh,0ah,'$'
PA4 Sample Solution.model large.stack 100h.data msg1 db "This programs scans a string of up to 256 bytes and counts the repetitions of the number 4206 and sums them.",0dh,0ah,'$' msg2 db "Please enter
More informationTransfer of Control. Lecture 10 JMP. JMP Formats. Jump Loop Homework 3 Outputting prompts Reading single characters
Lecture 10 Jump Loop Homework 3 Outputting prompts Reading single characters Transfer of Control The CPU loads and executes programs sequentially. You d like to be able to implement if statements, gotos,
More informationExperiment 8 8 Subroutine Handling Instructions and Macros
Introduction Experiment 8 8 Subroutine Handling Instructions and Macros In this experiment you will be introduced to subroutines and how to call them. You will verify the exchange of data between a main
More informationVideo processing The INT instruction enables program to interrupt its own processing. Use INT instruction to handle inputs and outputs
Video processing The INT instruction enables program to interrupt its own processing. Use INT instruction to handle inputs and outputs INT 10H: screen handling INT 21H: for displaying screen output and
More informationMemory Organization. 27 December 2016 Pramod Ghimire. Slide 1 of 21
Memory Organization Slide 1 of 21 The assembler uses two basic formats for developing software. One method uses memory models and the other uses fullsegment definitions. MASM uses memory models. The TASM
More informationAssembly Language: g Part III. First Semester 2013 Department of Computer Science Faculty of Science Chiang Mai University
System Programming with Assembly Language: g Part III First Semester 2013 Department of Computer Science Faculty of Science Chiang Mai University Outline A Few Basic Instructions Translation of high Level
More informationExperiment #2. Addressing Modes and Data Transfer using TASM
2.0 Objective Experiment #2 Addressing Modes and Data Transfer using TASM The objective of this experiment is to learn various addressing modes and to verify the actions of data transfer. 2.1 Introduction
More information16-bit MS-DOS and BIOS Programming
CS2422 Assem bly Language and System Programming 16-bit MS-DOS and BIOS Programming Department of Computer Science National Tsing Hua University Overview Chapter 13: 16-bit MS-DOS Programming MS-DOS and
More informationAssembly Language for Intel-Based Computers, 4 th Edition. Chapter 13: 16-Bit MS-DOS Programming
Assembly Language for Intel-Based Computers, 4 th Edition Kip R. Irvine Chapter 13: 16-Bit MS-DOS Programming (c) Pearson Education, 2002. All rights reserved. Chapter Overview MS-DOS and the IBM-PC MS-DOS
More information.code. lea dx,msg2. Page 1/8. Problem 1: Programming in Assembly [25 Points]
Problem : Programming in Assembly [ Points] The following assembly program is supposed to: receive three integer numbers from the console, call a function, name sort, function sort arranges the three input
More informationUNIT 4. Modular Programming
1 UNIT 4. Modular Programming Program is composed from several smaller modules. Modules could be developed by separate teams concurrently. The modules are only assembled producing.obj modules (Object modules).
More informationMicrocomputer Architecture..Second Year (Sem.2).Lecture(2) مدرس المادة : م. سندس العزاوي... قسم / الحاسبات
1) Input/output In computing, input/output or I/O, is the communication between an information processing system (such as a computer) and the outside world, possibly a human or another information processing
More informationQ1: Define a character string named CO_NAME containing "Internet Services" as a constant?
CS 321 Lab Model Answers ١ First Lab : Q1: Define a character string named CO_NAME containing "Internet Services" as a constant? ANS: CO_NAME EQU ' Internet Services' Q2: Define the following numeric values
More informationExperiment N o 8. String Handling Instructions
Experiment N o 8 String Handling Instructions Introduction: In this experiment you will deal with string handling instructions, such as reading a string, moving a string from one memory location to another,
More informationAssembling, Linking and Executing 1) Assembling: .obj obj .obj.lst .crf Assembler Types: a) One pass assembler:
Assembling, Linking and Executing 1) Assembling: - Assembling converts source program into object program if syntactically correct and generates an intermediate.obj file or module. - It calculates the
More informationCONTENTS. 1. Display a Message Display a one Digit Number Accept a Character from keyboard and display the character 4
University of Kashmir, North Campus Course Code Course Name Course Instructor MCA-104-DCE Assembly Language Programming Bilal Ahmad Dar CONTENTS 1. Display a Message 2 2. Display a one Digit Number 3 3.
More informationHow to write an assembly language program.
Copyright 1999 by Barry B. Brey How to write an assembly language program. Someone asked about this and, at first, I thought this was a very difficult question until I thought about it for a few minutes.
More informationELEC 242 Using Library Procedures
ELEC 242 Using Library Procedures There are a number of existing procedures that are already written for you that you will use in your programs. In order to use the library procedures that come with the
More informationAssembly Language for Intel-Based Computers, 4 th Edition
Assembly Language for Intel-Based Computers, 4 th Edition Kip R. Irvine Chapter 13: 16-Bit MS-DOS Programming Interrupts Slide show prepared by Kip R. Irvine, Revision date: 08/04/02 Modified by Dr. Nikolay
More informationINT 21H and INT 10H Programming and Macros
Dec Hex Bin 4 4 00000100 ORG ; FOUR INT 21H and INT 10H Programming and Macros OBJECTIVES this chapter enables the student to: Use INT 10H function calls to: Clear the screen. Set the cursor position.
More informationSPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY
BACKGROUND Segment The "SEGMENT" and "ENDS" directives indicate to the assembler the beginning and ending of a segment and have the following format label SEGMENT [options] ;place the statements belonging
More informationFACULTY OF ENGINEERING LAB SHEET
FACULTY OF ENGINEERING LAB SHEET ADVANCED MICROPROCESSORS ECE TRIMESTER (0/0) AM: Real- Mode Programming AM: Protected- Mode Programming *Note: On-the-spot evaluation may be carried out during or at the
More information8086 ALP TOOLS (CH 2) CHAPTER 2
1 CHAPTER 2 In this chapter, we shall discuss the Assembly Language Program development tools, PC memory structure and Assembler directives. Books to be Referred: 1. Microprocessors and Interfacing 2nd
More informationExperiment N o 3. Segmentation and Addressing Modes
Introduction: Experiment N o 3 Segmentation and Addressing Modes In this experiment you will be introduced to physical segmentation of the memory, and the logical segmentation of programs. You will also
More informationFACULTY OF ENGINEERING LAB SHEET
FACULTY OF ENGINEERING LAB SHEET ECE366: ADVANCED MICROPROCESSORS TRIMESTER (08/09) AM: Real- Mode Programming *Note: On-the-spot evaluation may be carried out during or at the end of the experiment. Students
More informationExperiment N o 3 Segmentation and Addressing Modes
Introduction: Experiment N o 3 Segmentation and Addressing Modes In this experiment you will be introduced to physical segmentation of the memory, and the logical segmentation of programs. You will also
More informationObjectives. Saving Interrupt Vectors. Writing a Custom Interrupt Handler. Examples of use of System functions for Input-Output and Interrupts
ICT106 Fundamentals of Computer Systems Week 11 Practical Examples of use of System functions for Input-Output and Interrupts Objectives To illustrate how to write interrupt service routine (ISR) for Intel
More informationEXPERIMENT 1. FAMILIARITY WITH DEBUG, x86 REGISTERS and MACHINE INSTRUCTIONS
EXPERIMENT 1 FAMILIARITY WITH DEBUG, x86 REGISTERS and MACHINE INSTRUCTIONS Pre-lab: This lab introduces you to a software tool known as DEBUG. Before the lab session, read the first two sections of chapter
More informationLABORATORY 8: USING BIOS ROUTINES FOR KEYBOARD INPUT AND DISPLAY OUTPUT
LABORATORY 8: USING BIOS ROUTINES FOR KEYBOARD INPUT AND DISPLAY OUTPUT NAME: STUDENT ID#: Objectives Learn how to: Use the read keyboard and display character BIOS routines. Display prompt messages on
More informationSPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY
BACKGROUND Interrupts The INT instruction is the instruction which does the most work in any assembler program. What it does is it calls a DOS interrupt (like a function) to perform a special task. When
More informationCS-202 Microprocessor and Assembly Language
CS-202 Microprocessor and Assembly Language Lecture 2 Introduction to 8086 Assembly Language Dr Hashim Ali Spring - 2019 Department of Computer Science and Engineering HITEC University Taxila!1 Lecture
More informationChapter 3: Addressing Modes
Chapter 3: Addressing Modes Chapter 3 Addressing Modes Note: Adapted from (Author Slides) Instructor: Prof. Dr. Khalid A. Darabkh 2 Introduction Efficient software development for the microprocessor requires
More informationEXPERIMENT WRITE UP. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM
EXPERIMENT WRITE UP AIM: Assembly language program to search a number in given array. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM
More informationWeek /8086 Microprocessor Programming II
Week 5 8088/8086 Microprocessor Programming II Quick Review Shift & Rotate C Target register or memory SHL/SAL 0 C SHR 0 SAR C Sign Bit 2 Examples Examples Ex. Ex. Ex. SHL dest, 1; SHL dest,cl; SHL dest,
More informationMr. Sapan Naik 1. Babu Madhav Institute of Information Technology, UTU
5 Years Integrated M.Sc.(IT) Semester 4 060010402 System Programming Question Bank Unit 1: Introduction 1. Write the decimal equivalent for each integral power of 2 from 2! to 2!". 2. Convert the following
More informationMarking Scheme. Examination Paper. Module: Microprocessors (630313)
Philadelphia University Faculty of Engineering Marking Scheme Examination Paper Department of CE Module: Microprocessors (630313) Final Exam Second Semester Date: 12/06/2017 Section 1 Weighting 40% of
More informationMicroprocessor. By Mrs. R.P.Chaudhari Mrs.P.S.Patil
Microprocessor By Mrs. R.P.Chaudhari Mrs.P.S.Patil Chapter 1 Basics of Microprocessor CO-Draw Architecture Of 8085 Salient Features of 8085 It is a 8 bit microprocessor. It is manufactured with N-MOS technology.
More informationIntel 8086: Instruction Set
IUST-EE (Chapter 6) Intel 8086: Instruction Set 1 Outline Instruction Set Data Transfer Instructions Arithmetic Instructions Bit Manipulation Instructions String Instructions Unconditional Transfer Instruction
More informationEC-333 Microprocessor and Interfacing Techniques
EC-333 Microprocessor and Interfacing Techniques Lecture 4 Addressing Modes Dr Hashim Ali Spring - 2018 Department of Computer Science and Engineering HITEC University Taxila Slides taken from Computer
More informationAssembly Language Lab #5
Islamic University of Gaza Computer Engineering Department 2009 Assembly Language Lab #5 Eng. Tahani Z. Fourah Islamic University of Gaza Lab 5 Addressing Modes The addressing modes are different ways
More informationMarking Scheme. Examination Paper Department of CE. Module: Microprocessors (630313)
Philadelphia University Faculty of Engineering Marking Scheme Examination Paper Department of CE Module: Microprocessors (630313) Final Exam Second Semester Date: 02/06/2018 Section 1 Weighting 40% of
More informationBabu Madhav Institute of Information Technology, UTU
5 Years Integrated M.Sc.(IT) Semester 4 060010309 : DSE3 Microprocessor Programming and Interfacing Question Bank 1. Write an assembly language program to check whether the given number is odd or even.
More informationAssembly Language Each statement in an assembly language program consists of four parts or fields.
Chapter 3: Addressing Modes Assembly Language Each statement in an assembly language program consists of four parts or fields. The leftmost field is called the label. - used to identify the name of a memory
More informationSRI VENKATESWARA COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF ECE EC6504 MICROPROCESSOR AND MICROCONTROLLER (REGULATION 2013)
SRI VENKATESWARA COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF ECE EC6504 MICROPROCESSOR AND MICROCONTROLLER (REGULATION 2013) UNIT I THE 8086 MICROPROCESSOR PART A (2 MARKS) 1. What are the functional
More informationCS401 - Computer Architecture and Assembly Language Programming Glossary By
CS401 - Computer Architecture and Assembly Language Programming Glossary By absolute address : A virtual (not physical) address within the process address space that is computed as an absolute number.
More informationCome and join us at WebLyceum
Come and join us at WebLyceum For Past Papers, Quiz, Assignments, GDBs, Video Lectures etc Go to http://www.weblyceum.com and click Register In Case of any Problem Contact Administrators Rana Muhammad
More informationCSCI516: Program 1 - October 11, 2010 The Program is due: October 25, 2010 in the beginning of the class
CSCI516: Program 1 - October 11, 2010 The Program is due: October 25, 2010 in the beginning of the class For Late Submissions 10 out of 100 points will be taken off. For your first program, you are to
More informationLecture 16: Passing Parameters on the Stack. Push Examples. Pop Examples. CALL and RET
Lecture 1: Passing Parameters on the Stack Push Examples Quick Stack Review Passing Parameters on the Stack Binary/ASCII conversion ;assume SP = 0202 mov ax, 124h push ax push 0af8h push 0eeeh EE 0E F8
More informationQ1: Define a character string named CO_NAME containing "Internet Services" as a constant?
CS 321 Lab Model Answers ١ First Lab : Q1: Define a character string named CO_NAME containing "Internet Services" as a constant? ANS: CO_NAME EQU ' Internet Services' Q2: Define the following numeric values
More informationEC 333 Microprocessor and Interfacing Techniques (3+1)
EC 333 Microprocessor and Interfacing Techniques (3+1) Lecture 6 8086/88 Microprocessor Programming (Arithmetic Instructions) Dr Hashim Ali Fall 2018 Department of Computer Science and Engineering HITEC
More informationProgramming in Module. Near Call
Programming in Module Main: sub1: call sub1 sub ax,ax sub1 sub1 proc near sub ax,ax endp sub1 sub1 proc Far sub ax,ax endp Near Call sub1 sub1 Main: call sub1 sub1: sub ax,ax proc near sub ax,ax endp SP
More informationAssignment no:4 on chapter no :3 : Instruction set of 8086
Assignment no:4 on chapter no :3 : Instruction set of 8086 1) Describe any two string operation instruction of 8086 with syntax & one example of each. 1] REP: REP is a prefix which is written before one
More informationUnit 5 DOS INTERRPUTS
Unit 5 DOS INTERRPUTS 5.1 Introduction The DOS (Disk Operating System) provides a large number of procedures to access devices, files and memory. These procedures can be called in any user program using
More informationADVANCE MICROPROCESSOR & INTERFACING
VENUS INTERNATIONAL COLLEGE OF TECHNOLOGY Gandhinagar Department of Computer Enggineering ADVANCE MICROPROCESSOR & INTERFACING Name : Enroll no. : Class Year : 2014-15 : 5 th SEM C.E. VENUS INTERNATIONAL
More informationBasic Assembly SYSC-3006
Basic Assembly Program Development Problem: convert ideas into executing program (binary image in memory) Program Development Process: tools to provide people-friendly way to do it. Tool chain: 1. Programming
More informationORG ; TWO. Assembly Language Programming
Dec 2 Hex 2 Bin 00000010 ORG ; TWO Assembly Language Programming OBJECTIVES this chapter enables the student to: Explain the difference between Assembly language instructions and pseudo-instructions. Identify
More informationExperiment 3. TITLE Optional: Write here the Title of your program.model SMALL This directive defines the memory model used in the program.
Experiment 3 Introduction: In this experiment the students are exposed to the structure of an assembly language program and the definition of data variables and constants. Objectives: Assembly language
More informationThe statement above assumes that the PCMAC.INC file is in the current directory. The full path of the file can also be given:
MACROS for I/O As you have probably noticed, writing DOS calls can become tedious. Much of the code is repetitive, and each call has its own function code and register usage. You are probably used to dealing
More informationLABORATORY WORK NO. 7 FLOW CONTROL INSTRUCTIONS
LABORATORY WORK NO. 7 FLOW CONTROL INSTRUCTIONS 1. Object of laboratory The x86 microprocessor family has a large variety of instructions that allow instruction flow control. We have 4 categories: jump,
More informationQ. State and Explain steps involved in program development. [w-08, w-10, s-12, w-11]
Q. State and Explain steps involved in program development. [w-08, w-10, s-12, w-11] Answer: 1. Defining Problem 2. Algorithm 3. Flowchart 4. Initialization of checklist 5. Choosing instructions 6. Converting
More informationΡουτίνες Λειτουργίας (DOS function calls)
Ρουτίνες Λειτουργίας (DOS function calls) Παρακάτω ακολουθεί µία λίστα αυτών των AH κωδικών µε τα ονόµατα της ρουτίνας λειτουργίας (DOS function calls). 00H 01H 02H 03H 04H 05H 06H 07H 08H 09H TERMINATE
More informationLecture 13: I/O I/O. Interrupts. How?
Lecture 13: I/O I/O Interrupts MS-DOS Function Calls Input,Output, File I/O Video Keyboard Getting data into your program: define it in the data area use immediate operands Very limiting Most programs
More informationThe registers(di,si) are automatically incremented or decremented depending on the value of the direction flag:
String Instructions String instructions were designed to operate on large data structures. The SI and DI registers are used as pointers to the data structures being accessed or manipulated. The operation
More informationIBM PC Hardware CPU 8088, Pentium... ALU (Arithmetic and Logic Unit) Registers. CU (Control Unit) IP.
IBM PC Hardware CPU 8088, 8086 80286 80386 80486 Pentium... ALU (Arithmetic and Logic Unit) Registers CU (Control Unit) IP Memory ROM BIOS I/O RAM OS Programs Video memory BIOS data Interrupt Vectors Memory
More informationKingdom of Saudi Arabia Ministry of Higher Education. Taif University. Faculty of Computers & Information Systems
Kingdom of Saudi Arabia Ministry of Higher Education Taif University Faculty of Computers & Information Systems المملكة العربية السعودية وزارة التعليم العالي جامعة الطاي ف آلية الحاسبات ونظم المعلومات
More informationELEC VIDEO BIOS ROUTINES
It is less confusing to the user if we remove unnecessary messages from the display before giving information or instructions. At the command prompt, we do this with the DOS command CLS. However, this
More informationVARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad
Introduction to MS-DOS Debugger DEBUG In this laboratory, we will use DEBUG program and learn how to: 1. Examine and modify the contents of the 8086 s internal registers, and dedicated parts of the memory
More informationTopics Introduction to Microprocessors. Chapter 5 Macros and modules. What is macro? How to use macro? (I) How to use macro?
Topics 2102440 Introduction to Microprocessors Macros Subroutines Modules Chapter 5 Macros and modules Suree Pumrin,, Ph.D. 1 2102440 Introduction to Microprocessors 2 What is macro? It is used to automate
More informationAssembly Language for Intel-Based Computers, 5 th Edition. Kip Irvine. Chapter 3: Assembly Language Fundamentals
Assembly Language for Intel-Based Computers, 5 th Edition Kip Irvine Chapter 3: Assembly Language Fundamentals Chapter Overview Basic Elements of Assembly Language Example: Adding and Subtracting Integers
More informationComputer Architecture and System Software Lecture 06: Assembly Language Programming
Computer Architecture and System Software Lecture 06: Assembly Language Programming Instructor: Rob Bergen Applied Computer Science University of Winnipeg Announcements Assignment 3 due thursday Midterm
More informationOverview: 1. Overview: 2
1: TITLE Binary equivalent of characters BINCHAR.ASM 3: Objective: To print the binary equivalent of 4: ASCII character code. 5: Input: Requests a character from keyboard. 6: Output: Prints the ASCII code
More informationWeek /8086 Microprocessor Programming
Week 5 8088/8086 Microprocessor Programming Multiplication and Division Multiplication Multiplicant Operand Result (MUL or IMUL) (Multiplier) Byte * Byte AL Register or memory Word * Word AX Register or
More informationPHY4635/5635 Spring Lecture 8: Program Control Instructions
PHY4635/5635 Spring 2009 Lecture 8: Program Control Instructions Short, Near and Far Jumps Short jump: jump is within +127 to -128 bytes from the address following the jump. Relative jumps : moves with
More informationAssembly Language Lab # 11 Kyboard input with int 16 & Macros
Faculty of Engineering Computer Engineering Department Islamic University of Gaza Assembly Language Lab # 11 Kyboard input with int 16 & Macros Eng AlaaIHaniya Assembly Language Fundamentals Part1: Bios
More informationHomework 2. Lecture 6: Machine Code. Instruction Formats for HW2. Two parts: How to do Homework 2!!!!
Lecture 6: Machine How to do Homework 2!!!! Homework 2 Two parts: Part 1: Use Debug to enter and run a simple machine code program convert input data into 2 s complement hex enter data at the correct address
More informationLab 10 CST8214 Ian! D. Allen Fall 2007
Name: Date: Lab Section: Lab partner s name: Lab PC Number: Objectives: Understanding video memory and character mapping of CGA characters in ROM BIOS, using the DOS debug command. Writing simple assembly
More informationChapter 3: Assembly Language Fundamentals. Cristina G. Rivera
Chapter 3: Assembly Language Fundamentals Cristina G. Rivera Basic Elements of Assembly Language Example: Adding and Subtracting Integers Assembling, Linking, and Running Programs Defining Data Symbolic
More informationEEM336 Microprocessors I. Data Movement Instructions
EEM336 Microprocessors I Data Movement Instructions Introduction This chapter concentrates on common data movement instructions. 2 Chapter Objectives Upon completion of this chapter, you will be able to:
More informationMicroprocessors (A) DOS Services
1 Services 2 System Calls Operating System services: Disk and file system management Screen display and printing Keyboard entry Other I/O management Date and time Program run and terminate Command arguments
More informationPESIT Bangalore South Campus
INTERNAL ASSESSMENT TEST 2 Date : 02/04/2018 Max Marks: 40 Subject & Code : Microprocessor (15CS44) Section : IV A and B Name of faculty: Deepti.C Time : 8:30 am-10:00 am Note: Note: Answer any five complete
More informationLAB WORK NO. 3 TURBO DEBUGGER ENVIRONMENT
LAB WORK NO. 3 TURBO DEBUGGER ENVIRONMENT 1. Objective of the lab work The purpose of this lab is to be able to debug programs written in assembly language and general executables, using a debugging tool.
More informationA4 Sample Solution Ch3
A4 Sample Solution Ch3 2. AL, AH, BL, BH,CL,CH,DLl, DH 3. AX, BX, CX, DX, SP, BP, SI, DI, CS, DS, ES, SS, FS, GS 4. EAX, EBX, ECX, EDX, ESP, EBP, EDI, ESI 5. RAX, RBX, RCX, RDX, RSP, RBP, RSI, RDI and
More informationEEM336 Microprocessors I. Addressing Modes
EEM336 Microprocessors I Addressing Modes Introduction Efficient software development for the microprocessor requires a complete familiarity with the addressing modes employed by each instruction. This
More informationPrograms for Assembly Language Programming
;Program to print lower case alphabets.stack 100 mov dl, 'a' mov cl, 26 print: mov ah, 02h inc dl loop print mov ah, 4ch Programs for Assembly Language Programming ;Program to printf upper case alphabets.stack
More informationELEC 242 Time Delay Procedure
There are many occasions where we wish to time events. If we are using a personal computer, we have a number of ways to do this. The 8088/8086 computer had a Programmable Interval Timer like the 8253/54
More informationProgramming in Assembler. Laboratory manual. Exercise 3
Zakład Mikroinformatyki i Teorii Automatów Cyfrowych Programming in Assembler Laboratory manual Exercise 3 Simple MS-DOS program assembling and debugging 2008,2011 Krzysztof Tokarz, Piotr Czekalski (edt.)
More informationComputer Architecture 1 ح 303
Lecture 4 A. Addressing MODES 1. Introduction to assembly language programming: Program is a sequence of commands used to tell a microcomputer what to do. Each command in a program is an instruction Programs
More informationAssembly Language for Intel-Based Computers, 4 th Edition. Chapter 3: Assembly Language Fundamentals
Assembly Language for Intel-Based Computers, 4 th Edition Kip R. Irvine Chapter 3: Assembly Language Fundamentals (c) Pearson Education, 2002. Chapter Overview Basic Elements of Assembly Language Example:
More informationTHE UNIVERSITY OF TRINIDAD & TOBAGO
THE UNIVERSITY OF TRINIDAD & TOBAGO FINAL ASSESSMENT/EXAMINATIONS DECEMBER 2012 Course Code and Title: Microprocessor Architecture & Interfacing Programme: Computer Engineering Technician Date and Time:
More informationPhiladelphia University Student Name: Student Number:
Philadelphia University Student Name: Student Number: Faculty of Engineering Serial Number: Final Exam, Second Semester: 2016/2017 Dept. of Computer Engineering Course Title: Microprocessors Date: 12/06/2017
More informationSHEET-2 ANSWERS. [1] Rewrite Program 2-3 to transfer one word at a time instead of one byte.
SHEET-2 ANSWERS [1] Rewrite Program 2-3 to transfer one word at a time instead of one byte. TITLE PROG2-3 PURPOSE: TRANSFER 6 WORDS OF DATA PAGE 60,132.MODEL SMALL.STACK 64.DATA ORG 10H DATA_IN DW 234DH,
More informationWeek /8086 Microprocessor Programming I
Week 4 8088/8086 Microprocessor Programming I Example. The PC Typewriter Write an 80x86 program to input keystrokes from the PC s keyboard and display the characters on the system monitor. Pressing any
More informationLABORATORY WORK NO. 8 WORKING WITH MACROS AND LIBRARIES
LABORATORY WORK NO. 8 WORKING WITH MACROS AND LIBRARIES 1. Object of laboratory Getting used to defining and using macros, procedure defining and using LIB library librarian. 2. Theoretical considerations
More information8086 Assembly Language Programming
of 28 7/6/2018 1:10 PM Tuesday, June 9, 2015 About Me 8086 Assembly Language Programming Assembly Language Programming is a low level programming language which is processor specific. It means it will
More informationAssembly Language for Intel-Based Computers, 5 th Edition. Chapter 3: Assembly Language Fundamentals
Assembly Language for Intel-Based Computers, 5 th Edition Kip Irvine Chapter 3: Assembly Language Fundamentals Slides prepared by the author Revision date: June 4, 2006 (c) Pearson Education, 2006-2007.
More information