1. Trang chủ
  2. » Công Nghệ Thông Tin

Thiết kế và lập trình hệ thống - Chương 23

13 361 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 13
Dung lượng 318,71 KB

Nội dung

Thiết kế và lập trình hệ thống - Chương

 ✂✁✄☎ ✆✝✄✞✠✟✡☛✟☞✝✝✌✎✍☛✏✑✒✏✓✔✄✄✆✝✕✖✁✗✘ ✙✞✚✛✜✑1✢✔✎✣✟✌✖✤✑✦✥✤✑✑✜✧✎★✩✪☞✝✫UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6✬✎✭✮✠✯✰✱✲✲✯✳✴✰✎✵StringOperations.MOVS,LODS,STOS,INS,OUTSAllowdatatransfersofabyte,awordoradoubleword,orifrepeated,ablockofeachofthese.TheDflag-bit(direction),SIandDIareimplicitlyused.•D=0:AutoincrementDIandSI.UseCLDinstructiontoclearthisflag.•D=1:AutodecrementDIandSI.UseSTDinstructiontosetit.DI:Accessesdataintheextrasegment.CanNOToverride.SI:Accessesdatainthedatasegment.Canbeoverriddenwithsegmentoverrideprefix.  ✂✁✄☎ ✆✝✄✞✠✟✡☛✟☞✝✝✌✎✍☛✏✑✒✏✓✔✄✄✆✝✕✖✁✗✘ ✙✞✚✛✜✑2✢✔✎✣✟✌✖✤✑✦✥✤✑✑✜✧✎★✩✪☞✝✫UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6✬✎✭✮✠✯✰✱✲✲✯✳✴✰✎✵StringOperations.LODS:LoadsAL,AXorEAXwithdatastoredatthedatasegment(orextrasegment)+offsetgivenbySI.SIisincrementedordecrementedafterwards:STOSB:StoresAL,AXorEAXtotheextrasegment(ES)+offsetgivenbyDI.EScannotbeoverridden.DIisincrementedordecrementedafterwards:LODS ✁✂✁✄☎✆✁✝✞ ✟✠✡✟☛☞☎✟☛✞✟☛ ✌✍✏✎✑✒ ✓ ✁✂✁✄✔LODSB☎✁✕✞ ✟✠✡✟☛☞☎✟☛✞✟☛ ✌✍✏✎✄LODSD☎✆✁✝✞ ✟✠✡✟☛☞☎✟☛✞✟☛ ✌✍✏✎✑doubleword.LODS✆✟✠ ✁✂✁✄☎✖✘✗✙✚✚✒ ✛✙ ✟✜STOS ✁✂✁✄☎✆✟✠✡ ☛☞✞✁✝☎✟☛✞✟☛ ✌✍✏✎✢✒ ✓ ✁✂✁✄✔STOSB☎✆✟✠✡ ☛☞✞✁✕☎ ☛✞ ☛ ✌✍✏✎✄STOSD☎✆✟✠✡ ☛☞✞✆✁✝☎ ☛✞ ☛ ✌✍✏✎✑word.  ✂✁✄☎ ✆✝✄✞✠✟✡☛✟☞✝✝✌✎✍☛✏✑✒✏✓✔✄✄✆✝✕✖✁✗✘ ✙✞✚✛✜✑3✢✔✎✣✟✌✖✤✑✦✥✤✑✑✜✧✎★✩✪☞✝✫UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6✬✎✭✮✠✯✰✱✲✲✯✳✴✰✎✵StringOperations:LODSWEAXEBXECXEDXESPEBPEDIESICSDSESSS  ✁✂✁✄ ☎✆*10H✝✞✞✞+✝✞✞✞11000✟✞✠✡✟✞✠✡+/-2  ✂✁✄☎ ✆✝✄✞✠✟✡☛✟☞✝✝✌✎✍☛✏✑✒✏✓✔✄✄✆✝✕✖✁✗✘ ✙✞✚✛✜✑4✢✔✎✣✟✌✖✤✑✦✥✤✑✑✜✧✎★✩✪☞✝✫UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6✬✎✭✮✠✯✰✱✲✲✯✳✴✰✎✵StringOperations.REPprefix:ExecutestheinstructionCXtimes.NOTE:REPdoesnotmakesensewiththeLODSinstruction.CLD✜ ✖ ✆✕✂☛✁✂.STARTUPMOV AX✄☎ ✆✝☎☎ ✞.EXITEND☎✟✙✟✙✠✡✒☞☛✠✚✙✌✙☛✡✌✍✛✙✜.CODE☎✁✛✛✚✙✎✎✗✒ ✛✙✍✎✙✏✆✝☎☎✜MOV ES✄AXMOV DI✄☎☎✖✓✓✎✙✡☎✜MOV CX✄✢ ✑✒✝☎☎✕✍✔✛✠✍✓☛✡✜MOV AX✄☎ ✔✢☎ ✞☎✕✍✔✛✔✡✡✚✒ ✕✓✡✙✔☛✛✠✖✔✚✜✗✘✙✄✚✛✄✜☎✢✟✙✔✚✡✖✙✎✠✚✙✙☛✜  ✂✁✄☎ ✆✝✄✞✠✟✡☛✟☞✝✝✌✎✍☛✏✑✒✏✓✔✄✄✆✝✕✖✁✗✘ ✙✞✚✛✜✑5✢✔✎✣✟✌✖✤✑✦✥✤✑✑✜✧✎★✩✪☞✝✫UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6✬✎✭✮✠✯✰✱✲✲✯✳✴✰✎✵StringOperations.MOVS:Movesabyte,wordordoublewordfromdatasegmentandoffsetSItoextrasegmentandoffsetDI.Increments/decrementsbothDIandSI:INS/OUTS(notavailableonthe8086):Transfersabyte,wordordoublewordofdatafrom/toanI/Odeviceinto/outoftheextra/datasegment+offsetDI/SI,respectively.TheI/OaddressisstoredintheDXregister.MOVS✆✄✄✆✢☎✆✟✠✡ ☛☞✞ ✟✠✡✟☛☞☎ ☛✞ ☛✌✍✏✎✄☎✟☛✞✟☛ ✌✍✏✎✄MOVSB☎✆✟✠✡ ☛☞✞ ✟✠✡✟☛☞☎ ☛✞ ☛ ✌✍✏✎✄☎✟☛✞✟☛ ✌✍✏✎✄MOVSD☎✆✟✠✡ ☛☞✞ ✟✠✡✟☛☞☎ ☛✞ ☛✌✍✏✎✑☎✟☛✞✟☛ ✌✍✏✎✑ ✁✄✜✂✄✄✂✢☎✆✟✠✡ ☛☞✞✡ ✝☞☎ ☛✞ ☛ ✌✍✏✎✢☎✟☛✞✟☛ ✌✍✏✎✢INSB☎✆✟✠✡ ☛☞✞✡ ✝☞☎ ☛✞ ☛✌✍✏✎✄INSD☎✆✟✠✡ ☛☞✞✡ ✝☞☎ ☛✞ ☛ ✌✍✏✎✑OUTSB☎✡ ✝☞✞ ✟✠✡✟☛☞☎✟☛✞✟☛ ✌✍✏✎✄  ✂✁✄☎ ✆✝✄✞✠✟✡☛✟☞✝✝✌✎✍☛✏✑✒✏✓✔✄✄✆✝✕✖✁✗✘ ✙✞✚✛✜✑6✢✔✎✣✟✌✖✤✑✦✥✤✑✑✜✧✎★✩✪☞✝✫UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6✬✎✭✮✠✯✰✱✲✲✯✳✴✰✎✵StringOperations.INSExample:NOTE:Thisassumesthedeviceisabletomakedataavailableatthespeedoftheprogram,andinsyncwiththeprogram.Sincethisisalmostnevertrue,thecodeaboveneedstohavea“devicestatuscheck”instruction(s).Ofcourse,theREPprefixcannotbeusedinthiscase.ThesameholdstrueforOUTSinstructions.LEA DI✄✕☛✟✂☎✁✛✛✚✙✎✎✔✚✚✔ ✜MOV DX✄✁✁✢✞☎✟✍✌✙☛✍✖✛✙✗✒✠✙✔✛✛✚✙✎✎✜MOV CX✄✑☎✗✘✙ ✁✄✂☎✄✙✡✡✖✙✛✔✡✔✜ .CLD .  ✂✁✄☎ ✆✝✄✞✠✟✡☛✟☞✝✝✌✎✍☛✏✑✒✏✓✔✄✄✆✝✕✖✁✗✘ ✙✞✚✛✜✑7✢✔✎✣✟✌✖✤✑✦✥✤✑✑✜✧✎★✩✪☞✝✫UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6✬✎✭✮✠✯✰✱✲✲✯✳✴✰✎✵MiscellaneousDataTransferOperations.XCHG:Exchangesthecontentsofaregisterwiththecontentsofanyotherregisterormemorylocation.ItcanNOTexchangesegmentregistersormemory-to-memorydata.Byte,wordanddoublewordscanbeexchangedusinganyaddressingmode(exceptimmediate,ofcourse).XLAT:PerformsatablelookupoperationbyconvertingthevalueinALfromanindextoavaluestoredinthecellofatableinmemory. ✁✂✄EDX✄ESI☎✆✆☎✠✖✔☛✏✙✆ ✝✔☛✛✆✟☛ ✁✂✄AL✄ ✁✂✁✢☎✆☎✠✖✔☛✏✙✚✙✏✒✎✡✙✚✔☛✛✌✙✌✍✚ ✗✔✟✓✙✎✜MOV AL✄✑☎✕✍✔✛✒☛✛✙☎✜XLAT .✝✘✟BX✄✖✞✞✟✆✂✂✁✆✕✆☎✆✔✎✙✔✛✛✚✙✎✎✍✓✡✔✕✟✙✜☎✟✟✔✠✕ ✡✙✔✡✁✕✌✆✝✌ ✟✟✒✡✖✁✕✜ .  ✂✁✄☎ ✆✝✄✞✠✟✡☛✟☞✝✝✌✎✍☛✏✑✒✏✓✔✄✄✆✝✕✖✁✗✘ ✙✞✚✛✜✑8✢✔✎✣✟✌✖✤✑✦✥✤✑✑✜✧✎★✩✪☞✝✫UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6✬✎✭✮✠✯✰✱✲✲✯✳✴✰✎✵MiscellaneousDataTransferOperations.INandOUT:Transfersabyte,wordordoublewordofdatafrom/toanI/Odeviceinto/outofAL,AXandEAX,respectively.Memoryoperationsarenotavailable(astheyareinINSandOUTS):Twoforms:•Fixed-portaddressing:8-bitportnumberencodedininstruction.8-bitvalueissign-extendedintoaddressbits8-15.Addressbits16-31areundefined.•Variable-portaddressing:16-bitportnumberstoredinDX. ✁AL✄✠✝☎✝ ✎✕✒✡✎✔✚✙✎✔✗✙✛✡✍✁✕✓✚✍✌☛✍✖✠✍✚✡✠✝✜ ✁EAX✄✠✝☎✁✢✎✕✒✡✎✔✚✙✎✔✗✙✛✡✍✆✁✝✜✛ ✚DX✄EAX☎✁✢✎✕✒✡✎✔✚✙✟✚✒✡✡✙☛✡✍✠✍✚✡ ✝✓✚✍✌✆✁✝✜  ✂✁✄☎ ✆✝✄✞✠✟✡☛✟☞✝✝✌✎✍☛✏✑✒✏✓✔✄✄✆✝✕✖✁✗✘ ✙✞✚✛✜✑9✢✔✎✣✟✌✖✤✑✦✥✤✑✑✜✧✎★✩✪☞✝✫UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6✬✎✭✮✠✯✰✱✲✲✯✳✴✰✎✵MiscellaneousDataTransferOperations.INandOUTExample:Notethattheoldcontentsofthehigher-orderbitpositionsoftheportarepreserved.IN AL✄ ✄ ✞✜ ✖ ✆✕✂☛✁✂.STARTUPOR AL✄✁.EXITEND☎✁✙✔✛✠✍✚✡ ✄ ✞✂✎✠✙✔✄✙✚☎✜.CODE☎✟✙✡✚✒✏✖✡✌✍✎✡✡✟✍✕✒✡✎✜OUT ✄ ✞✄ALLOOP✕✄☎✂✒✌✙✛✙✟✔ ✜IN AL✄ ✄ ✞☎✁✙✔✛✠✍✚✡ ✄ ✞✜AND AL✄☎✞✢✞☎✢✟✙✔✚✚✒✏✖✡✌✍✎✡✡✟✍✕✒✡✎✜✛ ✚ ✄ ✞✄AL☎✟✠✙✔✄✙✚✍✓✓✜☎✂✓✚☛✍☛✡✖✙✎✠✙✔✄✙✚✜MOV CX✄✄☎☎☎ ✞☎ ✙✟✔ ✠✍✓☛✡✜L1:  ✂✁✄☎ ✆✝✄✞✠✟✡☛✟☞✝✝✌✎✍☛✏✑✒✏✓✔✄✄✆✝✕✖✁✗✘ ✙✞✚✛✜✑10✢✔✎✣✟✌✖✤✑✦✥✤✑✑✜✧✎★✩✪☞✝✫UMBCU M B CUNIVERSITY OF MARYLAND BALTIMORE COUNTY1 9 6 6✬✎✭✮✠✯✰✱✲✲✯✳✴✰✎✵MiscellaneousDataTransferOperations.MOVSXandMOVZX(80386anduponly):Move-and-sign-extendandMove-and-zero-extend:BSWAP(80486anduponly):Swapsthefirstbytewiththeforth,andthesecondbytewiththethird.Usedtoconvertbetweenlittleendianandbigendian: ✛✁✄ CX✄BL☎✟✒✏☛✎✙☎✡✙☛✛✎✆✕✒☛✡✍✢✝ ✛✁✂ EAX✄ ✁✂✁✢☎✄✙✚✍✙☎✡✙☛✛✎✟✍✚✛✔✡ ✁✂✁✢✒☛✆✆☎✜✂✄✜✟✙EAXEAXEBXECXEDX✡✡✠✠✞✞✝✝✝✝✞✞✠✠✡✡ . 6✬✎✭✮✠✯✰✱✲✲✯✳✴✰✎✵MiscellaneousDataTransferOperations.INandOUT:Transfersabyte,wordordoublewordofdatafrom/toanI/Odeviceinto/outofAL,AXandEAX,respectively.Memoryoperationsarenotavailable(astheyareinINSandOUTS):Twoforms:•Fixed-portaddressing:8-bitportnumberencodedininstruction.8-bitvalueissign-extendedintoaddressbits 8-1 5.Addressbits1 6-3 1areundefined.•Variable-portaddressing:16-bitportnumberstoredinDX. ✁AL✄✠✝☎✝. 6✬✎✭✮✠✯✰✱✲✲✯✳✴✰✎✵MiscellaneousDataTransferOperations.MOVSXandMOVZX(80386anduponly):Move-and-sign-extendandMove-and-zero-extend:BSWAP(80486anduponly):Swapsthefirstbytewiththeforth,andthesecondbytewiththethird.Usedtoconvertbetweenlittleendianandbigendian: ✛✁✄ CX✄BL☎✟✒✏☛✎✙☎✡✙☛✛✎✆✕✒☛✡✍✢✝ ✛✁✂ EAX✄ ✁✂✁✢☎✄✙✚✍✙☎✡✙☛✛✎✟✍✚✛✔✡ ✁✂✁✢✒☛✆✆☎✜✂✄✜✟✙EAXEAXEBXECXEDX✡✡✠✠✞✞✝✝✝✝✞✞✠✠✡✡  ✂✁✄☎

Ngày đăng: 15/11/2012, 11:07

w