/***************************************************************
Warning! This is generated code.

Any edits will be overwritten with the next call to parse_gen.py
***************************************************************/


#include "libudis.h"
#include <stdio.h>
#include <string.h>


int stringify_entry_6502(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets) {
	int dist;
	unsigned char opcode, leadin, op1, op2, op3;
	char *first_t, *h, *opstr;
	unsigned short rel, addr;

	first_t = t;
	opcode = entry->instruction[0];
	switch(opcode) {
	/* implicit  */
	case 0x0: opstr = lc ? "brk" : "BRK"; goto Limplicit_1;
	case 0x8: opstr = lc ? "php" : "PHP"; goto Limplicit_1;
	case 0x18: opstr = lc ? "clc" : "CLC"; goto Limplicit_1;
	case 0x28: opstr = lc ? "plp" : "PLP"; goto Limplicit_1;
	case 0x38: opstr = lc ? "sec" : "SEC"; goto Limplicit_1;
	case 0x40: opstr = lc ? "rti" : "RTI"; goto Limplicit_1;
	case 0x48: opstr = lc ? "pha" : "PHA"; goto Limplicit_1;
	case 0x58: opstr = lc ? "cli" : "CLI"; goto Limplicit_1;
	case 0x60: opstr = lc ? "rts" : "RTS"; goto Limplicit_1;
	case 0x68: opstr = lc ? "pla" : "PLA"; goto Limplicit_1;
	case 0x78: opstr = lc ? "sei" : "SEI"; goto Limplicit_1;
	case 0x88: opstr = lc ? "dey" : "DEY"; goto Limplicit_1;
	case 0x8a: opstr = lc ? "txa" : "TXA"; goto Limplicit_1;
	case 0x98: opstr = lc ? "tya" : "TYA"; goto Limplicit_1;
	case 0x9a: opstr = lc ? "txs" : "TXS"; goto Limplicit_1;
	case 0xa8: opstr = lc ? "tay" : "TAY"; goto Limplicit_1;
	case 0xaa: opstr = lc ? "tax" : "TAX"; goto Limplicit_1;
	case 0xb8: opstr = lc ? "clv" : "CLV"; goto Limplicit_1;
	case 0xba: opstr = lc ? "tsx" : "TSX"; goto Limplicit_1;
	case 0xc8: opstr = lc ? "iny" : "INY"; goto Limplicit_1;
	case 0xca: opstr = lc ? "dex" : "DEX"; goto Limplicit_1;
	case 0xd8: opstr = lc ? "cld" : "CLD"; goto Limplicit_1;
	case 0xe8: opstr = lc ? "inx" : "INX"; goto Limplicit_1;
	case 0xea: opstr = lc ? "nop" : "NOP"; goto Limplicit_1;
	case 0xf8: opstr = lc ? "sed" : "SED"; goto Limplicit_1;

	/* indirectx ($%02x,x) */
	case 0x1: opstr = lc ? "ora" : "ORA"; goto Lindirectx_2;
	case 0x21: opstr = lc ? "and" : "AND"; goto Lindirectx_2;
	case 0x41: opstr = lc ? "eor" : "EOR"; goto Lindirectx_2;
	case 0x61: opstr = lc ? "adc" : "ADC"; goto Lindirectx_2;
	case 0x81: opstr = lc ? "sta" : "STA"; goto Lindirectx_2;
	case 0xa1: opstr = lc ? "lda" : "LDA"; goto Lindirectx_2;
	case 0xc1: opstr = lc ? "cmp" : "CMP"; goto Lindirectx_2;
	case 0xe1: opstr = lc ? "sbc" : "SBC"; goto Lindirectx_2;

	/* zeropage $%02x */
	case 0x5: opstr = lc ? "ora" : "ORA"; goto Lzeropage_2;
	case 0x6: opstr = lc ? "asl" : "ASL"; goto Lzeropage_2;
	case 0x24: opstr = lc ? "bit" : "BIT"; goto Lzeropage_2;
	case 0x25: opstr = lc ? "and" : "AND"; goto Lzeropage_2;
	case 0x26: opstr = lc ? "rol" : "ROL"; goto Lzeropage_2;
	case 0x45: opstr = lc ? "eor" : "EOR"; goto Lzeropage_2;
	case 0x46: opstr = lc ? "lsr" : "LSR"; goto Lzeropage_2;
	case 0x65: opstr = lc ? "adc" : "ADC"; goto Lzeropage_2;
	case 0x66: opstr = lc ? "ror" : "ROR"; goto Lzeropage_2;
	case 0x84: opstr = lc ? "sty" : "STY"; goto Lzeropage_2;
	case 0x85: opstr = lc ? "sta" : "STA"; goto Lzeropage_2;
	case 0x86: opstr = lc ? "stx" : "STX"; goto Lzeropage_2;
	case 0xa4: opstr = lc ? "ldy" : "LDY"; goto Lzeropage_2;
	case 0xa5: opstr = lc ? "lda" : "LDA"; goto Lzeropage_2;
	case 0xa6: opstr = lc ? "ldx" : "LDX"; goto Lzeropage_2;
	case 0xc4: opstr = lc ? "cpy" : "CPY"; goto Lzeropage_2;
	case 0xc5: opstr = lc ? "cmp" : "CMP"; goto Lzeropage_2;
	case 0xc6: opstr = lc ? "dec" : "DEC"; goto Lzeropage_2;
	case 0xe4: opstr = lc ? "cpx" : "CPX"; goto Lzeropage_2;
	case 0xe5: opstr = lc ? "sbc" : "SBC"; goto Lzeropage_2;
	case 0xe6: opstr = lc ? "inc" : "INC"; goto Lzeropage_2;

	/* immediate #$%02x */
	case 0x9: opstr = lc ? "ora" : "ORA"; goto Limmediate_2;
	case 0x29: opstr = lc ? "and" : "AND"; goto Limmediate_2;
	case 0x49: opstr = lc ? "eor" : "EOR"; goto Limmediate_2;
	case 0x69: opstr = lc ? "adc" : "ADC"; goto Limmediate_2;
	case 0xa0: opstr = lc ? "ldy" : "LDY"; goto Limmediate_2;
	case 0xa2: opstr = lc ? "ldx" : "LDX"; goto Limmediate_2;
	case 0xa9: opstr = lc ? "lda" : "LDA"; goto Limmediate_2;
	case 0xc0: opstr = lc ? "cpy" : "CPY"; goto Limmediate_2;
	case 0xc9: opstr = lc ? "cmp" : "CMP"; goto Limmediate_2;
	case 0xe0: opstr = lc ? "cpx" : "CPX"; goto Limmediate_2;
	case 0xe9: opstr = lc ? "sbc" : "SBC"; goto Limmediate_2;

	/* accumulator a */
	case 0xa: opstr = lc ? "asl" : "ASL"; goto Laccumulator_1;
	case 0x2a: opstr = lc ? "rol" : "ROL"; goto Laccumulator_1;
	case 0x4a: opstr = lc ? "lsr" : "LSR"; goto Laccumulator_1;
	case 0x6a: opstr = lc ? "ror" : "ROR"; goto Laccumulator_1;

	/* absolute $%02x%02x */
	case 0xd: opstr = lc ? "ora" : "ORA"; goto Labsolute_3;
	case 0xe: opstr = lc ? "asl" : "ASL"; goto Labsolute_3;
	case 0x20: opstr = lc ? "jsr" : "JSR"; goto Labsolute_3;
	case 0x2c: opstr = lc ? "bit" : "BIT"; goto Labsolute_3;
	case 0x2d: opstr = lc ? "and" : "AND"; goto Labsolute_3;
	case 0x2e: opstr = lc ? "rol" : "ROL"; goto Labsolute_3;
	case 0x4c: opstr = lc ? "jmp" : "JMP"; goto Labsolute_3;
	case 0x4d: opstr = lc ? "eor" : "EOR"; goto Labsolute_3;
	case 0x4e: opstr = lc ? "lsr" : "LSR"; goto Labsolute_3;
	case 0x6d: opstr = lc ? "adc" : "ADC"; goto Labsolute_3;
	case 0x6e: opstr = lc ? "ror" : "ROR"; goto Labsolute_3;
	case 0x8c: opstr = lc ? "sty" : "STY"; goto Labsolute_3;
	case 0x8d: opstr = lc ? "sta" : "STA"; goto Labsolute_3;
	case 0x8e: opstr = lc ? "stx" : "STX"; goto Labsolute_3;
	case 0xac: opstr = lc ? "ldy" : "LDY"; goto Labsolute_3;
	case 0xad: opstr = lc ? "lda" : "LDA"; goto Labsolute_3;
	case 0xae: opstr = lc ? "ldx" : "LDX"; goto Labsolute_3;
	case 0xcc: opstr = lc ? "cpy" : "CPY"; goto Labsolute_3;
	case 0xcd: opstr = lc ? "cmp" : "CMP"; goto Labsolute_3;
	case 0xce: opstr = lc ? "dec" : "DEC"; goto Labsolute_3;
	case 0xec: opstr = lc ? "cpx" : "CPX"; goto Labsolute_3;
	case 0xed: opstr = lc ? "sbc" : "SBC"; goto Labsolute_3;
	case 0xee: opstr = lc ? "inc" : "INC"; goto Labsolute_3;

	/* relative $%04x */
	case 0x10: opstr = lc ? "bpl" : "BPL"; goto Lrelative_2;
	case 0x30: opstr = lc ? "bmi" : "BMI"; goto Lrelative_2;
	case 0x50: opstr = lc ? "bvc" : "BVC"; goto Lrelative_2;
	case 0x70: opstr = lc ? "bvs" : "BVS"; goto Lrelative_2;
	case 0x90: opstr = lc ? "bcc" : "BCC"; goto Lrelative_2;
	case 0xb0: opstr = lc ? "bcs" : "BCS"; goto Lrelative_2;
	case 0xd0: opstr = lc ? "bne" : "BNE"; goto Lrelative_2;
	case 0xf0: opstr = lc ? "beq" : "BEQ"; goto Lrelative_2;

	/* indirecty ($%02x),y */
	case 0x11: opstr = lc ? "ora" : "ORA"; goto Lindirecty_2;
	case 0x31: opstr = lc ? "and" : "AND"; goto Lindirecty_2;
	case 0x51: opstr = lc ? "eor" : "EOR"; goto Lindirecty_2;
	case 0x71: opstr = lc ? "adc" : "ADC"; goto Lindirecty_2;
	case 0x91: opstr = lc ? "sta" : "STA"; goto Lindirecty_2;
	case 0xb1: opstr = lc ? "lda" : "LDA"; goto Lindirecty_2;
	case 0xd1: opstr = lc ? "cmp" : "CMP"; goto Lindirecty_2;
	case 0xf1: opstr = lc ? "sbc" : "SBC"; goto Lindirecty_2;

	/* zeropagex $%02x,x */
	case 0x15: opstr = lc ? "ora" : "ORA"; goto Lzeropagex_2;
	case 0x16: opstr = lc ? "asl" : "ASL"; goto Lzeropagex_2;
	case 0x35: opstr = lc ? "and" : "AND"; goto Lzeropagex_2;
	case 0x36: opstr = lc ? "rol" : "ROL"; goto Lzeropagex_2;
	case 0x55: opstr = lc ? "eor" : "EOR"; goto Lzeropagex_2;
	case 0x56: opstr = lc ? "lsr" : "LSR"; goto Lzeropagex_2;
	case 0x75: opstr = lc ? "adc" : "ADC"; goto Lzeropagex_2;
	case 0x76: opstr = lc ? "ror" : "ROR"; goto Lzeropagex_2;
	case 0x94: opstr = lc ? "sty" : "STY"; goto Lzeropagex_2;
	case 0x95: opstr = lc ? "sta" : "STA"; goto Lzeropagex_2;
	case 0xb4: opstr = lc ? "ldy" : "LDY"; goto Lzeropagex_2;
	case 0xb5: opstr = lc ? "lda" : "LDA"; goto Lzeropagex_2;
	case 0xd5: opstr = lc ? "cmp" : "CMP"; goto Lzeropagex_2;
	case 0xd6: opstr = lc ? "dec" : "DEC"; goto Lzeropagex_2;
	case 0xf5: opstr = lc ? "sbc" : "SBC"; goto Lzeropagex_2;
	case 0xf6: opstr = lc ? "inc" : "INC"; goto Lzeropagex_2;

	/* absolutey $%02x%02x,y */
	case 0x19: opstr = lc ? "ora" : "ORA"; goto Labsolutey_3;
	case 0x39: opstr = lc ? "and" : "AND"; goto Labsolutey_3;
	case 0x59: opstr = lc ? "eor" : "EOR"; goto Labsolutey_3;
	case 0x79: opstr = lc ? "adc" : "ADC"; goto Labsolutey_3;
	case 0x99: opstr = lc ? "sta" : "STA"; goto Labsolutey_3;
	case 0xb9: opstr = lc ? "lda" : "LDA"; goto Labsolutey_3;
	case 0xbe: opstr = lc ? "ldx" : "LDX"; goto Labsolutey_3;
	case 0xd9: opstr = lc ? "cmp" : "CMP"; goto Labsolutey_3;
	case 0xf9: opstr = lc ? "sbc" : "SBC"; goto Labsolutey_3;

	/* absolutex $%02x%02x,x */
	case 0x1d: opstr = lc ? "ora" : "ORA"; goto Labsolutex_3;
	case 0x1e: opstr = lc ? "asl" : "ASL"; goto Labsolutex_3;
	case 0x3d: opstr = lc ? "and" : "AND"; goto Labsolutex_3;
	case 0x3e: opstr = lc ? "rol" : "ROL"; goto Labsolutex_3;
	case 0x5d: opstr = lc ? "eor" : "EOR"; goto Labsolutex_3;
	case 0x5e: opstr = lc ? "lsr" : "LSR"; goto Labsolutex_3;
	case 0x7d: opstr = lc ? "adc" : "ADC"; goto Labsolutex_3;
	case 0x7e: opstr = lc ? "ror" : "ROR"; goto Labsolutex_3;
	case 0x9d: opstr = lc ? "sta" : "STA"; goto Labsolutex_3;
	case 0xbc: opstr = lc ? "ldy" : "LDY"; goto Labsolutex_3;
	case 0xbd: opstr = lc ? "lda" : "LDA"; goto Labsolutex_3;
	case 0xdd: opstr = lc ? "cmp" : "CMP"; goto Labsolutex_3;
	case 0xde: opstr = lc ? "dec" : "DEC"; goto Labsolutex_3;
	case 0xfd: opstr = lc ? "sbc" : "SBC"; goto Labsolutex_3;
	case 0xfe: opstr = lc ? "inc" : "INC"; goto Labsolutex_3;

	/* indirect ($%02x%02x) */
	case 0x6c: opstr = lc ? "jmp" : "JMP"; goto Lindirect_3;

	/* zeropagey $%02x,y */
	case 0x96: opstr = lc ? "stx" : "STX"; goto Lzeropagey_2;
	case 0xb6: opstr = lc ? "ldx" : "LDX"; goto Lzeropagey_2;

	default:
		h = &hexdigits[(opcode & 0xff)*2]; *t++=*h++; *t++=*h++;
		goto last;
	}
Limplicit_1: /*  [] */
	do {*t++ = *opstr++;} while (*opstr);
	goto last;
Lindirectx_2: /* ($%02x,x) ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ',*t++='(';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='x';
	else *t++='X';
	*t++=')';
	goto last;
Lzeropage_2: /* $%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Limmediate_2: /* #$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	goto last;
Laccumulator_1: /* a [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	goto last;
Labsolute_3: /* $%02x%02x ['op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	addr = op1 + 256 * op2;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	goto last;
Lrelative_2: /* $%04x ['rel'] */
	do {*t++ = *opstr++;} while (*opstr);
	dist = entry->instruction[1];
	if (dist > 127) dist -= 256;
	rel = (entry->pc + 2 + dist) & 0xffff;
	*t++=' ';
	t += print_label_or_addr(rel, jmp_targets, t, hexdigits, 0);
	goto last;
Lindirecty_2: /* ($%02x),y ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ',*t++='(';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=')',*t++=',';
	if (lc) *t++='y';
	else *t++='Y';
	goto last;
Lzeropagex_2: /* $%02x,x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='x';
	else *t++='X';
	goto last;
Labsolutey_3: /* $%02x%02x,y ['op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	addr = op1 + 256 * op2;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	*t++=',';
	if (lc) *t++='y';
	else *t++='Y';
	goto last;
Labsolutex_3: /* $%02x%02x,x ['op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	addr = op1 + 256 * op2;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	*t++=',';
	if (lc) *t++='x';
	else *t++='X';
	goto last;
Lindirect_3: /* ($%02x%02x) ['op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ',*t++='(';
	addr = op1 + 256 * op2;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	*t++=')';
	goto last;
Lzeropagey_2: /* $%02x,y ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='y';
	else *t++='Y';
	goto last;

last:
	return (int)(t - first_t);
}

int stringify_entry_6502undoc(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets) {
	int dist;
	unsigned char opcode, leadin, op1, op2, op3;
	char *first_t, *h, *opstr;
	unsigned short rel, addr;

	first_t = t;
	opcode = entry->instruction[0];
	switch(opcode) {
	/* implicit  (undocumented) */
	case 0x2: opstr = lc ? "hlt" : "HLT"; goto Limplicit_1;
	case 0x12: opstr = lc ? "hlt" : "HLT"; goto Limplicit_1;
	case 0x1a: opstr = lc ? "nop" : "NOP"; goto Limplicit_1;
	case 0x22: opstr = lc ? "hlt" : "HLT"; goto Limplicit_1;
	case 0x32: opstr = lc ? "hlt" : "HLT"; goto Limplicit_1;
	case 0x3a: opstr = lc ? "nop" : "NOP"; goto Limplicit_1;
	case 0x42: opstr = lc ? "hlt" : "HLT"; goto Limplicit_1;
	case 0x52: opstr = lc ? "hlt" : "HLT"; goto Limplicit_1;
	case 0x5a: opstr = lc ? "nop" : "NOP"; goto Limplicit_1;
	case 0x62: opstr = lc ? "hlt" : "HLT"; goto Limplicit_1;
	case 0x72: opstr = lc ? "hlt" : "HLT"; goto Limplicit_1;
	case 0x7a: opstr = lc ? "nop" : "NOP"; goto Limplicit_1;
	case 0x92: opstr = lc ? "hlt" : "HLT"; goto Limplicit_1;
	case 0xb2: opstr = lc ? "hlt" : "HLT"; goto Limplicit_1;
	case 0xd2: opstr = lc ? "hlt" : "HLT"; goto Limplicit_1;
	case 0xda: opstr = lc ? "nop" : "NOP"; goto Limplicit_1;
	case 0xf2: opstr = lc ? "hlt" : "HLT"; goto Limplicit_1;
	case 0xfa: opstr = lc ? "nop" : "NOP"; goto Limplicit_1;

	/* indirectx ($%02x,x) (undocumented) */
	case 0x3: opstr = lc ? "slo" : "SLO"; goto Lindirectx_2;
	case 0x43: opstr = lc ? "sre" : "SRE"; goto Lindirectx_2;
	case 0x63: opstr = lc ? "rra" : "RRA"; goto Lindirectx_2;
	case 0x83: opstr = lc ? "sax" : "SAX"; goto Lindirectx_2;
	case 0xa3: opstr = lc ? "lax" : "LAX"; goto Lindirectx_2;
	case 0xc3: opstr = lc ? "dcp" : "DCP"; goto Lindirectx_2;
	case 0xe3: opstr = lc ? "isc" : "ISC"; goto Lindirectx_2;

	/* zeropage $%02x (undocumented) */
	case 0x4: opstr = lc ? "nop" : "NOP"; goto Lzeropage_2;
	case 0x7: opstr = lc ? "slo" : "SLO"; goto Lzeropage_2;
	case 0x27: opstr = lc ? "rla" : "RLA"; goto Lzeropage_2;
	case 0x44: opstr = lc ? "nop" : "NOP"; goto Lzeropage_2;
	case 0x47: opstr = lc ? "sre" : "SRE"; goto Lzeropage_2;
	case 0x64: opstr = lc ? "nop" : "NOP"; goto Lzeropage_2;
	case 0x67: opstr = lc ? "rra" : "RRA"; goto Lzeropage_2;
	case 0x87: opstr = lc ? "sax" : "SAX"; goto Lzeropage_2;
	case 0xa7: opstr = lc ? "lax" : "LAX"; goto Lzeropage_2;
	case 0xc7: opstr = lc ? "dcp" : "DCP"; goto Lzeropage_2;
	case 0xe7: opstr = lc ? "isc" : "ISC"; goto Lzeropage_2;

	/* immediate #$%02x (undocumented) */
	case 0xb: opstr = lc ? "anc" : "ANC"; goto Limmediate_2;
	case 0x2b: opstr = lc ? "anc" : "ANC"; goto Limmediate_2;
	case 0x4b: opstr = lc ? "alr" : "ALR"; goto Limmediate_2;
	case 0x6b: opstr = lc ? "arr" : "ARR"; goto Limmediate_2;
	case 0x80: opstr = lc ? "nop" : "NOP"; goto Limmediate_2;
	case 0x82: opstr = lc ? "nop" : "NOP"; goto Limmediate_2;
	case 0x89: opstr = lc ? "nop" : "NOP"; goto Limmediate_2;
	case 0x8b: opstr = lc ? "xaa" : "XAA"; goto Limmediate_2;
	case 0xab: opstr = lc ? "atx" : "ATX"; goto Limmediate_2;
	case 0xc2: opstr = lc ? "nop" : "NOP"; goto Limmediate_2;
	case 0xcb: opstr = lc ? "sbx" : "SBX"; goto Limmediate_2;
	case 0xe2: opstr = lc ? "nop" : "NOP"; goto Limmediate_2;
	case 0xeb: opstr = lc ? "sbc" : "SBC"; goto Limmediate_2;

	/* absolute $%02x%02x (undocumented) */
	case 0xc: opstr = lc ? "nop" : "NOP"; goto Labsolute_3;
	case 0xf: opstr = lc ? "slo" : "SLO"; goto Labsolute_3;
	case 0x2f: opstr = lc ? "rla" : "RLA"; goto Labsolute_3;
	case 0x4f: opstr = lc ? "sre" : "SRE"; goto Labsolute_3;
	case 0x6f: opstr = lc ? "rra" : "RRA"; goto Labsolute_3;
	case 0x8f: opstr = lc ? "sax" : "SAX"; goto Labsolute_3;
	case 0xaf: opstr = lc ? "lax" : "LAX"; goto Labsolute_3;
	case 0xcf: opstr = lc ? "dcp" : "DCP"; goto Labsolute_3;
	case 0xef: opstr = lc ? "isc" : "ISC"; goto Labsolute_3;

	/* indirecty ($%02x),y (undocumented) */
	case 0x13: opstr = lc ? "slo" : "SLO"; goto Lindirecty_2;
	case 0x23: opstr = lc ? "rla" : "RLA"; goto Lindirecty_2;
	case 0x53: opstr = lc ? "sre" : "SRE"; goto Lindirecty_2;
	case 0x73: opstr = lc ? "rra" : "RRA"; goto Lindirecty_2;
	case 0x93: opstr = lc ? "sha" : "SHA"; goto Lindirecty_2;
	case 0xb3: opstr = lc ? "lax" : "LAX"; goto Lindirecty_2;
	case 0xd3: opstr = lc ? "dcp" : "DCP"; goto Lindirecty_2;
	case 0xf3: opstr = lc ? "isc" : "ISC"; goto Lindirecty_2;

	/* zeropagex $%02x,x (undocumented) */
	case 0x14: opstr = lc ? "nop" : "NOP"; goto Lzeropagex_2;
	case 0x17: opstr = lc ? "slo" : "SLO"; goto Lzeropagex_2;
	case 0x34: opstr = lc ? "nop" : "NOP"; goto Lzeropagex_2;
	case 0x37: opstr = lc ? "rla" : "RLA"; goto Lzeropagex_2;
	case 0x54: opstr = lc ? "nop" : "NOP"; goto Lzeropagex_2;
	case 0x57: opstr = lc ? "sre" : "SRE"; goto Lzeropagex_2;
	case 0x74: opstr = lc ? "nop" : "NOP"; goto Lzeropagex_2;
	case 0x77: opstr = lc ? "rra" : "RRA"; goto Lzeropagex_2;
	case 0xd4: opstr = lc ? "nop" : "NOP"; goto Lzeropagex_2;
	case 0xd7: opstr = lc ? "dcp" : "DCP"; goto Lzeropagex_2;
	case 0xf4: opstr = lc ? "nop" : "NOP"; goto Lzeropagex_2;
	case 0xf7: opstr = lc ? "isc" : "ISC"; goto Lzeropagex_2;

	/* absolutey $%02x%02x,y (undocumented) */
	case 0x1b: opstr = lc ? "slo" : "SLO"; goto Labsolutey_3;
	case 0x3b: opstr = lc ? "rla" : "RLA"; goto Labsolutey_3;
	case 0x5b: opstr = lc ? "sre" : "SRE"; goto Labsolutey_3;
	case 0x7b: opstr = lc ? "rra" : "RRA"; goto Labsolutey_3;
	case 0x9b: opstr = lc ? "shs" : "SHS"; goto Labsolutey_3;
	case 0x9e: opstr = lc ? "shx" : "SHX"; goto Labsolutey_3;
	case 0x9f: opstr = lc ? "sha" : "SHA"; goto Labsolutey_3;
	case 0xbb: opstr = lc ? "lar" : "LAR"; goto Labsolutey_3;
	case 0xbf: opstr = lc ? "lax" : "LAX"; goto Labsolutey_3;
	case 0xdb: opstr = lc ? "dcp" : "DCP"; goto Labsolutey_3;
	case 0xfb: opstr = lc ? "isc" : "ISC"; goto Labsolutey_3;

	/* absolutex $%02x%02x,x (undocumented) */
	case 0x1c: opstr = lc ? "nop" : "NOP"; goto Labsolutex_3;
	case 0x1f: opstr = lc ? "slo" : "SLO"; goto Labsolutex_3;
	case 0x3c: opstr = lc ? "nop" : "NOP"; goto Labsolutex_3;
	case 0x3f: opstr = lc ? "rla" : "RLA"; goto Labsolutex_3;
	case 0x5c: opstr = lc ? "nop" : "NOP"; goto Labsolutex_3;
	case 0x5f: opstr = lc ? "sre" : "SRE"; goto Labsolutex_3;
	case 0x7c: opstr = lc ? "nop" : "NOP"; goto Labsolutex_3;
	case 0x7f: opstr = lc ? "rra" : "RRA"; goto Labsolutex_3;
	case 0x9c: opstr = lc ? "shy" : "SHY"; goto Labsolutex_3;
	case 0xdc: opstr = lc ? "nop" : "NOP"; goto Labsolutex_3;
	case 0xdf: opstr = lc ? "dcp" : "DCP"; goto Labsolutex_3;
	case 0xfc: opstr = lc ? "nop" : "NOP"; goto Labsolutex_3;
	case 0xff: opstr = lc ? "isc" : "ISC"; goto Labsolutex_3;

	/* zeropagey $%02x,y (undocumented) */
	case 0x97: opstr = lc ? "sax" : "SAX"; goto Lzeropagey_2;
	case 0xb7: opstr = lc ? "lax" : "LAX"; goto Lzeropagey_2;

	default:
		h = &hexdigits[(opcode & 0xff)*2]; *t++=*h++; *t++=*h++;
		goto last;
	}
Limplicit_1: /*  [] */
	do {*t++ = *opstr++;} while (*opstr);
	goto last;
