IDE >> TextPad 4.5

 

Updated: 12/22/2003

TextPad is a registered trademark of Helios Software Solutions. Their web site is www.textpad.com.

Helios has permitted us to distribute an unregistered evaluation copy of TextPad 4. I personally use it as my editor of choice for assembly language because it can easily customized. I particularly like its built-in syntax highlighting feature.

In this short tutorial, we will show you how to add commands to the Tools menu in TextPad, so you can easily assemble, link, and debug your assembly language programs.

First: Run the TextPad4.exe program located in the \TextPad directory of the CDROM in your book. This program will install the TextPad 4 text editor. Click here to begin adding the Tool commands.

Optional: Create a MASM document class in TextPad. This will enable you to customize colors, add syntax highlighting, and configure other options.

Optional: Test your configuration. If you're writing 32-bit programs, open the AddSub.asm program from Chapter 3. If you're writing 16-bit programs, open the AddSubR.asm program from the same directory. Select the appropriate Build command from the Tools menu.

Any command you install in the Tools menu will act on the file in the currently active editor window.

Next, modfy the program by intentionally inserting errors. Save the program and build it again. Note how the error messages are formatted in the output window, showing each line number that contains an error. Correct your error and build the program again.

Notice that when you execute the Run MASM tool, you have to close the MS-DOS window after the program has finished. If you want to make the window close immediately, click here.

More Information?

If you need more information, TextPad has extensive online help that shows how to edit the Tools menu. If you're making these modifications for multiple users (as in a laboratory), you can use RegEdit to save the registry subtree to a REG file. Look for the following entry:

HKEY_CURRENT_USER > SOFTWARE > Helios > TextPad 4 > Tool

Advanced Users Only

If you have experience with the MS-Windows system registry, you can download and import one of the following files into your system registry. They will update your TextPad settings automatically, so you will not have to go through the manual steps shown elsewhere in this tutorial:

Important: The registry file time must match your operating system. You cannot use these files to update a Windows 98 registry, for example.

Warning: Back up your system registry before making any changes!

 

 

 

 

 

 

 

 

 


Adding the Tool Commands

You will be adding the following commands to the Tools menu in TextPad:

  • Build 16-bit MASM
  • Debug 16-bit MASM
  • Build 32-bit MASM
  • Debug 32-bit MASM
  • Run MASM

