Class2

841 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
841
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
19
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Class2

  1. 1. IBM PC Assembly Language and Programming by Peter AbelChapter 1: Basic Feature of PC hardware<br />Mohammed Nazimuddin(나짐) <br />Email:nazim@eslab.inha.ac.kr<br />1210 Hi-tech centre.<br />
  2. 2. Hardware Features<br />Internal Hardware<br />Processor<br />Memory<br />Register<br />External hardware<br />Keyboard<br />Monitor<br />Disk<br />CD-ROM<br />
  3. 3. Bits and Bytes<br />Bits <br />The fundamental building block of computer storage is Bit.<br />A bit may be<br />Off  0<br />On  1<br />
  4. 4. Bytes<br />A group of nine related bits<br />The eight data bits provide the basis for binary arithmetic and characters<br /><ul><li>256(28) – (00000000 ~ 11111111)</li></ul>One Bit parity.<br />Rules of Parity<br />Must be odd in each byte<br /><ul><li>00001010  00001010(1)</li></ul>Represents a storage Location<br />
  5. 5. Related Bytes<br />Word<br />2-Byte(16-bit)<br />Double Word<br />4-Byte(32-bit)<br />Quadword<br />8-Byte(64-bit)<br />Paragraph<br />16-byte(128)<br />Kilobyte(KB)<br />Megabyte(MB)<br />
  6. 6. Number system<br />Binary<br />Base 2 (0,1)<br />Binary to Decimal<br />01000001<br />Bits are numbered from the right to left.<br /><ul><li>b8b7b6b5b4b3b2b1b0</li></ul>Subscripts represent the place value, e.g. <br /><ul><li>b6 has place value 26</li></ul>Conversion to decimal is done by evaluating the polynomial<br /><ul><li>b8*28+ b7*27 + b6*26 + b5*25 +b4*24 +b3*23 +b2*22 +b1*21 + b0*20
  7. 7. In this case, 0+64+0+0+0+0+0+1 = 65</li></li></ul><li>Decimal<br />Base 10( 0 to 9)<br />Decimal to Binary<br />Divided by 2 <br />Stop when 0<br />Concatenate the Remainder is reverse order<br />Example<br />65 1000001<br />65 / 2 = 32 r 1<br />32 / 2 = 16 r 0<br />16 / 2 = 8 r 0<br />8 / 2 = 4 r 0<br />4 / 2 = 2 r 0<br />2 / 2 = 1 r 0<br />1 / 2 = 0 r 1<br />
  8. 8. HEXADECIMAL<br />Base 16(0 to 9, A..F)<br /><ul><li>Hex to Binary
  9. 9. Expand each hex digit to the equivalent 4-bit binary form
  10. 10. You may omit leading zeros of leftmost digit
  11. 11. 37h = 0011 0111b
  12. 12. (or 110111b)
  13. 13. Binary to Hex
  14. 14. Group bits by fours (starting with least significant bits)
  15. 15. Add leading zeros as necessary to complete the last group
  16. 16. Convert each group to the equivalent hex digit
  17. 17. 0100 1110b = 4Eh</li></li></ul><li>Character Data<br />American Standard Code for Information Interchange (ASCII)<br />A 7-bit binary code for a set of 128 characters<br />Usually occupy a byte of storage<br />Leading bit may be ignored or used differently by various programs<br />A sequence of bytes containing ASCII codes is referred to as an ASCII string<br />
  18. 18. Numeric Data<br />Binary storage<br />two’s complement, one’s complement, sign and magnitude, or biased representations<br />ASCII storage<br />sequence of ASCII bytes representing the digits of the number expressed in some radix<br />Binary Coded Decimal<br />sequence of nybbles representing digits 0-9 of the number<br />
  19. 19. Binary Storage<br />A pre-arranged storage size is used<br />typically byte, word, doubleword, or quadword<br />Represent a number in base two and encode the bits<br />197d is 11000101b<br />at least 8 bits will be required to store this number (leading zeros are added if necessary to fill additional bits for larger storage sizes)<br />
  20. 20. Signed vs Unsigned Codes<br /><ul><li>Signed Byte
  21. 21. two’s complement code is most common
  22. 22. only 7 bits are used for the magnitude
  23. 23. Minimum -128 is coded as 10000000b
  24. 24. Maximum +127 is coded as 01111111b
  25. 25. Zero is 00000000b
  26. 26. Unsigned Byte
  27. 27. all 8 bits used to represent the magnitude of the number
  28. 28. Minimum 0 (zero) is coded as 00000000b
  29. 29. Maximum 255 is coded as 11111111b</li></li></ul><li>Storage Sizes and Ranges<br />Unsigned Integer<br /><ul><li>Byte
  30. 30. 0 to 255
  31. 31. Word
  32. 32. 0 to 65,535
  33. 33. Doubleword
  34. 34. 0 to 4,294,967,295
  35. 35. Quadword
  36. 36. 0 to 18,446,744,073,709,551,615</li></ul>Signed (2’s Complement Code)<br /><ul><li>Byte
  37. 37. -128 to 127
  38. 38. Word
  39. 39. -32,768 to 32,767
  40. 40. Doubleword
  41. 41. -2,147,483,648 to 2,147,483,647
  42. 42. Quadword
  43. 43. -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807</li></li></ul><li>Binary Arithmetic<br />Addition<br /><ul><li>Numbers can be added in any number base
  44. 44. Use the same algorithm you practiced in second grade!
  45. 45. Binary Example:</li></ul> c ccc<br /> 10101<br />+ 1111<br />100100<br />0+0 = 0<br />0+1 = 1<br />1+0 = 1<br />1+1 = 10<br />1+1+1 = 11<br />
  46. 46. Negative Binary Number<br />A negative binary value is expressed in Two’s complement notation. <br />Two’s complement<br />Reverse the bit<br />Add 1<br />Example: +65 <br /> Reverse bits <br /> Add 1<br /> Number -65 <br />01000001<br />10111110<br /> 1<br />10111111 <br />
  47. 47. Subtraction<br /> How to Subtract 42 from 65 ?<br /> 65 :<br /> +(-43) :<br /> = 22<br />
  48. 48. PC Components<br />System Board<br />Processor, main memory, connectors, hard disk, etc…<br /> Bus<br />A bus with wires attached to the system board connects the components.<br />Processor<br />8088,8086,80286….Pentium<br />Execution and Bus control unit<br />
  49. 49. Execution and Bus control Unit<br />EU: Execution Unit<br />BIU: Bus interface Unit<br />Program control<br />Instruction <br />Queue<br />.<br />.<br />
  50. 50. Intel 8086 Organization<br />Registers - storage locations found inside the processor for temporary storage of data<br />Data Registers (16-bit)<br />AX, BX, CX, DX<br />Address Registers (16-bit)<br />Segment registers: CS, SS, DS, ES<br />Pointer registers: SP, BP, IP<br />Index registers: SI, DI<br />Status (Flags) register (16-bit)<br />
  51. 51. Data Registers<br />The data registers may be used for general purposes, however each has special uses<br />AX : Accumulator<br />BX : Base<br />CX : Count<br />DX : Data<br />Each byte of the 4 data registers can be accessed independently<br />AH, AL, BH, etc.<br />These are referred to as 8-bit registers, but remember they are part of an existing register<br />
  52. 52. Memory<br />8086 - 1 megabyte of memory (220 bytes)<br />Each byte is accessed by specifying an address (00000h through FFFFFh)<br />20-bit addresses must be formed from 16-bits of information<br />
  53. 53. Interrupt Vectors<br />BIOS and DOS Data<br />DOS<br />Application <br />Program Area<br />Video<br />Reserved<br />BIOS<br />
  54. 54. Segment Registers<br />20-bit addresses are obtained by combining two 16-bit registers, segment:offset<br />Address = segment*16(10h)+offset<br />Example CS: 010C IP: 14D2<br />Address = 010C*10+14D2 = 010C0+14D2 Address = 02592<br />Each segment is 64K, segments can start at any paragraph boundary<br />
  55. 55. Program Segments<br />During program execution, the segment registers are only changed if memory not currently accessible in an active segment must be accessed<br />Program bytes are arranged into distinct segments for convenience<br />CS -> segment containing machine instructions<br />SS -> segment containing storage for the stack<br />DS -> segment containing data values and storage<br />ES -> segment for additional data or special memory operations<br />Programmers must be aware of this organization<br />
  56. 56. Instruction and Stack Pointers<br />IP contains the address of the next instruction to be executed<br />IP specifies an offset into the CS segment<br />IP is not the operand of any instruction<br />SP points to the top item on the stack<br />SP is an offset into the SS segment<br />SP can be used as an operand in some instructions<br />
  57. 57. BP and Index Registers<br />BP is a Base Pointer<br />Specifies an offset into any segment, but most commonly the Stack segment<br />SI and DI are called Index registers<br />They normally specify an offset into the Data segment, although they can be used as offsets into any segment<br />Sometimes they hold a number to be added to the address of an array (index)<br />
  58. 58. Flags<br />Individual bits are used to store the status of the microprocessor<br />Bits are set or cleared as the result of many operations<br />Bits may be affected indirectly (by the execution of an instruction) or directly by an instruction designed to access the status word.<br />

×