Lindirectx_2: /* ($%02x,x) ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ',*t++='(';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='x';
	else *t++='X';
	*t++=')';
	goto last;
Lzeropage_2: /* $%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Limmediate_2: /* #$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	goto last;
Labsolute_3: /* $%02x%02x ['op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	addr = op1 + 256 * op2;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	goto last;
Lindirecty_2: /* ($%02x),y ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ',*t++='(';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=')',*t++=',';
	if (lc) *t++='y';
	else *t++='Y';
	goto last;
Lzeropagex_2: /* $%02x,x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='x';
	else *t++='X';
	goto last;
Labsolutey_3: /* $%02x%02x,y ['op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	addr = op1 + 256 * op2;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	*t++=',';
	if (lc) *t++='y';
	else *t++='Y';
	goto last;
Labsolutex_3: /* $%02x%02x,x ['op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	addr = op1 + 256 * op2;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	*t++=',';
	if (lc) *t++='x';
	else *t++='X';
	goto last;
Lzeropagey_2: /* $%02x,y ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='y';
	else *t++='Y';
	goto last;

last:
	return (int)(t - first_t);
}

int stringify_entry_65816(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets) {
	int dist;
	unsigned char opcode, leadin, op1, op2, op3;
	char *first_t, *h, *opstr;
	unsigned short rel, addr;

	first_t = t;
	opcode = entry->instruction[0];
	switch(opcode) {
	/* implicit  */
	case 0x0: opstr = lc ? "brk" : "BRK"; goto Limplicit_1;
	case 0x8: opstr = lc ? "php" : "PHP"; goto Limplicit_1;
	case 0xb: opstr = lc ? "phd" : "PHD"; goto Limplicit_1;
	case 0x18: opstr = lc ? "clc" : "CLC"; goto Limplicit_1;
	case 0x1b: opstr = lc ? "tcs" : "TCS"; goto Limplicit_1;
	case 0x28: opstr = lc ? "plp" : "PLP"; goto Limplicit_1;
	case 0x2b: opstr = lc ? "pld" : "PLD"; goto Limplicit_1;
	case 0x38: opstr = lc ? "sec" : "SEC"; goto Limplicit_1;
	case 0x3b: opstr = lc ? "tsc" : "TSC"; goto Limplicit_1;
	case 0x40: opstr = lc ? "rti" : "RTI"; goto Limplicit_1;
	case 0x48: opstr = lc ? "pha" : "PHA"; goto Limplicit_1;
	case 0x4b: opstr = lc ? "phk" : "PHK"; goto Limplicit_1;
	case 0x58: opstr = lc ? "cli" : "CLI"; goto Limplicit_1;
	case 0x5a: opstr = lc ? "phy" : "PHY"; goto Limplicit_1;
	case 0x5b: opstr = lc ? "tcd" : "TCD"; goto Limplicit_1;
	case 0x60: opstr = lc ? "rts" : "RTS"; goto Limplicit_1;
	case 0x68: opstr = lc ? "pla" : "PLA"; goto Limplicit_1;
	case 0x6b: opstr = lc ? "rtl" : "RTL"; goto Limplicit_1;
	case 0x78: opstr = lc ? "sei" : "SEI"; goto Limplicit_1;
	case 0x7a: opstr = lc ? "ply" : "PLY"; goto Limplicit_1;
	case 0x7b: opstr = lc ? "tdc" : "TDC"; goto Limplicit_1;
	case 0x88: opstr = lc ? "dey" : "DEY"; goto Limplicit_1;
	case 0x8a: opstr = lc ? "txa" : "TXA"; goto Limplicit_1;
	case 0x8b: opstr = lc ? "phb" : "PHB"; goto Limplicit_1;
	case 0x98: opstr = lc ? "tya" : "TYA"; goto Limplicit_1;
	case 0x9a: opstr = lc ? "txs" : "TXS"; goto Limplicit_1;
	case 0x9b: opstr = lc ? "txy" : "TXY"; goto Limplicit_1;
	case 0xa8: opstr = lc ? "tay" : "TAY"; goto Limplicit_1;
	case 0xaa: opstr = lc ? "tax" : "TAX"; goto Limplicit_1;
	case 0xab: opstr = lc ? "plb" : "PLB"; goto Limplicit_1;
	case 0xb8: opstr = lc ? "clv" : "CLV"; goto Limplicit_1;
	case 0xba: opstr = lc ? "tsx" : "TSX"; goto Limplicit_1;
	case 0xbb: opstr = lc ? "tyx" : "TYX"; goto Limplicit_1;
	case 0xc8: opstr = lc ? "iny" : "INY"; goto Limplicit_1;
	case 0xca: opstr = lc ? "dex" : "DEX"; goto Limplicit_1;
	case 0xcb: opstr = lc ? "wai" : "WAI"; goto Limplicit_1;
	case 0xd8: opstr = lc ? "cld" : "CLD"; goto Limplicit_1;
	case 0xda: opstr = lc ? "phx" : "PHX"; goto Limplicit_1;
	case 0xdb: opstr = lc ? "stp" : "STP"; goto Limplicit_1;
	case 0xe8: opstr = lc ? "inx" : "INX"; goto Limplicit_1;
	case 0xea: opstr = lc ? "nop" : "NOP"; goto Limplicit_1;
	case 0xeb: opstr = lc ? "xba" : "XBA"; goto Limplicit_1;
	case 0xf8: opstr = lc ? "sed" : "SED"; goto Limplicit_1;
	case 0xfa: opstr = lc ? "plx" : "PLX"; goto Limplicit_1;
	case 0xfb: opstr = lc ? "xce" : "XCE"; goto Limplicit_1;

	/* indirectx ($%02x,x) */
	case 0x1: opstr = lc ? "ora" : "ORA"; goto Lindirectx_2;
	case 0x21: opstr = lc ? "and" : "AND"; goto Lindirectx_2;
	case 0x41: opstr = lc ? "eor" : "EOR"; goto Lindirectx_2;
	case 0x61: opstr = lc ? "adc" : "ADC"; goto Lindirectx_2;
	case 0x81: opstr = lc ? "sta" : "STA"; goto Lindirectx_2;
	case 0xa1: opstr = lc ? "lda" : "LDA"; goto Lindirectx_2;
	case 0xc1: opstr = lc ? "cmp" : "CMP"; goto Lindirectx_2;
	case 0xe1: opstr = lc ? "sbc" : "SBC"; goto Lindirectx_2;

	/* zeropage $%02x */
	case 0x2: opstr = lc ? "cop" : "COP"; goto Lzeropage_2;
	case 0x4: opstr = lc ? "tsb" : "TSB"; goto Lzeropage_2;
	case 0x5: opstr = lc ? "ora" : "ORA"; goto Lzeropage_2;
	case 0x6: opstr = lc ? "asl" : "ASL"; goto Lzeropage_2;
	case 0x14: opstr = lc ? "trb" : "TRB"; goto Lzeropage_2;
	case 0x24: opstr = lc ? "bit" : "BIT"; goto Lzeropage_2;
	case 0x25: opstr = lc ? "and" : "AND"; goto Lzeropage_2;
	case 0x26: opstr = lc ? "rol" : "ROL"; goto Lzeropage_2;
	case 0x42: opstr = lc ? "wdm" : "WDM"; goto Lzeropage_2;
	case 0x45: opstr = lc ? "eor" : "EOR"; goto Lzeropage_2;
	case 0x46: opstr = lc ? "lsr" : "LSR"; goto Lzeropage_2;
	case 0x64: opstr = lc ? "stz" : "STZ"; goto Lzeropage_2;
	case 0x65: opstr = lc ? "adc" : "ADC"; goto Lzeropage_2;
	case 0x66: opstr = lc ? "ror" : "ROR"; goto Lzeropage_2;
	case 0x84: opstr = lc ? "sty" : "STY"; goto Lzeropage_2;
	case 0x85: opstr = lc ? "sta" : "STA"; goto Lzeropage_2;
	case 0x86: opstr = lc ? "stx" : "STX"; goto Lzeropage_2;
	case 0xa4: opstr = lc ? "ldy" : "LDY"; goto Lzeropage_2;
	case 0xa5: opstr = lc ? "lda" : "LDA"; goto Lzeropage_2;
	case 0xa6: opstr = lc ? "ldx" : "LDX"; goto Lzeropage_2;
	case 0xc4: opstr = lc ? "cpy" : "CPY"; goto Lzeropage_2;
	case 0xc5: opstr = lc ? "cmp" : "CMP"; goto Lzeropage_2;
	case 0xc6: opstr = lc ? "dec" : "DEC"; goto Lzeropage_2;
	case 0xe4: opstr = lc ? "cpx" : "CPX"; goto Lzeropage_2;
	case 0xe5: opstr = lc ? "sbc" : "SBC"; goto Lzeropage_2;
	case 0xe6: opstr = lc ? "inc" : "INC"; goto Lzeropage_2;

	/* stackrelative $%02x,s */
	case 0x3: opstr = lc ? "ora" : "ORA"; goto Lstackrelative_2;
	case 0x23: opstr = lc ? "and" : "AND"; goto Lstackrelative_2;
	case 0x43: opstr = lc ? "eor" : "EOR"; goto Lstackrelative_2;
	case 0x63: opstr = lc ? "adc" : "ADC"; goto Lstackrelative_2;
	case 0x83: opstr = lc ? "sta" : "STA"; goto Lstackrelative_2;
	case 0xa3: opstr = lc ? "lda" : "LDA"; goto Lstackrelative_2;
	case 0xc3: opstr = lc ? "cmp" : "CMP"; goto Lstackrelative_2;
	case 0xe3: opstr = lc ? "sbc" : "SBC"; goto Lstackrelative_2;

	/* directpageindirectlong [$%02x] */
	case 0x7: opstr = lc ? "ora" : "ORA"; goto Ldirectpageindirectlong_2;
	case 0x27: opstr = lc ? "and" : "AND"; goto Ldirectpageindirectlong_2;
	case 0x47: opstr = lc ? "eor" : "EOR"; goto Ldirectpageindirectlong_2;
	case 0x67: opstr = lc ? "adc" : "ADC"; goto Ldirectpageindirectlong_2;
	case 0x87: opstr = lc ? "sta" : "STA"; goto Ldirectpageindirectlong_2;
	case 0xa7: opstr = lc ? "lda" : "LDA"; goto Ldirectpageindirectlong_2;
	case 0xc7: opstr = lc ? "cmp" : "CMP"; goto Ldirectpageindirectlong_2;
	case 0xe7: opstr = lc ? "sbc" : "SBC"; goto Ldirectpageindirectlong_2;

	/* immediate #$%02x */
	case 0x9: opstr = lc ? "ora" : "ORA"; goto Limmediate_2;
	case 0x29: opstr = lc ? "and" : "AND"; goto Limmediate_2;
	case 0x49: opstr = lc ? "eor" : "EOR"; goto Limmediate_2;
	case 0x69: opstr = lc ? "adc" : "ADC"; goto Limmediate_2;
	case 0x89: opstr = lc ? "bit" : "BIT"; goto Limmediate_2;
	case 0xa0: opstr = lc ? "ldy" : "LDY"; goto Limmediate_2;
	case 0xa2: opstr = lc ? "ldx" : "LDX"; goto Limmediate_2;
	case 0xa9: opstr = lc ? "lda" : "LDA"; goto Limmediate_2;
	case 0xc0: opstr = lc ? "cpy" : "CPY"; goto Limmediate_2;
	case 0xc2: opstr = lc ? "rep" : "REP"; goto Limmediate_2;
	case 0xc9: opstr = lc ? "cmp" : "CMP"; goto Limmediate_2;
	case 0xe0: opstr = lc ? "cpx" : "CPX"; goto Limmediate_2;
	case 0xe2: opstr = lc ? "sep" : "SEP"; goto Limmediate_2;
	case 0xe9: opstr = lc ? "sbc" : "SBC"; goto Limmediate_2;

	/* accumulator a */
	case 0xa: opstr = lc ? "asl" : "ASL"; goto Laccumulator_1;
	case 0x1a: opstr = lc ? "inc" : "INC"; goto Laccumulator_1;
	case 0x2a: opstr = lc ? "rol" : "ROL"; goto Laccumulator_1;
	case 0x3a: opstr = lc ? "dec" : "DEC"; goto Laccumulator_1;
	case 0x4a: opstr = lc ? "lsr" : "LSR"; goto Laccumulator_1;
	case 0x6a: opstr = lc ? "ror" : "ROR"; goto Laccumulator_1;

	/* absolute $%02x%02x */
	case 0xc: opstr = lc ? "tsb" : "TSB"; goto Labsolute_3;
	case 0xd: opstr = lc ? "ora" : "ORA"; goto Labsolute_3;
	case 0xe: opstr = lc ? "asl" : "ASL"; goto Labsolute_3;
	case 0x1c: opstr = lc ? "trb" : "TRB"; goto Labsolute_3;
	case 0x20: opstr = lc ? "jsr" : "JSR"; goto Labsolute_3;
	case 0x2c: opstr = lc ? "bit" : "BIT"; goto Labsolute_3;
	case 0x2d: opstr = lc ? "and" : "AND"; goto Labsolute_3;
	case 0x2e: opstr = lc ? "rol" : "ROL"; goto Labsolute_3;
	case 0x4c: opstr = lc ? "jmp" : "JMP"; goto Labsolute_3;
	case 0x4d: opstr = lc ? "eor" : "EOR"; goto Labsolute_3;
	case 0x4e: opstr = lc ? "lsr" : "LSR"; goto Labsolute_3;
	case 0x62: opstr = lc ? "per" : "PER"; goto Labsolute_3;
	case 0x6d: opstr = lc ? "adc" : "ADC"; goto Labsolute_3;
	case 0x6e: opstr = lc ? "ror" : "ROR"; goto Labsolute_3;
	case 0x8c: opstr = lc ? "sty" : "STY"; goto Labsolute_3;
	case 0x8d: opstr = lc ? "sta" : "STA"; goto Labsolute_3;
	case 0x8e: opstr = lc ? "stx" : "STX"; goto Labsolute_3;
	case 0x9c: opstr = lc ? "stz" : "STZ"; goto Labsolute_3;
	case 0xac: opstr = lc ? "ldy" : "LDY"; goto Labsolute_3;
	case 0xad: opstr = lc ? "lda" : "LDA"; goto Labsolute_3;
	case 0xae: opstr = lc ? "ldx" : "LDX"; goto Labsolute_3;
	case 0xcc: opstr = lc ? "cpy" : "CPY"; goto Labsolute_3;
	case 0xcd: opstr = lc ? "cmp" : "CMP"; goto Labsolute_3;
	case 0xce: opstr = lc ? "dec" : "DEC"; goto Labsolute_3;
	case 0xec: opstr = lc ? "cpx" : "CPX"; goto Labsolute_3;
	case 0xed: opstr = lc ? "sbc" : "SBC"; goto Labsolute_3;
	case 0xee: opstr = lc ? "inc" : "INC"; goto Labsolute_3;
	case 0xf4: opstr = lc ? "pea" : "PEA"; goto Labsolute_3;

	/* absolutelong $%02x%02x%02x */
	case 0xf: opstr = lc ? "ora" : "ORA"; goto Labsolutelong_4;
	case 0x22: opstr = lc ? "jsr" : "JSR"; goto Labsolutelong_4;
	case 0x2f: opstr = lc ? "and" : "AND"; goto Labsolutelong_4;
	case 0x4f: opstr = lc ? "eor" : "EOR"; goto Labsolutelong_4;
	case 0x5c: opstr = lc ? "jmp" : "JMP"; goto Labsolutelong_4;
	case 0x6f: opstr = lc ? "adc" : "ADC"; goto Labsolutelong_4;
	case 0x8f: opstr = lc ? "sta" : "STA"; goto Labsolutelong_4;
	case 0xaf: opstr = lc ? "lda" : "LDA"; goto Labsolutelong_4;
	case 0xcf: opstr = lc ? "cmp" : "CMP"; goto Labsolutelong_4;
	case 0xef: opstr = lc ? "sbc" : "SBC"; goto Labsolutelong_4;

	/* relative $%04x */
	case 0x10: opstr = lc ? "bpl" : "BPL"; goto Lrelative_2;
	case 0x30: opstr = lc ? "bmi" : "BMI"; goto Lrelative_2;
	case 0x50: opstr = lc ? "bvc" : "BVC"; goto Lrelative_2;
	case 0x70: opstr = lc ? "bvs" : "BVS"; goto Lrelative_2;
	case 0x80: opstr = lc ? "bra" : "BRA"; goto Lrelative_2;
	case 0x90: opstr = lc ? "bcc" : "BCC"; goto Lrelative_2;
	case 0xb0: opstr = lc ? "bcs" : "BCS"; goto Lrelative_2;
	case 0xd0: opstr = lc ? "bne" : "BNE"; goto Lrelative_2;
	case 0xf0: opstr = lc ? "beq" : "BEQ"; goto Lrelative_2;

	/* indirecty ($%02x),y */
	case 0x11: opstr = lc ? "ora" : "ORA"; goto Lindirecty_2;
	case 0x31: opstr = lc ? "and" : "AND"; goto Lindirecty_2;
	case 0x51: opstr = lc ? "eor" : "EOR"; goto Lindirecty_2;
	case 0x71: opstr = lc ? "adc" : "ADC"; goto Lindirecty_2;
	case 0x91: opstr = lc ? "sta" : "STA"; goto Lindirecty_2;
	case 0xb1: opstr = lc ? "lda" : "LDA"; goto Lindirecty_2;
	case 0xd1: opstr = lc ? "cmp" : "CMP"; goto Lindirecty_2;
	case 0xf1: opstr = lc ? "sbc" : "SBC"; goto Lindirecty_2;

	/* indirectzeropage ($%02x) */
	case 0x12: opstr = lc ? "ora" : "ORA"; goto Lindirectzeropage_2;
	case 0x32: opstr = lc ? "and" : "AND"; goto Lindirectzeropage_2;
	case 0x52: opstr = lc ? "eor" : "EOR"; goto Lindirectzeropage_2;
	case 0x72: opstr = lc ? "adc" : "ADC"; goto Lindirectzeropage_2;
	case 0x92: opstr = lc ? "sta" : "STA"; goto Lindirectzeropage_2;
	case 0xb2: opstr = lc ? "lda" : "LDA"; goto Lindirectzeropage_2;
	case 0xd2: opstr = lc ? "cmp" : "CMP"; goto Lindirectzeropage_2;
	case 0xf2: opstr = lc ? "sbc" : "SBC"; goto Lindirectzeropage_2;

	/* stackrelativeindirecty ($%02x,s),y */
	case 0x13: opstr = lc ? "ora" : "ORA"; goto Lstackrelativeindirecty_2;
	case 0x33: opstr = lc ? "and" : "AND"; goto Lstackrelativeindirecty_2;
	case 0x53: opstr = lc ? "eor" : "EOR"; goto Lstackrelativeindirecty_2;
	case 0x73: opstr = lc ? "adc" : "ADC"; goto Lstackrelativeindirecty_2;
	case 0x93: opstr = lc ? "sta" : "STA"; goto Lstackrelativeindirecty_2;
	case 0xb3: opstr = lc ? "lda" : "LDA"; goto Lstackrelativeindirecty_2;
	case 0xd3: opstr = lc ? "cmp" : "CMP"; goto Lstackrelativeindirecty_2;
	case 0xf3: opstr = lc ? "sbc" : "SBC"; goto Lstackrelativeindirecty_2;

	/* zeropagex $%02x,x */
	case 0x15: opstr = lc ? "ora" : "ORA"; goto Lzeropagex_2;
	case 0x16: opstr = lc ? "asl" : "ASL"; goto Lzeropagex_2;
	case 0x34: opstr = lc ? "bit" : "BIT"; goto Lzeropagex_2;
	case 0x35: opstr = lc ? "and" : "AND"; goto Lzeropagex_2;
	case 0x36: opstr = lc ? "rol" : "ROL"; goto Lzeropagex_2;
	case 0x55: opstr = lc ? "eor" : "EOR"; goto Lzeropagex_2;
	case 0x56: opstr = lc ? "lsr" : "LSR"; goto Lzeropagex_2;
	case 0x74: opstr = lc ? "stz" : "STZ"; goto Lzeropagex_2;
	case 0x75: opstr = lc ? "adc" : "ADC"; goto Lzeropagex_2;
	case 0x76: opstr = lc ? "ror" : "ROR"; goto Lzeropagex_2;
	case 0x94: opstr = lc ? "sty" : "STY"; goto Lzeropagex_2;
	case 0x95: opstr = lc ? "sta" : "STA"; goto Lzeropagex_2;
	case 0xb4: opstr = lc ? "ldy" : "LDY"; goto Lzeropagex_2;
	case 0xb5: opstr = lc ? "lda" : "LDA"; goto Lzeropagex_2;
	case 0xd5: opstr = lc ? "cmp" : "CMP"; goto Lzeropagex_2;
	case 0xd6: opstr = lc ? "dec" : "DEC"; goto Lzeropagex_2;
	case 0xf5: opstr = lc ? "sbc" : "SBC"; goto Lzeropagex_2;
	case 0xf6: opstr = lc ? "inc" : "INC"; goto Lzeropagex_2;

	/* directpageindirectlongy [$%02x],y */
	case 0x17: opstr = lc ? "ora" : "ORA"; goto Ldirectpageindirectlongy_2;
	case 0x37: opstr = lc ? "and" : "AND"; goto Ldirectpageindirectlongy_2;
	case 0x57: opstr = lc ? "eor" : "EOR"; goto Ldirectpageindirectlongy_2;
	case 0x77: opstr = lc ? "adc" : "ADC"; goto Ldirectpageindirectlongy_2;
	case 0x97: opstr = lc ? "sta" : "STA"; goto Ldirectpageindirectlongy_2;
	case 0xb7: opstr = lc ? "lda" : "LDA"; goto Ldirectpageindirectlongy_2;
	case 0xd7: opstr = lc ? "cmp" : "CMP"; goto Ldirectpageindirectlongy_2;
	case 0xf7: opstr = lc ? "sbc" : "SBC"; goto Ldirectpageindirectlongy_2;

	/* absolutey $%02x%02x,y */
	case 0x19: opstr = lc ? "ora" : "ORA"; goto Labsolutey_3;
	case 0x39: opstr = lc ? "and" : "AND"; goto Labsolutey_3;
	case 0x59: opstr = lc ? "eor" : "EOR"; goto Labsolutey_3;
	case 0x79: opstr = lc ? "adc" : "ADC"; goto Labsolutey_3;
	case 0x99: opstr = lc ? "sta" : "STA"; goto Labsolutey_3;
	case 0xb9: opstr = lc ? "lda" : "LDA"; goto Labsolutey_3;
	case 0xbe: opstr = lc ? "ldx" : "LDX"; goto Labsolutey_3;
	case 0xd9: opstr = lc ? "cmp" : "CMP"; goto Labsolutey_3;
	case 0xf9: opstr = lc ? "sbc" : "SBC"; goto Labsolutey_3;

	/* absolutex $%02x%02x,x */
	case 0x1d: opstr = lc ? "ora" : "ORA"; goto Labsolutex_3;
	case 0x1e: opstr = lc ? "asl" : "ASL"; goto Labsolutex_3;
	case 0x3c: opstr = lc ? "bit" : "BIT"; goto Labsolutex_3;
	case 0x3d: opstr = lc ? "and" : "AND"; goto Labsolutex_3;
	case 0x3e: opstr = lc ? "rol" : "ROL"; goto Labsolutex_3;
	case 0x5d: opstr = lc ? "eor" : "EOR"; goto Labsolutex_3;
	case 0x5e: opstr = lc ? "lsr" : "LSR"; goto Labsolutex_3;
	case 0x7d: opstr = lc ? "adc" : "ADC"; goto Labsolutex_3;
	case 0x7e: opstr = lc ? "ror" : "ROR"; goto Labsolutex_3;
	case 0x9d: opstr = lc ? "sta" : "STA"; goto Labsolutex_3;
	case 0x9e: opstr = lc ? "stz" : "STZ"; goto Labsolutex_3;
	case 0xbc: opstr = lc ? "ldy" : "LDY"; goto Labsolutex_3;
	case 0xbd: opstr = lc ? "lda" : "LDA"; goto Labsolutex_3;
	case 0xdd: opstr = lc ? "cmp" : "CMP"; goto Labsolutex_3;
	case 0xde: opstr = lc ? "dec" : "DEC"; goto Labsolutex_3;
	case 0xfd: opstr = lc ? "sbc" : "SBC"; goto Labsolutex_3;
	case 0xfe: opstr = lc ? "inc" : "INC"; goto Labsolutex_3;

	/* absolutelongx $%02x%02x%02x,x */
	case 0x1f: opstr = lc ? "ora" : "ORA"; goto Labsolutelongx_4;
	case 0x3f: opstr = lc ? "and" : "AND"; goto Labsolutelongx_4;
	case 0x5f: opstr = lc ? "eor" : "EOR"; goto Labsolutelongx_4;
	case 0x7f: opstr = lc ? "adc" : "ADC"; goto Labsolutelongx_4;
	case 0x9f: opstr = lc ? "sta" : "STA"; goto Labsolutelongx_4;
	case 0xbf: opstr = lc ? "lda" : "LDA"; goto Labsolutelongx_4;
	case 0xdf: opstr = lc ? "cmp" : "CMP"; goto Labsolutelongx_4;
	case 0xff: opstr = lc ? "sbc" : "SBC"; goto Labsolutelongx_4;

	/* blockmove $%02x,$%02x */
	case 0x44: opstr = lc ? "mvp" : "MVP"; goto Lblockmove_3;
	case 0x54: opstr = lc ? "mvn" : "MVN"; goto Lblockmove_3;

	/* indirect ($%02x%02x) */
	case 0x6c: opstr = lc ? "jmp" : "JMP"; goto Lindirect_3;

	/* absoluteindexedindirect ($%02x%02x,x) */
	case 0x7c: opstr = lc ? "jmp" : "JMP"; goto Labsoluteindexedindirect_3;

	/* relativelong $%04x */
	case 0x82: opstr = lc ? "brl" : "BRL"; goto Lrelativelong_3;

	/* zeropagey $%02x,y */
	case 0x96: opstr = lc ? "stx" : "STX"; goto Lzeropagey_2;
	case 0xb6: opstr = lc ? "ldx" : "LDX"; goto Lzeropagey_2;

	/* directpageindirect ($%02x) */
	case 0xd4: opstr = lc ? "pei" : "PEI"; goto Ldirectpageindirect_2;

	/* absoluteindirectlong [$%02x%02x] */
	case 0xdc: opstr = lc ? "jmp" : "JMP"; goto Labsoluteindirectlong_3;

	default:
		h = &hexdigits[(opcode & 0xff)*2]; *t++=*h++; *t++=*h++;
		goto last;
	}
Limplicit_1: /*  [] */
	do {*t++ = *opstr++;} while (*opstr);
	goto last;
Lindirectx_2: /* ($%02x,x) ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ',*t++='(';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='x';
	else *t++='X';
	*t++=')';
	goto last;
Lzeropage_2: /* $%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lstackrelative_2: /* $%02x,s ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='s';
	else *t++='S';
	goto last;
Ldirectpageindirectlong_2: /* [$%02x] ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ',*t++='[';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=']';
	goto last;
Limmediate_2: /* #$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	goto last;
Laccumulator_1: /* a [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	goto last;
Labsolute_3: /* $%02x%02x ['op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	addr = op1 + 256 * op2;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	goto last;
Labsolutelong_4: /* $%02x%02x%02x ['op3', 'op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	op3 = entry->instruction[3];
	*t++=' ';
	addr = op2 + 256 * op3;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	goto last;
Lrelative_2: /* $%04x ['rel'] */
	do {*t++ = *opstr++;} while (*opstr);
	dist = entry->instruction[1];
	if (dist > 127) dist -= 256;
	rel = (entry->pc + 2 + dist) & 0xffff;
	*t++=' ';
	t += print_label_or_addr(rel, jmp_targets, t, hexdigits, 0);
	goto last;
Lindirecty_2: /* ($%02x),y ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ',*t++='(';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=')',*t++=',';
	if (lc) *t++='y';
	else *t++='Y';
	goto last;
Lindirectzeropage_2: /* ($%02x) ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ',*t++='(';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=')';
	goto last;
Lstackrelativeindirecty_2: /* ($%02x,s),y ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ',*t++='(';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='s';
	else *t++='S';
	*t++=')',*t++=',';
	if (lc) *t++='y';
	else *t++='Y';
	goto last;
Lzeropagex_2: /* $%02x,x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='x';
	else *t++='X';
	goto last;
Ldirectpageindirectlongy_2: /* [$%02x],y ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ',*t++='[';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=']',*t++=',';
	if (lc) *t++='y';
	else *t++='Y';
	goto last;
Labsolutey_3: /* $%02x%02x,y ['op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	addr = op1 + 256 * op2;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	*t++=',';
	if (lc) *t++='y';
	else *t++='Y';
	goto last;
Labsolutex_3: /* $%02x%02x,x ['op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	addr = op1 + 256 * op2;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	*t++=',';
	if (lc) *t++='x';
	else *t++='X';
	goto last;
Labsolutelongx_4: /* $%02x%02x%02x,x ['op3', 'op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	op3 = entry->instruction[3];
	*t++=' ';
	addr = op2 + 256 * op3;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	*t++=',';
	if (lc) *t++='x';
	else *t++='X';
	goto last;
Lblockmove_3: /* $%02x,$%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	t += print_label_or_addr(op2, jmp_targets, t, hexdigits, 1);
	goto last;
Lindirect_3: /* ($%02x%02x) ['op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ',*t++='(';
	addr = op1 + 256 * op2;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	*t++=')';
	goto last;
Labsoluteindexedindirect_3: /* ($%02x%02x,x) ['op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ',*t++='(';
	addr = op1 + 256 * op2;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	*t++=',';
	if (lc) *t++='x';
	else *t++='X';
	*t++=')';
	goto last;
Lrelativelong_3: /* $%04x ['rel'] */
	do {*t++ = *opstr++;} while (*opstr);
	rel = entry->target_addr;
	*t++=' ';
	t += print_label_or_addr(rel, jmp_targets, t, hexdigits, 0);
	goto last;
