.asm Notes
  • How do the assembler and linker work together'?

Linker is companion program that combines individual files created by assembler into one executable file.

  • Give an example of an embedded systems application.

An embedded system is a special-purpose computer system designed to perform one or a few dedicated functions,[1] often with real-time computing constraints. It is usually embedded as part of a complete device including hardware and mechanical parts. In contrast, a general-purpose computer, such as a personal computer, can do many different tasks depending on programming. Embedded systems control many of the common devices in use today. [http://en.wikipedia.org/wiki/Embedded_system]

Consumer electronics include personal digital assistants (PDAs), mp3 players, mobile phones, videogame consoles, digital cameras, DVD players, GPS receivers, and printers. Many household appliances, such as microwave ovens, washing machines and dishwashers, are including embedded systems to provide flexibility, efficiency and features. Advanced HVAC systems use networked thermostats to more accurately and efficiently control temperature that can change by time of day and season. Home automation uses wired- and wireless-networking that can be used to control lights, climate, security, audio/visual, etc., all of which use embedded devices for sensing and controlling.

Transportation systems from flight to automobiles increasingly use embedded systems. New airplanes contain advanced avionics such as inertial guidance systems and GPS receivers that also have considerable safety requirements. Various electric motors — brushless DC motors, induction motors and DC motors — are using electric/electronic motor controllers. Automobiles, electric vehicles. and hybrid vehicles are increasingly using embedded systems to maximize efficiency and reduce pollution. Other automotive safety systems such as anti-lock braking system (ABS), Electronic Stability Control (ESC/ESP), and automatic four-wheel drive.

Medical equipment is continuing to advance with more embedded systems for vital signs monitoring, electronic stethoscopes for amplifying sounds, and various medical imaging (PET, SPECT, CT, MRI) for non-invasive internal inspections.

  • Is type checking on pointer variables stronger in assembly language or in C++?


  • Challenge: Translate the following C++ expression to assembly language, using the example presented earlier in this chapter as a guide : X = (Y * 4) + 3

mov eax,Y
imul eax,4
mov ebx,3
add eax,ebx
mov X,eax
(-not checked yet…)


  • Binary integers can be either signed or unsig ned. A signed intege r can be eith er positive or negative . An unsigned integer can only be positive , including zero . Through spec ial encoding schemes, bin ary numbers can even represent real numbers.

Integer Storage Size

The basic storage unit for all da ta in an lA-32-based computer is a byte, containing 8 bits . Other storage sizes are word (2 bytes), doubleword (4 bytes) , and quadword (8 bytes).


Large binary numbers are cumbersome to read, so hexadecimal digits are usually used by assemblers and de buggers to represent binary data. Each digit in a hexadecimal integer represents four binary bits , and two hexadecimal digits together represent a byte.


Assuming that a computer can only store binary data, one might wonder how it could also store characters. To do this, it must support a certain character set, which is a mapping of characters to integers. Until a few years ago, character sets used only 8 bits. Because of the great diversity of languages around the world, the 16-bit Unicode character set was created to support thousands of different character symbols.

When running in character mode (such as MS-DOS), IBM-compatible microcomputers use the ASCII (pronounced "askey") character set. ASCII is an acronym for American Standard Code for Information Interchange. In ASCII, a unique 7-bit integer is assigned to each character. Because ASCII codes use only the lower 7 bits of every byte, the extra bit is used on various computers to create a proprietary character set. On IBM-compatible microcomputers, for example, values 128-255 represent graphics symbols and Greek characters.

MS-Windows programs use a variety of different character sets, so it is not possible to use just a single lookup table. (You can read the Microsoft documentation on Windows fonts to see how characters translate into numeric codes.)

Q: How computer knows to print a char which is in binary presentation instead of to print a number which has the same value with that char?



• NOT: notated as ¬ or ~ or `
• AND: notated as ∧ or •
• OR: notated as v or +

The NOT operator is unary, and the other operators are binary. The operands of a boolean expression can also be boolean expressions.

Precedence: () > NOT > AND > OR

IA-32 processor Architecture

Basic Microcomputer Design

  • The central processor unit (CPU) is where all the calculations and logic operations take place. It contains a limited number of storage locations called registers, a high-frequency clock, a control unit, and an arithmetic logic unit.

• The clock synchronizes the internal operations of the CPU with other system components.
• The control unit (CU) coordinates sequence of execution steps (-Fetch instructions from memory, decode them to find their types)
• The arithmetic logic unit (ALU) performs arithmetic operations such as addition and subtraction, and logical operations such as AND, OR, and NOT.
• Registers store data and instructions used by the processor
• Datapath consists of registers and ALU(s)

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License