Index: trunk/minix/commands/i386/asmconv/Makefile
===================================================================
--- trunk/minix/commands/i386/asmconv/Makefile	(revision 9)
+++ 	(revision )
@@ -1,32 +1,0 @@
-# Makefile for asmconv.
-
-CFLAGS=		$(OPT)
-LDFLAGS=	-i
-CC = exec cc
-
-all:	asmconv
-
-OBJ=	asm86.o asmconv.o parse_ack.o parse_gnu.o parse_bas.o \
-	tokenize.o emit_ack.o emit_gnu.o
-
-asmconv:	$(OBJ)
-	$(CC) $(LDFLAGS) -o $@ $(OBJ)
-	install -S 8kw $@
-
-install:	/usr/lib/asmconv
-
-/usr/lib/asmconv:	asmconv
-	install -cs -o bin asmconv $@
-
-clean:
-	rm -f $(OBJ) asmconv core
-
-# Dependencies.
-asm86.o:	asm86.h asmconv.h token.h
-asmconv.o:	asmconv.h languages.h asm86.h
-parse_ack.o:	asmconv.h languages.h token.h asm86.h
-parse_gnu.o:	asmconv.h languages.h token.h asm86.h
-parse_bas.o:	asmconv.h languages.h token.h asm86.h
-tokenize.o:	asmconv.h token.h
-emit_ack.o:	asmconv.h languages.h token.h asm86.h
-emit_gnu.o:	asmconv.h languages.h token.h asm86.h
Index: trunk/minix/commands/i386/asmconv/asm86.c
===================================================================
--- trunk/minix/commands/i386/asmconv/asm86.c	(revision 9)
+++ 	(revision )
@@ -1,85 +1,0 @@
-/*	asm86.c - 80X86 assembly intermediate		Author: Kees J. Bot
- *								24 Dec 1993
- */
-#define nil 0
-#include <stddef.h>
-#include <string.h>
-#include <assert.h>
-#include "asm86.h"
-#include "asmconv.h"
-#include "token.h"
-
-expression_t *new_expr(void)
-/* Make a new cell to build an expression. */
-{
-	expression_t *e;
-
-	e= allocate(nil, sizeof(*e));
-	e->operator= -1;
-	e->left= e->middle= e->right= nil;
-	e->name= nil;
-	e->magic= 31624;
-	return e;
-}
-
-void del_expr(expression_t *e)
-/* Delete an expression tree. */
-{
-	if (e != nil) {
-		assert(e->magic == 31624);
-		e->magic= 0;
-		deallocate(e->name);
-		del_expr(e->left);
-		del_expr(e->middle);
-		del_expr(e->right);
-		deallocate(e);
-	}
-}
-
-asm86_t *new_asm86(void)
-/* Make a new cell to hold an 80X86 instruction. */
-{
-	asm86_t *a;
-
-	a= allocate(nil, sizeof(*a));
-	a->opcode= -1;
-	get_file(&a->file, &a->line);
-	a->optype= -1;
-	a->oaz= 0;
-	a->rep= ONCE;
-	a->seg= DEFSEG;
-	a->args= nil;
-	a->magic= 37937;
-	return a;
-}
-
-void del_asm86(asm86_t *a)
-/* Delete an 80X86 instruction. */
-{
-	assert(a != nil);
-	assert(a->magic == 37937);
-	a->magic= 0;
-	del_expr(a->args);
-	deallocate(a);
-}
-
-int isregister(const char *name)
-/* True if the string is a register name.  Return its size. */
-{
-	static char *regs[] = {
-		"al", "bl", "cl", "dl", "ah", "bh", "ch", "dh",
-		"ax", "bx", "cx", "dx", "si", "di", "bp", "sp",
-		"cs", "ds", "es", "fs", "gs", "ss",
-		"eax", "ebx", "ecx", "edx", "esi", "edi", "ebp", "esp",
-		"cr0", "cr1", "cr2", "cr3",
-		"st",
-	};
-	int reg;
-
-	for (reg= 0; reg < arraysize(regs); reg++) {
-		if (strcmp(name, regs[reg]) == 0) {
-			return reg < 8 ? 1 : reg < 22 ? 2 : 4;
-		}
-	}
-	return 0;
-}
Index: trunk/minix/commands/i386/asmconv/asm86.h
===================================================================
--- trunk/minix/commands/i386/asmconv/asm86.h	(revision 9)
+++ 	(revision )
@@ -1,250 +1,0 @@
-/*	asm86.h - 80X86 assembly intermediate		Author: Kees J. Bot
- *								27 Jun 1993
- */
-
-typedef enum opcode {	/* 80486 opcodes, from the i486 reference manual.
-			 * Synonyms left out, some new words invented.
-			 */
-	DOT_ALIGN,
-	DOT_ASCII,	DOT_ASCIZ,
-	DOT_ASSERT,			/* Pseudo's invented */
-	DOT_BASE,
-	DOT_COMM,	DOT_LCOMM,
-	DOT_DATA1,
-	DOT_DATA2,
-	DOT_DATA4,
-	DOT_DEFINE,	DOT_EXTERN,
-	DOT_EQU,
-	DOT_FILE,	DOT_LINE,
-	DOT_LABEL,
-	DOT_LIST,	DOT_NOLIST,
-	DOT_SPACE,
-	DOT_SYMB,
-	DOT_TEXT,	DOT_ROM,	DOT_DATA,	DOT_BSS,	DOT_END,
-	DOT_USE16,	DOT_USE32,
-	AAA,
-	AAD,
-	AAM,
-	AAS,
-	ADC,
-	ADD,
-	AND,
-	ARPL,
-	BOUND,
-	BSF,
-	BSR,
-	BSWAP,
-	BT,
-	BTC,
-	BTR,
-	BTS,
-	CALL,	CALLF,			/* CALLF added */
-	CBW,
-	CLC,
-	CLD,
-	CLI,
-	CLTS,
-	CMC,
-	CMP,
-	CMPS,
-	CMPXCHG,
-	CWD,
-	DAA,
-	DAS,
-	DEC,
-	DIV,
-	ENTER,
-	F2XM1,
-	FABS,
-	FADD,	FADDD,	FADDS,	FADDP,	FIADDL,	FIADDS,
-	FBLD,
-	FBSTP,
-	FCHS,
-	FCLEX,
-	FCOMD,	FCOMS,	FCOMPD,	FCOMPS,	FCOMPP,
-	FCOS,
-	FDECSTP,
-	FDIVD,	FDIVS,	FDIVP,	FIDIVL,	FIDIVS,
-	FDIVRD,	FDIVRS,	FDIVRP,	FIDIVRL,	FIDIVRS,
-	FFREE,
-	FICOM,	FICOMP,
-	FILDQ,	FILDL,	FILDS,
-	FINCSTP,
-	FINIT,
-	FISTL,	FISTS,	FISTP,
-	FLDX,	FLDD,	FLDS,
-	FLD1,	FLDL2T,	FLDL2E,	FLDPI,	FLDLG2,	FLDLN2,	FLDZ,
-	FLDCW,
-	FLDENV,
-	FMULD,	FMULS,	FMULP,	FIMULL,	FIMULS,
-	FNOP,
-	FPATAN,
-	FPREM,
-	FPREM1,
-	FPTAN,
-	FRNDINT,
-	FRSTOR,
-	FSAVE,
-	FSCALE,
-	FSIN,
-	FSINCOS,
-	FSQRT,
-	FSTD,	FSTS,	FSTPX,	FSTPD,	FSTPS,
-	FSTCW,
-	FSTENV,
-	FSTSW,
-	FSUBD,	FSUBS,	FSUBP,	FISUBL,	FISUBS,
-	FSUBRD,	FSUBRS,	FSUBPR,	FISUBRL, FISUBRS,
-	FTST,
-	FUCOM,	FUCOMP,	FUCOMPP,
-	FXAM,
-	FXCH,
-	FXTRACT,
-	FYL2X,
-	FYL2XP1,
-	HLT,
-	IDIV,
-	IMUL,
-	IN,
-	INC,
-	INS,
-	INT,	INTO,
-	INVD,
-	INVLPG,
-	IRET,	IRETD,
-	JA,	JAE,	JB,	JBE,	JCXZ,	JE,	JG,	JGE,	JL,
-	JLE,	JNE,	JNO,	JNP,	JNS,	JO,	JP,	JS,
-	JMP,	JMPF,			/* JMPF added */
-	LAHF,
-	LAR,
-	LEA,
-	LEAVE,
-	LGDT,	LIDT,
-	LGS,	LSS,	LDS,	LES,	LFS,
-	LLDT,
-	LMSW,
-	LOCK,
-	LODS,
-	LOOP,	LOOPE,	LOOPNE,
-	LSL,
-	LTR,
-	MOV,
-	MOVS,
-	MOVSX,
-	MOVSXB,
-	MOVZX,
-	MOVZXB,
-	MUL,
-	NEG,
-	NOP,
-	NOT,
-	OR,
-	OUT,
-	OUTS,
-	POP,
-	POPA,
-	POPF,
-	PUSH,
-	PUSHA,
-	PUSHF,
-	RCL,	RCR,	ROL,	ROR,
-	RET,	RETF,			/* RETF added */
-	SAHF,
-	SAL,	SAR,	SHL,	SHR,
-	SBB,
-	SCAS,
-	SETA,	SETAE,	SETB,	SETBE,	SETE,	SETG,	SETGE,	SETL,
-	SETLE,	SETNE,	SETNO,	SETNP,	SETNS,	SETO,	SETP,	SETS,
-	SGDT,	SIDT,
-	SHLD,
-	SHRD,
-	SLDT,
-	SMSW,
-	STC,
-	STD,
-	STI,
-	STOS,
-	STR,
-	SUB,
-	TEST,
-	VERR,	VERW,
-	WAIT,
-	WBINVD,
-	XADD,
-	XCHG,
-	XLAT,
-	XOR
-} opcode_t;
-
-#define is_pseudo(o)	((o) <= DOT_USE32)
-#define N_OPCODES	((int) XOR + 1)
-
-#define OPZ	0x01		/* Operand size prefix. */
-#define ADZ	0x02		/* Address size prefix. */
-
-typedef enum optype {
-	PSEUDO,	JUMP,	BYTE,	WORD,	OWORD		/* Ordered list! */
-} optype_t;
-
-typedef enum repeat {
-	ONCE,	REP,	REPE,	REPNE
-} repeat_t;
-
-typedef enum segment {
-	DEFSEG,	CSEG,	DSEG,	ESEG,	FSEG,	GSEG,	SSEG
-} segment_t;
-
-typedef struct expression {
-	int		operator;
-	struct expression *left, *middle, *right;
-	char		*name;
-	size_t		len;
-	unsigned	magic;
-} expression_t;
-
-typedef struct asm86 {
-	opcode_t	opcode;		/* DOT_TEXT, MOV, ... */
-	char		*file;		/* Name of the file it is found in. */
-	long		line;		/* Line number. */
-	optype_t	optype;		/* Type of operands: byte, word... */
-	int		oaz;		/* Operand/address size prefix? */
-	repeat_t	rep;		/* Repeat prefix used on this instr. */
-	segment_t	seg;		/* Segment override. */
-	expression_t	*args;		/* Arguments in ACK order. */
-	unsigned	magic;
-} asm86_t;
-
-expression_t *new_expr(void);
-void del_expr(expression_t *a);
-asm86_t *new_asm86(void);
-void del_asm86(asm86_t *a);
-int isregister(const char *name);
-
-/*
- * Format of the arguments of the asm86_t structure:
- *
- *
- * ACK assembly operands	expression_t cell:
- * or part of operand:		{operator, left, middle, right, name, len}
- *
- * [expr]			{'[', nil, expr, nil}
- * word				{'W', nil, nil, nil, word}
- * "string"			{'S', nil, nil, nil, "string", strlen("string")}
- * label = expr			{'=', nil, expr, nil, label}
- * expr * expr			{'*', expr, nil, expr}
- * - expr			{'-', nil, expr, nil}
- * (memory)			{'(', nil, memory, nil}
- * offset(base)(index*n)	{'O', offset, base, index*n}
- * base				{'B', nil, nil, nil, base}
- * index*4			{'4', nil, nil, nil, index}
- * operand, oplist		{',', operand, nil, oplist}
- * label :			{':', nil, nil, nil, label}
- *
- * The precedence of operators is ignored.  The expression is simply copied
- * as is, including parentheses.  Problems like missing operators in the
- * target language will have to be handled by rewriting the source language.
- * 16-bit or 32-bit registers must be used where they are required by the
- * target assembler even though ACK makes no difference between 'ax' and
- * 'eax'.  Asmconv is smart enough to transform compiler output.  Human made
- * assembly can be fixed up to be transformable.
- */
Index: trunk/minix/commands/i386/asmconv/asmconv.c
===================================================================
--- trunk/minix/commands/i386/asmconv/asmconv.c	(revision 9)
+++ 	(revision )
@@ -1,157 +1,0 @@
-/*	asmconv 1.11 - convert 80X86 assembly		Author: Kees J. Bot
- *								24 Dec 1993
- */
-static char version[] = "1.11";
-
-#define nil 0
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-#include "asmconv.h"
-#include "asm86.h"
-#include "languages.h"
-
-void fatal(char *label)
-{
-	fprintf(stderr, "asmconv: %s: %s\n", label, strerror(errno));
-	exit(EXIT_FAILURE);
-}
-
-void *allocate(void *mem, size_t size)
-/* A checked malloc/realloc().  Yes, I know ISO C allows realloc(NULL, size). */
-{
-	mem= mem == nil ? malloc(size) : realloc(mem, size);
-	if (mem == nil) fatal("malloc()");
-	return mem;
-}
-
-void deallocate(void *mem)
-/* Free a malloc()d cell.  (Yes I know ISO C allows free(NULL) */
-{
-	if (mem != nil) free(mem);
-}
-
-char *copystr(const char *s)
-{
-	char *c;
-
-	c= allocate(nil, (strlen(s) + 1) * sizeof(s[0]));
-	strcpy(c, s);
-	return c;
-}
-
-int isanumber(const char *s)
-/* True if s can be turned into a number. */
-{
-	char *end;
-
-	(void) strtol(s, &end, 0);
-	return end != s && *end == 0;
-}
-
-/* "Invisible" globals. */
-int asm_mode32= (sizeof(int) == 4);
-int err_code= EXIT_SUCCESS;
-
-int main(int argc, char **argv)
-{
-	void (*parse_init)(char *file);
-	asm86_t *(*get_instruction)(void);
-	void (*emit_init)(char *file, const char *banner);
-	void (*emit_instruction)(asm86_t *instr);
-	char *lang_parse, *lang_emit, *input_file, *output_file;
-	asm86_t *instr;
-	char banner[80];
-
-	if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'm') {
-		if (strcmp(argv[1], "-mi86") == 0) {
-			set_use16();
-		} else
-		if (strcmp(argv[1], "-mi386") == 0) {
-			set_use32();
-		} else {
-			fprintf(stderr, "asmconv: '%s': unknown machine\n",
-				argv[1]+2);
-		}
-		argc--;
-		argv++;
-	}
-
-	if (argc < 3 || argc > 5) {
-		fprintf(stderr,
-"Usage: asmconv <input-type> <output-type> [input-file [output-file]]\n");
-		exit(EXIT_FAILURE);
-	}
-
-	lang_parse= argv[1];
-	lang_emit= argv[2];
-	input_file= argc < 4 ? nil : argv[3];
-	output_file= argc < 5 ? nil : argv[4];
-
-	/* Choose the parsing routines. */
-	if (strcmp(lang_parse, "ack") == 0) {
-		/* Standard ACK. */
-		parse_init= ack_parse_init;
-		get_instruction= ack_get_instruction;
-	} else
-	if (strcmp(lang_parse, "ncc") == 0) {
-		/* ACK Xenix assembly, a black sheep among ACK assemblies. */
-		parse_init= ncc_parse_init;
-		get_instruction= ncc_get_instruction;
-	} else
-	if (strcmp(lang_parse, "gnu") == 0) {
-		/* GNU assembly.  Parser by R.S. Veldema. */
-		parse_init= gnu_parse_init;
-		get_instruction= gnu_get_instruction;
-	} else
-	if (strcmp(lang_parse, "bas") == 0) {
-		/* Bruce Evans' assembler. */
-		parse_init= bas_parse_init;
-		get_instruction= bas_get_instruction;
-	} else {
-		fprintf(stderr, "asmconv: '%s': unknown input language\n",
-			lang_parse);
-		exit(EXIT_FAILURE);
-	}
-
-	/* Choose the output language. */
-	if (strcmp(lang_emit, "ack") == 0) {
-		/* Standard ACK. */
-		emit_init= ack_emit_init;
-		emit_instruction= ack_emit_instruction;
-	} else
-	if (strcmp(lang_emit, "ncc") == 0) {
-		/* ACK Xenix assembly, can be read by BAS and the 8086 ACK
-		 * ANSI C compiler.  (Allows us to compile the Boot Monitor.)
-		 */
-		emit_init= ncc_emit_init;
-		emit_instruction= ncc_emit_instruction;
-	} else
-	if (strcmp(lang_emit, "gnu") == 0) {
-		/* GNU assembler.  So we can assemble the ACK stuff among the
-		 * kernel sources and in the library.
-		 */
-		emit_init= gnu_emit_init;
-		emit_instruction= gnu_emit_instruction;
-	} else {
-		fprintf(stderr, "asmconv: '%s': unknown output language\n",
-			lang_emit);
-		exit(EXIT_FAILURE);
-	}
-
-	sprintf(banner, "Translated from %s to %s by asmconv %s",
-					lang_parse, lang_emit, version);
-
-	(*parse_init)(input_file);
-	(*emit_init)(output_file, banner);
-	for (;;) {
-		instr= (*get_instruction)();
-		(*emit_instruction)(instr);
-		if (instr == nil) break;
-		del_asm86(instr);
-	}
-	exit(err_code);
-}
Index: trunk/minix/commands/i386/asmconv/asmconv.h
===================================================================
--- trunk/minix/commands/i386/asmconv/asmconv.h	(revision 9)
+++ 	(revision )
@@ -1,24 +1,0 @@
-/*	asmconv.h - shared functions			Author: Kees J. Bot
- *								19 Dec 1993
- */
-
-#define arraysize(a)	(sizeof(a)/sizeof((a)[0]))
-#define arraylimit(a)	((a) + arraysize(a))
-#define between(a, c, z)	\
-			((unsigned)((c) - (a)) <= (unsigned)((z) - (a)))
-
-void *allocate(void *mem, size_t size);
-void deallocate(void *mem);
-void fatal(char *label);
-char *copystr(const char *s);
-int isanumber(const char *s);
-
-extern int asm_mode32;	/* In 32 bit mode if true. */
-
-#define use16()		(!asm_mode32)
-#define use32()		((int) asm_mode32)
-#define set_use16()	((void) (asm_mode32= 0))
-#define set_use32()	((void) (asm_mode32= 1))
-
-extern int err_code;	/* Exit code. */
-#define set_error()	((void) (err_code= EXIT_FAILURE))
Index: trunk/minix/commands/i386/asmconv/build
===================================================================
--- trunk/minix/commands/i386/asmconv/build	(revision 9)
+++ 	(revision )
@@ -1,3 +1,0 @@
-#!/bin/sh
-make clean
-make && make install
Index: trunk/minix/commands/i386/asmconv/emit_ack.c
===================================================================
--- trunk/minix/commands/i386/asmconv/emit_ack.c	(revision 9)
+++ 	(revision )
@@ -1,621 +1,0 @@
-/*	emit_ack.c - emit ACK assembly			Author: Kees J. Bot
- *		     emit NCC assembly				27 Dec 1993
- */
-#define nil 0
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <assert.h>
-#include "asmconv.h"
-#include "token.h"
-#include "asm86.h"
-#include "languages.h"
-
-typedef struct mnemonic {	/* ACK as86 mnemonics translation table. */
-	opcode_t	opcode;
-	char		*name;
-} mnemonic_t;
-
-static mnemonic_t mnemtab[] = {
-	{ AAA,		"aaa"		},
-	{ AAD,		"aad"		},
-	{ AAM,		"aam"		},
-	{ AAS,		"aas"		},
-	{ ADC,		"adc%"		},
-	{ ADD,		"add%"		},
-	{ AND,		"and%"		},
-	{ ARPL,		"arpl"		},
-	{ BOUND,	"bound"		},
-	{ BSF,		"bsf"		},
-	{ BSR,		"bsr"		},
-	{ BSWAP,	"bswap"		},
-	{ BT,		"bt"		},
-	{ BTC,		"btc"		},
-	{ BTR,		"btr"		},
-	{ BTS,		"bts"		},
-	{ CALL,		"call"		},
-	{ CALLF,	"callf"		},
-	{ CBW,		"cbw"		},
-	{ CLC,		"clc"		},
-	{ CLD,		"cld"		},
-	{ CLI,		"cli"		},
-	{ CLTS,		"clts"		},
-	{ CMC,		"cmc"		},
-	{ CMP,		"cmp%"		},
-	{ CMPS,		"cmps%"		},
-	{ CMPXCHG,	"cmpxchg"	},
-	{ CWD,		"cwd"		},
-	{ DAA,		"daa"		},
-	{ DAS,		"das"		},
-	{ DEC,		"dec%"		},
-	{ DIV,		"div%"		},
-	{ DOT_ALIGN,	".align"	},
-	{ DOT_ASCII,	".ascii"	},
-	{ DOT_ASCIZ,	".asciz"	},
-	{ DOT_ASSERT,	".assert"	},
-	{ DOT_BASE,	".base"		},
-	{ DOT_BSS,	".sect .bss"	},
-	{ DOT_COMM,	".comm"		},
-	{ DOT_DATA,	".sect .data"	},
-	{ DOT_DATA1,	".data1"	},
-	{ DOT_DATA2,	".data2"	},
-	{ DOT_DATA4,	".data4"	},
-	{ DOT_DEFINE,	".define"	},
-	{ DOT_END,	".sect .end"	},
-	{ DOT_EXTERN,	".extern"	},
-	{ DOT_FILE,	".file"		},
-	{ DOT_LCOMM,	".comm"		},
-	{ DOT_LINE,	".line"		},
-	{ DOT_LIST,	".list"		},
-	{ DOT_NOLIST,	".nolist"	},
-	{ DOT_ROM,	".sect .rom"	},
-	{ DOT_SPACE,	".space"	},
-	{ DOT_SYMB,	".symb"		},
-	{ DOT_TEXT,	".sect .text"	},
-	{ DOT_USE16,	".use16"	},
-	{ DOT_USE32,	".use32"	},
-	{ ENTER,	"enter"		},
-	{ F2XM1,	"f2xm1"		},
-	{ FABS,		"fabs"		},
-	{ FADD,		"fadd"		},
-	{ FADDD,	"faddd"		},
-	{ FADDP,	"faddp"		},
-	{ FADDS,	"fadds"		},
-	{ FBLD,		"fbld"		},
-	{ FBSTP,	"fbstp"		},
-	{ FCHS,		"fchs"		},
-	{ FCLEX,	"fclex"		},
-	{ FCOMD,	"fcomd"		},
-	{ FCOMPD,	"fcompd"	},
-	{ FCOMPP,	"fcompp"	},
-	{ FCOMPS,	"fcomps"	},
-	{ FCOMS,	"fcoms"		},
-	{ FCOS,		"fcos"		},
-	{ FDECSTP,	"fdecstp"	},
-	{ FDIVD,	"fdivd"		},
-	{ FDIVP,	"fdivp"		},
-	{ FDIVRD,	"fdivrd"	},
-	{ FDIVRP,	"fdivrp"	},
-	{ FDIVRS,	"fdivrs"	},
-	{ FDIVS,	"fdivs"		},
-	{ FFREE,	"ffree"		},
-	{ FIADDL,	"fiaddl"	},
-	{ FIADDS,	"fiadds"	},
-	{ FICOM,	"ficom"		},
-	{ FICOMP,	"ficomp"	},
-	{ FIDIVL,	"fidivl"	},
-	{ FIDIVRL,	"fidivrl"	},
-	{ FIDIVRS,	"fidivrs"	},
-	{ FIDIVS,	"fidivs"	},
-	{ FILDL,	"fildl"		},
-	{ FILDQ,	"fildq"		},
-	{ FILDS,	"filds"		},
-	{ FIMULL,	"fimull"	},
-	{ FIMULS,	"fimuls"	},
-	{ FINCSTP,	"fincstp"	},
-	{ FINIT,	"finit"		},
-	{ FISTL,	"fistl"		},
-	{ FISTP,	"fistp"		},
-	{ FISTS,	"fists"		},
-	{ FISUBL,	"fisubl"	},
-	{ FISUBRL,	"fisubrl"	},
-	{ FISUBRS,	"fisubrs"	},
-	{ FISUBS,	"fisubs"	},
-	{ FLD1,		"fld1"		},
-	{ FLDCW,	"fldcw"		},
-	{ FLDD,		"fldd"		},
-	{ FLDENV,	"fldenv"	},
-	{ FLDL2E,	"fldl2e"	},
-	{ FLDL2T,	"fldl2t"	},
-	{ FLDLG2,	"fldlg2"	},
-	{ FLDLN2,	"fldln2"	},
-	{ FLDPI,	"fldpi"		},
-	{ FLDS,		"flds"		},
-	{ FLDX,		"fldx"		},
-	{ FLDZ,		"fldz"		},
-	{ FMULD,	"fmuld"		},
-	{ FMULP,	"fmulp"		},
-	{ FMULS,	"fmuls"		},
-	{ FNOP,		"fnop"		},
-	{ FPATAN,	"fpatan"	},
-	{ FPREM,	"fprem"		},
-	{ FPREM1,	"fprem1"	},
-	{ FPTAN,	"fptan"		},
-	{ FRNDINT,	"frndint"	},
-	{ FRSTOR,	"frstor"	},
-	{ FSAVE,	"fsave"		},
-	{ FSCALE,	"fscale"	},
-	{ FSIN,		"fsin"		},
-	{ FSINCOS,	"fsincos"	},
-	{ FSQRT,	"fsqrt"		},
-	{ FSTCW,	"fstcw"		},
-	{ FSTD,		"fstd"		},
-	{ FSTENV,	"fstenv"	},
-	{ FSTPD,	"fstpd"		},
-	{ FSTPS,	"fstps"		},
-	{ FSTPX,	"fstpx"		},
-	{ FSTS,		"fsts"		},
-	{ FSTSW,	"fstsw"		},
-	{ FSUBD,	"fsubd"		},
-	{ FSUBP,	"fsubp"		},
-	{ FSUBPR,	"fsubpr"	},
-	{ FSUBRD,	"fsubrd"	},
-	{ FSUBRS,	"fsubrs"	},
-	{ FSUBS,	"fsubs"		},
-	{ FTST,		"ftst"		},
-	{ FUCOM,	"fucom"		},
-	{ FUCOMP,	"fucomp"	},
-	{ FUCOMPP,	"fucompp"	},
-	{ FXAM,		"fxam"		},
-	{ FXCH,		"fxch"		},
-	{ FXTRACT,	"fxtract"	},
-	{ FYL2X,	"fyl2x"		},
-	{ FYL2XP1,	"fyl2xp1"	},
-	{ HLT,		"hlt"		},
-	{ IDIV,		"idiv%"		},
-	{ IMUL,		"imul%"		},
-	{ IN,		"in%"		},
-	{ INC,		"inc%"		},
-	{ INS,		"ins%"		},
-	{ INT,		"int"		},
-	{ INTO,		"into"		},
-	{ INVD,		"invd"		},
-	{ INVLPG,	"invlpg"	},
-	{ IRET,		"iret"		},
-	{ IRETD,	"iretd"		},
-	{ JA,		"ja"		},
-	{ JAE,		"jae"		},
-	{ JB,		"jb"		},
-	{ JBE,		"jbe"		},
-	{ JCXZ,		"jcxz"		},
-	{ JE,		"je"		},
-	{ JG,		"jg"		},
-	{ JGE,		"jge"		},
-	{ JL,		"jl"		},
-	{ JLE,		"jle"		},
-	{ JMP,		"jmp"		},
-	{ JMPF,		"jmpf"		},
-	{ JNE,		"jne"		},
-	{ JNO,		"jno"		},
-	{ JNP,		"jnp"		},
-	{ JNS,		"jns"		},
-	{ JO,		"jo"		},
-	{ JP,		"jp"		},
-	{ JS,		"js"		},
-	{ LAHF,		"lahf"		},
-	{ LAR,		"lar"		},
-	{ LDS,		"lds"		},
-	{ LEA,		"lea"		},
-	{ LEAVE,	"leave"		},
-	{ LES,		"les"		},
-	{ LFS,		"lfs"		},
-	{ LGDT,		"lgdt"		},
-	{ LGS,		"lgs"		},
-	{ LIDT,		"lidt"		},
-	{ LLDT,		"lldt"		},
-	{ LMSW,		"lmsw"		},
-	{ LOCK,		"lock"		},
-	{ LODS,		"lods%"		},
-	{ LOOP,		"loop"		},
-	{ LOOPE,	"loope"		},
-	{ LOOPNE,	"loopne"	},
-	{ LSL,		"lsl"		},
-	{ LSS,		"lss"		},
-	{ LTR,		"ltr"		},
-	{ MOV,		"mov%"		},
-	{ MOVS,		"movs%"		},
-	{ MOVSX,	"movsx"		},
-	{ MOVSXB,	"movsxb"	},
-	{ MOVZX,	"movzx"		},
-	{ MOVZXB,	"movzxb"	},
-	{ MUL,		"mul%"		},
-	{ NEG,		"neg%"		},
-	{ NOP,		"nop"		},
-	{ NOT,		"not%"		},
-	{ OR,		"or%"		},
-	{ OUT,		"out%"		},
-	{ OUTS,		"outs%"		},
-	{ POP,		"pop"		},
-	{ POPA,		"popa"		},
-	{ POPF,		"popf"		},
-	{ PUSH,		"push"		},
-	{ PUSHA,	"pusha"		},
-	{ PUSHF,	"pushf"		},
-	{ RCL,		"rcl%"		},
-	{ RCR,		"rcr%"		},
-	{ RET,		"ret"		},
-	{ RETF,		"retf"		},
-	{ ROL,		"rol%"		},
-	{ ROR,		"ror%"		},
-	{ SAHF,		"sahf"		},
-	{ SAL,		"sal%"		},
-	{ SAR,		"sar%"		},
-	{ SBB,		"sbb%"		},
-	{ SCAS,		"scas%"		},
-	{ SETA,		"seta"		},
-	{ SETAE,	"setae"		},
-	{ SETB,		"setb"		},
-	{ SETBE,	"setbe"		},
-	{ SETE,		"sete"		},
-	{ SETG,		"setg"		},
-	{ SETGE,	"setge"		},
-	{ SETL,		"setl"		},
-	{ SETLE,	"setle"		},
-	{ SETNE,	"setne"		},
-	{ SETNO,	"setno"		},
-	{ SETNP,	"setnp"		},
-	{ SETNS,	"setns"		},
-	{ SETO,		"seto"		},
-	{ SETP,		"setp"		},
-	{ SETS,		"sets"		},
-	{ SGDT,		"sgdt"		},
-	{ SHL,		"shl%"		},
-	{ SHLD,		"shld"		},
-	{ SHR,		"shr%"		},
-	{ SHRD,		"shrd"		},
-	{ SIDT,		"sidt"		},
-	{ SLDT,		"sldt"		},
-	{ SMSW,		"smsw"		},
-	{ STC,		"stc"		},
-	{ STD,		"std"		},
-	{ STI,		"sti"		},
-	{ STOS,		"stos%"		},
-	{ STR,		"str"		},
-	{ SUB,		"sub%"		},
-	{ TEST,		"test%"		},
-	{ VERR,		"verr"		},
-	{ VERW,		"verw"		},
-	{ WAIT,		"wait"		},
-	{ WBINVD,	"wbinvd"	},
-	{ XADD,		"xadd"		},
-	{ XCHG,		"xchg%"		},
-	{ XLAT,		"xlat"		},
-	{ XOR,		"xor%"		},
-};
-
-#define farjmp(o)	((o) == JMPF || (o) == CALLF)
-
-static FILE *ef;
-static long eline= 1;
-static char *efile;
-static char *orig_efile;
-static char *opcode2name_tab[N_OPCODES];
-static enum dialect { ACK, NCC } dialect= ACK;
-
-static void ack_putchar(int c)
-/* LOOK, this programmer checks the return code of putc!  What an idiot, noone
- * does that!
- */
-{
-	if (putc(c, ef) == EOF) fatal(orig_efile);
-}
-
-static void ack_printf(const char *fmt, ...)
-{
-	va_list ap;
-
-	va_start(ap, fmt);
-	if (vfprintf(ef, fmt, ap) == EOF) fatal(orig_efile);
-	va_end(ap);
-}
-
-void ack_emit_init(char *file, const char *banner)
-/* Prepare producing an ACK assembly file. */
-{
-	mnemonic_t *mp;
-
-	if (file == nil) {
-		file= "stdout";
-		ef= stdout;
-	} else {
-		if ((ef= fopen(file, "w")) == nil) fatal(file);
-	}
-	orig_efile= file;
-	efile= file;
-	ack_printf("! %s", banner);
-	if (dialect == ACK) {
-		/* Declare the four sections used under Minix. */
-		ack_printf(
-	"\n.sect .text; .sect .rom; .sect .data; .sect .bss\n.sect .text");
-	}
-
-	/* Initialize the opcode to mnemonic translation table. */
-	for (mp= mnemtab; mp < arraylimit(mnemtab); mp++) {
-		assert(opcode2name_tab[mp->opcode] == nil);
-		opcode2name_tab[mp->opcode]= mp->name;
-	}
-}
-
-#define opcode2name(op)		(opcode2name_tab[op] + 0)
-
-static void ack_put_string(const char *s, size_t n)
-/* Emit a string with weird characters quoted. */
-{
-	while (n > 0) {
-		int c= *s;
-
-		if (c < ' ' || c > 0177) {
-			ack_printf("\\%03o", c & 0xFF);
-		} else
-		if (c == '"' || c == '\\') {
-			ack_printf("\\%c", c);
-		} else {
-			ack_putchar(c);
-		}
-		s++;
-		n--;
-	}
-}
-
-static void ack_put_expression(asm86_t *a, expression_t *e, int deref)
-/* Send an expression, i.e. instruction operands, to the output file.  Deref
- * is true when the rewrite for the ncc dialect may be made.
- */
-{
-	assert(e != nil);
-
-	switch (e->operator) {
-	case ',':
-		if (dialect == NCC && farjmp(a->opcode)) {
-			/* ACK jmpf seg:off  ->  NCC jmpf off,seg */
-			ack_put_expression(a, e->right, deref);
-			ack_printf(", ");
-			ack_put_expression(a, e->left, deref);
-		} else {
-			ack_put_expression(a, e->left, deref);
-			ack_printf(farjmp(a->opcode) ? ":" : ", ");
-			ack_put_expression(a, e->right, deref);
-		}
-		break;
-	case 'O':
-		if (deref && a->optype == JUMP) ack_putchar('@');
-		if (e->left != nil) ack_put_expression(a, e->left, 0);
-		if (e->middle != nil) ack_put_expression(a, e->middle, 0);
-		if (e->right != nil) ack_put_expression(a, e->right, 0);
-		break;
-	case '(':
-		if (deref && a->optype == JUMP) ack_putchar('@');
-		if (!deref) ack_putchar('(');
-		ack_put_expression(a, e->middle, 0);
-		if (!deref) ack_putchar(')');
-		break;
-	case 'B':
-		ack_printf("(%s)", e->name);
-		break;
-	case '1':
-	case '2':
-	case '4':
-	case '8':
-		ack_printf((use16() && e->operator == '1')
-				? "(%s)" : "(%s*%c)", e->name, e->operator);
-		break;
-	case '+':
-	case '-':
-	case '~':
-		if (e->middle != nil) {
-			if (deref && a->optype != JUMP) ack_putchar('#');
-			ack_putchar(e->operator);
-			ack_put_expression(a, e->middle, 0);
-			break;
-		}
-		/*FALL THROUGH*/
-	case '*':
-	case '/':
-	case '%':
-	case '&':
-	case '|':
-	case '^':
-	case S_LEFTSHIFT:
-	case S_RIGHTSHIFT:
-		if (deref && a->optype != JUMP) ack_putchar('#');
-		ack_put_expression(a, e->left, 0);
-		if (e->operator == S_LEFTSHIFT) {
-			ack_printf("<<");
-		} else
-		if (e->operator == S_RIGHTSHIFT) {
-			ack_printf(">>");
-		} else {
-			ack_putchar(e->operator);
-		}
-		ack_put_expression(a, e->right, 0);
-		break;
-	case '[':
-		if (deref && a->optype != JUMP) ack_putchar('#');
-		ack_putchar('[');
-		ack_put_expression(a, e->middle, 0);
-		ack_putchar(']');
-		break;
-	case 'W':
-		if (deref && a->optype == JUMP && isregister(e->name))
-		{
-			ack_printf("(%s)", e->name);
-			break;
-		}
-		if (deref && a->optype != JUMP && !isregister(e->name)) {
-			ack_putchar('#');
-		}
-		ack_printf("%s", e->name);
-		break;
-	case 'S':
-		ack_putchar('"');
-		ack_put_string(e->name, e->len);
-		ack_putchar('"');
-		break;
-	default:
-		fprintf(stderr,
-		"asmconv: internal error, unknown expression operator '%d'\n",
-			e->operator);
-		exit(EXIT_FAILURE);
-	}
-}
-
-void ack_emit_instruction(asm86_t *a)
-/* Output one instruction and its operands. */
-{
-	int same= 0;
-	char *p;
-	static int high_seg;
-	int deref;
-
-	if (a == nil) {
-		/* Last call */
-		ack_putchar('\n');
-		return;
-	}
-
-	/* Make sure the line number of the line to be emitted is ok. */
-	if ((a->file != efile && strcmp(a->file, efile) != 0)
-				|| a->line < eline || a->line > eline+10) {
-		ack_putchar('\n');
-		ack_printf("# %ld \"%s\"\n", a->line, a->file);
-		efile= a->file;
-		eline= a->line;
-	} else {
-		if (a->line == eline) {
-			ack_printf("; ");
-			same= 1;
-		}
-		while (eline < a->line) {
-			ack_putchar('\n');
-			eline++;
-		}
-	}
-
-	if (a->opcode == DOT_LABEL) {
-		assert(a->args->operator == ':');
-		ack_printf("%s:", a->args->name);
-	} else
-	if (a->opcode == DOT_EQU) {
-		assert(a->args->operator == '=');
-		ack_printf("\t%s = ", a->args->name);
-		ack_put_expression(a, a->args->middle, 0);
-	} else
-	if ((p= opcode2name(a->opcode)) != nil) {
-		char *sep= dialect == ACK ? "" : ";";
-
-		if (!is_pseudo(a->opcode) && !same) ack_putchar('\t');
-
-		switch (a->rep) {
-		case ONCE:	break;
-		case REP:	ack_printf("rep");	break;
-		case REPE:	ack_printf("repe");	break;
-		case REPNE:	ack_printf("repne");	break;
-		default:	assert(0);
-		}
-		if (a->rep != ONCE) {
-			ack_printf(dialect == ACK ? " " : "; ");
-		}
-		switch (a->seg) {
-		case DEFSEG:	break;
-		case CSEG:	ack_printf("cseg");	break;
-		case DSEG:	ack_printf("dseg");	break;
-		case ESEG:	ack_printf("eseg");	break;
-		case FSEG:	ack_printf("fseg");	break;
-		case GSEG:	ack_printf("gseg");	break;
-		case SSEG:	ack_printf("sseg");	break;
-		default:	assert(0);
-		}
-		if (a->seg != DEFSEG) {
-			ack_printf(dialect == ACK ? " " : "; ");
-		}
-		if (a->oaz & OPZ) ack_printf(use16() ? "o32 " : "o16 ");
-		if (a->oaz & ADZ) ack_printf(use16() ? "a32 " : "a16 ");
-
-		if (a->opcode == CBW) {
-			p= !(a->oaz & OPZ) == use16() ? "cbw" : "cwde";
-		}
-
-		if (a->opcode == CWD) {
-			p= !(a->oaz & OPZ) == use16() ? "cwd" : "cdq";
-		}
-
-		if (a->opcode == DOT_COMM && a->args != nil
-			&& a->args->operator == ','
-			&& a->args->left->operator == 'W'
-		) {
-			ack_printf(".define\t%s; ", a->args->left->name);
-		}
-		while (*p != 0) {
-			if (*p == '%') {
-				if (a->optype == BYTE) ack_putchar('b');
-			} else {
-				ack_putchar(*p);
-			}
-			p++;
-		}
-		if (a->args != nil) {
-			ack_putchar('\t');
-			switch (a->opcode) {
-			case IN:
-			case OUT:
-			case INT:
-				deref= 0;
-				break;
-			default:
-				deref= (dialect == NCC && a->optype != PSEUDO);
-			}
-			ack_put_expression(a, a->args, deref);
-		}
-		if (a->opcode == DOT_USE16) set_use16();
-		if (a->opcode == DOT_USE32) set_use32();
-	} else {
-		fprintf(stderr,
-			"asmconv: internal error, unknown opcode '%d'\n",
-			a->opcode);
-		exit(EXIT_FAILURE);
-	}
-}
-
-/* A few ncc mnemonics are different. */
-static mnemonic_t ncc_mnemtab[] = {
-	{ DOT_BSS,	".bss"		},
-	{ DOT_DATA,	".data"		},
-	{ DOT_END,	".end"		},
-	{ DOT_ROM,	".rom"		},
-	{ DOT_TEXT,	".text"		},
-};
-
-void ncc_emit_init(char *file, const char *banner)
-/* The assembly produced by the Minix ACK ANSI C compiler for the 8086 is
- * different from the normal ACK assembly, and different from the old K&R
- * assembler.  This brings us endless joy.  (It was supposed to make
- * translation of the assembly used by the old K&R assembler easier by
- * not deviating too much from that dialect.)
- */
-{
-	mnemonic_t *mp;
-
-	dialect= NCC;
-	ack_emit_init(file, banner);
-
-	/* Replace a few mnemonics. */
-	for (mp= ncc_mnemtab; mp < arraylimit(ncc_mnemtab); mp++) {
-		opcode2name_tab[mp->opcode]= mp->name;
-	}
-}
-
-void ncc_emit_instruction(asm86_t *a)
-{
-	ack_emit_instruction(a);
-}
Index: trunk/minix/commands/i386/asmconv/emit_gnu.c
===================================================================
--- trunk/minix/commands/i386/asmconv/emit_gnu.c	(revision 9)
+++ 	(revision )
@@ -1,674 +1,0 @@
-/*	emit_gnu.c - emit GNU assembly			Author: Kees J. Bot
- *								28 Dec 1993
- */
-#define nil 0
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <assert.h>
-#include "asmconv.h"
-#include "token.h"
-#include "asm86.h"
-#include "languages.h"
-
-typedef struct mnemonic {	/* GNU as386 mnemonics translation table. */
-	opcode_t	opcode;
-	char		*name;
-} mnemonic_t;
-
-static mnemonic_t mnemtab[] = {
-	{ AAA,		"aaa"		},
-	{ AAD,		"aad"		},
-	{ AAM,		"aam"		},
-	{ AAS,		"aas"		},
-	{ ADC,		"adc%"		},
-	{ ADD,		"add%"		},
-	{ AND,		"and%"		},
-	{ ARPL,		"arpl"		},
-	{ BOUND,	"bound%"	},
-	{ BSF,		"bsf%"		},
-	{ BSR,		"bsr%"		},
-	{ BSWAP,	"bswap"		},
-	{ BT,		"bt%"		},
-	{ BTC,		"btc%"		},
-	{ BTR,		"btr%"		},
-	{ BTS,		"bts%"		},
-	{ CALL,		"call"		},
-	{ CALLF,	"lcall"		},
-	{ CBW,		"cbtw"		},
-	{ CLC,		"clc"		},
-	{ CLD,		"cld"		},
-	{ CLI,		"cli"		},
-	{ CLTS,		"clts"		},
-	{ CMC,		"cmc"		},
-	{ CMP,		"cmp%"		},
-	{ CMPS,		"cmps%"		},
-	{ CMPXCHG,	"cmpxchg"	},
-	{ CWD,		"cwtd"		},
-	{ DAA,		"daa"		},
-	{ DAS,		"das"		},
-	{ DEC,		"dec%"		},
-	{ DIV,		"div%"		},
-	{ DOT_ALIGN,	".align"	},
-	{ DOT_ASCII,	".ascii"	},
-	{ DOT_ASCIZ,	".asciz"	},
-	{ DOT_ASSERT,	".assert"	},
-	{ DOT_BASE,	".base"		},
-	{ DOT_BSS,	".bss"		},
-	{ DOT_COMM,	".comm"		},
-	{ DOT_DATA,	".data"		},
-	{ DOT_DATA1,	".byte"		},
-	{ DOT_DATA2,	".short"	},
-	{ DOT_DATA4,	".long"		},
-	{ DOT_DEFINE,	".globl"	},
-	{ DOT_EXTERN,	".globl"	},
-	{ DOT_FILE,	".file"		},
-	{ DOT_LCOMM,	".lcomm"	},
-	{ DOT_LINE,	".line"		},
-	{ DOT_LIST,	".list"		},
-	{ DOT_NOLIST,	".nolist"	},
-	{ DOT_ROM,	".data"		},	/* Minix -- separate I&D. */
-	{ DOT_SPACE,	".space"	},
-	{ DOT_SYMB,	".symb"		},
-	{ DOT_TEXT,	".text"		},
-	{ DOT_USE16,	".use16"	},
-	{ DOT_USE32,	".use32"	},
-	{ ENTER,	"enter"		},
-	{ F2XM1,	"f2xm1"		},
-	{ FABS,		"fabs"		},
-	{ FADD,		"fadd"		},
-	{ FADDD,	"faddl"		},
-	{ FADDP,	"faddp"		},
-	{ FADDS,	"fadds"		},
-	{ FBLD,		"fbld"		},
-	{ FBSTP,	"fbstp"		},
-	{ FCHS,		"fchs"		},
-	{ FCLEX,	"fnclex"	},
-	{ FCOMD,	"fcoml"		},
-	{ FCOMPD,	"fcompl"	},
-	{ FCOMPP,	"fcompp"	},
-	{ FCOMPS,	"fcomps"	},
-	{ FCOMS,	"fcoms"		},
-	{ FCOS,		"fcos"		},
-	{ FDECSTP,	"fdecstp"	},
-	{ FDIVD,	"fdivl"		},
-	{ FDIVP,	"fdivp"		},
-	{ FDIVRD,	"fdivrl"	},
-	{ FDIVRP,	"fdivrp"	},
-	{ FDIVRS,	"fdivrs"	},
-	{ FDIVS,	"fdivs"		},
-	{ FFREE,	"ffree"		},
-	{ FIADDL,	"fiaddl"	},
-	{ FIADDS,	"fiadds"	},
-	{ FICOM,	"ficom"		},
-	{ FICOMP,	"ficomp"	},
-	{ FIDIVL,	"fidivl"	},
-	{ FIDIVRL,	"fidivrl"	},
-	{ FIDIVRS,	"fidivrs"	},
-	{ FIDIVS,	"fidivs"	},
-	{ FILDL,	"fildl"		},
-	{ FILDQ,	"fildq"		},
-	{ FILDS,	"filds"		},
-	{ FIMULL,	"fimull"	},
-	{ FIMULS,	"fimuls"	},
-	{ FINCSTP,	"fincstp"	},
-	{ FINIT,	"fninit"	},
-	{ FISTL,	"fistl"		},
-	{ FISTP,	"fistp"		},
-	{ FISTS,	"fists"		},
-	{ FISUBL,	"fisubl"	},
-	{ FISUBRL,	"fisubrl"	},
-	{ FISUBRS,	"fisubrs"	},
-	{ FISUBS,	"fisubs"	},
-	{ FLD1,		"fld1"		},
-	{ FLDCW,	"fldcw"		},
-	{ FLDD,		"fldl"		},
-	{ FLDENV,	"fldenv"	},
-	{ FLDL2E,	"fldl2e"	},
-	{ FLDL2T,	"fldl2t"	},
-	{ FLDLG2,	"fldlg2"	},
-	{ FLDLN2,	"fldln2"	},
-	{ FLDPI,	"fldpi"		},
-	{ FLDS,		"flds"		},
-	{ FLDX,		"fldt"		},
-	{ FLDZ,		"fldz"		},
-	{ FMULD,	"fmull"		},
-	{ FMULP,	"fmulp"		},
-	{ FMULS,	"fmuls"		},
-	{ FNOP,		"fnop"		},
-	{ FPATAN,	"fpatan"	},
-	{ FPREM,	"fprem"		},
-	{ FPREM1,	"fprem1"	},
-	{ FPTAN,	"fptan"		},
-	{ FRNDINT,	"frndint"	},
-	{ FRSTOR,	"frstor"	},
-	{ FSAVE,	"fnsave"	},
-	{ FSCALE,	"fscale"	},
-	{ FSIN,		"fsin"		},
-	{ FSINCOS,	"fsincos"	},
-	{ FSQRT,	"fsqrt"		},
-	{ FSTCW,	"fnstcw"	},
-	{ FSTD,		"fstl"		},
-	{ FSTENV,	"fnstenv"	},
-	{ FSTPD,	"fstpl"		},
-	{ FSTPS,	"fstps"		},
-	{ FSTPX,	"fstpt"		},
-	{ FSTS,		"fsts"		},
-	{ FSTSW,	"fstsw"		},
-	{ FSUBD,	"fsubl"		},
-	{ FSUBP,	"fsubp"		},
-	{ FSUBPR,	"fsubpr"	},
-	{ FSUBRD,	"fsubrl"	},
-	{ FSUBRS,	"fsubrs"	},
-	{ FSUBS,	"fsubs"		},
-	{ FTST,		"ftst"		},
-	{ FUCOM,	"fucom"		},
-	{ FUCOMP,	"fucomp"	},
-	{ FUCOMPP,	"fucompp"	},
-	{ FXAM,		"fxam"		},
-	{ FXCH,		"fxch"		},
-	{ FXTRACT,	"fxtract"	},
-	{ FYL2X,	"fyl2x"		},
-	{ FYL2XP1,	"fyl2xp1"	},
-	{ HLT,		"hlt"		},
-	{ IDIV,		"idiv%"		},
-	{ IMUL,		"imul%"		},
-	{ IN,		"in%"		},
-	{ INC,		"inc%"		},
-	{ INS,		"ins%"		},
-	{ INT,		"int"		},
-	{ INTO,		"into"		},
-	{ INVD,		"invd"		},
-	{ INVLPG,	"invlpg"	},
-	{ IRET,		"iret"		},
-	{ IRETD,	"iret"		},
-	{ JA,		"ja"		},
-	{ JAE,		"jae"		},
-	{ JB,		"jb"		},
-	{ JBE,		"jbe"		},
-	{ JCXZ,		"jcxz"		},
-	{ JE,		"je"		},
-	{ JG,		"jg"		},
-	{ JGE,		"jge"		},
-	{ JL,		"jl"		},
-	{ JLE,		"jle"		},
-	{ JMP,		"jmp"		},
-	{ JMPF,		"ljmp"		},
-	{ JNE,		"jne"		},
-	{ JNO,		"jno"		},
-	{ JNP,		"jnp"		},
-	{ JNS,		"jns"		},
-	{ JO,		"jo"		},
-	{ JP,		"jp"		},
-	{ JS,		"js"		},
-	{ LAHF,		"lahf"		},
-	{ LAR,		"lar"		},
-	{ LDS,		"lds"		},
-	{ LEA,		"lea%"		},
-	{ LEAVE,	"leave"		},
-	{ LES,		"les"		},
-	{ LFS,		"lfs"		},
-	{ LGDT,		"lgdt"		},
-	{ LGS,		"lgs"		},
-	{ LIDT,		"lidt"		},
-	{ LLDT,		"lldt"		},
-	{ LMSW,		"lmsw"		},
-	{ LOCK,		"lock"		},
-	{ LODS,		"lods%"		},
-	{ LOOP,		"loop"		},
-	{ LOOPE,	"loope"		},
-	{ LOOPNE,	"loopne"	},
-	{ LSL,		"lsl"		},
-	{ LSS,		"lss"		},
-	{ LTR,		"ltr"		},
-	{ MOV,		"mov%"		},
-	{ MOVS,		"movs%"		},
-	{ MOVSX,	"movswl"	},
-	{ MOVSXB,	"movsb%"	},
-	{ MOVZX,	"movzwl"	},
-	{ MOVZXB,	"movzb%"	},
-	{ MUL,		"mul%"		},
-	{ NEG,		"neg%"		},
-	{ NOP,		"nop"		},
-	{ NOT,		"not%"		},
-	{ OR,		"or%"		},
-	{ OUT,		"out%"		},
-	{ OUTS,		"outs%"		},
-	{ POP,		"pop%"		},
-	{ POPA,		"popa%"		},
-	{ POPF,		"popf%"		},
-	{ PUSH,		"push%"		},
-	{ PUSHA,	"pusha%"	},
-	{ PUSHF,	"pushf%"	},
-	{ RCL,		"rcl%"		},
-	{ RCR,		"rcr%"		},
-	{ RET,		"ret"		},
-	{ RETF,		"lret"		},
-	{ ROL,		"rol%"		},
-	{ ROR,		"ror%"		},
-	{ SAHF,		"sahf"		},
-	{ SAL,		"sal%"		},
-	{ SAR,		"sar%"		},
-	{ SBB,		"sbb%"		},
-	{ SCAS,		"scas%"		},
-	{ SETA,		"setab"		},
-	{ SETAE,	"setaeb"	},
-	{ SETB,		"setbb"		},
-	{ SETBE,	"setbeb"	},
-	{ SETE,		"seteb"		},
-	{ SETG,		"setgb"		},
-	{ SETGE,	"setgeb"	},
-	{ SETL,		"setlb"		},
-	{ SETLE,	"setleb"	},
-	{ SETNE,	"setneb"	},
-	{ SETNO,	"setnob"	},
-	{ SETNP,	"setnpb"	},
-	{ SETNS,	"setnsb"	},
-	{ SETO,		"setob"		},
-	{ SETP,		"setpb"		},
-	{ SETS,		"setsb"		},
-	{ SGDT,		"sgdt"		},
-	{ SHL,		"shl%"		},
-	{ SHLD,		"shld%"		},
-	{ SHR,		"shr%"		},
-	{ SHRD,		"shrd%"		},
-	{ SIDT,		"sidt"		},
-	{ SLDT,		"sldt"		},
-	{ SMSW,		"smsw"		},
-	{ STC,		"stc"		},
-	{ STD,		"std"		},
-	{ STI,		"sti"		},
-	{ STOS,		"stos%"		},
-	{ STR,		"str"		},
-	{ SUB,		"sub%"		},
-	{ TEST,		"test%"		},
-	{ VERR,		"verr"		},
-	{ VERW,		"verw"		},
-	{ WAIT,		"wait"		},
-	{ WBINVD,	"wbinvd"	},
-	{ XADD,		"xadd"		},
-	{ XCHG,		"xchg%"		},
-	{ XLAT,		"xlat"		},
-	{ XOR,		"xor%"		},
-};
-
-static FILE *ef;
-static long eline= 1;
-static char *efile;
-static char *orig_efile;
-static char *opcode2name_tab[N_OPCODES];
-
-static void gnu_putchar(int c)
-/* LOOK, this programmer checks the return code of putc!  What an idiot, noone
- * does that!
- */
-{
-	if (putc(c, ef) == EOF) fatal(orig_efile);
-}
-
-static void gnu_printf(const char *fmt, ...)
-{
-	va_list ap;
-
-	va_start(ap, fmt);
-	if (vfprintf(ef, fmt, ap) == EOF) fatal(orig_efile);
-	va_end(ap);
-}
-
-void gnu_emit_init(char *file, const char *banner)
-/* Prepare producing a GNU assembly file. */
-{
-	mnemonic_t *mp;
-
-	if (file == nil) {
-		file= "stdout";
-		ef= stdout;
-	} else {
-		if ((ef= fopen(file, "w")) == nil) fatal(file);
-	}
-	orig_efile= file;
-	efile= file;
-	gnu_printf("/ %s", banner);
-
-	/* Initialize the opcode to mnemonic translation table. */
-	for (mp= mnemtab; mp < arraylimit(mnemtab); mp++) {
-		assert(opcode2name_tab[mp->opcode] == nil);
-		opcode2name_tab[mp->opcode]= mp->name;
-	}
-}
-
-#define opcode2name(op)		(opcode2name_tab[op] + 0)
-
-static void gnu_put_string(const char *s, size_t n)
-/* Emit a string with weird characters quoted. */
-{
-	while (n > 0) {
-		int c= *s;
-
-		if (c < ' ' || c > 0177) {
-			gnu_printf("\\%03o", c);
-		} else
-		if (c == '"' || c == '\\') {
-			gnu_printf("\\%c", c & 0xFF);
-		} else {
-			gnu_putchar(c);
-		}
-		s++;
-		n--;
-	}
-}
-
-static void gnu_put_expression(asm86_t *a, expression_t *e, int deref)
-/* Send an expression, i.e. instruction operands, to the output file.  Deref
- * is true when the rewrite of "x" -> "#x" or "(x)" -> "x" may be made.
- */
-{
-	assert(e != nil);
-
-	switch (e->operator) {
-	case ',':
-		if (is_pseudo(a->opcode)) {
-			/* Pseudo's are normal. */
-			gnu_put_expression(a, e->left, deref);
-			gnu_printf(", ");
-			gnu_put_expression(a, e->right, deref);
-		} else {
-			/* He who invented GNU assembly has seen one VAX too
-			 * many, operands are given in the wrong order.  This
-			 * makes coding from an Intel databook a real delight.
-			 * A good thing this program allows us to write the
-			 * more normal ACK assembly.
-			 */
-			gnu_put_expression(a, e->right, deref);
-			gnu_printf(", ");
-			gnu_put_expression(a, e->left, deref);
-		}
-		break;
-	case 'O':
-		if (deref && a->optype == JUMP) gnu_putchar('*');
-		if (e->left != nil) gnu_put_expression(a, e->left, 0);
-		gnu_putchar('(');
-		if (e->middle != nil) gnu_put_expression(a, e->middle, 0);
-		if (e->right != nil) {
-			gnu_putchar(',');
-			gnu_put_expression(a, e->right, 0);
-		}
-		gnu_putchar(')');
-		break;
-	case '(':
-		if (!deref) gnu_putchar('(');
-		if (deref && a->optype == JUMP) gnu_putchar('*');
-		gnu_put_expression(a, e->middle, 0);
-		if (!deref) gnu_putchar(')');
-		break;
-	case 'B':
-		gnu_printf("%%%s", e->name);
-		break;
-	case '1':
-	case '2':
-	case '4':
-	case '8':
-		gnu_printf("%%%s,%c", e->name, e->operator);
-		break;
-	case '+':
-	case '-':
-	case '~':
-		if (e->middle != nil) {
-			if (deref && a->optype >= BYTE) gnu_putchar('$');
-			gnu_putchar(e->operator);
-			gnu_put_expression(a, e->middle, 0);
-			break;
-		}
-		/*FALL THROUGH*/
-	case '*':
-	case '/':
-	case '%':
-	case '&':
-	case '|':
-	case '^':
-	case S_LEFTSHIFT:
-	case S_RIGHTSHIFT:
-		if (deref && a->optype >= BYTE) gnu_putchar('$');
-		gnu_put_expression(a, e->left, 0);
-		if (e->operator == S_LEFTSHIFT) {
-			gnu_printf("<<");
-		} else
-		if (e->operator == S_RIGHTSHIFT) {
-			gnu_printf(">>");
-		} else {
-			gnu_putchar(e->operator);
-		}
-		gnu_put_expression(a, e->right, 0);
-		break;
-	case '[':
-		if (deref && a->optype >= BYTE) gnu_putchar('$');
-		gnu_putchar('(');
-		gnu_put_expression(a, e->middle, 0);
-		gnu_putchar(')');
-		break;
-	case 'W':
-		if (isregister(e->name)) {
-			if (a->optype == JUMP) gnu_putchar('*');
-			gnu_printf("%%%s", e->name);
-		} else {
-			if (deref && a->optype >= BYTE) gnu_putchar('$');
-			gnu_printf("%s", e->name);
-		}
-		break;
-	case 'S':
-		gnu_putchar('"');
-		gnu_put_string(e->name, e->len);
-		gnu_putchar('"');
-		break;
-	default:
-		fprintf(stderr,
-		"asmconv: internal error, unknown expression operator '%d'\n",
-			e->operator);
-		exit(EXIT_FAILURE);
-	}
-}
-
-void gnu_emit_instruction(asm86_t *a)
-/* Output one instruction and its operands. */
-{
-	int same= 0;
-	char *p;
-
-	if (a == nil) {
-		/* Last call */
-		gnu_putchar('\n');
-		return;
-	}
-
-	if (use16()) {
-		fprintf(stderr,
-		"asmconv: the GNU assembler can't translate 8086 code\n");
-		exit(EXIT_FAILURE);
-	}
-
-	/* Make sure the line number of the line to be emitted is ok. */
-	if ((a->file != efile && strcmp(a->file, efile) != 0)
-				|| a->line < eline || a->line > eline+10) {
-		gnu_putchar('\n');
-		gnu_printf("# %ld \"%s\"\n", a->line, a->file);
-		efile= a->file;
-		eline= a->line;
-	} else {
-		if (a->line == eline) {
-			gnu_printf("; ");
-			same= 1;
-		}
-		while (eline < a->line) {
-			gnu_putchar('\n');
-			eline++;
-		}
-	}
-
-	if (a->opcode == DOT_LABEL) {
-		assert(a->args->operator == ':');
-		gnu_printf("%s:", a->args->name);
-	} else
-	if (a->opcode == DOT_EQU) {
-		assert(a->args->operator == '=');
-		gnu_printf("\t%s = ", a->args->name);
-		gnu_put_expression(a, a->args->middle, 0);
-	} else
-	if (a->opcode == DOT_ALIGN) {
-		/* GNU .align thinks in powers of two. */
-		unsigned long n;
-		unsigned s;
-
-		assert(a->args->operator == 'W' && isanumber(a->args->name));
-		n= strtoul(a->args->name, nil, 0);
-		for (s= 0; s <= 4 && (1 << s) < n; s++) {}
-		gnu_printf(".align\t%u", s);
-	} else
-	if ((p= opcode2name(a->opcode)) != nil) {
-		if (!is_pseudo(a->opcode) && !same) gnu_putchar('\t');
-
-		switch (a->rep) {
-		case ONCE:	break;
-		case REP:	gnu_printf("rep; ");	break;
-		case REPE:	gnu_printf("repe; ");	break;
-		case REPNE:	gnu_printf("repne; ");	break;
-		default:	assert(0);
-		}
-		switch (a->seg) {
-		/* Kludge to avoid knowing where to put the "%es:" */
-		case DEFSEG:	break;
-		case CSEG:	gnu_printf(".byte 0x2e; ");	break;
-		case DSEG:	gnu_printf(".byte 0x3e; ");	break;
-		case ESEG:	gnu_printf(".byte 0x26; ");	break;
-		case FSEG:	gnu_printf(".byte 0x64; ");	break;
-		case GSEG:	gnu_printf(".byte 0x65; ");	break;
-		case SSEG:	gnu_printf(".byte 0x36; ");	break;
-		default:	assert(0);
-		}
-
-		/* Exceptions, exceptions... */
-		if (a->opcode == CBW) {
-			if (!(a->oaz & OPZ)) p= "cwtl";
-			a->oaz&= ~OPZ;
-		}
-		if (a->opcode == CWD) {
-			if (!(a->oaz & OPZ)) p= "cltd";
-			a->oaz&= ~OPZ;
-		}
-
-		if (a->opcode == RET || a->opcode == RETF) {
-			/* Argument of RET needs a '$'. */
-			a->optype= WORD;
-		}
-
-		if (a->opcode == MUL && a->args != nil
-						&& a->args->operator == ',') {
-			/* Two operand MUL is an IMUL? */
-			p="imul%";
-		}
-
-		/* GAS doesn't understand the interesting combinations. */
-		if (a->oaz & ADZ) gnu_printf(".byte 0x67; ");
-		if (a->oaz & OPZ && strchr(p, '%') == nil)
-			gnu_printf(".byte 0x66; ");
-
-		/* Unsupported instructions that Minix code needs. */
-		if (a->opcode == JMPF && a->args != nil
-					&& a->args->operator == ',') {
-			/* JMPF seg:off. */
-			gnu_printf(".byte 0xEA; .long ");
-			gnu_put_expression(a, a->args->right, 0);
-			gnu_printf("; .short ");
-			gnu_put_expression(a, a->args->left, 0);
-			return;
-		}
-		if (a->opcode == JMPF && a->args != nil
-			&& a->args->operator == 'O'
-			&& a->args->left != nil
-			&& a->args->right == nil
-			&& a->args->middle != nil
-			&& a->args->middle->operator == 'B'
-			&& strcmp(a->args->middle->name, "esp") == 0
-		) {
-			/* JMPF offset(ESP). */
-			gnu_printf(".byte 0xFF,0x6C,0x24,");
-			gnu_put_expression(a, a->args->left, 0);
-			return;
-		}
-		if (a->opcode == MOV && a->args != nil
-			&& a->args->operator == ','
-			&& a->args->left != nil
-			&& a->args->left->operator == 'W'
-			&& (strcmp(a->args->left->name, "ds") == 0
-				|| strcmp(a->args->left->name, "es") == 0)
-			&& a->args->right->operator == 'O'
-			&& a->args->right->left != nil
-			&& a->args->right->right == nil
-			&& a->args->right->middle != nil
-			&& a->args->right->middle->operator == 'B'
-			&& strcmp(a->args->right->middle->name, "esp") == 0
-		) {
-			/* MOV DS, offset(ESP); MOV ES, offset(ESP) */
-			gnu_printf(".byte 0x8E,0x%02X,0x24,",
-				a->args->left->name[0] == 'd' ? 0x5C : 0x44);
-			gnu_put_expression(a, a->args->right->left, 0);
-			return;
-		}
-		if (a->opcode == MOV && a->args != nil
-			&& a->args->operator == ','
-			&& a->args->left != nil
-			&& a->args->left->operator == 'W'
-			&& (strcmp(a->args->left->name, "ds") == 0
-				|| strcmp(a->args->left->name, "es") == 0)
-			&& a->args->right->operator == '('
-			&& a->args->right->middle != nil
-		) {
-			/* MOV DS, (memory); MOV ES, (memory) */
-			gnu_printf(".byte 0x8E,0x%02X; .long ",
-				a->args->left->name[0] == 'd' ? 0x1D : 0x05);
-			gnu_put_expression(a, a->args->right->middle, 0);
-			return;
-		}
-
-		while (*p != 0) {
-			if (*p == '%') {
-				if (a->optype == BYTE) {
-					gnu_putchar('b');
-				} else
-				if (a->optype == WORD) {
-					gnu_putchar((a->oaz & OPZ) ? 'w' : 'l');
-				} else {
-					assert(0);
-				}
-			} else {
-				gnu_putchar(*p);
-			}
-			p++;
-		}
-
-		if (a->args != nil) {
-			static char *aregs[] = { "al", "ax", "eax" };
-
-			gnu_putchar('\t');
-			switch (a->opcode) {
-			case IN:
-				gnu_put_expression(a, a->args, 1);
-				gnu_printf(", %%%s", aregs[a->optype - BYTE]);
-				break;
-			case OUT:
-				gnu_printf("%%%s, ", aregs[a->optype - BYTE]);
-				gnu_put_expression(a, a->args, 1);
-				break;
-			default:
-				gnu_put_expression(a, a->args, 1);
-			}
-		}
-		if (a->opcode == DOT_USE16) set_use16();
-		if (a->opcode == DOT_USE32) set_use32();
-	} else {
-		fprintf(stderr,
-			"asmconv: internal error, unknown opcode '%d'\n",
-			a->opcode);
-		exit(EXIT_FAILURE);
-	}
-}
Index: trunk/minix/commands/i386/asmconv/languages.h
===================================================================
--- trunk/minix/commands/i386/asmconv/languages.h	(revision 9)
+++ 	(revision )
@@ -1,25 +1,0 @@
-/*	languages.h - functions that parse or emit assembly
- *							Author: Kees J. Bot
- *								27 Dec 1993
- */
-
-void ack_parse_init(char *file);
-asm86_t *ack_get_instruction(void);
-
-void ncc_parse_init(char *file);
-asm86_t *ncc_get_instruction(void);
-
-void gnu_parse_init(char *file);
-asm86_t *gnu_get_instruction(void);
-
-void bas_parse_init(char *file);
-asm86_t *bas_get_instruction(void);
-
-void ack_emit_init(char *file, const char *banner);
-void ack_emit_instruction(asm86_t *instr);
-
-void ncc_emit_init(char *file, const char *banner);
-void ncc_emit_instruction(asm86_t *instr);
-
-void gnu_emit_init(char *file, const char *banner);
-void gnu_emit_instruction(asm86_t *instr);
Index: trunk/minix/commands/i386/asmconv/parse_ack.c
===================================================================
--- trunk/minix/commands/i386/asmconv/parse_ack.c	(revision 9)
+++ 	(revision )
@@ -1,910 +1,0 @@
-/*	parse_ack.c - parse ACK assembly		Author: Kees J. Bot
- *		      parse NCC assembly			18 Dec 1993
- */
-#define nil 0
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include "asmconv.h"
-#include "token.h"
-#include "asm86.h"
-#include "languages.h"
-
-typedef struct mnemonic {	/* ACK as86 mnemonics translation table. */
-	char		*name;
-	opcode_t	opcode;
-	optype_t	optype;
-} mnemonic_t;
-
-static mnemonic_t mnemtab[] = {			/* This array is sorted. */
-	{ ".align",	DOT_ALIGN,	PSEUDO },
-	{ ".ascii",	DOT_ASCII,	PSEUDO },
-	{ ".asciz",	DOT_ASCIZ,	PSEUDO },
-	{ ".assert",	DOT_ASSERT,	PSEUDO },
-	{ ".base",	DOT_BASE,	PSEUDO },
-	{ ".bss",	DOT_BSS,	PSEUDO },
-	{ ".comm",	DOT_LCOMM,	PSEUDO },
-	{ ".data",	DOT_DATA,	PSEUDO },
-	{ ".data1",	DOT_DATA1,	PSEUDO },
-	{ ".data2",	DOT_DATA2,	PSEUDO },
-	{ ".data4",	DOT_DATA4,	PSEUDO },
-	{ ".define",	DOT_DEFINE,	PSEUDO },
-	{ ".end",	DOT_END,	PSEUDO },
-	{ ".extern",	DOT_EXTERN,	PSEUDO },
-	{ ".file",	DOT_FILE,	PSEUDO },
-	{ ".line",	DOT_LINE,	PSEUDO },
-	{ ".list",	DOT_LIST,	PSEUDO },
-	{ ".nolist",	DOT_NOLIST,	PSEUDO },
-	{ ".rom",	DOT_ROM,	PSEUDO },
-	{ ".space",	DOT_SPACE,	PSEUDO },
-	{ ".symb",	DOT_SYMB,	PSEUDO },
-	{ ".text",	DOT_TEXT,	PSEUDO },
-	{ ".use16",	DOT_USE16,	PSEUDO },
-	{ ".use32",	DOT_USE32,	PSEUDO },
-	{ "aaa",	AAA,		WORD },
-	{ "aad",	AAD,		WORD },
-	{ "aam",	AAM,		WORD },
-	{ "aas",	AAS,		WORD },
-	{ "adc",	ADC,		WORD },
-	{ "adcb",	ADC,		BYTE },
-	{ "add",	ADD,		WORD },
-	{ "addb",	ADD,		BYTE },
-	{ "and",	AND,		WORD },
-	{ "andb",	AND,		BYTE },
-	{ "arpl",	ARPL,		WORD },
-	{ "bound",	BOUND,		WORD },
-	{ "bsf",	BSF,		WORD },
-	{ "bsr",	BSR,		WORD },
-	{ "bswap",	BSWAP,		WORD },
-	{ "bt",		BT,		WORD },
-	{ "btc",	BTC,		WORD },
-	{ "btr",	BTR,		WORD },
-	{ "bts",	BTS,		WORD },
-	{ "call",	CALL,		JUMP },
-	{ "callf",	CALLF,		JUMP },
-	{ "cbw",	CBW,		WORD },
-	{ "cdq",	CWD,		WORD },
-	{ "clc",	CLC,		WORD },
-	{ "cld",	CLD,		WORD },
-	{ "cli",	CLI,		WORD },
-	{ "clts",	CLTS,		WORD },
-	{ "cmc",	CMC,		WORD },
-	{ "cmp",	CMP,		WORD },
-	{ "cmpb",	CMP,		BYTE },
-	{ "cmps",	CMPS,		WORD },
-	{ "cmpsb",	CMPS,		BYTE },
-	{ "cmpxchg",	CMPXCHG,	WORD },
-	{ "cwd",	CWD,		WORD },
-	{ "cwde",	CBW,		WORD },
-	{ "daa",	DAA,		WORD },
-	{ "das",	DAS,		WORD },
-	{ "dec",	DEC,		WORD },
-	{ "decb",	DEC,		BYTE },
-	{ "div",	DIV,		WORD },
-	{ "divb",	DIV,		BYTE },
-	{ "enter",	ENTER,		WORD },
-	{ "f2xm1",	F2XM1,		WORD },
-	{ "fabs",	FABS,		WORD },
-	{ "fadd",	FADD,		WORD },
-	{ "faddd",	FADDD,		WORD },
-	{ "faddp",	FADDP,		WORD },
-	{ "fadds",	FADDS,		WORD },
-	{ "fbld",	FBLD,		WORD },
-	{ "fbstp",	FBSTP,		WORD },
-	{ "fchs",	FCHS,		WORD },
-	{ "fclex",	FCLEX,		WORD },
-	{ "fcomd",	FCOMD,		WORD },
-	{ "fcompd",	FCOMPD,		WORD },
-	{ "fcompp",	FCOMPP,		WORD },
-	{ "fcomps",	FCOMPS,		WORD },
-	{ "fcoms",	FCOMS,		WORD },
-	{ "fcos",	FCOS,		WORD },
-	{ "fdecstp",	FDECSTP,	WORD },
-	{ "fdivd",	FDIVD,		WORD },
-	{ "fdivp",	FDIVP,		WORD },
-	{ "fdivrd",	FDIVRD,		WORD },
-	{ "fdivrp",	FDIVRP,		WORD },
-	{ "fdivrs",	FDIVRS,		WORD },
-	{ "fdivs",	FDIVS,		WORD },
-	{ "ffree",	FFREE,		WORD },
-	{ "fiaddl",	FIADDL,		WORD },
-	{ "fiadds",	FIADDS,		WORD },
-	{ "ficom",	FICOM,		WORD },
-	{ "ficomp",	FICOMP,		WORD },
-	{ "fidivl",	FIDIVL,		WORD },
-	{ "fidivrl",	FIDIVRL,	WORD },
-	{ "fidivrs",	FIDIVRS,	WORD },
-	{ "fidivs",	FIDIVS,		WORD },
-	{ "fildl",	FILDL,		WORD },
-	{ "fildq",	FILDQ,		WORD },
-	{ "filds",	FILDS,		WORD },
-	{ "fimull",	FIMULL,		WORD },
-	{ "fimuls",	FIMULS,		WORD },
-	{ "fincstp",	FINCSTP,	WORD },
-	{ "finit",	FINIT,		WORD },
-	{ "fistl",	FISTL,		WORD },
-	{ "fistp",	FISTP,		WORD },
-	{ "fists",	FISTS,		WORD },
-	{ "fisubl",	FISUBL,		WORD },
-	{ "fisubrl",	FISUBRL,	WORD },
-	{ "fisubrs",	FISUBRS,	WORD },
-	{ "fisubs",	FISUBS,		WORD },
-	{ "fld1",	FLD1,		WORD },
-	{ "fldcw",	FLDCW,		WORD },
-	{ "fldd",	FLDD,		WORD },
-	{ "fldenv",	FLDENV,		WORD },
-	{ "fldl2e",	FLDL2E,		WORD },
-	{ "fldl2t",	FLDL2T,		WORD },
-	{ "fldlg2",	FLDLG2,		WORD },
-	{ "fldln2",	FLDLN2,		WORD },
-	{ "fldpi",	FLDPI,		WORD },
-	{ "flds",	FLDS,		WORD },
-	{ "fldx",	FLDX,		WORD },
-	{ "fldz",	FLDZ,		WORD },
-	{ "fmuld",	FMULD,		WORD },
-	{ "fmulp",	FMULP,		WORD },
-	{ "fmuls",	FMULS,		WORD },
-	{ "fnop",	FNOP,		WORD },
-	{ "fpatan",	FPATAN,		WORD },
-	{ "fprem",	FPREM,		WORD },
-	{ "fprem1",	FPREM1,		WORD },
-	{ "fptan",	FPTAN,		WORD },
-	{ "frndint",	FRNDINT,	WORD },
-	{ "frstor",	FRSTOR,		WORD },
-	{ "fsave",	FSAVE,		WORD },
-	{ "fscale",	FSCALE,		WORD },
-	{ "fsin",	FSIN,		WORD },
-	{ "fsincos",	FSINCOS,	WORD },
-	{ "fsqrt",	FSQRT,		WORD },
-	{ "fstcw",	FSTCW,		WORD },
-	{ "fstd",	FSTD,		WORD },
-	{ "fstenv",	FSTENV,		WORD },
-	{ "fstpd",	FSTPD,		WORD },
-	{ "fstps",	FSTPS,		WORD },
-	{ "fstpx",	FSTPX,		WORD },
-	{ "fsts",	FSTS,		WORD },
-	{ "fstsw",	FSTSW,		WORD },
-	{ "fsubd",	FSUBD,		WORD },
-	{ "fsubp",	FSUBP,		WORD },
-	{ "fsubpr",	FSUBPR,		WORD },
-	{ "fsubrd",	FSUBRD,		WORD },
-	{ "fsubrs",	FSUBRS,		WORD },
-	{ "fsubs",	FSUBS,		WORD },
-	{ "ftst",	FTST,		WORD },
-	{ "fucom",	FUCOM,		WORD },
-	{ "fucomp",	FUCOMP,		WORD },
-	{ "fucompp",	FUCOMPP,	WORD },
-	{ "fxam",	FXAM,		WORD },
-	{ "fxch",	FXCH,		WORD },
-	{ "fxtract",	FXTRACT,	WORD },
-	{ "fyl2x",	FYL2X,		WORD },
-	{ "fyl2xp1",	FYL2XP1,	WORD },
-	{ "hlt",	HLT,		WORD },
-	{ "idiv",	IDIV,		WORD },
-	{ "idivb",	IDIV,		BYTE },
-	{ "imul",	IMUL,		WORD },
-	{ "imulb",	IMUL,		BYTE },
-	{ "in",		IN,		WORD },
-	{ "inb",	IN,		BYTE },
-	{ "inc",	INC,		WORD },
-	{ "incb",	INC,		BYTE },
-	{ "ins",	INS,		WORD },
-	{ "insb",	INS,		BYTE },
-	{ "int",	INT,		WORD },
-	{ "into",	INTO,		JUMP },
-	{ "invd",	INVD,		WORD },
-	{ "invlpg",	INVLPG,		WORD },
-	{ "iret",	IRET,		JUMP },
-	{ "iretd",	IRETD,		JUMP },
-	{ "ja",		JA,		JUMP },
-	{ "jae",	JAE,		JUMP },
-	{ "jb",		JB,		JUMP },
-	{ "jbe",	JBE,		JUMP },
-	{ "jc",		JB,		JUMP },
-	{ "jcxz",	JCXZ,		JUMP },
-	{ "je",		JE,		JUMP },
-	{ "jecxz",	JCXZ,		JUMP },
-	{ "jg",		JG,		JUMP },
-	{ "jge",	JGE,		JUMP },
-	{ "jl",		JL,		JUMP },
-	{ "jle",	JLE,		JUMP },
-	{ "jmp",	JMP,		JUMP },
-	{ "jmpf",	JMPF,		JUMP },
-	{ "jna",	JBE,		JUMP },
-	{ "jnae",	JB,		JUMP },
-	{ "jnb",	JAE,		JUMP },
-	{ "jnbe",	JA,		JUMP },
-	{ "jnc",	JAE,		JUMP },
-	{ "jne",	JNE,		JUMP },
-	{ "jng",	JLE,		JUMP },
-	{ "jnge",	JL,		JUMP },
-	{ "jnl",	JGE,		JUMP },
-	{ "jnle",	JG,		JUMP },
-	{ "jno",	JNO,		JUMP },
-	{ "jnp",	JNP,		JUMP },
-	{ "jns",	JNS,		JUMP },
-	{ "jnz",	JNE,		JUMP },
-	{ "jo",		JO,		JUMP },
-	{ "jp",		JP,		JUMP },
-	{ "js",		JS,		JUMP },
-	{ "jz",		JE,		JUMP },
-	{ "lahf",	LAHF,		WORD },
-	{ "lar",	LAR,		WORD },
-	{ "lds",	LDS,		WORD },
-	{ "lea",	LEA,		WORD },
-	{ "leave",	LEAVE,		WORD },
-	{ "les",	LES,		WORD },
-	{ "lfs",	LFS,		WORD },
-	{ "lgdt",	LGDT,		WORD },
-	{ "lgs",	LGS,		WORD },
-	{ "lidt",	LIDT,		WORD },
-	{ "lldt",	LLDT,		WORD },
-	{ "lmsw",	LMSW,		WORD },
-	{ "lock",	LOCK,		WORD },
-	{ "lods",	LODS,		WORD },
-	{ "lodsb",	LODS,		BYTE },
-	{ "loop",	LOOP,		JUMP },
-	{ "loope",	LOOPE,		JUMP },
-	{ "loopne",	LOOPNE,		JUMP },
-	{ "loopnz",	LOOPNE,		JUMP },
-	{ "loopz",	LOOPE,		JUMP },
-	{ "lsl",	LSL,		WORD },
-	{ "lss",	LSS,		WORD },
-	{ "ltr",	LTR,		WORD },
-	{ "mov",	MOV,		WORD },
-	{ "movb",	MOV,		BYTE },
-	{ "movs",	MOVS,		WORD },
-	{ "movsb",	MOVS,		BYTE },
-	{ "movsx",	MOVSX,		WORD },
-	{ "movsxb",	MOVSXB,		WORD },
-	{ "movzx",	MOVZX,		WORD },
-	{ "movzxb",	MOVZXB,		WORD },
-	{ "mul",	MUL,		WORD },
-	{ "mulb",	MUL,		BYTE },
-	{ "neg",	NEG,		WORD },
-	{ "negb",	NEG,		BYTE },
-	{ "nop",	NOP,		WORD },
-	{ "not",	NOT,		WORD },
-	{ "notb",	NOT,		BYTE },
-	{ "or",		OR,		WORD },
-	{ "orb",	OR,		BYTE },
-	{ "out",	OUT,		WORD },
-	{ "outb",	OUT,		BYTE },
-	{ "outs",	OUTS,		WORD },
-	{ "outsb",	OUTS,		BYTE },
-	{ "pop",	POP,		WORD },
-	{ "popa",	POPA,		WORD },
-	{ "popad",	POPA,		WORD },
-	{ "popf",	POPF,		WORD },
-	{ "push",	PUSH,		WORD },
-	{ "pusha",	PUSHA,		WORD },
-	{ "pushad",	PUSHA,		WORD },
-	{ "pushf",	PUSHF,		WORD },
-	{ "rcl",	RCL,		WORD },
-	{ "rclb",	RCL,		BYTE },
-	{ "rcr",	RCR,		WORD },
-	{ "rcrb",	RCR,		BYTE },
-	{ "ret",	RET,		JUMP },
-	{ "retf",	RETF,		JUMP },
-	{ "rol",	ROL,		WORD },
-	{ "rolb",	ROL,		BYTE },
-	{ "ror",	ROR,		WORD },
-	{ "rorb",	ROR,		BYTE },
-	{ "sahf",	SAHF,		WORD },
-	{ "sal",	SAL,		WORD },
-	{ "salb",	SAL,		BYTE },
-	{ "sar",	SAR,		WORD },
-	{ "sarb",	SAR,		BYTE },
-	{ "sbb",	SBB,		WORD },
-	{ "sbbb",	SBB,		BYTE },
-	{ "scas",	SCAS,		WORD },
-	{ "scasb",	SCAS,		BYTE },
-	{ "seta",	SETA,		BYTE },
-	{ "setae",	SETAE,		BYTE },
-	{ "setb",	SETB,		BYTE },
-	{ "setbe",	SETBE,		BYTE },
-	{ "sete",	SETE,		BYTE },
-	{ "setg",	SETG,		BYTE },
-	{ "setge",	SETGE,		BYTE },
-	{ "setl",	SETL,		BYTE },
-	{ "setna",	SETBE,		BYTE },
-	{ "setnae",	SETB,		BYTE },
-	{ "setnb",	SETAE,		BYTE },
-	{ "setnbe",	SETA,		BYTE },
-	{ "setne",	SETNE,		BYTE },
-	{ "setng",	SETLE,		BYTE },
-	{ "setnge",	SETL,		BYTE },
-	{ "setnl",	SETGE,		BYTE },
-	{ "setnle",	SETG,		BYTE },
-	{ "setno",	SETNO,		BYTE },
-	{ "setnp",	SETNP,		BYTE },
-	{ "setns",	SETNS,		BYTE },
-	{ "seto",	SETO,		BYTE },
-	{ "setp",	SETP,		BYTE },
-	{ "sets",	SETS,		BYTE },
-	{ "setz",	SETE,		BYTE },
-	{ "sgdt",	SGDT,		WORD },
-	{ "shl",	SHL,		WORD },
-	{ "shlb",	SHL,		BYTE },
-	{ "shld",	SHLD,		WORD },
-	{ "shr",	SHR,		WORD },
-	{ "shrb",	SHR,		BYTE },
-	{ "shrd",	SHRD,		WORD },
-	{ "sidt",	SIDT,		WORD },
-	{ "sldt",	SLDT,		WORD },
-	{ "smsw",	SMSW,		WORD },
-	{ "stc",	STC,		WORD },
-	{ "std",	STD,		WORD },
-	{ "sti",	STI,		WORD },
-	{ "stos",	STOS,		WORD },
-	{ "stosb",	STOS,		BYTE },
-	{ "str",	STR,		WORD },
-	{ "sub",	SUB,		WORD },
-	{ "subb",	SUB,		BYTE },
-	{ "test",	TEST,		WORD },
-	{ "testb",	TEST,		BYTE },
-	{ "verr",	VERR,		WORD },
-	{ "verw",	VERW,		WORD },
-	{ "wait",	WAIT,		WORD },
-	{ "wbinvd",	WBINVD,		WORD },
-	{ "xadd",	XADD,		WORD },
-	{ "xchg",	XCHG,		WORD },
-	{ "xchgb",	XCHG,		BYTE },
-	{ "xlat",	XLAT,		WORD },
-	{ "xor",	XOR,		WORD },
-	{ "xorb",	XOR,		BYTE },
-};
-
-static enum dialect { ACK, NCC } dialect= ACK;
-
-void ack_parse_init(char *file)
-/* Prepare parsing of an ACK assembly file. */
-{
-	tok_init(file, '!');
-}
-
-void ncc_parse_init(char *file)
-/* Prepare parsing of an ACK Xenix assembly file.  See emit_ack.c for comments
- * on this fine assembly dialect.
- */
-{
-	dialect= NCC;
-	ack_parse_init(file);
-}
-
-static void zap(void)
-/* An error, zap the rest of the line. */
-{
-	token_t *t;
-
-	while ((t= get_token(0))->type != T_EOF && t->symbol != ';')
-		skip_token(1);
-}
-
-static mnemonic_t *search_mnem(char *name)
-/* Binary search for a mnemonic.  (That's why the table is sorted.) */
-{
-	int low, mid, high;
-	int cmp;
-	mnemonic_t *m;
-
-	low= 0;
-	high= arraysize(mnemtab)-1;
-	while (low <= high) {
-		mid= (low + high) / 2;
-		m= &mnemtab[mid];
-
-		if ((cmp= strcmp(name, m->name)) == 0) return m;
-
-		if (cmp < 0) high= mid-1; else low= mid+1;
-	}
-	return nil;
-}
-
-static expression_t *ack_get_C_expression(int *pn)
-/* Read a "C-like" expression.  Note that we don't worry about precedence,
- * the expression is printed later like it is read.  If the target language
- * does not have all the operators (like ~) then this has to be repaired by
- * changing the source file.  (No problem, you still have one source file
- * to maintain, not two.)
- */
-{
-	expression_t *e, *a1, *a2;
-	token_t *t;
-
-	if ((t= get_token(*pn))->symbol == '[') {
-		/* [ expr ]: grouping. */
-		(*pn)++;
-		if ((a1= ack_get_C_expression(pn)) == nil) return nil;
-		if (get_token(*pn)->symbol != ']') {
-			parse_err(1, t, "missing ]\n");
-			del_expr(a1);
-			return nil;
-		}
-		(*pn)++;
-		e= new_expr();
-		e->operator= '[';
-		e->middle= a1;
-	} else
-	if (t->type == T_WORD || t->type == T_STRING) {
-		/* Label, number, or string. */
-		e= new_expr();
-		e->operator= t->type == T_WORD ? 'W' : 'S';
-		e->name= allocate(nil, (t->len+1) * sizeof(e->name[0]));
-		memcpy(e->name, t->name, t->len+1);
-		e->len= t->len;
-		(*pn)++;
-	} else
-	if (t->symbol == '+' || t->symbol == '-' || t->symbol == '~') {
-		/* Unary operator. */
-		(*pn)++;
-		if ((a1= ack_get_C_expression(pn)) == nil) return nil;
-		e= new_expr();
-		e->operator= t->symbol;
-		e->middle= a1;
-	} else {
-		parse_err(1, t, "expression syntax error\n");
-		return nil;
-	}
-
-	switch ((t= get_token(*pn))->symbol) {
-	case '+':
-	case '-':
-	case '*':
-	case '/':
-	case '%':
-	case '&':
-	case '|':
-	case '^':
-	case S_LEFTSHIFT:
-	case S_RIGHTSHIFT:
-		(*pn)++;
-		a1= e;
-		if ((a2= ack_get_C_expression(pn)) == nil) {
-			del_expr(a1);
-			return nil;
-		}
-		e= new_expr();
-		e->operator= t->symbol;
-		e->left= a1;
-		e->right= a2;
-	}
-	return e;
-}
-
-static expression_t *ack_get_operand(int *pn, int deref)
-/* Get something like: (memory), offset(base)(index*scale), or simpler. */
-{
-	expression_t *e, *offset, *base, *index;
-	token_t *t;
-	int c;
-
-	/* Is it (memory)? */
-	if (get_token(*pn)->symbol == '('
-		&& ((t= get_token(*pn + 1))->type != T_WORD
-			|| !isregister(t->name))
-	) {
-		/* A memory dereference. */
-		(*pn)++;
-		if ((offset= ack_get_C_expression(pn)) == nil) return nil;
-		if (get_token(*pn)->symbol != ')') {
-			parse_err(1, t, "operand syntax error\n");
-			del_expr(offset);
-			return nil;
-		}
-		(*pn)++;
-		e= new_expr();
-		e->operator= '(';
-		e->middle= offset;
-		return e;
-	}
-
-	/* #constant? */
-	if (dialect == NCC && deref
-			&& ((c= get_token(*pn)->symbol) == '#' || c == '*')) {
-		/* NCC: mov ax,#constant  ->  ACK: mov ax,constant */
-		(*pn)++;
-		return ack_get_C_expression(pn);
-	}
-
-	/* @address? */
-	if (dialect == NCC && get_token(*pn)->symbol == '@') {
-		/* NCC: jmp @address  ->  ACK: jmp (address) */
-		(*pn)++;
-		if ((offset= ack_get_operand(pn, deref)) == nil) return nil;
-		e= new_expr();
-		e->operator= '(';
-		e->middle= offset;
-		return e;
-	}
-
-	/* Offset? */
-	if (get_token(*pn)->symbol != '(') {
-		/* There is an offset. */
-		if ((offset= ack_get_C_expression(pn)) == nil) return nil;
-	} else {
-		/* No offset. */
-		offset= nil;
-	}
-
-	/* (base)? */
-	if (get_token(*pn)->symbol == '('
-		&& (t= get_token(*pn + 1))->type == T_WORD
-		&& isregister(t->name)
-		&& get_token(*pn + 2)->symbol == ')'
-	) {
-		/* A base register expression. */
-		base= new_expr();
-		base->operator= 'B';
-		base->name= copystr(t->name);
-		(*pn)+= 3;
-	} else {
-		/* No base register expression. */
-		base= nil;
-	}
-
-	/* (index*scale)? */
-	if (get_token(*pn)->symbol == '(') {
-		/* An index most likely. */
-		token_t *m= nil;
-
-		if (!(		/* This must be true: */
-			(t= get_token(*pn + 1))->type == T_WORD
-			&& isregister(t->name)
-			&& (get_token(*pn + 2)->symbol == ')' || (
-				get_token(*pn + 2)->symbol == '*'
-				&& (m= get_token(*pn + 3))->type == T_WORD
-				&& strchr("1248", m->name[0]) != nil
-				&& m->name[1] == 0
-				&& get_token(*pn + 4)->symbol == ')'
-			))
-		)) {
-			/* Alas it isn't */
-			parse_err(1, t, "operand syntax error\n");
-			del_expr(offset);
-			del_expr(base);
-			return nil;
-		}
-		/* Found an index. */
-		index= new_expr();
-		index->operator= m == nil ? '1' : m->name[0];
-		index->name= copystr(t->name);
-		(*pn)+= (m == nil ? 3 : 5);
-	} else {
-		/* No index. */
-		index= nil;
-	}
-
-	if (dialect == NCC && deref && base == nil && index == nil
-		&& !(offset != nil && offset->operator == 'W'
-					&& isregister(offset->name))
-	) {
-		/* NCC: mov ax,thing  ->  ACK mov ax,(thing) */
-		e= new_expr();
-		e->operator= '(';
-		e->middle= offset;
-		return e;
-	}
-
-	if (base == nil && index == nil) {
-		/* Return a lone offset as is. */
-		e= offset;
-	} else {
-		e= new_expr();
-		e->operator= 'O';
-		e->left= offset;
-		e->middle= base;
-		e->right= index;
-	}
-	return e;
-}
-
-static expression_t *ack_get_oplist(int *pn, int deref)
-/* Get a comma (or colon for jmpf and callf) separated list of instruction
- * operands.
- */
-{
-	expression_t *e, *o1, *o2;
-	token_t *t;
-
-	if ((e= ack_get_operand(pn, deref)) == nil) return nil;
-
-	if ((t= get_token(*pn))->symbol == ',' || t->symbol == ':') {
-		o1= e;
-		(*pn)++;
-		if ((o2= ack_get_oplist(pn, deref)) == nil) {
-			del_expr(o1);
-			return nil;
-		}
-		e= new_expr();
-		e->operator= ',';
-		e->left= o1;
-		e->right= o2;
-	}
-	return e;
-}
-
-static asm86_t *ack_get_statement(void)
-/* Get a pseudo op or machine instruction with arguments. */
-{
-	token_t *t= get_token(0);
-	asm86_t *a;
-	mnemonic_t *m;
-	int n;
-	int prefix_seen;
-	int oaz_prefix;
-	int deref;
-
-	assert(t->type == T_WORD);
-
-	if (strcmp(t->name, ".sect") == 0) {
-		/* .sect .text etc.  Accept only four segment names. */
-		skip_token(1);
-		t= get_token(0);
-		if (t->type != T_WORD || (
-			strcmp(t->name, ".text") != 0
-			&& strcmp(t->name, ".rom") != 0
-			&& strcmp(t->name, ".data") != 0
-			&& strcmp(t->name, ".bss") != 0
-			&& strcmp(t->name, ".end") != 0
-		)) {
-			parse_err(1, t, "weird section name to .sect\n");
-			return nil;
-		}
-	}
-	a= new_asm86();
-
-	/* Process instruction prefixes. */
-	oaz_prefix= 0;
-	for (prefix_seen= 0;; prefix_seen= 1) {
-		if (strcmp(t->name, "o16") == 0) {
-			if (use16()) {
-				parse_err(1, t, "o16 in an 8086 section\n");
-			}
-			oaz_prefix|= OPZ;
-		} else
-		if (strcmp(t->name, "o32") == 0) {
-			if (use32()) {
-				parse_err(1, t, "o32 in an 80386 section\n");
-			}
-			oaz_prefix|= OPZ;
-		} else
-		if (strcmp(t->name, "a16") == 0) {
-			if (use16()) {
-				parse_err(1, t, "a16 in an 8086 section\n");
-			}
-			oaz_prefix|= ADZ;
-		} else
-		if (strcmp(t->name, "a32") == 0) {
-			if (use32()) {
-				parse_err(1, t, "a32 in an 80386 section\n");
-			}
-			oaz_prefix|= ADZ;
-		} else
-		if (strcmp(t->name, "rep") == 0
-			|| strcmp(t->name, "repe") == 0
-			|| strcmp(t->name, "repne") == 0
-			|| strcmp(t->name, "repz") == 0
-			|| strcmp(t->name, "repnz") == 0
-		) {
-			if (a->rep != ONCE) {
-				parse_err(1, t,
-					"can't have more than one rep\n");
-			}
-			switch (t->name[3]) {
-			case 0:		a->rep= REP;	break;
-			case 'e':
-			case 'z':	a->rep= REPE;	break;
-			case 'n':	a->rep= REPNE;	break;
-			}
-		} else
-		if (strchr("cdefgs", t->name[0]) != nil
-					&& strcmp(t->name+1, "seg") == 0) {
-			if (a->seg != DEFSEG) {
-				parse_err(1, t,
-				"can't have more than one segment prefix\n");
-			}
-			switch (t->name[0]) {
-			case 'c':	a->seg= CSEG;	break;
-			case 'd':	a->seg= DSEG;	break;
-			case 'e':	a->seg= ESEG;	break;
-			case 'f':	a->seg= FSEG;	break;
-			case 'g':	a->seg= GSEG;	break;
-			case 's':	a->seg= SSEG;	break;
-			}
-		} else
-		if (!prefix_seen) {
-			/* No prefix here, get out! */
-			break;
-		} else {
-			/* No more prefixes, next must be an instruction. */
-			if (t->type != T_WORD
-				|| (m= search_mnem(t->name)) == nil
-				|| m->optype == PSEUDO
-			) {
-				parse_err(1, t,
-		"machine instruction expected after instruction prefix\n");
-				del_asm86(a);
-				return nil;
-			}
-			if (oaz_prefix != 0 && m->optype != JUMP
-						&& m->optype != WORD) {
-				parse_err(1, t,
-			"'%s' can't have an operand size prefix\n", m->name);
-			}
-			break;
-		}
-
-		/* Skip the prefix and extra newlines. */
-		do {
-			skip_token(1);
-		} while ((t= get_token(0))->symbol == ';');
-	}
-
-	/* All the readahead being done upsets the line counter. */
-	a->line= t->line;
-
-	/* Read a machine instruction or pseudo op. */
-	if ((m= search_mnem(t->name)) == nil) {
-		parse_err(1, t, "unknown instruction '%s'\n", t->name);
-		del_asm86(a);
-		return nil;
-	}
-	a->opcode= m->opcode;
-	a->optype= m->optype;
-	a->oaz= oaz_prefix;
-
-	switch (a->opcode) {
-	case IN:
-	case OUT:
-	case INT:
-		deref= 0;
-		break;
-	default:
-		deref= (a->optype >= BYTE);
-	}
-	n= 1;
-	if (get_token(1)->symbol != ';'
-			&& (a->args= ack_get_oplist(&n, deref)) == nil) {
-		del_asm86(a);
-		return nil;
-	}
-	if (get_token(n)->symbol != ';') {
-		parse_err(1, t, "garbage at end of instruction\n");
-		del_asm86(a);
-		return nil;
-	}
-	switch (a->opcode) {
-	case DOT_ALIGN:
-		/* Restrict .align to have a single numeric argument, some
-		 * assemblers think of the argument as a power of two, so
-		 * we need to be able to change the value.
-		 */
-		if (a->args == nil || a->args->operator != 'W'
-					|| !isanumber(a->args->name)) {
-			parse_err(1, t,
-			  ".align is restricted to one numeric argument\n");
-			del_asm86(a);
-			return nil;
-		}
-		break;
-	case JMPF:
-	case CALLF:
-		/* NCC jmpf off,seg  ->  ACK jmpf seg:off */
-		if (dialect == NCC && a->args != nil
-						&& a->args->operator == ',') {
-			expression_t *t;
-
-			t= a->args->left;
-			a->args->left= a->args->right;
-			a->args->right= t;
-			break;
-		}
-		/*FALL THROUGH*/
-	case JMP:
-	case CALL:
-		/* NCC jmp @(reg)  ->  ACK jmp (reg) */
-		if (dialect == NCC && a->args != nil && (
-			(a->args->operator == '('
-				&& a->args->middle != nil
-				&& a->args->middle->operator == 'O')
-			|| (a->args->operator == 'O'
-				&& a->args->left == nil
-				&& a->args->middle != nil
-				&& a->args->right == nil)
-		)) {
-			expression_t *t;
-
-			t= a->args;
-			a->args= a->args->middle;
-			t->middle= nil;
-			del_expr(t);
-			if (a->args->operator == 'B') a->args->operator= 'W';
-		}
-		break;
-	default:;
-	}
-	skip_token(n+1);
-	return a;
-}
-
-asm86_t *ack_get_instruction(void)
-{
-	asm86_t *a= nil;
-	expression_t *e;
-	token_t *t;
-
-	while ((t= get_token(0))->symbol == ';')
-		skip_token(1);
-
-	if (t->type == T_EOF) return nil;
-
-	if (t->symbol == '#') {
-		/* Preprocessor line and file change. */
-
-		if ((t= get_token(1))->type != T_WORD || !isanumber(t->name)
-			|| get_token(2)->type != T_STRING
-		) {
-			parse_err(1, t, "file not preprocessed?\n");
-			zap();
-		} else {
-			set_file(get_token(2)->name,
-				strtol(get_token(1)->name, nil, 0) - 1);
-
-			/* GNU CPP adds extra cruft, simply zap the line. */
-			zap();
-		}
-		a= ack_get_instruction();
-	} else
-	if (t->type == T_WORD && get_token(1)->symbol == ':') {
-		/* A label definition. */
-		a= new_asm86();
-		a->line= t->line;
-		a->opcode= DOT_LABEL;
-		a->optype= PSEUDO;
-		a->args= e= new_expr();
-		e->operator= ':';
-		e->name= copystr(t->name);
-		skip_token(2);
-	} else
-	if (t->type == T_WORD && get_token(1)->symbol == '=') {
-		int n= 2;
-
-		if ((e= ack_get_C_expression(&n)) == nil) {
-			zap();
-			a= ack_get_instruction();
-		} else
-		if (get_token(n)->symbol != ';') {
-			parse_err(1, t, "garbage after assignment\n");
-			zap();
-			a= ack_get_instruction();
-		} else {
-			a= new_asm86();
-			a->line= t->line;
-			a->opcode= DOT_EQU;
-			a->optype= PSEUDO;
-			a->args= new_expr();
-			a->args->operator= '=';
-			a->args->name= copystr(t->name);
-			a->args->middle= e;
-			skip_token(n+1);
-		}
-	} else
-	if (t->type == T_WORD) {
-		if ((a= ack_get_statement()) == nil) {
-			zap();
-			a= ack_get_instruction();
-		}
-	} else {
-		parse_err(1, t, "syntax error\n");
-		zap();
-		a= ack_get_instruction();
-	}
-	return a;
-}
-
-asm86_t *ncc_get_instruction(void)
-{
-	return ack_get_instruction();
-}
Index: trunk/minix/commands/i386/asmconv/parse_bas.c
===================================================================
--- trunk/minix/commands/i386/asmconv/parse_bas.c	(revision 9)
+++ 	(revision )
@@ -1,940 +1,0 @@
-/*	parse_bas.c - parse BCC AS assembly		Author: Kees J. Bot
- *								13 Nov 1994
- */
-#define nil 0
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include "asmconv.h"
-#include "token.h"
-#include "asm86.h"
-#include "languages.h"
-
-typedef struct mnemonic {	/* BAS mnemonics translation table. */
-	char		*name;
-	opcode_t	opcode;
-	optype_t	optype;
-} mnemonic_t;
-
-static mnemonic_t mnemtab[] = {			/* This array is sorted. */
-	{ ".align",	DOT_ALIGN,	PSEUDO },
-	{ ".ascii",	DOT_ASCII,	PSEUDO },
-	{ ".asciz",	DOT_ASCIZ,	PSEUDO },
-	{ ".assert",	DOT_ASSERT,	PSEUDO },
-	{ ".base",	DOT_BASE,	PSEUDO },
-	{ ".blkb",	DOT_SPACE,	PSEUDO },
-	{ ".bss",	DOT_BSS,	PSEUDO },
-	{ ".byte",	DOT_DATA1,	PSEUDO },
-	{ ".comm",	DOT_COMM,	PSEUDO },
-	{ ".data",	DOT_DATA,	PSEUDO },
-	{ ".define",	DOT_DEFINE,	PSEUDO },
-	{ ".end",	DOT_END,	PSEUDO },
-	{ ".even",	DOT_ALIGN,	PSEUDO },
-	{ ".extern",	DOT_EXTERN,	PSEUDO },
-	{ ".file",	DOT_FILE,	PSEUDO },
-	{ ".globl",	DOT_DEFINE,	PSEUDO },
-	{ ".lcomm",	DOT_LCOMM,	PSEUDO },
-	{ ".line",	DOT_LINE,	PSEUDO },
-	{ ".list",	DOT_LIST,	PSEUDO },
-	{ ".long",	DOT_DATA4,	PSEUDO },
-	{ ".nolist",	DOT_NOLIST,	PSEUDO },
-	{ ".rom",	DOT_ROM,	PSEUDO },
-	{ ".space",	DOT_SPACE,	PSEUDO },
-	{ ".symb",	DOT_SYMB,	PSEUDO },
-	{ ".text",	DOT_TEXT,	PSEUDO },
-	{ ".use16",	DOT_USE16,	PSEUDO },
-	{ ".use32",	DOT_USE32,	PSEUDO },
-	{ ".word",	DOT_DATA2,	PSEUDO },
-	{ ".zerob",	DOT_SPACE,	PSEUDO },
-	{ ".zerow",	DOT_SPACE,	PSEUDO },
-	{ "aaa",	AAA,		WORD },
-	{ "aad",	AAD,		WORD },
-	{ "aam",	AAM,		WORD },
-	{ "aas",	AAS,		WORD },
-	{ "adc",	ADC,		WORD },
-	{ "add",	ADD,		WORD },
-	{ "and",	AND,		WORD },
-	{ "arpl",	ARPL,		WORD },
-	{ "bc",		JB,		JUMP },
-	{ "beq",	JE,		JUMP },
-	{ "bge",	JGE,		JUMP },
-	{ "bgt",	JG,		JUMP },
-	{ "bhi",	JA,		JUMP },
-	{ "bhis",	JAE,		JUMP },
-	{ "ble",	JLE,		JUMP },
-	{ "blo",	JB,		JUMP },
-	{ "blos",	JBE,		JUMP },
-	{ "blt",	JL,		JUMP },
-	{ "bnc",	JAE,		JUMP },
-	{ "bne",	JNE,		JUMP },
-	{ "bound",	BOUND,		WORD },
-	{ "br",		JMP,		JUMP },
-	{ "bsf",	BSF,		WORD },
-	{ "bsr",	BSR,		WORD },
-	{ "bswap",	BSWAP,		WORD },
-	{ "bt",		BT,		WORD },
-	{ "btc",	BTC,		WORD },
-	{ "btr",	BTR,		WORD },
-	{ "bts",	BTS,		WORD },
-	{ "bz",		JE,		JUMP },
-	{ "call",	CALL,		JUMP },
-	{ "callf",	CALLF,		JUMP },
-	{ "cbw",	CBW,		WORD },
-	{ "cdq",	CWD,		WORD },
-	{ "clc",	CLC,		WORD },
-	{ "cld",	CLD,		WORD },
-	{ "cli",	CLI,		WORD },
-	{ "clts",	CLTS,		WORD },
-	{ "cmc",	CMC,		WORD },
-	{ "cmp",	CMP,		WORD },
-	{ "cmps",	CMPS,		WORD },
-	{ "cmpsb",	CMPS,		BYTE },
-	{ "cmpxchg",	CMPXCHG,	WORD },
-	{ "cwd",	CWD,		WORD },
-	{ "cwde",	CBW,		WORD },
-	{ "daa",	DAA,		WORD },
-	{ "das",	DAS,		WORD },
-	{ "dd",		DOT_DATA4,	PSEUDO },
-	{ "dec",	DEC,		WORD },
-	{ "div",	DIV,		WORD },
-	{ "enter",	ENTER,		WORD },
-	{ "export",	DOT_DEFINE,	PSEUDO },
-	{ "f2xm1",	F2XM1,		WORD },
-	{ "fabs",	FABS,		WORD },
-	{ "fadd",	FADD,		WORD },
-	{ "faddd",	FADDD,		WORD },
-	{ "faddp",	FADDP,		WORD },
-	{ "fadds",	FADDS,		WORD },
-	{ "fbld",	FBLD,		WORD },
-	{ "fbstp",	FBSTP,		WORD },
-	{ "fchs",	FCHS,		WORD },
-	{ "fclex",	FCLEX,		WORD },
-	{ "fcomd",	FCOMD,		WORD },
-	{ "fcompd",	FCOMPD,		WORD },
-	{ "fcompp",	FCOMPP,		WORD },
-	{ "fcomps",	FCOMPS,		WORD },
-	{ "fcoms",	FCOMS,		WORD },
-	{ "fcos",	FCOS,		WORD },
-	{ "fdecstp",	FDECSTP,	WORD },
-	{ "fdivd",	FDIVD,		WORD },
-	{ "fdivp",	FDIVP,		WORD },
-	{ "fdivrd",	FDIVRD,		WORD },
-	{ "fdivrp",	FDIVRP,		WORD },
-	{ "fdivrs",	FDIVRS,		WORD },
-	{ "fdivs",	FDIVS,		WORD },
-	{ "ffree",	FFREE,		WORD },
-	{ "fiaddl",	FIADDL,		WORD },
-	{ "fiadds",	FIADDS,		WORD },
-	{ "ficom",	FICOM,		WORD },
-	{ "ficomp",	FICOMP,		WORD },
-	{ "fidivl",	FIDIVL,		WORD },
-	{ "fidivrl",	FIDIVRL,	WORD },
-	{ "fidivrs",	FIDIVRS,	WORD },
-	{ "fidivs",	FIDIVS,		WORD },
-	{ "fildl",	FILDL,		WORD },
-	{ "fildq",	FILDQ,		WORD },
-	{ "filds",	FILDS,		WORD },
-	{ "fimull",	FIMULL,		WORD },
-	{ "fimuls",	FIMULS,		WORD },
-	{ "fincstp",	FINCSTP,	WORD },
-	{ "finit",	FINIT,		WORD },
-	{ "fistl",	FISTL,		WORD },
-	{ "fistp",	FISTP,		WORD },
-	{ "fists",	FISTS,		WORD },
-	{ "fisubl",	FISUBL,		WORD },
-	{ "fisubrl",	FISUBRL,	WORD },
-	{ "fisubrs",	FISUBRS,	WORD },
-	{ "fisubs",	FISUBS,		WORD },
-	{ "fld1",	FLD1,		WORD },
-	{ "fldcw",	FLDCW,		WORD },
-	{ "fldd",	FLDD,		WORD },
-	{ "fldenv",	FLDENV,		WORD },
-	{ "fldl2e",	FLDL2E,		WORD },
-	{ "fldl2t",	FLDL2T,		WORD },
-	{ "fldlg2",	FLDLG2,		WORD },
-	{ "fldln2",	FLDLN2,		WORD },
-	{ "fldpi",	FLDPI,		WORD },
-	{ "flds",	FLDS,		WORD },
-	{ "fldx",	FLDX,		WORD },
-	{ "fldz",	FLDZ,		WORD },
-	{ "fmuld",	FMULD,		WORD },
-	{ "fmulp",	FMULP,		WORD },
-	{ "fmuls",	FMULS,		WORD },
-	{ "fnop",	FNOP,		WORD },
-	{ "fpatan",	FPATAN,		WORD },
-	{ "fprem",	FPREM,		WORD },
-	{ "fprem1",	FPREM1,		WORD },
-	{ "fptan",	FPTAN,		WORD },
-	{ "frndint",	FRNDINT,	WORD },
-	{ "frstor",	FRSTOR,		WORD },
-	{ "fsave",	FSAVE,		WORD },
-	{ "fscale",	FSCALE,		WORD },
-	{ "fsin",	FSIN,		WORD },
-	{ "fsincos",	FSINCOS,	WORD },
-	{ "fsqrt",	FSQRT,		WORD },
-	{ "fstcw",	FSTCW,		WORD },
-	{ "fstd",	FSTD,		WORD },
-	{ "fstenv",	FSTENV,		WORD },
-	{ "fstpd",	FSTPD,		WORD },
-	{ "fstps",	FSTPS,		WORD },
-	{ "fstpx",	FSTPX,		WORD },
-	{ "fsts",	FSTS,		WORD },
-	{ "fstsw",	FSTSW,		WORD },
-	{ "fsubd",	FSUBD,		WORD },
-	{ "fsubp",	FSUBP,		WORD },
-	{ "fsubpr",	FSUBPR,		WORD },
-	{ "fsubrd",	FSUBRD,		WORD },
-	{ "fsubrs",	FSUBRS,		WORD },
-	{ "fsubs",	FSUBS,		WORD },
-	{ "ftst",	FTST,		WORD },
-	{ "fucom",	FUCOM,		WORD },
-	{ "fucomp",	FUCOMP,		WORD },
-	{ "fucompp",	FUCOMPP,	WORD },
-	{ "fxam",	FXAM,		WORD },
-	{ "fxch",	FXCH,		WORD },
-	{ "fxtract",	FXTRACT,	WORD },
-	{ "fyl2x",	FYL2X,		WORD },
-	{ "fyl2xp1",	FYL2XP1,	WORD },
-	{ "hlt",	HLT,		WORD },
-	{ "idiv",	IDIV,		WORD },
-	{ "imul",	IMUL,		WORD },
-	{ "in",		IN,		WORD },
-	{ "inb",	IN,		BYTE },
-	{ "inc",	INC,		WORD },
-	{ "ins",	INS,		WORD },
-	{ "insb",	INS,		BYTE },
-	{ "int",	INT,		WORD },
-	{ "into",	INTO,		JUMP },
-	{ "invd",	INVD,		WORD },
-	{ "invlpg",	INVLPG,		WORD },
-	{ "iret",	IRET,		JUMP },
-	{ "iretd",	IRETD,		JUMP },
-	{ "j",		JMP,		JUMP },
-	{ "ja",		JA,		JUMP },
-	{ "jae",	JAE,		JUMP },
-	{ "jb",		JB,		JUMP },
-	{ "jbe",	JBE,		JUMP },
-	{ "jc",		JB,		JUMP },
-	{ "jcxz",	JCXZ,		JUMP },
-	{ "je",		JE,		JUMP },
-	{ "jecxz",	JCXZ,		JUMP },
-	{ "jeq",	JE,		JUMP },
-	{ "jg",		JG,		JUMP },
-	{ "jge",	JGE,		JUMP },
-	{ "jgt",	JG,		JUMP },
-	{ "jhi",	JA,		JUMP },
-	{ "jhis",	JAE,		JUMP },
-	{ "jl",		JL,		JUMP },
-	{ "jle",	JLE,		JUMP },
-	{ "jlo",	JB,		JUMP },
-	{ "jlos",	JBE,		JUMP },
-	{ "jlt",	JL,		JUMP },
-	{ "jmp",	JMP,		JUMP },
-	{ "jmpf",	JMPF,		JUMP },
-	{ "jna",	JBE,		JUMP },
-	{ "jnae",	JB,		JUMP },
-	{ "jnb",	JAE,		JUMP },
-	{ "jnbe",	JA,		JUMP },
-	{ "jnc",	JAE,		JUMP },
-	{ "jne",	JNE,		JUMP },
-	{ "jng",	JLE,		JUMP },
-	{ "jnge",	JL,		JUMP },
-	{ "jnl",	JGE,		JUMP },
-	{ "jnle",	JG,		JUMP },
-	{ "jno",	JNO,		JUMP },
-	{ "jnp",	JNP,		JUMP },
-	{ "jns",	JNS,		JUMP },
-	{ "jnz",	JNE,		JUMP },
-	{ "jo",		JO,		JUMP },
-	{ "jp",		JP,		JUMP },
-	{ "js",		JS,		JUMP },
-	{ "jz",		JE,		JUMP },
-	{ "lahf",	LAHF,		WORD },
-	{ "lar",	LAR,		WORD },
-	{ "lds",	LDS,		WORD },
-	{ "lea",	LEA,		WORD },
-	{ "leave",	LEAVE,		WORD },
-	{ "les",	LES,		WORD },
-	{ "lfs",	LFS,		WORD },
-	{ "lgdt",	LGDT,		WORD },
-	{ "lgs",	LGS,		WORD },
-	{ "lidt",	LIDT,		WORD },
-	{ "lldt",	LLDT,		WORD },
-	{ "lmsw",	LMSW,		WORD },
-	{ "lock",	LOCK,		WORD },
-	{ "lods",	LODS,		WORD },
-	{ "lodsb",	LODS,		BYTE },
-	{ "loop",	LOOP,		JUMP },
-	{ "loope",	LOOPE,		JUMP },
-	{ "loopne",	LOOPNE,		JUMP },
-	{ "loopnz",	LOOPNE,		JUMP },
-	{ "loopz",	LOOPE,		JUMP },
-	{ "lsl",	LSL,		WORD },
-	{ "lss",	LSS,		WORD },
-	{ "ltr",	LTR,		WORD },
-	{ "mov",	MOV,		WORD },
-	{ "movs",	MOVS,		WORD },
-	{ "movsb",	MOVS,		BYTE },
-	{ "movsx",	MOVSX,		WORD },
-	{ "movzx",	MOVZX,		WORD },
-	{ "mul",	MUL,		WORD },
-	{ "neg",	NEG,		WORD },
-	{ "nop",	NOP,		WORD },
-	{ "not",	NOT,		WORD },
-	{ "or",		OR,		WORD },
-	{ "out",	OUT,		WORD },
-	{ "outb",	OUT,		BYTE },
-	{ "outs",	OUTS,		WORD },
-	{ "outsb",	OUTS,		BYTE },
-	{ "pop",	POP,		WORD },
-	{ "popa",	POPA,		WORD },
-	{ "popad",	POPA,		WORD },
-	{ "popf",	POPF,		WORD },
-	{ "popfd",	POPF,		WORD },
-	{ "push",	PUSH,		WORD },
-	{ "pusha",	PUSHA,		WORD },
-	{ "pushad",	PUSHA,		WORD },
-	{ "pushf",	PUSHF,		WORD },
-	{ "pushfd",	PUSHF,		WORD },
-	{ "rcl",	RCL,		WORD },
-	{ "rcr",	RCR,		WORD },
-	{ "ret",	RET,		JUMP },
-	{ "retf",	RETF,		JUMP },
-	{ "rol",	ROL,		WORD },
-	{ "ror",	ROR,		WORD },
-	{ "sahf",	SAHF,		WORD },
-	{ "sal",	SAL,		WORD },
-	{ "sar",	SAR,		WORD },
-	{ "sbb",	SBB,		WORD },
-	{ "scas",	SCAS,		WORD },
-	{ "seta",	SETA,		BYTE },
-	{ "setae",	SETAE,		BYTE },
-	{ "setb",	SETB,		BYTE },
-	{ "setbe",	SETBE,		BYTE },
-	{ "sete",	SETE,		BYTE },
-	{ "setg",	SETG,		BYTE },
-	{ "setge",	SETGE,		BYTE },
-	{ "setl",	SETL,		BYTE },
-	{ "setna",	SETBE,		BYTE },
-	{ "setnae",	SETB,		BYTE },
-	{ "setnb",	SETAE,		BYTE },
-	{ "setnbe",	SETA,		BYTE },
-	{ "setne",	SETNE,		BYTE },
-	{ "setng",	SETLE,		BYTE },
-	{ "setnge",	SETL,		BYTE },
-	{ "setnl",	SETGE,		BYTE },
-	{ "setnle",	SETG,		BYTE },
-	{ "setno",	SETNO,		BYTE },
-	{ "setnp",	SETNP,		BYTE },
-	{ "setns",	SETNS,		BYTE },
-	{ "seto",	SETO,		BYTE },
-	{ "setp",	SETP,		BYTE },
-	{ "sets",	SETS,		BYTE },
-	{ "setz",	SETE,		BYTE },
-	{ "sgdt",	SGDT,		WORD },
-	{ "shl",	SHL,		WORD },
-	{ "shld",	SHLD,		WORD },
-	{ "shr",	SHR,		WORD },
-	{ "shrd",	SHRD,		WORD },
-	{ "sidt",	SIDT,		WORD },
-	{ "sldt",	SLDT,		WORD },
-	{ "smsw",	SMSW,		WORD },
-	{ "stc",	STC,		WORD },
-	{ "std",	STD,		WORD },
-	{ "sti",	STI,		WORD },
-	{ "stos",	STOS,		WORD },
-	{ "stosb",	STOS,		BYTE },
-	{ "str",	STR,		WORD },
-	{ "sub",	SUB,		WORD },
-	{ "test",	TEST,		WORD },
-	{ "verr",	VERR,		WORD },
-	{ "verw",	VERW,		WORD },
-	{ "wait",	WAIT,		WORD },
-	{ "wbinvd",	WBINVD,		WORD },
-	{ "xadd",	XADD,		WORD },
-	{ "xchg",	XCHG,		WORD },
-	{ "xlat",	XLAT,		WORD },
-	{ "xor",	XOR,		WORD },
-};
-
-void bas_parse_init(char *file)
-/* Prepare parsing of an BAS assembly file. */
-{
-	tok_init(file, '!');
-}
-
-static void zap(void)
-/* An error, zap the rest of the line. */
-{
-	token_t *t;
-
-	while ((t= get_token(0))->type != T_EOF && t->symbol != ';')
-		skip_token(1);
-}
-
-static mnemonic_t *search_mnem(char *name)
-/* Binary search for a mnemonic.  (That's why the table is sorted.) */
-{
-	int low, mid, high;
-	int cmp;
-	mnemonic_t *m;
-
-	low= 0;
-	high= arraysize(mnemtab)-1;
-	while (low <= high) {
-		mid= (low + high) / 2;
-		m= &mnemtab[mid];
-
-		if ((cmp= strcmp(name, m->name)) == 0) return m;
-
-		if (cmp < 0) high= mid-1; else low= mid+1;
-	}
-	return nil;
-}
-
-static expression_t *bas_get_C_expression(int *pn)
-/* Read a "C-like" expression.  Note that we don't worry about precedence,
- * the expression is printed later like it is read.  If the target language
- * does not have all the operators (like ~) then this has to be repaired by
- * changing the source file.  (No problem, you still have one source file
- * to maintain, not two.)
- */
-{
-	expression_t *e, *a1, *a2;
-	token_t *t;
-
-	if ((t= get_token(*pn))->symbol == '(') {
-		/* ( expr ): grouping. */
-		(*pn)++;
-		if ((a1= bas_get_C_expression(pn)) == nil) return nil;
-		if (get_token(*pn)->symbol != ')') {
-			parse_err(1, t, "missing )\n");
-			del_expr(a1);
-			return nil;
-		}
-		(*pn)++;
-		e= new_expr();
-		e->operator= '[';
-		e->middle= a1;
-	} else
-	if (t->type == T_WORD || t->type == T_STRING) {
-		/* Label, number, or string. */
-		e= new_expr();
-		e->operator= t->type == T_WORD ? 'W' : 'S';
-		e->name= allocate(nil, (t->len+1) * sizeof(e->name[0]));
-		memcpy(e->name, t->name, t->len+1);
-		e->len= t->len;
-		(*pn)++;
-	} else
-	if (t->symbol == '+' || t->symbol == '-' || t->symbol == '~') {
-		/* Unary operator. */
-		(*pn)++;
-		if ((a1= bas_get_C_expression(pn)) == nil) return nil;
-		e= new_expr();
-		e->operator= t->symbol;
-		e->middle= a1;
-	} else
-	if (t->symbol == '$' && get_token(*pn + 1)->type == T_WORD) {
-		/* A hexadecimal number. */
-		t= get_token(*pn + 1);
-		e= new_expr();
-		e->operator= 'W';
-		e->name= allocate(nil, (t->len+3) * sizeof(e->name[0]));
-		strcpy(e->name, "0x");
-		memcpy(e->name+2, t->name, t->len+1);
-		e->len= t->len+2;
-		(*pn)+= 2;
-	} else {
-		parse_err(1, t, "expression syntax error\n");
-		return nil;
-	}
-
-	switch ((t= get_token(*pn))->symbol) {
-	case '+':
-	case '-':
-	case '*':
-	case '/':
-	case '%':
-	case '&':
-	case '|':
-	case '^':
-	case S_LEFTSHIFT:
-	case S_RIGHTSHIFT:
-		(*pn)++;
-		a1= e;
-		if ((a2= bas_get_C_expression(pn)) == nil) {
-			del_expr(a1);
-			return nil;
-		}
-		e= new_expr();
-		e->operator= t->symbol;
-		e->left= a1;
-		e->right= a2;
-	}
-	return e;
-}
-
-/* We want to know the sizes of the first two operands. */
-static optype_t optypes[2];
-static int op_idx;
-
-static expression_t *bas_get_operand(int *pn)
-/* Get something like: [memory], offset[base+index*scale], or simpler. */
-{
-	expression_t *e, *offset, *base, *index;
-	token_t *t;
-	int c;
-	optype_t optype;
-
-	/* Prefixed by 'byte', 'word' or 'dword'? */
-	if ((t= get_token(*pn))->type == T_WORD && (
-		strcmp(t->name, "byte") == 0
-		|| strcmp(t->name, "word") == 0
-		|| strcmp(t->name, "dword") == 0)
-	) {
-		switch (t->name[0]) {
-		case 'b':	optype= BYTE; break;
-		case 'w':	optype= use16() ? WORD : OWORD; break;
-		case 'd':	optype= use32() ? WORD : OWORD; break;
-		}
-		if (op_idx < arraysize(optypes)) optypes[op_idx++]= optype;
-		(*pn)++;
-
-		/* It may even be "byte ptr"... */
-		if ((t= get_token(*pn))->type == T_WORD
-					&& strcmp(t->name, "ptr") == 0) {
-			(*pn)++;
-		}
-	}
-
-	/* Is it [memory]? */
-	if (get_token(*pn)->symbol == '['
-		&& ((t= get_token(*pn + 1))->type != T_WORD
-			|| !isregister(t->name))
-	) {
-		/* A memory dereference. */
-		(*pn)++;
-		if ((offset= bas_get_C_expression(pn)) == nil) return nil;
-		if (get_token(*pn)->symbol != ']') {
-			parse_err(1, t, "operand syntax error\n");
-			del_expr(offset);
-			return nil;
-		}
-		(*pn)++;
-		e= new_expr();
-		e->operator= '(';
-		e->middle= offset;
-		return e;
-	}
-
-	/* #something? *something? */
-	if ((c= get_token(*pn)->symbol) == '#' || c == '*') {
-		/* '#' and '*' are often used to introduce some constant. */
-		(*pn)++;
-	}
-
-	/* Offset? */
-	if (get_token(*pn)->symbol != '[') {
-		/* There is an offset. */
-		if ((offset= bas_get_C_expression(pn)) == nil) return nil;
-	} else {
-		/* No offset. */
-		offset= nil;
-	}
-
-	/* [base]? [base+? base-? */
-	c= 0;
-	if (get_token(*pn)->symbol == '['
-		&& (t= get_token(*pn + 1))->type == T_WORD
-		&& isregister(t->name)
-		&& ((c= get_token(*pn + 2)->symbol) == ']' || c=='+' || c=='-')
-	) {
-		/* A base register expression. */
-		base= new_expr();
-		base->operator= 'B';
-		base->name= copystr(t->name);
-		(*pn)+= c == ']' ? 3 : 2;
-	} else {
-		/* No base register expression. */
-		base= nil;
-	}
-
-	/* +offset]? -offset]? */
-	if (offset == nil
-		&& (c == '+' || c == '-')
-		&& (t= get_token(*pn + 1))->type == T_WORD
-		&& !isregister(t->name)
-	) {
-		(*pn)++;
-		if ((offset= bas_get_C_expression(pn)) == nil) return nil;
-		if (get_token(*pn)->symbol != ']') {
-			parse_err(1, t, "operand syntax error\n");
-			del_expr(offset);
-			del_expr(base);
-			return nil;
-		}
-		(*pn)++;
-		c= 0;
-	}
-
-	/* [index*scale]? +index*scale]? */
-	if (c == '+' || get_token(*pn)->symbol == '[') {
-		/* An index most likely. */
-		token_t *m= nil;
-
-		if (!(		/* This must be true: */
-			(t= get_token(*pn + 1))->type == T_WORD
-			&& isregister(t->name)
-			&& (get_token(*pn + 2)->symbol == ']' || (
-				get_token(*pn + 2)->symbol == '*'
-				&& (m= get_token(*pn + 3))->type == T_WORD
-				&& strchr("1248", m->name[0]) != nil
-				&& m->name[1] == 0
-				&& get_token(*pn + 4)->symbol == ']'
-			))
-		)) {
-			/* Alas it isn't */
-			parse_err(1, t, "operand syntax error\n");
-			del_expr(offset);
-			del_expr(base);
-			return nil;
-		}
-		/* Found an index. */
-		index= new_expr();
-		index->operator= m == nil ? '1' : m->name[0];
-		index->name= copystr(t->name);
-		(*pn)+= (m == nil ? 3 : 5);
-	} else {
-		/* No index. */
-		index= nil;
-	}
-
-	if (base == nil && index == nil) {
-		/* Return a lone offset as is. */
-		e= offset;
-
-		/* Lone registers tell operand size. */
-		if (offset->operator == 'W' && isregister(offset->name)) {
-			switch (isregister(offset->name)) {
-			case 1:	optype= BYTE; break;
-			case 2:	optype= use16() ? WORD : OWORD; break;
-			case 4:	optype= use32() ? WORD : OWORD; break;
-			}
-			if (op_idx < arraysize(optypes))
-				optypes[op_idx++]= optype;
-		}
-	} else {
-		e= new_expr();
-		e->operator= 'O';
-		e->left= offset;
-		e->middle= base;
-		e->right= index;
-	}
-	return e;
-}
-
-static expression_t *bas_get_oplist(int *pn)
-/* Get a comma (or colon for jmpf and callf) separated list of instruction
- * operands.
- */
-{
-	expression_t *e, *o1, *o2;
-	token_t *t;
-
-	if ((e= bas_get_operand(pn)) == nil) return nil;
-
-	if ((t= get_token(*pn))->symbol == ',' || t->symbol == ':') {
-		o1= e;
-		(*pn)++;
-		if ((o2= bas_get_oplist(pn)) == nil) {
-			del_expr(o1);
-			return nil;
-		}
-		e= new_expr();
-		e->operator= ',';
-		e->left= o1;
-		e->right= o2;
-	}
-	return e;
-}
-
-static asm86_t *bas_get_statement(void)
-/* Get a pseudo op or machine instruction with arguments. */
-{
-	token_t *t= get_token(0);
-	asm86_t *a;
-	mnemonic_t *m;
-	int n;
-	int prefix_seen;
-
-
-	assert(t->type == T_WORD);
-
-	if (strcmp(t->name, ".sect") == 0) {
-		/* .sect .text etc.  Accept only four segment names. */
-		skip_token(1);
-		t= get_token(0);
-		if (t->type != T_WORD || (
-			strcmp(t->name, ".text") != 0
-			&& strcmp(t->name, ".rom") != 0
-			&& strcmp(t->name, ".data") != 0
-			&& strcmp(t->name, ".bss") != 0
-			&& strcmp(t->name, ".end") != 0
-		)) {
-			parse_err(1, t, "weird section name to .sect\n");
-			return nil;
-		}
-	}
-	a= new_asm86();
-
-	/* Process instruction prefixes. */
-	for (prefix_seen= 0;; prefix_seen= 1) {
-		if (strcmp(t->name, "rep") == 0
-			|| strcmp(t->name, "repe") == 0
-			|| strcmp(t->name, "repne") == 0
-			|| strcmp(t->name, "repz") == 0
-			|| strcmp(t->name, "repnz") == 0
-		) {
-			if (a->rep != ONCE) {
-				parse_err(1, t,
-					"can't have more than one rep\n");
-			}
-			switch (t->name[3]) {
-			case 0:		a->rep= REP;	break;
-			case 'e':
-			case 'z':	a->rep= REPE;	break;
-			case 'n':	a->rep= REPNE;	break;
-			}
-		} else
-		if (strcmp(t->name, "seg") == 0
-					&& get_token(1)->type == T_WORD) {
-			if (a->seg != DEFSEG) {
-				parse_err(1, t,
-				"can't have more than one segment prefix\n");
-			}
-			switch (get_token(1)->name[0]) {
-			case 'c':	a->seg= CSEG;	break;
-			case 'd':	a->seg= DSEG;	break;
-			case 'e':	a->seg= ESEG;	break;
-			case 'f':	a->seg= FSEG;	break;
-			case 'g':	a->seg= GSEG;	break;
-			case 's':	a->seg= SSEG;	break;
-			}
-			skip_token(1);
-		} else
-		if (!prefix_seen) {
-			/* No prefix here, get out! */
-			break;
-		} else {
-			/* No more prefixes, next must be an instruction. */
-			if (t->type != T_WORD
-				|| (m= search_mnem(t->name)) == nil
-				|| m->optype == PSEUDO
-			) {
-				parse_err(1, t,
-		"machine instruction expected after instruction prefix\n");
-				del_asm86(a);
-				return nil;
-			}
-			break;
-		}
-
-		/* Skip the prefix and extra newlines. */
-		do {
-			skip_token(1);
-		} while ((t= get_token(0))->symbol == ';');
-	}
-
-	/* All the readahead being done upsets the line counter. */
-	a->line= t->line;
-
-	/* Read a machine instruction or pseudo op. */
-	if ((m= search_mnem(t->name)) == nil) {
-		parse_err(1, t, "unknown instruction '%s'\n", t->name);
-		del_asm86(a);
-		return nil;
-	}
-	a->opcode= m->opcode;
-	a->optype= m->optype;
-	if (a->opcode == CBW || a->opcode == CWD) {
-		a->optype= (strcmp(t->name, "cbw") == 0
-		    || strcmp(t->name, "cwd") == 0) == use16() ? WORD : OWORD;
-	}
-	for (op_idx= 0; op_idx < arraysize(optypes); op_idx++)
-		optypes[op_idx]= m->optype;
-	op_idx= 0;
-
-	n= 1;
-	if (get_token(1)->symbol != ';'
-				&& (a->args= bas_get_oplist(&n)) == nil) {
-		del_asm86(a);
-		return nil;
-	}
-
-	if (m->optype == WORD) {
-		/* Does one of the operands overide the optype? */
-		for (op_idx= 0; op_idx < arraysize(optypes); op_idx++) {
-			if (optypes[op_idx] != m->optype)
-				a->optype= optypes[op_idx];
-		}
-	}
-
-	if (get_token(n)->symbol != ';') {
-		parse_err(1, t, "garbage at end of instruction\n");
-		del_asm86(a);
-		return nil;
-	}
-	switch (a->opcode) {
-	case DOT_ALIGN:
-		/* Restrict .align to have a single numeric argument, some
-		 * assemblers think of the argument as a power of two, so
-		 * we need to be able to change the value.
-		 */
-		if (strcmp(t->name, ".even") == 0 && a->args == nil) {
-			/* .even becomes .align 2. */
-			expression_t *e;
-			a->args= e= new_expr();
-			e->operator= 'W';
-			e->name= copystr("2");
-			e->len= 2;
-		}
-		if (a->args == nil || a->args->operator != 'W'
-					|| !isanumber(a->args->name)) {
-			parse_err(1, t,
-			  ".align is restricted to one numeric argument\n");
-			del_asm86(a);
-			return nil;
-		}
-		break;
-	case MOVSX:
-	case MOVZX:
-		/* Types of both operands tell the instruction type. */
-		a->optype= optypes[0];
-		if (optypes[1] == BYTE) {
-			a->opcode= a->opcode == MOVSX ? MOVSXB : MOVZXB;
-		}
-		break;
-	case SAL:
-	case SAR:
-	case SHL:
-	case SHR:
-	case RCL:
-	case RCR:
-	case ROL:
-	case ROR:
-		/* Only the first operand tells the operand size. */
-		a->optype= optypes[0];
-		break;
-	default:;
-	}
-	skip_token(n+1);
-	return a;
-}
-
-asm86_t *bas_get_instruction(void)
-{
-	asm86_t *a= nil;
-	expression_t *e;
-	token_t *t;
-
-	while ((t= get_token(0))->symbol == ';')
-		skip_token(1);
-
-	if (t->type == T_EOF) return nil;
-
-	if (t->symbol == '#') {
-		/* Preprocessor line and file change. */
-
-		if ((t= get_token(1))->type != T_WORD || !isanumber(t->name)
-			|| get_token(2)->type != T_STRING
-		) {
-			parse_err(1, t, "file not preprocessed?\n");
-			zap();
-		} else {
-			set_file(get_token(2)->name,
-				strtol(get_token(1)->name, nil, 0) - 1);
-
-			/* GNU CPP adds extra cruft, simply zap the line. */
-			zap();
-		}
-		a= bas_get_instruction();
-	} else
-	if (t->type == T_WORD && get_token(1)->symbol == ':') {
-		/* A label definition. */
-		a= new_asm86();
-		a->line= t->line;
-		a->opcode= DOT_LABEL;
-		a->optype= PSEUDO;
-		a->args= e= new_expr();
-		e->operator= ':';
-		e->name= copystr(t->name);
-		skip_token(2);
-	} else
-	if (t->type == T_WORD && get_token(1)->symbol == '=') {
-		int n= 2;
-
-		if ((e= bas_get_C_expression(&n)) == nil) {
-			zap();
-			a= bas_get_instruction();
-		} else
-		if (get_token(n)->symbol != ';') {
-			parse_err(1, t, "garbage after assignment\n");
-			zap();
-			a= bas_get_instruction();
-		} else {
-			a= new_asm86();
-			a->line= t->line;
-			a->opcode= DOT_EQU;
-			a->optype= PSEUDO;
-			a->args= new_expr();
-			a->args->operator= '=';
-			a->args->name= copystr(t->name);
-			a->args->middle= e;
-			skip_token(n+1);
-		}
-	} else
-	if (t->type == T_WORD && get_token(1)->type == T_WORD
-				&& strcmp(get_token(1)->name, "lcomm") == 0) {
-		/* Local common block definition. */
-		int n= 2;
-
-		if ((e= bas_get_C_expression(&n)) == nil) {
-			zap();
-			a= bas_get_instruction();
-		} else
-		if (get_token(n)->symbol != ';') {
-			parse_err(1, t, "garbage after lcomm\n");
-			zap();
-			a= bas_get_instruction();
-		} else {
-			a= new_asm86();
-			a->line= t->line;
-			a->opcode= DOT_LCOMM;
-			a->optype= PSEUDO;
-			a->args= new_expr();
-			a->args->operator= ',';
-			a->args->right= e;
-			a->args->left= e= new_expr();
-			e->operator= 'W';
-			e->name= copystr(t->name);
-			e->len= strlen(e->name)+1;
-			skip_token(n+1);
-		}
-	} else
-	if (t->type == T_WORD) {
-		if ((a= bas_get_statement()) == nil) {
-			zap();
-			a= bas_get_instruction();
-		}
-	} else {
-		parse_err(1, t, "syntax error\n");
-		zap();
-		a= bas_get_instruction();
-	}
-	if (a->optype == OWORD) {
-		a->optype= WORD;
-		a->oaz|= OPZ;
-	}
-	return a;
-}
Index: trunk/minix/commands/i386/asmconv/parse_gnu.c
===================================================================
--- trunk/minix/commands/i386/asmconv/parse_gnu.c	(revision 9)
+++ 	(revision )
@@ -1,879 +1,0 @@
-/*	parse_ack.c - parse GNU assembly		Author: R.S. Veldema
- *							 <rveldema@cs.vu.nl>
- *								26 Aug 1996
- */
-#define nil 0
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <assert.h>
-#include "asmconv.h"
-#include "token.h"
-#include "asm86.h"
-#include "languages.h"
-
-typedef struct mnemonic {	/* GNU as86 mnemonics translation table. */
-	char		*name;
-	opcode_t	opcode;
-	optype_t	optype;
-} mnemonic_t;
-
-static mnemonic_t mnemtab[] = {			/* This array is sorted. */
-	{ ".align",	DOT_ALIGN,	PSEUDO },
-	{ ".ascii",	DOT_ASCII,	PSEUDO },
-	{ ".asciz",	DOT_ASCIZ,	PSEUDO },
-	{ ".assert",	DOT_ASSERT,	PSEUDO },
-	{ ".base",	DOT_BASE,	PSEUDO },
-	{ ".bss",	DOT_BSS,	PSEUDO },
-	{ ".byte",	DOT_DATA1,	PSEUDO },
-	{ ".comm",	DOT_COMM,	PSEUDO },
-	{ ".data",	DOT_DATA,	PSEUDO },
-	{ ".data1",	DOT_DATA1,	PSEUDO },
-	{ ".data2",	DOT_DATA2,	PSEUDO },
-	{ ".data4",	DOT_DATA4,	PSEUDO },
-	{ ".end",	DOT_END,	PSEUDO },
-	{ ".extern",	DOT_EXTERN,	PSEUDO },
-	{ ".file",	DOT_FILE,	PSEUDO },
-	{ ".globl",	DOT_DEFINE,	PSEUDO },
-	{ ".lcomm",	DOT_LCOMM,	PSEUDO },
-	{ ".line",	DOT_LINE,	PSEUDO },
-	{ ".list",	DOT_LIST,	PSEUDO },
-	{ ".long",	DOT_DATA4,	PSEUDO },
-	{ ".nolist",	DOT_NOLIST,	PSEUDO },
-	{ ".rom",	DOT_ROM,	PSEUDO },
-	{ ".space",	DOT_SPACE,	PSEUDO },
-	{ ".symb",	DOT_SYMB,	PSEUDO },
-	{ ".text",	DOT_TEXT,	PSEUDO },
-	{ ".word",	DOT_DATA2,	PSEUDO },
-	{ "aaa",	AAA,		WORD },
-	{ "aad",	AAD,		WORD },
-	{ "aam",	AAM,		WORD },
-	{ "aas",	AAS,		WORD },
-	{ "adcb",	ADC,		BYTE },
-	{ "adcl",	ADC,		WORD },
-	{ "adcw",	ADC,		OWORD },
-	{ "addb",	ADD,		BYTE },
-	{ "addl",	ADD,		WORD },
-	{ "addw",	ADD,		OWORD },
-	{ "andb",	AND,		BYTE },
-	{ "andl",	AND,		WORD },
-	{ "andw",	AND,		OWORD },
-	{ "arpl",	ARPL,		WORD },
-	{ "bound",	BOUND,		WORD },
-	{ "bsf",	BSF,		WORD },
-	{ "bsr",	BSR,		WORD },
-	{ "bswap",	BSWAP,		WORD },
-	{ "btc",	BTC,		WORD },
-	{ "btl",	BT,		WORD },
-	{ "btr",	BTR,		WORD },
-	{ "bts",	BTS,		WORD },
-	{ "btw",	BT,		OWORD },
-	{ "call",	CALL,		JUMP },
-	{ "callf",	CALLF,		JUMP },
-	{ "cbtw",	CBW,		OWORD },
-	{ "cbw",	CBW,		WORD },
-	{ "cdq",	CWD,		WORD },
-	{ "clc",	CLC,		WORD },
-	{ "cld",	CLD,		WORD },
-	{ "cli",	CLI,		WORD },
-	{ "cltd",	CWD,		WORD },
-	{ "clts",	CLTS,		WORD },
-	{ "cmc",	CMC,		WORD },
-	{ "cmpb",	CMP,		BYTE },
-	{ "cmpl",	CMP,		WORD },
-	{ "cmps",	CMPS,		WORD },
-	{ "cmpsb",	CMPS,		BYTE },
-	{ "cmpw",	CMP,		OWORD },
-	{ "cmpxchg",	CMPXCHG,	WORD },
-	{ "cwd",	CWD,		WORD },
-	{ "cwde",	CBW,		WORD },
-	{ "cwtd",	CWD,		OWORD },
-	{ "cwtl",	CBW,		WORD },
-	{ "daa",	DAA,		WORD },
-	{ "das",	DAS,		WORD },
-	{ "decb",	DEC,		BYTE },
-	{ "decl",	DEC,		WORD },
-	{ "decw",	DEC,		OWORD },
-	{ "divb",	DIV,		BYTE },
-	{ "divl",	DIV,		WORD },
-	{ "divw",	DIV,		OWORD },
-	{ "enter",	ENTER,		WORD },
-	{ "f2xm1",	F2XM1,		WORD },
-	{ "fabs",	FABS,		WORD },
-	{ "fadd",	FADD,		WORD },
-	{ "faddd",	FADDD,		WORD },
-	{ "faddp",	FADDP,		WORD },
-	{ "fadds",	FADDS,		WORD },
-	{ "fbld",	FBLD,		WORD },
-	{ "fbstp",	FBSTP,		WORD },
-	{ "fchs",	FCHS,		WORD },
-	{ "fcomd",	FCOMD,		WORD },
-	{ "fcompd",	FCOMPD,		WORD },
-	{ "fcompp",	FCOMPP,		WORD },
-	{ "fcomps",	FCOMPS,		WORD },
-	{ "fcoms",	FCOMS,		WORD },
-	{ "fcos",	FCOS,		WORD },
-	{ "fdecstp",	FDECSTP,	WORD },
-	{ "fdivd",	FDIVD,		WORD },
-	{ "fdivp",	FDIVP,		WORD },
-	{ "fdivrd",	FDIVRD,		WORD },
-	{ "fdivrp",	FDIVRP,		WORD },
-	{ "fdivrs",	FDIVRS,		WORD },
-	{ "fdivs",	FDIVS,		WORD },
-	{ "ffree",	FFREE,		WORD },
-	{ "fiaddl",	FIADDL,		WORD },
-	{ "fiadds",	FIADDS,		WORD },
-	{ "ficom",	FICOM,		WORD },
-	{ "ficomp",	FICOMP,		WORD },
-	{ "fidivl",	FIDIVL,		WORD },
-	{ "fidivrl",	FIDIVRL,	WORD },
-	{ "fidivrs",	FIDIVRS,	WORD },
-	{ "fidivs",	FIDIVS,		WORD },
-	{ "fildl",	FILDL,		WORD },
-	{ "fildq",	FILDQ,		WORD },
-	{ "filds",	FILDS,		WORD },
-	{ "fimull",	FIMULL,		WORD },
-	{ "fimuls",	FIMULS,		WORD },
-	{ "fincstp",	FINCSTP,	WORD },
-	{ "fistl",	FISTL,		WORD },
-	{ "fistp",	FISTP,		WORD },
-	{ "fists",	FISTS,		WORD },
-	{ "fisubl",	FISUBL,		WORD },
-	{ "fisubrl",	FISUBRL,	WORD },
-	{ "fisubrs",	FISUBRS,	WORD },
-	{ "fisubs",	FISUBS,		WORD },
-	{ "fld1",	FLD1,		WORD },
-	{ "fldcw",	FLDCW,		WORD },
-	{ "fldd",	FLDD,		WORD },
-	{ "fldenv",	FLDENV,		WORD },
-	{ "fldl2e",	FLDL2E,		WORD },
-	{ "fldl2t",	FLDL2T,		WORD },
-	{ "fldlg2",	FLDLG2,		WORD },
-	{ "fldln2",	FLDLN2,		WORD },
-	{ "fldpi",	FLDPI,		WORD },
-	{ "flds",	FLDS,		WORD },
-	{ "fldx",	FLDX,		WORD },
-	{ "fldz",	FLDZ,		WORD },
-	{ "fmuld",	FMULD,		WORD },
-	{ "fmulp",	FMULP,		WORD },
-	{ "fmuls",	FMULS,		WORD },
-	{ "fnclex",	FCLEX,		WORD },
-	{ "fninit",	FINIT,		WORD },
-	{ "fnop",	FNOP,		WORD },
-	{ "fnsave",	FSAVE,		WORD },
-	{ "fnstcw",	FSTCW,		WORD },
-	{ "fnstenv",	FSTENV,		WORD },
-	{ "fpatan",	FPATAN,		WORD },
-	{ "fprem",	FPREM,		WORD },
-	{ "fprem1",	FPREM1,		WORD },
-	{ "fptan",	FPTAN,		WORD },
-	{ "frndint",	FRNDINT,	WORD },
-	{ "frstor",	FRSTOR,		WORD },
-	{ "fscale",	FSCALE,		WORD },
-	{ "fsin",	FSIN,		WORD },
-	{ "fsincos",	FSINCOS,	WORD },
-	{ "fsqrt",	FSQRT,		WORD },
-	{ "fstd",	FSTD,		WORD },
-	{ "fstpd",	FSTPD,		WORD },
-	{ "fstps",	FSTPS,		WORD },
-	{ "fstpx",	FSTPX,		WORD },
-	{ "fsts",	FSTS,		WORD },
-	{ "fstsw",	FSTSW,		WORD },
-	{ "fsubd",	FSUBD,		WORD },
-	{ "fsubp",	FSUBP,		WORD },
-	{ "fsubpr",	FSUBPR,		WORD },
-	{ "fsubrd",	FSUBRD,		WORD },
-	{ "fsubrs",	FSUBRS,		WORD },
-	{ "fsubs",	FSUBS,		WORD },
-	{ "ftst",	FTST,		WORD },
-	{ "fucom",	FUCOM,		WORD },
-	{ "fucomp",	FUCOMP,		WORD },
-	{ "fucompp",	FUCOMPP,	WORD },
-	{ "fxam",	FXAM,		WORD },
-	{ "fxch",	FXCH,		WORD },
-	{ "fxtract",	FXTRACT,	WORD },
-	{ "fyl2x",	FYL2X,		WORD },
-	{ "fyl2xp1",	FYL2XP1,	WORD },
-	{ "hlt",	HLT,		WORD },
-	{ "idivb",	IDIV,		BYTE },
-	{ "idivl",	IDIV,		WORD },
-	{ "idivw",	IDIV,		OWORD },
-	{ "imulb",	IMUL,		BYTE },
-	{ "imull",	IMUL,		WORD },
-	{ "imulw",	IMUL,		OWORD },
-	{ "inb",	IN,		BYTE },
-	{ "incb",	INC,		BYTE },
-	{ "incl",	INC,		WORD },
-	{ "incw",	INC,		OWORD },
-	{ "inl",	IN,		WORD },
-	{ "insb",	INS,		BYTE },
-	{ "insl",	INS,		WORD },
-	{ "insw",	INS,		OWORD },
-	{ "int",	INT,		WORD },
-	{ "into",	INTO,		JUMP },
-	{ "invd",	INVD,		WORD },
-	{ "invlpg",	INVLPG,		WORD },
-	{ "inw",	IN,		OWORD },
-	{ "iret",	IRET,		JUMP },
-	{ "iretd",	IRETD,		JUMP },
-	{ "ja",		JA,		JUMP },
-	{ "jae",	JAE,		JUMP },
-	{ "jb",		JB,		JUMP },
-	{ "jbe",	JBE,		JUMP },
-	{ "jc",		JB,		JUMP },
-	{ "jcxz",	JCXZ,		JUMP },
-	{ "je",		JE,		JUMP },
-	{ "jecxz",	JCXZ,		JUMP },
-	{ "jg",		JG,		JUMP },
-	{ "jge",	JGE,		JUMP },
-	{ "jl",		JL,		JUMP },
-	{ "jle",	JLE,		JUMP },
-	{ "jmp",	JMP,		JUMP },
-	{ "jmpf",	JMPF,		JUMP },
-	{ "jna",	JBE,		JUMP },
-	{ "jnae",	JB,		JUMP },
-	{ "jnb",	JAE,		JUMP },
-	{ "jnbe",	JA,		JUMP },
-	{ "jnc",	JAE,		JUMP },
-	{ "jne",	JNE,		JUMP },
-	{ "jng",	JLE,		JUMP },
-	{ "jnge",	JL,		JUMP },
-	{ "jnl",	JGE,		JUMP },
-	{ "jnle",	JG,		JUMP },
-	{ "jno",	JNO,		JUMP },
-	{ "jnp",	JNP,		JUMP },
-	{ "jns",	JNS,		JUMP },
-	{ "jnz",	JNE,		JUMP },
-	{ "jo",		JO,		JUMP },
-	{ "jp",		JP,		JUMP },
-	{ "js",		JS,		JUMP },
-	{ "jz",		JE,		JUMP },
-	{ "lahf",	LAHF,		WORD },
-	{ "lar",	LAR,		WORD },
-	{ "lds",	LDS,		WORD },
-	{ "leal",	LEA,		WORD },
-	{ "leave",	LEAVE,		WORD },
-	{ "leaw",	LEA,		OWORD },
-	{ "les",	LES,		WORD },
-	{ "lfs",	LFS,		WORD },
-	{ "lgdt",	LGDT,		WORD },
-	{ "lgs",	LGS,		WORD },
-	{ "lidt",	LIDT,		WORD },
-	{ "lldt",	LLDT,		WORD },
-	{ "lmsw",	LMSW,		WORD },
-	{ "lock",	LOCK,		WORD },
-	{ "lods",	LODS,		WORD },
-	{ "lodsb",	LODS,		BYTE },
-	{ "loop",	LOOP,		JUMP },
-	{ "loope",	LOOPE,		JUMP },
-	{ "loopne",	LOOPNE,		JUMP },
-	{ "loopnz",	LOOPNE,		JUMP },
-	{ "loopz",	LOOPE,		JUMP },
-	{ "lsl",	LSL,		WORD },
-	{ "lss",	LSS,		WORD },
-	{ "ltr",	LTR,		WORD },
-	{ "movb",	MOV,		BYTE },
-	{ "movl",	MOV,		WORD },
-	{ "movsb",	MOVS,		BYTE },
-	{ "movsbl",	MOVSXB,		WORD },
-	{ "movsbw",	MOVSXB,		OWORD },
-	{ "movsl",	MOVS,		WORD },
-	{ "movsw",	MOVS,		OWORD },
-	{ "movswl",	MOVSX,		WORD },
-	{ "movw",	MOV,		OWORD },
-	{ "movzbl",	MOVZXB,		WORD },
-	{ "movzbw",	MOVZXB,		OWORD },
-	{ "movzwl",	MOVZX,		WORD },
-	{ "mulb",	MUL,		BYTE },
-	{ "mull",	MUL,		WORD },
-	{ "mulw",	MUL,		OWORD },
-	{ "negb",	NEG,		BYTE },
-	{ "negl",	NEG,		WORD },
-	{ "negw",	NEG,		OWORD },
-	{ "nop",	NOP,		WORD },
-	{ "notb",	NOT,		BYTE },
-	{ "notl",	NOT,		WORD },
-	{ "notw",	NOT,		OWORD },
-	{ "orb",	OR,		BYTE },
-	{ "orl",	OR,		WORD },
-	{ "orw",	OR,		OWORD },
-	{ "outb",	OUT,		BYTE },
-	{ "outl",	OUT,		WORD },
-	{ "outsb",	OUTS,		BYTE },
-	{ "outsl",	OUTS,		WORD },
-	{ "outsw",	OUTS,		OWORD },
-	{ "outw",	OUT,		OWORD },
-	{ "pop",	POP,		WORD },
-	{ "popa",	POPA,		WORD },
-	{ "popad",	POPA,		WORD },
-	{ "popf",	POPF,		WORD },
-	{ "popl",	POP,		WORD },
-	{ "push",	PUSH,		WORD },
-	{ "pusha",	PUSHA,		WORD },
-	{ "pushad",	PUSHA,		WORD },
-	{ "pushf",	PUSHF,		WORD },
-	{ "pushl",	PUSH,		WORD },
-	{ "rclb",	RCL,		BYTE },
-	{ "rcll",	RCL,		WORD },
-	{ "rclw",	RCL,		OWORD },
-	{ "rcrb",	RCR,		BYTE },
-	{ "rcrl",	RCR,		WORD },
-	{ "rcrw",	RCR,		OWORD },
-	{ "ret",	RET,		JUMP },
-	{ "retf",	RETF,		JUMP },
-	{ "rolb",	ROL,		BYTE },
-	{ "roll",	ROL,		WORD },
-	{ "rolw",	ROL,		OWORD },
-	{ "rorb",	ROR,		BYTE },
-	{ "rorl",	ROR,		WORD },
-	{ "rorw",	ROR,		OWORD },
-	{ "sahf",	SAHF,		WORD },
-	{ "salb",	SAL,		BYTE },
-	{ "sall",	SAL,		WORD },
-	{ "salw",	SAL,		OWORD },
-	{ "sarb",	SAR,		BYTE },
-	{ "sarl",	SAR,		WORD },
-	{ "sarw",	SAR,		OWORD },
-	{ "sbbb",	SBB,		BYTE },
-	{ "sbbl",	SBB,		WORD },
-	{ "sbbw",	SBB,		OWORD },
-	{ "scasb",	SCAS,		BYTE },
-	{ "scasl",	SCAS,		WORD },
-	{ "scasw",	SCAS,		OWORD },
-	{ "seta",	SETA,		BYTE },
-	{ "setae",	SETAE,		BYTE },
-	{ "setb",	SETB,		BYTE },
-	{ "setbe",	SETBE,		BYTE },
-	{ "sete",	SETE,		BYTE },
-	{ "setg",	SETG,		BYTE },
-	{ "setge",	SETGE,		BYTE },
-	{ "setl",	SETL,		BYTE },
-	{ "setna",	SETBE,		BYTE },
-	{ "setnae",	SETB,		BYTE },
-	{ "setnb",	SETAE,		BYTE },
-	{ "setnbe",	SETA,		BYTE },
-	{ "setne",	SETNE,		BYTE },
-	{ "setng",	SETLE,		BYTE },
-	{ "setnge",	SETL,		BYTE },
-	{ "setnl",	SETGE,		BYTE },
-	{ "setnle",	SETG,		BYTE },
-	{ "setno",	SETNO,		BYTE },
-	{ "setnp",	SETNP,		BYTE },
-	{ "setns",	SETNS,		BYTE },
-	{ "seto",	SETO,		BYTE },
-	{ "setp",	SETP,		BYTE },
-	{ "sets",	SETS,		BYTE },
-	{ "setz",	SETE,		BYTE },
-	{ "sgdt",	SGDT,		WORD },
-	{ "shlb",	SHL,		BYTE },
-	{ "shldl",	SHLD,		WORD },
-	{ "shll",	SHL,		WORD },
-	{ "shlw",	SHL,		OWORD },
-	{ "shrb",	SHR,		BYTE },
-	{ "shrdl",	SHRD,		WORD },
-	{ "shrl",	SHR,		WORD },
-	{ "shrw",	SHR,		OWORD },
-	{ "sidt",	SIDT,		WORD },
-	{ "sldt",	SLDT,		WORD },
-	{ "smsw",	SMSW,		WORD },
-	{ "stc",	STC,		WORD },
-	{ "std",	STD,		WORD },
-	{ "sti",	STI,		WORD },
-	{ "stosb",	STOS,		BYTE },
-	{ "stosl",	STOS,		WORD },
-	{ "stosw",	STOS,		OWORD },
-	{ "str",	STR,		WORD },
-	{ "subb",	SUB,		BYTE },
-	{ "subl",	SUB,		WORD },
-	{ "subw",	SUB,		OWORD },
-	{ "testb",	TEST,		BYTE },
-	{ "testl",	TEST,		WORD },
-	{ "testw",	TEST,		OWORD },
-	{ "verr",	VERR,		WORD },
-	{ "verw",	VERW,		WORD },
-	{ "wait",	WAIT,		WORD },
-	{ "wbinvd",	WBINVD,		WORD },
-	{ "xadd",	XADD,		WORD },
-	{ "xchgb",	XCHG,		BYTE },
-	{ "xchgl",	XCHG,		WORD },
-	{ "xchgw",	XCHG,		OWORD },
-	{ "xlat",	XLAT,		WORD },
-	{ "xorb",	XOR,		BYTE },
-	{ "xorl",	XOR,		WORD },
-	{ "xorw",	XOR,		OWORD },
-};
-
-void gnu_parse_init(char *file)
-/* Prepare parsing of an GNU assembly file. */
-{
-	tok_init(file, '#');
-}
-
-static void zap(void)
-/* An error, zap the rest of the line. */
-{
-	token_t *t;
-
-	while ((t= get_token(0))->type != T_EOF && t->symbol != ';')
-		skip_token(1);
-}
-
-static mnemonic_t *search_mnem(char *name)
-/* Binary search for a mnemonic.  (That's why the table is sorted.) */
-{
-	int low, mid, high;
-	int cmp;
-	mnemonic_t *m;
-
-	low= 0;
-	high= arraysize(mnemtab)-1;
-	while (low <= high) {
-		mid= (low + high) / 2;
-		m= &mnemtab[mid];
-
-		if ((cmp= strcmp(name, m->name)) == 0) return m;
-
-		if (cmp < 0) high= mid-1; else low= mid+1;
-	}
-	return nil;
-}
-
-static expression_t *gnu_get_C_expression(int *pn)
-/* Read a "C-like" expression.  Note that we don't worry about precedence,
- * the expression is printed later like it is read.  If the target language
- * does not have all the operators (like ~) then this has to be repaired by
- * changing the source file.  (No problem, you still have one source file
- * to maintain, not two.)
- */
-{
-	expression_t *e, *a1, *a2;
-	token_t *t;
-
-	if ((t= get_token(*pn))->symbol == '(') {
-		/* ( expr ): grouping. */
-		(*pn)++;
-		if ((a1= gnu_get_C_expression(pn)) == nil) return nil;
-		if (get_token(*pn)->symbol != ')') {
-			parse_err(1, t, "missing )\n");
-			del_expr(a1);
-			return nil;
-		}
-		(*pn)++;
-		e= new_expr();
-		e->operator= '[';
-		e->middle= a1;
-	} else
-	if (t->type == T_WORD || t->type == T_STRING) {
-		/* Label, number, or string. */
-		e= new_expr();
-		e->operator= t->type == T_WORD ? 'W' : 'S';
-		e->name= allocate(nil, (t->len+1) * sizeof(e->name[0]));
-		memcpy(e->name, t->name , t->len+1);
-		e->len= t->len;
-		(*pn)++;
-	} else
-	if (t->symbol == '+' || t->symbol == '-' || t->symbol == '~') {
-		/* Unary operator. */
-		(*pn)++;
-		if ((a1= gnu_get_C_expression(pn)) == nil) return nil;
-		e= new_expr();
-		e->operator= t->symbol;
-		e->middle= a1;
-	} else {
-		parse_err(1, t, "expression syntax error\n");
-		return nil;
-	}
-
-	switch ((t= get_token(*pn))->symbol) {
-	case '%': 
-	case '+':
-	case '-':
-	case '*':
-	case '/':
-	case '&':
-	case '|':
-	case '^':
-	case S_LEFTSHIFT:
-	case S_RIGHTSHIFT:
-		(*pn)++;
-		a1= e;
-		if ((a2= gnu_get_C_expression(pn)) == nil) {
-			del_expr(a1);
-			return nil;
-		}
-		e= new_expr();
-		e->operator= t->symbol;
-		e->left= a1;
-		e->right= a2;
-	}
-	return e;
-}
-
-static expression_t *gnu_get_operand(int *pn, int deref)
-/* Get something like: $immed, memory, offset(%base,%index,scale), or simpler. */
-{
-	expression_t *e, *offset, *base, *index;
-	token_t *t;
-	int c;
-
-	if (get_token(*pn)->symbol == '$') {
-		/* An immediate value. */
-		(*pn)++;
-		return gnu_get_C_expression(pn);
-	}
-
-	if (get_token(*pn)->symbol == '*') {
-		/* Indirection. */
-		(*pn)++;
-		if ((offset= gnu_get_operand(pn, deref)) == nil) return nil;
-		e= new_expr();
-		e->operator= '(';
-		e->middle= offset;
-		return e;
-	}
-
-	if ((get_token(*pn)->symbol == '%')
-		&& (t= get_token(*pn + 1))->type == T_WORD
-		&& isregister(t->name)
-	) {
-		/* A register operand. */
-		(*pn)+= 2;
-		e= new_expr();
-		e->operator= 'W';
-		e->name= copystr(t->name);
-		return e;
-	}
-
-	/* Offset? */
-	if (get_token(*pn)->symbol != '('
-				|| get_token(*pn + 1)->symbol != '%') {
-		/* There is an offset. */
-		if ((offset= gnu_get_C_expression(pn)) == nil) return nil;
-	} else {
-		/* No offset. */
-		offset= nil;
-	}
-
-	/* (%base,%index,scale) ? */
-	base= index= nil;
-	if (get_token(*pn)->symbol == '(') {
-		(*pn)++;
-
-		/* %base ? */
-		if (get_token(*pn)->symbol == '%'
-			&& (t= get_token(*pn + 1))->type == T_WORD
-			&& isregister(t->name)
-		) {
-			/* A base register expression. */
-			base= new_expr();
-			base->operator= 'B';
-			base->name= copystr(t->name);
-			(*pn)+= 2;
-		}
-
-		if (get_token(*pn)->symbol == ',') (*pn)++;
-
-		/* %index ? */
-		if (get_token(*pn)->symbol == '%'
-			&& (t= get_token(*pn + 1))->type == T_WORD
-			&& isregister(t->name)
-		) {
-			/* A index register expression. */
-			index= new_expr();
-			index->operator= '1';		/* for now */
-			index->name= copystr(t->name);
-			(*pn)+= 2;
-		}
-
-		if (get_token(*pn)->symbol == ',') (*pn)++;
-
-		/* scale ? */
-		if ((base != nil || index != nil)
-			&& (t= get_token(*pn))->type == T_WORD
-			&& strchr("1248", t->name[0]) != nil
-			&& t->name[1] == 0
-		) {		
-			if (index == nil) {
-				/* Base is really an index register. */
-				index= base;
-				base= nil;
-			}
-			index->operator= t->name[0];
-			(*pn)++;
-		}
-
-		if (get_token(*pn)->symbol == ')') {
-			/* Ending paren. */
-			(*pn)++;
-		} else {
-			/* Alas. */
-			parse_err(1, t, "operand syntax error\n");
-			del_expr(offset);
-			del_expr(base);
-			del_expr(index);
-			return nil;
-		}
-	}
-
-	if (base == nil && index == nil) {
-		if (deref) {
-			/* Return a lone offset as (offset). */
-			e= new_expr();
-			e->operator= '(';
-			e->middle= offset;
-		} else {
-			/* Return a lone offset as is. */
-			e= offset;
-		}
-	} else {
-		e= new_expr();
-		e->operator= 'O';
-		e->left= offset;
-
-		e->middle= base;
-		e->right= index;
-	}
-	return e;
-}
-
-static expression_t *gnu_get_oplist(int *pn, int deref)
-/* Get a comma (or colon for jmpf and callf) separated list of instruction
- * operands.
- */
-{
-	expression_t *e, *o1, *o2;
-	token_t *t;
-
-	if ((e= gnu_get_operand(pn, deref)) == nil) return nil;
-
-	if ((t= get_token(*pn))->symbol == ',' || t->symbol == ':') {
-		o1= e;
-		(*pn)++;
-		if ((o2= gnu_get_oplist(pn, deref)) == nil) {
-			del_expr(o1);
-			return nil;
-		}
-		e= new_expr();
-		e->operator= ',';
-		e->left= o1;
-		e->right= o2;
-	}
-	return e;
-}
-
-
-static asm86_t *gnu_get_statement(void)
-/* Get a pseudo op or machine instruction with arguments. */
-{
-	token_t *t= get_token(0);
-	asm86_t *a;
-	mnemonic_t *m;
-	int n;
-	int prefix_seen;
-	int deref;
-
-	assert(t->type == T_WORD);
-
-	a= new_asm86();
-
-	/* Process instruction prefixes. */
-	for (prefix_seen= 0;; prefix_seen= 1) {
-		if (strcmp(t->name, "rep") == 0
-			|| strcmp(t->name, "repe") == 0
-			|| strcmp(t->name, "repne") == 0
-			|| strcmp(t->name, "repz") == 0
-			|| strcmp(t->name, "repnz") == 0
-		) {
-			if (a->rep != ONCE) {
-				parse_err(1, t,
-					"can't have more than one rep\n");
-			}
-			switch (t->name[3]) {
-			case 0:		a->rep= REP;	break;
-			case 'e':
-			case 'z':	a->rep= REPE;	break;
-			case 'n':	a->rep= REPNE;	break;
-			}
-		} else
-		if (!prefix_seen) {
-			/* No prefix here, get out! */
-			break;
-		} else {
-			/* No more prefixes, next must be an instruction. */
-			if (t->type != T_WORD
-				|| (m= search_mnem(t->name)) == nil
-				|| m->optype == PSEUDO
-			) {
-				parse_err(1, t,
-		"machine instruction expected after instruction prefix\n");
-				del_asm86(a);
-				return nil;
-			}
-			break;
-		}
-
-		/* Skip the prefix and extra newlines. */
-		do {
-			skip_token(1);
-		} while ((t= get_token(0))->symbol == ';');
-	}
-
-	/* All the readahead being done upsets the line counter. */
-	a->line= t->line;
-
-	/* Read a machine instruction or pseudo op. */
-	if ((m= search_mnem(t->name)) == nil) {
-		parse_err(1, t, "unknown instruction '%s'\n", t->name);
-		del_asm86(a);
-		return nil;
-	}
-	a->opcode= m->opcode;
-	a->optype= m->optype;
-	a->oaz= 0;
-	if (a->optype == OWORD) {
-		a->oaz|= OPZ;
-		a->optype= WORD;
-	}
-
-	switch (a->opcode) {
-	case IN:
-	case OUT:
-	case INT:
-		deref= 0;
-		break;
-	default:
-		deref= (a->optype >= BYTE);
-	}
-	n= 1;
-	if (get_token(1)->symbol != ';'
-			&& (a->args= gnu_get_oplist(&n, deref)) == nil) {
-		del_asm86(a);
-		return nil;
-	}
-	if (get_token(n)->symbol != ';') {
-		parse_err(1, t, "garbage at end of instruction\n");
-		del_asm86(a);
-		return nil;
-	}
-	if (!is_pseudo(a->opcode)) {
-		/* GNU operand order is the other way around. */
-		expression_t *e, *t;
-
-		e= a->args;
-		while (e != nil && e->operator == ',') {
-			t= e->right; e->right= e->left; e->left= t;
-			e= e->left;
-		}
-	}
-	switch (a->opcode) {
-	case DOT_ALIGN:
-		/* Delete two argument .align, because ACK can't do it.
-		 * Raise 2 to the power of .align's argument.
-		 */
-		if (a->args == nil || a->args->operator != 'W') {	
-			del_asm86(a);
-			return nil;
-		}
-		if (a->args != nil && a->args->operator == 'W'
-			&& isanumber(a->args->name)
-		) {	
-			unsigned n;
-			char num[sizeof(int) * CHAR_BIT / 3 + 1];
-
-			n= 1 << strtoul(a->args->name, nil, 0);
-			sprintf(num, "%u", n);
-			deallocate(a->args->name);
-			a->args->name= copystr(num);
-		}
-		break;
-	case JMPF:
-	case CALLF:
-		/*FALL THROUGH*/
-	case JMP:
-	case CALL:
-		break;
-	default:;
-	}
-	skip_token(n+1);
-	return a;
-}
-
-
-asm86_t *gnu_get_instruction(void)
-{
-	asm86_t *a= nil;
-	expression_t *e;
-	token_t *t;
-
-	while ((t= get_token(0))->symbol == ';' || t->symbol == '/') {
-		zap();		/* if a comment started by a '/' */
-		skip_token(1);
-	}
-
-	if (t->type == T_EOF) return nil;
-
-	if (t->symbol == '#') {
-		/* Preprocessor line and file change. */
-
-		if ((t= get_token(1))->type != T_WORD || !isanumber(t->name)
-			|| get_token(2)->type != T_STRING
-		) {
-			parse_err(1, t, "file not preprocessed?\n");
-			zap();
-		} else {
-			set_file(get_token(2)->name,
-				strtol(get_token(1)->name, nil, 0) - 1);
-
-			/* GNU CPP adds extra cruft, simply zap the line. */
-			zap();
-		}
-		a= gnu_get_instruction();
-	} else
-	if (t->type == T_WORD && get_token(1)->symbol == ':') {
-		/* A label definition. */
-
-		a= new_asm86();
-		a->line= t->line;
-		a->opcode= DOT_LABEL;
-		a->optype= PSEUDO;
-		a->args= e= new_expr();
-		e->operator= ':';
-		e->name= copystr(t->name);
-		skip_token(2);
-	} else
-	if (t->type == T_WORD && get_token(1)->symbol == '=') {
-		int n= 2;
-
-		if ((e= gnu_get_C_expression(&n)) == nil) {
-			zap();
-			a= gnu_get_instruction();
-		} else
-		if (get_token(n)->symbol != ';') {
-			parse_err(1, t, "garbage after assignment\n");
-			zap();
-			a= gnu_get_instruction();
-		} else {
-			a= new_asm86();
-			a->line= t->line;
-			a->opcode= DOT_EQU;
-			a->optype= PSEUDO;
-			a->args= new_expr();
-			a->args->operator= '=';
-			a->args->name= copystr(t->name);
-			a->args->middle= e;
-			skip_token(n+1);
-		}
-	} else
-	if (t->type == T_WORD) {
-		if ((a= gnu_get_statement()) == nil) {
-			zap();
-			a= gnu_get_instruction();
-		}
-	} else {
-		parse_err(1, t, "syntax error\n");
-		zap();
-		a= gnu_get_instruction();
-	}
-	return a;
-}
Index: trunk/minix/commands/i386/asmconv/syntax.ack
===================================================================
--- trunk/minix/commands/i386/asmconv/syntax.ack	(revision 9)
+++ 	(revision )
@@ -1,107 +1,0 @@
-asmprog:
-	comment ?
-	statement
-	asmprog ; asmprog
-	asmprog comment ? \n asmprog
-
-letter:
-	[._a-zA-Z]
-
-digit:
-	[0-9]
-
-identifier:
-	letter (letter | digit)*
-	digit [bf]
-
-string:
-	'C-like string sequence'
-	"C-like string sequence"
-
-number:
-	C-like number
-
-comment:
-	! .*
-
-statement:
-	label-definition statement
-	empty
-	assignment
-	instruction
-	pseudo-instruction
-
-label-definition:
-	identifier :
-	digit :
-
-assignment:
-	identifier = expression
-
-instruction:
-	iX86-instruction
-
-pseudo-instruction:
-	.extern identifier (, identifier)*
-	.define identifier (, identifier)*
-	.data1 expression (, expression)*
-	.data2 expression (, expression)*
-	.data4 expression (, expression)*
-	.ascii string
-	.asciz string
-	.align expression
-	.space expression
-	.comm identifier , expression
-	.sect identifier
-	.base expression
-	.assert expression
-	.symb XXX
-	.line XXX
-	.file XXX
-	.nolist
-	.list
-	iX86-pseudo
-
-expression:
-	C-like expression with [ and ] for grouping
-
-iX86-instruction:
-	prefix
-	prefix iX86-instruction
-	identifier
-	identifier iX86operand
-	identifier iX86operand , iX86operand
-	identifier iX86operand : iX86operand
-
-prefix:
-	o16
-	o32
-	a16
-	a32
-	rep
-	repz
-	repnz
-	repe
-	repne
-	cseg | dseg | eseg | fseg | gseg | sseg
-
-iX86operand:
-	register
-	( register )
-	expression
-	( expression )
-	expression ( register )
-	expression ( register * [1248] )
-	expression ? ( register ) ( register )
-	expression ? ( register ) ( register * [1248] )
-
-register:
-	al | bl | cl | dl | ah | bh | ch | dh
-	ax | bx | cx | dx | si | di | bp | sp
-	eax | ebx | ecx | edx | esi | edi | ebp | esp
-	cs | ds | es | fs | gs | ss
-	cr0 | cr1 | cr2 | cr3
-
-iX86-pseudo:
-	.use16
-	.use32
Index: trunk/minix/commands/i386/asmconv/token.h
===================================================================
--- trunk/minix/commands/i386/asmconv/token.h	(revision 9)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*	token.h - token definition			Author: Kees J. Bot
- *								13 Dec 1993
- */
-
-typedef enum toktype {
-	T_EOF,
-	T_CHAR,
-	T_WORD,
-	T_STRING
-} toktype_t;
-
-typedef struct token {
-	struct token	*next;
-	long		line;
-	toktype_t	type;
-	int		symbol;		/* Single character symbol. */
-	char		*name;		/* Word, number, etc. */
-	size_t		len;		/* Length of string. */
-} token_t;
-
-#define S_LEFTSHIFT	0x100		/* << */
-#define S_RIGHTSHIFT	0x101		/* >> */
-
-void set_file(char *file, long line);
-void get_file(char **file, long *line);
-void parse_err(int err, token_t *where, const char *fmt, ...);
-void tok_init(char *file, int comment);
-token_t *get_token(int n);
-void skip_token(int n);
Index: trunk/minix/commands/i386/asmconv/tokenize.c
===================================================================
--- trunk/minix/commands/i386/asmconv/tokenize.c	(revision 9)
+++ 	(revision )
@@ -1,306 +1,0 @@
-/*	tokenize.c - split input into tokens		Author: Kees J. Bot
- *								13 Dec 1993
- */
-#define nil 0
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include "asmconv.h"
-#include "token.h"
-
-static FILE *tf;
-static char *tfile;
-static char *orig_tfile;
-static int tcomment;
-static int tc;
-static long tline;
-static token_t *tq;
-
-static void readtc(void)
-/* Read one character from the input file and put it in the global 'tc'. */
-{
-	static int nl= 0;
-
-	if (nl) tline++;
-	if ((tc= getc(tf)) == EOF && ferror(tf)) fatal(orig_tfile);
-	nl= (tc == '\n');
-}
-
-void set_file(char *file, long line)
-/* Set file name and line number, changed by a preprocessor trick. */
-{
-	deallocate(tfile);
-	tfile= allocate(nil, (strlen(file) + 1) * sizeof(tfile[0]));
-	strcpy(tfile, file);
-	tline= line;
-}
-
-void get_file(char **file, long *line)
-/* Get file name and line number. */
-{
-	*file= tfile;
-	*line= tline;
-}
-
-void parse_err(int err, token_t *t, const char *fmt, ...)
-/* Report a parsing error. */
-{
-	va_list ap;
-
-	fprintf(stderr, "\"%s\", line %ld: ", tfile,
-						t == nil ? tline : t->line);
-	va_start(ap, fmt);
-	vfprintf(stderr, fmt, ap);
-	va_end(ap);
-	if (err) set_error();
-}
-
-void tok_init(char *file, int comment)
-/* Open the file to tokenize and initialize the tokenizer. */
-{
-	if (file == nil) {
-		file= "stdin";
-		tf= stdin;
-	} else {
-		if ((tf= fopen(file, "r")) == nil) fatal(file);
-	}
-	orig_tfile= file;
-	set_file(file, 1);
-	readtc();
-	tcomment= comment;
-}
-
-static int isspace(int c)
-{
-	return between('\0', c, ' ') && c != '\n';
-}
-
-#define iscomment(c)	((c) == tcomment)
-
-static int isidentchar(int c)
-{
-	return between('a', c, 'z')
-		|| between('A', c, 'Z')
-		|| between('0', c, '9')
-		|| c == '.'
-		|| c == '_'
-		;
-}
-
-static token_t *new_token(void)
-{
-	token_t *new;
-
-	new= allocate(nil, sizeof(*new));
-	new->next= nil;
-	new->line= tline;
-	new->name= nil;
-	new->symbol= -1;
-	return new;
-}
-
-static token_t *get_word(void)
-/* Read one word, an identifier, a number, a label, or a mnemonic. */
-{
-	token_t *w;
-	char *name;
-	size_t i, len;
-
-	i= 0;
-	len= 16;
-	name= allocate(nil, len * sizeof(name[0]));
-
-	while (isidentchar(tc)) {
-		name[i++]= tc;
-		readtc();
-		if (i == len) name= allocate(name, (len*= 2) * sizeof(name[0]));
-	}
-	name[i]= 0;
-	name= allocate(name, (i+1) * sizeof(name[0]));
-	w= new_token();
-	w->type= T_WORD;
-	w->name= name;
-	w->len= i;
-	return w;
-}
-
-static token_t *get_string(void)
-/* Read a single or double quotes delimited string. */
-{
-	token_t *s;
-	int quote;
-	char *str;
-	size_t i, len;
-	int n, j;
-	int seen;
-
-	quote= tc;
-	readtc();
-
-	i= 0;
-	len= 16;
-	str= allocate(nil, len * sizeof(str[0]));
-
-	while (tc != quote && tc != '\n' && tc != EOF) {
-		seen= -1;
-		if (tc == '\\') {
-			readtc();
-			if (tc == '\n' || tc == EOF) break;
-
-			switch (tc) {
-			case 'a':	tc= '\a'; break;
-			case 'b':	tc= '\b'; break;
-			case 'f':	tc= '\f'; break;
-			case 'n':	tc= '\n'; break;
-			case 'r':	tc= '\r'; break;
-			case 't':	tc= '\t'; break;
-			case 'v':	tc= '\v'; break;
-			case 'x':
-				n= 0;
-				for (j= 0; j < 3; j++) {
-					readtc();
-					if (between('0', tc, '9'))
-						tc-= '0' + 0x0;
-					else
-					if (between('A', tc, 'A'))
-						tc-= 'A' + 0xA;
-					else
-					if (between('a', tc, 'a'))
-						tc-= 'a' + 0xa;
-					else {
-						seen= tc;
-						break;
-					}
-					n= n*0x10 + tc;
-				}
-				tc= n;
-				break;
-			default:
-				if (!between('0', tc, '9')) break;
-				n= 0;
-				for (j= 0; j < 3; j++) {
-					if (between('0', tc, '9'))
-						tc-= '0';
-					else {
-						seen= tc;
-						break;
-					}
-					n= n*010 + tc;
-					readtc();
-				}
-				tc= n;
-			}
-		}
-		str[i++]= tc;
-		if (i == len) str= allocate(str, (len*= 2) * sizeof(str[0]));
-
-		if (seen < 0) readtc(); else tc= seen;
-	}
-
-	if (tc == quote) {
-		readtc();
-	} else {
-		parse_err(1, nil, "string contains newline\n");
-	}
-	str[i]= 0;
-	str= allocate(str, (i+1) * sizeof(str[0]));
-	s= new_token();
-	s->type= T_STRING;
-	s->name= str;
-	s->len= i;
-	return s;
-}
-
-static int old_n= 0;		/* To speed up n, n+1, n+2, ... accesses. */
-static token_t **old_ptq= &tq;
-
-token_t *get_token(int n)
-/* Return the n-th token on the input queue. */
-{
-	token_t *t, **ptq;
-
-	assert(n >= 0);
-
-	if (0 && n >= old_n) {
-		/* Go forward from the previous point. */
-		n-= old_n;
-		old_n+= n;
-		ptq= old_ptq;
-	} else {
-		/* Restart from the head of the queue. */
-		old_n= n;
-		ptq= &tq;
-	}
-
-	for (;;) {
-		if ((t= *ptq) == nil) {
-			/* Token queue doesn't have element <n>, read a
-			 * new token from the input stream.
-			 */
-			while (isspace(tc) || iscomment(tc)) {
-				if (iscomment(tc)) {
-					while (tc != '\n' && tc != EOF)
-						readtc();
-				} else {
-					readtc();
-				}
-			}
-
-			if (tc == EOF) {
-				t= new_token();
-				t->type= T_EOF;
-			} else
-			if (isidentchar(tc)) {
-				t= get_word();
-			} else
-			if (tc == '\'' || tc == '"') {
-				t= get_string();
-			} else {
-				if (tc == '\n') tc= ';';
-				t= new_token();
-				t->type= T_CHAR;
-				t->symbol= tc;
-				readtc();
-				if (t->symbol == '<' && tc == '<') {
-					t->symbol= S_LEFTSHIFT;
-					readtc();
-				} else
-				if (t->symbol == '>' && tc == '>') {
-					t->symbol= S_RIGHTSHIFT;
-					readtc();
-				}
-			}
-			*ptq= t;
-		}
-		if (n == 0) break;
-		n--;
-		ptq= &t->next;
-	}
-	old_ptq= ptq;
-	return t;
-}
-
-void skip_token(int n)
-/* Remove n tokens from the input queue.  One is not allowed to skip unread
- * tokens.
- */
-{
-	token_t *junk;
-
-	assert(n >= 0);
-
-	while (n > 0) {
-		assert(tq != nil);
-
-		junk= tq;
-		tq= tq->next;
-		deallocate(junk->name);
-		deallocate(junk);
-		n--;
-	}
-	/* Reset the old reference. */
-	old_n= 0;
-	old_ptq= &tq;
-}
