Introduction to MASM Assemble-Link Execute Cycle Listing File

Introduction to MASM Assemble-Link Execute Cycle Listing File

Introduction to MASM ICT106 Fundamentals of • Originally developed by Microsoft for MS- Computer Systems DOS operating system; Practice Week 9 • Support a wide variety of macro facilities and structured programming; MASM 6.11 Reference • Support for 16-bit and 32-bit versions; • The latest version is called MASM32 V9; • MASM 611 version is used for demonstration and lab practices. school of information technology ICT 106 _Week 9_06 2 school of information technology Assemble-Link Execute Cycle Listing File • The following diagram describes the steps from creating a source • Use it to see how your program is program through executing the compiled program. compiled • If the source code is modified, Steps 2 through 4 must be repeated. • Contains – source code – addresses – object code (machine language) – segment names – symbols (variables, procedures, and constants) • Example: hello.lst ICT 106 _Week 9_06 3 school of information technology ICT 106 _Week 9_06 4 school of information technology 1 Map File MASM Tools • Information about each program • CodeView Debugger runs the assembled segment: or compiled program while simultaneously – starting address displaying the program source code, – ending address –size program variables, etc – segment type • CVPACK is used to reduce the size of an • Example: hello.map executable file that contains CodeView debugging information ICT 106 _Week 9_06 5 school of information technology ICT 106 _Week 9_06 6 school of information technology • The HELPMAKE utility creates help files • The LIB utility helps create, organise, and and customised the help files supplied with maintain run-time libraries Microsoft language products • The LINK utility combines object files into • The H2INC utility converts C header (.H) a single executable file or dynamic-link library files into MASM-compatible include (.INC) files. It translates declarations and • The MASM program converts command- line options from MASM style to ML style, prototypes, but does not translate code adds options to maximise compatibility, and calls ML.EXE ICT 106 _Week 9_06 7 school of information technology ICT 106 _Week 9_06 8 school of information technology 2 • The ML program assembles and links one • The Microsoft Programmer’s WorkBench or more assembly-language source files. (PWB) provides an integrated environment The command-line options are case for developing programs in assembly sensitive language. • The NMAKE utility automates the process • The QuickHelp utility displays Help files. of compiling and linking project files ICT 106 _Week 9_06 9 school of information technology ICT 106 _Week 9_06 10 school of information technology Microsoft Assembler (ML) • The ML program assembles and links one or • The options parameter consists of zero or more assembly language source files more command-line options; •Syntax • You can use either a slash (/) or dash (-) ML [options] filename [[options] filename] … [/link linkoptions] before each option; • For example, assembles the source file • Multiple options are allowed but they must hello.asm and produces the object file hello.obj be separated by at least one space; ML /c hello.asm • Note that the command-line options are case sensitive. ICT 106 _Week 9_06 11 school of information technology ICT 106 _Week 9_06 12 school of information technology 3 ML Command-Line Options •/? •/Fefilename – Display a summary of ML command-line syntax – Names the executable file. Note that the filename •/c is limited to only 8 characters – E.g. ML /FeHi.exe hello.asm – Assembles only. Does not link – E.g. ML /c hello.asm •/Fl[filename] •/Cu – Generates an assembled code listing – E.g. ML /FlHi.lst hello.asm – Maps all identifiers to uppercase – E.g. ML /Cu hello.asm ICT 106 _Week 9_06 13 school of information technology ICT 106 _Week 9_06 14 school of information technology •/Fm[filename] •/I pathname – Creates a linker map file – Sets path for include file. A maximum of 10 /I – E.g. ML /FmHi.map hello.asm options is allowed •/Fofilename – E.g. ML /l include\ hello.asm – Names an object file • /link – E.g. ML /FoHi.obj hello.asm – Linker options and libraries •/Sn – Turns off symbol table when producing a listing ICT 106 _Week 9_06 15 school of information technology ICT 106 _Week 9_06 16 school of information technology 4 Link Command-Link Options •/Ta filename •Syntax – Assembles source file whose name does not end LINK objfiles [, [exefile] [, [mapfile] [, with the .ASM extension [libraries] [, [deffile] ] ] ] ] – E.g. ML /Ta hello.txt •/CO •/Zi – Adds symbolic data and line numbers needed by – Generates CodeView information in object file the Microsoft CodeView debugger. •/Zs •/F – Performs a syntax check only – Optimises far calls ICT 106 _Week 9_06 17 school of information technology ICT 106 _Week 9_06 18 school of information technology •/INF •/ST:number – Displays to the standard output the phase of – Sets the stack size to number bytes, from 1 byte to linking and names of object files being linked 64K •/M •/T – Adds public symbols to the map file – Creates a tiny-model MS-DOS program with a •/NOF .COM extension instead of .EXE – Turns off far-call optimisation •/? – Displays a summary of LINK command-link syntax ICT 106 _Week 9_06 19 school of information technology ICT 106 _Week 9_06 20 school of information technology 5 MASM Command-Line Options • MASM is provided to maintain •/L compatibility with old makefiles. You – Creates a normal listing. Translated to /Fl should use the more powerful ML.EXE in •/MU your lab – Converts names to uppercase. Translated to /Cu •/H – Lists command-line arguments. Translated to •/N /help – Suppresses table in listing file. Translated to /Sn •/I pathname •/Z – Specifies an include path – Displays error lines on screen. Ignored ICT 106 _Week 9_06 21 school of information technology ICT 106 _Week 9_06 22 school of information technology Introduction to CodeView • A window-oriented debugging tool that • CodeView would present the user with helps to find and correct errors in MASM several windows that could be tiled, and Microsoft C/C++ programs moved, and otherwise manipulated. Some • It was one of the first debuggers on the of the windows were: – Code window - the code window showed the currently MS-DOS platform that was full-screen debugged code in its source code context. oriented, rather than line oriented – Data window - a hexadecimal dump of a user-specified memory area. – Command window - user commands (using the same or similar syntax as DEBUG.COM) could be entered here. ICT 106 _Week 9_06 23 school of information technology ICT 106 _Week 9_06 24 school of information technology 6 • You can specify CodeView options when •E.g. you assemble a source file with the /Zi option ML /C /Zi hello.asm • If you do not need full symbolic information Link /CO hello in some modules, compile with the /Zd option cv hello.exe ICT 106 _Week 9_06 25 school of information technology ICT 106 _Week 9_06 26 school of information technology CodeView Command-Line Options •/2 •/K – Permits the use of two monitors – Disables installation of keyboard monitors for the • /25 or /43 or /50 program being debugged – Starts in 25/43/50-line mode •/M •/B – Disables CodeView use of the mouse – Starts in black-and-while mode •/R – Enables 80386/486 debug registers ICT 106 _Week 9_06 27 school of information technology ICT 106 _Week 9_06 28 school of information technology 7.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    7 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us