Preview

Assembly language lecture6

Satisfactory Essays
Open Document
Open Document
991 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Assembly language lecture6
Jump instructions
– do not change flags.

Unconditional jumps
Jump
• near – the target label is in the same segment than the jump • far – jump to another code segment

Direct jump jmp label
Near jump jmp Stop xor ax,ax
Stop: mov ah,4Ch

Machine code: cs:0000 cs:0002 cs:0003 cs:0005

EB 03
90
33 00
B4 4C

displacement = the difference between the target label and IP
(may also be negative) jmp Stop nop xor ax,ax
Stop: mov ah,4Ch
Assembly Languag 6/ 1

A processor executes the jump adding the displacement to the current value of IP (IP := 0002 + 3 = 0005) => IP will point to the instruction at which the program execution shall continue.
Two-pass assembler
– scans the source assembly language program twice.
The purpose of the 1st pass is to work out the locations corresponding to symbols (identifiers). To work out these locations, the assembler uses a variable known as the location counter (LC). The symbol table is created during the first pass; it records the names of variables and labels together with their attributes.
LC =

0
2
202
205

.DATA
Number DW 1234h
Array DW 100 dup(?)
Value DB 5,6,7

Symbol table:
Symbol

Segment

Offset

Type

Number

_Data

0 variable: word

Array

_Data

2 variable: word

Value

_Data

202 variable: byte

Assembly Languag 6/ 2

LC =

0
3
5
9
10

.CODE
Start:

Next:

mov mov mov dec ax,@data ds,ax cx,Number cx Symbol table:
Symbol

Segment

Offset

Type

Start

_Text

0 label: near

Next

_Text

9 label: near

Problem: forward jumps
A 16-bit displacement ∈ 〈-32768; 32767〉 is supposed, i.e. the assembler reserves two bytes for the displacement of a forward jump instruction.
In the 2nd pass the assembler uses the symbol table to generate the machine code. If the displacement is an 8-bit value ≤ 127, the second byte is filled with the op-code for instruction nop.
Operator short instructs the assembler to use an 8-bit displacement: cs:0000 EB 02 cs:0002 33 00 cs:0004 B4 4C

jmp short Stop xor ax,ax
Stop: mov ah,4Ch
Assembly Languag 6/ 3

You May Also Find These Documents Helpful

  • Good Essays

    Nt1310 Unit 8 Assignment 1

    • 1415 Words
    • 6 Pages

    This project used an Atmega644 microcontroller clocked at 20MHz in each of the two functional modules for processing. Memory storage is provided by a standard Secure Digital (SD) card. Xbee modules provide bidirectional wireless communication and we use the TLV5616 DAC chip for generating analog audio. The LM358 dual op amp provides active filtering to the output of the DAC. Music files can be added to the SD card using any computer with a multimedia card reader. Once the base station detects an SD card inserted into the holder, it awaits data requests from the portable module. The portable module requests data when required and feeds these values into the DAC. The DAC output is low-pass filtered by the op amp, which also buffers the DAC output before it reaches the audio output…

    • 1415 Words
    • 6 Pages
    Good Essays
  • Powerful Essays

    It is important to test the cables before you install them and after they are installed. Although there are many tools that are used for testing the cables in a network this paper is only going to talk about three. The first one is the multifunction cable scanner, they are available for testing both copper and fiber optic cable. One such model is the Hobbes 258898 it can test every pin of almost 20 often used cables from coax to 40 pin ribbon cables. It identifies opens, shorts and mis-wires at the pin level. With a multifunction cable tester you can perform a range of tests that you would normally need a few different testers to do. You can do wire-mapping, test for the length of the cable, test the attenuation, and you can test NEXT (near end crosstalk) for copper cables. They will also test for optical power and signal loss in fiber optic cables. A lot of the multifunction cable testers perform other more comprehensive test such as PS-NEXT, ACRF, PS-ACRF, delay…

    • 659 Words
    • 3 Pages
    Powerful Essays
  • Satisfactory Essays

    A good example of refraction of light and reflection of light is a rainbow. Sunlight enters the rain droplet at a specific angle and the rain droplet separates the white light into many different colors. This angle is a fixed measurement between your eye and the sun. What color is refracted depends upon the critical angle, which is the angle the sunlight strikes the back of the rain droplet. Red light bends the least while violet light bends the most all the other colors bend at an angle that is between the two. Each rain droplet reflects all colors at a given point and time, but only one color comes back to your eye, requiring millions of rain droplets to create a rainbow. As the rain droplets fall…

    • 395 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    This paper will discuss the three types of network topologies discussed in Chapter 3. They are, hierarchical star, bus, and ring network topologies. Each has its advantages and disadvantages as will be discussed…

    • 398 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Nt1310 Unit 3 Assignment 1

    • 1410 Words
    • 6 Pages

    Don’t limit yourself to modular sizes listed in a catalog - surf2 tables are available in 1 inch…

    • 1410 Words
    • 6 Pages
    Good Essays
  • Satisfactory Essays

    I recently had to deal with a problem with the Event Name as: BlueScreen. The Locale ID of the fault can be designated by the numerical value as: 5146. I am a touch apprehensive as to whether such a typical fault has been triggered owing to a virus attack. What should I do to eliminate the fault and ensure that the problem does not occur all over again?…

    • 474 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Which of the following answers are true about random-access memory (RAM) as it is normally used inside a personal computer? ( choose two answers)…

    • 957 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    IT104 Assignment Unit 5

    • 307 Words
    • 2 Pages

    1) What does a professional programmer usually do first to gain an understanding of a problem?…

    • 307 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    When addressing system performance, a key element that is often overlooked is Disk Fragmentation. Even on a brand new system with plenty of RAM and processing speed, the performance of the hard disk may be a bottleneck causing issues. It takes time to load large data files into memory - issues become particularly noticeable when dealing with movies, video clips, database files or image files which may easily be several gigabytes in size. On a freshly formatted disk, these files load fairly quickly. Over time, however you may start to notice performance issues - caused by disk fragmentation.…

    • 356 Words
    • 1 Page
    Satisfactory Essays
  • Good Essays

    An extra layer of authentication for the security of resources by two-step verification. The combination of any two or more veri-fication methods (password, biometrics, trusted device).…

    • 553 Words
    • 3 Pages
    Good Essays
  • Good Essays

    In order to get any new technology out to the public there are certain procedures and documentations that a publisher must go through. I won’t be going over the entire process but instead I’ll be focusing on two areas which are Request for Comments (RFC) and an Internet Draft. Even the most popular networking technologies used today like IP and Ethernet had to go through these processes at some point. I’ll also be explaining the organizations that must produce the documentation and the processes to produce said documents.…

    • 634 Words
    • 3 Pages
    Good Essays
  • Good Essays

    Domestic Terrorism is defined by the FBI as: “The unlawful use, or threatened use, of force or violence by a group of individuals based and operated entirely within the United States or Puerto Rico without foreign direction committed against persons or property to intimidate or coerce a government, the civilian population, or any segment thereof in furtherance of political or social objectives.” ("Internal threats to," 2012)…

    • 508 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    ILM3 Assignment 1

    • 2281 Words
    • 7 Pages

    behavior. If they can be observed to have the desire to work towards their needs they must have motivation.…

    • 2281 Words
    • 7 Pages
    Powerful Essays
  • Good Essays

    Branch Delay

    • 1747 Words
    • 7 Pages

    In the MIPS CPU, the branch operation is delayed by one instruction. The MAL assembler hides the delayed branch by inserting an instruction after each branch or jump. The instruction following a branch or jump is called the delay slot. By default the assembler inserts an instruction which does nothing, a no-op.…

    • 1747 Words
    • 7 Pages
    Good Essays
  • Satisfactory Essays

    Microproccesor

    • 1550 Words
    • 7 Pages

    3. To be able to create an assembly language program using turbo assembler with SK as editor.…

    • 1550 Words
    • 7 Pages
    Satisfactory Essays