Compare commits

...

13 Commits

Author SHA1 Message Date
Tom Nisbet c53a2ce20b update 2316 page 2024-04-12 17:43:33 -04:00
Tom Nisbet 885ddca83a update 2316 page 2024-04-12 17:41:57 -04:00
Tom Nisbet 3f0384959c update 2316 page 2024-04-12 17:39:20 -04:00
Tom Nisbet 4c3e9a5d13 update 2316 page 2024-04-12 17:36:11 -04:00
Tom Nisbet 90e29d2e50
Merge pull request #70 from jscrane/master
Use chip size for selected commands where it makes sense
2024-04-12 10:07:49 -04:00
steve e59459ff5b rename next -> dump_next 2024-04-12 14:32:19 +01:00
steve eb1a8cad78 Merge branch 'master' of github.com:jscrane/TommyPROM 2024-04-12 09:47:58 +01:00
steve 7b89696163 only Dump command remembers where to pick up again 2024-04-12 09:47:16 +01:00
Stephen Crane c11354cdad
Merge branch 'TomNisbet:master' into master 2024-04-11 09:28:35 +01:00
steve 75d611eca6 fix from pr comment 2024-04-10 21:20:14 +01:00
steve 6e58a7c298 fix gotchas with unspecified start 2024-04-10 20:02:02 +01:00
steve 1ea8f82c68 cleanups 2024-04-10 19:32:59 +01:00
steve b2a2b1d3bf more nuanced default command args 2024-04-10 19:30:59 +01:00
4 changed files with 111 additions and 40 deletions

View File

@ -29,6 +29,7 @@ class PromDevice
byte readData(uint32_t address) { return readByte(address); }
void resetDebugStats();
void printDebugStats();
uint32_t end() const { return mSize-1; }
virtual void begin() = 0;
virtual const char * getName() = 0;

View File

