Presentation is loading. Please wait.

Presentation is loading. Please wait.

6-4 CPU-Registers, effective address General registers vs Segment registers Computer Studies (AL)

Similar presentations


Presentation on theme: "6-4 CPU-Registers, effective address General registers vs Segment registers Computer Studies (AL)"— Presentation transcript:

1 6-4 CPU-Registers, effective address General registers vs Segment registers Computer Studies (AL)

2 Reference SEG3460 High level programming versus assembly programming (supplementary notes) 80x86 組合語言, p2-2 – 2-20

3 8088 Registers Data group General purpose registers: AX. BX. CS. DX Each 16-bit long AH-AL, BH-BL, CH-CL, DH-DL (8 bit access) AH: high order byte, AL: low order byte Uses: hold operands and temporary results Special purpose registers (e.g. dedicated for special I/O)

4 8088 Registers Pointer and Index Group SP (Stack pointer) BP (Base pointer) SI (Source Index) DI (Destination Index) IP (Instruction Pointer) ~ (PC)

5 8088 Registers Pointer and Index Group Must be accessed in 16 bits as a whole Uses: Memory Pointers With their contents interpreted as addresses of data/location E.g. [SI] means content of SI stores the address of the location or data of interest. IP points to the next instruction

6 8088 Registers Status and Control Flags (we learn 6 out of 9) OF (overflow) ZF (Zero Flag) PF (Parity Flag) CF (Carry Flag) AF (Auxiliary Carry Flag) SF (Sign Flag)

7 Example of status registers 0101010000111001 0100010101101010 1001100110100011 + SF=1, ZF=0, PF=1, CF=0, AF=1, OF=1

8 Segment memory Every byte has an address. 20 bit address bus 2 power 20 = 1048576 bytes = 1 Mb In 8088, each memory access is 8-bit wide, thus 2 bytes = 2 memory accesses. 1 word = 2 bytes = 16 bits = 65536 (max) It implies the max. addressable memory = 64k. How to break the limit?

9 Offset, segment and physical address 1 MB = 16 x 64k memory 16 bit address = offset ( 位移 ) within a segment = logical address 101100111111111 1011001111111110000 (offset) Physical address = Segment address + logical address. Logical address relate to which segment. The value of the logical address is stored in the segment registers. (refer to the supplementary notes, Fig. 2.1)

10 Example IP: next instruction 0000000100000000 CS: code segment register B3FFh (h = hex) Physical Address = CS:IP = CSx16 + IP 10110011111111110000 0000000100000000 + 10110100000011110000 (B40F0) (20-bit)

11 Where segments allocated? Anywhere in memory. Segments are overlapping. Refer to 80x86 reference notes.

12 Why use segment? Relocation Save 4 bits, yet can still have 20-bit address


Download ppt "6-4 CPU-Registers, effective address General registers vs Segment registers Computer Studies (AL)"

Similar presentations


Ads by Google