NASM 0.98p3.2
authorH. Peter Anvin <hpa@zytor.com>
Tue, 30 Apr 2002 20:54:58 +0000 (20:54 +0000)
committerH. Peter Anvin <hpa@zytor.com>
Tue, 30 Apr 2002 20:54:58 +0000 (20:54 +0000)
28 files changed:
Changes
MODIFIED
Makefile.in
Mkfiles/Makefile.bc2 [moved from Makefile.bc2 with 100% similarity]
Mkfiles/Makefile.bor [moved from Makefile.bor with 100% similarity]
Mkfiles/Makefile.dj [moved from Makefile.dj with 100% similarity]
Mkfiles/Makefile.dos [moved from Makefile.dos with 100% similarity]
Mkfiles/Makefile.lcc [moved from Makefile.lcc with 100% similarity]
Mkfiles/Makefile.sc [moved from Makefile.sc with 100% similarity]
Mkfiles/Makefile.scw [moved from Makefile.scw with 100% similarity]
Mkfiles/Makefile.unx [moved from Makefile.unx with 100% similarity]
Mkfiles/Makefile.vc [moved from Makefile.vc with 100% similarity]
Mkfiles/Makefile.wc [moved from Makefile.wc with 100% similarity]
Mkfiles/Makefile.wcw [moved from Makefile.wcw with 100% similarity]
c16.mac [new file with mode: 0644]
c32.mac [new file with mode: 0644]
changes.asm [new file with mode: 0644]
eval.c
exebin.mac [new file with mode: 0644]
insns.bas [deleted file]
insns.dat
macros.bas [deleted file]
macros.c
nasm.h
outform.h
rdoff/Makefile.in
standard.mac
zoutieee.c

diff --git a/Changes b/Changes
index 57584bd..a2a291d 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,9 @@
 Change log for NASM
 ===================
 
+This is the Changelog for the official releases; this is a modified
+version.  For the changes from the official release, see the MODIFIED file.
+
 0.90 released October 1996
 --------------------------
 
index f7626f3..b91f956 100644 (file)
--- a/MODIFIED
+++ b/MODIFIED
@@ -2,17 +2,44 @@ This is a modified version of NASM, modified and released by H. Peter
 Anvin <hpa@zytor.com>; it is not the original form released by the
 NASM authors.
 
-The changes include:
 
-1. Merged nasm098p3.zip with nasm-0.97.tar.gz to create a fully
-   buildable version for Unix systems (Makefile.in updates, etc.)
+For release 0.98.3.2:
 
-2. Changed insns.pl to create the instruction tables in nasm.h and
-   names.c, so that a new instruction can be added by adding it *only*
-   to insns.dat.
+* Merged in John S. Fine's changes from his 0.98-J4 prerelease; see
+  http://www.csoft.net/cz/johnfine/
 
-3. Added the following new instructions: SYSENTER, SYSEXIT, FXSAVE,
-   FXRSTOR, UD1, UD2 (the latter two are two opcodes that Intel
-   guarantee will never be used; one of them is documented as UD2 in
-   Intel documentation, the other one just as "Undefined Opcode" --
-   calling it UD1 seemed to make sense.)
+* Changed previous "spotless" Makefile target (appropriate for distribution)
+  to "distclean", and added "cleaner" target which is same as "clean"
+  except deletes files generated by Perl scripts; "spotless" is union.
+
+* Removed BASIC programs from distribution.  Get a Perl interpreter
+  instead (see below.)
+
+* Calling this "pre-release 3.2" rather than "p3-hpa2" because of
+  John's contributions.
+
+* Actually link in the IEEE output format (zoutieee.c); fix a bunch of
+  compiler warnings in that file.  Note I don't know what IEEE output
+  is supposed to look like, so these changes were made "blind".
+
+
+For release 0.98p3-hpa:
+
+* Merged nasm098p3.zip with nasm-0.97.tar.gz to create a fully
+  buildable version for Unix systems (Makefile.in updates, etc.)
+
+* Changed insns.pl to create the instruction tables in nasm.h and
+  names.c, so that a new instruction can be added by adding it *only*
+  to insns.dat.
+
+* Added the following new instructions: SYSENTER, SYSEXIT, FXSAVE,
+  FXRSTOR, UD1, UD2 (the latter two are two opcodes that Intel
+  guarantee will never be used; one of them is documented as UD2 in
+  Intel documentation, the other one just as "Undefined Opcode" --
+  calling it UD1 seemed to make sense.)
+
+* A note on the BASIC programs included: forget them.  insns.bas is
+  already out of date.  Get yourself a Perl interpreter for your
+  platform of choice at:
+
+       http://www.cpan.org/ports/index.html
index 063e492..750eb8a 100644 (file)
@@ -90,9 +90,14 @@ clean:
        rm -f *.o nasm ndisasm
        cd rdoff; $(MAKE) clean
 
-spotless: clean
+distclean: clean
        rm -f config.* Makefile *~
-       cd rdoff; $(MAKE) spotless
+       cd rdoff; $(MAKE) distclean
+
+cleaner: clean
+       rm -f insnsa.c insnsd.c insnsi.h insnsn.c macros.c
+
+spotless: distclean cleaner
 
 rdf:
        cd rdoff; $(MAKE)
