Jump to content
  • entries
    36
  • comments
    32
  • views
    73,383

Hack-o-matic III (HOM3)


jwierer

807 views

About once a year I get some external motivation to code. In 2007 I started looking at some of the bit hacking tools bit-hacker, hack-o-matic & HOM ][. They were better than using a hex editor for hacking up 2600 graphics, but lacked some of the flexibility I was used too in other applications. For me bit hacking needed to be a lot more like Microsoft Excel. I actually started by creating an add-on for Excel, but eventually I figured not everybody would have Excel and I wanted to really customize the experience.

 

I did start by looking at the HOM][ source. One of the things I noticed was that it was directly drawing to the form to create the grid. While incredibly fast, it did seem somewhat limiting. The whole idea was to create a much more flexible environment that felt like Excel so I opted to design it around the datagridview control. (DGVC) While this was meant for really data entry it's very convenient and powerful. Also after using it for my graphics editor in my Beef Drop Construction Set I was very familiar with it.

 

Unfortunately when I got started I writing the code quickly and not worrying too much about optimization. The result was in my first few public releases it could take up to minutes to load a binary of 16-32k. A bit part of the problem is how the DGVC adds rows. If you added them 1 by 1 it's ridiculously slow as it appears to redraw every time it's added. The first optimization was to figure out the number of rows, based on total bytes, re-size the matrix, load it and then visualize. Also because I introduced color coding, pinning, comments there is a bunch of logic that occurs in every row. Think about it, even though you may only be editing a 32K file, small by modern standards, it results in what is essentially a 32,768 rows by 18 columns. Excel 2003 and earlier only supported 256 columns by 64K rows so it's actually and impressive size grid if you think about it! The other major optimization was to move the row logic into separate threads if you have multiple cores. This way the load is spread across all the cores in modern PCs. Problem is that the DGVC is still updated in a single thread so you can't maximize performance. Anyway, on my laptop I think a 32K rom loads in ~3.1 seconds so it's a vast improvement over my earlier attempts icon_shades.gif

 

blogentry-5778-1243865866_thumb.jpg

 

When I started this, I had just upgraded to Visual Studio 2005 so this was written entirely in the .NET 2.0 Framework. If you've never tried HOM3, since it's incredibly difficult to find, you can download the latest published version here.

0 Comments


Recommended Comments

There are no comments to display.

Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...