summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2002-04-30 20:54:58 +0000
committerH. Peter Anvin <hpa@zytor.com>2002-04-30 20:54:58 +0000
commitce14ce6fc4bf6a8a73bd7061177f8dfa696b37db (patch)
treef44620fa214c3d1c4ec5eed664fd538e24832f26
parent900fa5b26b8f1374416d6dfbdacfed65f10ae5eb (diff)
downloadnasm-ce14ce6fc4bf6a8a73bd7061177f8dfa696b37db.tar.gz
NASM 0.98p3.2nasm-0.98p3.2
-rw-r--r--Changes3
-rw-r--r--MODIFIED49
-rw-r--r--Makefile.in9
-rw-r--r--Mkfiles/Makefile.bc2 (renamed from Makefile.bc2)0
-rw-r--r--Mkfiles/Makefile.bor (renamed from Makefile.bor)0
-rw-r--r--Mkfiles/Makefile.dj (renamed from Makefile.dj)0
-rw-r--r--Mkfiles/Makefile.dos (renamed from Makefile.dos)0
-rw-r--r--Mkfiles/Makefile.lcc (renamed from Makefile.lcc)0
-rw-r--r--Mkfiles/Makefile.sc (renamed from Makefile.sc)0
-rw-r--r--Mkfiles/Makefile.scw (renamed from Makefile.scw)0
-rw-r--r--Mkfiles/Makefile.unx (renamed from Makefile.unx)0
-rw-r--r--Mkfiles/Makefile.vc (renamed from Makefile.vc)0
-rw-r--r--Mkfiles/Makefile.wc (renamed from Makefile.wc)0
-rw-r--r--Mkfiles/Makefile.wcw (renamed from Makefile.wcw)0
-rw-r--r--c16.mac41
-rw-r--r--c32.mac26
-rw-r--r--changes.asm292
-rw-r--r--eval.c29
-rw-r--r--exebin.mac57
-rw-r--r--insns.bas541
-rw-r--r--insns.dat34
-rw-r--r--macros.bas176
-rw-r--r--macros.c2
-rw-r--r--nasm.h2
-rw-r--r--outform.h10
-rw-r--r--rdoff/Makefile.in6
-rw-r--r--standard.mac4
-rw-r--r--zoutieee.c27
28 files changed, 524 insertions, 784 deletions
diff --git a/Changes b/Changes
index 57584bdb..a2a291d8 100644
--- 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
--------------------------
diff --git a/MODIFIED b/MODIFIED
index f7626f35..b91f956e 100644
--- 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
diff --git a/Makefile.in b/Makefile.in
index 063e492e..750eb8a3 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -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)
diff --git a/Makefile.bc2 b/Mkfiles/Makefile.bc2
index 92ec9d2e..92ec9d2e 100644
--- a/Makefile.bc2
+++ b/Mkfiles/Makefile.bc2
diff --git a/Makefile.bor b/Mkfiles/Makefile.bor
index 90e96fba..90e96fba 100644
--- a/Makefile.bor
+++ b/Mkfiles/Makefile.bor
diff --git a/Makefile.dj b/Mkfiles/Makefile.dj
index 6d932f38..6d932f38 100644
--- a/Makefile.dj
+++ b/Mkfiles/Makefile.dj
diff --git a/Makefile.dos b/Mkfiles/Makefile.dos
index 94403fc1..94403fc1 100644
--- a/Makefile.dos
+++ b/Mkfiles/Makefile.dos
diff --git a/Makefile.lcc b/Mkfiles/Makefile.lcc
index 1f6fdcbd..1f6fdcbd 100644
--- a/Makefile.lcc
+++ b/Mkfiles/Makefile.lcc
diff --git a/Makefile.sc b/Mkfiles/Makefile.sc
index b5d0e35c..b5d0e35c 100644
--- a/Makefile.sc
+++ b/Mkfiles/Makefile.sc
diff --git a/Makefile.scw b/Mkfiles/Makefile.scw
index 6953b464..6953b464 100644
--- a/Makefile.scw
+++ b/Mkfiles/Makefile.scw
diff --git a/Makefile.unx b/Mkfiles/Makefile.unx
index f74d5440..f74d5440 100644
--- a/Makefile.unx
+++ b/Mkfiles/Makefile.unx
diff --git a/Makefile.vc b/Mkfiles/Makefile.vc
index 80beba4f..80beba4f 100644
--- a/Makefile.vc
+++ b/Mkfiles/Makefile.vc
diff --git a/Makefile.wc b/Mkfiles/Makefile.wc
index 6f0d48a5..6f0d48a5 100644
--- a/Makefile.wc
+++ b/Mkfiles/Makefile.wc
diff --git a/Makefile.wcw b/Mkfiles/Makefile.wcw
index d592c695..d592c695 100644
--- a/Makefile.wcw
+++ b/Mkfiles/Makefile.wcw
diff --git a/c16.mac b/c16.mac
new file mode 100644
index 00000000..2853db51
--- /dev/null
+++ b/c16.mac
@@ -0,0 +1,41 @@
+; NASM macro set to make interfacing to 16-bit programs easier -*- nasm -*-
+
+%imacro proc 1 ; begin a procedure definition
+%push proc
+ global %1
+%1: push bp
+ mov bp,sp
+%ifdef FARCODE PASCAL ; arguments may start at bp+4 or bp+6
+%assign %$arg 6
+%define %$firstarg 6
+%else
+%assign %$arg 4
+%define %$firstarg 4
+%endif
+%define %$procname %1
+%endmacro
+
+%imacro arg 0-1 2 ; used with the argument name as a label
+%00 equ %$arg
+ ; we could possibly be adding some
+ ; debug information at this point...?
+%assign %$arg %1+%$arg
+%endmacro
+
+%imacro endproc 0
+%ifnctx proc
+%error Mismatched `endproc'/`proc'
+%else
+ mov sp,bp
+ pop bp
+%ifdef PASCAL
+ retf %$arg - %$firstarg
+%elifdef FARCODE
+ retf
+%else
+ retn
+%endif
+__end_%$procname: ; useful for calculating function size
+%pop
+%endif
+%endmacro
diff --git a/c32.mac b/c32.mac
new file mode 100644
index 00000000..6abad995
--- /dev/null
+++ b/c32.mac
@@ -0,0 +1,26 @@
+; NASM macro set to make interfacing to 32-bit programs easier -*- nasm -*-
+
+%imacro proc 1 ; begin a procedure definition
+%push proc
+ global %1
+%1: push ebp
+ mov ebp,esp
+%assign %$arg 8
+%define %$procname %1
+%endmacro
+
+%imacro arg 0-1 4 ; used with the argument name as a label
+%00 equ %$arg
+%assign %$arg %1+%$arg
+%endmacro
+
+%imacro endproc 0
+%ifnctx proc
+%error Mismatched `endproc'/`proc'
+%else
+ leave
+ ret
+__end_%$procname: ; useful for calculating function size
+%pop
+%endif
+%endmacro
diff --git a/changes.asm b/changes.asm
new file mode 100644
index 00000000..3ae24edf
--- /dev/null
+++ b/changes.asm
@@ -0,0 +1,292 @@
+;This file demonstrates many of the differences between NASM version X and NASM
+;version 0.97
+;
+; changes.asm is copyright (C) 1998 John S. Fine
+;
+; It may be redistributed under the same conditions as NASM as described in
+; Licence file in the NASM archive
+;_________________________________
+;
+; nasm changes.asm -l changes.lst
+;
+; When assembled without any -d switches, it includes examples which:
+; Work correctly in version X
+; and Work incorrectly and/or display warnings in version 0.97
+; and Do not prevent the generation of output in version 0.97
+;
+; Not all the differences can be seen in the .lst file. I suggest that you use
+; "ndisasm changes" to examine the code actually generated.
+;_________________________________
+;
+; nasm changes.asm -l changes.lst -doldmsg
+;
+; When assembled with -doldmsg, it adds examples which:
+; Work correctly in version X
+; and Generate error messages in version 0.97 and do not generate output
+;_________________________________
+;
+; nasm changes.asm -l changes.lst -doldcrash
+;
+; When assembled with -doldcrash, it adds examples which:
+; Work correctly in version X
+; and Cause NASM to crash in version 0.97
+;_________________________________
+;
+; nasm changes.asm -l changes.lst -dnewmsg
+;
+; When assembled with -dnewmsg, it adds examples which:
+; Generate error messages in version X
+; and Generate wrong output without warning or error message in version 0.97
+;-----------------------------------------------------------------------------
+
+; Please note that I have reported the name of the person who made the
+; correction based on very limited information. In several cases, I am sure I
+; will identify the wrong author. Please send me any corrections; I don't
+; intend to insult or exclude anyone.
+
+;-----------------------------------------------------------------------------
+; Bug fixed by Simon in assemble()
+;
+; The following generated "call next" / "call next-1" instead of
+; two copies of "call next"
+;
+ times 2 a16 call next
+next:
+
+;-----------------------------------------------------------------------------
+; Bug fixed by John in parse_line() (and other routines)
+;
+; This used to jmp to prior.1, when it should be here.1
+;
+prior:
+.1:
+here: jmp .1
+.1:
+
+;-----------------------------------------------------------------------------
+; Bug fixed by John in assemble()
+;
+; Strings used in dq and dt were not zero filled correctly
+;
+ dq 'b'
+
+
+;-----------------------------------------------------------------------------
+; Bug fixed by Simon in isn_names[]
+;
+; Was not recognised as an instruction
+;
+ int01
+
+;-----------------------------------------------------------------------------
+; Bug fixed by Jim Hague in ???
+;
+; Forward references were instruction level rather than per operand
+;
+ shr word [forwardref],1
+forwardref:
+
+;-----------------------------------------------------------------------------
+; Bug fixed by John in preproc.c
+;
+; It used to silently discard id characters appended to a multi-line
+; macro parameter (such as the x in %1x below).
+;
+%macro xxx 1
+%1: nop
+%{1}x: jmp %1x
+%endmacro
+xxx yyy
+
+%ifdef oldmsg
+;***************************************************************
+;
+; The following examples will generate error messages in 0.97 and will generate
+; correct output in the new version.
+
+;-----------------------------------------------------------------------------
+; Bug fixed by Simon in isns.dat
+;
+; The optional "near" was not permitted on JMP and CALL
+;
+ jmp near here
+
+;-----------------------------------------------------------------------------
+; Feature added by Simon in stdscan()
+;
+; You can now use the numeric value of strings in %assign
+;
+%assign xxx 'ABCD'
+ dd xxx
+
+;-----------------------------------------------------------------------------
+; Feature added by John in add_vectors()
+;
+; Stranger address expressions are now supported as long as they resolve to
+; something valid.
+;
+ mov ax, [eax + ebx + ecx - eax]
+
+;-----------------------------------------------------------------------------
+; Bug fixed by Simon in ???
+;
+; The EQU directive affected local labels in a way that was inconsistent
+; between passes
+;
+.local:
+neither equ $
+ jmp .local
+
+;-----------------------------------------------------------------------------
+; Feature added by Jules in parse_line
+;
+; You can override a size specifier
+;
+%define arg1 dword [bp+4]
+ cmp word arg1, 2
+
+;-----------------------------------------------------------------------------
+; Bug fixed by John in preproc.c
+;
+; You could not use a label on the same line with a macro invocation, if the
+; macro definition began with a preprocessor directive.
+;
+ struc mytype
+.long resd 1
+ endstruc
+
+lbl istruc mytype
+ at mytype.long, dd 'ABCD'
+ iend
+
+;-----------------------------------------------------------------------------
+; Warning removed by John in preproc.c
+;
+; In order to allow macros that extend the definition of instructions, I
+; disabled the warning on a multi-line macro referencing itself.
+;
+%endif ;NASM 0.97 doesn't handle %0 etc. inside false %if
+%macro push 1-* ;
+%rep %0 ;
+push %1 ;
+%rotate 1 ;
+%endrep ;
+%endmacro ;
+%ifdef oldmsg ;
+
+ push ax,bx
+
+;-----------------------------------------------------------------------------
+; Warning removed by John in preproc.c
+;
+; To support other types of macros that extend the definition of instructions,
+; I disabled the warning on a multi-line macro called with the wrong number of
+; parameters. PUSH and POP can be extended equally well by either method, but
+; other intruction extensions may need one method or the other, so I made both
+; work.
+;
+; Note that neither of these warnings was really needed, because a later stage
+; of NASM would almost always give an adequate error message if the macro use
+; really was wrong.
+;
+%endif
+%macro pop 2-*
+%rep %0
+pop %1
+%rotate 1
+%endrep
+%endmacro
+%ifdef oldmsg
+
+ pop ax,bx
+%endif
+
+
+%ifdef newmsg ;***************************************************************
+
+;-----------------------------------------------------------------------------
+; Bug fixed by John in parse_line() (and other routines)
+;
+; This invalid code used to assemble without errors
+;
+myself equ myself+1
+ jmp myself
+
+;-----------------------------------------------------------------------------
+; Change made by John in preproc.c
+;
+; In 0.97, an id that appears as a label on a macro invocation was always
+; prepended to the first line of the macro expansion. That caused several
+; bugs, but also could be used in tricks like the arg macro in c16.mac and
+; c32.mac.
+;
+; In version X, an id that appears as a label on a macro invocation will
+; normally be defined as a label for the address at which the macro is
+; invoked, regardless of whether the first line of the macro expansion is
+; something that can take a label. The new token %00 may be used for any
+; of the situations in which the old prepend behavior was doing something
+; tricky but useful. %00 can also be used more than once and in places
+; other than the start of the expansion.
+;
+%endif
+%assign arg_off 0
+
+%imacro arg 0-1 2 ;arg defined the old way
+ equ arg_off
+%assign arg_off %1+arg_off
+%endmacro
+
+%ifdef newmsg
+arg_example arg
+%endif
+
+%imacro arg2 0-1 2 ;arg defined the new way
+%00 equ arg_off
+%assign arg_off %1+arg_off
+%endmacro
+
+%ifdef oldmsg
+arg_example2 arg2
+
+;-----------------------------------------------------------------------------
+; Change made by Jules and John in INSNS.DAT
+;
+; Various instruction in which the size of an immediate is built-in to the
+; instruction set, now allow you to redundantly specify that size as long
+; as you specify it correctly
+;
+ AAD byte 5
+ AAM byte 5
+ BT bx, byte 3
+ BTC cx, byte 4
+ BTR dx, byte 5
+ BTS si, byte 6
+ IN eax, byte 0x40
+ INT byte 21h
+ OUT byte 70h, ax
+ RET word 2
+ RETN word 2
+ RETF word 4
+
+; note "ENTER" has not been changed yet.
+
+%endif
+
+%ifdef oldcrash ;*************************************************************
+
+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___
+
+;-----------------------------------------------------------------------------
+; Bug fixed by John in preproc.c
+;
+; Builds of NASM that prohibit dereferencing a NULL pointer used to crash if a
+; macro that started with a blank line was invoked with a label
+;
+%macro empty_macro 0
+
+%endm
+
+emlabel empty_macro
+ jmp emlabel
+
+%endif
diff --git a/eval.c b/eval.c
index 6dd3f4df..a44ff7b3 100644
--- 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
index 00000000..022183fa
--- /dev/null
+++ b/exebin.mac
@@ -0,0 +1,57 @@
+; -*- nasm -*-
+; NASM macro file to allow the `bin' output format to generate
+; simple .EXE files by constructing the EXE header by hand.
+; Adapted from a contribution by Yann Guidon <whygee_corp@hol.fr>
+
+%define EXE_stack_size EXE_realstacksize
+
+%macro EXE_begin 0
+ ORG 0E0h
+ section .text
+
+header_start:
+ db 4Dh,5Ah ; EXE file signature
+ dw EXE_allocsize % 512
+ dw (EXE_allocsize + 511) / 512
+ dw 0 ; relocation information: none
+ dw (header_end-header_start)/16 ; header size in paragraphs
+ dw (EXE_absssize + EXE_realstacksize) / 16 ; min extra mem
+ dw (EXE_absssize + EXE_realstacksize) / 16 ; max extra mem
+ dw -10h ; Initial SS (before fixup)
+ dw EXE_endbss + EXE_realstacksize ; Initial SP (1K DPMI+1K STACK)
+ dw 0 ; (no) Checksum
+ dw 100h ; Initial IP - start just after the header
+ dw -10h ; Initial CS (before fixup)
+ dw 0 ; file offset to relocation table: none
+ dw 0 ; (no overlay)
+ align 16,db 0
+header_end:
+
+EXE_startcode:
+ section .data
+EXE_startdata:
+ section .bss
+EXE_startbss:
+%endmacro
+
+%macro EXE_stack 1
+EXE_realstacksize equ %1
+%define EXE_stack_size EXE_bogusstacksize ; defeat EQU in EXE_end
+%endmacro
+
+%macro EXE_end 0
+ section .text
+EXE_endcode:
+ section .data
+EXE_enddata:
+ section .bss
+ alignb 4
+EXE_endbss:
+
+EXE_acodesize equ (EXE_endcode-EXE_startcode+3) & (~3)
+EXE_datasize equ EXE_enddata-EXE_startdata
+EXE_absssize equ (EXE_endbss-EXE_startbss+3) & (~3)
+EXE_allocsize equ EXE_acodesize + EXE_datasize
+
+EXE_stack_size equ 0x800 ; default if nothing else was used
+%endmacro
diff --git a/insns.bas b/insns.bas
deleted file mode 100644
index 5178aa63..00000000
--- 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
-
- \ No newline at end of file
diff --git a/insns.dat b/insns.dat
index 1659422a..1e5b9d62 100644
--- 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
AAM void \2\xD4\x0A 8086
-AAM imm \1\xD4\24 8086
+AAM imm \1\xD4\24 8086,SB
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
+BT rm32,imm \321\300\2\x0F\xBA\204\25 386,SB
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
+BTC rm32,imm \321\300\2\x0F\xBA\207\25 386,SB
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
+BTR rm32,imm \321\300\2\x0F\xBA\206\25 386,SB
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
+BTS rm32,imm \321\300\2\x0F\xBA\205\25 386,SB
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
+IN reg_ax,imm \320\1\xE5\25 8086,SB
+IN reg_eax,imm \321\1\xE5\25 386,SB
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
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
RETF void \1\xCB 8086
-RETF imm \1\xCA\30 8086
+RETF imm \1\xCA\30 8086,SW
RETN void \1\xC3 8086
-RETN imm \1\xC2\30 8086
+RETN imm \1\xC2\30 8086,SW
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
index 89ba846b..00000000
--- a/macros.bas
+++ /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
-
- \ No newline at end of file
diff --git a/macros.c b/macros.c
index ea02959a..ed70a75e 100644
--- 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 3ea75f2e..e73d8a6f 100644
--- 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
diff --git a/outform.h b/outform.h
index 2e7a32d0..87313d41 100644
--- 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.... */
@@ -138,6 +141,9 @@
#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
diff --git a/rdoff/Makefile.in b/rdoff/Makefile.in
index 5ab409de..ed66fc4f 100644
--- a/rdoff/Makefile.in
+++ b/rdoff/Makefile.in
@@ -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
diff --git a/standard.mac b/standard.mac
index 0be81088..5f862980 100644
--- a/standard.mac
+++ b/standard.mac
@@ -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.
diff --git a/zoutieee.c b/zoutieee.c
index b36098a6..8475e95f 100644
--- a/zoutieee.c
+++ b/zoutieee.c
@@ -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.