The MASM Forum

General => The Laboratory => Topic started by: Mike on July 31, 2016, 06:15:26 PM

Title: Renumber named labels
Post by: Mike on July 31, 2016, 06:15:26 PM
Hi Everyone,

I wrote a pgm for the Z80 to renumber labels in 1980 and used it regularly. In 2006 I ported it to 16-bit TASM. Now, as a new member of this excellent forum, I'd like to share it as I have just finished upgrading it to 32-bit MASM. Depending on your coding style, you may find it useful.

It renumbers labels from 1 to 99, although I've never written a routine that long. It's very simple to use. Just select the lines containing the routine you want renumbered (including the reference label at the top) and copy it to the clipboard. Then start rls32, which will renumber the labels and put the text back on the clipboard. Then paste the result back into your code (the reference label is omitted).

A MASM routine to be renumbered may look like this:

rtl
rtl4: jmp rtl1
      jmp rtl2
rtl1: jmp rtl2
rtl2: jmp rtl4

The result will be:

rtl1: jmp rtl2
      jmp rtl3
rtl2: jmp rtl3
rtl3: jmp rtl1

I bet you'll hate my coding style, but I'll have to live with that!

Regards
Mike