»ã±à±Ê¼Ç
¼ÆËã»úµÄ¶¨Ò壺
A computer is a device that accepts input processes data,stores data and produces output all according to a series of stored instructions.
Computer input is whatever is typed,submitted or transmitted to a computer system. In the context computing data refers to symbols that represent facts,objects and ideas.computers manipulate data in many ways and this manipulation is called processing.
Memory is a area of computer that temporarily holds data waiting to be processed,stored or output. ΢´¦ÀíÆ÷ÈçºÎ»ñȡָÁî
Where does the microprocessor get it¡¯s instructions ? The simple answer is that a microprocessor executes(Ö´ÐÐ) instructions provided by a computer program . However,a microprocessor can¡¯t follow just any instructions . A program that contains an instruction to ¡°self destruct(×Ô»Ù)¡± won¡¯t have much effect because a microprocessor can perform only a limited list of instructions ¡°self destruct¡±isn¡¯t one of them .
The list of instructions that a microprocessor can perform is called it¡¯s instruction set. These instructions are hard-wired£¨Ó²ÏßÁ¬½Ó£© into the processor¡¯s circuitry(µç·¡¢µç·ϵͳ) and include basic arithmetic(Ëã·¨) and logic operations. Fetching data and clearing registers.
A computer can perform very complex tasks,but it does so by performing a combination of simple tasks from it¡¯s instruction set .
How does a microprocessor work? Inside the chip/carrier , a microprocessor is a very complex integrated circuit , containing as many as 300 million miniaturized
electronic components . The miniaturized circuitry in a microprocessor is grouped into important functional areas ,such as the ALU and the control unit.
The ALU(arithmetic logic unit) performs arithmetic operations , such as addition and subtraction . It also performs logic operations,such as comparing two numbers to see if they are the same . The ALU uses registers to hold data that is being processed , just as you use a mixing bowl to hold the ingredients for a batch of brownies . The microprocessor¡¯s control unit fetches each instruction , just as you get each ingredient out of a cupboard or the refrigerator .
µÚÒ»ÕÂ
1.1.1¼ÆËã»úËã¼ÆµÄ¶¨Òå
¼ÆËã»úÊÒÒ»ÖÖÄÜż°´ÕÕÊÂÏÈ´æ´¢µÄ³ÌÐò£¬×Ô¶¯¡¢¿ìËÙ¡¢×¼È·µØ½øÐдóÁ¿ÊýÖµ¼ÆËãºÍ¸÷ÖÖÐÅÏ¢´¦ÀíµÄÏÖ´ú»¯ÖÇÄܵç×ÓÉ豸
ÒÀ·ë¡£Ù¼ÒÀÂü»úÖÆ£¬¼ÆËã»úÓÉÎå´ó²¿¼þ×é³É£¬¼´ÔËËãÆ÷£¬¿ØÖÆÆ÷¡¢´æ´¢Æ÷¡¢ÊäÈëÉ豸¡¢Êä³öÉ豸¡£
1.1.2¼ÆËã»úµÄÌØÕ÷ 1£©ÔËËãËÙ¶È¿ì 2£©¼ÆË㾫¶È¸ß 3£©¼ÇÒ书ÄÜÇ¿
4£©¾ßÓÐÂß¼ÅжÏÄÜÁ¦ 1.2¼ÆËã»úϵͳ×é³É
¼ÆËã»úϵͳÓÉÓ²¼þºÍÈí¼þÁ½´ó²¿·Ö×é³É 1.2.1¼ÆËã»úÓ²¼þ
¼ÆËã»úÓ²¼þÓÉ¿ØÖÆÆ÷¡¢ÔËËãÆ÷¡¢´æ´¢Æ÷¡¢ÊäÈëÉ豸ºÍÊä³öÉ豸×é³É¡£ ´æ´¢Æ÷·ÖΪÄÚ´æ´¢Æ÷ºÍÍâ´æ´¢Æ÷¡£ 1) ÔËËãÆ÷
×¢ÒâALU(Arithmetic Logic Unit) 2) ´æ´¢Æ÷£¨Ö÷´æ´¢Æ÷£© 3) ¿ØÖÆÆ÷ 4) ÊäÈëÉ豸 5) Êä³öÉ豸
1.4.1 8086µÄ¼Ä´æÆ÷
8086ÊÇIntel¹«Ë¾ÍƳöµÄµÚÒ»¸ö16λµÄ΢´¦ÀíÆ÷£¬ËüÓÉÁ½¸ö¾ßÓнôÃÜÁªÏµµÄ²¿¼þ£¬Ö´Ðв¿¼þEU(Executive Unit)ºÍ×ÜÏß½Ó¿Ú²¿¼þBIU(Bus Interface Unit)¹¹³É£¬ÆäÄÚ²¿Âß¼½á¹¹ÈçÏÂͼ¡£8086µÄÍⲿ¾ßÓÐ20¸ùµØÖ·×ÜÏߣ¬¿ÉÖ±½ÓѰַµÄ´æ´¢Æ÷¿Õ¼ä´ï2^20=1MB.
8086ÖгÌÐò¿Æ·ÃÎʵļĴæÆ÷¹²ÓÐ14¸ö£¬°´¹¦ÄܿɷÖΪͨÓüĴæÆ÷×飬¶Î¼Ä´æÆ÷×éºÍרÓüĴæÆ÷×é¡£
1£©Í¨ÓüĴæÆ÷×é¡£ 8¸ö£¬·ÖΪÁ½×é
Ò»×éÊÇÊý¾Ý¼Ä´æÆ÷£¨4¸ö£©£º AX(Accumulator)£ºÀۼӼĴæÆ÷£¬³£ÓÃÓÚÔËË㣬Ôڳ˳ýÖ¸ÁîÖÐÖ¸¶¨ÓÃÀ´´æ·Å²Ù×÷Êý(ÔËËã½á¹û)£»ÁíÍ⣬ËùÓеÄI/OÖ¸ÁʹÓÃÕâÒ»¼Ä´æÆ÷ÓëÍâ½çÉ豸´«ËÍÊý¾Ý¡£ MUL BL -------------> AX = BL * AL
BX(Base)£º»ùÖ·¼Ä´æÆ÷£¬³£ÓÃÓÚµØÖ·Ë÷Òý¡£ CX(Count)£º¼ÆÊý¼Ä´æÆ÷£¬³£ÓÃÓÚ¼ÆÊý.¡£ DX(Dat)£ºÊý¾Ý´æ´¢Æ÷£¬³£ÓÃÓÚÊý¾Ý´«µÝ¡£
ÌØµã£ºÕâ4¸ö16λ¼Ä´æÆ÷¿É·ÖΪ¸ß8λ£ºAH¡¢BH¡¢CH¡¢DHÒÔ¼°µÍ8λ£ºAL¡¢BL¡¢CL¡¢DL¡£ Mov AX,BX ¡ð¡Ì Mov AL£¬AH¡ð¡Ì
ÁíÒ»×éÊÇÖ¸Õë¼Ä´æÆ÷ºÍ±äÖ·¼Ä´æÆ÷£¬°üÀ¨£º
SP(Stack Pointer)£º¶ÑÕ»Ö¸Õë¼Ä´æÆ÷£¬ÓëSSÅäºÏʹÓ㬿ÉÖ¸ÏòĿǰµÄ¶ÑջλÖᣠBP(Base Pointer)£º»ùÖ·Ö¸Õë¼Ä´æÆ÷£¬¿ÉÓÃ×÷SSµÄÒ»¸öÏà¶Ô»ùַλÖᣠSI(Source Index)£ºÔ´±äÖ·¼Ä´æÆ÷£¬¿ÉÓÃÀ´´æ·ÅÏà¶ÔÓÚDS¶ÎÖ®Ô´±äÖ·Ö¸Õë¡£ (Si¡¢Di¶ÔÊ×µØÖ·µÄ´æ´¢)
DI(Destination Index)£ºÄ¿µÄ±äÖ·¼Ä´æÆ÷£¬Ö÷ÒªÓÃÀ´´æ·ÅÏà¶ÔÓÚES¶Î֮ĿǰµÄ±äÖ·Ö®Ö·Ö¸Õë¡£ Õâ4¸ö16λ¼Ä´æÆ÷Ö»Äܰ´16λ½øÐдæÈ¡²Ù×÷£¬Ö÷ÒªÓÃÀ´ÐγɲÙ×÷ÊýµÄµØÖ·£¬ÓÃÓÚÔÚ¶ÑÕ»²Ù×÷ºÍ±äÖ·ÔËËãÖмÆËã²Ù×÷ÊýµÄÓÐЧµØÖ· 2£©¶Î¼Ä´æÆ÷(Segment Register)
4¸ö16λ¶Î¼Ä´æÆ÷£¬×¨ÃÅÓÃÀ´±£´æ¶ÎµØÖ·£º
CS(Code Segment)£º´úÂë¶Î¼Ä´æÆ÷£¬´æ·Åµ±Ç°ÕýÔÚÔËÐеijÌÐò¡£
DS(Data Segment)£ºÊý¾Ý¶Î¼Ä´æÆ÷£¬Êý¾Ý¶Î´æ·Åµ±Ç°ÔËÐгÌÐòËùÓеÄÊý¾Ý£¬¡£ SS(Stack Segment)£º¶ÑÕ»¶Î¼Ä´æÆ÷£¬¶ÑÕ»¶Î¶¨ÒåÁ˶ÑÕ»µÄËùÔÚÇøÓò¡£ ES(Extra Segment)£º¸½¼Ó¶Î¼Ä´æÆ÷¡£
ÓÉÓڶμĴæÆ÷¶¼ÊÇ16λµÄ£¬ËùÓÐÖ»ÄÜÔÚ¿ÉѰַ¿Õ¼äСÓÚ64KBµÄÇé¿öϱ»Éè³ÉÈÎÒâ´óС¡£ 3£©×¨ÓüĴæÆ÷×é
°üÀ¨Ö¸ÁîÖ¸ÕëIP(Instruction Pointer) ºÍ±êÖ¾¼Ä´æÆ÷FR(Flag Register) IP£º16λרÓüĴæÆ÷£¬ËüÖ¸Ïòµ±Ç°ÐèҪȡ³öµÄÖ¸Áî×Ö½Ú¡£ÈçÏÂ
IP=PC{pc+1->pc pc +n->pc}
×¢Ò⣬IPÖ¸ÏòµÄÊÇÖ¸ÁîµØÖ·µÄ¶ÎÄÚµØÖ·Æ«ÒÆÁ¿£¬ÓÖ³ÆÆ«ÒƵØÖ·(Offset Address)»òÓÐЧµØÖ·EA(Effective Address)¡£
FR£º=PSW¡£FRÓÐ16룬ÆäÖÐÓÐÒâÒåµÄÓÐ9λ-----6λ״̬룬3λÊÇ¿ØÖÆÎ»¡£¾ßÌ庬ÒåÈçÏ¡££¨16=9+7(ûÓÐÒâÒå),9=6¸ö״̬λ+3¸ö¿ØÖÆÎ»£©
OF£¬Òç³ö±ê־λ¡£·´Ó³ÓзûºÅÊý¼Ó¼õÔËËãËùµÃ½á¹ûÊÇ·ñÒç³ö¡£Òç³ö£¬OF=1£¬·ñÔòOF=0. DF£¬·½Ïò±êÖ¾£¬¸ÃλÓÃÀ´¾ö¶¨ÔÚ´®²Ù×÷Ö¸ÁîÖ´ÐÐʱÓйØÖ®Õù¼Ä´æÆ÷Ö¸Ïò¸ßµØÖ·»òµÍµØÖ·µÄ·½Ïò¡£