MASM as standard, fixmem example (Announce)
> > It's a subset of masm and completely public domain.
> >
> > This is what I see as the future - enhancing this
> > public domain assembler so that it gets closer to
> > be able to do things like assemble MSDOS 4.0 source code.
>
> I see your point, but MASM has a lot of heavy features. I don't think even
> TASM fully supported them all.
>
> In particular, one thing that MASM and TASM supported was memory references
> without square brackets, e.g. "MOV MyWordVar,13" instead of "MOV
> [MyWordVar],13". This is somewhat ambiguous (albeit more concise) and not
> supported by almost anyone else (over a dozen different assemblers), so not
> just NASM.
It's fairly complicated to determine whether a source operand is a memory access or an immediate due to this. In my conversion script I check for bare register names, plain numbers, "equates" (with expansions that are plain numbers), cl
, string literals, or whether the operand contains the offset
keyword.
Here's a changeset that describes the scriptlet to use to run fixmem.pl, and the diff of running it on one of lMS-DOS's format source text files.
This still doesn't cover every change needed. In this case, I ran a perl scriptlet to replace the double-dollar label prefixes that are probably written by the SALUT preprocessor. (NASM doesn't like double dollar prefixes.) One of the port labels had to be moved, the result still didn't assemble with NASM due to using a segment override on the source operand of a memory-destination mov
. Then it assembled.
Next I ran another perl scriptlet to replace some equates by %ixdefine
directives, which was needed because psdata.mac expects these to be defines. The local copy of parse.nas had to drop an earlier identicalise nop that had been added while identicalising msbio.
After that I ran yet another perl scriptlet to replace all uses of segment overrides on operands with offset
, which on recent NASM versions is allowed but makes it assemble this operand as a memory operand (if possible). MASM v5.10 appears to just ignore the segment override.
After this I verified that the file is identicalised using my ident86 tool. More on running that on the blog.
> Macros, structs, preprocessor, outputs, and other weird features. For just
> a "simple" assembler program, MASM is overkill.
NASM's preprocessor is fairly complicated as well.
> Yes, it was popular, but no, it's not standard (or even commonly
> supported).
NASM's development has been slow in the last years but I would still prefer that to using a closed source (if "free" under MIT license) MASM version.
> > > > > unlike the MASM that ships with the
> > > > > 2024 April MS-DOS v4 release. So therefore I think NASM is better.
>
> They ship MASM v5, right?
Yes, v5.10 to be precise. The MS-DOS v2 source tree ships v1.10 as well, which I used to use to build MSDebug, my MS-DOS Debug fork/recreation.
> > > > I personally don't want to involved in a non-standard
> > > > language.
> > >
> > > I don't see how NASM is "non-standard", unless you want to define a
> > > "standard" as just whatever dialect has the single largest existing
> code
> > > base or whatever tool has been the single most popular choice at one
> > > point in time.
>
> NASM was originally strictly two-pass, so some things they did without.
> (There are even one-pass assemblers with even more restrictions.)
NASM has been multi-pass for a long time now.
> Standards exist, even unofficial ones, but you more or less have to cope
> with your own workarounds. (It's feasible to write a Sed script to quickly
> adapt syntax between assemblers for specific bits of code.)
You can look at the full sources of fixmem.pl to see how much I already added to handle the MASM to NASM conversion.
> "Standard"? You don't strictly need it. You can roll your own syntax.
> Admittedly weird (and annoying when everybody is incompatible) but totally
> valid if you can prove it's better somehow (ahem, TASM's Ideal mode).
I don't recall much that uses Ideal mode. Maybe doslfn?
---
l
Complete thread:
- MSDOS 4.0 - kerravon, 26.04.2024, 04:43 (Announce)
- MSDOS 4.0 - Guti, 26.04.2024, 14:06
- MSDOS 4.0 - Oso2k, 26.04.2024, 15:38
- MSDOS 4.0 - roytam, 26.04.2024, 17:05
- MSDOS 4.0 - Japheth, 26.04.2024, 17:34
- MSDOS 4.0 - RayeR, 27.04.2024, 03:05
- MSDOS 4.0 - Ringding, 01.05.2024, 13:34
- MSDOS 4.0 - rr, 01.05.2024, 14:37
- MSDOS 4.0 - kerravon, 29.04.2025, 06:34
- MSDOS 4.0 - kerravon, 29.04.2025, 08:14
- MSDOS 4.0 - kerravon, 29.04.2025, 08:47
- MSDOS 4.0 - ecm, 29.04.2025, 09:50
- MSDOS 4.0 - kerravon, 29.04.2025, 10:40
- MSDOS 4.0 - ecm, 29.04.2025, 11:07
- MSDOS 4.0 - kerravon, 29.04.2025, 11:50
- MSDOS 4.0 -- MASM as standard - Rugxulo, 29.04.2025, 20:40
- MSDOS 4.0 -- MASM as standard - kerravon, 29.04.2025, 21:43
- MSDOS 4.0 -- MASM as standard - Rugxulo, 30.04.2025, 10:55
- MSDOS 4.0 -- MASM as standard - kerravon, 30.04.2025, 16:17
- MSDOS 4.0 -- MASM as standard - Rugxulo, 30.04.2025, 10:55
- MASM as standard, fixmem example - ecm, 01.05.2025, 12:24
- MASM as standard, fixmem example - Japheth, 02.05.2025, 16:10
- MASM as standard, fixmem example - bretjohn, 02.05.2025, 17:09
- MASM as standard, fixmem example - Rugxulo, 07.05.2025, 03:23
- MASM as standard, fixmem example - Rugxulo, 07.05.2025, 03:05
- MASM as standard, fixmem example - bretjohn, 02.05.2025, 17:09
- MASM as standard, fixmem example - Japheth, 02.05.2025, 16:10
- MSDOS 4.0 -- MASM as standard - kerravon, 29.04.2025, 21:43
- MSDOS 4.0 -- MASM as standard - Rugxulo, 29.04.2025, 20:40
- MSDOS 4.0 - kerravon, 29.04.2025, 11:50
- MSDOS 4.0 - ecm, 29.04.2025, 11:07
- MSDOS 4.0 - kerravon, 29.04.2025, 10:40
- MSDOS 4.0 - ecm, 29.04.2025, 09:50
- MSDOS 4.0 - kerravon, 29.04.2025, 08:47
- MSDOS 4.0 - kerravon, 29.04.2025, 08:14
- MSDOS 4.0 - kerravon, 29.04.2025, 06:34
- MSDOS 4.0 - rr, 01.05.2024, 14:37
- MSDOS 4.0 - Japheth, 26.04.2024, 17:34
- MSDOS 4.0 - rr, 26.04.2024, 22:00
- MSDOS 4.0 - usotsuki, 30.04.2024, 17:41
- MSDOS 4.0 - boeckmann, 30.04.2024, 21:03