Lzeropagey_2: /* $%02x,y ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='y';
	else *t++='Y';
	goto last;
Ldirectpageindirect_2: /* ($%02x) ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ',*t++='(';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=')';
	goto last;
Labsoluteindirectlong_3: /* [$%02x%02x] ['op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ',*t++='[';
	addr = op1 + 256 * op2;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	*t++=']';
	goto last;

last:
	return (int)(t - first_t);
}

int stringify_entry_65c02(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets) {
	int dist;
	unsigned char opcode, leadin, op1, op2, op3;
	char *first_t, *h, *opstr;
	unsigned short rel, addr;

	first_t = t;
	opcode = entry->instruction[0];
	switch(opcode) {
	/* implicit  */
	case 0x0: opstr = lc ? "brk" : "BRK"; goto Limplicit_1;
	case 0x8: opstr = lc ? "php" : "PHP"; goto Limplicit_1;
	case 0x18: opstr = lc ? "clc" : "CLC"; goto Limplicit_1;
	case 0x28: opstr = lc ? "plp" : "PLP"; goto Limplicit_1;
	case 0x38: opstr = lc ? "sec" : "SEC"; goto Limplicit_1;
	case 0x40: opstr = lc ? "rti" : "RTI"; goto Limplicit_1;
	case 0x48: opstr = lc ? "pha" : "PHA"; goto Limplicit_1;
	case 0x58: opstr = lc ? "cli" : "CLI"; goto Limplicit_1;
	case 0x5a: opstr = lc ? "phy" : "PHY"; goto Limplicit_1;
	case 0x60: opstr = lc ? "rts" : "RTS"; goto Limplicit_1;
	case 0x68: opstr = lc ? "pla" : "PLA"; goto Limplicit_1;
	case 0x78: opstr = lc ? "sei" : "SEI"; goto Limplicit_1;
	case 0x7a: opstr = lc ? "ply" : "PLY"; goto Limplicit_1;
	case 0x88: opstr = lc ? "dey" : "DEY"; goto Limplicit_1;
	case 0x8a: opstr = lc ? "txa" : "TXA"; goto Limplicit_1;
	case 0x98: opstr = lc ? "tya" : "TYA"; goto Limplicit_1;
	case 0x9a: opstr = lc ? "txs" : "TXS"; goto Limplicit_1;
	case 0xa8: opstr = lc ? "tay" : "TAY"; goto Limplicit_1;
	case 0xaa: opstr = lc ? "tax" : "TAX"; goto Limplicit_1;
	case 0xb8: opstr = lc ? "clv" : "CLV"; goto Limplicit_1;
	case 0xba: opstr = lc ? "tsx" : "TSX"; goto Limplicit_1;
	case 0xc8: opstr = lc ? "iny" : "INY"; goto Limplicit_1;
	case 0xca: opstr = lc ? "dex" : "DEX"; goto Limplicit_1;
	case 0xcb: opstr = lc ? "wai" : "WAI"; goto Limplicit_1;
	case 0xd8: opstr = lc ? "cld" : "CLD"; goto Limplicit_1;
	case 0xda: opstr = lc ? "phx" : "PHX"; goto Limplicit_1;
	case 0xdb: opstr = lc ? "stp" : "STP"; goto Limplicit_1;
	case 0xe8: opstr = lc ? "inx" : "INX"; goto Limplicit_1;
	case 0xea: opstr = lc ? "nop" : "NOP"; goto Limplicit_1;
	case 0xf8: opstr = lc ? "sed" : "SED"; goto Limplicit_1;
	case 0xfa: opstr = lc ? "plx" : "PLX"; goto Limplicit_1;

	/* indirectx ($%02x,x) */
	case 0x1: opstr = lc ? "ora" : "ORA"; goto Lindirectx_2;
	case 0x21: opstr = lc ? "and" : "AND"; goto Lindirectx_2;
	case 0x41: opstr = lc ? "eor" : "EOR"; goto Lindirectx_2;
	case 0x61: opstr = lc ? "adc" : "ADC"; goto Lindirectx_2;
	case 0x81: opstr = lc ? "sta" : "STA"; goto Lindirectx_2;
	case 0xa1: opstr = lc ? "lda" : "LDA"; goto Lindirectx_2;
	case 0xc1: opstr = lc ? "cmp" : "CMP"; goto Lindirectx_2;
	case 0xe1: opstr = lc ? "sbc" : "SBC"; goto Lindirectx_2;

	/* zeropage $%02x */
	case 0x4: opstr = lc ? "tsb" : "TSB"; goto Lzeropage_2;
	case 0x5: opstr = lc ? "ora" : "ORA"; goto Lzeropage_2;
	case 0x6: opstr = lc ? "asl" : "ASL"; goto Lzeropage_2;
	case 0x7: opstr = lc ? "rmb0" : "RMB0"; goto Lzeropage_2;
	case 0x14: opstr = lc ? "trb" : "TRB"; goto Lzeropage_2;
	case 0x17: opstr = lc ? "rmb1" : "RMB1"; goto Lzeropage_2;
	case 0x24: opstr = lc ? "bit" : "BIT"; goto Lzeropage_2;
	case 0x25: opstr = lc ? "and" : "AND"; goto Lzeropage_2;
	case 0x26: opstr = lc ? "rol" : "ROL"; goto Lzeropage_2;
	case 0x27: opstr = lc ? "rmb2" : "RMB2"; goto Lzeropage_2;
	case 0x37: opstr = lc ? "rmb3" : "RMB3"; goto Lzeropage_2;
	case 0x45: opstr = lc ? "eor" : "EOR"; goto Lzeropage_2;
	case 0x46: opstr = lc ? "lsr" : "LSR"; goto Lzeropage_2;
	case 0x47: opstr = lc ? "rmb4" : "RMB4"; goto Lzeropage_2;
	case 0x57: opstr = lc ? "rmb5" : "RMB5"; goto Lzeropage_2;
	case 0x64: opstr = lc ? "stz" : "STZ"; goto Lzeropage_2;
	case 0x65: opstr = lc ? "adc" : "ADC"; goto Lzeropage_2;
	case 0x66: opstr = lc ? "ror" : "ROR"; goto Lzeropage_2;
	case 0x67: opstr = lc ? "rmb6" : "RMB6"; goto Lzeropage_2;
	case 0x77: opstr = lc ? "rmb7" : "RMB7"; goto Lzeropage_2;
	case 0x84: opstr = lc ? "sty" : "STY"; goto Lzeropage_2;
	case 0x85: opstr = lc ? "sta" : "STA"; goto Lzeropage_2;
	case 0x86: opstr = lc ? "stx" : "STX"; goto Lzeropage_2;
	case 0x87: opstr = lc ? "smb0" : "SMB0"; goto Lzeropage_2;
	case 0x97: opstr = lc ? "smb1" : "SMB1"; goto Lzeropage_2;
	case 0xa4: opstr = lc ? "ldy" : "LDY"; goto Lzeropage_2;
	case 0xa5: opstr = lc ? "lda" : "LDA"; goto Lzeropage_2;
	case 0xa6: opstr = lc ? "ldx" : "LDX"; goto Lzeropage_2;
	case 0xa7: opstr = lc ? "smb2" : "SMB2"; goto Lzeropage_2;
	case 0xb7: opstr = lc ? "smb3" : "SMB3"; goto Lzeropage_2;
	case 0xc4: opstr = lc ? "cpy" : "CPY"; goto Lzeropage_2;
	case 0xc5: opstr = lc ? "cmp" : "CMP"; goto Lzeropage_2;
	case 0xc6: opstr = lc ? "dec" : "DEC"; goto Lzeropage_2;
	case 0xc7: opstr = lc ? "smb4" : "SMB4"; goto Lzeropage_2;
	case 0xd7: opstr = lc ? "smb5" : "SMB5"; goto Lzeropage_2;
	case 0xe4: opstr = lc ? "cpx" : "CPX"; goto Lzeropage_2;
	case 0xe5: opstr = lc ? "sbc" : "SBC"; goto Lzeropage_2;
	case 0xe6: opstr = lc ? "inc" : "INC"; goto Lzeropage_2;
	case 0xe7: opstr = lc ? "smb6" : "SMB6"; goto Lzeropage_2;
	case 0xf7: opstr = lc ? "smb7" : "SMB7"; goto Lzeropage_2;

	/* immediate #$%02x */
	case 0x9: opstr = lc ? "ora" : "ORA"; goto Limmediate_2;
	case 0x29: opstr = lc ? "and" : "AND"; goto Limmediate_2;
	case 0x49: opstr = lc ? "eor" : "EOR"; goto Limmediate_2;
	case 0x69: opstr = lc ? "adc" : "ADC"; goto Limmediate_2;
	case 0x89: opstr = lc ? "bit" : "BIT"; goto Limmediate_2;
	case 0xa0: opstr = lc ? "ldy" : "LDY"; goto Limmediate_2;
	case 0xa2: opstr = lc ? "ldx" : "LDX"; goto Limmediate_2;
	case 0xa9: opstr = lc ? "lda" : "LDA"; goto Limmediate_2;
	case 0xc0: opstr = lc ? "cpy" : "CPY"; goto Limmediate_2;
	case 0xc9: opstr = lc ? "cmp" : "CMP"; goto Limmediate_2;
	case 0xe0: opstr = lc ? "cpx" : "CPX"; goto Limmediate_2;
	case 0xe9: opstr = lc ? "sbc" : "SBC"; goto Limmediate_2;

	/* accumulator a */
	case 0xa: opstr = lc ? "asl" : "ASL"; goto Laccumulator_1;
	case 0x1a: opstr = lc ? "inc" : "INC"; goto Laccumulator_1;
	case 0x2a: opstr = lc ? "rol" : "ROL"; goto Laccumulator_1;
	case 0x3a: opstr = lc ? "dec" : "DEC"; goto Laccumulator_1;
	case 0x4a: opstr = lc ? "lsr" : "LSR"; goto Laccumulator_1;
	case 0x6a: opstr = lc ? "ror" : "ROR"; goto Laccumulator_1;

	/* absolute $%02x%02x */
	case 0xc: opstr = lc ? "tsb" : "TSB"; goto Labsolute_3;
	case 0xd: opstr = lc ? "ora" : "ORA"; goto Labsolute_3;
	case 0xe: opstr = lc ? "asl" : "ASL"; goto Labsolute_3;
	case 0x1c: opstr = lc ? "trb" : "TRB"; goto Labsolute_3;
	case 0x20: opstr = lc ? "jsr" : "JSR"; goto Labsolute_3;
	case 0x2c: opstr = lc ? "bit" : "BIT"; goto Labsolute_3;
	case 0x2d: opstr = lc ? "and" : "AND"; goto Labsolute_3;
	case 0x2e: opstr = lc ? "rol" : "ROL"; goto Labsolute_3;
	case 0x4c: opstr = lc ? "jmp" : "JMP"; goto Labsolute_3;
	case 0x4d: opstr = lc ? "eor" : "EOR"; goto Labsolute_3;
	case 0x4e: opstr = lc ? "lsr" : "LSR"; goto Labsolute_3;
	case 0x6d: opstr = lc ? "adc" : "ADC"; goto Labsolute_3;
	case 0x6e: opstr = lc ? "ror" : "ROR"; goto Labsolute_3;
	case 0x8c: opstr = lc ? "sty" : "STY"; goto Labsolute_3;
	case 0x8d: opstr = lc ? "sta" : "STA"; goto Labsolute_3;
	case 0x8e: opstr = lc ? "stx" : "STX"; goto Labsolute_3;
	case 0x9c: opstr = lc ? "stz" : "STZ"; goto Labsolute_3;
	case 0xac: opstr = lc ? "ldy" : "LDY"; goto Labsolute_3;
	case 0xad: opstr = lc ? "lda" : "LDA"; goto Labsolute_3;
	case 0xae: opstr = lc ? "ldx" : "LDX"; goto Labsolute_3;
	case 0xcc: opstr = lc ? "cpy" : "CPY"; goto Labsolute_3;
	case 0xcd: opstr = lc ? "cmp" : "CMP"; goto Labsolute_3;
	case 0xce: opstr = lc ? "dec" : "DEC"; goto Labsolute_3;
	case 0xec: opstr = lc ? "cpx" : "CPX"; goto Labsolute_3;
	case 0xed: opstr = lc ? "sbc" : "SBC"; goto Labsolute_3;
	case 0xee: opstr = lc ? "inc" : "INC"; goto Labsolute_3;

	/* zeropagerelative $%02x,${1:04x} */
	case 0xf: opstr = lc ? "bbr0" : "BBR0"; goto Lzeropagerelative_3;
	case 0x1f: opstr = lc ? "bbr1" : "BBR1"; goto Lzeropagerelative_3;
	case 0x2f: opstr = lc ? "bbr2" : "BBR2"; goto Lzeropagerelative_3;
	case 0x3f: opstr = lc ? "bbr3" : "BBR3"; goto Lzeropagerelative_3;
	case 0x4f: opstr = lc ? "bbr4" : "BBR4"; goto Lzeropagerelative_3;
	case 0x5f: opstr = lc ? "bbr5" : "BBR5"; goto Lzeropagerelative_3;
	case 0x6f: opstr = lc ? "bbr6" : "BBR6"; goto Lzeropagerelative_3;
	case 0x7f: opstr = lc ? "bbr7" : "BBR7"; goto Lzeropagerelative_3;
	case 0x8f: opstr = lc ? "bbs0" : "BBS0"; goto Lzeropagerelative_3;
	case 0x9f: opstr = lc ? "bbs1" : "BBS1"; goto Lzeropagerelative_3;
	case 0xaf: opstr = lc ? "bbs2" : "BBS2"; goto Lzeropagerelative_3;
	case 0xbf: opstr = lc ? "bbs3" : "BBS3"; goto Lzeropagerelative_3;
	case 0xcf: opstr = lc ? "bbs4" : "BBS4"; goto Lzeropagerelative_3;
	case 0xdf: opstr = lc ? "bbs5" : "BBS5"; goto Lzeropagerelative_3;
	case 0xef: opstr = lc ? "bbs6" : "BBS6"; goto Lzeropagerelative_3;
	case 0xff: opstr = lc ? "bbs7" : "BBS7"; goto Lzeropagerelative_3;

	/* relative $%04x */
	case 0x10: opstr = lc ? "bpl" : "BPL"; goto Lrelative_2;
	case 0x30: opstr = lc ? "bmi" : "BMI"; goto Lrelative_2;
	case 0x50: opstr = lc ? "bvc" : "BVC"; goto Lrelative_2;
	case 0x70: opstr = lc ? "bvs" : "BVS"; goto Lrelative_2;
	case 0x80: opstr = lc ? "bra" : "BRA"; goto Lrelative_2;
	case 0x90: opstr = lc ? "bcc" : "BCC"; goto Lrelative_2;
	case 0xb0: opstr = lc ? "bcs" : "BCS"; goto Lrelative_2;
	case 0xd0: opstr = lc ? "bne" : "BNE"; goto Lrelative_2;
	case 0xf0: opstr = lc ? "beq" : "BEQ"; goto Lrelative_2;

	/* indirecty ($%02x),y */
	case 0x11: opstr = lc ? "ora" : "ORA"; goto Lindirecty_2;
	case 0x31: opstr = lc ? "and" : "AND"; goto Lindirecty_2;
	case 0x51: opstr = lc ? "eor" : "EOR"; goto Lindirecty_2;
	case 0x71: opstr = lc ? "adc" : "ADC"; goto Lindirecty_2;
	case 0x91: opstr = lc ? "sta" : "STA"; goto Lindirecty_2;
	case 0xb1: opstr = lc ? "lda" : "LDA"; goto Lindirecty_2;
	case 0xd1: opstr = lc ? "cmp" : "CMP"; goto Lindirecty_2;
	case 0xf1: opstr = lc ? "sbc" : "SBC"; goto Lindirecty_2;

	/* indirectzeropage ($%02x) */
	case 0x12: opstr = lc ? "ora" : "ORA"; goto Lindirectzeropage_2;
	case 0x32: opstr = lc ? "and" : "AND"; goto Lindirectzeropage_2;
	case 0x52: opstr = lc ? "eor" : "EOR"; goto Lindirectzeropage_2;
	case 0x72: opstr = lc ? "adc" : "ADC"; goto Lindirectzeropage_2;
	case 0x92: opstr = lc ? "sta" : "STA"; goto Lindirectzeropage_2;
	case 0xb2: opstr = lc ? "lda" : "LDA"; goto Lindirectzeropage_2;
	case 0xd2: opstr = lc ? "cmp" : "CMP"; goto Lindirectzeropage_2;
	case 0xf2: opstr = lc ? "sbc" : "SBC"; goto Lindirectzeropage_2;

	/* zeropagex $%02x,x */
	case 0x15: opstr = lc ? "ora" : "ORA"; goto Lzeropagex_2;
	case 0x16: opstr = lc ? "asl" : "ASL"; goto Lzeropagex_2;
	case 0x34: opstr = lc ? "bit" : "BIT"; goto Lzeropagex_2;
	case 0x35: opstr = lc ? "and" : "AND"; goto Lzeropagex_2;
	case 0x36: opstr = lc ? "rol" : "ROL"; goto Lzeropagex_2;
	case 0x55: opstr = lc ? "eor" : "EOR"; goto Lzeropagex_2;
	case 0x56: opstr = lc ? "lsr" : "LSR"; goto Lzeropagex_2;
	case 0x74: opstr = lc ? "stz" : "STZ"; goto Lzeropagex_2;
	case 0x75: opstr = lc ? "adc" : "ADC"; goto Lzeropagex_2;
	case 0x76: opstr = lc ? "ror" : "ROR"; goto Lzeropagex_2;
	case 0x94: opstr = lc ? "sty" : "STY"; goto Lzeropagex_2;
	case 0x95: opstr = lc ? "sta" : "STA"; goto Lzeropagex_2;
	case 0xb4: opstr = lc ? "ldy" : "LDY"; goto Lzeropagex_2;
	case 0xb5: opstr = lc ? "lda" : "LDA"; goto Lzeropagex_2;
	case 0xd5: opstr = lc ? "cmp" : "CMP"; goto Lzeropagex_2;
	case 0xd6: opstr = lc ? "dec" : "DEC"; goto Lzeropagex_2;
	case 0xf5: opstr = lc ? "sbc" : "SBC"; goto Lzeropagex_2;
	case 0xf6: opstr = lc ? "inc" : "INC"; goto Lzeropagex_2;

	/* absolutey $%02x%02x,y */
	case 0x19: opstr = lc ? "ora" : "ORA"; goto Labsolutey_3;
	case 0x39: opstr = lc ? "and" : "AND"; goto Labsolutey_3;
	case 0x59: opstr = lc ? "eor" : "EOR"; goto Labsolutey_3;
	case 0x79: opstr = lc ? "adc" : "ADC"; goto Labsolutey_3;
	case 0x99: opstr = lc ? "sta" : "STA"; goto Labsolutey_3;
	case 0xb9: opstr = lc ? "lda" : "LDA"; goto Labsolutey_3;
	case 0xbe: opstr = lc ? "ldx" : "LDX"; goto Labsolutey_3;
	case 0xd9: opstr = lc ? "cmp" : "CMP"; goto Labsolutey_3;
	case 0xf9: opstr = lc ? "sbc" : "SBC"; goto Labsolutey_3;

	/* absolutex $%02x%02x,x */
	case 0x1d: opstr = lc ? "ora" : "ORA"; goto Labsolutex_3;
	case 0x1e: opstr = lc ? "asl" : "ASL"; goto Labsolutex_3;
	case 0x3c: opstr = lc ? "bit" : "BIT"; goto Labsolutex_3;
	case 0x3d: opstr = lc ? "and" : "AND"; goto Labsolutex_3;
	case 0x3e: opstr = lc ? "rol" : "ROL"; goto Labsolutex_3;
	case 0x5d: opstr = lc ? "eor" : "EOR"; goto Labsolutex_3;
	case 0x5e: opstr = lc ? "lsr" : "LSR"; goto Labsolutex_3;
	case 0x7d: opstr = lc ? "adc" : "ADC"; goto Labsolutex_3;
	case 0x7e: opstr = lc ? "ror" : "ROR"; goto Labsolutex_3;
	case 0x9d: opstr = lc ? "sta" : "STA"; goto Labsolutex_3;
	case 0x9e: opstr = lc ? "stz" : "STZ"; goto Labsolutex_3;
	case 0xbc: opstr = lc ? "ldy" : "LDY"; goto Labsolutex_3;
	case 0xbd: opstr = lc ? "lda" : "LDA"; goto Labsolutex_3;
	case 0xdd: opstr = lc ? "cmp" : "CMP"; goto Labsolutex_3;
	case 0xde: opstr = lc ? "dec" : "DEC"; goto Labsolutex_3;
	case 0xfd: opstr = lc ? "sbc" : "SBC"; goto Labsolutex_3;
	case 0xfe: opstr = lc ? "inc" : "INC"; goto Labsolutex_3;

	/* indirect ($%02x%02x) */
	case 0x6c: opstr = lc ? "jmp" : "JMP"; goto Lindirect_3;

	/* absoluteindexedindirect ($%02x%02x,x) */
	case 0x7c: opstr = lc ? "jmp" : "JMP"; goto Labsoluteindexedindirect_3;

	/* zeropagey $%02x,y */
	case 0x96: opstr = lc ? "stx" : "STX"; goto Lzeropagey_2;
	case 0xb6: opstr = lc ? "ldx" : "LDX"; goto Lzeropagey_2;

	default:
		h = &hexdigits[(opcode & 0xff)*2]; *t++=*h++; *t++=*h++;
		goto last;
	}
Limplicit_1: /*  [] */
	do {*t++ = *opstr++;} while (*opstr);
	goto last;
Lindirectx_2: /* ($%02x,x) ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ',*t++='(';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='x';
	else *t++='X';
	*t++=')';
	goto last;
Lzeropage_2: /* $%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Limmediate_2: /* #$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	goto last;
Laccumulator_1: /* a [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	goto last;
Labsolute_3: /* $%02x%02x ['op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	addr = op1 + 256 * op2;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	goto last;
Lzeropagerelative_3: /* $%02x,${1:04x} ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	rel = entry->target_addr;
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',',*t++='$',*t++='{',*t++='1',*t++=':',*t++='0',*t++='4';
	if (lc) *t++='x';
	else *t++='X';
	*t++='}';
	goto last;
Lrelative_2: /* $%04x ['rel'] */
	do {*t++ = *opstr++;} while (*opstr);
	dist = entry->instruction[1];
	if (dist > 127) dist -= 256;
	rel = (entry->pc + 2 + dist) & 0xffff;
	*t++=' ';
	t += print_label_or_addr(rel, jmp_targets, t, hexdigits, 0);
	goto last;
Lindirecty_2: /* ($%02x),y ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ',*t++='(';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=')',*t++=',';
	if (lc) *t++='y';
	else *t++='Y';
	goto last;
Lindirectzeropage_2: /* ($%02x) ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ',*t++='(';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=')';
	goto last;
Lzeropagex_2: /* $%02x,x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='x';
	else *t++='X';
	goto last;
Labsolutey_3: /* $%02x%02x,y ['op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	addr = op1 + 256 * op2;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	*t++=',';
	if (lc) *t++='y';
	else *t++='Y';
	goto last;
Labsolutex_3: /* $%02x%02x,x ['op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	addr = op1 + 256 * op2;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	*t++=',';
	if (lc) *t++='x';
	else *t++='X';
	goto last;
Lindirect_3: /* ($%02x%02x) ['op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ',*t++='(';
	addr = op1 + 256 * op2;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	*t++=')';
	goto last;
Labsoluteindexedindirect_3: /* ($%02x%02x,x) ['op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ',*t++='(';
	addr = op1 + 256 * op2;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	*t++=',';
	if (lc) *t++='x';
	else *t++='X';
	*t++=')';
	goto last;
Lzeropagey_2: /* $%02x,y ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='y';
	else *t++='Y';
	goto last;

last:
	return (int)(t - first_t);
}

int stringify_entry_6800(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets) {
	int dist;
	unsigned char opcode, leadin, op1, op2, op3;
	char *first_t, *h, *opstr;
	unsigned short rel, addr;

	first_t = t;
	opcode = entry->instruction[0];
	switch(opcode) {
	/* implied  */
	case 0x1: opstr = lc ? "nop" : "NOP"; goto Limplied_1;
	case 0x6: opstr = lc ? "tap" : "TAP"; goto Limplied_1;
	case 0x7: opstr = lc ? "tpa" : "TPA"; goto Limplied_1;
	case 0x8: opstr = lc ? "inx" : "INX"; goto Limplied_1;
	case 0x9: opstr = lc ? "dex" : "DEX"; goto Limplied_1;
	case 0xa: opstr = lc ? "clv" : "CLV"; goto Limplied_1;
	case 0xb: opstr = lc ? "sev" : "SEV"; goto Limplied_1;
	case 0xc: opstr = lc ? "clc" : "CLC"; goto Limplied_1;
	case 0xd: opstr = lc ? "sec" : "SEC"; goto Limplied_1;
	case 0xe: opstr = lc ? "cli" : "CLI"; goto Limplied_1;
	case 0xf: opstr = lc ? "sei" : "SEI"; goto Limplied_1;
	case 0x10: opstr = lc ? "sba" : "SBA"; goto Limplied_1;
	case 0x11: opstr = lc ? "cba" : "CBA"; goto Limplied_1;
	case 0x16: opstr = lc ? "tab" : "TAB"; goto Limplied_1;
	case 0x17: opstr = lc ? "tba" : "TBA"; goto Limplied_1;
	case 0x19: opstr = lc ? "daa" : "DAA"; goto Limplied_1;
	case 0x1b: opstr = lc ? "aba" : "ABA"; goto Limplied_1;
	case 0x30: opstr = lc ? "tsx" : "TSX"; goto Limplied_1;
	case 0x31: opstr = lc ? "ins" : "INS"; goto Limplied_1;
	case 0x32: opstr = lc ? "pula" : "PULA"; goto Limplied_1;
	case 0x33: opstr = lc ? "pulb" : "PULB"; goto Limplied_1;
	case 0x34: opstr = lc ? "des" : "DES"; goto Limplied_1;
	case 0x35: opstr = lc ? "txs" : "TXS"; goto Limplied_1;
	case 0x36: opstr = lc ? "psha" : "PSHA"; goto Limplied_1;
	case 0x37: opstr = lc ? "pshb" : "PSHB"; goto Limplied_1;
	case 0x39: opstr = lc ? "rts" : "RTS"; goto Limplied_1;
	case 0x3b: opstr = lc ? "rti" : "RTI"; goto Limplied_1;
	case 0x3e: opstr = lc ? "wai" : "WAI"; goto Limplied_1;
	case 0x3f: opstr = lc ? "swi" : "SWI"; goto Limplied_1;
	case 0x40: opstr = lc ? "nega" : "NEGA"; goto Limplied_1;
	case 0x43: opstr = lc ? "coma" : "COMA"; goto Limplied_1;
	case 0x44: opstr = lc ? "lsra" : "LSRA"; goto Limplied_1;
	case 0x46: opstr = lc ? "rora" : "RORA"; goto Limplied_1;
	case 0x47: opstr = lc ? "asra" : "ASRA"; goto Limplied_1;
	case 0x48: opstr = lc ? "asla" : "ASLA"; goto Limplied_1;
	case 0x49: opstr = lc ? "rola" : "ROLA"; goto Limplied_1;
	case 0x4a: opstr = lc ? "deca" : "DECA"; goto Limplied_1;
	case 0x4c: opstr = lc ? "inca" : "INCA"; goto Limplied_1;
	case 0x4d: opstr = lc ? "tsta" : "TSTA"; goto Limplied_1;
	case 0x4f: opstr = lc ? "clra" : "CLRA"; goto Limplied_1;
	case 0x50: opstr = lc ? "negb" : "NEGB"; goto Limplied_1;
	case 0x53: opstr = lc ? "comb" : "COMB"; goto Limplied_1;
	case 0x54: opstr = lc ? "lsrb" : "LSRB"; goto Limplied_1;
	case 0x56: opstr = lc ? "rorb" : "RORB"; goto Limplied_1;
	case 0x57: opstr = lc ? "asrb" : "ASRB"; goto Limplied_1;
	case 0x58: opstr = lc ? "aslb" : "ASLB"; goto Limplied_1;
	case 0x59: opstr = lc ? "rolb" : "ROLB"; goto Limplied_1;
	case 0x5a: opstr = lc ? "decb" : "DECB"; goto Limplied_1;
	case 0x5c: opstr = lc ? "incb" : "INCB"; goto Limplied_1;
	case 0x5d: opstr = lc ? "tstb" : "TSTB"; goto Limplied_1;
	case 0x5f: opstr = lc ? "clrb" : "CLRB"; goto Limplied_1;

	/* relative $%04x */
	case 0x20: opstr = lc ? "bra" : "BRA"; goto Lrelative_2;
	case 0x22: opstr = lc ? "bhi" : "BHI"; goto Lrelative_2;
	case 0x23: opstr = lc ? "bls" : "BLS"; goto Lrelative_2;
	case 0x24: opstr = lc ? "bcc" : "BCC"; goto Lrelative_2;
	case 0x25: opstr = lc ? "bcs" : "BCS"; goto Lrelative_2;
	case 0x26: opstr = lc ? "bne" : "BNE"; goto Lrelative_2;
	case 0x27: opstr = lc ? "beq" : "BEQ"; goto Lrelative_2;
	case 0x28: opstr = lc ? "bvc" : "BVC"; goto Lrelative_2;
	case 0x29: opstr = lc ? "bvs" : "BVS"; goto Lrelative_2;
	case 0x2a: opstr = lc ? "bpl" : "BPL"; goto Lrelative_2;
	case 0x2b: opstr = lc ? "bmi" : "BMI"; goto Lrelative_2;
	case 0x2c: opstr = lc ? "bge" : "BGE"; goto Lrelative_2;
	case 0x2d: opstr = lc ? "blt" : "BLT"; goto Lrelative_2;
	case 0x2e: opstr = lc ? "bgt" : "BGT"; goto Lrelative_2;
	case 0x2f: opstr = lc ? "ble" : "BLE"; goto Lrelative_2;
	case 0x8d: opstr = lc ? "bsr" : "BSR"; goto Lrelative_2;

	/* indexed $%02x,x */
	case 0x60: opstr = lc ? "neg" : "NEG"; goto Lindexed_2;
	case 0x63: opstr = lc ? "com" : "COM"; goto Lindexed_2;
	case 0x64: opstr = lc ? "lsr" : "LSR"; goto Lindexed_2;
	case 0x66: opstr = lc ? "ror" : "ROR"; goto Lindexed_2;
	case 0x67: opstr = lc ? "asr" : "ASR"; goto Lindexed_2;
	case 0x68: opstr = lc ? "asl" : "ASL"; goto Lindexed_2;
	case 0x69: opstr = lc ? "rol" : "ROL"; goto Lindexed_2;
	case 0x6a: opstr = lc ? "dec" : "DEC"; goto Lindexed_2;
	case 0x6c: opstr = lc ? "inc" : "INC"; goto Lindexed_2;
	case 0x6d: opstr = lc ? "tst" : "TST"; goto Lindexed_2;
	case 0x6e: opstr = lc ? "jmp" : "JMP"; goto Lindexed_2;
	case 0x6f: opstr = lc ? "clr" : "CLR"; goto Lindexed_2;
	case 0xa0: opstr = lc ? "suba" : "SUBA"; goto Lindexed_2;
	case 0xa1: opstr = lc ? "cmpa" : "CMPA"; goto Lindexed_2;
	case 0xa2: opstr = lc ? "sbca" : "SBCA"; goto Lindexed_2;
	case 0xa4: opstr = lc ? "anda" : "ANDA"; goto Lindexed_2;
	case 0xa5: opstr = lc ? "bita" : "BITA"; goto Lindexed_2;
	case 0xa6: opstr = lc ? "ldaa" : "LDAA"; goto Lindexed_2;
	case 0xa7: opstr = lc ? "staa" : "STAA"; goto Lindexed_2;
	case 0xa8: opstr = lc ? "eora" : "EORA"; goto Lindexed_2;
	case 0xa9: opstr = lc ? "adca" : "ADCA"; goto Lindexed_2;
	case 0xaa: opstr = lc ? "oraa" : "ORAA"; goto Lindexed_2;
	case 0xab: opstr = lc ? "adda" : "ADDA"; goto Lindexed_2;
	case 0xac: opstr = lc ? "cpx" : "CPX"; goto Lindexed_2;
	case 0xad: opstr = lc ? "jsr" : "JSR"; goto Lindexed_2;
	case 0xae: opstr = lc ? "lds" : "LDS"; goto Lindexed_2;
	case 0xaf: opstr = lc ? "sts" : "STS"; goto Lindexed_2;
	case 0xe0: opstr = lc ? "subb" : "SUBB"; goto Lindexed_2;
	case 0xe1: opstr = lc ? "cmpb" : "CMPB"; goto Lindexed_2;
	case 0xe2: opstr = lc ? "sbcb" : "SBCB"; goto Lindexed_2;
	case 0xe4: opstr = lc ? "andb" : "ANDB"; goto Lindexed_2;
	case 0xe5: opstr = lc ? "bitb" : "BITB"; goto Lindexed_2;
	case 0xe6: opstr = lc ? "ldab" : "LDAB"; goto Lindexed_2;
	case 0xe7: opstr = lc ? "stab" : "STAB"; goto Lindexed_2;
	case 0xe8: opstr = lc ? "eorb" : "EORB"; goto Lindexed_2;
	case 0xe9: opstr = lc ? "adcb" : "ADCB"; goto Lindexed_2;
	case 0xea: opstr = lc ? "orab" : "ORAB"; goto Lindexed_2;
	case 0xeb: opstr = lc ? "addb" : "ADDB"; goto Lindexed_2;
	case 0xee: opstr = lc ? "ldx" : "LDX"; goto Lindexed_2;
	case 0xef: opstr = lc ? "stx" : "STX"; goto Lindexed_2;

	/* extended $%02x%02x */
	case 0x70: opstr = lc ? "neg" : "NEG"; goto Lextended_3;
	case 0x73: opstr = lc ? "com" : "COM"; goto Lextended_3;
	case 0x74: opstr = lc ? "lsr" : "LSR"; goto Lextended_3;
	case 0x76: opstr = lc ? "ror" : "ROR"; goto Lextended_3;
	case 0x77: opstr = lc ? "asr" : "ASR"; goto Lextended_3;
	case 0x78: opstr = lc ? "asl" : "ASL"; goto Lextended_3;
	case 0x79: opstr = lc ? "rol" : "ROL"; goto Lextended_3;
	case 0x7a: opstr = lc ? "dec" : "DEC"; goto Lextended_3;
	case 0x7c: opstr = lc ? "inc" : "INC"; goto Lextended_3;
	case 0x7d: opstr = lc ? "tst" : "TST"; goto Lextended_3;
	case 0x7e: opstr = lc ? "jmp" : "JMP"; goto Lextended_3;
	case 0x7f: opstr = lc ? "clr" : "CLR"; goto Lextended_3;
	case 0xb0: opstr = lc ? "suba" : "SUBA"; goto Lextended_3;
	case 0xb1: opstr = lc ? "cmpa" : "CMPA"; goto Lextended_3;
	case 0xb2: opstr = lc ? "sbca" : "SBCA"; goto Lextended_3;
	case 0xb4: opstr = lc ? "anda" : "ANDA"; goto Lextended_3;
	case 0xb5: opstr = lc ? "bita" : "BITA"; goto Lextended_3;
	case 0xb6: opstr = lc ? "ldaa" : "LDAA"; goto Lextended_3;
	case 0xb7: opstr = lc ? "staa" : "STAA"; goto Lextended_3;
	case 0xb8: opstr = lc ? "eora" : "EORA"; goto Lextended_3;
	case 0xb9: opstr = lc ? "adca" : "ADCA"; goto Lextended_3;
	case 0xba: opstr = lc ? "oraa" : "ORAA"; goto Lextended_3;
	case 0xbb: opstr = lc ? "adda" : "ADDA"; goto Lextended_3;
	case 0xbc: opstr = lc ? "cpx" : "CPX"; goto Lextended_3;
	case 0xbd: opstr = lc ? "jsr" : "JSR"; goto Lextended_3;
	case 0xbe: opstr = lc ? "lds" : "LDS"; goto Lextended_3;
	case 0xbf: opstr = lc ? "sts" : "STS"; goto Lextended_3;
	case 0xf0: opstr = lc ? "subb" : "SUBB"; goto Lextended_3;
	case 0xf1: opstr = lc ? "cmpb" : "CMPB"; goto Lextended_3;
	case 0xf2: opstr = lc ? "sbcb" : "SBCB"; goto Lextended_3;
	case 0xf4: opstr = lc ? "andb" : "ANDB"; goto Lextended_3;
	case 0xf5: opstr = lc ? "bitb" : "BITB"; goto Lextended_3;
	case 0xf6: opstr = lc ? "ldab" : "LDAB"; goto Lextended_3;
	case 0xf7: opstr = lc ? "stab" : "STAB"; goto Lextended_3;
	case 0xf8: opstr = lc ? "eorb" : "EORB"; goto Lextended_3;
	case 0xf9: opstr = lc ? "adcb" : "ADCB"; goto Lextended_3;
	case 0xfa: opstr = lc ? "orab" : "ORAB"; goto Lextended_3;
	case 0xfb: opstr = lc ? "addb" : "ADDB"; goto Lextended_3;
	case 0xfe: opstr = lc ? "ldx" : "LDX"; goto Lextended_3;
	case 0xff: opstr = lc ? "stx" : "STX"; goto Lextended_3;

	/* immediate #$%02x */
	case 0x80: opstr = lc ? "suba" : "SUBA"; goto Limmediate_2;
	case 0x81: opstr = lc ? "cmpa" : "CMPA"; goto Limmediate_2;
	case 0x82: opstr = lc ? "sbca" : "SBCA"; goto Limmediate_2;
	case 0x84: opstr = lc ? "anda" : "ANDA"; goto Limmediate_2;
	case 0x85: opstr = lc ? "bita" : "BITA"; goto Limmediate_2;
	case 0x86: opstr = lc ? "ldaa" : "LDAA"; goto Limmediate_2;
	case 0x88: opstr = lc ? "eora" : "EORA"; goto Limmediate_2;
	case 0x89: opstr = lc ? "adca" : "ADCA"; goto Limmediate_2;
	case 0x8a: opstr = lc ? "oraa" : "ORAA"; goto Limmediate_2;
	case 0x8b: opstr = lc ? "adda" : "ADDA"; goto Limmediate_2;
	case 0xc0: opstr = lc ? "subb" : "SUBB"; goto Limmediate_2;
	case 0xc1: opstr = lc ? "cmpb" : "CMPB"; goto Limmediate_2;
	case 0xc2: opstr = lc ? "sbcb" : "SBCB"; goto Limmediate_2;
	case 0xc4: opstr = lc ? "andb" : "ANDB"; goto Limmediate_2;
	case 0xc5: opstr = lc ? "bitb" : "BITB"; goto Limmediate_2;
	case 0xc6: opstr = lc ? "ldab" : "LDAB"; goto Limmediate_2;
	case 0xc8: opstr = lc ? "eorb" : "EORB"; goto Limmediate_2;
	case 0xc9: opstr = lc ? "adcb" : "ADCB"; goto Limmediate_2;
	case 0xca: opstr = lc ? "orab" : "ORAB"; goto Limmediate_2;
	case 0xcb: opstr = lc ? "addb" : "ADDB"; goto Limmediate_2;

	/* immediatex #$%02x%02x */
	case 0x8c: opstr = lc ? "cpx" : "CPX"; goto Limmediatex_3;
	case 0x8e: opstr = lc ? "lds" : "LDS"; goto Limmediatex_3;
	case 0xce: opstr = lc ? "ldx" : "LDX"; goto Limmediatex_3;

	/* direct $%02x */
	case 0x90: opstr = lc ? "suba" : "SUBA"; goto Ldirect_2;
	case 0x91: opstr = lc ? "cmpa" : "CMPA"; goto Ldirect_2;
	case 0x92: opstr = lc ? "sbca" : "SBCA"; goto Ldirect_2;
	case 0x94: opstr = lc ? "anda" : "ANDA"; goto Ldirect_2;
	case 0x95: opstr = lc ? "bita" : "BITA"; goto Ldirect_2;
	case 0x96: opstr = lc ? "ldaa" : "LDAA"; goto Ldirect_2;
	case 0x97: opstr = lc ? "staa" : "STAA"; goto Ldirect_2;
	case 0x98: opstr = lc ? "eora" : "EORA"; goto Ldirect_2;
	case 0x99: opstr = lc ? "adca" : "ADCA"; goto Ldirect_2;
	case 0x9a: opstr = lc ? "oraa" : "ORAA"; goto Ldirect_2;
	case 0x9b: opstr = lc ? "adda" : "ADDA"; goto Ldirect_2;
	case 0x9c: opstr = lc ? "cpx" : "CPX"; goto Ldirect_2;
	case 0x9e: opstr = lc ? "lds" : "LDS"; goto Ldirect_2;
	case 0x9f: opstr = lc ? "sts" : "STS"; goto Ldirect_2;
	case 0xd0: opstr = lc ? "subb" : "SUBB"; goto Ldirect_2;
	case 0xd1: opstr = lc ? "cmpb" : "CMPB"; goto Ldirect_2;
	case 0xd2: opstr = lc ? "sbcb" : "SBCB"; goto Ldirect_2;
	case 0xd4: opstr = lc ? "andb" : "ANDB"; goto Ldirect_2;
	case 0xd5: opstr = lc ? "bitb" : "BITB"; goto Ldirect_2;
	case 0xd6: opstr = lc ? "ldab" : "LDAB"; goto Ldirect_2;
	case 0xd7: opstr = lc ? "stab" : "STAB"; goto Ldirect_2;
	case 0xd8: opstr = lc ? "eorb" : "EORB"; goto Ldirect_2;
	case 0xd9: opstr = lc ? "adcb" : "ADCB"; goto Ldirect_2;
	case 0xda: opstr = lc ? "orab" : "ORAB"; goto Ldirect_2;
	case 0xdb: opstr = lc ? "addb" : "ADDB"; goto Ldirect_2;
	case 0xde: opstr = lc ? "ldx" : "LDX"; goto Ldirect_2;
	case 0xdf: opstr = lc ? "stx" : "STX"; goto Ldirect_2;

	default:
		h = &hexdigits[(opcode & 0xff)*2]; *t++=*h++; *t++=*h++;
		goto last;
	}
