Assembler Programming. Lecture 6
|
|
- Joanna Lawrence
- 6 years ago
- Views:
Transcription
1 Assembler Programming Lecture 6
2 Lecture 6 Full segment definitions. Procedures. Parameters. Modules.
3 Full segment definitions Complete control over segments. Control over segments order. Posibility of groupping segments.
4 SEGMENT directive name SEGMENT [[align]] [[READONLY]] [[combine]] [[use]] [[class]] Name the name of the segment. Align memory boundary of beginning. READONLY generate an error while modifying item in the segment. Combine how to combine segments. Use size of the segment (16 or 32 bit). Class segments of the same class are groupped together.
5 SEGMENT directive name SEGMENT [[align]] [[READONLY]] [[combine]] [[use]] [[class]] BYTE - Next available byte address. WORD - Next available word address. DWORD - Next available doubleword address. PARA - Next available paragraph address (16 bytes per paragraph). Default. PAGE - Next available page address (256 bytes per page).
6 SEGMENT directive name SEGMENT [[align]] [[READONLY]] [[combine]] [[use]] [[class]] Protects against illegal sefl-modyfying code. Assembler checks for the instructions that modify the segment. Generates an error if You attempt to write directly to read-only segment.
7 PRIVATE - Does not combine the segment with other segments, even if they have the same name. Default. PUBLIC - Concatenates all segments having the same name to form a single, contiguous segment. STACK - Concatenates all segments having the same name and set SS:SP to the top of the segment. COMMON - Overlaps segments. The length is the length of the largest of the combined segments. MEMORY - Used as a synonym for the PUBLIC. AT address - Assumes address as the segment location. SEGMENT directive name SEGMENT [[align]] [[READONLY]] [[combine]] [[use]] [[class]]
8 SEGMENT directive name SEGMENT [[align]] [[READONLY]] [[combine]] [[use]] [[class]] USE16 offset is 16-bit. USE32 offset is 32-bit. FLAT.
9 SEGMENT directive name SEGMENT [[align]] [[READONLY]] [[combine]] [[use]] [[class]] Two segments of the same name are not combined if their class is different. All segments with the same class are next to each other.
10 Controlling segment order.seq order in which segments are declared..alpha alphabetical order within a module..dosseq: Code segments, Data segments: Segments not in class BSS or STACK, BSS segments, STACK segments.
11 Defining segment group name GROUP Segment [[, segment ]] Collection of segments not greater than 64kB. Group example is DGROUP containing _DATA, _BSS, CONST and STACK segments. Name is the label of the group. Segment can be any segment name. Segment can t belong to more than one group. Does not affect segments order 16-bit and 32-bit segments can t be in the same group.
12 Groupping example MYGROUP GROUP ASEG, BSEG ; MYGROUP contains two two ; segments ASEG and and BSEG MYGROUP GROUP CSEG ; Adds the the CSEG segment into ; MYGROUP so so it it contains now now ; three segments ASSUME DS:MYGROUP ; DS DS refers to to MYGROUP mov mov AX,MYGROUP mov mov DS,AX
13 Assuming segment registers Many instructions work only on offset part of the adress. They assume they work in default segment. Assembler must know what segment contains the address. ASSUME directive.
14 ASSUME directive ASSUME segregister : seglocation Segregister is the name of the segment register. Seglocation must be the name of the segment or the group. CS is automatically assumed with code segment. ASSUME affects only assembler not the processor, You should set values of segment registers with instructions.
15 ASSUME directive ASSUME ASSUME segregister : seglocation [,segregister : seglocation] ASSUME ASSUME datareg : qualifiedtype [, [, datareg : qualifiedtype] ASSUME ASSUME register : ERROR ERROR [, [, register : ERROR] ERROR] ASSUME ASSUME [register :] :] NOTHING [, [, register : NOTHING] ASSUME ASSUME register : FLAT FLAT [, [, register : FLAT] FLAT] NOTHING cancels the assumptions. ERROR prevents the use of register.
16 Full definitions example Staseg StasegSEGMENT STACK STACK Staseg Staseg ENDS ENDS Dtaseg Dtaseg SEGMENT ; Place Place variables here here Dtaseg Dtaseg ENDS ENDS Codseg Codseg SEGMENT ASSUME ASSUME DS:Dtaseg, SS:Staseg mov mov AX,Dtaseg mov mov DS,AX DS,AX ; Place Place program here here Codseg Codseg ENDS ENDS END END
17 Procedures Divide large programs into manageable units. Allow separate testing. Make code more efficient for repetitive tasks. Make easier using code in future applications.
18 Procedure definition PROC directive starts the procedure. ENDP directive ends the procedure. Additionally, PROC can automatically: Preserve register values that should not change but that the procedure might otherwise alter. Set up a local stack pointer, so that you can access parameters and local variables placed on the stack. Adjust the stack when the procedure ends.
19 Procedure definition example My_proc PROC FAR ret My_proc ENDP RET [constant] instruction.
20 Procedure calling CALL instruction Pushes the address of the next instruction on the stack. Passes control to a specified address. Address can be label, register or memory. Operand is calculated at run time. Calls can be near or far.
21 Procedure definition Procedures can be nested My_proc PROC NEAR... Your_prc PROC NEAR... ret Your_prc ENDP... ret My_proc ENDP
22 Procedure definition without PROC and ENDP NEAR procedures: Call NEAR PTR My_proc Call NEAR PTR Your_prc My_proc: retn Your_prc LABEL NEAR retn
23 Procedure definition without PROC and ENDP FAR procedures: Call FAR PTR My_proc My_proc LABEL FAR retf
24 Parameters of the procedure Parameters can be passed to the procedure: Through the registers. Through the common memory (variables). Through the stack. Mixed. Extended PROC syntax allows passing parameters automatically.
25 Extended PROC syntax label PROC [[attributes]] [[USES reglist]] [[Parameter[[:tag]]...]] Automates accessing arguments and saving registers. Attributes distance, langtype and visibility, Reglist list of registers that should be saved, Parameter list of parameters passed to the procedure on the stack. Label is the name of the procedure PROC is a required keyword
26 Extended PROC syntax label PROC [[attributes]] [[USES reglist]] [[Parameter[[:tag]]...]] [[distance]] [[langtype]] [[visibility]] [[<prologuearg>]] Distance NEAR or FAR, for 386 also NEAR16, NEAR32, FAR16, FAR32. Langtype BASIC, FORTRAN, PASCAL, C, STDCALL or SYSCALL.
27 Extended PROC syntax label PROC [[attributes]] [[USES reglist]] [[Parameter[[:tag]]...]] [[distance]] [[langtype]] [[visibility]] [[<prologuearg>]] Visibility PRIVATE, PUBLIC, EXPORT. Prologuearg LOADDS, FORCEFRAME.
28 Extended PROC syntax label PROC [[attributes]] [[USES reglist]] [[Parameter[[:tag]]...]] Reglist: Must be separated by spaces or tabs Assembler generates prologue code to push registers on the stack. Assembler generates epilogue code to pop the saved registers off the stack.
29 Extended PROC syntax label PROC [[attributes]] [[USES reglist]] [[Parameter[[:tag]]...]] List of parameters. Parameter - parmname [[:tag]] Parmname is the name of the parameter. Tag is the qualifier of type of the parameter. Tag can be the VARARG keyword for procedures with variable number of parameters.
30 Procedure parameters example My_add PROC NEAR C, arg1:word, arg2:word, count:word mov ax, arg1 add ax, count add ax, arg2 ret My_add ENDP
31 LOCAL directive. Local variables Creates local variables on the stack. Must be on the line following the PROC statement. Syntax of LOCAL directive: LOCAL vardef [[, vardef]]... Each vardef represents one local variable: Label [[ [count] ]] [[:type]]
32 Local variable example My_proc PROC NEAR arg:word LOCAL loc:word.. mov loc, 3 ; Initialize local variable add ax, loc ; Add local variable to to AX AX sub arg, ax ax ; Subtract local from arg.. ret My_proc ENDP
33 Procedure prototypes PROTO directive. The same function as in other HLL. Includes name, types and names of parameters. Enable the assembler to check for unmatched parameters. Useful for procedures called from other modules and other languages.
34 INVOKE directive Automatically pushes arguments onto the stack. Procedure must be declared previously. Generates a sequence of instructions that: Converts arguments to the expected types. Pushes arguments on the stack in the correct order. Calls the procedure. Cleans the stack when the procedure returns.
35 Prototype and invoking example. My_proc PROTO NEAR, C argcount:word, arg1:word, arg2:word My_proc PROC NEAR, C argcount:word, arg2:word, arg3:word... My_proc ENDP INVOKE My_proc, ax, x, x, y
36 Program modules Big projects can be divided into modules. Modules can be libraries for other languages. Symbols that have to be used in other modules must be visible in theese modules. Twomethods: With include file. Without include file.
37 Include files Can contain any MASM statement. If used in more than one module can t contain statements that define and allocate memory for symbols. INCLUDE directive: INCLUDE filename Filename must be fully specified (with the extension).
38 Modules with include file EXTERNDEF directive Public in the defining module External in referencing modules For variables and procedures COMM (communal) As EXTERNDEF but are allocated by linker Can t be initialized For variables PROTO For procedures Automatically issues EXTERNDEF
39 Include file example Include prcmod.inc My_proc PROTO NEAR, C argcount:word, arg1:word, arg2:word My_proc PROC NEAR, C argcount:word, arg2:word, arg3:word My_proc ENDP Include prcmod.inc My_proc PROTO NEAR, C argcount:word, arg1:word, arg2:word INVOKE My_proc, ax, ax, x, x, y
40 PUBLIC Modules without include file Makes a name visible outside the module in which it is defined. Must appear in defining module. EXTERN Referenced name is defined and declared public in another module. PUBLIC and EXTERN work with variables and procedures
41 PUBLIC and EXTERN example.model small, Pascal PUBLIC Build_table, Var Var LABEL FAR FAR DATA Var Var BYTE CODE Build_table PROC USES cx, cx, dx, dx, sizevar:word ret ret Build_table ENDP EXTERN Var:BYTE, Build_table:FAR mov mov al, al, Var Var call Build_table......
Assembler Programming. Lecture 10
Assembler Programming Lecture 10 Lecture 10 Mixed language programming. C and Basic to MASM Interface. Mixed language programming Combine Basic, C, Pascal with assembler. Call MASM routines from HLL program.
More informationThe Stack. Lecture 15: The Stack. The Stack. Adding Elements. What is it? What is it used for?
Lecture 15: The Stack The Stack What is it? What is it used for? A special memory buffer (outside the CPU) used as a temporary holding area for addresses and data The stack is in the stack segment. The
More informationObjectives. ICT106 Fundamentals of Computer Systems Topic 8. Procedures, Calling and Exit conventions, Run-time Stack Ref: Irvine, Ch 5 & 8
Objectives ICT106 Fundamentals of Computer Systems Topic 8 Procedures, Calling and Exit conventions, Run-time Stack Ref: Irvine, Ch 5 & 8 To understand how HLL procedures/functions are actually implemented
More informationStack -- Memory which holds register contents. Will keep the EIP of the next address after the call
Call without Parameter Value Transfer What are involved? ESP Stack Pointer Register Grows by 4 for EIP (return address) storage Stack -- Memory which holds register contents Will keep the EIP of the next
More informationIslamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB. Lab # 10. Advanced Procedures
Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB Lab # 10 Advanced Procedures May, 2014 1 Assembly Language LAB Stack Parameters There are
More informationProcedures and the Stack. Chapter 4 S. Dandamudi
Procedures and the Stack Chapter 4 S. Dandamudi Outline What is stack? Pentium implementation of stack Pentium stack instructions Uses of stack Procedures Assembler directives Pentium instructions Parameter
More informationSegmentation in Assembly Language Programming
1 2 Segmentation in General Segmentation in Assembly Language Programming UNIX programs have 3 segments Text segment Executable machine instructions Data segment Initialized data BSS segment (Block Started
More informationComputer Architecture and System Software Lecture 07: Assembly Language Programming
Computer Architecture and System Software Lecture 07: Assembly Language Programming Instructor: Rob Bergen Applied Computer Science University of Winnipeg Announcements New assembly examples uploaded to
More informationAssembly Language Programming: Procedures. EECE416 uc. Charles Kim Howard University. Fall
Assembly Language Programming: Procedures EECE416 uc Charles Kim Howard University Fall 2013 www.mwftr.com Before we start Schedule of the next few weeks T Nov 19: Procedure and Calls (continued) R Nov
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 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 informationUsing Addresses and Pointers
53 CHAPTER 3 Using Addresses and Pointers MASM applications running in real mode require segmented addresses to access code and data The address of the code or data in a segment is relative to a segment
More informationEECE.3170: Microprocessor Systems Design I Summer 2017 Homework 4 Solution
1. (40 points) Write the following subroutine in x86 assembly: Recall that: int f(int v1, int v2, int v3) { int x = v1 + v2; urn (x + v3) * (x v3); Subroutine arguments are passed on the stack, and can
More informationReverse Engineering II: Basics. Gergely Erdélyi Senior Antivirus Researcher
Reverse Engineering II: Basics Gergely Erdélyi Senior Antivirus Researcher Agenda Very basics Intel x86 crash course Basics of C Binary Numbers Binary Numbers 1 Binary Numbers 1 0 1 1 Binary Numbers 1
More informationMating Assembly with C
16 Do to others what you want them to do to you. Mating Assembly with C Nothing can beat the efficiency of Assembly language. A good optimizing C compiler will convert C file to a better assembly code.
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 informationReverse Engineering II: The Basics
Reverse Engineering II: The Basics Gergely Erdélyi Senior Manager, Anti-malware Research Protecting the irreplaceable f-secure.com Binary Numbers 1 0 1 1 - Nibble B 1 0 1 1 1 1 0 1 - Byte B D 1 0 1 1 1
More informationSummer 2003 Lecture 15 07/03/03
Summer 2003 Lecture 15 07/03/03 Initialization of Variables In the C (or C++) programming language any variable definition can have an optional initializer for the variable. How and when the initialization
More informationUNIVERSITY OF CALIFORNIA, RIVERSIDE
Final Page 1 of 7 UNIVERSITY OF CALIFORNIA, RIVERSIDE Computer Science Department CS61 Machine Organization & Assembly Language Final September 1, 2000 53 Name: Solution Key Student ID#: Please print legibly
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 informationParameter Passing. Procedure line. Calling procedure line. Most subroutines require parameters Can sometimes pass parameters via registers
Parameter Passing Most subroutines require parameters Can sometimes pass parameters via registers Assume subroutine line will compute the value: y = m*x + b where m,x,b are signed byte values, and y is
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 information16.317: Microprocessor Systems Design I Fall 2013
16.317: Microprocessor Systems Design I Fall 2013 Exam 2 Solution 1. (20 points, 5 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by circling
More informationScott M. Lewandowski CS295-2: Advanced Topics in Debugging September 21, 1998
Scott M. Lewandowski CS295-2: Advanced Topics in Debugging September 21, 1998 Assembler Syntax Everything looks like this: label: instruction dest,src instruction label Comments: comment $ This is a comment
More informationSummer 2003 Lecture 14 07/02/03
Summer 2003 Lecture 14 07/02/03 LAB 6 Lab 6 involves interfacing to the IBM PC parallel port Use the material on wwwbeyondlogicorg for reference This lab requires the use of a Digilab board Everyone should
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 informationIslamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB. Lab # 7. Procedures and the Stack
Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB Lab # 7 Procedures and the Stack April, 2014 1 Assembly Language LAB Runtime Stack and Stack
More informationCS 480 Fall Runtime Environments. Mike Lam, Professor. (a.k.a. procedure calls and heap management)
CS 480 Fall 2015 Mike Lam, Professor Runtime Environments (a.k.a. procedure calls and heap management) Subprograms General characteristics Single entry point Caller is suspended while subprogram is executing
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 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 informationReverse Engineering II: The Basics
Reverse Engineering II: The Basics This document is only to be distributed to teachers and students of the Malware Analysis and Antivirus Technologies course and should only be used in accordance with
More informationProgram Control Instructions
Program Control Instructions Introduction This chapter explains the program control instructions, including the jumps, calls, returns, interrupts, and machine control instructions. This chapter also presents
More informationCSC 2400: Computer Systems. Using the Stack for Function Calls
CSC 24: Computer Systems Using the Stack for Function Calls Lecture Goals Challenges of supporting functions! Providing information for the called function Function arguments and local variables! Allowing
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 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 informationG Programming Languages - Fall 2012
G22.2110-003 Programming Languages - Fall 2012 Lecture 4 Thomas Wies New York University Review Last week Control Structures Selection Loops Adding Invariants Outline Subprograms Calling Sequences Parameter
More informationCSC 2400: Computer Systems. Using the Stack for Function Calls
CSC 24: Computer Systems Using the Stack for Function Calls Lecture Goals Challenges of supporting functions! Providing information for the called function Function arguments and local variables! Allowing
More informationCSC 8400: Computer Systems. Using the Stack for Function Calls
CSC 84: Computer Systems Using the Stack for Function Calls Lecture Goals Challenges of supporting functions! Providing information for the called function Function arguments and local variables! Allowing
More informationComputer Organization & Assembly Language Programming. CSE 2312 Lecture 15 Addressing and Subroutine
Computer Organization & Assembly Language Programming CSE 2312 Lecture 15 Addressing and Subroutine 1 Sections in 8088 Code TEXT section, for the processor instructions. DATA section for the initialization
More informationAssembly Language for Intel-Based Computers, 4 th Edition. Chapter 8:Advanced Procedures
Assembly Language for Intel-Based Computers, 4 th Edition Kip R. Irvine Chapter 8:Advanced Procedures (c) Pearson Education, 2002. All rights reserved. Chapter Overview Local Variables Stack Parameters
More informationQuestion Bank Part-A UNIT I- THE 8086 MICROPROCESSOR 1. What is microprocessor? A microprocessor is a multipurpose, programmable, clock-driven, register-based electronic device that reads binary information
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 First Semester Date: 30/01/2018 Section 1 Weighting 40% of the
More informationLab 3: Defining Data and Symbolic Constants
COE 205 Lab Manual Lab 3: Defining Data and Symbolic Constants - page 25 Lab 3: Defining Data and Symbolic Constants Contents 3.1. MASM Data Types 3.2. Defining Integer Data 3.3. Watching Variables using
More information6/29/2011. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to:
Chapter 6: Program Control Instructions Introduction This chapter explains the program control instructions, including the jumps, calls, returns, interrupts, and machine control instructions. This chapter
More informationEE 314 Spring 2003 Microprocessor Systems
EE 314 Spring 2003 Microprocessor Systems Laboratory Project #3 Arithmetic and Subroutines Overview and Introduction Review the information in your textbook (pp. 115-118) on ASCII and BCD arithmetic. This
More informationAdvanced Procedures. Computer Organization and Assembly Languages Yung-Yu Chuang 2005/11/24. with slides by Kip Irvine
Advanced Procedures Computer Organization and Assembly Languages Yung-Yu Chuang 2005/11/24 with slides by Kip Irvine Announcements Assignment #2 due today by midnight. Assignment #3 due on 12/6 (Tue) midnight.
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 information22 Assembly Language for Intel-Based Computers, 4th Edition. 3. Each edge is a transition from one state to another, caused by some input.
22 Assembly Language for Intel-Based Computers, 4th Edition 6.6 Application: Finite-State Machines 1. A directed graph (also known as a diagraph). 2. Each node is a state. 3. Each edge is a transition
More informationEECE416 :Microcomputer Fundamentals and Design. X86 Assembly Programming Part 1. Dr. Charles Kim
EECE416 :Microcomputer Fundamentals and Design X86 Assembly Programming Part 1 Dr. Charles Kim Department of Electrical and Computer Engineering Howard University www.mwftr.com 1 Multiple Address Access
More information16.317: Microprocessor Systems Design I Fall 2015
16.317: Microprocessor Systems Design I Fall 2015 Exam 2 Solution 1. (16 points, 4 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by circling
More informationHLA v2.0 Intermediate Code Design Documentation
HLA v2.0 Intermediate Code Design Documentation This document describes the internal format of HLA v2.0s intermediate code that the code generator uses. This document assumes that the reader is familiar
More informationAssembly Language. Lecture 3 Assembly Fundamentals
Assembly Language Lecture 3 Assembly Fundamentals Ahmed Sallam Slides based on original lecture slides by Dr. Mahmoud Elgayyar General Concepts CPU Design, Instruction execution cycle IA-32 Processor Architecture
More informationRun-time Environments. Lecture 13. Prof. Alex Aiken Original Slides (Modified by Prof. Vijay Ganesh) Lecture 13
Run-time Environments Lecture 13 by Prof. Vijay Ganesh) Lecture 13 1 What have we covered so far? We have covered the front-end phases Lexical analysis (Lexer, regular expressions,...) Parsing (CFG, Top-down,
More informationAssembly Language for Intel-Based Computers, 4 th Edition
Assembly Language for Intel-Based Computers, 4 th Edition Kip R Irvine Chapter 5: Procedures Lecture 19: Procedures Procedure s parameters Slides prepared by Kip R Irvine Revision date: 08/22/2002 Modified
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 informationOlder geometric based addressing is called CHS for cylinder-head-sector. This triple value uniquely identifies every sector.
Review: On Disk Structures At the most basic level, a HDD is a collection of individually addressable sectors or blocks that are physically distributed across the surface of the platters. Older geometric
More informationAssembly Language for Intel-Based Computers, 4 th Edition. Lecture 25: Interface With High-Level Language
Assembly Language for Intel-Based Computers, 4 th Edition Kip R. Irvine Lecture 25: Interface With High-Level Language Slide show prepared by Kip R. Irvine, Revision date: 07/07/2002 Modified on April
More informationLab 2: Introduction to Assembly Language Programming
COE 205 Lab Manual Lab 2: Introduction to Assembly Language Programming - page 16 Lab 2: Introduction to Assembly Language Programming Contents 2.1. Intel IA-32 Processor Architecture 2.2. Basic Program
More informationProcedures: Advanced Topics Chapter 12
Thi d t t d ith F M k 4 0 2 Procedures: Advanced Topics Chapter 12 The last chapter described how to create procedures, pass parameters, and allocate and access local variables. This chapter picks up where
More informationConstants and. Lecture 7: Assembly Language Programs. Expressions (cont.) Constants and. Statements. Expressions
Lecture 7: Assembly Language Programs Basic elements of assembly language Assembler directives Data allocation directives Data movement instructions Assembling, linking, and debugging Using TASM Constants
More informationUMBC. contain new IP while 4th and 5th bytes contain CS. CALL BX and CALL [BX] versions also exist. contain displacement added to IP.
Procedures: CALL: Pushes the address of the instruction following the CALL instruction onto the stack. RET: Pops the address. SUM PROC NEAR USES BX CX DX ADD AX, BX ADD AX, CX MOV AX, DX RET SUM ENDP NEAR
More informationAssembly Language. Dr. Esam Al_Qaralleh CE Department Princess Sumaya University for Technology. Overview of Assembly Language
4345 Assembly Language Assembly Language Dr. Esam Al_Qaralleh CE Department Princess Sumaya University for Technology Assembly Language 3-1 Overview of Assembly Language Advantages: Faster as compared
More informationAssembly Language Programming
Experiment 3 Assembly Language Programming Every computer, no matter how simple or complex, has a microprocessor that manages the computer s arithmetical, logical and control activities. A computer program
More informationG Programming Languages Spring 2010 Lecture 4. Robert Grimm, New York University
G22.2110-001 Programming Languages Spring 2010 Lecture 4 Robert Grimm, New York University 1 Review Last week Control Structures Selection Loops 2 Outline Subprograms Calling Sequences Parameter Passing
More informationWriting 32-Bit Applications
335 CHAPTER 13 Writing 32-Bit Applications This chapter is an introduction to 32-bit programming for the 80386. The guidelines in this chapter also apply to the 80486 processor, which is basically a faster
More informationFunction Calls COS 217. Reading: Chapter 4 of Programming From the Ground Up (available online from the course Web site)
Function Calls COS 217 Reading: Chapter 4 of Programming From the Ground Up (available online from the course Web site) 1 Goals of Today s Lecture Finishing introduction to assembly language o EFLAGS register
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 informationAssembly Language for Intel-Based Computers, 5 th Edition
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 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 informationBAHAR DÖNEMİ MİKROİŞLEMCİLER LAB3 FÖYÜ
INTRODUCTION OF SEGMENT A typical program on 8086 consists of at least three segments Code segment: Contains instructions that accomplish certain tasks Data segment: Stores information to be processed
More informationIA-32 Architecture. CS 4440/7440 Malware Analysis and Defense
IA-32 Architecture CS 4440/7440 Malware Analysis and Defense Intel x86 Architecture } Security professionals constantly analyze assembly language code } Many exploits are written in assembly } Source code
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 informationWriting a Dynamic-Link Library For Windows
257 CHAPTER 10 Writing a Dynamic-Link Library For Windows The Windows operating system relies heavily on service routines and data contained in special libraries called dynamic-link libraries, or DLLs
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 informationINTRODUCTION. NOTE Some symbols used in this manual CL = Click Left CR = Click Right DCL = Double Click Left = Enter. Page 1
INTRODUCTION OBJECTIVE The purpose of this manual is to provide the student with practical experience in the writing of assembly language programs, and give them background and instructions on how to use
More informationCNIT 127: Exploit Development. Ch 1: Before you begin. Updated
CNIT 127: Exploit Development Ch 1: Before you begin Updated 1-14-16 Basic Concepts Vulnerability A flaw in a system that allows an attacker to do something the designer did not intend, such as Denial
More informationEXPERIMENT 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 informationCS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 21: Generating Pentium Code 10 March 08
CS412/CS413 Introduction to Compilers Tim Teitelbaum Lecture 21: Generating Pentium Code 10 March 08 CS 412/413 Spring 2008 Introduction to Compilers 1 Simple Code Generation Three-address code makes it
More informationAn Introduction to x86 ASM
An Introduction to x86 ASM Malware Analysis Seminar Meeting 1 Cody Cutler, Anton Burtsev Registers General purpose EAX, EBX, ECX, EDX ESI, EDI (index registers, but used as general in 32-bit protected
More informationSubprograms: Local Variables
Subprograms: Local Variables ICS312 Machine-Level and Systems Programming Henri Casanova (henric@hawaii.edu) Local Variables in Subprograms In all the examples we have seen so far, the subprograms were
More informationclean way to do separate compilation. ECS140A Programming Languages 12-1
Modularization separate program into different modules. motivation: separate major portions of code. improves maintainability. increases potential for reusability. e.g., scanner, parser, symbol table.
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 information16.317: Microprocessor Systems Design I Spring 2015
16.317: Microprocessor Systems Design I Spring 2015 Exam 2 Solution 1. (16 points, 4 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by
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 informationDr. D.M. Akbar Hussain
1 2 Compiler Construction F6S 1 3 4 Compiler Construction F6S 2 5 6 Compiler Construction F6S 3 7 8 Compiler Construction F6S 4 a=b*- c + b*- c 9 a=b*- c + b*- c 10 Compiler Construction F6S 5 a=b*- c
More informationAssembler Programming. Lecture 12
Assembler Programming Lecture 12 Lecture 12 Writting Windows 32 applications. Writting dynamic libraries. One memory model: flat, there are no segments. Some theory Programs run in protected mode. Registers
More informationCSE 505 Lecture 8: Introduction to Assembly Language
Page1 Advantages of Assembly Language Low-level access to the computer Higher speed Total control over CPU (Must know what you are doing in order to make these advantages work) Disadvantages of assembly
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 informationEECE.3170: Microprocessor Systems Design I Summer 2017
EECE.3170: Microprocessor Systems Design I Summer 2017 Lecture 8: Key Questions June 5, 2017 1. (Review) Describe the structure of a typical x86 stack frame. EECE.3170: Microprocessor Systems Design I
More informationModule 3 Instruction Set Architecture (ISA)
Module 3 Instruction Set Architecture (ISA) I S A L E V E L E L E M E N T S O F I N S T R U C T I O N S I N S T R U C T I O N S T Y P E S N U M B E R O F A D D R E S S E S R E G I S T E R S T Y P E S O
More informationMASM: Directives & Pseudo-Opcodes
This document was created with FrameMaker 402 MASM: Directives & Pseudo-Opcodes Chapter Eight Statements like ax,0 and add ax,bx are meaningless to the microprocessor As arcane as these statements appear,
More information16.317: Microprocessor Systems Design I Fall 2014
16.317: Microprocessor Systems Design I Fall 2014 Exam 2 Solution 1. (16 points, 4 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by circling
More informationRun-time Environments
Run-time Environments Status We have so far covered the front-end phases Lexical analysis Parsing Semantic analysis Next come the back-end phases Code generation Optimization Register allocation Instruction
More informationRun-time Environments
Run-time Environments Status We have so far covered the front-end phases Lexical analysis Parsing Semantic analysis Next come the back-end phases Code generation Optimization Register allocation Instruction
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 informationCS356: Discussion #6 Assembly Procedures and Arrays. Marco Paolieri
CS356: Discussion #6 Assembly Procedures and Arrays Marco Paolieri (paolieri@usc.edu) Procedures Functions are a key abstraction in software They break down a problem into subproblems. Reusable functionality:
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 informationCOMPUTER ENGINEERING DEPARTMENT
Page 1 of 11 COMPUTER ENGINEERING DEPARTMENT December 31, 2007 COE 205 COMPUTER ORGANIZATION & ASSEMBLY PROGRAMMING Major Exam II First Semester (071) Time: 7:00 PM-9:30 PM Student Name : KEY Student ID.
More informationProject Compiler. CS031 TA Help Session November 28, 2011
Project Compiler CS031 TA Help Session November 28, 2011 Motivation Generally, it s easier to program in higher-level languages than in assembly. Our goal is to automate the conversion from a higher-level
More informationDigital Forensics Lecture 3 - Reverse Engineering
Digital Forensics Lecture 3 - Reverse Engineering Low-Level Software Akbar S. Namin Texas Tech University Spring 2017 Reverse Engineering High-Level Software Low-level aspects of software are often the
More information