Computer System questions

profilea13940028911
Lecture4.docx

Lecture-4

Last week we talked about the relation between microprocessor and memory:

We talked about data bus and address bus and control bus.

The first Intel microprocessor 8086:

Later we had Intel Pentium:

This is an example of the motherboard:

Processor and memory are connected with wires. These wires are lines that can be seen on the other side of the motherboard.

There are two formats of writing assembly language for Intel microprocessor.

One format is called AT&T format.

One format is called INTEL format.

The book explains the differences between these two formats.

There are many books that use INTEL format.

However, this book uses AT&T format.

The following instruction:

movw %ax, %bx

RULES:

movw %ax, %bx Note that the two operands are shown with the arrow!

Based on the above rules are the following instructions valid or invalid?

movw %ax, %bx

VALID

movb %al, %bx

Not valid since bx is 16 bits not 8 bits-rule-1

movl %eax, %ebx

VALID

movw %ax, %ebx

Not valid rule-1

movb %ah, %al

VALID

VALID

movb 0x4050, %al

VALID The address is 32 bits but the content of that address a byte that is moved to al.

movb 0x4050, 0x5050

Not valid – Both are memory references

Note that when we want to specify a number we precede the number with $.

But when we write the number with no $, it means a memory address.

So when we say the destination cannot be a number, we mean it cannot be a number that starts with $.

However, the last instruction is valid since the number we want to place into EAX is in the source part and EAX is in the destination. But is the number 32 bits or in other words, is it the same size of EAX (rule-1)?

The 0x at the beginning of the number says it is a hex number. So $0x4050, it means the number is:

0000 0000 0000 0000 0100 0000 0101 0000

I added the blue zeros, just to show you that 0x4050 which is represented as binary with black color, can also be represented as a 32 bit number by padding zeros to the left of the number.