Limplied_1: /*  [] */
	do {*t++ = *opstr++;} while (*opstr);
	goto last;
Lrelative_2: /* $%04x ['rel'] */
	do {*t++ = *opstr++;} while (*opstr);
	dist = entry->instruction[1];
	if (dist > 127) dist -= 256;
	rel = (entry->pc + 2 + dist) & 0xffff;
	*t++=' ';
	t += print_label_or_addr(rel, jmp_targets, t, hexdigits, 0);
	goto last;
Lindexed_2: /* $%02x,x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='x';
	else *t++='X';
	goto last;
Lextended_3: /* $%02x%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	addr = op2 + 256 * op1;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	goto last;
Limmediate_2: /* #$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	goto last;
Limmediatex_3: /* #$%02x%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	h = &hexdigits[(op2)*2]; *t++=*h++; *t++=*h++;
	goto last;
Ldirect_2: /* $%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;

last:
	return (int)(t - first_t);
}

int stringify_entry_6809(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets) {
	int dist;
	unsigned char opcode, leadin, op1, op2, op3;
	char *first_t, *h, *opstr;
	unsigned short rel, addr;

	first_t = t;
	opcode = entry->instruction[0];
	switch(opcode) {
	/* direct $%02x */
	case 0x0: opstr = lc ? "neg" : "NEG"; goto Ldirect_2;
	case 0x3: opstr = lc ? "comb" : "COMB"; goto Ldirect_2;
	case 0x4: opstr = lc ? "lsr" : "LSR"; goto Ldirect_2;
	case 0x6: opstr = lc ? "ror" : "ROR"; goto Ldirect_2;
	case 0x7: opstr = lc ? "asr" : "ASR"; goto Ldirect_2;
	case 0x8: opstr = lc ? "lsl" : "LSL"; goto Ldirect_2;
	case 0x9: opstr = lc ? "rol" : "ROL"; goto Ldirect_2;
	case 0xa: opstr = lc ? "dec" : "DEC"; goto Ldirect_2;
	case 0xd: opstr = lc ? "tst" : "TST"; goto Ldirect_2;
	case 0xf: opstr = lc ? "clr" : "CLR"; goto Ldirect_2;
	case 0x6c: opstr = lc ? "inc" : "INC"; goto Ldirect_2;
	case 0x6e: opstr = lc ? "jmp" : "JMP"; goto Ldirect_2;
	case 0x90: opstr = lc ? "suba" : "SUBA"; goto Ldirect_2;
	case 0x91: opstr = lc ? "cmpa" : "CMPA"; goto Ldirect_2;
	case 0x92: opstr = lc ? "sbca" : "SBCA"; goto Ldirect_2;
	case 0x93: opstr = lc ? "subd" : "SUBD"; goto Ldirect_2;
	case 0x94: opstr = lc ? "anda" : "ANDA"; goto Ldirect_2;
	case 0x95: opstr = lc ? "bita" : "BITA"; goto Ldirect_2;
	case 0x96: opstr = lc ? "lda" : "LDA"; goto Ldirect_2;
	case 0x97: opstr = lc ? "sta" : "STA"; goto Ldirect_2;
	case 0x98: opstr = lc ? "eora" : "EORA"; goto Ldirect_2;
	case 0x99: opstr = lc ? "adca" : "ADCA"; goto Ldirect_2;
	case 0x9a: opstr = lc ? "ora" : "ORA"; goto Ldirect_2;
	case 0x9b: opstr = lc ? "adda" : "ADDA"; goto Ldirect_2;
	case 0x9c: opstr = lc ? "cmpx" : "CMPX"; goto Ldirect_2;
	case 0x9e: opstr = lc ? "ldx" : "LDX"; goto Ldirect_2;
	case 0x9f: opstr = lc ? "stx" : "STX"; goto Ldirect_2;
	case 0xa8: opstr = lc ? "eora" : "EORA"; goto Ldirect_2;
	case 0xad: opstr = lc ? "jsr" : "JSR"; goto Ldirect_2;
	case 0xd0: opstr = lc ? "subb" : "SUBB"; goto Ldirect_2;
	case 0xd1: opstr = lc ? "cmpb" : "CMPB"; goto Ldirect_2;
	case 0xd2: opstr = lc ? "sbcb" : "SBCB"; goto Ldirect_2;
	case 0xd3: opstr = lc ? "addd" : "ADDD"; goto Ldirect_2;
	case 0xd4: opstr = lc ? "andb" : "ANDB"; goto Ldirect_2;
	case 0xd5: opstr = lc ? "bitb" : "BITB"; goto Ldirect_2;
	case 0xd6: opstr = lc ? "ldb" : "LDB"; goto Ldirect_2;
	case 0xd7: opstr = lc ? "stb" : "STB"; goto Ldirect_2;
	case 0xd8: opstr = lc ? "eorb" : "EORB"; goto Ldirect_2;
	case 0xd9: opstr = lc ? "adcb" : "ADCB"; goto Ldirect_2;
	case 0xda: opstr = lc ? "orb" : "ORB"; goto Ldirect_2;
	case 0xdb: opstr = lc ? "addb" : "ADDB"; goto Ldirect_2;
	case 0xdc: opstr = lc ? "ldd" : "LDD"; goto Ldirect_2;
	case 0xdd: opstr = lc ? "std" : "STD"; goto Ldirect_2;
	case 0xde: opstr = lc ? "ldu" : "LDU"; goto Ldirect_2;
	case 0xdf: opstr = lc ? "stu" : "STU"; goto Ldirect_2;
	case 0xe8: opstr = lc ? "eorb" : "EORB"; goto Ldirect_2;

	/* indexed $%02x,x */
	case 0xc: opstr = lc ? "inc" : "INC"; goto Lindexed_2;
	case 0xe: opstr = lc ? "jmp" : "JMP"; goto Lindexed_2;
	case 0x30: opstr = lc ? "leax" : "LEAX"; goto Lindexed_2;
	case 0x31: opstr = lc ? "leay" : "LEAY"; goto Lindexed_2;
	case 0x32: opstr = lc ? "leas" : "LEAS"; goto Lindexed_2;
	case 0x33: opstr = lc ? "leau" : "LEAU"; goto Lindexed_2;
	case 0x60: opstr = lc ? "neg" : "NEG"; goto Lindexed_2;
	case 0x63: opstr = lc ? "comb" : "COMB"; goto Lindexed_2;
	case 0x64: opstr = lc ? "lsr" : "LSR"; goto Lindexed_2;
	case 0x66: opstr = lc ? "ror" : "ROR"; goto Lindexed_2;
	case 0x67: opstr = lc ? "asr" : "ASR"; goto Lindexed_2;
	case 0x68: opstr = lc ? "lsl" : "LSL"; goto Lindexed_2;
	case 0x69: opstr = lc ? "rol" : "ROL"; goto Lindexed_2;
	case 0x6a: opstr = lc ? "dec" : "DEC"; goto Lindexed_2;
	case 0x6d: opstr = lc ? "tst" : "TST"; goto Lindexed_2;
	case 0x6f: opstr = lc ? "clr" : "CLR"; goto Lindexed_2;
	case 0x9d: opstr = lc ? "jsr" : "JSR"; goto Lindexed_2;
	case 0xa0: opstr = lc ? "suba" : "SUBA"; goto Lindexed_2;
	case 0xa1: opstr = lc ? "cmpa" : "CMPA"; goto Lindexed_2;
	case 0xa2: opstr = lc ? "sbca" : "SBCA"; goto Lindexed_2;
	case 0xa3: opstr = lc ? "subd" : "SUBD"; goto Lindexed_2;
	case 0xa4: opstr = lc ? "anda" : "ANDA"; goto Lindexed_2;
	case 0xa5: opstr = lc ? "bita" : "BITA"; goto Lindexed_2;
	case 0xa6: opstr = lc ? "lda" : "LDA"; goto Lindexed_2;
	case 0xa7: opstr = lc ? "sta" : "STA"; goto Lindexed_2;
	case 0xa9: opstr = lc ? "adca" : "ADCA"; goto Lindexed_2;
	case 0xaa: opstr = lc ? "ora" : "ORA"; goto Lindexed_2;
	case 0xab: opstr = lc ? "adda" : "ADDA"; goto Lindexed_2;
	case 0xac: opstr = lc ? "cmpx" : "CMPX"; goto Lindexed_2;
	case 0xae: opstr = lc ? "ldx" : "LDX"; goto Lindexed_2;
	case 0xaf: opstr = lc ? "stx" : "STX"; goto Lindexed_2;
	case 0xe0: opstr = lc ? "subb" : "SUBB"; goto Lindexed_2;
	case 0xe1: opstr = lc ? "cmpb" : "CMPB"; goto Lindexed_2;
	case 0xe2: opstr = lc ? "sbcb" : "SBCB"; goto Lindexed_2;
	case 0xe3: opstr = lc ? "addd" : "ADDD"; goto Lindexed_2;
	case 0xe4: opstr = lc ? "andb" : "ANDB"; goto Lindexed_2;
	case 0xe5: opstr = lc ? "bitb" : "BITB"; goto Lindexed_2;
	case 0xe6: opstr = lc ? "ldb" : "LDB"; goto Lindexed_2;
	case 0xe7: opstr = lc ? "stb" : "STB"; goto Lindexed_2;
	case 0xe9: opstr = lc ? "adcb" : "ADCB"; goto Lindexed_2;
	case 0xea: opstr = lc ? "orb" : "ORB"; goto Lindexed_2;
	case 0xeb: opstr = lc ? "addb" : "ADDB"; goto Lindexed_2;
	case 0xec: opstr = lc ? "ldd" : "LDD"; goto Lindexed_2;
	case 0xed: opstr = lc ? "std" : "STD"; goto Lindexed_2;
	case 0xee: opstr = lc ? "ldu" : "LDU"; goto Lindexed_2;
	case 0xef: opstr = lc ? "stu" : "STU"; goto Lindexed_2;

	/* inherent  */
	case 0x12: opstr = lc ? "nop" : "NOP"; goto Linherent_1;
	case 0x13: opstr = lc ? "sync" : "SYNC"; goto Linherent_1;
	case 0x19: opstr = lc ? "daa" : "DAA"; goto Linherent_1;
	case 0x1d: opstr = lc ? "sex" : "SEX"; goto Linherent_1;
	case 0x39: opstr = lc ? "rts" : "RTS"; goto Linherent_1;
	case 0x3a: opstr = lc ? "abx" : "ABX"; goto Linherent_1;
	case 0x3b: opstr = lc ? "rti" : "RTI"; goto Linherent_1;
	case 0x3d: opstr = lc ? "mul" : "MUL"; goto Linherent_1;
	case 0x3f: opstr = lc ? "swi" : "SWI"; goto Linherent_1;
	case 0x40: opstr = lc ? "nega" : "NEGA"; goto Linherent_1;
	case 0x43: opstr = lc ? "coma" : "COMA"; goto Linherent_1;
	case 0x44: opstr = lc ? "lsra" : "LSRA"; goto Linherent_1;
	case 0x46: opstr = lc ? "rora" : "RORA"; goto Linherent_1;
	case 0x47: opstr = lc ? "asra" : "ASRA"; goto Linherent_1;
	case 0x48: opstr = lc ? "lsla" : "LSLA"; goto Linherent_1;
	case 0x49: opstr = lc ? "rola" : "ROLA"; goto Linherent_1;
	case 0x4a: opstr = lc ? "deca" : "DECA"; goto Linherent_1;
	case 0x4c: opstr = lc ? "inca" : "INCA"; goto Linherent_1;
	case 0x4d: opstr = lc ? "tsta" : "TSTA"; goto Linherent_1;
	case 0x4f: opstr = lc ? "clra" : "CLRA"; goto Linherent_1;
	case 0x50: opstr = lc ? "negb" : "NEGB"; goto Linherent_1;
	case 0x53: opstr = lc ? "comb" : "COMB"; goto Linherent_1;
	case 0x54: opstr = lc ? "lsrb" : "LSRB"; goto Linherent_1;
	case 0x56: opstr = lc ? "rorb" : "RORB"; goto Linherent_1;
	case 0x57: opstr = lc ? "asrb" : "ASRB"; goto Linherent_1;
	case 0x58: opstr = lc ? "lslb" : "LSLB"; goto Linherent_1;
	case 0x59: opstr = lc ? "rolb" : "ROLB"; goto Linherent_1;
	case 0x5a: opstr = lc ? "decb" : "DECB"; goto Linherent_1;
	case 0x5c: opstr = lc ? "incb" : "INCB"; goto Linherent_1;
	case 0x5d: opstr = lc ? "tstb" : "TSTB"; goto Linherent_1;
	case 0x5f: opstr = lc ? "clrb" : "CLRB"; goto Linherent_1;

	/* rel16 $%04x */
	case 0x16: opstr = lc ? "lbra" : "LBRA"; goto Lrel16_3;
	case 0x17: opstr = lc ? "lbsr" : "LBSR"; goto Lrel16_3;

	/* imm8 #$%02x */
	case 0x1a: opstr = lc ? "orcc" : "ORCC"; goto Limm8_2;
	case 0x1c: opstr = lc ? "andcc" : "ANDCC"; goto Limm8_2;
	case 0x34: opstr = lc ? "pshs" : "PSHS"; goto Limm8_2;
	case 0x35: opstr = lc ? "puls" : "PULS"; goto Limm8_2;
	case 0x36: opstr = lc ? "pshu" : "PSHU"; goto Limm8_2;
	case 0x37: opstr = lc ? "pulu" : "PULU"; goto Limm8_2;
	case 0x3c: opstr = lc ? "cwai" : "CWAI"; goto Limm8_2;
	case 0x80: opstr = lc ? "suba" : "SUBA"; goto Limm8_2;
	case 0x81: opstr = lc ? "cmpa" : "CMPA"; goto Limm8_2;
	case 0x82: opstr = lc ? "sbca" : "SBCA"; goto Limm8_2;
	case 0x84: opstr = lc ? "anda" : "ANDA"; goto Limm8_2;
	case 0x85: opstr = lc ? "bita" : "BITA"; goto Limm8_2;
	case 0x86: opstr = lc ? "lda" : "LDA"; goto Limm8_2;
	case 0x88: opstr = lc ? "eora" : "EORA"; goto Limm8_2;
	case 0x89: opstr = lc ? "adca" : "ADCA"; goto Limm8_2;
	case 0x8a: opstr = lc ? "ora" : "ORA"; goto Limm8_2;
	case 0x8b: opstr = lc ? "adda" : "ADDA"; goto Limm8_2;
	case 0xc0: opstr = lc ? "subb" : "SUBB"; goto Limm8_2;
	case 0xc1: opstr = lc ? "cmpb" : "CMPB"; goto Limm8_2;
	case 0xc2: opstr = lc ? "sbcb" : "SBCB"; goto Limm8_2;
	case 0xc4: opstr = lc ? "andb" : "ANDB"; goto Limm8_2;
	case 0xc5: opstr = lc ? "bitb" : "BITB"; goto Limm8_2;
	case 0xc6: opstr = lc ? "ldb" : "LDB"; goto Limm8_2;
	case 0xc8: opstr = lc ? "eorb" : "EORB"; goto Limm8_2;
	case 0xc9: opstr = lc ? "adcb" : "ADCB"; goto Limm8_2;
	case 0xca: opstr = lc ? "orb" : "ORB"; goto Limm8_2;
	case 0xcb: opstr = lc ? "addb" : "ADDB"; goto Limm8_2;

	/* r1,r2 $%02x */
	case 0x1e: opstr = lc ? "exg" : "EXG"; goto Lr1_r2_2;
	case 0x1f: opstr = lc ? "tfr" : "TFR"; goto Lr1_r2_2;

	/* rel8 $%04x */
	case 0x20: opstr = lc ? "bra" : "BRA"; goto Lrel8_2;
	case 0x21: opstr = lc ? "brn" : "BRN"; goto Lrel8_2;
	case 0x22: opstr = lc ? "bhi" : "BHI"; goto Lrel8_2;
	case 0x23: opstr = lc ? "bls" : "BLS"; goto Lrel8_2;
	case 0x24: opstr = lc ? "bhs" : "BHS"; goto Lrel8_2;
	case 0x25: opstr = lc ? "blo" : "BLO"; goto Lrel8_2;
	case 0x26: opstr = lc ? "bne" : "BNE"; goto Lrel8_2;
	case 0x27: opstr = lc ? "beq" : "BEQ"; goto Lrel8_2;
	case 0x28: opstr = lc ? "bvc" : "BVC"; goto Lrel8_2;
	case 0x29: opstr = lc ? "bvs" : "BVS"; goto Lrel8_2;
	case 0x2a: opstr = lc ? "bpl" : "BPL"; goto Lrel8_2;
	case 0x2b: opstr = lc ? "bmi" : "BMI"; goto Lrel8_2;
	case 0x2c: opstr = lc ? "bge" : "BGE"; goto Lrel8_2;
	case 0x2d: opstr = lc ? "blt" : "BLT"; goto Lrel8_2;
	case 0x2e: opstr = lc ? "bgt" : "BGT"; goto Lrel8_2;
	case 0x2f: opstr = lc ? "ble" : "BLE"; goto Lrel8_2;
	case 0x8d: opstr = lc ? "bsr" : "BSR"; goto Lrel8_2;

	/* extended $%02x%02x */
	case 0x70: opstr = lc ? "neg" : "NEG"; goto Lextended_3;
	case 0x73: opstr = lc ? "comb" : "COMB"; goto Lextended_3;
	case 0x74: opstr = lc ? "lsr" : "LSR"; goto Lextended_3;
	case 0x76: opstr = lc ? "ror" : "ROR"; goto Lextended_3;
	case 0x77: opstr = lc ? "asr" : "ASR"; goto Lextended_3;
	case 0x78: opstr = lc ? "lsl" : "LSL"; goto Lextended_3;
	case 0x79: opstr = lc ? "rol" : "ROL"; goto Lextended_3;
	case 0x7a: opstr = lc ? "dec" : "DEC"; goto Lextended_3;
	case 0x7c: opstr = lc ? "inc" : "INC"; goto Lextended_3;
	case 0x7d: opstr = lc ? "tst" : "TST"; goto Lextended_3;
	case 0x7e: opstr = lc ? "jmp" : "JMP"; goto Lextended_3;
	case 0x7f: opstr = lc ? "clr" : "CLR"; goto Lextended_3;
	case 0xb0: opstr = lc ? "suba" : "SUBA"; goto Lextended_3;
	case 0xb1: opstr = lc ? "cmpa" : "CMPA"; goto Lextended_3;
	case 0xb2: opstr = lc ? "sbca" : "SBCA"; goto Lextended_3;
	case 0xb3: opstr = lc ? "subd" : "SUBD"; goto Lextended_3;
	case 0xb4: opstr = lc ? "anda" : "ANDA"; goto Lextended_3;
	case 0xb5: opstr = lc ? "bita" : "BITA"; goto Lextended_3;
	case 0xb6: opstr = lc ? "lda" : "LDA"; goto Lextended_3;
	case 0xb7: opstr = lc ? "sta" : "STA"; goto Lextended_3;
	case 0xb8: opstr = lc ? "eora" : "EORA"; goto Lextended_3;
	case 0xb9: opstr = lc ? "adca" : "ADCA"; goto Lextended_3;
	case 0xba: opstr = lc ? "ora" : "ORA"; goto Lextended_3;
	case 0xbb: opstr = lc ? "adda" : "ADDA"; goto Lextended_3;
	case 0xbc: opstr = lc ? "cmpx" : "CMPX"; goto Lextended_3;
	case 0xbd: opstr = lc ? "jsr" : "JSR"; goto Lextended_3;
	case 0xbe: opstr = lc ? "ldx" : "LDX"; goto Lextended_3;
	case 0xbf: opstr = lc ? "stx" : "STX"; goto Lextended_3;
	case 0xf0: opstr = lc ? "subb" : "SUBB"; goto Lextended_3;
	case 0xf1: opstr = lc ? "cmpb" : "CMPB"; goto Lextended_3;
	case 0xf2: opstr = lc ? "sbcb" : "SBCB"; goto Lextended_3;
	case 0xf3: opstr = lc ? "addd" : "ADDD"; goto Lextended_3;
	case 0xf4: opstr = lc ? "andb" : "ANDB"; goto Lextended_3;
	case 0xf5: opstr = lc ? "bitb" : "BITB"; goto Lextended_3;
	case 0xf6: opstr = lc ? "ldb" : "LDB"; goto Lextended_3;
	case 0xf7: opstr = lc ? "stb" : "STB"; goto Lextended_3;
	case 0xf8: opstr = lc ? "eorb" : "EORB"; goto Lextended_3;
	case 0xf9: opstr = lc ? "adcb" : "ADCB"; goto Lextended_3;
	case 0xfa: opstr = lc ? "orb" : "ORB"; goto Lextended_3;
	case 0xfb: opstr = lc ? "addb" : "ADDB"; goto Lextended_3;
	case 0xfc: opstr = lc ? "ldd" : "LDD"; goto Lextended_3;
	case 0xfd: opstr = lc ? "std" : "STD"; goto Lextended_3;
	case 0xfe: opstr = lc ? "ldu" : "LDU"; goto Lextended_3;
	case 0xff: opstr = lc ? "stu" : "STU"; goto Lextended_3;

	/* imm16 #$%02x%02x */
	case 0x83: opstr = lc ? "subd" : "SUBD"; goto Limm16_3;
	case 0x8c: opstr = lc ? "cmpx" : "CMPX"; goto Limm16_3;
	case 0x8e: opstr = lc ? "ldx" : "LDX"; goto Limm16_3;
	case 0xc3: opstr = lc ? "addd" : "ADDD"; goto Limm16_3;
	case 0xcc: opstr = lc ? "ldd" : "LDD"; goto Limm16_3;
	case 0xce: opstr = lc ? "ldu" : "LDU"; goto Limm16_3;

case 0x10:
	leadin = opcode;
	opcode = entry->instruction[1];
	switch(opcode) {
		/* rel16 $%04x */
		case 0x21: opstr = lc ? "lbrn" : "LBRN"; goto Lrel16_4;
		case 0x22: opstr = lc ? "lbhi" : "LBHI"; goto Lrel16_4;
		case 0x23: opstr = lc ? "lbls" : "LBLS"; goto Lrel16_4;
		case 0x24: opstr = lc ? "lbhs" : "LBHS"; goto Lrel16_4;
		case 0x25: opstr = lc ? "lblo" : "LBLO"; goto Lrel16_4;
		case 0x26: opstr = lc ? "lbne" : "LBNE"; goto Lrel16_4;
		case 0x27: opstr = lc ? "lbeq" : "LBEQ"; goto Lrel16_4;
		case 0x28: opstr = lc ? "lbvc" : "LBVC"; goto Lrel16_4;
		case 0x29: opstr = lc ? "lbvs" : "LBVS"; goto Lrel16_4;
		case 0x2a: opstr = lc ? "lbpl" : "LBPL"; goto Lrel16_4;
		case 0x2b: opstr = lc ? "lbmi" : "LBMI"; goto Lrel16_4;
		case 0x2c: opstr = lc ? "lbge" : "LBGE"; goto Lrel16_4;
		case 0x2d: opstr = lc ? "lblt" : "LBLT"; goto Lrel16_4;
		case 0x2e: opstr = lc ? "lbgt" : "LBGT"; goto Lrel16_4;
		case 0x2f: opstr = lc ? "lble" : "LBLE"; goto Lrel16_4;

		/* inherent  */
		case 0x3f: opstr = lc ? "swi2" : "SWI2"; goto Linherent_2;

		/* imm16 #$%02x%02x */
		case 0x83: opstr = lc ? "cmpd" : "CMPD"; goto Limm16_4;
		case 0x8c: opstr = lc ? "cmpy" : "CMPY"; goto Limm16_4;
		case 0x8e: opstr = lc ? "ldy" : "LDY"; goto Limm16_4;
		case 0xce: opstr = lc ? "lds" : "LDS"; goto Limm16_4;

		/* direct $%02x */
		case 0x93: opstr = lc ? "cmpd" : "CMPD"; goto Ldirect_3;
		case 0x9c: opstr = lc ? "cmpy" : "CMPY"; goto Ldirect_3;
		case 0x9e: opstr = lc ? "ldy" : "LDY"; goto Ldirect_3;
		case 0x9f: opstr = lc ? "sty" : "STY"; goto Ldirect_3;
		case 0xde: opstr = lc ? "lds" : "LDS"; goto Ldirect_3;
		case 0xdf: opstr = lc ? "sts" : "STS"; goto Ldirect_3;

		/* indexed $%02x,x */
		case 0xa3: opstr = lc ? "cmpd" : "CMPD"; goto Lindexed_3;
		case 0xac: opstr = lc ? "cmpy" : "CMPY"; goto Lindexed_3;
		case 0xae: opstr = lc ? "ldy" : "LDY"; goto Lindexed_3;
		case 0xaf: opstr = lc ? "sty" : "STY"; goto Lindexed_3;
		case 0xee: opstr = lc ? "lds" : "LDS"; goto Lindexed_3;
		case 0xef: opstr = lc ? "sts" : "STS"; goto Lindexed_3;

		/* extended $%02x%02x */
		case 0xb3: opstr = lc ? "cmpd" : "CMPD"; goto Lextended_4;
		case 0xbc: opstr = lc ? "cmpy" : "CMPY"; goto Lextended_4;
		case 0xbe: opstr = lc ? "ldy" : "LDY"; goto Lextended_4;
		case 0xbf: opstr = lc ? "sty" : "STY"; goto Lextended_4;
		case 0xfe: opstr = lc ? "lds" : "LDS"; goto Lextended_4;
		case 0xff: opstr = lc ? "sts" : "STS"; goto Lextended_4;

	default:
		h = &hexdigits[(leadin & 0xff)*2]; *t++=*h++; *t++=*h++;
		h = &hexdigits[(opcode & 0xff)*2]; *t++=*h++; *t++=*h++;
		break;
	}
	break;

case 0x11:
	leadin = opcode;
	opcode = entry->instruction[1];
	switch(opcode) {
		/* inherent  */
		case 0x3f: opstr = lc ? "swi3" : "SWI3"; goto Linherent_2;

		/* imm16 #$%02x%02x */
		case 0x83: opstr = lc ? "cmpu" : "CMPU"; goto Limm16_4;
		case 0x8c: opstr = lc ? "cmps" : "CMPS"; goto Limm16_4;

		/* direct $%02x */
		case 0x93: opstr = lc ? "cmpu" : "CMPU"; goto Ldirect_3;
		case 0x9c: opstr = lc ? "cmps" : "CMPS"; goto Ldirect_3;

		/* indexed $%02x,x */
		case 0xa3: opstr = lc ? "cmpu" : "CMPU"; goto Lindexed_3;
		case 0xac: opstr = lc ? "cmps" : "CMPS"; goto Lindexed_3;

		/* extended $%02x%02x */
		case 0xb3: opstr = lc ? "cmpu" : "CMPU"; goto Lextended_4;
		case 0xbc: opstr = lc ? "cmps" : "CMPS"; goto Lextended_4;

	default:
		h = &hexdigits[(leadin & 0xff)*2]; *t++=*h++; *t++=*h++;
		h = &hexdigits[(opcode & 0xff)*2]; *t++=*h++; *t++=*h++;
		break;
	}
	break;

	default:
		h = &hexdigits[(opcode & 0xff)*2]; *t++=*h++; *t++=*h++;
		goto last;
	}
Ldirect_2: /* $%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lindexed_2: /* $%02x,x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='x';
	else *t++='X';
	goto last;
Linherent_1: /*  [] */
	do {*t++ = *opstr++;} while (*opstr);
	goto last;
Lrel16_3: /* $%04x ['rel'] */
	do {*t++ = *opstr++;} while (*opstr);
	rel = entry->target_addr;
	*t++=' ';
	t += print_label_or_addr(rel, jmp_targets, t, hexdigits, 0);
	goto last;
Limm8_2: /* #$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	goto last;
Lr1_r2_2: /* $%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lrel8_2: /* $%04x ['rel'] */
	do {*t++ = *opstr++;} while (*opstr);
	dist = entry->instruction[1];
	if (dist > 127) dist -= 256;
	rel = (entry->pc + 2 + dist) & 0xffff;
	*t++=' ';
	t += print_label_or_addr(rel, jmp_targets, t, hexdigits, 0);
	goto last;
Lextended_3: /* $%02x%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	addr = op2 + 256 * op1;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	goto last;
Limm16_3: /* #$%02x%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	h = &hexdigits[(op2)*2]; *t++=*h++; *t++=*h++;
	goto last;
Lrel16_4: /* $%04x ['rel'] */
	do {*t++ = *opstr++;} while (*opstr);
	rel = entry->target_addr;
	*t++=' ';
	t += print_label_or_addr(rel, jmp_targets, t, hexdigits, 0);
	goto last;
Linherent_2: /*  [] */
	do {*t++ = *opstr++;} while (*opstr);
	goto last;