@ -19,7 +19,7 @@
#include "XModem.h"
static const char * MY_VERSION = "3.4";
static const char * MY_VERSION = "3.5";
// Global status
@ -95,6 +95,8 @@ XModem xmodem(prom, cmdStatus);
* CLI parse functions
*/
const char hex[] = "0123456789abcdef";
const uint32_t unspec = ~0;
inline uint32_t if_unspec(uint32_t val, uint32_t repl) { return val == unspec? repl: val; }
enum {
// CLI Commands
@ -220,7 +222,7 @@ byte hexDigit(char c)
* @param pointer to string with the hex value of the word (modified)
* @return unsigned int represented by the digits
************************************************************/
uint32_t getHex32(char *& pData, uint32_t defaultValue=0)
uint32_t getHex32(char *& pData, uint32_t defaultValue=unspec)
{
uint32_t u32 = 0;
@ -346,7 +348,7 @@ word checksumBlock(uint32_t start, uint32_t end)
/**
* Read data from the device and dump it in hex and ascii.
**/
void dumpBlock(uint32_t start, uint32_t end)
uint32_t dumpBlock(uint32_t start, uint32_t end)
{
char line[81];
// 01234567891 234567892 234567893 234567894 234567895 234567896 234567897 23456789
@ -393,7 +395,7 @@ void dumpBlock(uint32_t start, uint32_t end)
Serial.println(line);
if (checkForBreak())
{
return;
return addr;
}
memset(line, ' ', sizeof(line));
count = 0;
@ -404,6 +406,8 @@ void dumpBlock(uint32_t start, uint32_t end)
{
Serial.println();
}
return end+1;
}
@ -476,7 +480,7 @@ void pokeBytes(char * pCursor)
//first value returned is the starting address
start = getHex32(pCursor, 0);
while (((val = getHex32(pCursor, 0xffff)) != 0xffff) && (byteCtr < BLOCK_SIZE))
while (((val = getHex32(pCursor)) != unspec) && (byteCtr < BLOCK_SIZE))
{
data[byteCtr++] = byte(val);
}
@ -680,9 +684,6 @@ void setup()
**/
char line[120];
uint32_t start = 0;
uint32_t end = 0xff;
byte val = 0xff;
void loop()
{
@ -695,9 +696,10 @@ void loop()
Serial.println();
byte cmd = parseCommand(line[0]);
char * pCursor = line+1;
start = getHex32(pCursor, 0);
end = getHex32(pCursor, 0xff);
val = (byte) getHex32(pCursor, 0);
uint32_t start = getHex32(pCursor);
uint32_t end = getHex32(pCursor);
uint32_t val = getHex32(pCursor);
static uint32_t dump_next = 0;
if ((cmd != CMD_LAST_STATUS) && (cmd != CMD_INVALID))
{
@ -707,10 +709,12 @@ void loop()
switch (cmd)
{
case CMD_BLANK:
erasedBlockCheck(start, end);
erasedBlockCheck(if_unspec(start, 0), if_unspec(end, prom.end()));
break;
case CMD_CHECKSUM:
start = if_unspec(start, 0);
end = if_unspec(end, prom.end());
w = checksumBlock(start, end);
Serial.print(F("Checksum "));
printWord(start);
@ -722,16 +726,31 @@ void loop()
break;
case CMD_DUMP:
dumpBlock(start, end);
start = if_unspec(start, dump_next);
dump_next = dumpBlock(start, if_unspec(end, start + 0xff));
break;
case CMD_ERASE:
printRetStatus(prom.erase(start, end));
if (start == unspec || end == unspec)
{
Serial.println(F("Erase requires explicit start, end"));
}
else
{
printRetStatus(prom.erase(start, end));
}
break;
case CMD_FILL:
prom.resetDebugStats();
fillBlock(start, end, val);
if (start == unspec || end == unspec || val == unspec)
{
Serial.println(F("Fill requires explicit start, end and value"));
}
else
{
prom.resetDebugStats();
fillBlock(start, end, (byte)val);
}
break;
case CMD_LOCK:
@ -745,10 +764,12 @@ void loop()
break;
case CMD_READ:
if (xmodem.SendFile(start, uint32_t(end) - start + 1))
start = if_unspec(start, 0);
end = if_unspec(end, prom.end());
if (xmodem.SendFile(start, end - start + 1))
{
cmdStatus.info("Send complete.");
cmdStatus.setValueDec(0, "NumBytes", uint32_t(end) - start + 1);
cmdStatus.setValueDec(0, "NumBytes", end - start + 1);
}
break;
@ -759,6 +780,7 @@ void loop()
case CMD_WRITE:
prom.resetDebugStats();
start = if_unspec(start, 0);
numBytes = xmodem.ReceiveFile(start);
if (numBytes)
{
@ -777,16 +799,16 @@ void loop()
break;
case CMD_SCAN:
scanBlock(start, end);
scanBlock(if_unspec(start, 0), if_unspec(end, prom.end()));
break;
case CMD_TEST:
testAddr(start);
testAddr(if_unspec(start, 0));
break;
case CMD_ZAP:
prom.resetDebugStats();
zapTest(start);
zapTest(if_unspec(start, 0));
break;
#endif /* ENABLE_DEBUG_COMMANDS */

View File

@ -113,7 +113,7 @@ the programmer that is able to provide high voltage pulses.
## PromDevice23
The PromDevice23 driver is used to read Commodore 2316, 2332, and 2364 mask-programmed ROMs.
This were used in early computers like the Commodore PET, Atari, and others.
These were used in early computers like the Commodore PET, Atari, Apple II, and others.
Most ROM chips can be read using the standard 28C driver. The 23 series ROMs are unique because
the chip select polarity is configurable when the chip is initally programmed. This means that, for example,

View File

@ -1,26 +1,74 @@
---
title: PROM Types
title: 2316, 2332, and 2364 ROMs
permalink: /docs/2316-roms
exerpt: "2316, 2332, and 2364 Read Only Memory"
---
## 2316, 2332, and 2364 Mask-Programmable Read-only Memory
|Model |Type |CS3 |CS2 |CS1 |Notes|
|:--- |:--- |:---:|:---:|:---:|:--- |
|12345 |2316 | x | H | H | |
|12345 |2316 | x | H | H | |
| Commodore 64|||
|12345 |2332 | - | H | H | |
|*TRS-80 Model 1*||
|ROM A. |2364 |. |. | |
|ROM B. |2332 |
|Apple II|||
|*OSI*|||
||2316||
|*TRS-80 Model 1*||
|ROM A. |2364 |. |. | |
|ROM B. |2332 |
|Apple II|||
|*OSI*|||
The 2316 is a 2Kx8 mask-programmable ROM made by Commodore. Intel made a version called the 2316E. There were also 4K and 8K versions produced as the 2332 and 2364. These chips were used by a wide variety of computers in the late 1970s and early 1980s, including products from Commodore, Atari, Ohio Scientific, Radio Shack, and others.
## Compatibility with UV EPROMs
The 2316, 2332 and 2364 ROMs are somewhat unique because they have Chip Select signals that are configured when the data is mask-programmed. Manufacturers could order a 2316 configured with any of its three Chip Select signals as either active-high or active-low.
This causes a bit of confusion, because the datasheets state that the chips are compatible with standard EPROMs, but they should really state that the chips __can be__ compatible, depending on the configuration selected. For example, a 2316 is only compatible with a 2716 if the 2316 was manufactured with *CS1* and *CS2* configured active-low and *CS3* configured active-high. Otherwise, some signals will need to be inverted to swap out a 23 serial chip with a more standard EPROM.
Some systems will contain multiple 23xx chips with the Chip Selects configured the same and others will configure each chip differently. For example, some 8K Atari cartridges use two 2332 chips and will invert one of the Chip Selects so that either chip can be selected with a single address line to differentiate them. If the chips are removed from the cartridge, they would need different Chip Selecct wiring to read their data.
## Reading 23xx chips with TommyPROM
A TommyPROM programmer can be constructed with an Arduino to read 2316 ROM chips. The code will scan the ROM to determine the correct Chip Select settings, so no wiring changes or inverters are needed when switching chips of the same type.
To use TommyPROM with 2316 chips, perform the following steps:
* Connect the Arduino data bus lines (D2..D9) to the ROM data lines.
* Connect the shift register address lines to the ROM address lines.
* Connect Arduino A2 (WE) to the ROM's CS3 on pin 21.
* Connect Arduino A1 (CE) to the ROM's CS2 on pin 18.
* Connect Arduino A0 (OE) to the ROM's CS1 on pin 20.
* Compile the TommyPROM code with PROM_IS_23 enabled
When running the TommyPROM software, first use the Unlock command to scan the chip. This should detect the correct configuration of the chip select lines.
After the scan us complete, the Dump or Read command can be used to read the data.
The 2332 only has two chip selects, so pin 21 should instead be connected to the shift registers A11 and the Arduino Pin A2 left unconncted. For the 2364, pin 21 connects to A12 and pin 18 connects to A11.
## 23xx Chips and Configurations
|Model |Type |CS3 |CS2 |CS1 |Tested|Notes|
|:--- |:--- |:---:|:---:|:---:|:---:|:--- |
|**UK101**|||
|MONUK02 |2316 | x | H | H | Y |
|BASUK01 |2316 | x | H | H | Y |
|BASUK02 |2316 | x | H | H | Y |
|BASUK03 |2316 | x | H | H | Y |
|BASUK04 |2316 | x | H | H | Y |
|**Commodore 64**|||
|901225-01 |2332 | - | | | N | Character ROM
|901226-01 |2364 | - | - | | N | Basic
|901227-03 |2364 | - | - | | N | Kernel
|**Commodore VIC 20**|||
|901460-03 |2332 | - | L | L | N | Character ROM
|901486-01 |2364 | - | - | | N | Basic
|901486-06 |2364 | - | - | | N | Kernel
|**Commodore 1451**|||
|325302-01 |2364 | - | - | | N | DOS
|901229-05 |2364 | - | - | | N | Kernel
|**TRS-80 Model 1**|||
|ROM A |2364 | - | - | | N|
|ROM B |2332 | - | | | N|
|**Apple II**|||
|**Ohio Scientific SuperBoard**|||
||2316||
|**Atari 400 and 800**|||
## References
[Commodore 64](https://ist.uwaterloo.ca/~schepers/roms.html)
[VIC 20 Character ROM](https://forum.vcfed.org/index.php?threads/replacing-vic-20-rom-char-901460-03-with-2732-unespected-behavior.80746/)
[2532 vs 2732](https://pinside.com/pinball/forum/topic/are-2532-and-2732-eproms-interchangeable)
[2332 vs 2532](https://wereallgeeks.wordpress.com/2023/04/18/2532_2732_progadapter/)