Thursday, March 20, 2008

LCD Monitor Troubles

Remember my 19" Hanspree LCD monitor I got last Christmas?

Just today I noticed that it was developing horizontal streaks across the screen towards the right especially during sharp brightness level changes.

I was at work when Frans told me it was getting really bad, so I Googled and found an article that said frame rates above 60Hz weren't good for LCDs, so I had her reset it from 75 to 60. It seemed to fix it a little bit, but the streaks were still there.

In desperation I asked her to secure the monitor cable at the back of the LCD and the PC. She did so for the back of the LCD, and the problem went away.

Or so I thought...

UPDATE:

The source of the problem was a loose AC power cord. Some arcing was probably messing up the timing circuits and causing the streaks. After securing the power cord, the screen was back to normal.

Phew

Steampunk Calculator

This isn't technically steampunk, nor was it invented in Victorian-era England, but with a few brass trimmings, it would fit right in. And...







...It could fit right in your pocket!




Friday, March 14, 2008

Willow Hack - Almost There

The main part of this hack - setting aside some SRAM to save to and load from, the actual routines for accomplishing this, and the basic interface to select from 3 slots where to save or load - is complete.

I still need to write a routine that displays Willow's stats for each save game, and do something better than SELECT+B in order to access the save menu. There is also a bug where the background music isn't restored after leaving the save menu.

I also did a few kludges to make things work, such as shamelessly copy/pasting some code from other parts of the code without knowing exactly what the function calls did. Seems to work fine though.

I also need to check if I've overwritten any code that shouldn't be. Fortunately (I noticed) the assembler does export symbols from the source. This means that any labels I've used in the source code are noted down along with their memory locations in the ROM. By placing labels at the end of functions and data tables, I can compare with the original disassembly and find out if I've overrun any code.

I also noticed and rooted out a little bug where the stack head kept moving up after selecting continue. Turns out the original code forced a stack reset which I failed to include (yes, copy/paste). Although there seemed to be no ill effects right off, it might have caused problems after the player continued 20 or so times.

However aside from the savegame text and a few bugs, there are a few things I want to add before I call this patch finished and release it into the world.

I want to add the name of the area into the save game, just so the player knows more-or-less where he left off, and a percent complete value would be nice. I suppose the calculation for percent completed would be computed from the items Willow has acquired. Then there's a minor hack to the saver/loader routines which should use a checksum to verify if the savegame is valid or corrupt.

One last thing, I'd like to add my name into the credits on the PRESS START screen, but the data is tightly packed with no free memory right after it, so my last hack will entail either moving that bit of data into some place more agreeable, or add and extend the "string" writing code to allow jumping to another location in memory. Right now I've just shamelessly replaced the TM & © "LUCASFILM" with "ENDERSOFT".

For now, here's what the selection screen will look like. The data is actually a mock-up - no values are read from SRAM - but the screen is actually running off the emulator (i.e. no Photoshop tricks)

Monday, March 10, 2008

Willow Hack News

I'm in the middle of unraveling the code to draw the backgrounds used for the START and PASSWORD screens.

Interestingly, it uses the same routines for drawing the in-game backgrounds. This is the background you see when walking through the game as Willow.

Now this routine uses two variables to specify what background is loaded to be scrolled into the screen while Willow walks to the edge of the visible screen.

  • Each variable seems to change independent of each other
  • One variable changes if Willow walks out the top/bottom of the screen, I designate this as mapY.
  • The other variable changes if Willow walks out left/right of the screen, I designate this as mapX.
  • The variables don't seem to be a direct index, as useful values seem to be in the 1A-1F range.

The "coordinates" for the START screen is (1A,1E). I'm not sure where the password screen is stored yet. When switching to the password screen, no backgrounds are drawn (i.e. the code for drawing backgrounds is not called). Instead, the code merely switches the active nametable implying that the password screen is already drawn into memory.

So far I've determined that these values decode into a memory address where the code picks up another byte that decodes into another address, which is where the char which will be copied to the nametable is stored. I still haven't fully decoded the routine, but it's another step towards finalization.

I think it uses some form of compression in order to save space, as the routine seems to read from certain locations multiple times, instead of simple packed data. It is probably RLE, which would be ideal given the repetative nature of the backgrounds.

Meanwhile, I think I should focus on what can be done, which is implementing the load/save screens - sans backgrounds - and adding support for multiple saves.

I just feel so close to understanding how it works that I don't want to let it by.

Wednesday, March 5, 2008

Willow Hack: Update

Remember how I said I wanted a feature to "skip" the dialog in WIllow? I really meant, make it print faster. Well, I was looking through the code today, trying to make sense of it all when I came upon some code that seemed to be reading the joystick in the dialog routine.

Aha! I thought, and noticed that the bit being tested was the one for the up button. That's when I "remembered" that in order to speed up the dialog you had to hold Up on the D-Pad. I thought this "Up" business to skip dialog was a bit silly when it's almost universally held that the B button was for "cancelling". So I remapped it to B.

I also stumbled upon how it draws text to the screen, and isolated a function call that seems to draw the background.

A little more work will be needed disassembling all this twisting code before I can figure out how it does the backgrounds. When that's done, I can be on my way to writing the Load / Save screens, and making this Proof-of-concept a full working patch!