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

  • Satisfactory Essays

    The Wiremap test is used to identify physical errors of the installation; proper pin termination at each end, shorts between any two or more wires, continuity to the remote end, split pairs, crossed pairs, reversed pairs, and any other mis-wiring. It tests four-pair data and voice cable links terminated with standard, modular, eight-position RJ45 jacks. Shielded ports test both shielded and unshielded cabling. This is essential for just about any network as telephones (voice) are also used in conjunction with data communications. This tester should be a part of every cable installation kit.…

    • 256 Words
    • 2 Pages
    Satisfactory 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

    The problematic scenario is when the physical sequence has a loop. In this scenario, a switch which is attached to the middlebox literally cannot identify the middlebox segment based on the combination of the input interface and packet header fields. To address this scenario, SIMPLE introduce a ProcState tag that encodes the packet’s processing state inside the packet header fields using either VLAN tags, unused fields in the IP headers i.e., IP ToS fields or MPLS labels depending on the fields supported in the SDN-enabled switches. Therefore, SDN controller installs tag addition forwarding rules at the first switch of each middlebox segment, which is based on packet header fields and input ports of the switch. In addition, downstream switches consider these tags for the matching purpose and perform respective forwarding action. This process continues until the middlebox segment is finished.…

    • 241 Words
    • 1 Page
    Satisfactory 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
  • Powerful Essays

    CODE FOR THE ABOVE FRAGMENT addi $t6, $zero, 101 # the loop termination value add $t0, $zero, $zero # i = 0 addi $t2, $a0, 0 # ptr to current A[i] addi $t3, $a1, 0 # ptr to current B[i] loop: lw $t4, 0($t3) # load B[i] add $t4, $t4, $s0 # B[i] + c sw $t4, 0($t2) # store in A[i] addi $t0, $t0, 1 # i++ addi $t2, $t2, 4 # ptr to next A[i] addi $t3, $t3, 4 # ptr to next B[i] bne $t0, $t6, loop # if i < 101, goto loop IF ANY QUERIES REGARDING CODE…

    • 107 Words
    • 1 Page
    Powerful 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

    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
  • 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
  • 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

    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