similarity index 100%
rename from Makefile.bc2
rename to Mkfiles/Makefile.bc2
similarity index 100%
rename from Makefile.bor
rename to Mkfiles/Makefile.bor
similarity index 100%
rename from Makefile.dj
rename to Mkfiles/Makefile.dj
similarity index 100%
rename from Makefile.dos
rename to Mkfiles/Makefile.dos
similarity index 100%
rename from Makefile.lcc
rename to Mkfiles/Makefile.lcc
similarity index 100%
rename from Makefile.sc
rename to Mkfiles/Makefile.sc
similarity index 100%
rename from Makefile.scw
rename to Mkfiles/Makefile.scw
similarity index 100%
rename from Makefile.unx
rename to Mkfiles/Makefile.unx
similarity index 100%
rename from Makefile.vc
rename to Mkfiles/Makefile.vc
similarity index 100%
rename from Makefile.wc
rename to Mkfiles/Makefile.wc
similarity index 100%
rename from Makefile.wcw
rename to Mkfiles/Makefile.wcw
diff --git a/c16.mac b/c16.mac
new file mode 100644 (file)
index 0000000..2853db5
--- /dev/null
+++ b/c16.mac
@@ -0,0 +1,41 @@
+; NASM macro set to make interfacing to 16-bit programs easier -*- nasm -*-\r
+\r
+%imacro proc 1                 ; begin a procedure definition\r
+%push proc\r
+         global %1\r
+%1:      push bp\r
+         mov bp,sp\r
+%ifdef FARCODE PASCAL          ; arguments may start at bp+4 or bp+6\r
+%assign %$arg 6\r
+%define %$firstarg 6\r
+%else\r
+%assign %$arg 4\r
+%define %$firstarg 4\r
+%endif\r
+%define %$procname %1\r
+%endmacro\r
+\r
+%imacro arg 0-1 2              ; used with the argument name as a label\r
+%00      equ %$arg\r
+                               ; we could possibly be adding some\r
+                               ; debug information at this point...?\r
+%assign %$arg %1+%$arg\r
+%endmacro\r
+\r
+%imacro endproc 0\r
+%ifnctx proc\r
+%error Mismatched `endproc'/`proc'\r
+%else\r
+          mov sp,bp\r
+          pop bp\r
+%ifdef PASCAL\r
+          retf %$arg - %$firstarg\r
+%elifdef FARCODE\r
+         retf\r
+%else\r
+         retn\r
+%endif\r
+__end_%$procname:              ; useful for calculating function size\r
+%pop\r
+%endif\r
+%endmacro\r
diff --git a/c32.mac b/c32.mac
new file mode 100644 (file)
index 0000000..6abad99
--- /dev/null
+++ b/c32.mac
@@ -0,0 +1,26 @@
+; NASM macro set to make interfacing to 32-bit programs easier -*- nasm -*-\r
+\r
+%imacro proc 1                 ; begin a procedure definition\r
+%push proc\r
+          global %1\r
+%1:       push ebp\r
+          mov ebp,esp\r
+%assign %$arg 8\r
+%define %$procname %1\r
+%endmacro\r
+\r
+%imacro arg 0-1 4              ; used with the argument name as a label\r
+%00      equ %$arg\r
+%assign %$arg %1+%$arg\r
+%endmacro\r
+\r
+%imacro endproc 0\r
+%ifnctx proc\r
+%error Mismatched `endproc'/`proc'\r
+%else\r
+         leave\r
+         ret\r
+__end_%$procname:              ; useful for calculating function size\r
+%pop\r
+%endif\r
+%endmacro\r
diff --git a/changes.asm b/changes.asm
new file mode 100644 (file)
index 0000000..3ae24ed
--- /dev/null
@@ -0,0 +1,292 @@
+;This file demonstrates many of the differences between NASM version X and NASM\r
+;version 0.97\r
+;\r
+; changes.asm is copyright (C) 1998 John S. Fine\r
+;\r
+;  It may be redistributed under the same conditions as NASM as described in\r
+;  Licence file in the NASM archive\r
+;_________________________________\r
+;\r
+;  nasm changes.asm -l changes.lst\r
+;\r
+; When assembled without any -d switches, it includes examples which:\r
+;       Work correctly in version X\r
+;  and  Work incorrectly and/or display warnings in version 0.97\r
+;  and  Do not prevent the generation of output in version 0.97\r
+;\r
+; Not all the differences can be seen in the .lst file.  I suggest that you use\r
+; "ndisasm changes"  to examine the code actually generated.\r
+;_________________________________\r
+;\r
+;  nasm changes.asm -l changes.lst -doldmsg\r
+;\r
+; When assembled with -doldmsg, it adds examples which:\r
+;       Work correctly in version X\r
+;  and  Generate error messages in version 0.97 and do not generate output\r
+;_________________________________\r
+;\r
+;  nasm changes.asm -l changes.lst -doldcrash\r
+;\r
+; When assembled with -doldcrash, it adds examples which:\r
+;       Work correctly in version X\r
+;  and  Cause NASM to crash in version 0.97\r
+;_________________________________\r
+;\r
+;  nasm changes.asm -l changes.lst -dnewmsg\r
+;\r
+; When assembled with -dnewmsg, it adds examples which:\r
+;       Generate error messages in version X\r
+;  and  Generate wrong output without warning or error message in version 0.97\r
+;-----------------------------------------------------------------------------\r
+\r
+; Please note that I have reported the name of the person who made the\r
+; correction based on very limited information.  In several cases, I am sure I\r
+; will identify the wrong author.  Please send me any corrections;  I don't\r
+; intend to insult or exclude anyone.\r
+\r
+;-----------------------------------------------------------------------------\r
+; Bug fixed by Simon in assemble()\r
+;\r
+; The following generated "call next" / "call next-1" instead of\r
+; two copies of "call next"\r
+;\r
+       times 2 a16 call next\r
+next:\r
+\r
+;-----------------------------------------------------------------------------\r
+; Bug fixed by John in parse_line()  (and other routines)\r
+;\r
+; This used to jmp to prior.1, when it should be here.1\r
+;\r
+prior:\r
+.1:\r
+here:  jmp     .1\r
+.1:\r
+\r
+;-----------------------------------------------------------------------------\r
+; Bug fixed by John in assemble()\r
+;\r
+; Strings used in dq and dt were not zero filled correctly\r
+;\r
+       dq      'b'\r
+\r
+\r
+;-----------------------------------------------------------------------------\r
+; Bug fixed by Simon in isn_names[]\r
+;\r
+; Was not recognised as an instruction\r
+;\r
+       int01\r
+\r
+;-----------------------------------------------------------------------------\r
+; Bug fixed by Jim Hague in ???\r
+;\r
+; Forward references were instruction level rather than per operand\r
+;\r
+       shr word [forwardref],1\r
+forwardref:\r
+\r
+;-----------------------------------------------------------------------------\r
+; Bug fixed by John in preproc.c\r
+;\r
+; It used to silently discard id characters appended to a multi-line\r
+; macro parameter (such as the x in %1x below).\r
+;\r
+%macro xxx 1\r
+%1: nop\r
+%{1}x: jmp %1x\r
+%endmacro\r
+xxx yyy\r
+\r
+%ifdef oldmsg\r
+;***************************************************************\r
+;\r
+; The following examples will generate error messages in 0.97 and will generate\r
+; correct output in the new version.\r
+\r
+;-----------------------------------------------------------------------------\r
+; Bug fixed by Simon in isns.dat\r
+;\r
+; The optional "near" was not permitted on JMP and CALL\r
+;\r
+       jmp near here\r
+\r
+;-----------------------------------------------------------------------------\r
+; Feature added by Simon in stdscan()\r
+;\r
+; You can now use the numeric value of strings in %assign\r
+;\r
+%assign xxx 'ABCD'\r
+       dd xxx\r
+\r
+;-----------------------------------------------------------------------------\r
+; Feature added by John in add_vectors()\r
+;\r
+; Stranger address expressions are now supported as long as they resolve to\r
+; something valid.\r
+;\r
+       mov ax, [eax + ebx + ecx - eax]\r
+\r
+;-----------------------------------------------------------------------------\r
+; Bug fixed by Simon in ???\r
+;\r
+; The EQU directive affected local labels in a way that was inconsistent\r
+; between passes\r
+;\r
+.local:\r
+neither equ $\r
+       jmp .local\r
+\r
+;-----------------------------------------------------------------------------\r
+; Feature added by Jules in parse_line\r
+;\r
+; You can override a size specifier\r
+;\r
+%define arg1 dword [bp+4]\r
+       cmp word arg1, 2\r
+\r
+;-----------------------------------------------------------------------------\r
+; Bug fixed by John in preproc.c\r
+;\r
+; You could not use a label on the same line with a macro invocation, if the\r
+; macro definition began with a preprocessor directive.\r
+;\r
+       struc mytype\r
+.long  resd    1\r
+       endstruc\r
+\r
+lbl    istruc mytype\r
+       at mytype.long, dd 'ABCD'\r
+       iend\r
+\r
+;-----------------------------------------------------------------------------\r
+; Warning removed by John in preproc.c\r
+;\r
+; In order to allow macros that extend the definition of instructions, I\r
+; disabled the warning on a multi-line macro referencing itself.\r
+;\r
+%endif                 ;NASM 0.97 doesn't handle %0 etc. inside false %if\r
+%macro push 1-*                ;\r
+%rep %0                        ;\r
+push %1                        ;\r
+%rotate 1              ;\r
+%endrep                        ;\r
+%endmacro              ;\r
+%ifdef oldmsg          ;\r
+\r
+       push ax,bx\r
+\r
+;-----------------------------------------------------------------------------\r
+; Warning removed by John in preproc.c\r
+;\r
+; To support other types of macros that extend the definition of instructions,\r
+; I disabled the warning on a multi-line macro called with the wrong number of\r
+; parameters.  PUSH and POP can be extended equally well by either method, but\r
+; other intruction extensions may need one method or the other, so I made both\r
+; work.\r
+;\r
+; Note that neither of these warnings was really needed, because a later stage\r
+; of NASM would almost always give an adequate error message if the macro use\r
+; really was wrong.\r
+;\r
+%endif\r
+%macro pop 2-*\r
+%rep %0\r
+pop %1\r
+%rotate 1\r
+%endrep\r
+%endmacro\r
+%ifdef oldmsg\r
+\r
+       pop ax,bx\r
+%endif\r
+\r
+\r
+%ifdef newmsg  ;***************************************************************\r
+\r
+;-----------------------------------------------------------------------------\r
+; Bug fixed by John in parse_line()  (and other routines)\r
+;\r
+; This invalid code used to assemble without errors\r
+;\r
+myself equ myself+1\r
+       jmp myself\r
+\r
+;-----------------------------------------------------------------------------\r
+; Change made by John in preproc.c\r
+;\r
+; In 0.97, an id that appears as a label on a macro invocation was always\r
+; prepended to the first line of the macro expansion.  That caused several\r
+; bugs, but also could be used in tricks like the arg macro in c16.mac and\r
+; c32.mac.\r
+;\r
+; In version X, an id that appears as a label on a macro invocation will\r
+; normally be defined as a label for the address at which the macro is\r
+; invoked, regardless of whether the first line of the macro expansion is\r
+; something that can take a label.  The new token %00 may be used for any\r
+; of the situations in which the old prepend behavior was doing something\r
+; tricky but useful.  %00 can also be used more than once and in places\r
+; other than the start of the expansion.\r
+;\r
+%endif\r
+%assign arg_off 0\r
+\r
+%imacro arg 0-1 2              ;arg defined the old way\r
+         equ arg_off\r
+%assign arg_off %1+arg_off\r
+%endmacro\r
+\r
+%ifdef newmsg\r
+arg_example arg\r
+%endif\r
+\r
+%imacro arg2 0-1 2             ;arg defined the new way\r
+%00      equ arg_off\r
+%assign arg_off %1+arg_off\r
+%endmacro\r
+\r
+%ifdef oldmsg\r
+arg_example2 arg2\r
+\r
+;-----------------------------------------------------------------------------\r
+; Change made by Jules and John in INSNS.DAT\r
+;\r
+; Various instruction in which the size of an immediate is built-in to the\r
+; instruction set, now allow you to redundantly specify that size as long\r
+; as you specify it correctly\r
+;\r
+       AAD     byte 5\r
+       AAM     byte 5\r
+       BT      bx, byte 3\r
+       BTC     cx, byte 4\r
+       BTR     dx, byte 5\r
+       BTS     si, byte 6\r
+       IN      eax, byte 0x40\r
+       INT     byte 21h\r
+       OUT     byte 70h, ax\r
+       RET     word 2\r
+       RETN    word 2\r
+       RETF    word 4\r
+\r
+; note "ENTER" has not been changed yet.\r
+       \r
+%endif\r
+\r
+%ifdef oldcrash  ;*************************************************************\r
+\r
+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___\r
+\r
+;-----------------------------------------------------------------------------\r
+; Bug fixed by John in preproc.c\r
+;\r
+; Builds of NASM that prohibit dereferencing a NULL pointer used to crash if a\r
+; macro that started with a blank line was invoked with a label\r
+;\r
+%macro empty_macro 0\r
+\r
+%endm\r
+\r
+emlabel empty_macro\r
+       jmp     emlabel\r
+\r
+%endif\r
diff --git a/eval.c b/eval.c
index 6dd3f4d..a44ff7b 100644 (file)
--- a/eval.c
+++ b/eval.c
@@ -698,33 +698,24 @@ static expr *expr6(int critical)
                break;
            }
 
