A few years ago I made some general-purpose macros for TASM that give certain C-like abilities to TASM. I was converting a large amount of ASM code to C, so I wanted to be able to make an "intermediate" ASM version whose structure easily translated to C. Since then I discovered that it is useful to use these macros in all ASM code. Some of the features:

- Generate addresses for "if" blocks (note-- code isn't generated, just addresses), and "loop" blocks
- Declare and use local stack variables and stack parameters without wasting ebp
- "Case" blocks, which are like "switch" blocks in C, which automatically create a jump table based on the "case" statements
- Easily define and write "stdcall" functions (other formats can be added, since it's just macros)
- Checks (at compile time) for certain illegal stack changes (for example, if ESP is changes by a different amount between IF..ELSE and ELSE..ENDIF)

I also have something for structures, but I recently changed everything to Ideal mode, and the strucs in ideal mode are way better than mine, so I ditched them.

Anyway, I released them a few years ago but they garnered little attention. Is this something that would be worth cleaning up and releasing? Or are there better tools for all of this? I know there is some high level stuff in MASM, but I kind of dislike it because it generates code, and I hate using its stack stuff because it wastes ebp. The other good thing about using macros is that you can pretty easily tell what the rules are, and you can upgrade things whenever you want.
Posted on 2004-08-30 02:10:47 by yessopotamus