Limm16_4: /* #$%02x%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[2];
	op2 = entry->instruction[3];
	*t++=' ',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	h = &hexdigits[(op2)*2]; *t++=*h++; *t++=*h++;
	goto last;
Ldirect_3: /* $%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[2];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lindexed_3: /* $%02x,x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[2];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='x';
	else *t++='X';
	goto last;
Lextended_4: /* $%02x%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[2];
	op2 = entry->instruction[3];
	*t++=' ';
	addr = op2 + 256 * op1;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	goto last;

last:
	return (int)(t - first_t);
}

int stringify_entry_6811(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets) {
	int dist;
	unsigned char opcode, leadin, op1, op2, op3;
	char *first_t, *h, *opstr;
	unsigned short rel, addr;

	first_t = t;
	opcode = entry->instruction[0];
	switch(opcode) {
	/* inherent  */
	case 0x0: opstr = lc ? "test" : "TEST"; goto Linherent_1;
	case 0x1: opstr = lc ? "nop" : "NOP"; goto Linherent_1;
	case 0x2: opstr = lc ? "idiv" : "IDIV"; goto Linherent_1;
	case 0x3: opstr = lc ? "fdiv" : "FDIV"; goto Linherent_1;
	case 0x4: opstr = lc ? "lsrd" : "LSRD"; goto Linherent_1;
	case 0x5: opstr = lc ? "lsld" : "LSLD"; goto Linherent_1;
	case 0x6: opstr = lc ? "tap" : "TAP"; goto Linherent_1;
	case 0x7: opstr = lc ? "tpa" : "TPA"; goto Linherent_1;
	case 0x8: opstr = lc ? "inx" : "INX"; goto Linherent_1;
	case 0x9: opstr = lc ? "dex" : "DEX"; goto Linherent_1;
	case 0xa: opstr = lc ? "clv" : "CLV"; goto Linherent_1;
	case 0xb: opstr = lc ? "sev" : "SEV"; goto Linherent_1;
	case 0xc: opstr = lc ? "clc" : "CLC"; goto Linherent_1;
	case 0xd: opstr = lc ? "sec" : "SEC"; goto Linherent_1;
	case 0xe: opstr = lc ? "cli" : "CLI"; goto Linherent_1;
	case 0xf: opstr = lc ? "sei" : "SEI"; goto Linherent_1;
	case 0x10: opstr = lc ? "sba" : "SBA"; goto Linherent_1;
	case 0x11: opstr = lc ? "cba" : "CBA"; goto Linherent_1;
	case 0x16: opstr = lc ? "tab" : "TAB"; goto Linherent_1;
	case 0x17: opstr = lc ? "tba" : "TBA"; goto Linherent_1;
	case 0x19: opstr = lc ? "daa" : "DAA"; goto Linherent_1;
	case 0x1b: opstr = lc ? "aba" : "ABA"; goto Linherent_1;
	case 0x30: opstr = lc ? "tsx" : "TSX"; goto Linherent_1;
	case 0x31: opstr = lc ? "ins" : "INS"; goto Linherent_1;
	case 0x32: opstr = lc ? "pula" : "PULA"; goto Linherent_1;
	case 0x33: opstr = lc ? "pulb" : "PULB"; goto Linherent_1;
	case 0x34: opstr = lc ? "des" : "DES"; goto Linherent_1;
	case 0x35: opstr = lc ? "txs" : "TXS"; goto Linherent_1;
	case 0x36: opstr = lc ? "psha" : "PSHA"; goto Linherent_1;
	case 0x37: opstr = lc ? "pshb" : "PSHB"; goto Linherent_1;
	case 0x38: opstr = lc ? "pulx" : "PULX"; goto Linherent_1;
	case 0x39: opstr = lc ? "rts" : "RTS"; goto Linherent_1;
	case 0x3a: opstr = lc ? "abx" : "ABX"; goto Linherent_1;
	case 0x3b: opstr = lc ? "rti" : "RTI"; goto Linherent_1;
	case 0x3c: opstr = lc ? "pshx" : "PSHX"; goto Linherent_1;
	case 0x3d: opstr = lc ? "mul" : "MUL"; goto Linherent_1;
	case 0x3e: opstr = lc ? "wai" : "WAI"; goto Linherent_1;
	case 0x3f: opstr = lc ? "swi" : "SWI"; goto Linherent_1;
	case 0x43: opstr = lc ? "coma" : "COMA"; goto Linherent_1;
	case 0x44: opstr = lc ? "lsra" : "LSRA"; goto Linherent_1;
	case 0x46: opstr = lc ? "rora" : "RORA"; goto Linherent_1;
	case 0x47: opstr = lc ? "asra" : "ASRA"; goto Linherent_1;
	case 0x48: opstr = lc ? "lsla" : "LSLA"; goto Linherent_1;
	case 0x49: opstr = lc ? "rola" : "ROLA"; goto Linherent_1;
	case 0x4a: opstr = lc ? "deca" : "DECA"; goto Linherent_1;
	case 0x4c: opstr = lc ? "inca" : "INCA"; goto Linherent_1;
	case 0x4d: opstr = lc ? "tsta" : "TSTA"; goto Linherent_1;
	case 0x4f: opstr = lc ? "clra" : "CLRA"; goto Linherent_1;
	case 0x53: opstr = lc ? "comb" : "COMB"; goto Linherent_1;
	case 0x54: opstr = lc ? "lsrb" : "LSRB"; goto Linherent_1;
	case 0x55: opstr = lc ? "rorb" : "RORB"; goto Linherent_1;
	case 0x57: opstr = lc ? "asrb" : "ASRB"; goto Linherent_1;
	case 0x58: opstr = lc ? "lslb" : "LSLB"; goto Linherent_1;
	case 0x59: opstr = lc ? "rolb" : "ROLB"; goto Linherent_1;
	case 0x5a: opstr = lc ? "decb" : "DECB"; goto Linherent_1;
	case 0x5c: opstr = lc ? "incb" : "INCB"; goto Linherent_1;
	case 0x5d: opstr = lc ? "tstb" : "TSTB"; goto Linherent_1;
	case 0x5f: opstr = lc ? "clrb" : "CLRB"; goto Linherent_1;
	case 0x8f: opstr = lc ? "xgdx" : "XGDX"; goto Linherent_1;
	case 0xcf: opstr = lc ? "stop" : "STOP"; goto Linherent_1;

	/* direct3 *$%02x $%02x ${2:04x} */
	case 0x12: opstr = lc ? "brset" : "BRSET"; goto Ldirect3_4;
	case 0x13: opstr = lc ? "brclr" : "BRCLR"; goto Ldirect3_4;

	/* direct2 *$%02x $%02x */
	case 0x14: opstr = lc ? "bset" : "BSET"; goto Ldirect2_3;
	case 0x15: opstr = lc ? "bclr" : "BCLR"; goto Ldirect2_3;

	/* indexedx2 $%02x,x $%02x */
	case 0x1c: opstr = lc ? "bset" : "BSET"; goto Lindexedx2_3;
	case 0x1d: opstr = lc ? "bclr" : "BCLR"; goto Lindexedx2_3;

	/* indexedx3 $%02x,x $%02x ${2:04x} */
	case 0x1e: opstr = lc ? "brset" : "BRSET"; goto Lindexedx3_4;
	case 0x1f: opstr = lc ? "brclr" : "BRCLR"; goto Lindexedx3_4;

	/* relative $%04x */
	case 0x20: opstr = lc ? "bra" : "BRA"; goto Lrelative_2;
	case 0x21: opstr = lc ? "brn" : "BRN"; goto Lrelative_2;
	case 0x22: opstr = lc ? "bhi" : "BHI"; goto Lrelative_2;
	case 0x23: opstr = lc ? "bls" : "BLS"; goto Lrelative_2;
	case 0x24: opstr = lc ? "bhs" : "BHS"; goto Lrelative_2;
	case 0x25: opstr = lc ? "blo" : "BLO"; goto Lrelative_2;
	case 0x26: opstr = lc ? "bne" : "BNE"; goto Lrelative_2;
	case 0x27: opstr = lc ? "beq" : "BEQ"; goto Lrelative_2;
	case 0x28: opstr = lc ? "bvc" : "BVC"; goto Lrelative_2;
	case 0x29: opstr = lc ? "bvs" : "BVS"; goto Lrelative_2;
	case 0x2a: opstr = lc ? "bpl" : "BPL"; goto Lrelative_2;
	case 0x2b: opstr = lc ? "bmi" : "BMI"; goto Lrelative_2;
	case 0x2c: opstr = lc ? "bge" : "BGE"; goto Lrelative_2;
	case 0x2d: opstr = lc ? "blt" : "BLT"; goto Lrelative_2;
	case 0x2e: opstr = lc ? "bgt" : "BGT"; goto Lrelative_2;
	case 0x2f: opstr = lc ? "ble" : "BLE"; goto Lrelative_2;
	case 0x8d: opstr = lc ? "bsr" : "BSR"; goto Lrelative_2;

	/* inherent  */
	case 0x40: opstr = lc ? "nega" : "NEGA"; goto Linherent_3;
	case 0x50: opstr = lc ? "negb" : "NEGB"; goto Linherent_3;

	/* indexedx $%02x,x */
	case 0x60: opstr = lc ? "neg" : "NEG"; goto Lindexedx_2;
	case 0x63: opstr = lc ? "com" : "COM"; goto Lindexedx_2;
	case 0x64: opstr = lc ? "lsr" : "LSR"; goto Lindexedx_2;
	case 0x66: opstr = lc ? "ror" : "ROR"; goto Lindexedx_2;
	case 0x67: opstr = lc ? "asr" : "ASR"; goto Lindexedx_2;
	case 0x68: opstr = lc ? "lsl" : "LSL"; goto Lindexedx_2;
	case 0x69: opstr = lc ? "rol" : "ROL"; goto Lindexedx_2;
	case 0x6a: opstr = lc ? "dec" : "DEC"; goto Lindexedx_2;
	case 0x6c: opstr = lc ? "inc" : "INC"; goto Lindexedx_2;
	case 0x6d: opstr = lc ? "tst" : "TST"; goto Lindexedx_2;
	case 0x6e: opstr = lc ? "jmp" : "JMP"; goto Lindexedx_2;
	case 0x6f: opstr = lc ? "clr" : "CLR"; goto Lindexedx_2;
	case 0xa0: opstr = lc ? "suba" : "SUBA"; goto Lindexedx_2;
	case 0xa1: opstr = lc ? "cmpa" : "CMPA"; goto Lindexedx_2;
	case 0xa2: opstr = lc ? "sbca" : "SBCA"; goto Lindexedx_2;
	case 0xa3: opstr = lc ? "subd" : "SUBD"; goto Lindexedx_2;
	case 0xa4: opstr = lc ? "anda" : "ANDA"; goto Lindexedx_2;
	case 0xa5: opstr = lc ? "bita" : "BITA"; goto Lindexedx_2;
	case 0xa6: opstr = lc ? "ldaa" : "LDAA"; goto Lindexedx_2;
	case 0xa7: opstr = lc ? "staa" : "STAA"; goto Lindexedx_2;
	case 0xa8: opstr = lc ? "eora" : "EORA"; goto Lindexedx_2;
	case 0xa9: opstr = lc ? "adca" : "ADCA"; goto Lindexedx_2;
	case 0xaa: opstr = lc ? "oraa" : "ORAA"; goto Lindexedx_2;
	case 0xab: opstr = lc ? "adda" : "ADDA"; goto Lindexedx_2;
	case 0xac: opstr = lc ? "cpx" : "CPX"; goto Lindexedx_2;
	case 0xad: opstr = lc ? "jsr" : "JSR"; goto Lindexedx_2;
	case 0xae: opstr = lc ? "lds" : "LDS"; goto Lindexedx_2;
	case 0xaf: opstr = lc ? "sts" : "STS"; goto Lindexedx_2;
	case 0xe0: opstr = lc ? "subb" : "SUBB"; goto Lindexedx_2;
	case 0xe1: opstr = lc ? "cmpb" : "CMPB"; goto Lindexedx_2;
	case 0xe2: opstr = lc ? "sbcb" : "SBCB"; goto Lindexedx_2;
	case 0xe3: opstr = lc ? "addd" : "ADDD"; goto Lindexedx_2;
	case 0xe4: opstr = lc ? "andb" : "ANDB"; goto Lindexedx_2;
	case 0xe5: opstr = lc ? "bitb" : "BITB"; goto Lindexedx_2;
	case 0xe6: opstr = lc ? "ldab" : "LDAB"; goto Lindexedx_2;
	case 0xe7: opstr = lc ? "stab" : "STAB"; goto Lindexedx_2;
	case 0xe8: opstr = lc ? "eorb" : "EORB"; goto Lindexedx_2;
	case 0xe9: opstr = lc ? "adcb" : "ADCB"; goto Lindexedx_2;
	case 0xea: opstr = lc ? "orab" : "ORAB"; goto Lindexedx_2;
	case 0xeb: opstr = lc ? "addb" : "ADDB"; goto Lindexedx_2;
	case 0xec: opstr = lc ? "ldd" : "LDD"; goto Lindexedx_2;
	case 0xed: opstr = lc ? "std" : "STD"; goto Lindexedx_2;
	case 0xee: opstr = lc ? "ldx" : "LDX"; goto Lindexedx_2;
	case 0xef: opstr = lc ? "stx" : "STX"; goto Lindexedx_2;

	/* extended $%02x%02x */
	case 0x70: opstr = lc ? "neg" : "NEG"; goto Lextended_3;
	case 0x73: opstr = lc ? "com" : "COM"; goto Lextended_3;
	case 0x74: opstr = lc ? "lsr" : "LSR"; goto Lextended_3;
	case 0x76: opstr = lc ? "ror" : "ROR"; goto Lextended_3;
	case 0x77: opstr = lc ? "asr" : "ASR"; goto Lextended_3;
	case 0x78: opstr = lc ? "lsl" : "LSL"; goto Lextended_3;
	case 0x79: opstr = lc ? "rol" : "ROL"; goto Lextended_3;
	case 0x7a: opstr = lc ? "dec" : "DEC"; goto Lextended_3;
	case 0x7c: opstr = lc ? "inc" : "INC"; goto Lextended_3;
	case 0x7d: opstr = lc ? "tst" : "TST"; goto Lextended_3;
	case 0x7e: opstr = lc ? "jmp" : "JMP"; goto Lextended_3;
	case 0x7f: opstr = lc ? "clr" : "CLR"; goto Lextended_3;
	case 0xb0: opstr = lc ? "suba" : "SUBA"; goto Lextended_3;
	case 0xb1: opstr = lc ? "cmpa" : "CMPA"; goto Lextended_3;
	case 0xb2: opstr = lc ? "sbca" : "SBCA"; goto Lextended_3;
	case 0xb3: opstr = lc ? "subd" : "SUBD"; goto Lextended_3;
	case 0xb4: opstr = lc ? "anda" : "ANDA"; goto Lextended_3;
	case 0xb5: opstr = lc ? "bita" : "BITA"; goto Lextended_3;
	case 0xb6: opstr = lc ? "ldaa" : "LDAA"; goto Lextended_3;
	case 0xb7: opstr = lc ? "staa" : "STAA"; goto Lextended_3;
	case 0xb8: opstr = lc ? "eora" : "EORA"; goto Lextended_3;
	case 0xb9: opstr = lc ? "adca" : "ADCA"; goto Lextended_3;
	case 0xba: opstr = lc ? "oraa" : "ORAA"; goto Lextended_3;
	case 0xbb: opstr = lc ? "adda" : "ADDA"; goto Lextended_3;
	case 0xbc: opstr = lc ? "cpx" : "CPX"; goto Lextended_3;
	case 0xbd: opstr = lc ? "jsr" : "JSR"; goto Lextended_3;
	case 0xbe: opstr = lc ? "lds" : "LDS"; goto Lextended_3;
	case 0xbf: opstr = lc ? "sts" : "STS"; goto Lextended_3;
	case 0xf0: opstr = lc ? "subb" : "SUBB"; goto Lextended_3;
	case 0xf1: opstr = lc ? "cmpb" : "CMPB"; goto Lextended_3;
	case 0xf2: opstr = lc ? "sbcb" : "SBCB"; goto Lextended_3;
	case 0xf3: opstr = lc ? "addd" : "ADDD"; goto Lextended_3;
	case 0xf4: opstr = lc ? "andb" : "ANDB"; goto Lextended_3;
	case 0xf5: opstr = lc ? "bitb" : "BITB"; goto Lextended_3;
	case 0xf6: opstr = lc ? "ldab" : "LDAB"; goto Lextended_3;
	case 0xf7: opstr = lc ? "stab" : "STAB"; goto Lextended_3;
	case 0xf8: opstr = lc ? "eorb" : "EORB"; goto Lextended_3;
	case 0xf9: opstr = lc ? "adcb" : "ADCB"; goto Lextended_3;
	case 0xfa: opstr = lc ? "orab" : "ORAB"; goto Lextended_3;
	case 0xfb: opstr = lc ? "addb" : "ADDB"; goto Lextended_3;
	case 0xfc: opstr = lc ? "ldd" : "LDD"; goto Lextended_3;
	case 0xfd: opstr = lc ? "std" : "STD"; goto Lextended_3;
	case 0xfe: opstr = lc ? "ldx" : "LDX"; goto Lextended_3;
	case 0xff: opstr = lc ? "stx" : "STX"; goto Lextended_3;

	/* immediate #$%02x */
	case 0x80: opstr = lc ? "suba" : "SUBA"; goto Limmediate_2;
	case 0x81: opstr = lc ? "cmpa" : "CMPA"; goto Limmediate_2;
	case 0x82: opstr = lc ? "sbca" : "SBCA"; goto Limmediate_2;
	case 0x84: opstr = lc ? "anda" : "ANDA"; goto Limmediate_2;
	case 0x85: opstr = lc ? "bita" : "BITA"; goto Limmediate_2;
	case 0x86: opstr = lc ? "ldaa" : "LDAA"; goto Limmediate_2;
	case 0x88: opstr = lc ? "eora" : "EORA"; goto Limmediate_2;
	case 0x89: opstr = lc ? "adca" : "ADCA"; goto Limmediate_2;
	case 0x8a: opstr = lc ? "oraa" : "ORAA"; goto Limmediate_2;
	case 0x8b: opstr = lc ? "adda" : "ADDA"; goto Limmediate_2;
	case 0xc0: opstr = lc ? "subb" : "SUBB"; goto Limmediate_2;
	case 0xc1: opstr = lc ? "cmpb" : "CMPB"; goto Limmediate_2;
	case 0xc2: opstr = lc ? "sbcb" : "SBCB"; goto Limmediate_2;
	case 0xc4: opstr = lc ? "andb" : "ANDB"; goto Limmediate_2;
	case 0xc5: opstr = lc ? "bitb" : "BITB"; goto Limmediate_2;
	case 0xc6: opstr = lc ? "ldab" : "LDAB"; goto Limmediate_2;
	case 0xc8: opstr = lc ? "eorb" : "EORB"; goto Limmediate_2;
	case 0xc9: opstr = lc ? "adcb" : "ADCB"; goto Limmediate_2;
	case 0xca: opstr = lc ? "orab" : "ORAB"; goto Limmediate_2;
	case 0xcb: opstr = lc ? "addb" : "ADDB"; goto Limmediate_2;

	/* immediatex #$%02x%02x */
	case 0x83: opstr = lc ? "subd" : "SUBD"; goto Limmediatex_3;
	case 0x8c: opstr = lc ? "cpx" : "CPX"; goto Limmediatex_3;
	case 0x8e: opstr = lc ? "lds" : "LDS"; goto Limmediatex_3;
	case 0xc3: opstr = lc ? "addd" : "ADDD"; goto Limmediatex_3;
	case 0xcc: opstr = lc ? "ldd" : "LDD"; goto Limmediatex_3;
	case 0xce: opstr = lc ? "ldx" : "LDX"; goto Limmediatex_3;

	/* direct $%02x */
	case 0x90: opstr = lc ? "suba" : "SUBA"; goto Ldirect_2;
	case 0x91: opstr = lc ? "cmpa" : "CMPA"; goto Ldirect_2;
	case 0x92: opstr = lc ? "sbca" : "SBCA"; goto Ldirect_2;
	case 0x93: opstr = lc ? "subd" : "SUBD"; goto Ldirect_2;
	case 0x94: opstr = lc ? "anda" : "ANDA"; goto Ldirect_2;
	case 0x95: opstr = lc ? "bita" : "BITA"; goto Ldirect_2;
	case 0x96: opstr = lc ? "ldaa" : "LDAA"; goto Ldirect_2;
	case 0x97: opstr = lc ? "staa" : "STAA"; goto Ldirect_2;
	case 0x98: opstr = lc ? "eora" : "EORA"; goto Ldirect_2;
	case 0x99: opstr = lc ? "adca" : "ADCA"; goto Ldirect_2;
	case 0x9a: opstr = lc ? "oraa" : "ORAA"; goto Ldirect_2;
	case 0x9b: opstr = lc ? "adda" : "ADDA"; goto Ldirect_2;
	case 0x9c: opstr = lc ? "cpx" : "CPX"; goto Ldirect_2;
	case 0x9d: opstr = lc ? "jsr" : "JSR"; goto Ldirect_2;
	case 0x9e: opstr = lc ? "lds" : "LDS"; goto Ldirect_2;
	case 0x9f: opstr = lc ? "sts" : "STS"; goto Ldirect_2;
	case 0xd0: opstr = lc ? "subb" : "SUBB"; goto Ldirect_2;
	case 0xd1: opstr = lc ? "cmpb" : "CMPB"; goto Ldirect_2;
	case 0xd2: opstr = lc ? "sbcb" : "SBCB"; goto Ldirect_2;
	case 0xd3: opstr = lc ? "addd" : "ADDD"; goto Ldirect_2;
	case 0xd4: opstr = lc ? "andb" : "ANDB"; goto Ldirect_2;
	case 0xd5: opstr = lc ? "bitb" : "BITB"; goto Ldirect_2;
	case 0xd6: opstr = lc ? "ldab" : "LDAB"; goto Ldirect_2;
	case 0xd7: opstr = lc ? "stab" : "STAB"; goto Ldirect_2;
	case 0xd8: opstr = lc ? "eorb" : "EORB"; goto Ldirect_2;
	case 0xd9: opstr = lc ? "adcb" : "ADCB"; goto Ldirect_2;
	case 0xda: opstr = lc ? "orab" : "ORAB"; goto Ldirect_2;
	case 0xdb: opstr = lc ? "addb" : "ADDB"; goto Ldirect_2;
	case 0xdc: opstr = lc ? "ldd" : "LDD"; goto Ldirect_2;
	case 0xdd: opstr = lc ? "std" : "STD"; goto Ldirect_2;
	case 0xde: opstr = lc ? "ldx" : "LDX"; goto Ldirect_2;
	case 0xdf: opstr = lc ? "stx" : "STX"; goto Ldirect_2;

case 0x18:
	leadin = opcode;
	opcode = entry->instruction[1];
	switch(opcode) {
		/* inherent  */
		case 0x8: opstr = lc ? "iny" : "INY"; goto Linherent_2;
		case 0x9: opstr = lc ? "dey" : "DEY"; goto Linherent_2;
		case 0x30: opstr = lc ? "tsy" : "TSY"; goto Linherent_2;
		case 0x35: opstr = lc ? "tys" : "TYS"; goto Linherent_2;
		case 0x38: opstr = lc ? "puly" : "PULY"; goto Linherent_2;
		case 0x3a: opstr = lc ? "aby" : "ABY"; goto Linherent_2;
		case 0x3c: opstr = lc ? "pshy" : "PSHY"; goto Linherent_2;
		case 0x8f: opstr = lc ? "xgdy" : "XGDY"; goto Linherent_2;

		/* indexedy2 $%02x,y $%02x */
		case 0x1c: opstr = lc ? "bset" : "BSET"; goto Lindexedy2_4;
		case 0x1d: opstr = lc ? "bclr" : "BCLR"; goto Lindexedy2_4;

		/* indexedy3 $%02x,y $%02x ${2:04x} */
		case 0x1e: opstr = lc ? "brset" : "BRSET"; goto Lindexedy3_5;
		case 0x1f: opstr = lc ? "brclr" : "BRCLR"; goto Lindexedy3_5;

		/* indexedy $%02x,y */
		case 0x60: opstr = lc ? "neg" : "NEG"; goto Lindexedy_3;
		case 0x63: opstr = lc ? "com" : "COM"; goto Lindexedy_3;
		case 0x64: opstr = lc ? "lsr" : "LSR"; goto Lindexedy_3;
		case 0x66: opstr = lc ? "ror" : "ROR"; goto Lindexedy_3;
		case 0x67: opstr = lc ? "asr" : "ASR"; goto Lindexedy_3;
		case 0x68: opstr = lc ? "lsl" : "LSL"; goto Lindexedy_3;
		case 0x69: opstr = lc ? "rol" : "ROL"; goto Lindexedy_3;
		case 0x6a: opstr = lc ? "dec" : "DEC"; goto Lindexedy_3;
		case 0x6c: opstr = lc ? "inc" : "INC"; goto Lindexedy_3;
		case 0x6d: opstr = lc ? "tst" : "TST"; goto Lindexedy_3;
		case 0x6e: opstr = lc ? "jmp" : "JMP"; goto Lindexedy_3;
		case 0x7f: opstr = lc ? "clr" : "CLR"; goto Lindexedy_3;
		case 0xa0: opstr = lc ? "suba" : "SUBA"; goto Lindexedy_3;
		case 0xa1: opstr = lc ? "cmpa" : "CMPA"; goto Lindexedy_3;
		case 0xa2: opstr = lc ? "sbca" : "SBCA"; goto Lindexedy_3;
		case 0xa3: opstr = lc ? "subd" : "SUBD"; goto Lindexedy_3;
		case 0xa4: opstr = lc ? "anda" : "ANDA"; goto Lindexedy_3;
		case 0xa5: opstr = lc ? "bita" : "BITA"; goto Lindexedy_3;
		case 0xa6: opstr = lc ? "ldaa" : "LDAA"; goto Lindexedy_3;
		case 0xa7: opstr = lc ? "staa" : "STAA"; goto Lindexedy_3;
		case 0xa8: opstr = lc ? "eora" : "EORA"; goto Lindexedy_3;
		case 0xa9: opstr = lc ? "adca" : "ADCA"; goto Lindexedy_3;
		case 0xaa: opstr = lc ? "oraa" : "ORAA"; goto Lindexedy_3;
		case 0xab: opstr = lc ? "adda" : "ADDA"; goto Lindexedy_3;
		case 0xac: opstr = lc ? "cpy" : "CPY"; goto Lindexedy_3;
		case 0xad: opstr = lc ? "jsr" : "JSR"; goto Lindexedy_3;
		case 0xae: opstr = lc ? "lds" : "LDS"; goto Lindexedy_3;
		case 0xaf: opstr = lc ? "sts" : "STS"; goto Lindexedy_3;
		case 0xe0: opstr = lc ? "subb" : "SUBB"; goto Lindexedy_3;
		case 0xe1: opstr = lc ? "cmpb" : "CMPB"; goto Lindexedy_3;
		case 0xe2: opstr = lc ? "sbcb" : "SBCB"; goto Lindexedy_3;
		case 0xe3: opstr = lc ? "addd" : "ADDD"; goto Lindexedy_3;
		case 0xe4: opstr = lc ? "andb" : "ANDB"; goto Lindexedy_3;
		case 0xe5: opstr = lc ? "bitb" : "BITB"; goto Lindexedy_3;
		case 0xe6: opstr = lc ? "ldab" : "LDAB"; goto Lindexedy_3;
		case 0xe7: opstr = lc ? "stab" : "STAB"; goto Lindexedy_3;
		case 0xe8: opstr = lc ? "eorb" : "EORB"; goto Lindexedy_3;
		case 0xe9: opstr = lc ? "adcb" : "ADCB"; goto Lindexedy_3;
		case 0xea: opstr = lc ? "orab" : "ORAB"; goto Lindexedy_3;
		case 0xeb: opstr = lc ? "addb" : "ADDB"; goto Lindexedy_3;
		case 0xec: opstr = lc ? "ldd" : "LDD"; goto Lindexedy_3;
		case 0xed: opstr = lc ? "std" : "STD"; goto Lindexedy_3;
		case 0xee: opstr = lc ? "ldy" : "LDY"; goto Lindexedy_3;
		case 0xef: opstr = lc ? "sty" : "STY"; goto Lindexedy_3;

		/* immediatex #$%02x%02x */
		case 0x8c: opstr = lc ? "cpy" : "CPY"; goto Limmediatex_4;
		case 0xce: opstr = lc ? "ldy" : "LDY"; goto Limmediatex_4;

		/* direct $%02x */
		case 0x9c: opstr = lc ? "cpy" : "CPY"; goto Ldirect_3;
		case 0xde: opstr = lc ? "ldy" : "LDY"; goto Ldirect_3;
		case 0xdf: opstr = lc ? "sty" : "STY"; goto Ldirect_3;

		/* extended $%02x%02x */
		case 0xbc: opstr = lc ? "cpy" : "CPY"; goto Lextended_4;
		case 0xfe: opstr = lc ? "ldy" : "LDY"; goto Lextended_4;
		case 0xff: opstr = lc ? "sty" : "STY"; goto Lextended_4;

	default:
		h = &hexdigits[(leadin & 0xff)*2]; *t++=*h++; *t++=*h++;
		h = &hexdigits[(opcode & 0xff)*2]; *t++=*h++; *t++=*h++;
		break;
	}
	break;

case 0x1a:
	leadin = opcode;
	opcode = entry->instruction[1];
	switch(opcode) {
		/* immediatex #$%02x%02x */
		case 0x83: opstr = lc ? "cpd" : "CPD"; goto Limmediatex_4;

		/* direct $%02x */
		case 0x93: opstr = lc ? "cpd" : "CPD"; goto Ldirect_3;

		/* indexedx $%02x,x */
		case 0xa3: opstr = lc ? "cpd" : "CPD"; goto Lindexedx_3;
		case 0xac: opstr = lc ? "cpy" : "CPY"; goto Lindexedx_3;
		case 0xee: opstr = lc ? "ldy" : "LDY"; goto Lindexedx_3;
		case 0xef: opstr = lc ? "sty" : "STY"; goto Lindexedx_3;

		/* extended $%02x%02x */
		case 0xb3: opstr = lc ? "cpd" : "CPD"; goto Lextended_4;

	default:
		h = &hexdigits[(leadin & 0xff)*2]; *t++=*h++; *t++=*h++;
		h = &hexdigits[(opcode & 0xff)*2]; *t++=*h++; *t++=*h++;
		break;
	}
	break;

case 0xcd:
	leadin = opcode;
	opcode = entry->instruction[1];
	switch(opcode) {
		/* indexedy $%02x,y */
		case 0xa3: opstr = lc ? "cpd" : "CPD"; goto Lindexedy_3;
		case 0xac: opstr = lc ? "cpx" : "CPX"; goto Lindexedy_3;
		case 0xee: opstr = lc ? "ldx" : "LDX"; goto Lindexedy_3;
		case 0xef: opstr = lc ? "stx" : "STX"; goto Lindexedy_3;

	default:
		h = &hexdigits[(leadin & 0xff)*2]; *t++=*h++; *t++=*h++;
		h = &hexdigits[(opcode & 0xff)*2]; *t++=*h++; *t++=*h++;
		break;
	}
	break;

	default:
		h = &hexdigits[(opcode & 0xff)*2]; *t++=*h++; *t++=*h++;
		goto last;
	}
Linherent_1: /*  [] */
	do {*t++ = *opstr++;} while (*opstr);
	goto last;
Ldirect3_4: /* *$%02x $%02x ${2:04x} ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	rel = entry->target_addr;
	*t++=' ',*t++='*';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=' ';
	t += print_label_or_addr(op2, jmp_targets, t, hexdigits, 1);
	*t++=' ',*t++='$',*t++='{',*t++='2',*t++=':',*t++='0',*t++='4';
	if (lc) *t++='x';
	else *t++='X';
	*t++='}';
	goto last;
Ldirect2_3: /* *$%02x $%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ',*t++='*';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=' ';
	t += print_label_or_addr(op2, jmp_targets, t, hexdigits, 1);
	goto last;
Lindexedx2_3: /* $%02x,x $%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='x';
	else *t++='X';
	*t++=' ';
	t += print_label_or_addr(op2, jmp_targets, t, hexdigits, 1);
	goto last;
Lindexedx3_4: /* $%02x,x $%02x ${2:04x} ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	rel = entry->target_addr;
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='x';
	else *t++='X';
	*t++=' ';
	t += print_label_or_addr(op2, jmp_targets, t, hexdigits, 1);
	*t++=' ',*t++='$',*t++='{',*t++='2',*t++=':',*t++='0',*t++='4';
	if (lc) *t++='x';
	else *t++='X';
	*t++='}';
	goto last;
Lrelative_2: /* $%04x ['rel'] */
	do {*t++ = *opstr++;} while (*opstr);
	dist = entry->instruction[1];
	if (dist > 127) dist -= 256;
	rel = (entry->pc + 2 + dist) & 0xffff;
	*t++=' ';
	t += print_label_or_addr(rel, jmp_targets, t, hexdigits, 0);
	goto last;
Linherent_3: /*  [] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	goto last;
Lindexedx_2: /* $%02x,x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='x';
	else *t++='X';
	goto last;
Lextended_3: /* $%02x%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	addr = op2 + 256 * op1;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	goto last;
Limmediate_2: /* #$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	goto last;
Limmediatex_3: /* #$%02x%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	h = &hexdigits[(op2)*2]; *t++=*h++; *t++=*h++;
	goto last;
Ldirect_2: /* $%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Linherent_2: /*  [] */
	do {*t++ = *opstr++;} while (*opstr);
	goto last;