-           /*
-            * Since the whole line is parsed before the label it
-            * defines is given to the label manager, we have
-            * problems with lines such as
-            *
-            *   end: TIMES 512-(end-start) DB 0
-            *
-            * where `end' is not known on pass one, despite not
-            * really being a forward reference, and due to
-            * criticality it is _needed_. Hence we check our label
-            * against the currently defined one, and do our own
-            * resolution of it if we have to.
-            */
            type = EXPR_SIMPLE;        /* might get overridden by UNKNOWN */
-           if (i == TOKEN_BASE) {
+           if (i == TOKEN_BASE)
+           {
                label_seg = location->segment;
                label_ofs = 0;
            } else if (i == TOKEN_HERE) {
                label_seg = location->segment;
                label_ofs = location->offset;
-           } else if (!labelfunc(tokval->t_charptr,&label_seg,&label_ofs)) {
+           } else {
+               if (!labelfunc(tokval->t_charptr,&label_seg,&label_ofs))
+               {
                if (critical == 2) {
                    error (ERR_NONFATAL, "symbol `%s' undefined",
                           tokval->t_charptr);
                    return NULL;
                } else if (critical == 1) {
-                   error (ERR_NONFATAL, "symbol `%s' not defined before use",
+                       error (ERR_NONFATAL,
+                               "symbol `%s' not defined before use",
                           tokval->t_charptr);
                    return NULL;
                } else {
@@ -735,12 +726,12 @@ static expr *expr6(int critical)
                    label_ofs = 1;
                }
            }
-           addtotemp(type, label_ofs);
-           if (label_seg!=NO_SEG) {
-               addtotemp(EXPR_SEGBASE + label_seg, 1L);
                if (opflags && is_extern (tokval->t_charptr))
                    *opflags |= OPFLAG_EXTERN;
            }
+           addtotemp(type, label_ofs);
+           if (label_seg!=NO_SEG)
+               addtotemp(EXPR_SEGBASE + label_seg, 1L);
            break;
        }
        i = scan(scpriv, tokval);
diff --git a/exebin.mac b/exebin.mac
new file mode 100644 (file)
index 0000000..022183f
--- /dev/null
@@ -0,0 +1,57 @@
+; -*- nasm -*-\r
+; NASM macro file to allow the `bin' output format to generate\r
+; simple .EXE files by constructing the EXE header by hand.\r
+; Adapted from a contribution by Yann Guidon <whygee_corp@hol.fr>\r
+\r
+%define EXE_stack_size EXE_realstacksize\r
+\r
+%macro EXE_begin 0\r
+         ORG 0E0h\r
+         section .text\r
+\r
+header_start:\r
+         db 4Dh,5Ah            ; EXE file signature\r
+         dw EXE_allocsize % 512\r
+         dw (EXE_allocsize + 511) / 512\r
+         dw 0                  ; relocation information: none\r
+         dw (header_end-header_start)/16 ; header size in paragraphs\r
+         dw (EXE_absssize + EXE_realstacksize) / 16 ; min extra mem\r
+         dw (EXE_absssize + EXE_realstacksize) / 16 ; max extra mem\r
+         dw -10h               ; Initial SS (before fixup)\r
+         dw EXE_endbss + EXE_realstacksize ; Initial SP (1K DPMI+1K STACK)\r
+         dw 0                  ; (no) Checksum\r
+         dw 100h               ; Initial IP - start just after the header\r
+         dw -10h               ; Initial CS (before fixup)\r
+         dw 0                  ; file offset to relocation table: none\r
+         dw 0                  ; (no overlay)\r
+         align 16,db 0\r
+header_end:\r
+\r
+EXE_startcode:\r
+         section .data\r
+EXE_startdata:\r
+         section .bss\r
+EXE_startbss:\r
+%endmacro\r
+\r
+%macro EXE_stack 1\r
+EXE_realstacksize equ %1\r
+%define EXE_stack_size EXE_bogusstacksize ; defeat EQU in EXE_end\r
+%endmacro\r
+\r
+%macro EXE_end 0\r
+         section .text\r
+EXE_endcode:\r
+         section .data\r
+EXE_enddata:\r
+         section .bss\r
+         alignb 4\r
+EXE_endbss:\r
+\r
+EXE_acodesize equ (EXE_endcode-EXE_startcode+3) & (~3)\r
+EXE_datasize equ EXE_enddata-EXE_startdata\r
+EXE_absssize equ (EXE_endbss-EXE_startbss+3) & (~3)\r
+EXE_allocsize equ EXE_acodesize + EXE_datasize\r
+\r
+EXE_stack_size equ 0x800       ; default if nothing else was used\r
+%endmacro\r
diff --git a/insns.bas b/insns.bas
deleted file mode 100644 (file)
index 5178aa6..0000000
--- a/insns.bas
+++ /dev/null
@@ -1,541 +0,0 @@
-' INFO_1: Converter for INSNS.DAT to INSNSA.C and INSNSD.C
-'
-' INFO_2: Written by Mark Junker in 1997
-'         InterNet: mjs@prg.hannover.sgh-net.de
-'         FIDO:     Mark Junker@2:2437/47.21
-'
-' COMMENT: While I wrote this program I often asked me, if it isn't easier
-'          to write an interpreter for Perl-scripts :]
-'
-' COMMENT: To start the program press SHIFT+F5 within the QBasic IDE
-'          or start it from the command-line with QBASIC /RUN MACROS
-'
-'
-' THIS PROGRAM NEEDS TO BE UPDATED -- it doesn't create insnsi.h
-' and insnsn.c.  However, Perl interpreters are now available for both
-' DOS and Windows, so it seems pointless to spend the effort.
-'
-
-DEFINT A-Z
-
-DECLARE FUNCTION ReplaceOp$ (a$)
-DECLARE FUNCTION StrTrimLeft$ (a$, b$)
-DECLARE FUNCTION StrTrimRight$ (a$, b$)
-DECLARE FUNCTION StrTrim$ (a$, b$)
-DECLARE SUB StrSplitString (SplitString$, SplitChars$, SplitField$(), SplitCount%)
-DECLARE FUNCTION Min% (a%, b%)
-DECLARE FUNCTION StrInstrLeft% (SearchStart%, SearchIn$, SearchFor$)
-DECLARE FUNCTION StrAscii% (a$)
-
-
-CONST MaxOpCodeBase = 3
-CONST MaxOpCodeType = 8
-
-CLS
-DIM LineData$(1 TO 2)
-DIM StrucData$(1 TO 5)
-DIM OpCodeList$(0 TO 255)
-DIM OpCodeByte(1 TO MaxOpCodeType, 1 TO MaxOpCodeBase)
-DIM OpCodeStat(1 TO 10)   ' don't need mode :)
-
-Instructs$ = ""
-LineOfs$ = ""
-
-OPEN "I", 1, "insns.dat"
-OPEN "B", 3, "insns.tmp"
-
-qt$ = CHR$(34)
-crlf$ = CHR$(13) + CHR$(10)
-
-
-'
-' preprocessing the current file
-'
-
-HexChar$ = "0123456789ABCDEF"
-
-PRINT "Preprocessing INSNS.DAT"
-OpCodes = 0
-OpCodeDebug = 0
-NowLineOfs& = 1
-lineNr = 0
-WHILE NOT EOF(1)
-  lineNr = lineNr + 1
-  IF (lineNr AND 15) = 0 THEN
-    LOCATE , 1
-    PRINT lineNr, OpCodes, OpCodeDebug;
-  END IF
-
-  LINE INPUT #1, l$
-  CALL StrSplitString(l$, ";", LineData$(), SplitCount)
-  IF SplitCount THEN
-    LineData$(1) = StrTrim$(LineData$(1), CHR$(9) + " ")
-    IF LEN(LineData$(1)) THEN
-      CALL StrSplitString(LineData$(1), " ", StrucData$(), cntSplit)
-      IF cntSplit <> 4 THEN
-        PRINT "line"; lineNr; " does not contain four fields"
-        END
-      END IF
-
-      tst$ = UCASE$(StrucData$(2))
-      res$ = ""
-      cnt% = 1
-      isfirst = 1
-      op = 1
-      p = StrInstrLeft(1, tst$ + ",", "|:,")
-      WHILE p
-        h$ = ReplaceOp$(MID$(tst$, op, p - op))
-        IF LEN(h$) THEN
-          SELECT CASE MID$(tst$, p, 1)
-          CASE ""
-            IF isfirst THEN
-              res$ = res$ + h$
-            ELSE
-              res$ = res$ + "|" + h$
-            END IF
-            isfirst = 0
-          CASE ","
-            IF isfirst THEN
-              res$ = res$ + h$ + ","
-            ELSE
-              res$ = res$ + "|" + h$ + ","
-            END IF
-            cnt% = cnt% + 1
-            isfirst = 1
-          CASE "|"
-            IF isfirst THEN
-              res$ = res$ + h$
-            ELSE
-              res$ = res$ + "|" + h$
-            END IF
-            isfirst = 0
-          CASE ":"
-            res$ = res$ + h$ + "|COLON,"
-            cnt% = cnt% + 1
-          END SELECT
-        END IF
-        op = p + 1
-        p = StrInstrLeft(op, tst$ + ",", "|:,")
-      WEND
-      FOR a = cnt% + 1 TO 3
-        res$ = res$ + ",0"
-      NEXT
-      StrucData$(2) = res$
-      IF LEFT$(res$, 2) = "0," THEN cnt% = cnt% - 1
-      StrucData$(5) = LTRIM$(STR$(cnt%))
-
-      NoDebug = 0
-      res$ = ""
-      tst$ = UCASE$(StrucData$(4))
-      op = 1
-      p = INSTR(tst$ + ",", ",")
-      isfirst = 1
-      WHILE p
-        h$ = MID$(tst$, op, p - op)
-        IF h$ = "ND" THEN
-          NoDebug = 1
-        ELSE
-          IF isfirst THEN
-            res$ = res$ + "IF_" + h$
-          ELSE
-            res$ = res$ + "|IF_" + h$
-          END IF
-          isfirst = 0
-        END IF
-        op = p + 1
-        p = INSTR(op, tst$ + ",", ",")
-      WEND
-      StrucData$(4) = res$
-
-      tst$ = UCASE$(StrucData$(3))
-      SELECT CASE tst$
-      CASE "IGNORE"
-        GOTO skipOpCode
-      CASE "\0", "\340"
-        OpCodeDebug = OpCodeDebug + 1    ' don't forget to increment
-        GOTO skipOpCode
-      END SELECT
-
-      AddRegs = 0
-      AddCCode = 0
-      NextIsOpCode = 0
-      opCodeVal$ = ""
-      op = 1
-      p = INSTR(tst$ + "\", "\")
-      DO WHILE p
-        h$ = MID$(tst$, op, p - op)
-        IF LEFT$(h$, 1) = "X" THEN
-          opCodeVal$ = CHR$(VAL("&H" + MID$(h$, 2)))
-          EXIT DO
-        ELSE
-          SELECT CASE h$
-          CASE "1", "2", "3"
-            NextIsOpCode = 1
-          CASE "4"
-            opCodeVal$ = CHR$(&H7) + CHR$(&H17) + CHR$(&H1F)
-            EXIT DO
-          CASE "5"
-            opCodeVal$ = CHR$(&HA1) + CHR$(&HA9)
-            EXIT DO
-          CASE "6"
-            opCodeVal$ = CHR$(&H6) + CHR$(&HE) + CHR$(&H16) + CHR$(&H1E)
-            EXIT DO
-          CASE "7"
-            opCodeVal$ = CHR$(&HA0) + CHR$(&HA8)
-            EXIT DO
-          CASE "10", "11", "12"
-            NextIsOpCode = 1
-            AddRegs = VAL(h$) - 9
-          CASE "330"
-            NextIsOpCode = 1
-            AddCCode = VAL(h$) - 329
-          CASE "17"
-            opCodeVal$ = CHR$(0)
-            EXIT DO
-          CASE ELSE
-            IF NextIsOpCode THEN
-              PRINT "Line:"; lineNr
-              PRINT "Unknown value: " + h$
-              END
-            END IF
-          END SELECT
-        END IF
-        op = p + 1
-        p = INSTR(op, tst$ + "\", "\")
-      LOOP
-      IF (p = 0) THEN
-        PRINT "No opcode found in line"; lineNr
-        PRINT "Line:"
-        PRINT l$
-        END
-      END IF
-
-      IF NoDebug = 0 THEN
-        FOR a = 1 TO LEN(opCodeVal$)
-          h = ASC(MID$(opCodeVal$, a, 1))
-          OpCodeStr$ = MKI$(OpCodeDebug)
-          IF AddRegs THEN
-            EndNr = 7
-          ELSEIF AddCCode THEN
-            EndNr = 15
-          ELSE
-            EndNr = 0
-          END IF
-          FOR b = 0 TO EndNr
-            OpCodeList$(h + b) = OpCodeList$(h + b) + OpCodeStr$
-          NEXT
-        NEXT
-        OpCodeDebug = OpCodeDebug + 1
-      END IF
-
-skipOpCode:
-      OpCodes = OpCodes + 1
-      LineOfs$ = LineOfs$ + MKL$(NowLineOfs&)
-      LineLg = 1
-      h$ = CHR$(NoDebug)
-      PUT #3, NowLineOfs&, h$
-      NowLineOfs& = NowLineOfs& + 1
-      FOR a = 1 TO 5
-        lg = LEN(StrucData$(a))
-        h$ = CHR$(lg) + StrucData$(a)
-        PUT #3, NowLineOfs&, h$
-        NowLineOfs& = NowLineOfs& + lg + 1
-        LineLg = LineLg + lg + 1
-      NEXT
-      LineOfs$ = LineOfs$ + MKI$(LineLg)
-    END IF
-  END IF
-WEND
-LOCATE , 1
-PRINT lineNr, OpCodes, OpCodeDebug
-
-
-'
-' creating insnsa.c
-'
-
-
-PRINT "Creating INSNSA.C"
-
-OPEN "O", 2, "insnsa.c"
-strBegStart$ = "static struct itemplate instrux_"
-strBegEnd$ = "[] = {"
-strEnd$ = "    {-1}" + crlf$ + "};" + crlf$
-
-PRINT #2, "/* This file auto-generated from insns.dat by insns.bas - don't edit it */"
-PRINT #2, ""
-PRINT #2, "#include <stdio.h>"
-PRINT #2, "#include " + qt$ + "nasm.h" + qt$
-PRINT #2, "#include " + qt$ + "insns.h" + qt$
-PRINT #2, ""
-
-oldOpCode$ = ""
-pOfs = 1
-FOR a = 1 TO OpCodes
-  LineOfs& = CVL(MID$(LineOfs$, pOfs, 4))
-  l$ = SPACE$(CVI(MID$(LineOfs$, pOfs + 4, 2)))
-  pOfs = pOfs + 6
-  GET #3, LineOfs&, l$
-
-  ' split data into fields
-  NoDebug = ASC(LEFT$(l$, 1))
-  pLn = 2
-  FOR b = 1 TO 5
-    lgLn = ASC(MID$(l$, pLn, 1))
-    StrucData$(b) = MID$(l$, pLn + 1, lgLn)
-    pLn = pLn + lgLn + 1
-  NEXT
-
-  IF oldOpCode$ <> StrucData$(1) THEN
-    Instructs$ = Instructs$ + StrucData$(1) + CHR$(0)
-    IF LEN(oldOpCode$) THEN PRINT #2, strEnd$
-    PRINT #2, strBegStart$ + StrucData$(1) + strBegEnd$
-    oldOpCode$ = StrucData$(1)
-  END IF
-  SELECT CASE UCASE$(StrucData$(3))
-  CASE "IGNORE"
-  CASE ELSE
-    PRINT #2, "    {I_" + oldOpCode$ + ", " + StrucData$(5) + ", {" + StrucData$(2) + "}, " + qt$ + StrucData$(3) + qt$ + ", " + StrucData$(4) + "},"
-  END SELECT
-NEXT
-IF LEN(oldOpCode$) THEN PRINT #2, strEnd$
-
-PRINT #2, "struct itemplate *nasm_instructions[] = {"
-op = 1
-p = INSTR(Instructs$, CHR$(0))
-WHILE p
-  h$ = MID$(Instructs$, op, p - op)
-  PRINT #2, "    instrux_" + h$ + ","
-  op = p + 1
-  p = INSTR(op, Instructs$, CHR$(0))
-WEND
-PRINT #2, "};"
-
-CLOSE 2
-
-
-
-'
-' creating insnsd.c
-'
-
-
-PRINT "Creating INSNSD.C"
-
-OPEN "O", 2, "insnsd.c"
-
-PRINT #2, "/* This file auto-generated from insns.dat by insns.bas - don't edit it */"
-PRINT #2, ""
-PRINT #2, "#include <stdio.h>"
-PRINT #2, "#include " + qt$ + "nasm.h" + qt$
-PRINT #2, "#include " + qt$ + "insns.h" + qt$
-PRINT #2, ""
-
-
-PRINT #2, "static struct itemplate instrux[] = {"
-pOfs = 1
-FOR a = 1 TO OpCodes
-  LineOfs& = CVL(MID$(LineOfs$, pOfs, 4))
-  l$ = SPACE$(CVI(MID$(LineOfs$, pOfs + 4, 2)))
-  pOfs = pOfs + 6
-  GET #3, LineOfs&, l$
-
-  ' split data into fields
-  NoDebug = ASC(LEFT$(l$, 1))
-  pLn = 2
-  FOR b = 1 TO 5
-    lgLn = ASC(MID$(l$, pLn, 1))
-    StrucData$(b) = MID$(l$, pLn + 1, lgLn)
-    pLn = pLn + lgLn + 1
-  NEXT
-
-  IF NoDebug OR (UCASE$(StrucData$(3)) = "IGNORE") THEN
-    ' ignorieren
-  ELSE
-    PRINT #2, "    {I_" + StrucData$(1) + ", " + StrucData$(5) + ", {" + StrucData$(2) + "}, " + qt$ + StrucData$(3) + qt$ + ", " + StrucData$(4) + "},"
-  END IF
-NEXT
-PRINT #2, "    {-1}" + crlf$ + "};" + crlf$
-
-
-OpCodeBegS$ = "static struct itemplate *itable_"
-OpCodeBegE$ = "[] = {"
-OpCodeEnd$ = "    NULL" + crlf$ + "};" + crlf$
-
-FOR a = 0 TO 255
-  PRINT #2, OpCodeBegS$ + RIGHT$("00" + HEX$(a), 2) + OpCodeBegE$
-  h$ = OpCodeList$(a)
-  FOR b = 1 TO LEN(h$) STEP 2
-    OpCodePos = CVI(MID$(h$, b, 2))
-    PRINT #2, "    instrux +" + STR$(OpCodePos) + ","
-  NEXT
-  PRINT #2, OpCodeEnd$
-NEXT
-
-PRINT #2, "struct itemplate **itable[] = {"
-FOR a = 0 TO 255
-  PRINT #2, "    itable_" + RIGHT$("00" + HEX$(a), 2) + ","
-NEXT
-PRINT #2, "};"
-
-CLOSE 2
-
-
-
-CLOSE 3
-KILL "insns.tmp"
-CLOSE 1
-SYSTEM
-
-FUNCTION ReplaceOp$ (a$)
-  tst$ = UCASE$(a$)
-  SELECT CASE tst$
-'  CASE "ND"
-'    ReplaceOp$ = ""
-  CASE "VOID", ""
-    ReplaceOp$ = "0"
-  CASE "IMM"
-    ReplaceOp$ = "IMMEDIATE"
-  CASE "MEM"
-    ReplaceOp$ = "MEMORY"
-  CASE "MEM8", "MEM16", "MEM32", "MEM64", "MEM80"
-    ReplaceOp$ = "MEMORY|BITS" + MID$(tst$, 4)
-  CASE "REG8", "REG16", "REG32"
-    ReplaceOp$ = tst$
-  CASE "RM8", "RM16", "RM32"
-    ReplaceOp$ = "REGMEM|BITS" + MID$(tst$, 3)
-  CASE "IMM8", "IMM16", "IMM32"
-    ReplaceOp$ = "IMMEDIATE|BITS" + MID$(tst$, 4)
-  CASE ELSE
-    ReplaceOp$ = tst$
-  END SELECT
-END FUNCTION
-
-FUNCTION Min% (a%, b%)
-  IF a% < b% THEN Min% = a% ELSE Min% = b%
-END FUNCTION
-
-FUNCTION StrAscii (a$)
-  IF LEN(a$) = 0 THEN
-    StrAscii = -1
-  ELSE
-    StrAscii = ASC(a$)
-  END IF
-END FUNCTION
-
-' same as =INSTR(SearchStart, SearchIn, ANY SearchFor$) in PowerBASIC(tm)
-'
-FUNCTION StrInstrLeft (SearchStart, SearchIn$, SearchFor$)
- ValuesCount = LEN(SearchFor$)
- MaxValue = LEN(SearchIn$) + 1
- MinValue = MaxValue
- FOR Counter1 = 1 TO ValuesCount
-  SearchChar$ = MID$(SearchFor$, Counter1, 1)
-  hVal2 = INSTR(SearchStart, SearchIn$, SearchChar$)
-  IF hVal2 > 0 THEN MinValue = Min%(hVal2, MinValue)
- NEXT
- IF MinValue = MaxValue THEN MinValue = 0
- StrInstrLeft = MinValue
-END FUNCTION
-
-'
-' This is a very damn fuckin' shit version of this splitting routine.
-' At this time, it's not very useful :]
-'
-SUB StrSplitString (SplitString$, SplitChars$, SplitField$(), SplitCount)
-  StartIndex = LBOUND(SplitField$)
-  LastIndex = UBOUND(SplitField$)
-  ActualIndex& = StartIndex
-  SplitCount = 0
-
-  LastPos = 1
-  FoundPos = StrInstrLeft(LastPos, SplitString$, SplitChars$ + CHR$(34))
-  GetDirect = 0
-  EndLoop = 0
-  TempString$ = ""
-  DO WHILE FoundPos > 0
-    FoundCharVal = StrAscii(MID$(SplitString$, FoundPos, 1))
-    PosDiff = (FoundPos - LastPos) + 1
-    SELECT CASE FoundCharVal
-    CASE 34
-      TempString$ = TempString$ + MID$(SplitString$, LastPos, PosDiff - 1)
-      SELECT CASE EndLoop
-      CASE 0
-        EndLoop = 2
-      CASE 3
-        EndLoop = 0
-      END SELECT
-    CASE ELSE
-      TempString$ = TempString$ + MID$(SplitString$, LastPos, PosDiff - 1)
-      SplitField$(ActualIndex&) = TempString$
-      TempString$ = ""
-      ActualIndex& = ActualIndex& + 1
-      IF ActualIndex& > LastIndex THEN
-        ActualIndex& = LastIndex
-        EndLoop = 1
-      END IF
-    END SELECT
-    SELECT CASE EndLoop
-    CASE 0
-      DO
-        LastPos = FoundPos + 1
-        FoundPos = StrInstrLeft(LastPos, SplitString$, SplitChars$)
-      LOOP WHILE LastPos = FoundPos
-      FoundPos = StrInstrLeft(LastPos, SplitString$, SplitChars$ + CHR$(34))
-    CASE 1
-      FoundPos = 0
-      LastPos = LEN(SplitString$) + 1
-    CASE 2
-      EndLoop = 3
-      LastPos = FoundPos + 1
-      FoundPos = StrInstrLeft(LastPos, SplitString$, CHR$(34))
-      IF FoundPos = 0 THEN
-       SplitString$ = SplitString$ + CHR$(34)
-       FoundPos = LEN(SplitString$)
-      END IF
-    END SELECT
-  LOOP
-  IF EndLoop = 0 THEN
-    IF LEN(TempString$) > 0 THEN
-      SplitField$(ActualIndex&) = TempString$
-    ELSEIF LastPos <= LEN(SplitString$) THEN
-      SplitField$(ActualIndex&) = MID$(SplitString$, LastPos)
-    ELSE
-      ActualIndex& = ActualIndex& - 1
-    END IF
-  END IF
-  FOR a = ActualIndex& + 1 TO LastIndex
-    SplitField$(a) = ""
-  NEXT
-  SplitCount = (ActualIndex& - StartIndex) + 1
-END SUB
-
-FUNCTION StrTrim$ (a$, b$)
-        StrTrim$ = StrTrimRight$(StrTrimLeft$(a$, b$), b$)
-END FUNCTION
-
-FUNCTION StrTrimLeft$ (a$, b$) 'public
-        p = 0
-        l = LEN(a$)
-        DO
-          p = p + 1
-          t$ = MID$(a$, p, 1)
-        LOOP WHILE (p < l) AND (INSTR(b$, t$) > 0)
-        StrTrimLeft$ = MID$(a$, p)
-END FUNCTION
-
-FUNCTION StrTrimRight$ (a$, b$) 'public
-        l = LEN(a$)
-        p = l + 1
-        DO
-          p = p - 1
-          IF p > 0 THEN
-            t$ = MID$(a$, p, 1)
-          ELSE
-            t$ = ""
-          END IF
-        LOOP WHILE (p > 0) AND (INSTR(b$, t$) > 0)
-        StrTrimRight$ = LEFT$(a$, p)
-END FUNCTION
-
-\1a
\ No newline at end of file
index 1659422..1e5b9d6 100644 (file)
--- a/insns.dat
+++ b/insns.dat
@@ -12,9 +12,9 @@
 
 AAA       void                \1\x37                        8086
 AAD       void                \2\xD5\x0A                    8086
-AAD       imm                 \1\xD5\24                     8086
+AAD       imm                 \1\xD5\24                     8086,SB\r
 AAM       void                \2\xD4\x0A                    8086
-AAM       imm                 \1\xD4\24                     8086
+AAM       imm                 \1\xD4\24                     8086,SB\r
 AAS       void                \1\x3F                        8086
 ADC       mem,reg8            \300\1\x10\101                8086,SM
 ADC       reg8,reg8           \300\1\x10\101                8086
@@ -102,26 +102,26 @@ BT        mem,reg16           \320\300\2\x0F\xA3\101        386,SM
 BT        reg16,reg16         \320\300\2\x0F\xA3\101        386
 BT        mem,reg32           \321\300\2\x0F\xA3\101        386,SM
 BT        reg32,reg32         \321\300\2\x0F\xA3\101        386
-BT        rm16,imm            \320\300\2\x0F\xBA\204\25     386
-BT        rm32,imm            \321\300\2\x0F\xBA\204\25     386
+BT        rm16,imm            \320\300\2\x0F\xBA\204\25     386,SB\r
+BT        rm32,imm            \321\300\2\x0F\xBA\204\25     386,SB\r
 BTC       mem,reg16           \320\300\2\x0F\xBB\101        386,SM
 BTC       reg16,reg16         \320\300\2\x0F\xBB\101        386
 BTC       mem,reg32           \321\300\2\x0F\xBB\101        386,SM
 BTC       reg32,reg32         \321\300\2\x0F\xBB\101        386
-BTC       rm16,imm            \320\300\2\x0F\xBA\207\25     386
-BTC       rm32,imm            \321\300\2\x0F\xBA\207\25     386
+BTC       rm16,imm            \320\300\2\x0F\xBA\207\25     386,SB\r
+BTC       rm32,imm            \321\300\2\x0F\xBA\207\25     386,SB\r
 BTR       mem,reg16           \320\300\2\x0F\xB3\101        386,SM
 BTR       reg16,reg16         \320\300\2\x0F\xB3\101        386
 BTR       mem,reg32           \321\300\2\x0F\xB3\101        386,SM
 BTR       reg32,reg32         \321\300\2\x0F\xB3\101        386
-BTR       rm16,imm            \320\300\2\x0F\xBA\206\25     386
-BTR       rm32,imm            \321\300\2\x0F\xBA\206\25     386
+BTR       rm16,imm            \320\300\2\x0F\xBA\206\25     386,SB\r
+BTR       rm32,imm            \321\300\2\x0F\xBA\206\25     386,SB\r
 BTS       mem,reg16           \320\300\2\x0F\xAB\101        386,SM
 BTS       reg16,reg16         \320\300\2\x0F\xAB\101        386
 BTS       mem,reg32           \321\300\2\x0F\xAB\101        386,SM
 BTS       reg32,reg32         \321\300\2\x0F\xAB\101        386
-BTS       rm16,imm            \320\300\2\x0F\xBA\205\25     386
-BTS       rm32,imm            \321\300\2\x0F\xBA\205\25     386
+BTS       rm16,imm            \320\300\2\x0F\xBA\205\25     386,SB\r
+BTS       rm32,imm            \321\300\2\x0F\xBA\205\25     386,SB\r
 CALL      imm                 \322\1\xE8\64                 8086
 CALL      imm|near            \322\1\xE8\64                 8086
 CALL      imm|far             \322\1\x9A\34\37              8086,ND
@@ -420,9 +420,9 @@ IMUL      reg16,imm8          \320\1\x6B\100\15             286
 IMUL      reg16,imm           \320\1\x69\100\31             286,SM
 IMUL      reg32,imm8          \321\1\x6B\100\15             386
 IMUL      reg32,imm           \321\1\x69\100\41             386,SM
-IN        reg_al,imm          \1\xE4\25                     8086
-IN        reg_ax,imm          \320\1\xE5\25                 8086
-IN        reg_eax,imm         \321\1\xE5\25                 386
+IN        reg_al,imm          \1\xE4\25                     8086,SB\r
+IN        reg_ax,imm          \320\1\xE5\25                 8086,SB\r
+IN        reg_eax,imm         \321\1\xE5\25                 386,SB\r
 IN        reg_al,reg_dx       \1\xEC                        8086
 IN        reg_ax,reg_dx       \320\1\xED                    8086
 IN        reg_eax,reg_dx      \321\1\xED                    386
@@ -435,7 +435,7 @@ INCBIN    ignore              ignore                        ignore
 INSB      void                \1\x6C                        186
 INSD      void                \321\1\x6D                    386
 INSW      void                \320\1\x6D                    186
-INT       imm                 \1\xCD\24                     8086
+INT       imm                 \1\xCD\24                     8086,SB\r
 INT01     void                \1\xF1                        P6,ND
 INT1      void                \1\xF1                        P6
 INT3      void                \1\xCC                        8086
@@ -840,11 +840,11 @@ RESQ      ignore              ignore                        ignore
 REST      ignore              ignore                        ignore
 RESW      ignore              ignore                        ignore
 RET       void                \1\xC3                        8086
-RET       imm                 \1\xC2\30                     8086
+RET       imm                 \1\xC2\30                     8086,SW\r
 RETF      void                \1\xCB                        8086
-RETF      imm                 \1\xCA\30                     8086
+RETF      imm                 \1\xCA\30                     8086,SW\r
 RETN      void                \1\xC3                        8086
-RETN      imm                 \1\xC2\30                     8086
+RETN      imm                 \1\xC2\30                     8086,SW\r
 ROL       rm8,unity           \300\1\xD0\200                8086
 ROL       rm8,reg_cl          \300\1\xD2\200                8086
 ROL       rm8,imm             \300\1\xC0\200\25             186,SB
diff --git a/macros.bas b/macros.bas
deleted file mode 100644 (file)
index 89ba846..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-' INFO_1: Converter for STANDARD.MAC to MACRO.C
-'
-' INFO_2: Written by Mark Junker in 1997
-'         InterNet: mjs@prg.hannover.sgh-net.de
-'         FIDO:     Mark Junker@2:2437/47.21
-'
-' COMMENT: To start the program press SHIFT+F5 within the QBasic IDE
-'          or start it from the command-line with QBASIC /RUN MACROS
-'
-
-DEFINT A-Z
-
-DECLARE FUNCTION StrTrimLeft$ (a$, b$)
-DECLARE FUNCTION StrTrimRight$ (a$, b$)
-DECLARE FUNCTION StrTrim$ (a$, b$)
-DECLARE SUB StrSplitString (SplitString$, SplitChars$, SplitField$(), SplitCount%)
-DECLARE FUNCTION Min% (a%, b%)
-DECLARE FUNCTION StrInstrLeft% (SearchStart%, SearchIn$, SearchFor$)
-DECLARE FUNCTION StrAscii% (a$)
-
-
-CLS
-DIM LineData$(1 TO 2)
-
-OPEN "I", 1, "STANDARD.MAC"
-OPEN "O", 2, "macros.c"
-
-PRINT #2, "/* This file auto-generated from standard.mac by macros.bas - don't edit it */"
-PRINT #2, ""
-PRINT #2, "static char *stdmac[] = {"
-
-WHILE NOT EOF(1)
-  LINE INPUT #1, l$
-  CALL StrSplitString(l$, ";", LineData$(), SplitCount)
-  IF SplitCount THEN
-    LineData$(1) = StrTrim$(LineData$(1), CHR$(9) + " ")
-    IF LEN(LineData$(1)) THEN
-      PRINT #2, "    " + CHR$(34) + LineData$(1) + CHR$(34) + ","
-    END IF
-  END IF
-WEND
-PRINT #2, "    NULL"
-PRINT #2, "};"
-
-CLOSE 2
-CLOSE 1
-SYSTEM
-
-FUNCTION Min% (a%, b%)
-  IF a% < b% THEN Min% = a% ELSE Min% = b%
-END FUNCTION
-
-FUNCTION StrAscii (a$)
-  IF LEN(a$) = 0 THEN
-    StrAscii = -1
-  ELSE
-    StrAscii = ASC(a$)
-  END IF
-END FUNCTION
-
-' same as =INSTR(SearchStart, SearchIn, ANY SearchFor$) in PowerBASIC(tm)
-'
-FUNCTION StrInstrLeft (SearchStart, SearchIn$, SearchFor$)
- ValuesCount = LEN(SearchFor$)
- MaxValue = LEN(SearchIn$) + 1
- MinValue = MaxValue
- FOR Counter1 = 1 TO ValuesCount
-  SearchChar$ = MID$(SearchFor$, Counter1, 1)
-  hVal2 = INSTR(SearchStart, SearchIn$, SearchChar$)
-  IF hVal2 > 0 THEN MinValue = Min%(hVal2, MinValue)
- NEXT
- IF MinValue = MaxValue THEN MinValue = 0
- StrInstrLeft = MinValue
-END FUNCTION
-
-'
-' This is a very damn fuckin' shit version of this splitting routine.
-' At this time, it's not very useful :]
-'
-SUB StrSplitString (SplitString$, SplitChars$, SplitField$(), SplitCount)
-  StartIndex = LBOUND(SplitField$)
-  LastIndex = UBOUND(SplitField$)
-  ActualIndex& = StartIndex
-  SplitCount = 0
-
-  LastPos = 1
-  FoundPos = StrInstrLeft(LastPos, SplitString$, SplitChars$ + CHR$(34))
-  GetDirect = 0
-  EndLoop = 0
-  TempString$ = ""
-  DO WHILE FoundPos > 0
-    FoundCharVal = StrAscii(MID$(SplitString$, FoundPos, 1))
-    PosDiff = (FoundPos - LastPos) + 1
-    SELECT CASE FoundCharVal
-    CASE 34
-      TempString$ = TempString$ + MID$(SplitString$, LastPos, PosDiff - 1)
-      SELECT CASE EndLoop
-      CASE 0
-        EndLoop = 2
-      CASE 3
-        EndLoop = 0
-      END SELECT
-    CASE ELSE
-      TempString$ = TempString$ + MID$(SplitString$, LastPos, PosDiff - 1)
-      SplitField$(ActualIndex&) = TempString$
-      TempString$ = ""
-      ActualIndex& = ActualIndex& + 1
-      IF ActualIndex& > LastIndex THEN
-        ActualIndex& = LastIndex
-        EndLoop = 1
-      END IF
-    END SELECT
-    SELECT CASE EndLoop
-    CASE 0
-      DO
-        LastPos = FoundPos + 1
-        FoundPos = StrInstrLeft(LastPos, SplitString$, SplitChars$)
-      LOOP WHILE LastPos = FoundPos
-      FoundPos = StrInstrLeft(LastPos, SplitString$, SplitChars$ + CHR$(34))
-    CASE 1
-      FoundPos = 0
-      LastPos = LEN(SplitString$) + 1
-    CASE 2
-      EndLoop = 3
-      LastPos = FoundPos + 1
-      FoundPos = StrInstrLeft(LastPos, SplitString$, CHR$(34))
-      IF FoundPos = 0 THEN
-       SplitString$ = SplitString$ + CHR$(34)
-       FoundPos = LEN(SplitString$)
-      END IF
-    END SELECT
-  LOOP
-  IF EndLoop = 0 THEN
-    IF LEN(TempString$) > 0 THEN
-      SplitField$(ActualIndex&) = TempString$
-    ELSEIF LastPos <= LEN(SplitString$) THEN
-      SplitField$(ActualIndex&) = MID$(SplitString$, LastPos)
-    ELSE
-      ActualIndex& = ActualIndex& - 1
-    END IF
-  END IF
-  FOR a = ActualIndex& + 1 TO LastIndex
-    SplitField$(a) = ""
-  NEXT
-  SplitCount = (ActualIndex& - StartIndex) + 1
-END SUB
-
-FUNCTION StrTrim$ (a$, b$)
-        StrTrim$ = StrTrimRight$(StrTrimLeft$(a$, b$), b$)
-END FUNCTION
-
-FUNCTION StrTrimLeft$ (a$, b$) 'public
-        p = 0
-        l = LEN(a$)
-        DO
-          p = p + 1
-          t$ = MID$(a$, p, 1)
-        LOOP WHILE (p < l) AND (INSTR(b$, t$) > 0)
-        StrTrimLeft$ = MID$(a$, p)
-END FUNCTION
-
-FUNCTION StrTrimRight$ (a$, b$) 'public
-        l = LEN(a$)
-        p = l + 1
-        DO
-          p = p - 1
-          IF p > 0 THEN
-            t$ = MID$(a$, p, 1)
-          ELSE
-            t$ = ""
-          END IF
-        LOOP WHILE (p > 0) AND (INSTR(b$, t$) > 0)
-        StrTrimRight$ = LEFT$(a$, p)
-END FUNCTION
-
-\1a
\ No newline at end of file
index ea02959..ed70a75 100644 (file)
--- a/macros.c
+++ b/macros.c
@@ -2,7 +2,7 @@
 
 static char *stdmac[] = {
     "%define __NASM_MAJOR__ 0",
-    "%define __NASM_MINOR__ 97",
+    "%define __NASM_MINOR__ 98",
     "%define __FILE__",
     "%define __LINE__",
     "%define __SECT__",
diff --git a/nasm.h b/nasm.h
index 3ea75f2..e73d8a6 100644 (file)
--- a/nasm.h
+++ b/nasm.h
@@ -13,7 +13,7 @@
 
 #define NASM_MAJOR_VER 0
 #define NASM_MINOR_VER 98
-#define NASM_VER "0.98 pre-release 3"
+#define NASM_VER "0.98 pre-release 3.2"
 
 #ifndef NULL
 #define NULL 0
index 2e7a32d..87313d4 100644 (file)
--- a/outform.h
+++ b/outform.h
@@ -95,6 +95,9 @@
 #ifndef OF_RDF2
 #define OF_RDF2
 #endif
+#ifndef OF_IEEE
+#define OF_IEEE
+#endif
 #endif /* OF_ALL */
 
 /* turn on groups of formats specified.... */
 #ifndef OF_RDF2
 #define OF_RDF2
 #endif
+#ifndef OF_IEEE
+#define OF_IEEE
+#endif
 #endif
 
 /* finally... override any format specifically specifed to be off */
@@ -191,6 +197,7 @@ extern struct ofmt of_obj;
 extern struct ofmt of_win32;
 extern struct ofmt of_rdf;
 extern struct ofmt of_rdf2;
+extern struct ofmt of_ieee;
 extern struct ofmt of_dbg;
 
 struct ofmt *drivers[]={
@@ -224,6 +231,9 @@ struct ofmt *drivers[]={
 #ifdef OF_RDF2
     &of_rdf2,
 #endif
+#ifdef OF_IEEE
+    &of_ieee,
+#endif
 #ifdef OF_DBG
     &of_dbg,
 #endif
index 5ab409d..ed66fc4 100644 (file)
@@ -62,9 +62,13 @@ nasmlib.o: $(top_srcdir)/nasmlib.c
 clean:
        rm -f *.o rdfdump ldrdf rdx rdflib rdf2bin rdf2com
 
-spotless: clean
+distclean: clean
        rm -f Makefile
 
+cleaner: clean
+
+spotless: distclean
+
 install: rdfdump ldrdf rdx rdflib rdf2bin rdf2com
        $(INSTALL_PROGRAM) rdfdump $(bindir)/rdfdump
        $(INSTALL_PROGRAM) ldrdf $(bindir)/ldrdf
index 0be8108..5f86298 100644 (file)
@@ -1,10 +1,10 @@
-; Standard macro set for NASM 0.97 -*- nasm -*-
+; Standard macro set for NASM 0.98 -*- nasm -*-
 ; Note that although some user-level forms of directives are defined
 ; here, not all of them are: the user-level form of a format-specific
 ; directive should be defined in the module for that directive.
 
 %define __NASM_MAJOR__ 0
-%define __NASM_MINOR__ 97
+%define __NASM_MINOR__ 98
 
 ; These two need to be defined, though the actual definitions will
 ; be constantly updated during preprocessing.
index b36098a..8475e95 100644 (file)
@@ -127,7 +127,7 @@ static struct ieeeSection {
     char *name;
 } *seghead, **segtail, *ieee_seg_needs_update;
 
-static struct ieeeObjData {
+struct ieeeObjData {
     struct ieeeObjData *next;
     unsigned char data[HUNKSIZE];
 };
@@ -1169,39 +1169,39 @@ static long ieee_putlr(struct ieeeFixupp *p)
                if (p->id1 < 0)
                    sprintf(buf,"%lX",-p->id1);
                else
-                   sprintf(buf,"L%X,10,/",p->id1);
+                   sprintf(buf,"L%lX,10,/",p->id1);
                break;
            case FT_OFS:
-               sprintf(buf,"R%X,%lX,+",p->id1,p->addend);
+               sprintf(buf,"R%lX,%lX,+",p->id1,p->addend);
                break;
            case FT_REL:
-               sprintf(buf,"R%X,%lX,+,P,-,%X,-",p->id1,p->addend,p->size);
+               sprintf(buf,"R%lX,%lX,+,P,-,%X,-",p->id1,p->addend,p->size);
                break;
                
            case FT_WRT:
                if (p->id2 < 0)
-                   sprintf(buf,"R%X,%lX,+,L%X,+,%lX,-",p->id2,p->addend,p->id2,-p->id1*16);
+                   sprintf(buf,"R%lX,%lX,+,L%lX,+,%lX,-",p->id2,p->addend,p->id2,-p->id1*16);
                else
-                   sprintf(buf,"R%X,%lX,+,L%X,+,L%X,-",p->id2,p->addend,p->id2,p->id1);
+                   sprintf(buf,"R%lX,%lX,+,L%lX,+,L%lX,-",p->id2,p->addend,p->id2,p->id1);
                break;
            case FT_EXT:
-               sprintf(buf,"X%X",p->id1,p->id1);
+               sprintf(buf,"X%lX",p->id1);
                break;
            case FT_EXTREL:
-               sprintf(buf,"X%X,P,-,%X,-",p->id1,size);
+               sprintf(buf,"X%lX,P,-,%lX,-",p->id1,size);
                break;
            case FT_EXTSEG:
                /* We needed a non-ieee hack here.
                 * We introduce the Y variable, which is the low
                 * limit of the native segment the extern resides in
                 */
-               sprintf(buf,"Y%X,10,/",p->id1);
+               sprintf(buf,"Y%lX,10,/",p->id1);
                break;
            case FT_EXTWRT:
                if (p->id2 < 0)
-                   sprintf(buf,"X%X,Y%X,+,%lX,-",p->id2,p->id2,-p->id1*16);
+                   sprintf(buf,"X%lX,Y%lX,+,%lX,-",p->id2,p->id2,-p->id1*16);
                else
-                   sprintf(buf,"X%X,Y%X,+,L%X,-",p->id2,p->id2,p->id1);
+                   sprintf(buf,"X%lX,Y%lX,+,L%lX,-",p->id2,p->id2,p->id1);
                break;
        }
        ieee_putascii("LR(%s,%lX).\r\n", buf, size);
@@ -1316,9 +1316,10 @@ static void dbgls_deflabel (char *name, long segment,
                          long offset, int is_global, char *special) 
 {
     struct ieeeSection *seg;
-    int used_special = FALSE;         /* have we used the special text? */
+    int used_special         /* have we used the special text? */
 
-    (void) special;
+    /* Keep compiler from warning about special and used_special */
+    used_special = special ? FALSE : FALSE;
 
     /*
      * If it's a special-retry from pass two, discard it.