1 ;This file demonstrates many of the differences between NASM version X and NASM
4 ; changes.asm is copyright (C) 1998 John S. Fine
6 ; It may be redistributed under the same conditions as NASM as described in
7 ; Licence file in the NASM archive
8 ;_________________________________
10 ; nasm changes.asm -l changes.lst
12 ; When assembled without any -d switches, it includes examples which:
13 ; Work correctly in version X
14 ; and Work incorrectly and/or display warnings in version 0.97
15 ; and Do not prevent the generation of output in version 0.97
17 ; Not all the differences can be seen in the .lst file. I suggest that you use
18 ; "ndisasm changes" to examine the code actually generated.
19 ;_________________________________
21 ; nasm changes.asm -l changes.lst -doldmsg
23 ; When assembled with -doldmsg, it adds examples which:
24 ; Work correctly in version X
25 ; and Generate error messages in version 0.97 and do not generate output
26 ;_________________________________
28 ; nasm changes.asm -l changes.lst -doldcrash
30 ; When assembled with -doldcrash, it adds examples which:
31 ; Work correctly in version X
32 ; and Cause NASM to crash in version 0.97
33 ;_________________________________
35 ; nasm changes.asm -l changes.lst -dnewmsg
37 ; When assembled with -dnewmsg, it adds examples which:
38 ; Generate error messages in version X
39 ; and Generate wrong output without warning or error message in version 0.97
40 ;-----------------------------------------------------------------------------
42 ; Please note that I have reported the name of the person who made the
43 ; correction based on very limited information. In several cases, I am sure I
44 ; will identify the wrong author. Please send me any corrections; I don't
45 ; intend to insult or exclude anyone.
47 ;-----------------------------------------------------------------------------
48 ; Bug fixed by Simon in assemble()
50 ; The following generated "call next" / "call next-1" instead of
51 ; two copies of "call next"
56 ;-----------------------------------------------------------------------------
57 ; Bug fixed by John in parse_line() (and other routines)
59 ; This used to jmp to prior.1, when it should be here.1
66 ;-----------------------------------------------------------------------------
67 ; Bug fixed by John in assemble()
69 ; Strings used in dq and dt were not zero filled correctly
74 ;-----------------------------------------------------------------------------
75 ; Bug fixed by Simon in isn_names[]
77 ; Was not recognised as an instruction
81 ;-----------------------------------------------------------------------------
82 ; Bug fixed by Jim Hague in ???
84 ; Forward references were instruction level rather than per operand
86 shr word [forwardref
],1
89 ;-----------------------------------------------------------------------------
90 ; Bug fixed by John in preproc.c
92 ; It used to silently discard id characters appended to a multi-line
93 ; macro parameter (such as the x in %1x below).
102 ;***************************************************************
104 ; The following examples will generate error messages in 0.97 and will generate
105 ; correct output in the new version.
107 ;-----------------------------------------------------------------------------
108 ; Bug fixed by Simon in isns.dat
110 ; The optional "near" was not permitted on JMP and CALL
114 ;-----------------------------------------------------------------------------
115 ; Feature added by Simon in stdscan()
117 ; You can now use the numeric value of strings in %assign
122 ;-----------------------------------------------------------------------------
123 ; Feature added by John in add_vectors()
125 ; Stranger address expressions are now supported as long as they resolve to
128 mov ax, [eax + ebx + ecx - eax]
130 ;-----------------------------------------------------------------------------
131 ; Bug fixed by Simon in ???
133 ; The EQU directive affected local labels in a way that was inconsistent
140 ;-----------------------------------------------------------------------------
141 ; Feature added by Jules in parse_line
143 ; You can override a size specifier
145 %define arg1
dword [bp+4]
148 ;-----------------------------------------------------------------------------
149 ; Bug fixed by John in preproc.c
151 ; You could not use a label on the same line with a macro invocation, if the
152 ; macro definition began with a preprocessor directive.
159 at mytype.long
, dd 'ABCD'
162 ;-----------------------------------------------------------------------------
163 ; Warning removed by John in preproc.c
165 ; In order to allow macros that extend the definition of instructions, I
166 ; disabled the warning on a multi-line macro referencing itself.
168 %endif
;NASM 0.97 doesn't handle %0 etc. inside false %if
179 ;-----------------------------------------------------------------------------
180 ; Warning removed by John in preproc.c
182 ; To support other types of macros that extend the definition of instructions,
183 ; I disabled the warning on a multi-line macro called with the wrong number of
184 ; parameters. PUSH and POP can be extended equally well by either method, but
185 ; other intruction extensions may need one method or the other, so I made both
188 ; Note that neither of these warnings was really needed, because a later stage
189 ; of NASM would almost always give an adequate error message if the macro use
205 %ifdef newmsg
;***************************************************************
207 ;-----------------------------------------------------------------------------
208 ; Bug fixed by John in parse_line() (and other routines)
210 ; This invalid code used to assemble without errors
215 ;-----------------------------------------------------------------------------
216 ; Change made by John in preproc.c
218 ; In 0.97, an id that appears as a label on a macro invocation was always
219 ; prepended to the first line of the macro expansion. That caused several
220 ; bugs, but also could be used in tricks like the arg macro in c16.mac and
223 ; In version X, an id that appears as a label on a macro invocation will
224 ; normally be defined as a label for the address at which the macro is
225 ; invoked, regardless of whether the first line of the macro expansion is
226 ; something that can take a label. The new token %00 may be used for any
227 ; of the situations in which the old prepend behavior was doing something
228 ; tricky but useful. %00 can also be used more than once and in places
229 ; other than the start of the expansion.
234 %imacro arg
0-1 2 ;arg defined the old way
236 %assign arg_off
%1+arg_off
243 %imacro arg2
0-1 2 ;arg defined the new way
245 %assign arg_off
%1+arg_off
251 ;-----------------------------------------------------------------------------
252 ; Change made by Jules and John in INSNS.DAT
254 ; Various instruction in which the size of an immediate is built-in to the
255 ; instruction set, now allow you to redundantly specify that size as long
256 ; as you specify it correctly
271 ; note "ENTER" has not been changed yet.
275 %ifdef oldcrash
;*************************************************************
277 This_label_is_256_characters_long__There_used_to_be_a_bug_in_stdscan_which_made_it_crash_when_it_did_a_keyword_search_on_any_label_longer_than_255_characters__Now_anything_longer_than_MAX_KEYWORD_is_always_a_symbol__It_will_not_even_try_a_keyword_search___
279 ;-----------------------------------------------------------------------------
280 ; Bug fixed by John in preproc.c
282 ; Builds of NASM that prohibit dereferencing a NULL pointer used to crash if a
283 ; macro that started with a blank line was invoked with a label