Lindexedy2_4: /* $%02x,y $%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[2];
	op2 = entry->instruction[3];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='y';
	else *t++='Y';
	*t++=' ';
	t += print_label_or_addr(op2, jmp_targets, t, hexdigits, 1);
	goto last;
Lindexedy3_5: /* $%02x,y $%02x ${2:04x} ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='y';
	else *t++='Y';
	*t++=' ';
	t += print_label_or_addr(op2, jmp_targets, t, hexdigits, 1);
	*t++=' ',*t++='$',*t++='{',*t++='2',*t++=':',*t++='0',*t++='4';
	if (lc) *t++='x';
	else *t++='X';
	*t++='}';
	goto last;
Lindexedy_3: /* $%02x,y ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[2];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='y';
	else *t++='Y';
	goto last;
Limmediatex_4: /* #$%02x%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[2];
	op2 = entry->instruction[3];
	*t++=' ',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	h = &hexdigits[(op2)*2]; *t++=*h++; *t++=*h++;
	goto last;
Ldirect_3: /* $%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[2];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lextended_4: /* $%02x%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[2];
	op2 = entry->instruction[3];
	*t++=' ';
	addr = op2 + 256 * op1;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	goto last;
Lindexedx_3: /* $%02x,x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[2];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='x';
	else *t++='X';
	goto last;

last:
	return (int)(t - first_t);
}

int stringify_entry_8051(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets) {
	int dist;
	unsigned char opcode, leadin, op1, op2, op3;
	char *first_t, *h, *opstr;
	unsigned short rel, addr;

	first_t = t;
	opcode = entry->instruction[0];
	switch(opcode) {
	/*   */
	case 0x0: opstr = lc ? "nop" : "NOP"; goto L1;
	case 0x22: opstr = lc ? "ret" : "RET"; goto L1;
	case 0x32: opstr = lc ? "reti" : "RETI"; goto L1;

	/* addr11 $%02x */
	case 0x1: opstr = lc ? "ajmp" : "AJMP"; goto Laddr11_2;
	case 0x11: opstr = lc ? "acall" : "ACALL"; goto Laddr11_2;
	case 0x21: opstr = lc ? "ajmp" : "AJMP"; goto Laddr11_2;
	case 0x31: opstr = lc ? "acall" : "ACALL"; goto Laddr11_2;
	case 0x41: opstr = lc ? "ajmp" : "AJMP"; goto Laddr11_2;
	case 0x51: opstr = lc ? "acall" : "ACALL"; goto Laddr11_2;
	case 0x61: opstr = lc ? "ajmp" : "AJMP"; goto Laddr11_2;
	case 0x71: opstr = lc ? "acall" : "ACALL"; goto Laddr11_2;
	case 0x81: opstr = lc ? "ajmp" : "AJMP"; goto Laddr11_2;
	case 0x91: opstr = lc ? "acall" : "ACALL"; goto Laddr11_2;
	case 0xa1: opstr = lc ? "ajmp" : "AJMP"; goto Laddr11_2;
	case 0xb1: opstr = lc ? "acall" : "ACALL"; goto Laddr11_2;
	case 0xc1: opstr = lc ? "ajmp" : "AJMP"; goto Laddr11_2;
	case 0xd1: opstr = lc ? "acall" : "ACALL"; goto Laddr11_2;
	case 0xe1: opstr = lc ? "ajmp" : "AJMP"; goto Laddr11_2;
	case 0xf1: opstr = lc ? "acall" : "ACALL"; goto Laddr11_2;

	/* addr16 $%02x%02x */
	case 0x2: opstr = lc ? "ljmp" : "LJMP"; goto Laddr16_3;
	case 0x12: opstr = lc ? "lcall" : "LCALL"; goto Laddr16_3;

	/* a a */
	case 0x3: opstr = lc ? "rr" : "RR"; goto La_1;
	case 0x4: opstr = lc ? "inc" : "INC"; goto La_1;
	case 0x13: opstr = lc ? "rrc" : "RRC"; goto La_1;
	case 0x14: opstr = lc ? "dec" : "DEC"; goto La_1;
	case 0x23: opstr = lc ? "rl" : "RL"; goto La_1;
	case 0x33: opstr = lc ? "rlc" : "RLC"; goto La_1;
	case 0xc4: opstr = lc ? "swap" : "SWAP"; goto La_1;
	case 0xd4: opstr = lc ? "da" : "DA"; goto La_1;
	case 0xe4: opstr = lc ? "clr" : "CLR"; goto La_1;
	case 0xf4: opstr = lc ? "cpl" : "CPL"; goto La_1;

	/* direct $%02x */
	case 0x5: opstr = lc ? "inc" : "INC"; goto Ldirect_2;
	case 0x15: opstr = lc ? "dec" : "DEC"; goto Ldirect_2;
	case 0xc0: opstr = lc ? "push" : "PUSH"; goto Ldirect_2;
	case 0xd0: opstr = lc ? "pop" : "POP"; goto Ldirect_2;

	/* @r0 @r0 */
	case 0x6: opstr = lc ? "inc" : "INC"; goto Lat_r0_1;

	/* @r1 @r1 */
	case 0x7: opstr = lc ? "inc" : "INC"; goto Lat_r1_1;
	case 0x17: opstr = lc ? "dec" : "DEC"; goto Lat_r1_1;

	/* r0 r0 */
	case 0x8: opstr = lc ? "inc" : "INC"; goto Lr0_1;
	case 0x16: opstr = lc ? "dec" : "DEC"; goto Lr0_1;
	case 0x18: opstr = lc ? "dec" : "DEC"; goto Lr0_1;

	/* r1 r1 */
	case 0x9: opstr = lc ? "inc" : "INC"; goto Lr1_1;
	case 0x19: opstr = lc ? "dec" : "DEC"; goto Lr1_1;

	/* r2 r2 */
	case 0xa: opstr = lc ? "inc" : "INC"; goto Lr2_1;
	case 0x1a: opstr = lc ? "dec" : "DEC"; goto Lr2_1;

	/* r3 r3 */
	case 0xb: opstr = lc ? "inc" : "INC"; goto Lr3_1;
	case 0x1b: opstr = lc ? "dec" : "DEC"; goto Lr3_1;

	/* r4 r4 */
	case 0xc: opstr = lc ? "inc" : "INC"; goto Lr4_1;
	case 0x1c: opstr = lc ? "dec" : "DEC"; goto Lr4_1;

	/* r5 r5 */
	case 0xd: opstr = lc ? "inc" : "INC"; goto Lr5_1;
	case 0x1d: opstr = lc ? "dec" : "DEC"; goto Lr5_1;

	/* r6 r6 */
	case 0xe: opstr = lc ? "inc" : "INC"; goto Lr6_1;
	case 0x1e: opstr = lc ? "dec" : "DEC"; goto Lr6_1;

	/* r7 r7 */
	case 0xf: opstr = lc ? "inc" : "INC"; goto Lr7_1;
	case 0x1f: opstr = lc ? "dec" : "DEC"; goto Lr7_1;

	/* bit,offset $%02x,$%02x */
	case 0x10: opstr = lc ? "jbc" : "JBC"; goto Lbit_offset_3;
	case 0x20: opstr = lc ? "jb" : "JB"; goto Lbit_offset_3;
	case 0x30: opstr = lc ? "jnb" : "JNB"; goto Lbit_offset_3;

	/* a,immed a,#$%02x */
	case 0x24: opstr = lc ? "add" : "ADD"; goto La_immed_2;
	case 0x34: opstr = lc ? "addc" : "ADDC"; goto La_immed_2;
	case 0x44: opstr = lc ? "orl" : "ORL"; goto La_immed_2;
	case 0x54: opstr = lc ? "anl" : "ANL"; goto La_immed_2;
	case 0x64: opstr = lc ? "xrl" : "XRL"; goto La_immed_2;
	case 0x74: opstr = lc ? "mov" : "MOV"; goto La_immed_2;
	case 0x94: opstr = lc ? "subb" : "SUBB"; goto La_immed_2;

	/* a,direct a,$%02x */
	case 0x25: opstr = lc ? "add" : "ADD"; goto La_direct_2;
	case 0x35: opstr = lc ? "addc" : "ADDC"; goto La_direct_2;
	case 0x45: opstr = lc ? "orl" : "ORL"; goto La_direct_2;
	case 0x55: opstr = lc ? "anl" : "ANL"; goto La_direct_2;
	case 0x65: opstr = lc ? "xrl" : "XRL"; goto La_direct_2;
	case 0x95: opstr = lc ? "subb" : "SUBB"; goto La_direct_2;
	case 0xc5: opstr = lc ? "xch" : "XCH"; goto La_direct_2;
	case 0xe5: opstr = lc ? "mov" : "MOV"; goto La_direct_2;

	/* a,r0 a,r0 */
	case 0x26: opstr = lc ? "add" : "ADD"; goto La_r0_1;
	case 0x28: opstr = lc ? "add" : "ADD"; goto La_r0_1;
	case 0x38: opstr = lc ? "addc" : "ADDC"; goto La_r0_1;
	case 0x48: opstr = lc ? "orl" : "ORL"; goto La_r0_1;
	case 0x58: opstr = lc ? "anl" : "ANL"; goto La_r0_1;
	case 0x68: opstr = lc ? "xrl" : "XRL"; goto La_r0_1;
	case 0x98: opstr = lc ? "subb" : "SUBB"; goto La_r0_1;
	case 0xc8: opstr = lc ? "xch" : "XCH"; goto La_r0_1;
	case 0xe8: opstr = lc ? "mov" : "MOV"; goto La_r0_1;

	/* a,@r1 a,@r1 */
	case 0x27: opstr = lc ? "add" : "ADD"; goto La_at_r1_1;
	case 0x37: opstr = lc ? "addc" : "ADDC"; goto La_at_r1_1;
	case 0x47: opstr = lc ? "orl" : "ORL"; goto La_at_r1_1;
	case 0x57: opstr = lc ? "anl" : "ANL"; goto La_at_r1_1;
	case 0x67: opstr = lc ? "xrl" : "XRL"; goto La_at_r1_1;
	case 0x97: opstr = lc ? "subb" : "SUBB"; goto La_at_r1_1;
	case 0xc7: opstr = lc ? "xch" : "XCH"; goto La_at_r1_1;
	case 0xd7: opstr = lc ? "xchd" : "XCHD"; goto La_at_r1_1;
	case 0xe3: opstr = lc ? "movx" : "MOVX"; goto La_at_r1_1;
	case 0xe7: opstr = lc ? "mov" : "MOV"; goto La_at_r1_1;

	/* a,r1 a,r1 */
	case 0x29: opstr = lc ? "add" : "ADD"; goto La_r1_1;
	case 0x39: opstr = lc ? "addc" : "ADDC"; goto La_r1_1;
	case 0x49: opstr = lc ? "orl" : "ORL"; goto La_r1_1;
	case 0x59: opstr = lc ? "anl" : "ANL"; goto La_r1_1;
	case 0x69: opstr = lc ? "xrl" : "XRL"; goto La_r1_1;
	case 0x99: opstr = lc ? "subb" : "SUBB"; goto La_r1_1;
	case 0xc9: opstr = lc ? "xch" : "XCH"; goto La_r1_1;
	case 0xe9: opstr = lc ? "mov" : "MOV"; goto La_r1_1;

	/* a,r2 a,r2 */
	case 0x2a: opstr = lc ? "add" : "ADD"; goto La_r2_1;
	case 0x3a: opstr = lc ? "addc" : "ADDC"; goto La_r2_1;
	case 0x4a: opstr = lc ? "orl" : "ORL"; goto La_r2_1;
	case 0x5a: opstr = lc ? "anl" : "ANL"; goto La_r2_1;
	case 0x6a: opstr = lc ? "xrl" : "XRL"; goto La_r2_1;
	case 0x9a: opstr = lc ? "subb" : "SUBB"; goto La_r2_1;
	case 0xca: opstr = lc ? "xch" : "XCH"; goto La_r2_1;
	case 0xea: opstr = lc ? "mov" : "MOV"; goto La_r2_1;

	/* a,r3 a,r3 */
	case 0x2b: opstr = lc ? "add" : "ADD"; goto La_r3_1;
	case 0x3b: opstr = lc ? "addc" : "ADDC"; goto La_r3_1;
	case 0x4b: opstr = lc ? "orl" : "ORL"; goto La_r3_1;
	case 0x5b: opstr = lc ? "anl" : "ANL"; goto La_r3_1;
	case 0x6b: opstr = lc ? "xrl" : "XRL"; goto La_r3_1;
	case 0x9b: opstr = lc ? "subb" : "SUBB"; goto La_r3_1;
	case 0xcb: opstr = lc ? "xch" : "XCH"; goto La_r3_1;
	case 0xeb: opstr = lc ? "mov" : "MOV"; goto La_r3_1;

	/* a,r4 a,r4 */
	case 0x2c: opstr = lc ? "add" : "ADD"; goto La_r4_1;
	case 0x3c: opstr = lc ? "addc" : "ADDC"; goto La_r4_1;
	case 0x4c: opstr = lc ? "orl" : "ORL"; goto La_r4_1;
	case 0x5c: opstr = lc ? "anl" : "ANL"; goto La_r4_1;
	case 0x6c: opstr = lc ? "xrl" : "XRL"; goto La_r4_1;
	case 0x9c: opstr = lc ? "subb" : "SUBB"; goto La_r4_1;
	case 0xcc: opstr = lc ? "xch" : "XCH"; goto La_r4_1;
	case 0xec: opstr = lc ? "mov" : "MOV"; goto La_r4_1;

	/* a,r5 a,r5 */
	case 0x2d: opstr = lc ? "add" : "ADD"; goto La_r5_1;
	case 0x3d: opstr = lc ? "addc" : "ADDC"; goto La_r5_1;
	case 0x4d: opstr = lc ? "orl" : "ORL"; goto La_r5_1;
	case 0x5d: opstr = lc ? "anl" : "ANL"; goto La_r5_1;
	case 0x6d: opstr = lc ? "xrl" : "XRL"; goto La_r5_1;
	case 0x9d: opstr = lc ? "subb" : "SUBB"; goto La_r5_1;
	case 0xcd: opstr = lc ? "xch" : "XCH"; goto La_r5_1;
	case 0xed: opstr = lc ? "mov" : "MOV"; goto La_r5_1;

	/* a,r6 a,r6 */
	case 0x2e: opstr = lc ? "add" : "ADD"; goto La_r6_1;
	case 0x3e: opstr = lc ? "addc" : "ADDC"; goto La_r6_1;
	case 0x4e: opstr = lc ? "orl" : "ORL"; goto La_r6_1;
	case 0x5e: opstr = lc ? "anl" : "ANL"; goto La_r6_1;
	case 0x6e: opstr = lc ? "xrl" : "XRL"; goto La_r6_1;
	case 0x9e: opstr = lc ? "subb" : "SUBB"; goto La_r6_1;
	case 0xce: opstr = lc ? "xch" : "XCH"; goto La_r6_1;
	case 0xee: opstr = lc ? "mov" : "MOV"; goto La_r6_1;

	/* a,r7 a,r7 */
	case 0x2f: opstr = lc ? "add" : "ADD"; goto La_r7_1;
	case 0x3f: opstr = lc ? "addc" : "ADDC"; goto La_r7_1;
	case 0x4f: opstr = lc ? "orl" : "ORL"; goto La_r7_1;
	case 0x5f: opstr = lc ? "anl" : "ANL"; goto La_r7_1;
	case 0x6f: opstr = lc ? "xrl" : "XRL"; goto La_r7_1;
	case 0x9f: opstr = lc ? "subb" : "SUBB"; goto La_r7_1;
	case 0xcf: opstr = lc ? "xch" : "XCH"; goto La_r7_1;
	case 0xef: opstr = lc ? "mov" : "MOV"; goto La_r7_1;

	/* a,@r0 a,@r0 */
	case 0x36: opstr = lc ? "addc" : "ADDC"; goto La_at_r0_1;
	case 0x46: opstr = lc ? "orl" : "ORL"; goto La_at_r0_1;
	case 0x56: opstr = lc ? "anl" : "ANL"; goto La_at_r0_1;
	case 0x66: opstr = lc ? "xrl" : "XRL"; goto La_at_r0_1;
	case 0x96: opstr = lc ? "subb" : "SUBB"; goto La_at_r0_1;
	case 0xc6: opstr = lc ? "xch" : "XCH"; goto La_at_r0_1;
	case 0xd6: opstr = lc ? "xchd" : "XCHD"; goto La_at_r0_1;
	case 0xe2: opstr = lc ? "movx" : "MOVX"; goto La_at_r0_1;
	case 0xe6: opstr = lc ? "mov" : "MOV"; goto La_at_r0_1;

	/* offset $%04x */
	case 0x40: opstr = lc ? "jc" : "JC"; goto Loffset_2;
	case 0x50: opstr = lc ? "jnc" : "JNC"; goto Loffset_2;
	case 0x60: opstr = lc ? "jz" : "JZ"; goto Loffset_2;
	case 0x70: opstr = lc ? "jnz" : "JNZ"; goto Loffset_2;
	case 0x80: opstr = lc ? "sjmp" : "SJMP"; goto Loffset_2;

	/* direct,a $%02x,a */
	case 0x42: opstr = lc ? "orl" : "ORL"; goto Ldirect_a_2;
	case 0x52: opstr = lc ? "anl" : "ANL"; goto Ldirect_a_2;
	case 0x62: opstr = lc ? "xrl" : "XRL"; goto Ldirect_a_2;
	case 0xf5: opstr = lc ? "mov" : "MOV"; goto Ldirect_a_2;

	/* direct,immed $%02x,#$%02x */
	case 0x43: opstr = lc ? "orl" : "ORL"; goto Ldirect_immed_3;
	case 0x53: opstr = lc ? "anl" : "ANL"; goto Ldirect_immed_3;
	case 0x63: opstr = lc ? "xrl" : "XRL"; goto Ldirect_immed_3;
	case 0x75: opstr = lc ? "mov" : "MOV"; goto Ldirect_immed_3;

	/* c,bit c,$%02x */
	case 0x72: opstr = lc ? "orl" : "ORL"; goto Lc_bit_2;
	case 0x82: opstr = lc ? "anl" : "ANL"; goto Lc_bit_2;
	case 0xa0: opstr = lc ? "orl" : "ORL"; goto Lc_bit_2;
	case 0xa2: opstr = lc ? "mov" : "MOV"; goto Lc_bit_2;
	case 0xb0: opstr = lc ? "anl" : "ANL"; goto Lc_bit_2;

	/* @a+dptr @a+dptr */
	case 0x73: opstr = lc ? "jmp" : "JMP"; goto Lat_a_dptr_1;

	/* @r0,immed @r0,#$%02x */
	case 0x76: opstr = lc ? "mov" : "MOV"; goto Lat_r0_immed_2;

	/* @r1,immed @r1,#$%02x */
	case 0x77: opstr = lc ? "mov" : "MOV"; goto Lat_r1_immed_2;

	/* r0,immed r0,#$%02x */
	case 0x78: opstr = lc ? "mov" : "MOV"; goto Lr0_immed_2;

	/* r1,immed r1,#$%02x */
	case 0x79: opstr = lc ? "mov" : "MOV"; goto Lr1_immed_2;

	/* r2,immed r2,#$%02x */
	case 0x7a: opstr = lc ? "mov" : "MOV"; goto Lr2_immed_2;

	/* r3,immed r3,#$%02x */
	case 0x7b: opstr = lc ? "mov" : "MOV"; goto Lr3_immed_2;

	/* r4,immed r4,#$%02x */
	case 0x7c: opstr = lc ? "mov" : "MOV"; goto Lr4_immed_2;

	/* r5,immed r5,#$%02x */
	case 0x7d: opstr = lc ? "mov" : "MOV"; goto Lr5_immed_2;

	/* r6,immed r6,#$%02x */
	case 0x7e: opstr = lc ? "mov" : "MOV"; goto Lr6_immed_2;

	/* r7,immed r7,#$%02x */
	case 0x7f: opstr = lc ? "mov" : "MOV"; goto Lr7_immed_2;

	/* a,@a+pc a,@a+pc */
	case 0x83: opstr = lc ? "movc" : "MOVC"; goto La_at_a_pc_1;

	/* ab ab */
	case 0x84: opstr = lc ? "div" : "DIV"; goto Lab_1;
	case 0xa4: opstr = lc ? "mul" : "MUL"; goto Lab_1;

	/* direct,direct $%02x,$%02x */
	case 0x85: opstr = lc ? "mov" : "MOV"; goto Ldirect_direct_3;

	/* direct,@r0 $%02x,@r0 */
	case 0x86: opstr = lc ? "mov" : "MOV"; goto Ldirect_at_r0_2;

	/* direct,@r1 $%02x,@r1 */
	case 0x87: opstr = lc ? "mov" : "MOV"; goto Ldirect_at_r1_2;

	/* direct,r0 $%02x,r0 */
	case 0x88: opstr = lc ? "mov" : "MOV"; goto Ldirect_r0_2;

	/* direct,r1 $%02x,r1 */
	case 0x89: opstr = lc ? "mov" : "MOV"; goto Ldirect_r1_2;

	/* direct,r2 $%02x,r2 */
	case 0x8a: opstr = lc ? "mov" : "MOV"; goto Ldirect_r2_2;

	/* direct,r3 $%02x,r3 */
	case 0x8b: opstr = lc ? "mov" : "MOV"; goto Ldirect_r3_2;

	/* direct,r4 $%02x,r4 */
	case 0x8c: opstr = lc ? "mov" : "MOV"; goto Ldirect_r4_2;

	/* direct,r5 $%02x,r5 */
	case 0x8d: opstr = lc ? "mov" : "MOV"; goto Ldirect_r5_2;

	/* direct,r6 $%02x,r6 */
	case 0x8e: opstr = lc ? "mov" : "MOV"; goto Ldirect_r6_2;

	/* direct,r7 $%02x,r7 */
	case 0x8f: opstr = lc ? "mov" : "MOV"; goto Ldirect_r7_2;

	/* dptr,immed dptr,#$%02x */
	case 0x90: opstr = lc ? "mov" : "MOV"; goto Ldptr_immed_3;

	/* bit,c $%02x,c */
	case 0x92: opstr = lc ? "mov" : "MOV"; goto Lbit_c_2;

	/* a,@a+dptr a,@a+dptr */
	case 0x93: opstr = lc ? "movc" : "MOVC"; goto La_at_a_dptr_1;

	/* dptr dptr */
	case 0xa3: opstr = lc ? "inc" : "INC"; goto Ldptr_1;

	/* @r0,direct @r0,$%02x */
	case 0xa6: opstr = lc ? "mov" : "MOV"; goto Lat_r0_direct_2;

	/* @r1,direct @r1,$%02x */
	case 0xa7: opstr = lc ? "mov" : "MOV"; goto Lat_r1_direct_2;

	/* r0,direct r0,$%02x */
	case 0xa8: opstr = lc ? "mov" : "MOV"; goto Lr0_direct_2;

	/* r1,direct r1,$%02x */
	case 0xa9: opstr = lc ? "mov" : "MOV"; goto Lr1_direct_2;

	/* r2,direct r2,$%02x */
	case 0xaa: opstr = lc ? "mov" : "MOV"; goto Lr2_direct_2;

	/* r3,direct r3,$%02x */
	case 0xab: opstr = lc ? "mov" : "MOV"; goto Lr3_direct_2;

	/* r4,direct r4,$%02x */
	case 0xac: opstr = lc ? "mov" : "MOV"; goto Lr4_direct_2;

	/* r5,direct r5,$%02x */
	case 0xad: opstr = lc ? "mov" : "MOV"; goto Lr5_direct_2;

	/* r6,direct r6,$%02x */
	case 0xae: opstr = lc ? "mov" : "MOV"; goto Lr6_direct_2;

	/* r7,direct r7,$%02x */
	case 0xaf: opstr = lc ? "mov" : "MOV"; goto Lr7_direct_2;

	/* bit $%02x */
	case 0xb2: opstr = lc ? "cpl" : "CPL"; goto Lbit_2;
	case 0xc2: opstr = lc ? "clr" : "CLR"; goto Lbit_2;
	case 0xd2: opstr = lc ? "setb" : "SETB"; goto Lbit_2;

	/* c c */
	case 0xb3: opstr = lc ? "cpl" : "CPL"; goto Lc_1;
	case 0xc3: opstr = lc ? "clr" : "CLR"; goto Lc_1;
	case 0xd3: opstr = lc ? "setb" : "SETB"; goto Lc_1;

	/* a,immed,offset a,#$%02x,$%02x */
	case 0xb4: opstr = lc ? "cjne" : "CJNE"; goto La_immed_offset_3;

	/* a,direct,offset a,$%02x,$%02x */
	case 0xb5: opstr = lc ? "cjne" : "CJNE"; goto La_direct_offset_3;

	/* @r0,immed,offset @r0,#$%02x,$%02x */
	case 0xb6: opstr = lc ? "cjne" : "CJNE"; goto Lat_r0_immed_offset_3;

	/* @r1,immed,offset @r1,#$%02x,$%02x */
	case 0xb7: opstr = lc ? "cjne" : "CJNE"; goto Lat_r1_immed_offset_3;

	/* r0,immed,offset r0,#$%02x,$%02x */
	case 0xb8: opstr = lc ? "cjne" : "CJNE"; goto Lr0_immed_offset_3;

	/* r1,immed,offset r1,#$%02x,$%02x */
	case 0xb9: opstr = lc ? "cjne" : "CJNE"; goto Lr1_immed_offset_3;

	/* r2,immed,offset r2,#$%02x,$%02x */
	case 0xba: opstr = lc ? "cjne" : "CJNE"; goto Lr2_immed_offset_3;

	/* r3,immed,offset r3,#$%02x,$%02x */
	case 0xbb: opstr = lc ? "cjne" : "CJNE"; goto Lr3_immed_offset_3;

	/* r4,immed,offset r4,#$%02x,$%02x */
	case 0xbc: opstr = lc ? "cjne" : "CJNE"; goto Lr4_immed_offset_3;

	/* r5,immed,offset r5,#$%02x,$%02x */
	case 0xbd: opstr = lc ? "cjne" : "CJNE"; goto Lr5_immed_offset_3;

	/* r6,immed,offset r6,#$%02x,$%02x */
	case 0xbe: opstr = lc ? "cjne" : "CJNE"; goto Lr6_immed_offset_3;

	/* r7,immed,offset r7,#$%02x,$%02x */
	case 0xbf: opstr = lc ? "cjne" : "CJNE"; goto Lr7_immed_offset_3;

	/* direct,offset $%02x,$%02x */
	case 0xd5: opstr = lc ? "djnz" : "DJNZ"; goto Ldirect_offset_3;

	/* r0,offset r0,$%02x */
	case 0xd8: opstr = lc ? "djnz" : "DJNZ"; goto Lr0_offset_2;

	/* r1,offset r1,$%02x */
	case 0xd9: opstr = lc ? "djnz" : "DJNZ"; goto Lr1_offset_2;

	/* r2,offset r2,$%02x */
	case 0xda: opstr = lc ? "djnz" : "DJNZ"; goto Lr2_offset_2;

	/* r3,offset r3,$%02x */
	case 0xdb: opstr = lc ? "djnz" : "DJNZ"; goto Lr3_offset_2;

	/* r4,offset r4,$%02x */
	case 0xdc: opstr = lc ? "djnz" : "DJNZ"; goto Lr4_offset_2;

	/* r5,offset r5,$%02x */
	case 0xdd: opstr = lc ? "djnz" : "DJNZ"; goto Lr5_offset_2;

	/* r6,offset r6,$%02x */
	case 0xde: opstr = lc ? "djnz" : "DJNZ"; goto Lr6_offset_2;

	/* r7,offset r7,$%02x */
	case 0xdf: opstr = lc ? "djnz" : "DJNZ"; goto Lr7_offset_2;

	/* a,@dptr a,@dptr */
	case 0xe0: opstr = lc ? "movx" : "MOVX"; goto La_at_dptr_1;

	/* @dptr,a @dptr,a */
	case 0xf0: opstr = lc ? "movx" : "MOVX"; goto Lat_dptr_a_1;

	/* @r0,a @r0,a */
	case 0xf2: opstr = lc ? "movx" : "MOVX"; goto Lat_r0_a_1;
	case 0xf6: opstr = lc ? "mov" : "MOV"; goto Lat_r0_a_1;

	/* @r1,a @r1,a */
	case 0xf3: opstr = lc ? "movx" : "MOVX"; goto Lat_r1_a_1;
	case 0xf7: opstr = lc ? "mov" : "MOV"; goto Lat_r1_a_1;

	/* r0,a r0,a */
	case 0xf8: opstr = lc ? "mov" : "MOV"; goto Lr0_a_1;

	/* r1,a r1,a */
	case 0xf9: opstr = lc ? "mov" : "MOV"; goto Lr1_a_1;

	/* r2,a r2,a */
	case 0xfa: opstr = lc ? "mov" : "MOV"; goto Lr2_a_1;

	/* r3,a r3,a */
	case 0xfb: opstr = lc ? "mov" : "MOV"; goto Lr3_a_1;

	/* r4,a r4,a */
	case 0xfc: opstr = lc ? "mov" : "MOV"; goto Lr4_a_1;

	/* r5,a r5,a */
	case 0xfd: opstr = lc ? "mov" : "MOV"; goto Lr5_a_1;

	/* r6,a r6,a */
	case 0xfe: opstr = lc ? "mov" : "MOV"; goto Lr6_a_1;

	/* r7,a r7,a */
	case 0xff: opstr = lc ? "mov" : "MOV"; goto Lr7_a_1;

	default:
		h = &hexdigits[(opcode & 0xff)*2]; *t++=*h++; *t++=*h++;
		goto last;
	}
L1: /*  [] */
	do {*t++ = *opstr++;} while (*opstr);
	goto last;
Laddr11_2: /* $%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Laddr16_3: /* $%02x%02x ['op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	addr = op1 + 256 * op2;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	goto last;
La_1: /* a [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	goto last;
Ldirect_2: /* $%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lat_r0_1: /* @r0 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ',*t++='@';
	if (lc) *t++='r';
	else *t++='R';
	*t++='0';
	goto last;
Lat_r1_1: /* @r1 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ',*t++='@';
	if (lc) *t++='r';
	else *t++='R';
	*t++='1';
	goto last;
Lr0_1: /* r0 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='0';
	goto last;
Lr1_1: /* r1 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='1';
	goto last;
Lr2_1: /* r2 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='2';
	goto last;
Lr3_1: /* r3 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='3';
	goto last;
Lr4_1: /* r4 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='4';
	goto last;
Lr5_1: /* r5 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='5';
	goto last;
Lr6_1: /* r6 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='6';
	goto last;
Lr7_1: /* r7 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='7';
	goto last;
Lbit_offset_3: /* $%02x,$%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	t += print_label_or_addr(op2, jmp_targets, t, hexdigits, 1);
	goto last;
La_immed_2: /* a,#$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	goto last;
La_direct_2: /* a,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
La_r0_1: /* a,r0 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',';
	if (lc) *t++='r';
	else *t++='R';
	*t++='0';
	goto last;
La_at_r1_1: /* a,@r1 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',',*t++='@';
	if (lc) *t++='r';
	else *t++='R';
	*t++='1';
	goto last;
La_r1_1: /* a,r1 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',';
	if (lc) *t++='r';
	else *t++='R';
	*t++='1';
	goto last;
La_r2_1: /* a,r2 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',';
	if (lc) *t++='r';
	else *t++='R';
	*t++='2';
	goto last;
La_r3_1: /* a,r3 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',';
	if (lc) *t++='r';
	else *t++='R';
	*t++='3';
	goto last;
La_r4_1: /* a,r4 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',';
	if (lc) *t++='r';
	else *t++='R';
	*t++='4';
	goto last;
La_r5_1: /* a,r5 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',';
	if (lc) *t++='r';
	else *t++='R';
	*t++='5';
	goto last;
La_r6_1: /* a,r6 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',';
	if (lc) *t++='r';
	else *t++='R';
	*t++='6';
	goto last;
La_r7_1: /* a,r7 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',';
	if (lc) *t++='r';
	else *t++='R';
	*t++='7';
	goto last;
La_at_r0_1: /* a,@r0 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',',*t++='@';
	if (lc) *t++='r';
	else *t++='R';
	*t++='0';
	goto last;
Loffset_2: /* $%04x ['rel'] */
	do {*t++ = *opstr++;} while (*opstr);
	dist = entry->instruction[1];
	if (dist > 127) dist -= 256;
	rel = (entry->pc + 2 + dist) & 0xffff;
	*t++=' ';
	t += print_label_or_addr(rel, jmp_targets, t, hexdigits, 0);
	goto last;