The order and spelling of the commands is unimportant. (It's easy to rearrange and rename existing commands.)

Build 16-bit MASM

This command will be used to assemble and link 16-bit Real-mode programs. Do the following steps, in order:

  1. Select Preferences from the Configure menu.
  2. Select Tools in the left hand pane, and click on Add.
  3. Select DOS command... from the drop-down list.
  4. Enter Build 16-bit MASM in the dialog window, click on OK, and click on Apply.
  5. In the left-hand pane, select Build 16-bit MASM
  6. Paste the following text into the Parameters field: c:\Masm615\make16.bat  $BaseName
  7. Check the options shown in the following image:
    You may optionally select the Capture output option, if you are running either Windows 2000 or Windows XP.

    If you installed the assembler in a directory that contains spaces in any of the folder names along its path, you must surround the path to make16.bat with quotation marks. Suppose you installed MASM in:

    c:\Program Files\Masm615

    Then the Parameters entry for the Build 16-bit MASM command would be:

    "c:\Program Files\Masm615\make16.bat" $BaseName
    

    The same is true for all other Tools menu commands that use the MASM home directory.

Note to Advanced Users: The Capture output option can still be used with Windows 98, but you must remove the PAUSE command located at the end of the make16.bat file. Otherwise, TextPad will fail to terminate the process that runs the batch file, and you will have to power down the computer and restart Windows!

Click on Apply to save your changes.

Debug 16-bit MASM

This command will run the Microsoft CodeView debugger so you can debug 16-bit Real-mode programs. Do the following steps, in order:

  1. Select Preferences from the Configure menu.
  2. Select Tools in the left hand pane, and click on Add.
  3. Select DOS command... from the drop-down list.
  4. Enter Debug 16-bit MASM in the dialog window, click on OK, and click on Apply.
  5. In the left-hand pane, select Debug 16-bit MASM.
  6. Paste the following text into the Parameters field: c:\Masm615\runCV.bat  $BaseName
  7. Check the options shown in the following image:

    The Close DOS window on exit option will appear after you remove the check from the Capture output option.

Click on Apply to save your changes.

Build 32-bit MASM

This command will be used to assemble and link 32-bit Protected mode programs. Do the following steps, in order:

  1. Select Preferences from the Configure menu.
  2. Select Tools in the left hand pane, and click on Add.
  3. Select DOS command... from the drop-down list.
  4. Enter Build 32-bit MASM in the dialog window, click on OK, and click on Apply.
  5. In the left-hand pane, select Build 32-bit MASM.
  6. Paste the following text into the Parameters field: c:\Masm615\make32.bat  $BaseName
  7. Check the options shown in the following image:
You may optionally select the Capture output option, if you are running either Windows 2000 or Windows XP.
Note to Advanced Users: The Capture output option can still be used with Windows 98, but you must remove the PAUSE command located at the end of the make32.bat file.

Click on Apply to save your changes.

(See our note about the Capture output option under the Build 16-bit MASM command.)

Debug 32-bit MASM

This command will let you debug 32-bit Protected mode applications with a debugger of your choice. Click here to read more information about debugging choices.

  1. Select Preferences from the Configure menu.
  2. Select Tools in the left hand pane, and click the Add button on the right side.
  3. Select Program from the drop-down list.
  4. When the Select a File dialog window appears, navigate to the EXE file for the debugger you plan to use. Now you need to navigate to the debugger's EXE file location:
  • Click here if you have installed Microsoft Visual Studio.Net.
  • Click here if you have installed Microsoft Visual Studio 6.0.
  • Click here if you have installed the Microsoft Windows Debugger (WinDbg).

After selecting the debugger filename, you may want to rename the command to something more user-friendly such as Debug 32-bit MASM. To do this, click once on the name, wait for a second. Retype the command's name and press the Enter key. Click on Apply to save your changes.

Run MASM

This command will run the executable program identified by the file in the active edit window. Do the following steps, in order:

  1. Select Preferences from the Configure menu.
  2. Select Tools in the left hand pane, and click on Add.
  3. Select DOS command... from the drop-down list.
  4. Enter Run MASM in the dialog window, click on OK, and click on Apply.
  5. In the left-hand pane, select Run MASM and enter the following information:
  6. Paste the following text into the Parameters field: $BaseName
  7. Verify your Preferences with the following image:
  •  

Click on OK to close the dialog and save your changes. You're done!

Return to Top

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


Improving the Run MASM Command

There is a way to close the MS-DOS window immediately when using the Run MASM command. What you can do is use a batch file named runASM.bat, which you can download by right-clicking on this link and saving the file to your C:\Masm615 directory. Here are the setup steps:

  • Select Preferences from the Configure menu.
  • Click on the + sign next to Tools in the left hand pane to expand the list of tools.
  • Select Run MASM and enter the following information:
  • Notice that we've checked the Close DOS window on exit option. The window will close as soon as the batch file finishes.

     

Click on OK to save your changes.

Back to the top

 

 

 

 


Microsoft Visual Studio 6.0 Debugger

The debugger's filename is msdev.exe. Find it and click on Open. Enter the following parameters:

  •  

Click on Apply to save your changes.

Continue to the RUN MASM command.

 

 

 

 

 

 

 

 

 

 


Microsoft Visual Studio.Net Debugger

The debugger's filename is devenv.exe, usually located in the <SystemDrive>\Program Files\Microsoft Visual Studio .NET\Common7\IDE directory. Find it and click on Open. Enter the following parameters:

Click on Apply to save your changes.

Continue to the RUN MASM command.

 

 

 

 

 

 

 

 

 


Microsoft Windows Debugger

The debugger's filename is windbg.exe. Find it and click on Open. Enter the following parameters:

(-QY auto-saves the debugger's workspace file. -g skips over the MS-Windows startup code that launches your program. -G skips the MS-Windows cleanup code that executes after your program has ended.) For more information about debugging options, press F1 in WinDbg and look for the topic command-line options under Reference.)

Click on Apply to save your changes.

Continue to the RUN MASM command.