Anonymous avatar Anonymous committed 9472c41

Breaking out chip definitions into a separate file.

Comments (0)

Files changed (6)

 
 # List C source files here. (C dependencies are automatically generated.)
 SRC =	$(TARGET).c \
+	chips.c \
 	bits.c \
 	xmodem.c \
 	usb_serial.c \
 LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
 #LDFLAGS += -T linker_script.x
 
-
+#---------------- Platform detection -------------
+UNAME := $(shell uname)
 
 #---------------- Programming Options (avrdude) ----------------
 
 AVRDUDE_PROGRAMMER = stk500v2
 
 # com1 = serial port. Use lpt1 to connect to parallel port.
-AVRDUDE_PORT = com1    # programmer connected to serial device
+ifeq ($(UNAME), Linux)
+	AVRDUDE_PORT = /dev/ttyACM0    # programmer connected to serial device
+else
+	AVRDUDE_PORT = com1
+endif
 
 AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
 #AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
 
 # Define programs and commands.
 SHELL = sh
-AVR_PATH = /Applications/Arduino.app/Contents//Resources/Java/hardware/tools/avr
+ifeq ($(UNAME), Linux)
+	AVR_PATH = /usr
+else
+	AVR_PATH = /Applications/Arduino.app/Contents//Resources/Java/hardware/tools/avr
+endif
+
 CC = $(AVR_PATH)/bin/avr-gcc
 OBJCOPY = $(AVR_PATH)/bin/avr-objcopy
 OBJDUMP = $(AVR_PATH)/bin/avr-objdump
 
 # Program the device.  
 program: $(TARGET).hex $(TARGET).eep
-	$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
+	ifeq ($(UNAME), Linux)
+		~/opt/teensy_loader_cli/teensy_loader_cli -mmcu=$(MCU) -w $(TARGET).hex
+	else
+		$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
+	endif
+
 
 
 # Generate avr-gdb config/init file which does the following:
+#include "chips.h"
+#include "bits.h"
+
+const prom_t proms[] = {
+{
+	// Default is to leave everything in tristate mode
+	.name		= "NONE",
+	.pins		= 28,
+
+	.addr_width	= 0,
+	.addr_pins	= {
+	},
+
+	.data_width	= 0,
+	.data_pins	= {
+	},
+
+	.hi_pins	= { },
+	.lo_pins	= { },
+},
+{
+	.name		= "M27C512",
+	.pins		= 28,
+
+	.addr_width	= 16,
+	.addr_pins	= {
+		10, 9, 8, 7, 6, 5, 4, 3, 25, 24, 21, 23, 2, 26, 27, 1,
+	},
+
+	.data_width	= 8,
+	.data_pins	= {
+		11, 12, 13, 15, 16, 17, 18, 19,
+	},
+
+	.hi_pins	= { 28, },
+	.lo_pins	= { 22, 20, 14, },
+},
+{
+	.name		= "M27C256",
+	.pins		= 28,
+	.addr_width	= 15,
+	.addr_pins	= {
+		10, 9, 8, 7, 6, 5, 4, 3, 25, 24, 21, 23, 2, 26, 27,
+	},
+
+	.data_width	= 8,
+	.data_pins	= {
+		11, 12, 13, 15, 16, 17, 18, 19,
+	},
+	.hi_pins	= { 28, 1 },
+	.lo_pins	= { 22, 20, 14, },
+},
+{
+	.name		= "M27C128",
+	.pins		= 28,
+	.addr_width	= 14,
+	.addr_pins	= {
+		10, 9, 8, 7, 6, 5, 4, 3, 25, 24, 21, 23, 2, 26,
+	},
+
+	.data_width	= 8,
+	.data_pins	= {
+		11, 12, 13, 15, 16, 17, 18, 19,
+	},
+	.hi_pins	= { 28, 1, 27, },
+	.lo_pins	= { 22, 20, 14, },
+},
+{
+	.name		= "LH-535618",
+    .options 	= OPTIONS_PULLUPS | OPTIONS_LATCH,
+	.pins		= 28,
+	.addr_width	= 15,
+	.addr_pins	= {
+    10, 9, 8, 7, 6, 5, 4, 3, 26, 25, 2, 20, 24, 22, 28,
+	},
+
+	.data_width	= 8,
+	.data_pins	= {
+		11, 12, 13, 15, 16, 17, 18, 19,
+	},
+	.hi_pins	= { 1, },
+	.lo_pins	= { 
+    [LATCH_PIN] = 23,
+    21, 27, 14, },
+},
+{
+	.name		= "M27C64",
+	.pins		= 28,
+	.addr_width	= 13,
+	.addr_pins	= {
+		10, 9, 8, 7, 6, 5, 4, 3, 25, 24, 21, 23, 2,
+	},
+
+	.data_width	= 8,
+	.data_pins	= {
+		11, 12, 13, 15, 16, 17, 18, 19,
+	},
+	.hi_pins	= { 28, 1, 27 },
+	.lo_pins	= { 22, 20, 14, },
+},
+{
+	.name		= "87C64",
+	.options 	= OPTIONS_PULLUPS | OPTIONS_LATCH,
+	.pins		= 28,
+	.addr_width	= 13,
+	.addr_pins	= {
+		10, 9, 8, 7, 6, 5, 4, 3, 25, 24, 21, 23, 2,
+	},
+
+	.data_width	= 8,
+	.data_pins	= {
+		11, 12, 13, 15, 16, 17, 18, 19,
+	},
+	.hi_pins	= { 28, 1, 27 },
+	.lo_pins	= { 
+		[LATCH_PIN] = 20,
+		22, 14, 
+	},
+},
+{
+	.name		= "C64-2732",
+	.pins		= 24,
+	.addr_width	= 12,
+	.addr_pins	= {
+		8, 7, 6, 5, 4, 3, 2, 1, 23, 22, 19, 18,
+	},
+
+	.data_width	= 8,
+	.data_pins	= {
+		9, 10, 11, 13, 14, 15, 16, 17,
+	},
+	.hi_pins	= { 24, 21 },
+	.lo_pins	= { 12, 20, },
+},
+{
+	/** 512x8 PROM -- UNTESTED */	
+	.name		= "TBP28S42",
+	.pins		= 20,
+	.addr_width	= 9,
+	.addr_pins	= {
+		1, 2, 3, 4, 5, 16, 17, 18, 19,
+	},
+	.data_width	= 8,
+	.data_pins	= {
+		6, 7, 8, 9, 11, 12, 13, 14,
+	},
+	.hi_pins	= { 20 },
+	.lo_pins	= { 10, 15 },
+},
+
+{
+	/** 8192x8 UV EEPROM, found in DX synth */
+	.name		= "MBM2764-30",
+	.pins		= 28,
+	.addr_width	= 13,
+	.addr_pins	= {
+		10, 9, 8, 7, 6, 5, 4, 3, 25, 24, 21, 23, 2,
+	},
+
+	.data_width	= 8,
+	.data_pins	= {
+		11, 12, 13, 15, 16, 17, 18, 19,
+	},
+	.hi_pins	= {
+		//28, // vdd, disabled since external power must be used
+		27, // pgm
+		1,  // vpp
+	},
+	.lo_pins	= { 22, 20, 14, }, // !oe, !cs, gnd
+},
+{
+	// C64 kernel and basic ROMs
+	.name		= "27C210",
+	.pins		= 40,
+	.addr_width	= 16,
+	.addr_pins	= {
+    21, 22, 23, 24, 25, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 37,
+	},
+	.data_width	= 16,
+	.data_pins	= {
+    19, 18, 17, 16, 15, 14, 13, 12, 10,  9,  8,  7,  6,  5,  4,  3,
+	},
+	.hi_pins	= {
+    40, // VCC
+    1,  // VPP
+    39, // PGM'
+	},
+	.lo_pins	= {
+    2, // E'
+    11, 30, // GND
+    20, // G'
+	},
+},
+{
+	/** Apple Mac SE PROM chips
+	 * Similar to a M27C512, but with the 17th address line
+	 * on 22 instead of Vpp, allowing 128 KB of data.
+	 */
+	.name		= "APPLE PROM",
+	.pins		= 28,
+	.addr_width	= 17,
+	.addr_pins	= {
+		10, 9, 8, 7, 6, 5, 4, 3, 25, 24, 21, 23, 2, 26, 27, 1, 22
+	},
+
+	.data_width	= 8,
+	.data_pins	= {
+		11, 12, 13, 15, 16, 17, 18, 19,
+	},
+	.hi_pins	= { 28, },
+	.lo_pins	= { 20, 14, },
+},
+{
+	.name		= "28F512 (untstd)",
+	.pins		= 32,
+	.addr_width	= 16,
+	.addr_pins	= {
+		12, 11, 10, 9, 8, 7, 6, 5, 27, 26, 23, 25, 4, 28, 29, 15
+	},
+	.data_width	= 8,
+	.data_pins	= {
+		13, 14, 15, 17, 18, 19, 20, 21,
+	},
+	.hi_pins	= {
+		32, // vcc
+		31, // !we
+		1, // Vpp
+	},
+	.lo_pins	= {
+		16, // gnd
+		24, // !oe
+		22, // !ce
+	},
+},
+{
+	// C64 kernel and basic ROMs
+	.name		= "2364A",
+	.pins		= 24,
+	.addr_width	= 13,
+	.addr_pins	= {
+		8, 7, 6, 5, 4, 3, 2, 1, 23, 22, 19, 18, 21,
+	},
+	.data_width	= 8,
+	.data_pins	= {
+		9, 10, 11, 13, 14, 15, 16, 17,
+	},
+	.hi_pins	= {
+		24,
+	},
+	.lo_pins	= {
+		12, // gnd
+		20, // !cs
+	},
+},
+{
+	/** 2716 mask ROM used in video games.
+	 * \note: Not tested yet.
+	 */
+	.name		= "2716 (untested)",
+	.pins		= 24,
+	.addr_width	= 11,
+	.addr_pins	= {
+		8, 7, 6, 5, 4, 3, 2, 1, 23, 22, 19,
+	},
+
+	.data_width	= 8,
+	.data_pins	= {
+		9, 10, 11, 13, 14, 15, 16, 17
+	},
+
+	.hi_pins	= { 24, 21, },
+	.lo_pins	= { 12, 20, 18 },
+},
+{
+	/** 9316 mask ROM used in video games.
+	 * \note: Not tested yet.
+	 */
+	.name		= "9316 (untested)",
+	.pins		= 24,
+	.addr_width	= 11,
+	.addr_pins	= {
+		8, 7, 6, 5, 4, 3, 2, 1, 23, 22, 19,
+	},
+
+	.data_width	= 8,
+	.data_pins	= {
+		9, 10, 11, 13, 14, 15, 16, 17
+	},
+
+	.hi_pins	= { 24, 18, },
+	.lo_pins	= { 12, 21, 20 },
+},
+{
+	.name		= "HN462732",
+	.pins		= 24,
+	.addr_width	= 12,
+	.addr_pins	= {
+		8, 7, 6, 5, 4, 3, 2, 1, 23, 22, 19, 21,
+	},
+	.data_width	= 8,
+	.data_pins	= {
+		9, 10, 11, 13, 14, 15, 16, 17,
+	},
+	.hi_pins	= {
+		24, // vcc
+	},
+	.lo_pins	= {
+		12, // gnd
+		20, // !oe
+		18, // !ce
+	},
+},
+{
+	/** atmega8.
+	 * Not an EEPROM, but a chip to read via ISP.
+	 * data_width / addr_width == 0 to indicate that this is not eeprom
+	 */
+	.name		= "ATMega8",
+	.pins		= 28,
+	.addr_width	= 13,
+	.addr_pins	= {
+		[ISP_MOSI] = 17, // from the reader to the chip
+		[ISP_SCK] = 19, // SCK,
+		[ISP_RESET] = 1, // reset
+		[ISP_XTAL] = 9, // xtal
+	},
+	.data_pins	= {
+		[ISP_MISO] = 18, // from the chip back to the reader
+	},
+	.lo_pins	= {
+		8, // gnd
+		22, // gnd
+	},
+	.hi_pins	= {
+		7, // vcc
+		20, // avcc
+	},
+},
+};
+
+const uint16_t proms_count = array_count(proms);
+#ifndef CHIPS_H
+#define CHIPS_H
+
+#include <stdint.h>
+
+// Turn on pullups on input pins
+#define OPTIONS_PULLUPS 0x01
+// Needs a latch pulse
+#define OPTIONS_LATCH   0x02
+
+// Output pin for OPTIONS_LATCH
+#define LATCH_PIN 0
+
+// For AVR chips
+#define ISP_MOSI 0
+#define ISP_MISO 0
+#define ISP_SCK 1
+#define ISP_RESET 2
+#define ISP_XTAL 3
+
+typedef struct
+{
+	/** Name of the chip type */
+	char name[16];
+
+	/** Options for chip, including pullup */
+	uint8_t options;
+
+	/** Total number of pins on the chip */
+	uint8_t pins;
+
+	/** Total number of address pins.
+	 * The download will retrieve 2^addr_width bytes.
+ 	 */
+	uint8_t addr_width;
+
+	/** Total number of data pins.
+	 * If data_pins == 0, the chip is assumed to be in AVR ISP mode.
+	 */
+	uint8_t data_width;
+
+	/** Address pins.
+	 * An array of up to 24 pins in package numbering.
+	 * Any that are 0 will be ignored.  Other than ISP mode chips,
+	 * there should be addr_width pins defined here.
+	 * These will be configured as outputs from the reader
+	 * and initially driven low.
+	 */
+	uint8_t addr_pins[24];
+
+	/** Data pins.
+	 * An array of up to 24 pins in package numbering.
+	 * Any that are 0 will be ignored.  Other than ISP mode chips,
+	 * there should be data_width pins defined here.
+	 * These will be configured as inputs from the reader,
+	 * with no pull ups.
+	 */
+	uint8_t data_pins[24];
+
+	/** Pins to be driven high at all times.
+	 * These will be configured as outputs and drive hi.
+	 * Typical power limits are sourcing 50 mA per pin.
+	 */
+	uint8_t hi_pins[8];
+
+	/** Pins to be driven low at all times.
+	 * These will be configured as outputs and driven low.
+	 * Typical power limits are sinking 50 mA per pin.
+	 */
+	uint8_t lo_pins[8];
+} prom_t;
+
+extern const prom_t proms[];
+extern const uint16_t proms_count;
+
+#endif // CHIPS_H
+   1               		.file	"chips.c"
+   2               	__SP_H__ = 0x3e
+   3               	__SP_L__ = 0x3d
+   4               	__SREG__ = 0x3f
+   5               	__RAMPZ__ = 0x3b
+   6               	__tmp_reg__ = 0
+   7               	__zero_reg__ = 1
+   8               		.text
+   9               	.Ltext0:
+  10               	.global	proms_count
+  11               		.section	.rodata
+  14               	proms_count:
+  15 0000 1200      		.word	18
+  16               	.global	proms
+  19               	proms:
+  20 0002 4E4F 4E45 		.string	"NONE"
+  20      00
+  21 0007 0000 0000 		.zero	11
+  21      0000 0000 
+  21      0000 00
+  22 0012 00        		.zero	1
+  23 0013 1C        		.byte	28
+  24 0014 00        		.byte	0
+  25 0015 00        		.byte	0
+  26 0016 0000 0000 		.zero	24
+  26      0000 0000 
+  26      0000 0000 
+  26      0000 0000 
+  26      0000 0000 
+  27 002e 0000 0000 		.zero	24
+  27      0000 0000 
+  27      0000 0000 
+  27      0000 0000 
+  27      0000 0000 
+  28 0046 0000 0000 		.zero	8
+  28      0000 0000 
+  29 004e 0000 0000 		.zero	8
+  29      0000 0000 
+  30 0056 4D32 3743 		.string	"M27C512"
+  30      3531 3200 
+  31 005e 0000 0000 		.zero	8
+  31      0000 0000 
+  32 0066 00        		.zero	1
+  33 0067 1C        		.byte	28
+  34 0068 10        		.byte	16
+  35 0069 08        		.byte	8
+  36 006a 0A        		.byte	10
+  37 006b 09        		.byte	9
+  38 006c 08        		.byte	8
+  39 006d 07        		.byte	7
+  40 006e 06        		.byte	6
+  41 006f 05        		.byte	5
+  42 0070 04        		.byte	4
+  43 0071 03        		.byte	3
+  44 0072 19        		.byte	25
+  45 0073 18        		.byte	24
+  46 0074 15        		.byte	21
+  47 0075 17        		.byte	23
+  48 0076 02        		.byte	2
+  49 0077 1A        		.byte	26
+  50 0078 1B        		.byte	27
+  51 0079 01        		.byte	1
+  52 007a 0000 0000 		.zero	8
+  52      0000 0000 
+  53 0082 0B        		.byte	11
+  54 0083 0C        		.byte	12
+  55 0084 0D        		.byte	13
+  56 0085 0F        		.byte	15
+  57 0086 10        		.byte	16
+  58 0087 11        		.byte	17
+  59 0088 12        		.byte	18
+  60 0089 13        		.byte	19
+  61 008a 0000 0000 		.zero	16
+  61      0000 0000 
+  61      0000 0000 
+  61      0000 0000 
+  62 009a 1C        		.byte	28
+  63 009b 0000 0000 		.zero	7
+  63      0000 00
+  64 00a2 16        		.byte	22
+  65 00a3 14        		.byte	20
+  66 00a4 0E        		.byte	14
+  67 00a5 0000 0000 		.zero	5
+  67      00
+  68 00aa 4D32 3743 		.string	"M27C256"
+  68      3235 3600 
+  69 00b2 0000 0000 		.zero	8
+  69      0000 0000 
+  70 00ba 00        		.zero	1
+  71 00bb 1C        		.byte	28
+  72 00bc 0F        		.byte	15
+  73 00bd 08        		.byte	8
+  74 00be 0A        		.byte	10
+  75 00bf 09        		.byte	9
+  76 00c0 08        		.byte	8
+  77 00c1 07        		.byte	7
+  78 00c2 06        		.byte	6
+  79 00c3 05        		.byte	5
+  80 00c4 04        		.byte	4
+  81 00c5 03        		.byte	3
+  82 00c6 19        		.byte	25
+  83 00c7 18        		.byte	24
+  84 00c8 15        		.byte	21
+  85 00c9 17        		.byte	23
+  86 00ca 02        		.byte	2
+  87 00cb 1A        		.byte	26
+  88 00cc 1B        		.byte	27
+  89 00cd 0000 0000 		.zero	9
+  89      0000 0000 
+  89      00
+  90 00d6 0B        		.byte	11
+  91 00d7 0C        		.byte	12
+  92 00d8 0D        		.byte	13
+  93 00d9 0F        		.byte	15
+  94 00da 10        		.byte	16
+  95 00db 11        		.byte	17
+  96 00dc 12        		.byte	18
+  97 00dd 13        		.byte	19
+  98 00de 0000 0000 		.zero	16
+  98      0000 0000 
+  98      0000 0000 
+  98      0000 0000 
+  99 00ee 1C        		.byte	28
+ 100 00ef 01        		.byte	1
+ 101 00f0 0000 0000 		.zero	6
+ 101      0000 
+ 102 00f6 16        		.byte	22
+ 103 00f7 14        		.byte	20
+ 104 00f8 0E        		.byte	14
+ 105 00f9 0000 0000 		.zero	5
+ 105      00
+ 106 00fe 4D32 3743 		.string	"M27C128"
+ 106      3132 3800 
+ 107 0106 0000 0000 		.zero	8
+ 107      0000 0000 
+ 108 010e 00        		.zero	1
+ 109 010f 1C        		.byte	28
+ 110 0110 0E        		.byte	14
+ 111 0111 08        		.byte	8
+ 112 0112 0A        		.byte	10
+ 113 0113 09        		.byte	9
+ 114 0114 08        		.byte	8
+ 115 0115 07        		.byte	7
+ 116 0116 06        		.byte	6
+ 117 0117 05        		.byte	5
+ 118 0118 04        		.byte	4
+ 119 0119 03        		.byte	3
+ 120 011a 19        		.byte	25
+ 121 011b 18        		.byte	24
+ 122 011c 15        		.byte	21
+ 123 011d 17        		.byte	23
+ 124 011e 02        		.byte	2
+ 125 011f 1A        		.byte	26
+ 126 0120 0000 0000 		.zero	10
+ 126      0000 0000 
+ 126      0000 
+ 127 012a 0B        		.byte	11
+ 128 012b 0C        		.byte	12
+ 129 012c 0D        		.byte	13
+ 130 012d 0F        		.byte	15
+ 131 012e 10        		.byte	16
+ 132 012f 11        		.byte	17
+ 133 0130 12        		.byte	18
+ 134 0131 13        		.byte	19
+ 135 0132 0000 0000 		.zero	16
+ 135      0000 0000 
+ 135      0000 0000 
+ 135      0000 0000 
+ 136 0142 1C        		.byte	28
+ 137 0143 01        		.byte	1
+ 138 0144 1B        		.byte	27
+ 139 0145 0000 0000 		.zero	5
+ 139      00
+ 140 014a 16        		.byte	22
+ 141 014b 14        		.byte	20
+ 142 014c 0E        		.byte	14
+ 143 014d 0000 0000 		.zero	5
+ 143      00
+ 144 0152 4C48 2D35 		.string	"LH-535618"
+ 144      3335 3631 
+ 144      3800 
+ 145 015c 0000 0000 		.zero	6
+ 145      0000 
+ 146 0162 03        		.byte	3
+ 147 0163 1C        		.byte	28
+ 148 0164 0F        		.byte	15
+ 149 0165 08        		.byte	8
+ 150 0166 0A        		.byte	10
+ 151 0167 09        		.byte	9
+ 152 0168 08        		.byte	8
+ 153 0169 07        		.byte	7
+ 154 016a 06        		.byte	6
+ 155 016b 05        		.byte	5
+ 156 016c 04        		.byte	4
+ 157 016d 03        		.byte	3
+ 158 016e 1A        		.byte	26
+ 159 016f 19        		.byte	25
+ 160 0170 02        		.byte	2
+ 161 0171 14        		.byte	20
+ 162 0172 18        		.byte	24
+ 163 0173 16        		.byte	22
+ 164 0174 1C        		.byte	28
+ 165 0175 0000 0000 		.zero	9
+ 165      0000 0000 
+ 165      00
+ 166 017e 0B        		.byte	11
+ 167 017f 0C        		.byte	12
+ 168 0180 0D        		.byte	13
+ 169 0181 0F        		.byte	15
+ 170 0182 10        		.byte	16
+ 171 0183 11        		.byte	17
+ 172 0184 12        		.byte	18
+ 173 0185 13        		.byte	19
+ 174 0186 0000 0000 		.zero	16
+ 174      0000 0000 
+ 174      0000 0000 
+ 174      0000 0000 
+ 175 0196 01        		.byte	1
+ 176 0197 0000 0000 		.zero	7
+ 176      0000 00
+ 177 019e 17        		.byte	23
+ 178 019f 15        		.byte	21
+ 179 01a0 1B        		.byte	27
+ 180 01a1 0E        		.byte	14
+ 181 01a2 0000 0000 		.zero	4
+ 182 01a6 4D32 3743 		.string	"M27C64"
+ 182      3634 00
+ 183 01ad 0000 0000 		.zero	9
+ 183      0000 0000 
+ 183      00
+ 184 01b6 00        		.zero	1
+ 185 01b7 1C        		.byte	28
+ 186 01b8 0D        		.byte	13
+ 187 01b9 08        		.byte	8
+ 188 01ba 0A        		.byte	10
+ 189 01bb 09        		.byte	9
+ 190 01bc 08        		.byte	8
+ 191 01bd 07        		.byte	7
+ 192 01be 06        		.byte	6
+ 193 01bf 05        		.byte	5
+ 194 01c0 04        		.byte	4
+ 195 01c1 03        		.byte	3
+ 196 01c2 19        		.byte	25
+ 197 01c3 18        		.byte	24
+ 198 01c4 15        		.byte	21
+ 199 01c5 17        		.byte	23
+ 200 01c6 02        		.byte	2
+ 201 01c7 0000 0000 		.zero	11
+ 201      0000 0000 
+ 201      0000 00
+ 202 01d2 0B        		.byte	11
+ 203 01d3 0C        		.byte	12
+ 204 01d4 0D        		.byte	13
+ 205 01d5 0F        		.byte	15
+ 206 01d6 10        		.byte	16
+ 207 01d7 11        		.byte	17
+ 208 01d8 12        		.byte	18
+ 209 01d9 13        		.byte	19
+ 210 01da 0000 0000 		.zero	16
+ 210      0000 0000 
+ 210      0000 0000 
+ 210      0000 0000 
+ 211 01ea 1C        		.byte	28
+ 212 01eb 01        		.byte	1
+ 213 01ec 1B        		.byte	27
+ 214 01ed 0000 0000 		.zero	5
+ 214      00
+ 215 01f2 16        		.byte	22
+ 216 01f3 14        		.byte	20
+ 217 01f4 0E        		.byte	14
+ 218 01f5 0000 0000 		.zero	5
+ 218      00
+ 219 01fa 3837 4336 		.string	"87C64"
+ 219      3400 
+ 220 0200 0000 0000 		.zero	10
+ 220      0000 0000 
+ 220      0000 
+ 221 020a 03        		.byte	3
+ 222 020b 1C        		.byte	28
+ 223 020c 0D        		.byte	13
+ 224 020d 08        		.byte	8
+ 225 020e 0A        		.byte	10
+ 226 020f 09        		.byte	9
+ 227 0210 08        		.byte	8
+ 228 0211 07        		.byte	7
+ 229 0212 06        		.byte	6
+ 230 0213 05        		.byte	5
+ 231 0214 04        		.byte	4
+ 232 0215 03        		.byte	3
+ 233 0216 19        		.byte	25
+ 234 0217 18        		.byte	24
+ 235 0218 15        		.byte	21
+ 236 0219 17        		.byte	23
+ 237 021a 02        		.byte	2
+ 238 021b 0000 0000 		.zero	11
+ 238      0000 0000 
+ 238      0000 00
+ 239 0226 0B        		.byte	11
+ 240 0227 0C        		.byte	12
+ 241 0228 0D        		.byte	13
+ 242 0229 0F        		.byte	15
+ 243 022a 10        		.byte	16
+ 244 022b 11        		.byte	17
+ 245 022c 12        		.byte	18
+ 246 022d 13        		.byte	19
+ 247 022e 0000 0000 		.zero	16
+ 247      0000 0000 
+ 247      0000 0000 
+ 247      0000 0000 
+ 248 023e 1C        		.byte	28
+ 249 023f 01        		.byte	1
+ 250 0240 1B        		.byte	27
+ 251 0241 0000 0000 		.zero	5
+ 251      00
+ 252 0246 14        		.byte	20
+ 253 0247 16        		.byte	22
+ 254 0248 0E        		.byte	14
+ 255 0249 0000 0000 		.zero	5
+ 255      00
+ 256 024e 4336 342D 		.string	"C64-2732"
+ 256      3237 3332 
+ 256      00
+ 257 0257 0000 0000 		.zero	7
+ 257      0000 00
+ 258 025e 00        		.zero	1
+ 259 025f 18        		.byte	24
+ 260 0260 0C        		.byte	12
+ 261 0261 08        		.byte	8
+ 262 0262 08        		.byte	8
+ 263 0263 07        		.byte	7
+ 264 0264 06        		.byte	6
+ 265 0265 05        		.byte	5
+ 266 0266 04        		.byte	4
+ 267 0267 03        		.byte	3
+ 268 0268 02        		.byte	2
+ 269 0269 01        		.byte	1
+ 270 026a 17        		.byte	23
+ 271 026b 16        		.byte	22
+ 272 026c 13        		.byte	19
+ 273 026d 12        		.byte	18
+ 274 026e 0000 0000 		.zero	12
+ 274      0000 0000 
+ 274      0000 0000 
+ 275 027a 09        		.byte	9
+ 276 027b 0A        		.byte	10
+ 277 027c 0B        		.byte	11
+ 278 027d 0D        		.byte	13
+ 279 027e 0E        		.byte	14
+ 280 027f 0F        		.byte	15
+ 281 0280 10        		.byte	16
+ 282 0281 11        		.byte	17
+ 283 0282 0000 0000 		.zero	16
+ 283      0000 0000 
+ 283      0000 0000 
+ 283      0000 0000 
+ 284 0292 18        		.byte	24
+ 285 0293 15        		.byte	21
+ 286 0294 0000 0000 		.zero	6
+ 286      0000 
+ 287 029a 0C        		.byte	12
+ 288 029b 14        		.byte	20
+ 289 029c 0000 0000 		.zero	6
+ 289      0000 
+ 290 02a2 5442 5032 		.string	"TBP28S42"
+ 290      3853 3432 
+ 290      00
+ 291 02ab 0000 0000 		.zero	7
+ 291      0000 00
+ 292 02b2 00        		.zero	1
+ 293 02b3 14        		.byte	20
+ 294 02b4 09        		.byte	9
+ 295 02b5 08        		.byte	8
+ 296 02b6 01        		.byte	1
+ 297 02b7 02        		.byte	2
+ 298 02b8 03        		.byte	3
+ 299 02b9 04        		.byte	4
+ 300 02ba 05        		.byte	5
+ 301 02bb 10        		.byte	16
+ 302 02bc 11        		.byte	17
+ 303 02bd 12        		.byte	18
+ 304 02be 13        		.byte	19
+ 305 02bf 0000 0000 		.zero	15
+ 305      0000 0000 
+ 305      0000 0000 
+ 305      0000 00
+ 306 02ce 06        		.byte	6
+ 307 02cf 07        		.byte	7
+ 308 02d0 08        		.byte	8
+ 309 02d1 09        		.byte	9
+ 310 02d2 0B        		.byte	11
+ 311 02d3 0C        		.byte	12
+ 312 02d4 0D        		.byte	13
+ 313 02d5 0E        		.byte	14
+ 314 02d6 0000 0000 		.zero	16
+ 314      0000 0000 
+ 314      0000 0000 
+ 314      0000 0000 
+ 315 02e6 14        		.byte	20
+ 316 02e7 0000 0000 		.zero	7
+ 316      0000 00
+ 317 02ee 0A        		.byte	10
+ 318 02ef 0F        		.byte	15
+ 319 02f0 0000 0000 		.zero	6
+ 319      0000 
+ 320 02f6 4D42 4D32 		.string	"MBM2764-30"
+ 320      3736 342D 
+ 320      3330 00
+ 321 0301 0000 0000 		.zero	5
+ 321      00
+ 322 0306 00        		.zero	1
+ 323 0307 1C        		.byte	28
+ 324 0308 0D        		.byte	13
+ 325 0309 08        		.byte	8
+ 326 030a 0A        		.byte	10
+ 327 030b 09        		.byte	9
+ 328 030c 08        		.byte	8
+ 329 030d 07        		.byte	7
+ 330 030e 06        		.byte	6
+ 331 030f 05        		.byte	5
+ 332 0310 04        		.byte	4
+ 333 0311 03        		.byte	3
+ 334 0312 19        		.byte	25
+ 335 0313 18        		.byte	24
+ 336 0314 15        		.byte	21
+ 337 0315 17        		.byte	23
+ 338 0316 02        		.byte	2
+ 339 0317 0000 0000 		.zero	11
+ 339      0000 0000 
+ 339      0000 00
+ 340 0322 0B        		.byte	11
+ 341 0323 0C        		.byte	12
+ 342 0324 0D        		.byte	13
+ 343 0325 0F        		.byte	15
+ 344 0326 10        		.byte	16
+ 345 0327 11        		.byte	17
+ 346 0328 12        		.byte	18
+ 347 0329 13        		.byte	19
+ 348 032a 0000 0000 		.zero	16
+ 348      0000 0000 
+ 348      0000 0000 
+ 348      0000 0000 
+ 349 033a 1B        		.byte	27
+ 350 033b 01        		.byte	1
+ 351 033c 0000 0000 		.zero	6
+ 351      0000 
+ 352 0342 16        		.byte	22
+ 353 0343 14        		.byte	20
+ 354 0344 0E        		.byte	14
+ 355 0345 0000 0000 		.zero	5
+ 355      00
+ 356 034a 3237 4332 		.string	"27C210"
+ 356      3130 00
+ 357 0351 0000 0000 		.zero	9
+ 357      0000 0000 
+ 357      00
+ 358 035a 00        		.zero	1
+ 359 035b 28        		.byte	40
+ 360 035c 10        		.byte	16
+ 361 035d 10        		.byte	16
+ 362 035e 15        		.byte	21
+ 363 035f 16        		.byte	22
+ 364 0360 17        		.byte	23
+ 365 0361 18        		.byte	24
+ 366 0362 19        		.byte	25
+ 367 0363 1A        		.byte	26
+ 368 0364 1B        		.byte	27
+ 369 0365 1C        		.byte	28
+ 370 0366 1D        		.byte	29
+ 371 0367 1F        		.byte	31
+ 372 0368 20        		.byte	32
+ 373 0369 21        		.byte	33
+ 374 036a 22        		.byte	34
+ 375 036b 23        		.byte	35
+ 376 036c 24        		.byte	36
+ 377 036d 25        		.byte	37
+ 378 036e 0000 0000 		.zero	8
+ 378      0000 0000 
+ 379 0376 13        		.byte	19
+ 380 0377 12        		.byte	18
+ 381 0378 11        		.byte	17
+ 382 0379 10        		.byte	16
+ 383 037a 0F        		.byte	15
+ 384 037b 0E        		.byte	14
+ 385 037c 0D        		.byte	13
+ 386 037d 0C        		.byte	12
+ 387 037e 0A        		.byte	10
+ 388 037f 09        		.byte	9
+ 389 0380 08        		.byte	8
+ 390 0381 07        		.byte	7
+ 391 0382 06        		.byte	6
+ 392 0383 05        		.byte	5
+ 393 0384 04        		.byte	4
+ 394 0385 03        		.byte	3
+ 395 0386 0000 0000 		.zero	8
+ 395      0000 0000 
+ 396 038e 28        		.byte	40
+ 397 038f 01        		.byte	1
+ 398 0390 27        		.byte	39
+ 399 0391 0000 0000 		.zero	5
+ 399      00
+ 400 0396 02        		.byte	2
+ 401 0397 0B        		.byte	11
+ 402 0398 1E        		.byte	30
+ 403 0399 14        		.byte	20
+ 404 039a 0000 0000 		.zero	4
+ 405 039e 4150 504C 		.string	"APPLE PROM"
+ 405      4520 5052 
+ 405      4F4D 00
+ 406 03a9 0000 0000 		.zero	5
+ 406      00
+ 407 03ae 00        		.zero	1
+ 408 03af 1C        		.byte	28
+ 409 03b0 11        		.byte	17
+ 410 03b1 08        		.byte	8
+ 411 03b2 0A        		.byte	10
+ 412 03b3 09        		.byte	9
+ 413 03b4 08        		.byte	8
+ 414 03b5 07        		.byte	7
+ 415 03b6 06        		.byte	6
+ 416 03b7 05        		.byte	5
+ 417 03b8 04        		.byte	4
+ 418 03b9 03        		.byte	3
+ 419 03ba 19        		.byte	25
+ 420 03bb 18        		.byte	24
+ 421 03bc 15        		.byte	21
+ 422 03bd 17        		.byte	23
+ 423 03be 02        		.byte	2
+ 424 03bf 1A        		.byte	26
+ 425 03c0 1B        		.byte	27
+ 426 03c1 01        		.byte	1
+ 427 03c2 16        		.byte	22
+ 428 03c3 0000 0000 		.zero	7
+ 428      0000 00
+ 429 03ca 0B        		.byte	11
+ 430 03cb 0C        		.byte	12
+ 431 03cc 0D        		.byte	13
+ 432 03cd 0F        		.byte	15
+ 433 03ce 10        		.byte	16
+ 434 03cf 11        		.byte	17
+ 435 03d0 12        		.byte	18
+ 436 03d1 13        		.byte	19
+ 437 03d2 0000 0000 		.zero	16
+ 437      0000 0000 
+ 437      0000 0000 
+ 437      0000 0000 
+ 438 03e2 1C        		.byte	28
+ 439 03e3 0000 0000 		.zero	7
+ 439      0000 00
+ 440 03ea 14        		.byte	20
+ 441 03eb 0E        		.byte	14
+ 442 03ec 0000 0000 		.zero	6
+ 442      0000 
+ 443 03f2 3238 4635 		.string	"28F512 (untstd)"
+ 443      3132 2028 
+ 443      756E 7473 
+ 443      7464 2900 
+ 444 0402 00        		.zero	1
+ 445 0403 20        		.byte	32
+ 446 0404 10        		.byte	16
+ 447 0405 08        		.byte	8
+ 448 0406 0C        		.byte	12
+ 449 0407 0B        		.byte	11
+ 450 0408 0A        		.byte	10
+ 451 0409 09        		.byte	9
+ 452 040a 08        		.byte	8
+ 453 040b 07        		.byte	7
+ 454 040c 06        		.byte	6
+ 455 040d 05        		.byte	5
+ 456 040e 1B        		.byte	27
+ 457 040f 1A        		.byte	26
+ 458 0410 17        		.byte	23
+ 459 0411 19        		.byte	25
+ 460 0412 04        		.byte	4
+ 461 0413 1C        		.byte	28
+ 462 0414 1D        		.byte	29
+ 463 0415 0F        		.byte	15
+ 464 0416 0000 0000 		.zero	8
+ 464      0000 0000 
+ 465 041e 0D        		.byte	13
+ 466 041f 0E        		.byte	14
+ 467 0420 0F        		.byte	15
+ 468 0421 11        		.byte	17
+ 469 0422 12        		.byte	18
+ 470 0423 13        		.byte	19
+ 471 0424 14        		.byte	20
+ 472 0425 15        		.byte	21
+ 473 0426 0000 0000 		.zero	16
+ 473      0000 0000 
+ 473      0000 0000 
+ 473      0000 0000 
+ 474 0436 20        		.byte	32
+ 475 0437 1F        		.byte	31
+ 476 0438 01        		.byte	1
+ 477 0439 0000 0000 		.zero	5
+ 477      00
+ 478 043e 10        		.byte	16
+ 479 043f 18        		.byte	24
+ 480 0440 16        		.byte	22
+ 481 0441 0000 0000 		.zero	5
+ 481      00
+ 482 0446 3233 3634 		.string	"2364A"
+ 482      4100 
+ 483 044c 0000 0000 		.zero	10
+ 483      0000 0000 
+ 483      0000 
+ 484 0456 00        		.zero	1
+ 485 0457 18        		.byte	24
+ 486 0458 0D        		.byte	13
+ 487 0459 08        		.byte	8
+ 488 045a 08        		.byte	8
+ 489 045b 07        		.byte	7
+ 490 045c 06        		.byte	6
+ 491 045d 05        		.byte	5
+ 492 045e 04        		.byte	4
+ 493 045f 03        		.byte	3
+ 494 0460 02        		.byte	2
+ 495 0461 01        		.byte	1
+ 496 0462 17        		.byte	23
+ 497 0463 16        		.byte	22
+ 498 0464 13        		.byte	19
+ 499 0465 12        		.byte	18
+ 500 0466 15        		.byte	21
+ 501 0467 0000 0000 		.zero	11
+ 501      0000 0000 
+ 501      0000 00
+ 502 0472 09        		.byte	9
+ 503 0473 0A        		.byte	10
+ 504 0474 0B        		.byte	11
+ 505 0475 0D        		.byte	13
+ 506 0476 0E        		.byte	14
+ 507 0477 0F        		.byte	15
+ 508 0478 10        		.byte	16
+ 509 0479 11        		.byte	17
+ 510 047a 0000 0000 		.zero	16
+ 510      0000 0000 
+ 510      0000 0000 
+ 510      0000 0000 
+ 511 048a 18        		.byte	24
+ 512 048b 0000 0000 		.zero	7
+ 512      0000 00
+ 513 0492 0C        		.byte	12
+ 514 0493 14        		.byte	20
+ 515 0494 0000 0000 		.zero	6
+ 515      0000 
+ 516 049a 3237 3136 		.string	"2716 (untested)"
+ 516      2028 756E 
+ 516      7465 7374 
+ 516      6564 2900 
+ 517 04aa 00        		.zero	1
+ 518 04ab 18        		.byte	24
+ 519 04ac 0B        		.byte	11
+ 520 04ad 08        		.byte	8
+ 521 04ae 08        		.byte	8
+ 522 04af 07        		.byte	7
+ 523 04b0 06        		.byte	6
+ 524 04b1 05        		.byte	5
+ 525 04b2 04        		.byte	4
+ 526 04b3 03        		.byte	3
+ 527 04b4 02        		.byte	2
+ 528 04b5 01        		.byte	1
+ 529 04b6 17        		.byte	23
+ 530 04b7 16        		.byte	22
+ 531 04b8 13        		.byte	19
+ 532 04b9 0000 0000 		.zero	13
+ 532      0000 0000 
+ 532      0000 0000 
+ 532      00
+ 533 04c6 09        		.byte	9
+ 534 04c7 0A        		.byte	10
+ 535 04c8 0B        		.byte	11
+ 536 04c9 0D        		.byte	13
+ 537 04ca 0E        		.byte	14
+ 538 04cb 0F        		.byte	15
+ 539 04cc 10        		.byte	16
+ 540 04cd 11        		.byte	17
+ 541 04ce 0000 0000 		.zero	16
+ 541      0000 0000 
+ 541      0000 0000 
+ 541      0000 0000 
+ 542 04de 18        		.byte	24
+ 543 04df 15        		.byte	21
+ 544 04e0 0000 0000 		.zero	6
+ 544      0000 
+ 545 04e6 0C        		.byte	12
+ 546 04e7 14        		.byte	20
+ 547 04e8 12        		.byte	18
+ 548 04e9 0000 0000 		.zero	5
+ 548      00
+ 549 04ee 3933 3136 		.string	"9316 (untested)"
+ 549      2028 756E 
+ 549      7465 7374 
+ 549      6564 2900 
+ 550 04fe 00        		.zero	1
+ 551 04ff 18        		.byte	24
+ 552 0500 0B        		.byte	11
+ 553 0501 08        		.byte	8
+ 554 0502 08        		.byte	8
+ 555 0503 07        		.byte	7
+ 556 0504 06        		.byte	6
+ 557 0505 05        		.byte	5
+ 558 0506 04        		.byte	4
+ 559 0507 03        		.byte	3
+ 560 0508 02        		.byte	2
+ 561 0509 01        		.byte	1
+ 562 050a 17        		.byte	23
+ 563 050b 16        		.byte	22
+ 564 050c 13        		.byte	19
+ 565 050d 0000 0000 		.zero	13
+ 565      0000 0000 
+ 565      0000 0000 
+ 565      00
+ 566 051a 09        		.byte	9
+ 567 051b 0A        		.byte	10
+ 568 051c 0B        		.byte	11
+ 569 051d 0D        		.byte	13
+ 570 051e 0E        		.byte	14
+ 571 051f 0F        		.byte	15
+ 572 0520 10        		.byte	16
+ 573 0521 11        		.byte	17
+ 574 0522 0000 0000 		.zero	16
+ 574      0000 0000 
+ 574      0000 0000 
+ 574      0000 0000 
+ 575 0532 18        		.byte	24
+ 576 0533 12        		.byte	18
+ 577 0534 0000 0000 		.zero	6
+ 577      0000 
+ 578 053a 0C        		.byte	12
+ 579 053b 15        		.byte	21
+ 580 053c 14        		.byte	20
+ 581 053d 0000 0000 		.zero	5
+ 581      00
+ 582 0542 484E 3436 		.string	"HN462732"
+ 582      3237 3332 
+ 582      00
+ 583 054b 0000 0000 		.zero	7
+ 583      0000 00
+ 584 0552 00        		.zero	1
+ 585 0553 18        		.byte	24
+ 586 0554 0C        		.byte	12
+ 587 0555 08        		.byte	8
+ 588 0556 08        		.byte	8
+ 589 0557 07        		.byte	7
+ 590 0558 06        		.byte	6
+ 591 0559 05        		.byte	5
+ 592 055a 04        		.byte	4
+ 593 055b 03        		.byte	3
+ 594 055c 02        		.byte	2
+ 595 055d 01        		.byte	1
+ 596 055e 17        		.byte	23
+ 597 055f 16        		.byte	22
+ 598 0560 13        		.byte	19
+ 599 0561 15        		.byte	21
+ 600 0562 0000 0000 		.zero	12
+ 600      0000 0000 
+ 600      0000 0000 
+ 601 056e 09        		.byte	9
+ 602 056f 0A        		.byte	10
+ 603 0570 0B        		.byte	11
+ 604 0571 0D        		.byte	13
+ 605 0572 0E        		.byte	14
+ 606 0573 0F        		.byte	15
+ 607 0574 10        		.byte	16
+ 608 0575 11        		.byte	17
+ 609 0576 0000 0000 		.zero	16
+ 609      0000 0000 
+ 609      0000 0000 
+ 609      0000 0000 
+ 610 0586 18        		.byte	24
+ 611 0587 0000 0000 		.zero	7
+ 611      0000 00
+ 612 058e 0C        		.byte	12
+ 613 058f 14        		.byte	20
+ 614 0590 12        		.byte	18
+ 615 0591 0000 0000 		.zero	5
+ 615      00
+ 616 0596 4154 4D65 		.string	"ATMega8"
+ 616      6761 3800 
+ 617 059e 0000 0000 		.zero	8
+ 617      0000 0000 
+ 618 05a6 00        		.zero	1
+ 619 05a7 1C        		.byte	28
+ 620 05a8 0D        		.byte	13
+ 621 05a9 00        		.zero	1
+ 622 05aa 11        		.byte	17
+ 623 05ab 13        		.byte	19
+ 624 05ac 01        		.byte	1
+ 625 05ad 09        		.byte	9
+ 626 05ae 0000 0000 		.zero	20
+ 626      0000 0000 
+ 626      0000 0000 
+ 626      0000 0000 
+ 626      0000 0000 
+ 627 05c2 12        		.byte	18
+ 628 05c3 0000 0000 		.zero	23
+ 628      0000 0000 
+ 628      0000 0000 
+ 628      0000 0000 
+ 628      0000 0000 
+ 629 05da 07        		.byte	7
+ 630 05db 14        		.byte	20
+ 631 05dc 0000 0000 		.zero	6
+ 631      0000 
+ 632 05e2 08        		.byte	8
+ 633 05e3 16        		.byte	22
+ 634 05e4 0000 0000 		.zero	6
+ 634      0000 
+ 635               		.text
+ 636               	.Letext0:
+ 637               		.file 1 "/usr/lib/gcc/avr/4.7.0/../../../avr/include/stdint.h"
+ 638               		.file 2 "chips.h"
+ 639               		.file 3 "chips.c"
+DEFINED SYMBOLS
+                            *ABS*:0000000000000000 chips.c
+     /tmp/ccLMrB7y.s:2      *ABS*:000000000000003e __SP_H__
+     /tmp/ccLMrB7y.s:3      *ABS*:000000000000003d __SP_L__
+     /tmp/ccLMrB7y.s:4      *ABS*:000000000000003f __SREG__
+     /tmp/ccLMrB7y.s:5      *ABS*:000000000000003b __RAMPZ__
+     /tmp/ccLMrB7y.s:6      *ABS*:0000000000000000 __tmp_reg__
+     /tmp/ccLMrB7y.s:7      *ABS*:0000000000000001 __zero_reg__
+     /tmp/ccLMrB7y.s:14     .rodata:0000000000000000 proms_count
+     /tmp/ccLMrB7y.s:19     .rodata:0000000000000002 proms
+
+UNDEFINED SYMBOLS
+__do_copy_data

Binary file added.

 #include "usb_serial.h"
 #include "xmodem.h"
 #include "bits.h"
+#include "chips.h"
 
 void send_str(const char *s);
 uint8_t recv_str(char *buf, uint8_t size);
 	[40]	= 0xB7,
 };
 
-#define OPTIONS_PULLUPS 0x01
-#define OPTIONS_LATCH   0x02
-
-typedef struct
-{
-	/** Name of the chip type */
-	char name[16];
-
-	/** Options for chip, including pullup */
-	uint8_t options;
-
-	/** Total number of pins on the chip */
-	uint8_t pins;
-
-	/** Total number of address pins.
-	 * The download will retrieve 2^addr_width bytes.
- 	 */
-	uint8_t addr_width;
-
-	/** Total number of data pins.
-	 * If data_pins == 0, the chip is assumed to be in AVR ISP mode.
-	 */
-	uint8_t data_width;
-
-	/** Address pins.
-	 * An array of up to 24 pins in package numbering.
-	 * Any that are 0 will be ignored.  Other than ISP mode chips,
-	 * there should be addr_width pins defined here.
-	 * These will be configured as outputs from the reader
-	 * and initially driven low.
-	 */
-	uint8_t addr_pins[24];
-
-	/** Data pins.
-	 * An array of up to 24 pins in package numbering.
-	 * Any that are 0 will be ignored.  Other than ISP mode chips,
-	 * there should be data_width pins defined here.
-	 * These will be configured as inputs from the reader,
-	 * with no pull ups.
-	 */
-	uint8_t data_pins[24];
-
-	/** Pins to be driven high at all times.
-	 * These will be configured as outputs and drive hi.
-	 * Typical power limits are sourcing 50 mA per pin.
-	 */
-	uint8_t hi_pins[8];
-
-	/** Pins to be driven low at all times.
-	 * These will be configured as outputs and driven low.
-	 * Typical power limits are sinking 50 mA per pin.
-	 */
-	uint8_t lo_pins[8];
-} prom_t;
-
-#define LATCH_PIN 0
-
-static const prom_t proms[] = {
-{
-	// Default is to leave everything in tristate mode
-	.name		= "NONE",
-	.pins		= 28,
-
-	.addr_width	= 0,
-	.addr_pins	= {
-	},
-
-	.data_width	= 0,
-	.data_pins	= {
-	},
-
-	.hi_pins	= { },
-	.lo_pins	= { },
-},
-{
-	.name		= "M27C512",
-	.pins		= 28,
-
-	.addr_width	= 16,
-	.addr_pins	= {
-		10, 9, 8, 7, 6, 5, 4, 3, 25, 24, 21, 23, 2, 26, 27, 1,
-	},
-
-	.data_width	= 8,
-	.data_pins	= {
-		11, 12, 13, 15, 16, 17, 18, 19,
-	},
-
-	.hi_pins	= { 28, },
-	.lo_pins	= { 22, 20, 14, },
-},
-{
-	.name		= "M27C256",
-	.pins		= 28,
-	.addr_width	= 15,
-	.addr_pins	= {
-		10, 9, 8, 7, 6, 5, 4, 3, 25, 24, 21, 23, 2, 26, 27,
-	},
-
-	.data_width	= 8,
-	.data_pins	= {
-		11, 12, 13, 15, 16, 17, 18, 19,
-	},
-	.hi_pins	= { 28, 1 },
-	.lo_pins	= { 22, 20, 14, },
-},
-{
-	.name		= "M27C128",
-	.pins		= 28,
-	.addr_width	= 14,
-	.addr_pins	= {
-		10, 9, 8, 7, 6, 5, 4, 3, 25, 24, 21, 23, 2, 26,
-	},
-
-	.data_width	= 8,
-	.data_pins	= {
-		11, 12, 13, 15, 16, 17, 18, 19,
-	},
-	.hi_pins	= { 28, 1, 27, },
-	.lo_pins	= { 22, 20, 14, },
-},
-{
-	.name		= "LH-535618",
-    .options 	= OPTIONS_PULLUPS | OPTIONS_LATCH,
-	.pins		= 28,
-	.addr_width	= 15,
-	.addr_pins	= {
-    10, 9, 8, 7, 6, 5, 4, 3, 26, 25, 2, 20, 24, 22, 28,
-	},
-
-	.data_width	= 8,
-	.data_pins	= {
-		11, 12, 13, 15, 16, 17, 18, 19,
-	},
-	.hi_pins	= { 1, },
-	.lo_pins	= { 
-    [LATCH_PIN] = 23,
-    21, 27, 14, },
-},
-{
-	.name		= "M27C64",
-	.pins		= 28,
-	.addr_width	= 13,
-	.addr_pins	= {
-		10, 9, 8, 7, 6, 5, 4, 3, 25, 24, 21, 23, 2,
-	},
-
-	.data_width	= 8,
-	.data_pins	= {
-		11, 12, 13, 15, 16, 17, 18, 19,
-	},
-	.hi_pins	= { 28, 1, 27 },
-	.lo_pins	= { 22, 20, 14, },
-},
-{
-	.name		= "87C64",
-	.options 	= OPTIONS_PULLUPS | OPTIONS_LATCH,
-	.pins		= 28,
-	.addr_width	= 13,
-	.addr_pins	= {
-		10, 9, 8, 7, 6, 5, 4, 3, 25, 24, 21, 23, 2,
-	},
-
-	.data_width	= 8,
-	.data_pins	= {
-		11, 12, 13, 15, 16, 17, 18, 19,
-	},
-	.hi_pins	= { 28, 1, 27 },
-	.lo_pins	= { 
-		[LATCH_PIN] = 20,
-		22, 14, 
-	},
-},
-{
-	.name		= "C64-2732",
-	.pins		= 24,
-	.addr_width	= 12,
-	.addr_pins	= {
-		8, 7, 6, 5, 4, 3, 2, 1, 23, 22, 19, 18,
-	},
-
-	.data_width	= 8,
-	.data_pins	= {
-		9, 10, 11, 13, 14, 15, 16, 17,
-	},
-	.hi_pins	= { 24, 21 },
-	.lo_pins	= { 12, 20, },
-},
-{
-	/** 512x8 PROM -- UNTESTED */	
-	.name		= "TBP28S42",
-	.pins		= 20,
-	.addr_width	= 9,
-	.addr_pins	= {
-		1, 2, 3, 4, 5, 16, 17, 18, 19,
-	},
-	.data_width	= 8,
-	.data_pins	= {
-		6, 7, 8, 9, 11, 12, 13, 14,
-	},
-	.hi_pins	= { 20 },
-	.lo_pins	= { 10, 15 },
-},
-
-{
-	/** 8192x8 UV EEPROM, found in DX synth */
-	.name		= "MBM2764-30",
-	.pins		= 28,
-	.addr_width	= 13,
-	.addr_pins	= {
-		10, 9, 8, 7, 6, 5, 4, 3, 25, 24, 21, 23, 2,
-	},
-
-	.data_width	= 8,
-	.data_pins	= {
-		11, 12, 13, 15, 16, 17, 18, 19,
-	},
-	.hi_pins	= {
-		//28, // vdd, disabled since external power must be used
-		27, // pgm
-		1,  // vpp
-	},
-	.lo_pins	= { 22, 20, 14, }, // !oe, !cs, gnd
-},
-{
-	// C64 kernel and basic ROMs
-	.name		= "27C210",
-	.pins		= 40,
-	.addr_width	= 16,
-	.addr_pins	= {
-    21, 22, 23, 24, 25, 26, 27, 28, 29, 31, 32, 33, 34, 35, 36, 37,
-	},
-	.data_width	= 16,
-	.data_pins	= {
-    19, 18, 17, 16, 15, 14, 13, 12, 10,  9,  8,  7,  6,  5,  4,  3,
-	},
-	.hi_pins	= {
-    40, // VCC
-    1,  // VPP
-    39, // PGM'
-	},
-	.lo_pins	= {
-    2, // E'
-    11, 30, // GND
-    20, // G'
-	},
-},
-{
-	/** Apple Mac SE PROM chips
-	 * Similar to a M27C512, but with the 17th address line
-	 * on 22 instead of Vpp, allowing 128 KB of data.
-	 */
-	.name		= "APPLE PROM",
-	.pins		= 28,
-	.addr_width	= 17,
-	.addr_pins	= {
-		10, 9, 8, 7, 6, 5, 4, 3, 25, 24, 21, 23, 2, 26, 27, 1, 22
-	},
-
-	.data_width	= 8,
-	.data_pins	= {
-		11, 12, 13, 15, 16, 17, 18, 19,
-	},
-	.hi_pins	= { 28, },
-	.lo_pins	= { 20, 14, },
-},
-{
-	.name		= "28F512 (untstd)",
-	.pins		= 32,
-	.addr_width	= 16,
-	.addr_pins	= {
-		12, 11, 10, 9, 8, 7, 6, 5, 27, 26, 23, 25, 4, 28, 29, 15
-	},
-	.data_width	= 8,
-	.data_pins	= {
-		13, 14, 15, 17, 18, 19, 20, 21,
-	},
-	.hi_pins	= {
-		32, // vcc
-		31, // !we
-		1, // Vpp
-	},
-	.lo_pins	= {
-		16, // gnd
-		24, // !oe
-		22, // !ce
-	},
-},
-{
-	// C64 kernel and basic ROMs
-	.name		= "2364A",
-	.pins		= 24,
-	.addr_width	= 13,
-	.addr_pins	= {
-		8, 7, 6, 5, 4, 3, 2, 1, 23, 22, 19, 18, 21,
-	},
-	.data_width	= 8,
-	.data_pins	= {
-		9, 10, 11, 13, 14, 15, 16, 17,
-	},
-	.hi_pins	= {
-		24,
-	},
-	.lo_pins	= {
-		12, // gnd
-		20, // !cs
-	},
-},
-{
-	/** 2716 mask ROM used in video games.
-	 * \note: Not tested yet.
-	 */
-	.name		= "2716 (untested)",
-	.pins		= 24,
-	.addr_width	= 11,
-	.addr_pins	= {
-		8, 7, 6, 5, 4, 3, 2, 1, 23, 22, 19,
-	},
-
-	.data_width	= 8,
-	.data_pins	= {
-		9, 10, 11, 13, 14, 15, 16, 17
-	},
-
-	.hi_pins	= { 24, 21, },
-	.lo_pins	= { 12, 20, 18 },
-},
-{
-	/** 9316 mask ROM used in video games.
-	 * \note: Not tested yet.
-	 */
-	.name		= "9316 (untested)",
-	.pins		= 24,
-	.addr_width	= 11,
-	.addr_pins	= {
-		8, 7, 6, 5, 4, 3, 2, 1, 23, 22, 19,
-	},
-
-	.data_width	= 8,
-	.data_pins	= {
-		9, 10, 11, 13, 14, 15, 16, 17
-	},
-
-	.hi_pins	= { 24, 18, },
-	.lo_pins	= { 12, 21, 20 },
-},
-{
-	.name		= "HN462732",
-	.pins		= 24,
-	.addr_width	= 12,
-	.addr_pins	= {
-		8, 7, 6, 5, 4, 3, 2, 1, 23, 22, 19, 21,
-	},
-	.data_width	= 8,
-	.data_pins	= {
-		9, 10, 11, 13, 14, 15, 16, 17,
-	},
-	.hi_pins	= {
-		24, // vcc
-	},
-	.lo_pins	= {
-		12, // gnd
-		20, // !oe
-		18, // !ce
-	},
-},
-{
-	/** atmega8.
-	 * Not an EEPROM, but a chip to read via ISP.
-	 * data_width / addr_width == 0 to indicate that this is not eeprom
-	 */
-#define ISP_MOSI 0
-#define ISP_MISO 0
-#define ISP_SCK 1
-#define ISP_RESET 2
-#define ISP_XTAL 3
-	.name		= "ATMega8",
-	.pins		= 28,
-	.addr_width	= 13,
-	.addr_pins	= {
-		[ISP_MOSI] = 17, // from the reader to the chip
-		[ISP_SCK] = 19, // SCK,
-		[ISP_RESET] = 1, // reset
-		[ISP_XTAL] = 9, // xtal
-	},
-	.data_pins	= {
-		[ISP_MISO] = 18, // from the chip back to the reader
-	},
-	.lo_pins	= {
-		8, // gnd
-		22, // gnd
-	},
-	.hi_pins	= {
-		7, // vcc
-		20, // avcc
-	},
-},
-};
-
 /** Select one of the chips */
 static const prom_t * prom = &proms[0];
 
 prom_list(void)
 {
 	send_str(PSTR("\r\n"));
-	for (int i = 0 ; i < array_count(proms) ; i++)
+	for (int i = 0 ; i < proms_count ; i++)
 	{
 		const prom_t * const p = &proms[i];
 		prom_list_send(i, p, p == prom );
 	}
 
 	uint8_t mode = c - '0';
-	if (mode >= array_count(proms))
+	if (mode >= proms_count)
 	{
 		send_str(PSTR("?\r\n"));
 		return;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.