Ldirect_a_2: /* $%02x,a ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='a';
	else *t++='A';
	goto last;
Ldirect_immed_3: /* $%02x,#$%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',',*t++='#',*t++='$';
	h = &hexdigits[(op2)*2]; *t++=*h++; *t++=*h++;
	goto last;
Lc_bit_2: /* c,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='c';
	else *t++='C';
	*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lat_a_dptr_1: /* @a+dptr [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ',*t++='@';
	if (lc) *t++='a';
	else *t++='A';
	*t++='+';
	if (lc) *t++='d',*t++='p',*t++='t',*t++='r';
	else *t++='D',*t++='P',*t++='T',*t++='R';
	goto last;
Lat_r0_immed_2: /* @r0,#$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ',*t++='@';
	if (lc) *t++='r';
	else *t++='R';
	*t++='0',*t++=',',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	goto last;
Lat_r1_immed_2: /* @r1,#$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ',*t++='@';
	if (lc) *t++='r';
	else *t++='R';
	*t++='1',*t++=',',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	goto last;
Lr0_immed_2: /* r0,#$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='0',*t++=',',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	goto last;
Lr1_immed_2: /* r1,#$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='1',*t++=',',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	goto last;
Lr2_immed_2: /* r2,#$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='2',*t++=',',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	goto last;
Lr3_immed_2: /* r3,#$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='3',*t++=',',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	goto last;
Lr4_immed_2: /* r4,#$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='4',*t++=',',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	goto last;
Lr5_immed_2: /* r5,#$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='5',*t++=',',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	goto last;
Lr6_immed_2: /* r6,#$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='6',*t++=',',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	goto last;
Lr7_immed_2: /* r7,#$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='7',*t++=',',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	goto last;
La_at_a_pc_1: /* a,@a+pc [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',',*t++='@';
	if (lc) *t++='a';
	else *t++='A';
	*t++='+';
	if (lc) *t++='p',*t++='c';
	else *t++='P',*t++='C';
	goto last;
Lab_1: /* ab [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a',*t++='b';
	else *t++='A',*t++='B';
	goto last;
Ldirect_direct_3: /* $%02x,$%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	t += print_label_or_addr(op2, jmp_targets, t, hexdigits, 1);
	goto last;
Ldirect_at_r0_2: /* $%02x,@r0 ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',',*t++='@';
	if (lc) *t++='r';
	else *t++='R';
	*t++='0';
	goto last;
Ldirect_at_r1_2: /* $%02x,@r1 ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',',*t++='@';
	if (lc) *t++='r';
	else *t++='R';
	*t++='1';
	goto last;
Ldirect_r0_2: /* $%02x,r0 ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='r';
	else *t++='R';
	*t++='0';
	goto last;
Ldirect_r1_2: /* $%02x,r1 ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='r';
	else *t++='R';
	*t++='1';
	goto last;
Ldirect_r2_2: /* $%02x,r2 ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='r';
	else *t++='R';
	*t++='2';
	goto last;
Ldirect_r3_2: /* $%02x,r3 ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='r';
	else *t++='R';
	*t++='3';
	goto last;
Ldirect_r4_2: /* $%02x,r4 ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='r';
	else *t++='R';
	*t++='4';
	goto last;
Ldirect_r5_2: /* $%02x,r5 ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='r';
	else *t++='R';
	*t++='5';
	goto last;
Ldirect_r6_2: /* $%02x,r6 ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='r';
	else *t++='R';
	*t++='6';
	goto last;
Ldirect_r7_2: /* $%02x,r7 ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='r';
	else *t++='R';
	*t++='7';
	goto last;
Ldptr_immed_3: /* dptr,#$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	if (lc) *t++='d',*t++='p',*t++='t',*t++='r';
	else *t++='D',*t++='P',*t++='T',*t++='R';
	*t++=',',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	goto last;
Lbit_c_2: /* $%02x,c ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	if (lc) *t++='c';
	else *t++='C';
	goto last;
La_at_a_dptr_1: /* a,@a+dptr [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',',*t++='@';
	if (lc) *t++='a';
	else *t++='A';
	*t++='+';
	if (lc) *t++='d',*t++='p',*t++='t',*t++='r';
	else *t++='D',*t++='P',*t++='T',*t++='R';
	goto last;
Ldptr_1: /* dptr [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='d',*t++='p',*t++='t',*t++='r';
	else *t++='D',*t++='P',*t++='T',*t++='R';
	goto last;
Lat_r0_direct_2: /* @r0,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ',*t++='@';
	if (lc) *t++='r';
	else *t++='R';
	*t++='0',*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lat_r1_direct_2: /* @r1,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ',*t++='@';
	if (lc) *t++='r';
	else *t++='R';
	*t++='1',*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lr0_direct_2: /* r0,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='0',*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lr1_direct_2: /* r1,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='1',*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lr2_direct_2: /* r2,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='2',*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lr3_direct_2: /* r3,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='3',*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lr4_direct_2: /* r4,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='4',*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lr5_direct_2: /* r5,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='5',*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lr6_direct_2: /* r6,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='6',*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lr7_direct_2: /* r7,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='7',*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lbit_2: /* $%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lc_1: /* c [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='c';
	else *t++='C';
	goto last;
La_immed_offset_3: /* a,#$%02x,$%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	*t++=',';
	t += print_label_or_addr(op2, jmp_targets, t, hexdigits, 1);
	goto last;
La_direct_offset_3: /* a,$%02x,$%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	t += print_label_or_addr(op2, jmp_targets, t, hexdigits, 1);
	goto last;
Lat_r0_immed_offset_3: /* @r0,#$%02x,$%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ',*t++='@';
	if (lc) *t++='r';
	else *t++='R';
	*t++='0',*t++=',',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	*t++=',';
	t += print_label_or_addr(op2, jmp_targets, t, hexdigits, 1);
	goto last;
Lat_r1_immed_offset_3: /* @r1,#$%02x,$%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ',*t++='@';
	if (lc) *t++='r';
	else *t++='R';
	*t++='1',*t++=',',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	*t++=',';
	t += print_label_or_addr(op2, jmp_targets, t, hexdigits, 1);
	goto last;
Lr0_immed_offset_3: /* r0,#$%02x,$%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='0',*t++=',',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	*t++=',';
	t += print_label_or_addr(op2, jmp_targets, t, hexdigits, 1);
	goto last;
Lr1_immed_offset_3: /* r1,#$%02x,$%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='1',*t++=',',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	*t++=',';
	t += print_label_or_addr(op2, jmp_targets, t, hexdigits, 1);
	goto last;
Lr2_immed_offset_3: /* r2,#$%02x,$%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='2',*t++=',',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	*t++=',';
	t += print_label_or_addr(op2, jmp_targets, t, hexdigits, 1);
	goto last;
Lr3_immed_offset_3: /* r3,#$%02x,$%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='3',*t++=',',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	*t++=',';
	t += print_label_or_addr(op2, jmp_targets, t, hexdigits, 1);
	goto last;
Lr4_immed_offset_3: /* r4,#$%02x,$%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='4',*t++=',',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	*t++=',';
	t += print_label_or_addr(op2, jmp_targets, t, hexdigits, 1);
	goto last;
Lr5_immed_offset_3: /* r5,#$%02x,$%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='5',*t++=',',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	*t++=',';
	t += print_label_or_addr(op2, jmp_targets, t, hexdigits, 1);
	goto last;
Lr6_immed_offset_3: /* r6,#$%02x,$%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='6',*t++=',',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	*t++=',';
	t += print_label_or_addr(op2, jmp_targets, t, hexdigits, 1);
	goto last;
Lr7_immed_offset_3: /* r7,#$%02x,$%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='7',*t++=',',*t++='#',*t++='$';
	h = &hexdigits[(op1)*2]; *t++=*h++; *t++=*h++;
	*t++=',';
	t += print_label_or_addr(op2, jmp_targets, t, hexdigits, 1);
	goto last;
Ldirect_offset_3: /* $%02x,$%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=',';
	t += print_label_or_addr(op2, jmp_targets, t, hexdigits, 1);
	goto last;
Lr0_offset_2: /* r0,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='0',*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lr1_offset_2: /* r1,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='1',*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lr2_offset_2: /* r2,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='2',*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lr3_offset_2: /* r3,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='3',*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lr4_offset_2: /* r4,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='4',*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lr5_offset_2: /* r5,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='5',*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lr6_offset_2: /* r6,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='6',*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lr7_offset_2: /* r7,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='7',*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
La_at_dptr_1: /* a,@dptr [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',',*t++='@';
	if (lc) *t++='d',*t++='p',*t++='t',*t++='r';
	else *t++='D',*t++='P',*t++='T',*t++='R';
	goto last;
Lat_dptr_a_1: /* @dptr,a [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ',*t++='@';
	if (lc) *t++='d',*t++='p',*t++='t',*t++='r';
	else *t++='D',*t++='P',*t++='T',*t++='R';
	*t++=',';
	if (lc) *t++='a';
	else *t++='A';
	goto last;
Lat_r0_a_1: /* @r0,a [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ',*t++='@';
	if (lc) *t++='r';
	else *t++='R';
	*t++='0',*t++=',';
	if (lc) *t++='a';
	else *t++='A';
	goto last;
Lat_r1_a_1: /* @r1,a [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ',*t++='@';
	if (lc) *t++='r';
	else *t++='R';
	*t++='1',*t++=',';
	if (lc) *t++='a';
	else *t++='A';
	goto last;
Lr0_a_1: /* r0,a [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='0',*t++=',';
	if (lc) *t++='a';
	else *t++='A';
	goto last;
Lr1_a_1: /* r1,a [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='1',*t++=',';
	if (lc) *t++='a';
	else *t++='A';
	goto last;
Lr2_a_1: /* r2,a [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='2',*t++=',';
	if (lc) *t++='a';
	else *t++='A';
	goto last;
Lr3_a_1: /* r3,a [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='3',*t++=',';
	if (lc) *t++='a';
	else *t++='A';
	goto last;
Lr4_a_1: /* r4,a [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='4',*t++=',';
	if (lc) *t++='a';
	else *t++='A';
	goto last;
Lr5_a_1: /* r5,a [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='5',*t++=',';
	if (lc) *t++='a';
	else *t++='A';
	goto last;
Lr6_a_1: /* r6,a [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='6',*t++=',';
	if (lc) *t++='a';
	else *t++='A';
	goto last;
Lr7_a_1: /* r7,a [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='r';
	else *t++='R';
	*t++='7',*t++=',';
	if (lc) *t++='a';
	else *t++='A';
	goto last;

last:
	return (int)(t - first_t);
}

int stringify_entry_8080(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets) {
	int dist;
	unsigned char opcode, leadin, op1, op2, op3;
	char *first_t, *h, *opstr;
	unsigned short rel, addr;

	first_t = t;
	opcode = entry->instruction[0];
	switch(opcode) {
	/* implied  */
	case 0x0: opstr = lc ? "nop" : "NOP"; goto Limplied_1;
	case 0x7: opstr = lc ? "rlc" : "RLC"; goto Limplied_1;
	case 0xf: opstr = lc ? "rrc" : "RRC"; goto Limplied_1;
	case 0x17: opstr = lc ? "ral" : "RAL"; goto Limplied_1;
	case 0x19: opstr = lc ? "dad" : "DAD"; goto Limplied_1;
	case 0x1f: opstr = lc ? "rar" : "RAR"; goto Limplied_1;
	case 0x27: opstr = lc ? "daa" : "DAA"; goto Limplied_1;
	case 0x2f: opstr = lc ? "cma" : "CMA"; goto Limplied_1;
	case 0x37: opstr = lc ? "stc" : "STC"; goto Limplied_1;
	case 0x3f: opstr = lc ? "cmc" : "CMC"; goto Limplied_1;
	case 0x76: opstr = lc ? "hlt" : "HLT"; goto Limplied_1;
	case 0xc0: opstr = lc ? "rnz" : "RNZ"; goto Limplied_1;
	case 0xc8: opstr = lc ? "rz" : "RZ"; goto Limplied_1;
	case 0xc9: opstr = lc ? "ret" : "RET"; goto Limplied_1;
	case 0xd0: opstr = lc ? "rnc" : "RNC"; goto Limplied_1;
	case 0xd8: opstr = lc ? "rc" : "RC"; goto Limplied_1;
	case 0xe0: opstr = lc ? "rpo" : "RPO"; goto Limplied_1;
	case 0xe3: opstr = lc ? "xthl" : "XTHL"; goto Limplied_1;
	case 0xe8: opstr = lc ? "rpe" : "RPE"; goto Limplied_1;
	case 0xe9: opstr = lc ? "pchl" : "PCHL"; goto Limplied_1;
	case 0xeb: opstr = lc ? "xchg" : "XCHG"; goto Limplied_1;
	case 0xf0: opstr = lc ? "rp" : "RP"; goto Limplied_1;
	case 0xf3: opstr = lc ? "di" : "DI"; goto Limplied_1;
	case 0xf8: opstr = lc ? "rm" : "RM"; goto Limplied_1;
	case 0xf9: opstr = lc ? "sphl" : "SPHL"; goto Limplied_1;
	case 0xfb: opstr = lc ? "ei" : "EI"; goto Limplied_1;

	/* immxb b,$%02x%02x */
	case 0x1: opstr = lc ? "lxi" : "LXI"; goto Limmxb_3;

	/* regb b */
	case 0x2: opstr = lc ? "stax" : "STAX"; goto Lregb_1;
	case 0x3: opstr = lc ? "inx" : "INX"; goto Lregb_1;
	case 0x4: opstr = lc ? "inr" : "INR"; goto Lregb_1;
	case 0x5: opstr = lc ? "dcr" : "DCR"; goto Lregb_1;
	case 0x9: opstr = lc ? "dad" : "DAD"; goto Lregb_1;
	case 0xa: opstr = lc ? "ldax" : "LDAX"; goto Lregb_1;
	case 0xb: opstr = lc ? "dcx" : "DCX"; goto Lregb_1;
	case 0x80: opstr = lc ? "add" : "ADD"; goto Lregb_1;
	case 0x88: opstr = lc ? "adc" : "ADC"; goto Lregb_1;
	case 0x90: opstr = lc ? "sub" : "SUB"; goto Lregb_1;
	case 0x98: opstr = lc ? "sbb" : "SBB"; goto Lregb_1;
	case 0xa0: opstr = lc ? "ana" : "ANA"; goto Lregb_1;
	case 0xa8: opstr = lc ? "xra" : "XRA"; goto Lregb_1;
	case 0xb0: opstr = lc ? "ora" : "ORA"; goto Lregb_1;
	case 0xb8: opstr = lc ? "cmp" : "CMP"; goto Lregb_1;
	case 0xc1: opstr = lc ? "pop" : "POP"; goto Lregb_1;
	case 0xc5: opstr = lc ? "push" : "PUSH"; goto Lregb_1;

	/* immb b,$%02x */
	case 0x6: opstr = lc ? "mvi" : "MVI"; goto Limmb_2;

	/* regc c */
	case 0xc: opstr = lc ? "inr" : "INR"; goto Lregc_1;
	case 0xd: opstr = lc ? "dcr" : "DCR"; goto Lregc_1;
	case 0x81: opstr = lc ? "add" : "ADD"; goto Lregc_1;
	case 0x89: opstr = lc ? "adc" : "ADC"; goto Lregc_1;
	case 0x91: opstr = lc ? "sub" : "SUB"; goto Lregc_1;
	case 0x99: opstr = lc ? "sbb" : "SBB"; goto Lregc_1;
	case 0xa1: opstr = lc ? "ana" : "ANA"; goto Lregc_1;
	case 0xa9: opstr = lc ? "xra" : "XRA"; goto Lregc_1;
	case 0xb1: opstr = lc ? "ora" : "ORA"; goto Lregc_1;
	case 0xb9: opstr = lc ? "cmp" : "CMP"; goto Lregc_1;

	/* immc c,$%02x */
	case 0xe: opstr = lc ? "mvi" : "MVI"; goto Limmc_2;

	/* immxd d,$%02x%02x */
	case 0x11: opstr = lc ? "lxi" : "LXI"; goto Limmxd_3;

	/* regd d */
	case 0x12: opstr = lc ? "stax" : "STAX"; goto Lregd_1;
	case 0x13: opstr = lc ? "inx" : "INX"; goto Lregd_1;
	case 0x14: opstr = lc ? "inr" : "INR"; goto Lregd_1;
	case 0x15: opstr = lc ? "dcr" : "DCR"; goto Lregd_1;
	case 0x1a: opstr = lc ? "ldax" : "LDAX"; goto Lregd_1;
	case 0x1b: opstr = lc ? "dcx" : "DCX"; goto Lregd_1;
	case 0x82: opstr = lc ? "add" : "ADD"; goto Lregd_1;
	case 0x8a: opstr = lc ? "adc" : "ADC"; goto Lregd_1;
	case 0x92: opstr = lc ? "sub" : "SUB"; goto Lregd_1;
	case 0x9a: opstr = lc ? "sbb" : "SBB"; goto Lregd_1;
	case 0xa2: opstr = lc ? "ana" : "ANA"; goto Lregd_1;
	case 0xaa: opstr = lc ? "xra" : "XRA"; goto Lregd_1;
	case 0xb2: opstr = lc ? "ora" : "ORA"; goto Lregd_1;
	case 0xba: opstr = lc ? "cmp" : "CMP"; goto Lregd_1;
	case 0xd1: opstr = lc ? "pop" : "POP"; goto Lregd_1;
	case 0xd5: opstr = lc ? "push" : "PUSH"; goto Lregd_1;

	/* immd d,$%02x */
	case 0x16: opstr = lc ? "mvi" : "MVI"; goto Limmd_2;

	/* rege e */
	case 0x1c: opstr = lc ? "inr" : "INR"; goto Lrege_1;
	case 0x1d: opstr = lc ? "dcr" : "DCR"; goto Lrege_1;
	case 0x83: opstr = lc ? "add" : "ADD"; goto Lrege_1;
	case 0x8b: opstr = lc ? "adc" : "ADC"; goto Lrege_1;
	case 0x93: opstr = lc ? "sub" : "SUB"; goto Lrege_1;
	case 0x9b: opstr = lc ? "sbb" : "SBB"; goto Lrege_1;
	case 0xa3: opstr = lc ? "ana" : "ANA"; goto Lrege_1;
	case 0xab: opstr = lc ? "xra" : "XRA"; goto Lrege_1;
	case 0xb3: opstr = lc ? "ora" : "ORA"; goto Lrege_1;
	case 0xbb: opstr = lc ? "cmp" : "CMP"; goto Lrege_1;

	/* imme e,$%02x */
	case 0x1e: opstr = lc ? "mvi" : "MVI"; goto Limme_2;

	/* immxh h,$%02x%02x */
	case 0x21: opstr = lc ? "lxi" : "LXI"; goto Limmxh_3;

	/* direct $%02x%02x */
	case 0x22: opstr = lc ? "shld" : "SHLD"; goto Ldirect_3;
	case 0x2a: opstr = lc ? "lhld" : "LHLD"; goto Ldirect_3;
	case 0x32: opstr = lc ? "sta" : "STA"; goto Ldirect_3;
	case 0x3a: opstr = lc ? "lda" : "LDA"; goto Ldirect_3;
	case 0xc2: opstr = lc ? "jnz" : "JNZ"; goto Ldirect_3;
	case 0xc3: opstr = lc ? "jmp" : "JMP"; goto Ldirect_3;
	case 0xc4: opstr = lc ? "cnz" : "CNZ"; goto Ldirect_3;
	case 0xca: opstr = lc ? "jz" : "JZ"; goto Ldirect_3;
	case 0xcc: opstr = lc ? "cz" : "CZ"; goto Ldirect_3;
	case 0xcd: opstr = lc ? "call" : "CALL"; goto Ldirect_3;
	case 0xd2: opstr = lc ? "jnc" : "JNC"; goto Ldirect_3;
	case 0xd4: opstr = lc ? "cnc" : "CNC"; goto Ldirect_3;
	case 0xda: opstr = lc ? "jc" : "JC"; goto Ldirect_3;
	case 0xdc: opstr = lc ? "cc" : "CC"; goto Ldirect_3;
	case 0xe2: opstr = lc ? "jpo" : "JPO"; goto Ldirect_3;
	case 0xe4: opstr = lc ? "cpo" : "CPO"; goto Ldirect_3;
	case 0xea: opstr = lc ? "jpe" : "JPE"; goto Ldirect_3;
	case 0xec: opstr = lc ? "cpe" : "CPE"; goto Ldirect_3;
	case 0xf2: opstr = lc ? "jp" : "JP"; goto Ldirect_3;
	case 0xf4: opstr = lc ? "cp" : "CP"; goto Ldirect_3;
	case 0xfa: opstr = lc ? "jm" : "JM"; goto Ldirect_3;
	case 0xfc: opstr = lc ? "cm" : "CM"; goto Ldirect_3;

	/* regh h */
	case 0x23: opstr = lc ? "inx" : "INX"; goto Lregh_1;
	case 0x24: opstr = lc ? "inr" : "INR"; goto Lregh_1;
	case 0x25: opstr = lc ? "dcr" : "DCR"; goto Lregh_1;
	case 0x29: opstr = lc ? "dad" : "DAD"; goto Lregh_1;
	case 0x2b: opstr = lc ? "dcx" : "DCX"; goto Lregh_1;
	case 0x84: opstr = lc ? "add" : "ADD"; goto Lregh_1;
	case 0x8c: opstr = lc ? "adc" : "ADC"; goto Lregh_1;
	case 0x94: opstr = lc ? "sub" : "SUB"; goto Lregh_1;
	case 0x9c: opstr = lc ? "sbb" : "SBB"; goto Lregh_1;
	case 0xa4: opstr = lc ? "ana" : "ANA"; goto Lregh_1;
	case 0xac: opstr = lc ? "xra" : "XRA"; goto Lregh_1;
	case 0xb4: opstr = lc ? "ora" : "ORA"; goto Lregh_1;
	case 0xbc: opstr = lc ? "cmp" : "CMP"; goto Lregh_1;
	case 0xe1: opstr = lc ? "pop" : "POP"; goto Lregh_1;
	case 0xe5: opstr = lc ? "push" : "PUSH"; goto Lregh_1;

	/* immh h,$%02x */
	case 0x26: opstr = lc ? "mvi" : "MVI"; goto Limmh_2;

	/* regl l */
	case 0x2c: opstr = lc ? "inr" : "INR"; goto Lregl_1;
	case 0x2d: opstr = lc ? "dcr" : "DCR"; goto Lregl_1;
	case 0x85: opstr = lc ? "add" : "ADD"; goto Lregl_1;
	case 0x8d: opstr = lc ? "adc" : "ADC"; goto Lregl_1;
	case 0x95: opstr = lc ? "sub" : "SUB"; goto Lregl_1;
	case 0x9d: opstr = lc ? "sbb" : "SBB"; goto Lregl_1;
	case 0xa5: opstr = lc ? "ana" : "ANA"; goto Lregl_1;
	case 0xad: opstr = lc ? "xra" : "XRA"; goto Lregl_1;
	case 0xb5: opstr = lc ? "ora" : "ORA"; goto Lregl_1;
	case 0xbd: opstr = lc ? "cmp" : "CMP"; goto Lregl_1;

	/* imml l,$%02x */
	case 0x2e: opstr = lc ? "mvi" : "MVI"; goto Limml_2;

	/* immxsp sp,$%02x%02x */
	case 0x31: opstr = lc ? "lxi" : "LXI"; goto Limmxsp_3;

	/* regsp sp */
	case 0x33: opstr = lc ? "inx" : "INX"; goto Lregsp_1;
	case 0x39: opstr = lc ? "dad" : "DAD"; goto Lregsp_1;
	case 0x3b: opstr = lc ? "dcx" : "DCX"; goto Lregsp_1;

	/* regm m */
	case 0x34: opstr = lc ? "inr" : "INR"; goto Lregm_1;
	case 0x35: opstr = lc ? "dcr" : "DCR"; goto Lregm_1;
	case 0x86: opstr = lc ? "add" : "ADD"; goto Lregm_1;
	case 0x8e: opstr = lc ? "adc" : "ADC"; goto Lregm_1;
	case 0x96: opstr = lc ? "sub" : "SUB"; goto Lregm_1;
	case 0x9e: opstr = lc ? "sbb" : "SBB"; goto Lregm_1;
	case 0xa6: opstr = lc ? "ana" : "ANA"; goto Lregm_1;
	case 0xae: opstr = lc ? "xra" : "XRA"; goto Lregm_1;
	case 0xb6: opstr = lc ? "ora" : "ORA"; goto Lregm_1;
	case 0xbe: opstr = lc ? "cmp" : "CMP"; goto Lregm_1;

	/* immm m,$%02x */
	case 0x36: opstr = lc ? "mvi" : "MVI"; goto Limmm_2;

	/* rega a */
	case 0x3c: opstr = lc ? "inr" : "INR"; goto Lrega_1;
	case 0x3d: opstr = lc ? "dcr" : "DCR"; goto Lrega_1;
	case 0x87: opstr = lc ? "add" : "ADD"; goto Lrega_1;
	case 0x8f: opstr = lc ? "adc" : "ADC"; goto Lrega_1;
	case 0x97: opstr = lc ? "sub" : "SUB"; goto Lrega_1;
	case 0x9f: opstr = lc ? "sbb" : "SBB"; goto Lrega_1;
	case 0xa7: opstr = lc ? "ana" : "ANA"; goto Lrega_1;
	case 0xaf: opstr = lc ? "xra" : "XRA"; goto Lrega_1;
	case 0xb7: opstr = lc ? "ora" : "ORA"; goto Lrega_1;
	case 0xbf: opstr = lc ? "cmp" : "CMP"; goto Lrega_1;

	/* imma a,$%02x */
	case 0x3e: opstr = lc ? "mvi" : "MVI"; goto Limma_2;

	/* regbb b,b */
	case 0x40: opstr = lc ? "mov" : "MOV"; goto Lregbb_1;

	/* regbc b,c */
	case 0x41: opstr = lc ? "mov" : "MOV"; goto Lregbc_1;

	/* regbd b,d */
	case 0x42: opstr = lc ? "mov" : "MOV"; goto Lregbd_1;

	/* regbe b,e */
	case 0x43: opstr = lc ? "mov" : "MOV"; goto Lregbe_1;

	/* regbh b,h */
	case 0x44: opstr = lc ? "mov" : "MOV"; goto Lregbh_1;

	/* regbl b,l */
	case 0x45: opstr = lc ? "mov" : "MOV"; goto Lregbl_1;

	/* regbm b,m */
	case 0x46: opstr = lc ? "mov" : "MOV"; goto Lregbm_1;

	/* regba b,a */
	case 0x47: opstr = lc ? "mov" : "MOV"; goto Lregba_1;

	/* regcb c,b */
	case 0x48: opstr = lc ? "mov" : "MOV"; goto Lregcb_1;

	/* regcc c,c */
	case 0x49: opstr = lc ? "mov" : "MOV"; goto Lregcc_1;

	/* regcd c,d */
	case 0x4a: opstr = lc ? "mov" : "MOV"; goto Lregcd_1;

	/* regce c,e */
	case 0x4b: opstr = lc ? "mov" : "MOV"; goto Lregce_1;

	/* regch c,h */
	case 0x4c: opstr = lc ? "mov" : "MOV"; goto Lregch_1;

	/* regcl c,l */
	case 0x4d: opstr = lc ? "mov" : "MOV"; goto Lregcl_1;

	/* regcm c,m */
	case 0x4e: opstr = lc ? "mov" : "MOV"; goto Lregcm_1;

	/* regca c,a */
	case 0x4f: opstr = lc ? "mov" : "MOV"; goto Lregca_1;

	/* regdb d,b */
	case 0x50: opstr = lc ? "mov" : "MOV"; goto Lregdb_1;

	/* regdc d,c */
	case 0x51: opstr = lc ? "mov" : "MOV"; goto Lregdc_1;

	/* regdd d,d */
	case 0x52: opstr = lc ? "mov" : "MOV"; goto Lregdd_1;

	/* regde d,e */
	case 0x53: opstr = lc ? "mov" : "MOV"; goto Lregde_1;

	/* regdh d,h */
	case 0x54: opstr = lc ? "mov" : "MOV"; goto Lregdh_1;

	/* regdl d,l */
	case 0x55: opstr = lc ? "mov" : "MOV"; goto Lregdl_1;

	/* regdm d,m */
	case 0x56: opstr = lc ? "mov" : "MOV"; goto Lregdm_1;

	/* regda d,a */
	case 0x57: opstr = lc ? "mov" : "MOV"; goto Lregda_1;

	/* regeb e,b */
	case 0x58: opstr = lc ? "mov" : "MOV"; goto Lregeb_1;

	/* regec e,c */
	case 0x59: opstr = lc ? "mov" : "MOV"; goto Lregec_1;

	/* reged e,d */
	case 0x5a: opstr = lc ? "mov" : "MOV"; goto Lreged_1;

	/* regee e,e */
	case 0x5b: opstr = lc ? "mov" : "MOV"; goto Lregee_1;

	/* regeh e,h */
	case 0x5c: opstr = lc ? "mov" : "MOV"; goto Lregeh_1;

	/* regel e,l */
	case 0x5d: opstr = lc ? "mov" : "MOV"; goto Lregel_1;

	/* regem e,m */
	case 0x5e: opstr = lc ? "mov" : "MOV"; goto Lregem_1;

	/* regea e,a */
	case 0x5f: opstr = lc ? "mov" : "MOV"; goto Lregea_1;

	/* reghb h,b */
	case 0x60: opstr = lc ? "mov" : "MOV"; goto Lreghb_1;

	/* reghc h,c */
	case 0x61: opstr = lc ? "mov" : "MOV"; goto Lreghc_1;

	/* reghd h,d */
	case 0x62: opstr = lc ? "mov" : "MOV"; goto Lreghd_1;

	/* reghe h,e */
	case 0x63: opstr = lc ? "mov" : "MOV"; goto Lreghe_1;

	/* reghh h,h */
	case 0x64: opstr = lc ? "mov" : "MOV"; goto Lreghh_1;

	/* reghl h,l */
	case 0x65: opstr = lc ? "mov" : "MOV"; goto Lreghl_1;

	/* reghm h,m */
	case 0x66: opstr = lc ? "mov" : "MOV"; goto Lreghm_1;

	/* regha h,a */
	case 0x67: opstr = lc ? "mov" : "MOV"; goto Lregha_1;

	/* reglb l,b */
	case 0x68: opstr = lc ? "mov" : "MOV"; goto Lreglb_1;

	/* reglc l,c */
	case 0x69: opstr = lc ? "mov" : "MOV"; goto Lreglc_1;

	/* regld l,d */
	case 0x6a: opstr = lc ? "mov" : "MOV"; goto Lregld_1;

	/* regle l,e */
	case 0x6b: opstr = lc ? "mov" : "MOV"; goto Lregle_1;

	/* reglh l,h */
	case 0x6c: opstr = lc ? "mov" : "MOV"; goto Lreglh_1;

	/* regll l,l */
	case 0x6d: opstr = lc ? "mov" : "MOV"; goto Lregll_1;

	/* reglm l,m */
	case 0x6e: opstr = lc ? "mov" : "MOV"; goto Lreglm_1;

	/* regla l,a */
	case 0x6f: opstr = lc ? "mov" : "MOV"; goto Lregla_1;

	/* regmb m,b */
	case 0x70: opstr = lc ? "mov" : "MOV"; goto Lregmb_1;

	/* regmc m,c */
	case 0x71: opstr = lc ? "mov" : "MOV"; goto Lregmc_1;

	/* regmd m,d */
	case 0x72: opstr = lc ? "mov" : "MOV"; goto Lregmd_1;

	/* regme m,e */
	case 0x73: opstr = lc ? "mov" : "MOV"; goto Lregme_1;

	/* regmh m,h */
	case 0x74: opstr = lc ? "mov" : "MOV"; goto Lregmh_1;

	/* regml m,l */
	case 0x75: opstr = lc ? "mov" : "MOV"; goto Lregml_1;

	/* regma m,a */
	case 0x77: opstr = lc ? "mov" : "MOV"; goto Lregma_1;

	/* regab a,b */
	case 0x78: opstr = lc ? "mov" : "MOV"; goto Lregab_1;

	/* regac a,c */
	case 0x79: opstr = lc ? "mov" : "MOV"; goto Lregac_1;

	/* regad a,d */
	case 0x7a: opstr = lc ? "mov" : "MOV"; goto Lregad_1;

	/* regae a,e */
	case 0x7b: opstr = lc ? "mov" : "MOV"; goto Lregae_1;

	/* regah a,h */
	case 0x7c: opstr = lc ? "mov" : "MOV"; goto Lregah_1;

	/* regal a,l */
	case 0x7d: opstr = lc ? "mov" : "MOV"; goto Lregal_1;

	/* regam a,m */
	case 0x7e: opstr = lc ? "mov" : "MOV"; goto Lregam_1;

	/* regaa a,a */
	case 0x7f: opstr = lc ? "mov" : "MOV"; goto Lregaa_1;

	/* imm $%02x */
	case 0xc6: opstr = lc ? "adi" : "ADI"; goto Limm_2;
	case 0xce: opstr = lc ? "aci" : "ACI"; goto Limm_2;
	case 0xd3: opstr = lc ? "out" : "OUT"; goto Limm_2;
	case 0xd6: opstr = lc ? "sui" : "SUI"; goto Limm_2;
	case 0xdb: opstr = lc ? "in" : "IN"; goto Limm_2;
	case 0xde: opstr = lc ? "sbi" : "SBI"; goto Limm_2;
	case 0xe6: opstr = lc ? "ani" : "ANI"; goto Limm_2;
	case 0xee: opstr = lc ? "xri" : "XRI"; goto Limm_2;
	case 0xf6: opstr = lc ? "ori" : "ORI"; goto Limm_2;
	case 0xfe: opstr = lc ? "cpi" : "CPI"; goto Limm_2;

	/* 0 0 */
	case 0xc7: opstr = lc ? "rst" : "RST"; goto L0_1;

	/* 1 1 */
	case 0xcf: opstr = lc ? "rst" : "RST"; goto L1_1;

	/* 2 2 */
	case 0xd7: opstr = lc ? "rst" : "RST"; goto L2_1;

	/* 3 3 */
	case 0xdf: opstr = lc ? "rst" : "RST"; goto L3_1;

	/* 4 4 */
	case 0xe7: opstr = lc ? "rst" : "RST"; goto L4_1;

	/* 5 5 */
	case 0xef: opstr = lc ? "rst" : "RST"; goto L5_1;

	/* regpsw psw */
	case 0xf1: opstr = lc ? "pop" : "POP"; goto Lregpsw_1;
	case 0xf5: opstr = lc ? "push" : "PUSH"; goto Lregpsw_1;

	/* 6 6 */
	case 0xf7: opstr = lc ? "rst" : "RST"; goto L6_1;

	/* 7 7 */
	case 0xff: opstr = lc ? "rst" : "RST"; goto L7_1;

	default:
		h = &hexdigits[(opcode & 0xff)*2]; *t++=*h++; *t++=*h++;
		goto last;
	}
