Mp Reference 2017 | Assembly Language | Instruction Set

Please download to get full document.

View again

of 23
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Information Report
Category:

Documents

Published:

Views: 0 | Pages: 23

Extension: DOC | Download: 0

Share
Related documents
Description
8086 programming
Transcript
   Introduction to MASM Assembly language unlocks the secrets of computer hardware and software. Assembler will converts source code to machine own language. Microsoft Macro Assembler (MASM), a productof Microsoft Corporation includes several features which makes programming efficient and  productive. his lab sheet gives an overview of how to use MASM for assembling the ! !#  programs. MASM  is a command line assembler. $ser has to first create a file and write assembly program using%&S editor before using the assembler. 't does not have provisions to create, edit, save and debug programs. All the commands accepted by the assembler are entered at the %&S prompt. Execution of 8086 Software programsRun command prompt and go to Masm directory i.e. C:\masm\  Type te program !y opening an editor using Edit command i.e. C:\masm\edit #ename.asm $fter typing te program assem!#e te program using masm command. i.e. C:\masm\masm #ename.asm% $fter assem!#ing& #in' te #e using #in' command i.e. C:\masm\#in' #ename.o!(% )ina##y use de!ug or afde!ug command to execute te program. C:\masm\de!ug #ename .exe *t % for sing#e step execution *g % for at a time execution *+ % for restarting te program execution *d % to see te data segment *, % to ,uit te execution C:\masm\afde!ug #ename .exe )- % for sing#e step execution g % for at a time execution  #ename .exe % to re#oad te program /uit % to come out of te execute screen  Creating a program file Create a file with .asm* e+tension by typing the following command at the %&S command prompt. C:\masm611\bin>EDIT sourcefilenameasmT!e follo ing blue screen ill appear rite ! !# program code in this editor and save. #oading and #in$ing: -un the assembler to create the .com or .e+e file by typing the following command at the command promptCmasm#//bin0MASM sourcefilename.asm. MASM Debugger: Code%ie Code 1iew (C1) is the debugger that comes along with MASM. o launch code view type 2cvsomefile.com3 at the %&S prompts. he startup screen consists of windows, each of which has its ownname and purpose. he main screen of the Code1iew debugger is divided into windows. A good place tostart for debugging assembly language programs is with the following windows since they are the onesmost commonly used 4 he source te+t window 4 he registers5 window 4 he command window The Source window  contains the te+t of your program in assembly language and the line numbers. henCode1iew e+ecutes one command in your e+ecutable module (.C&M), it highlights the correspondingline in your source code in the Source window. o e+ecute one command, press the 6! or 6/ key. The Register window  reflects the current state of the registers and flags. he registers are represented byname (A7, 87 and so on) and their he+adecimal values. 6lag values however have symbolic denotation  (9:, &1 and so on). he -egister window is situated on the right side of the screen. his window appearswhen you press the 6; key and disappears if you press it again. The Command window  is intended for controlling the debugging process. he cursor is usually located inthis window, indicating that you can type in commands. Command < is to <uit the code view. his command finishes the debugging process, and returns control toMS=%&S. he ne+t most useful command is the !  command, which means >elp. $se this command toget online information about Code1iew commands, parameters and features. hese two commands are practically all you need to start working with Code1iew.S?9A7 &6 ! !#@! !! ASSM8B? BA9$A ã he language is not case sensitive. ã here may be only one statement per line. A statement may start in any column. ã A statement is either an instruction, which the assembler translates into machine code, or anassembler directive (pseudo=op), which instructs the assembler to perform some specific task. ã Synta+ of a statementDnameE mnemonic Doperand(s)E DF commentE (a) he curly brackets indicate those items that are not present or are optional in some statements. (b) he name field is used for instruction labels, procedure names, segment names, macro names,names of variables, and names of constants. (c) MASM #./ accepts identifier names up to ;GH characters long. All characters are significant,whereas under MASM I./, names are significant to J/ characters only. 9ames may consist of letters, digits, and the following # special characters &  ' ( ) * .'f a period is usedF it must be the first character. 9ames may not begin with a digit. (d) 'nstruction mnemonics, directive mnemonics, register names, operator names and other wordsare reserved. ã Synta+ of an instructionDlabelE mnemonic Doperand D , operandE E DF commentEhe curly brackets indicate those items that are not present or are optional in some instructions. hus an instruction may have Kero, one, or two operands. ã &peratorshe ! !#@! !! Assembly language has a number of operators. An operator acts on an operand or operands to produce a value at assembly time. +amples are L , = , 4, @ , %$, and &66S ã CommentsA semicolon starts a comment. A comment may follow a statement or it may be on a separate line. Multiple=line comments can be written by using the C&MM9 directive. he synta+ isC&MM9 delimiter  DcommentE  comment   delimiter D comment Ewhere delimiter is any non=blank character not appearing in comment. he curly brackets indicate anitem that is optional.e.g., C&MM9 4his program findsthe ma+imum element in a byte array4 ã  9umbers(a) A binary number is suffi+ed by b or 8.e.g.,// / ///8(b) A decimal number is suffi+ed by an optional d or %.e.g.,G;d=;;%JIH!(c) A he+adecimal number must begin with a decimal digit and it is suffi+ed by h or >e.g.,; > b6;Ah ã CharactersA character is enclosed in a pair of single <uotes or in a pair of double <uotes.e.g.,+*283 ã StringsA string is enclosed in a pair of single <uotes or in a pair of double <uotes.e.g., 9- ?&$- 9AM * 2> MA7'M$M 1AB$ 'S 3 6or a string delimited by single <uotes, a pair of consecutive single <uotes stands for a single <uote.e.g.,&mar* *s books* ã %ata definitionach variable has a data type and is assigned a memory address by the program. he data=definingdirectives are
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks