Ch 15 Assembly Language and Related Topics

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Executable code

The machine code generated by a source code language processor such as an assembler or compiler. This is software in a form that can be run in the computer.

Object Code

The machine language representation of programming source code. Object code is created by a compiler or assembler and is then turned into executable code by the linker.

Operand(s) (for assembly language)

An assembly language statement includes zero or more operands. Addressing modes are the same as previously discussed.

NASH directives

1. BITS (specifies 16-,32-, or 64-bit mode) 2. DEFAULT (can change defaults) 3. SECTION or SEGMENT (changes the output file the source code will be assembled to) 4. EXTERN (used to declare a symbol that is defined ina different module) 5. GLOBAL (the other end of EXTERN. It declares the varibale) 6. COMMON (used to declare common variables) 7. CPU (restricts instructions based on the CPU) 8. FLOAT (Allows the programmer to change some of the default settings) 9. [WARNING] (used to enable or disable classes of warnings)

Binary, Hexadecimal, symbolic, and assembly programs

1. Binary- everything's in binary 2. Hexadecimal- parts are in hexadecimal 3. Symbolic- each instruction is given a symbolic name (pseudo- instructions) 4. Assembly Language- symbolic addresses are used

Advantages of occasional use of Assembly language

1. Debugging and verifying the compiler 2. Making compilers 3. Embedded systems 4. Hardware drivers and system code 5. Accessing instructions that are not accessible from high-level language 6. Self-modifying code 7. Optimizing code for size 8. Optimizing code for speed 9. Function Libraries 10. Making Function libraries compatible with multiple compilers and operating systems.

Disadvantages of using assembly vs HLL

1. Increased Development time 2. Reliability and security (better in HLL) 3. Debugging and verifying (easier in HLL) 4. Maintainability (easier in HLL) 5. Portability (possible in HLL) 6. System code can use intrinsic functions 7. Application code can use intrinsic functions 8. Compilers have improved a lot in recent years

Linkage editor

A linker that produces a relocatable load module

Loader

A program routine that copies an executable program into memory for execution

Compiler

A program that converts another program from some source language (or programming language) to machine language. Some compilers output assembly language. Generally, each input statement to a compiler does not directly correspond to one machine instruction.

Assembler

A program that translates an assembly-language program into machine code

Assembly Language

A symbolic representation of the machine language of a specific processor, augmented by additional types of statements that facilitate program writing and that provide instructions to the assembler. It is hardware dependent.

Linker

A utility program that combines one of more files containing object code from separately compiled program modules into a single file containing loadable or executable code. ALSO... takes a collection of object modules and produces a load module, consisting of an integrated set of program and data modules to be passes to the loader. Symbolic addresses within modules must be resolved.

Absolute loading

An absolute loader requires that a given load module always be loading into the same location in main memory. Specific addresses can either be done by the programmer or at assembly time.

DLLs (dynamic-link libraries)

Dynamic linking modules in windows

Assembly language statement structure

Label, Mnemonic (operator), operand(s), and optional comment

Zeroth pass

Necessary when macros are present. The macros must be expanded.

Cross-assembler

Runs on a computer other than the one for which it assembles object programs. Typically, the host machine for the assembler is a larger system while the target machine is an embedded system.

Machine language aka machine code

The binary representation of a computer program which is actually read and interpreted by the computer. A program in machine code consists of a sequence of machine instructions (possibly interspersed with data). Instructions are binary strings which may be either all the same size or different sizes.

Instruction set

The collection of all possible instructions for a particular computer; that is, the collection of machine language instructions that a particular processor understands.

Directive

a command embedded in the assembly source code that is recognized and acted upon by the assembler.

Subroutine

a section of a program that is written once, and can be used multiple times by calling the subroutine from any point in the program.

Relocatable loading

addresses are relative to some location point, so the block can be moved to any part of main memory. The loader must be told how to interpret the addresses.

Macroassembler

allows the user to define sequences of instructions as macros.

Meta-assembler

can handle multiple instruction sets

Symbol table

contains a list of all labels and associated location counter values.

Dynamic run-time loading

defers the calculation of an absolute address until it is actually needed at run time. This allows a program to be loaded into any part of main memory after each time it is swapped.

Label in assembly language

if present, the assembler defines it as equivalent to the address into which the first byte of the object code generated for that instruction will be loaded. It is useful for use as a reference point for a branch instruction.

Comment (in assembly language)

like a comment in a HLL. Usually, the comment starts with a semicolon.

Macro definitions

like a subroutine, a macro definition is a section of code that the programmer writes once and can use many times. However, macro expansion occurs. It is handled by hardware at runtime.

Loading

loading a program into main memory. The three types are absolute loading, relocatable loading, and dynamic run-time loading.

One pass assembler

main difficulty of implementation is forward references to labels. To solve this, forward references are initially left as all zeros and filled in later.

One-pass assembler

makes a single pass through the assembly code to produce the machine code.

Relocation

makes is possible to swap processes into and out of main memory. It is not possible to know ahead of time where a process will be in memory.

Two-pass assembler

makes two passes through the assembly code to produce the machine code. Most assemblers require two passes.

DLL hell

occurs if two or more processes are sharing a DLL module, but expect difference versions of the module.

Plain-label vs Brackets

plain-label means the memory address while the [] brackets mean the data at that location.

Dynamic linking

refers to the practice of deferring the linkage of some external modules until after the load module has been created. Thus, the load module contains unresolved references to other programs, which can be resolved at load or run time.

Second pass of two pass assembler

rereads program, translating everything into its appropriate binary machine code.

Resident assembler

runs on the computer for which it assembles programs.

Three directive sections for NASM

section.data, section.bss, section.text

Run-time dynamic linking

some of the linking is postponed until execution time. When a call is made to a module that isn't in memory, it is brought into main memory.

Pseudo-instructions

statements which, though not real x86 instructions, are used in the instruction field anyway because it is convenient. Pseudo-instructions are not directly translated into machine language instructions, but accomplish functions like defining constants, initializing memory, allowing references, etc.

Assembler software utility

takes an assembly program as input and produces object code as output. The object code is a binary file.

First pass of two pass assembler

the assembler is only concerned with label definitions. The first pass examines each assembly statement to determine the length of the corresponding machine instruction and how much to increment the LC.

System calls

the assembler makes use of the x86 INT instruction to make system calls. Arguments are put into registers and an interrupt is called.

Location counter (LC) Values

the first byte of object code has an LC of zero.

Load-time dynamic linking

the load module to be loaded is read into memory. Any reference to an external module causes the loader to find the target module, load it, and alter memory references.

Mnemonic (for assembly language)

the name of the operation or function of the assembly language statement.

Microassembler

used to write programs that define the instruction set of a micro programmed computer.

Macro expansion

when the assembler encounters a macro call, it replaces the macro call with the macro itself. Multiple instances of the macro appear in the assembled code (the assembler does the work). Macro expansion uses more space.


Set pelajaran terkait

Executive Branch Structure: President, cabinet, executive departments, the three agencies

View Set

APES Unit 6: Energy Resources and Consumption

View Set