Limplied_1: /*  [] */
	do {*t++ = *opstr++;} while (*opstr);
	goto last;
Limmxb_3: /* b,$%02x%02x ['op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	if (lc) *t++='b';
	else *t++='B';
	*t++=',';
	addr = op1 + 256 * op2;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	goto last;
Lregb_1: /* b [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='b';
	else *t++='B';
	goto last;
Limmb_2: /* b,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='b';
	else *t++='B';
	*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lregc_1: /* c [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='c';
	else *t++='C';
	goto last;
Limmc_2: /* c,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='c';
	else *t++='C';
	*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Limmxd_3: /* d,$%02x%02x ['op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	if (lc) *t++='d';
	else *t++='D';
	*t++=',';
	addr = op1 + 256 * op2;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	goto last;
Lregd_1: /* d [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='d';
	else *t++='D';
	goto last;
Limmd_2: /* d,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='d';
	else *t++='D';
	*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lrege_1: /* e [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='e';
	else *t++='E';
	goto last;
Limme_2: /* e,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='e';
	else *t++='E';
	*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Limmxh_3: /* h,$%02x%02x ['op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	if (lc) *t++='h';
	else *t++='H';
	*t++=',';
	addr = op1 + 256 * op2;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	goto last;
Ldirect_3: /* $%02x%02x ['op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	addr = op1 + 256 * op2;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	goto last;
Lregh_1: /* h [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='h';
	else *t++='H';
	goto last;
Limmh_2: /* h,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='h';
	else *t++='H';
	*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lregl_1: /* l [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='l';
	else *t++='L';
	goto last;
Limml_2: /* l,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='l';
	else *t++='L';
	*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Limmxsp_3: /* sp,$%02x%02x ['op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	if (lc) *t++='s',*t++='p';
	else *t++='S',*t++='P';
	*t++=',';
	addr = op1 + 256 * op2;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	goto last;
Lregsp_1: /* sp [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='s',*t++='p';
	else *t++='S',*t++='P';
	goto last;
Lregm_1: /* m [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='m';
	else *t++='M';
	goto last;
Limmm_2: /* m,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='m';
	else *t++='M';
	*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lrega_1: /* a [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	goto last;
Limma_2: /* a,$%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
Lregbb_1: /* b,b [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='b';
	else *t++='B';
	*t++=',';
	if (lc) *t++='b';
	else *t++='B';
	goto last;
Lregbc_1: /* b,c [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='b';
	else *t++='B';
	*t++=',';
	if (lc) *t++='c';
	else *t++='C';
	goto last;
Lregbd_1: /* b,d [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='b';
	else *t++='B';
	*t++=',';
	if (lc) *t++='d';
	else *t++='D';
	goto last;
Lregbe_1: /* b,e [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='b';
	else *t++='B';
	*t++=',';
	if (lc) *t++='e';
	else *t++='E';
	goto last;
Lregbh_1: /* b,h [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='b';
	else *t++='B';
	*t++=',';
	if (lc) *t++='h';
	else *t++='H';
	goto last;
Lregbl_1: /* b,l [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='b';
	else *t++='B';
	*t++=',';
	if (lc) *t++='l';
	else *t++='L';
	goto last;
Lregbm_1: /* b,m [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='b';
	else *t++='B';
	*t++=',';
	if (lc) *t++='m';
	else *t++='M';
	goto last;
Lregba_1: /* b,a [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='b';
	else *t++='B';
	*t++=',';
	if (lc) *t++='a';
	else *t++='A';
	goto last;
Lregcb_1: /* c,b [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='c';
	else *t++='C';
	*t++=',';
	if (lc) *t++='b';
	else *t++='B';
	goto last;
Lregcc_1: /* c,c [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='c';
	else *t++='C';
	*t++=',';
	if (lc) *t++='c';
	else *t++='C';
	goto last;
Lregcd_1: /* c,d [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='c';
	else *t++='C';
	*t++=',';
	if (lc) *t++='d';
	else *t++='D';
	goto last;
Lregce_1: /* c,e [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='c';
	else *t++='C';
	*t++=',';
	if (lc) *t++='e';
	else *t++='E';
	goto last;
Lregch_1: /* c,h [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='c';
	else *t++='C';
	*t++=',';
	if (lc) *t++='h';
	else *t++='H';
	goto last;
Lregcl_1: /* c,l [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='c';
	else *t++='C';
	*t++=',';
	if (lc) *t++='l';
	else *t++='L';
	goto last;
Lregcm_1: /* c,m [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='c';
	else *t++='C';
	*t++=',';
	if (lc) *t++='m';
	else *t++='M';
	goto last;
Lregca_1: /* c,a [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='c';
	else *t++='C';
	*t++=',';
	if (lc) *t++='a';
	else *t++='A';
	goto last;
Lregdb_1: /* d,b [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='d';
	else *t++='D';
	*t++=',';
	if (lc) *t++='b';
	else *t++='B';
	goto last;
Lregdc_1: /* d,c [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='d';
	else *t++='D';
	*t++=',';
	if (lc) *t++='c';
	else *t++='C';
	goto last;
Lregdd_1: /* d,d [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='d';
	else *t++='D';
	*t++=',';
	if (lc) *t++='d';
	else *t++='D';
	goto last;
Lregde_1: /* d,e [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='d';
	else *t++='D';
	*t++=',';
	if (lc) *t++='e';
	else *t++='E';
	goto last;
Lregdh_1: /* d,h [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='d';
	else *t++='D';
	*t++=',';
	if (lc) *t++='h';
	else *t++='H';
	goto last;
Lregdl_1: /* d,l [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='d';
	else *t++='D';
	*t++=',';
	if (lc) *t++='l';
	else *t++='L';
	goto last;
Lregdm_1: /* d,m [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='d';
	else *t++='D';
	*t++=',';
	if (lc) *t++='m';
	else *t++='M';
	goto last;
Lregda_1: /* d,a [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='d';
	else *t++='D';
	*t++=',';
	if (lc) *t++='a';
	else *t++='A';
	goto last;
Lregeb_1: /* e,b [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='e';
	else *t++='E';
	*t++=',';
	if (lc) *t++='b';
	else *t++='B';
	goto last;
Lregec_1: /* e,c [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='e';
	else *t++='E';
	*t++=',';
	if (lc) *t++='c';
	else *t++='C';
	goto last;
Lreged_1: /* e,d [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='e';
	else *t++='E';
	*t++=',';
	if (lc) *t++='d';
	else *t++='D';
	goto last;
Lregee_1: /* e,e [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='e';
	else *t++='E';
	*t++=',';
	if (lc) *t++='e';
	else *t++='E';
	goto last;
Lregeh_1: /* e,h [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='e';
	else *t++='E';
	*t++=',';
	if (lc) *t++='h';
	else *t++='H';
	goto last;
Lregel_1: /* e,l [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='e';
	else *t++='E';
	*t++=',';
	if (lc) *t++='l';
	else *t++='L';
	goto last;
Lregem_1: /* e,m [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='e';
	else *t++='E';
	*t++=',';
	if (lc) *t++='m';
	else *t++='M';
	goto last;
Lregea_1: /* e,a [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='e';
	else *t++='E';
	*t++=',';
	if (lc) *t++='a';
	else *t++='A';
	goto last;
Lreghb_1: /* h,b [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='h';
	else *t++='H';
	*t++=',';
	if (lc) *t++='b';
	else *t++='B';
	goto last;
Lreghc_1: /* h,c [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='h';
	else *t++='H';
	*t++=',';
	if (lc) *t++='c';
	else *t++='C';
	goto last;
Lreghd_1: /* h,d [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='h';
	else *t++='H';
	*t++=',';
	if (lc) *t++='d';
	else *t++='D';
	goto last;
Lreghe_1: /* h,e [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='h';
	else *t++='H';
	*t++=',';
	if (lc) *t++='e';
	else *t++='E';
	goto last;
Lreghh_1: /* h,h [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='h';
	else *t++='H';
	*t++=',';
	if (lc) *t++='h';
	else *t++='H';
	goto last;
Lreghl_1: /* h,l [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='h';
	else *t++='H';
	*t++=',';
	if (lc) *t++='l';
	else *t++='L';
	goto last;
Lreghm_1: /* h,m [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='h';
	else *t++='H';
	*t++=',';
	if (lc) *t++='m';
	else *t++='M';
	goto last;
Lregha_1: /* h,a [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='h';
	else *t++='H';
	*t++=',';
	if (lc) *t++='a';
	else *t++='A';
	goto last;
Lreglb_1: /* l,b [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='l';
	else *t++='L';
	*t++=',';
	if (lc) *t++='b';
	else *t++='B';
	goto last;
Lreglc_1: /* l,c [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='l';
	else *t++='L';
	*t++=',';
	if (lc) *t++='c';
	else *t++='C';
	goto last;
Lregld_1: /* l,d [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='l';
	else *t++='L';
	*t++=',';
	if (lc) *t++='d';
	else *t++='D';
	goto last;
Lregle_1: /* l,e [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='l';
	else *t++='L';
	*t++=',';
	if (lc) *t++='e';
	else *t++='E';
	goto last;
Lreglh_1: /* l,h [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='l';
	else *t++='L';
	*t++=',';
	if (lc) *t++='h';
	else *t++='H';
	goto last;
Lregll_1: /* l,l [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='l';
	else *t++='L';
	*t++=',';
	if (lc) *t++='l';
	else *t++='L';
	goto last;
Lreglm_1: /* l,m [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='l';
	else *t++='L';
	*t++=',';
	if (lc) *t++='m';
	else *t++='M';
	goto last;
Lregla_1: /* l,a [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='l';
	else *t++='L';
	*t++=',';
	if (lc) *t++='a';
	else *t++='A';
	goto last;
Lregmb_1: /* m,b [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='m';
	else *t++='M';
	*t++=',';
	if (lc) *t++='b';
	else *t++='B';
	goto last;
Lregmc_1: /* m,c [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='m';
	else *t++='M';
	*t++=',';
	if (lc) *t++='c';
	else *t++='C';
	goto last;
Lregmd_1: /* m,d [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='m';
	else *t++='M';
	*t++=',';
	if (lc) *t++='d';
	else *t++='D';
	goto last;
Lregme_1: /* m,e [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='m';
	else *t++='M';
	*t++=',';
	if (lc) *t++='e';
	else *t++='E';
	goto last;
Lregmh_1: /* m,h [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='m';
	else *t++='M';
	*t++=',';
	if (lc) *t++='h';
	else *t++='H';
	goto last;
Lregml_1: /* m,l [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='m';
	else *t++='M';
	*t++=',';
	if (lc) *t++='l';
	else *t++='L';
	goto last;
Lregma_1: /* m,a [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='m';
	else *t++='M';
	*t++=',';
	if (lc) *t++='a';
	else *t++='A';
	goto last;
Lregab_1: /* a,b [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',';
	if (lc) *t++='b';
	else *t++='B';
	goto last;
Lregac_1: /* a,c [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',';
	if (lc) *t++='c';
	else *t++='C';
	goto last;
Lregad_1: /* a,d [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',';
	if (lc) *t++='d';
	else *t++='D';
	goto last;
Lregae_1: /* a,e [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',';
	if (lc) *t++='e';
	else *t++='E';
	goto last;
Lregah_1: /* a,h [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',';
	if (lc) *t++='h';
	else *t++='H';
	goto last;
Lregal_1: /* a,l [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',';
	if (lc) *t++='l';
	else *t++='L';
	goto last;
Lregam_1: /* a,m [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',';
	if (lc) *t++='m';
	else *t++='M';
	goto last;
Lregaa_1: /* a,a [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='a';
	else *t++='A';
	*t++=',';
	if (lc) *t++='a';
	else *t++='A';
	goto last;
Limm_2: /* $%02x ['op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	*t++=' ';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	goto last;
L0_1: /* 0 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ',*t++='0';
	goto last;
L1_1: /* 1 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ',*t++='1';
	goto last;
L2_1: /* 2 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ',*t++='2';
	goto last;
L3_1: /* 3 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ',*t++='3';
	goto last;
L4_1: /* 4 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ',*t++='4';
	goto last;
L5_1: /* 5 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ',*t++='5';
	goto last;
Lregpsw_1: /* psw [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ';
	if (lc) *t++='p',*t++='s',*t++='w';
	else *t++='P',*t++='S',*t++='W';
	goto last;
L6_1: /* 6 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ',*t++='6';
	goto last;
L7_1: /* 7 [] */
	do {*t++ = *opstr++;} while (*opstr);
	*t++=' ',*t++='7';
	goto last;

last:
	return (int)(t - first_t);
}

int stringify_entry_jumpman_level(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets) {
	int dist;
	unsigned char opcode, leadin, op1, op2, op3;
	char *first_t, *h, *opstr;
	unsigned short rel, addr;

	first_t = t;
	opcode = entry->instruction[0];
	switch(opcode) {
	/* type $%02x%02x */
	case 0xfc: opstr = lc ? "type" : "TYPE"; goto Ltype_3;

	/* draw x=$%02x y=$%02x len=$%02x */
	case 0xfd: opstr = lc ? "draw" : "DRAW"; goto Ldraw_4;

	/* spacing dx=$%02x dy=$%02x */
	case 0xfe: opstr = lc ? "spacing" : "SPACING"; goto Lspacing_3;

	/* implicit  */
	case 0xff: opstr = lc ? "end" : "END"; goto Limplicit_1;

	default:
		h = &hexdigits[(opcode & 0xff)*2]; *t++=*h++; *t++=*h++;
		goto last;
	}
Ltype_3: /* $%02x%02x ['op2', 'op1'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	addr = op1 + 256 * op2;
	t += print_label_or_addr(addr, jmp_targets, t, hexdigits, 0);
	goto last;
Ldraw_4: /* x=$%02x y=$%02x len=$%02x ['op1', 'op2', 'op3'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	op3 = entry->instruction[3];
	*t++=' ';
	if (lc) *t++='x';
	else *t++='X';
	*t++='=';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=' ';
	if (lc) *t++='y';
	else *t++='Y';
	*t++='=';
	t += print_label_or_addr(op2, jmp_targets, t, hexdigits, 1);
	*t++=' ';
	if (lc) *t++='l',*t++='e',*t++='n';
	else *t++='L',*t++='E',*t++='N';
	*t++='=';
	t += print_label_or_addr(op3, jmp_targets, t, hexdigits, 1);
	goto last;
Lspacing_3: /* dx=$%02x dy=$%02x ['op1', 'op2'] */
	do {*t++ = *opstr++;} while (*opstr);
	op1 = entry->instruction[1];
	op2 = entry->instruction[2];
	*t++=' ';
	if (lc) *t++='d',*t++='x';
	else *t++='D',*t++='X';
	*t++='=';
	t += print_label_or_addr(op1, jmp_targets, t, hexdigits, 1);
	*t++=' ';
	if (lc) *t++='d',*t++='y';
	else *t++='D',*t++='Y';
	*t++='=';
	t += print_label_or_addr(op2, jmp_targets, t, hexdigits, 1);
	goto last;
Limplicit_1: /*  [] */
	do {*t++ = *opstr++;} while (*opstr);
	goto last;

last:
	return (int)(t - first_t);
}


extern int stringify_entry_data(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets);
extern int stringify_entry_frame_start(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets);
extern int stringify_entry_frame_end(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets);
extern int stringify_entry_antic_dl(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets);
extern int stringify_entry_jumpman_harvest(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets);
extern int stringify_entry_6502_history(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets);
extern int stringify_entry_6502_history_result(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets);
extern int stringify_entry_atari800_history(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets);
extern int stringify_entry_6502_history_result(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets);
extern int stringify_entry_atari800_vbi_start(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets);
extern int stringify_entry_atari800_vbi_end(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets);
extern int stringify_entry_atari800_dli_start(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets);
extern int stringify_entry_atari800_dli_end(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets);
extern int stringify_entry_next_instruction(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets);
extern int stringify_entry_next_instruction_result(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets);
extern int stringify_entry_breakpoint(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets);
extern int stringify_entry_blank(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets);
extern int stringify_entry_unknown_disassembler(history_entry_t *entry, char *t, char *hexdigits, int lc, jmp_targets_t *jmp_targets);

void *stringifier_map[] = {
stringify_entry_data, /* 0 */
stringify_entry_unknown_disassembler, /* 1 */
stringify_entry_unknown_disassembler, /* 2 */
stringify_entry_unknown_disassembler, /* 3 */
stringify_entry_unknown_disassembler, /* 4 */
stringify_entry_unknown_disassembler, /* 5 */
stringify_entry_unknown_disassembler, /* 6 */
stringify_entry_unknown_disassembler, /* 7 */
stringify_entry_unknown_disassembler, /* 8 */
stringify_entry_unknown_disassembler, /* 9 */
stringify_entry_6502, /* 10 */
stringify_entry_6502undoc, /* 11 */
stringify_entry_65816, /* 12 */
stringify_entry_65c02, /* 13 */
stringify_entry_6800, /* 14 */
stringify_entry_6809, /* 15 */
stringify_entry_6811, /* 16 */
stringify_entry_8051, /* 17 */
stringify_entry_8080, /* 18 */
stringify_entry_unknown_disassembler, /* 19 */
stringify_entry_unknown_disassembler, /* 20 */
stringify_entry_unknown_disassembler, /* 21 */
stringify_entry_unknown_disassembler, /* 22 */
stringify_entry_unknown_disassembler, /* 23 */
stringify_entry_unknown_disassembler, /* 24 */
stringify_entry_unknown_disassembler, /* 25 */
stringify_entry_unknown_disassembler, /* 26 */
stringify_entry_unknown_disassembler, /* 27 */
stringify_entry_unknown_disassembler, /* 28 */
stringify_entry_unknown_disassembler, /* 29 */
stringify_entry_antic_dl, /* 30 */
stringify_entry_jumpman_harvest, /* 31 */
stringify_entry_jumpman_level, /* 32 */
stringify_entry_unknown_disassembler, /* 33 */
stringify_entry_unknown_disassembler, /* 34 */
stringify_entry_unknown_disassembler, /* 35 */
stringify_entry_unknown_disassembler, /* 36 */
stringify_entry_unknown_disassembler, /* 37 */
stringify_entry_unknown_disassembler, /* 38 */
stringify_entry_unknown_disassembler, /* 39 */
stringify_entry_unknown_disassembler, /* 40 */
stringify_entry_unknown_disassembler, /* 41 */
stringify_entry_unknown_disassembler, /* 42 */
stringify_entry_unknown_disassembler, /* 43 */
stringify_entry_unknown_disassembler, /* 44 */
stringify_entry_unknown_disassembler, /* 45 */
stringify_entry_unknown_disassembler, /* 46 */
stringify_entry_unknown_disassembler, /* 47 */
stringify_entry_unknown_disassembler, /* 48 */
stringify_entry_unknown_disassembler, /* 49 */
stringify_entry_unknown_disassembler, /* 50 */
stringify_entry_unknown_disassembler, /* 51 */
stringify_entry_unknown_disassembler, /* 52 */
stringify_entry_unknown_disassembler, /* 53 */
stringify_entry_unknown_disassembler, /* 54 */
stringify_entry_unknown_disassembler, /* 55 */
stringify_entry_unknown_disassembler, /* 56 */
stringify_entry_unknown_disassembler, /* 57 */
stringify_entry_unknown_disassembler, /* 58 */
stringify_entry_unknown_disassembler, /* 59 */
stringify_entry_unknown_disassembler, /* 60 */
stringify_entry_unknown_disassembler, /* 61 */
stringify_entry_unknown_disassembler, /* 62 */
stringify_entry_unknown_disassembler, /* 63 */
stringify_entry_unknown_disassembler, /* 64 */
stringify_entry_unknown_disassembler, /* 65 */
stringify_entry_unknown_disassembler, /* 66 */
stringify_entry_unknown_disassembler, /* 67 */
stringify_entry_unknown_disassembler, /* 68 */
stringify_entry_unknown_disassembler, /* 69 */
stringify_entry_unknown_disassembler, /* 70 */
stringify_entry_unknown_disassembler, /* 71 */
stringify_entry_unknown_disassembler, /* 72 */
stringify_entry_unknown_disassembler, /* 73 */
stringify_entry_unknown_disassembler, /* 74 */
stringify_entry_unknown_disassembler, /* 75 */
stringify_entry_unknown_disassembler, /* 76 */
stringify_entry_unknown_disassembler, /* 77 */
stringify_entry_unknown_disassembler, /* 78 */
stringify_entry_unknown_disassembler, /* 79 */
stringify_entry_unknown_disassembler, /* 80 */
stringify_entry_unknown_disassembler, /* 81 */
stringify_entry_unknown_disassembler, /* 82 */
stringify_entry_unknown_disassembler, /* 83 */
stringify_entry_unknown_disassembler, /* 84 */
stringify_entry_unknown_disassembler, /* 85 */
stringify_entry_unknown_disassembler, /* 86 */
stringify_entry_unknown_disassembler, /* 87 */
stringify_entry_unknown_disassembler, /* 88 */
stringify_entry_unknown_disassembler, /* 89 */
stringify_entry_unknown_disassembler, /* 90 */
stringify_entry_unknown_disassembler, /* 91 */
stringify_entry_unknown_disassembler, /* 92 */
stringify_entry_unknown_disassembler, /* 93 */
stringify_entry_unknown_disassembler, /* 94 */
stringify_entry_unknown_disassembler, /* 95 */
stringify_entry_unknown_disassembler, /* 96 */
stringify_entry_unknown_disassembler, /* 97 */
stringify_entry_unknown_disassembler, /* 98 */
stringify_entry_unknown_disassembler, /* 99 */
stringify_entry_unknown_disassembler, /* 100 */
stringify_entry_unknown_disassembler, /* 101 */
stringify_entry_unknown_disassembler, /* 102 */
stringify_entry_unknown_disassembler, /* 103 */
stringify_entry_unknown_disassembler, /* 104 */
stringify_entry_unknown_disassembler, /* 105 */
stringify_entry_unknown_disassembler, /* 106 */
stringify_entry_unknown_disassembler, /* 107 */
stringify_entry_unknown_disassembler, /* 108 */
stringify_entry_unknown_disassembler, /* 109 */
stringify_entry_unknown_disassembler, /* 110 */
stringify_entry_unknown_disassembler, /* 111 */
stringify_entry_unknown_disassembler, /* 112 */
stringify_entry_unknown_disassembler, /* 113 */
stringify_entry_unknown_disassembler, /* 114 */
stringify_entry_unknown_disassembler, /* 115 */
stringify_entry_unknown_disassembler, /* 116 */
stringify_entry_unknown_disassembler, /* 117 */
stringify_entry_unknown_disassembler, /* 118 */
stringify_entry_unknown_disassembler, /* 119 */
stringify_entry_unknown_disassembler, /* 120 */
stringify_entry_unknown_disassembler, /* 121 */
stringify_entry_unknown_disassembler, /* 122 */
stringify_entry_unknown_disassembler, /* 123 */
stringify_entry_unknown_disassembler, /* 124 */
stringify_entry_unknown_disassembler, /* 125 */
stringify_entry_unknown_disassembler, /* 126 */
stringify_entry_unknown_disassembler, /* 127 */
stringify_entry_6502_history, /* 128 */
stringify_entry_6502_history_result, /* 129 */
stringify_entry_atari800_history, /* 130 */
stringify_entry_6502_history_result, /* 131 */
stringify_entry_next_instruction, /* 132 */
stringify_entry_next_instruction_result, /* 133 */
stringify_entry_unknown_disassembler, /* 134 */
stringify_entry_unknown_disassembler, /* 135 */
stringify_entry_unknown_disassembler, /* 136 */
stringify_entry_unknown_disassembler, /* 137 */
stringify_entry_unknown_disassembler, /* 138 */
stringify_entry_unknown_disassembler, /* 139 */
stringify_entry_unknown_disassembler, /* 140 */
stringify_entry_unknown_disassembler, /* 141 */
stringify_entry_unknown_disassembler, /* 142 */
stringify_entry_unknown_disassembler, /* 143 */
stringify_entry_unknown_disassembler, /* 144 */
stringify_entry_unknown_disassembler, /* 145 */
stringify_entry_unknown_disassembler, /* 146 */
stringify_entry_unknown_disassembler, /* 147 */
stringify_entry_unknown_disassembler, /* 148 */
stringify_entry_unknown_disassembler, /* 149 */
stringify_entry_unknown_disassembler, /* 150 */
stringify_entry_unknown_disassembler, /* 151 */
stringify_entry_unknown_disassembler, /* 152 */
stringify_entry_unknown_disassembler, /* 153 */
stringify_entry_unknown_disassembler, /* 154 */
stringify_entry_unknown_disassembler, /* 155 */
stringify_entry_unknown_disassembler, /* 156 */
stringify_entry_unknown_disassembler, /* 157 */
stringify_entry_unknown_disassembler, /* 158 */
stringify_entry_unknown_disassembler, /* 159 */
stringify_entry_unknown_disassembler, /* 160 */
stringify_entry_unknown_disassembler, /* 161 */
stringify_entry_unknown_disassembler, /* 162 */
stringify_entry_unknown_disassembler, /* 163 */
stringify_entry_unknown_disassembler, /* 164 */
stringify_entry_unknown_disassembler, /* 165 */
stringify_entry_unknown_disassembler, /* 166 */
stringify_entry_unknown_disassembler, /* 167 */
stringify_entry_unknown_disassembler, /* 168 */
stringify_entry_unknown_disassembler, /* 169 */
stringify_entry_unknown_disassembler, /* 170 */
stringify_entry_unknown_disassembler, /* 171 */
stringify_entry_unknown_disassembler, /* 172 */
stringify_entry_unknown_disassembler, /* 173 */
stringify_entry_unknown_disassembler, /* 174 */
stringify_entry_unknown_disassembler, /* 175 */
stringify_entry_unknown_disassembler, /* 176 */
stringify_entry_unknown_disassembler, /* 177 */
stringify_entry_unknown_disassembler, /* 178 */
stringify_entry_unknown_disassembler, /* 179 */
stringify_entry_unknown_disassembler, /* 180 */
stringify_entry_unknown_disassembler, /* 181 */
stringify_entry_unknown_disassembler, /* 182 */
stringify_entry_unknown_disassembler, /* 183 */
stringify_entry_unknown_disassembler, /* 184 */
stringify_entry_unknown_disassembler, /* 185 */
stringify_entry_unknown_disassembler, /* 186 */
stringify_entry_unknown_disassembler, /* 187 */
stringify_entry_unknown_disassembler, /* 188 */
stringify_entry_unknown_disassembler, /* 189 */
stringify_entry_unknown_disassembler, /* 190 */
stringify_entry_unknown_disassembler, /* 191 */
stringify_entry_frame_start, /* 192 */
stringify_entry_frame_end, /* 192 */
stringify_entry_atari800_vbi_start, /* 194 */
stringify_entry_atari800_vbi_end, /* 195 */
stringify_entry_atari800_dli_start, /* 196 */
stringify_entry_atari800_dli_end, /* 197 */
stringify_entry_unknown_disassembler, /* 198 */
stringify_entry_unknown_disassembler, /* 199 */
stringify_entry_unknown_disassembler, /* 200 */
stringify_entry_unknown_disassembler, /* 201 */
stringify_entry_unknown_disassembler, /* 202 */
stringify_entry_unknown_disassembler, /* 203 */
stringify_entry_unknown_disassembler, /* 204 */
stringify_entry_unknown_disassembler, /* 205 */
stringify_entry_unknown_disassembler, /* 206 */
stringify_entry_unknown_disassembler, /* 207 */
stringify_entry_unknown_disassembler, /* 208 */
stringify_entry_unknown_disassembler, /* 209 */
stringify_entry_unknown_disassembler, /* 210 */
stringify_entry_unknown_disassembler, /* 211 */
stringify_entry_unknown_disassembler, /* 212 */
stringify_entry_unknown_disassembler, /* 213 */
stringify_entry_unknown_disassembler, /* 214 */
stringify_entry_unknown_disassembler, /* 215 */
stringify_entry_unknown_disassembler, /* 216 */
stringify_entry_unknown_disassembler, /* 217 */
stringify_entry_unknown_disassembler, /* 218 */
stringify_entry_unknown_disassembler, /* 219 */
stringify_entry_unknown_disassembler, /* 220 */
stringify_entry_unknown_disassembler, /* 221 */
stringify_entry_unknown_disassembler, /* 222 */
stringify_entry_unknown_disassembler, /* 223 */
stringify_entry_unknown_disassembler, /* 224 */
stringify_entry_unknown_disassembler, /* 225 */
stringify_entry_unknown_disassembler, /* 226 */
stringify_entry_unknown_disassembler, /* 227 */
stringify_entry_unknown_disassembler, /* 228 */
stringify_entry_unknown_disassembler, /* 229 */
stringify_entry_unknown_disassembler, /* 230 */
stringify_entry_unknown_disassembler, /* 231 */
stringify_entry_unknown_disassembler, /* 232 */
stringify_entry_unknown_disassembler, /* 233 */
stringify_entry_unknown_disassembler, /* 234 */
stringify_entry_unknown_disassembler, /* 235 */
stringify_entry_unknown_disassembler, /* 236 */
stringify_entry_unknown_disassembler, /* 237 */
stringify_entry_unknown_disassembler, /* 238 */
stringify_entry_unknown_disassembler, /* 239 */
stringify_entry_unknown_disassembler, /* 240 */
stringify_entry_unknown_disassembler, /* 241 */
stringify_entry_unknown_disassembler, /* 242 */
stringify_entry_unknown_disassembler, /* 243 */
stringify_entry_unknown_disassembler, /* 244 */
stringify_entry_unknown_disassembler, /* 245 */
stringify_entry_unknown_disassembler, /* 246 */
stringify_entry_unknown_disassembler, /* 247 */
stringify_entry_unknown_disassembler, /* 248 */
stringify_entry_unknown_disassembler, /* 249 */
stringify_entry_unknown_disassembler, /* 250 */
stringify_entry_unknown_disassembler, /* 251 */
stringify_entry_unknown_disassembler, /* 252 */
stringify_entry_breakpoint, /* 253 */
stringify_entry_blank, /* 254 */
stringify_entry_unknown_disassembler, /* 255 */
};
