资源描述:
《汇编语言程序设计(第五版).ppt》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、AssemblyLanguageforIntel-BasedComputers,5thEditionChapter3:AssemblyLanguageFundamentals(c)PearsonEducation,2006-2007.Allrightsreserved.Youmaymodifyandcopythisslideshowforyourpersonaluse,orforuseintheclassroom,aslongasthiscopyrightstatement,theauthor'sname,andthetit
2、learenotchanged.SlidespreparedbytheauthorRevisiondate:June4,2006KipIrvineChapterOverviewBasicElementsofAssemblyLanguageExample:AddingandSubtractingIntegersAssembling,Linking,andRunningProgramsDefiningDataSymbolicConstantsReal-AddressModeProgrammingBasicElementsofAs
3、semblyLanguageIntegerconstantsIntegerexpressionsCharacterandstringconstantsReservedwordsandidentifiersDirectivesandinstructionsLabelsMnemonicsandOperandsCommentsExamplesIntegerConstantsOptionalleading+or–signbinary,decimal,hexadecimal,oroctaldigitsCommonradixcharac
4、ters:h–hexadecimald–decimalb–binaryr–encodedrealExamples:30d,6Ah,42,1101bHexadecimalbeginningwithletter:0A5hIntegerExpressionsOperatorsandprecedencelevels:Examples:CharacterandStringConstantsEnclosecharacterinsingleordoublequotes'A',"x"ASCIIcharacter=1byteEnclosest
5、ringsinsingleordoublequotes"ABC"'xyz'EachcharacteroccupiesasinglebyteEmbeddedquotes:'Say"Goodnight,"Gracie'ReservedWordsandIdentifiersReservedwordscannotbeusedasidentifiersInstructionmnemonics,directives,typeattributes,operators,predefinedsymbolsSeeMASMreferenceinA
6、ppendixAIdentifiers1-247characters,includingdigitsnotcasesensitivefirstcharactermustbealetter,_,@,?,or$DirectivesCommandsthatarerecognizedandacteduponbytheassemblerNotpartoftheIntelinstructionsetUsedtodeclarecode,dataareas,selectmemorymodel,declareprocedures,etc.no
7、tcasesensitiveDifferentassemblershavedifferentdirectivesNASMnotthesameasMASM,forexampleInstructionsAssembledintomachinecodebyassemblerExecutedatruntimebytheCPUWeusetheIntelIA-32instructionsetAninstructioncontains:Label(optional)Mnemonic(required)Operand(dependsonth
8、einstruction)Comment(optional)LabelsActasplacemarkersmarkstheaddress(offset)ofcodeanddataFollowidentiferrulesDatalabelmustbeuniqueexample:myArray