Skip to content

Find bit isolated empty regions on OTP ROM images for reuse.

Notifications You must be signed in to change notification settings

ruenahcmohr/blockfinder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

blockfinder

Find bit isolated empty regions on OTP ROM images for reuse.

eyecandy


ABOUT:

This tool finds ranges of un-programmed memory space on PROMS so that areas of them can be re-used by locking address bits to constrain your storage range.

This tool finds the largest blocks first, and then finds successively smaller blocks down to 16 bytes (It could go further, but I dont see the point)

example output:

 This program finds empty blocks on ROM images. 
 Written by Rue Mohr 2024 

File image size is 15 bits

2 kbits :
 0b1111110........ / 8  [starts 0x7E00  (32256)]
1 kbits :
 0b11111110....... / 7  [starts 0x7F00  (32512)]
64 bytes :
 0b111110111...... / 6  [starts 0x7DC0  (32192)]
 0b111111110...... / 6  [starts 0x7F80  (32640)]
32 bytes :
 0b1111101101..... / 5  [starts 0x7DA0  (32160)]
16 bytes :
 0b11111011001.... / 4  [starts 0x7D90  (32144)]
 0b11111111100.... / 4  [starts 0x7FC0  (32704)]

Here, it shows there is a 2kbit empty space (8 address lines) at 0x7E00 which will to go 0x7EFF (256 bytes)

Additionally, there is a space of 1kbits at 0x7F00, which will end at 0x7F7F (128 bytes)

There are additionalally 2 blocks of 64 bytes at 0x7DC0 and 0x7F80... etc

I have included two example ROM images to play with. (sadly, the above is one of them)


COMPILING:

gcc main.c -o blockfind

yup, thats it.


USE:

The intended use is as follows:

  1. read the ROM your targeting to a file
  2. run this program
 ./blockfind sample256k.bin
  1. if there is not a block available with the space you need for your projet (were not all using this for 7 segment decoders, are we?) select another ROM and goto(1);
  2. use dd to write the image for your project over the blank area of the target ROM (this is why I gave you the start address in decimal)
 dd if=project16bytes.bin of=modifyme.bin bs=1 seek=32144 conv=notrunc
  1. write the modified image back to the ROM
  2. install ROM in your project with the high address lines tied high or low according to the binary hint in the finder. (thats why I gave you the start address in binary, and constrained the binary to the number of address bits in your ROM)
  3. play.

If you always use the smallest region your project requires, you could probably get a few projects out of a ROM!


TRIAL RUN EXAMPLE TIDBITS:

cp sample256k.bin modifyme.bin

./blockfind modifyme.bin


16 bytes :
 0b11111011001.... / 4  [starts 0x7D90  (32144)]


hd -v modifyme.bin |less

00007d70  20 20 20 20 20 20 20 20  20 20 20 10 00 01 00 05  |           .....|
00007d80  00 0a 0e ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00007d90  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00007da0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00007db0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

echo -n HELLOTHEREWORLD! > project16bytes.bin

dd if=project16bytes.bin of=modifyme.bin bs=1 seek=32144 conv=notrunc

hd -v modifyme.bin |less

00007d70  20 20 20 20 20 20 20 20  20 20 20 10 00 01 00 05  |           .....|
00007d80  00 0a 0e ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00007d90  48 45 4c 4c 4f 54 48 45  52 45 57 4f 52 4c 44 21  |HELLOTHEREWORLD!|
00007da0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00007db0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

Rue.

About

Find bit isolated empty regions on OTP ROM images for reuse.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages