More Ramblings from a Los Angeles Programmer

January 30, 2008


Filed under: delirium, mathematics, technology, uk life — Tags: , , , , , — Josh DeWald @ 11:13 pm

Lately I have been more and more amazed by two things:

  1. Gravity
  2. Magnetism

Sure, we have a bunch of equations for their effects (i.e. the force they impart), but do we really truly understand how they could actually come about?

Think about it, our Earth is completely locked into orbit around an object 93 million miles away. 93 million. Heck, Pluto is 3.6 billion (3.6 thousand million for the Brits out there) miles away and it ain’t even going to break away. That is pretty damn amazing and we totally take it for granted.

One of the more entertaining things to do for us simple-minded folks is to take two magnets and try to push their like-poles together. Those puppies will really fight you! You can use the effect and move another magnet around a table. Japan uses this for friction-less high speed trains. Kids play with magnets from the youngest age, and it’s always fascinating, but it is completely taken in stride.

It is very interesting that another instance of moving things without touching them, telekinesis, is complete hogwash (presumably…) despite there being electric currents running all through us.

Maybe this is why every guy has, at some point in his life, been convinced the he could use the Force.

Don’t even get me started with quantum entanglement (aka “spooky action at a distance”). The world around us is truly stunning, even when we can “explain” it.

Update:Had 36 thousand million instead of 3.6

January 9, 2008

Holidays and a New Year

Filed under: coding, daily life, technology, uk life — Tags: , , , , — Josh DeWald @ 5:52 pm

It’s been a while…

I’m ending a nice long 3-or-so week extended Christmas (just me, the wife, and pictures of gifts from family), New Year’s (very cool dinner on a ship permanently docked on the Thames. Those who know me won’t be surprised to know that I spilled red wine all over the table within about 2 minutes of sitting down. The 9 others at the table were quite nice about it) and 5-day Moroccan holiday in Marrakesh (مراكش). The last was quite cool (finally something different from Europe, you can only handle so many castles) but hectic and wearing at times (I can only handle so much haggling.. even though it’s satisfying to only pay 50% of the original price, I know I’m still paying way more than the price a local would pay). Again those who know me will not be surprised to know that I dropped (and shattered) the large tagine that we had purchased… was about 10 feet from our boarding gate at the airport.

And to really but an end to the holiday, my wife is now on a plane back to the States to get us going for our repatriation there. I will be following 3 weeks later, as my year-long stint here in the UK is ending. I have have had an awesome time here, both at work in out and about. Met some great people who I will definitely miss.

And now for something completely different..

To bring things back around to geeky stuff (I tend to skim over other people’s personal stuff, so I understand if you, Reader, have done the same) I have finally started working on my Super Nintendo (SNES) emulator. It is still using the same basic core as the C64 and NES emulators. Main difference is that the SNES using a 65816, a successor to the 6502 which can address 16MB of memory (24 bits) and implements all of the 256 op codes and adds some more addressing modes. When it initially starts up, it is actually in 6502 emulation mode (with bugs that the original 6502 had fixed, which I’m sure provided frustration to many developers who depended on undocumented instructions and bugs). I have gotten some basic graphics to work in the ‘test.smc’ demo included in Y0shi’s documentation, but it is nowhere near even able to get screenshots, but hopefully only a week or so (I’ve spent a feverish 3 or 4 days dedicated to SNES stuff, but probably spent another couple of weeks previously working toward getting an Apple IIGS emulator working, which uses the same processor) to get there.

I have started adding some JUnit tests of the actual instruction implementations, as even minor bugs can truly spiral out of control in the running of the system.

As usual, Zophar’s domain has proved invaluable for obtaining documentation, but I have also used Wikipedia for system overview (memory sizes and the like) and another site I stumbled on just called “Emu-Docs

I will make the code available via CVS or Subversion once it is in a usable state. Apparently my wife never really played the SNES, so we shall see if I can find anything to drive me like getting SMB3 working on the NES did.  I would love to get Super Mario Kart working.

I have been using ZSNES as my “reference” for what a working system should look like (I don’t know if it’s open source or not, but I am only using the executable in any case).

Shoutout goes to the many people who dedicated hours and hours dissecting and analyzing the SNES and writing emulators in C and Assembly which ran on old Pentiums. My Java emulator may one day run at a full speed on a 2 Gig machine 🙂

November 12, 2007

My very own Hitchhiker’s Guide

Filed under: daily life, technology, uk life — Tags: , , , , — Josh DeWald @ 9:32 am

So I recently bought one of the new iPod Touches (basically, an iPhone without the GSM radio, camera or mic).

It’s cool that it plays music and all, but that’s not what I bought it for. I really was impressed by the way the browser worked and that essentially full-fledged Cocoa applications could be installed onto it.

What I really got it for was so that I can have my dream of an internet-enabled hand-held encyclopedia. I want The Hitchhiker’s Guide to the Galaxy. And now I’m that much closer.

It turns out that there is a “school edition” of Wikipedia, which is a static dump of Wikipedia content that’s been slightly edited and chosen for entries that “appeal to children.” Don’t let that dissuade you, it has an entry on MKULTRA. In their words:

It is about the size of a fifteen volume encyclopaedia (24,000 images and 14 million words), and includes essentially all topics in Wikipedia rated “Good” or higher by Wikipedia itself at date of production. Volunteers at Wikipedia have also suggested more than a thousand other articles considered valuable and relevant to this project which SOS Children volunteers have checked and tidied up.

They have a 750MB download available at Once you de-compress it, you’re left with the exact same thing as what is at the Schools’ version site. Until we truly have ubiquitous, and free, Wi-Fi access (including during flights), this will be an awesome set of information to have on hand.

Unfortunately, Safari on the iPod/iPhone does not support viewing of local files directly with a “file:///” protocol. It reports “Cannot view the page because it is a local file.” It’s a good thing I had already “jailbroken” my iPod, so I just had to install the ‘lighttpd’ web server.

After copying the files to my iPod at /var/root/Sites using WinSCP (you can use any scp program though) into a ‘wikipedia’ directory, I was able to browse to http://localhost/wikipedia on my phone. And voila!

I assume this all works on the iPhone as well as the iPod, as most of the apps are actually meant for the iPhone.

I know this isn’t what Apple intended, yet (they are coming out with the official SDK in February), but if I wasn’t able to do something like this I would not be as pleased with my purchase. I don’t care if there are actually tons of other ways to have a hand-held encyclopedia, how many of them are also a music-playing, mail-synchronizing, calendaring web browser?

July 9, 2007

Expect the Playstation game soon

Filed under: daily life, uk life — Josh DeWald @ 8:48 pm

My wife’s brothers are in town, and one of them brought his skateboard. As you can no doubt imagine, I’m a world class skater. Allow me to demonstrate:

Josh startingJosh continuingJosh slippingJosh down

That was just practice, let’s try that again.

Josh starting againJosh continuing againJosh slipping againJosh down again

I’m expecting the call from a game studio any time now.

May 26, 2007

Economical? No. Necessary? Yes

Filed under: books, daily life, uk life — Josh DeWald @ 8:19 pm

My wife and I try to read fairly steadily. But I was just thinking that the cost to send these books back are probably going to be quite a bit more than I paid for most of them (there’s a local market that I pick up a lot of used books for on average 1 GBP ($2). The ones of the left are what we’ve read since getting here and the rest are “to read”. The rightmost ones actually were ones we sent *from* the US for reference and to read.


I’ve been getting into Stephen Baxter, but I kept ignoring him in the states because I only saw him attached to some Arthur C. Clarke books and I tend to not read books that are co-written like that. Incidentally, Arthur C. Clarke has traditionally been my “favorite” author (I’ve got most of what he’s written fiction-wise, about 45 books or so) but haven’t actually read him in years as he’s been mostly doing the “co-written” stuff. What this means as the ACC came up with a story, and Baxter wrote it. But they are never pitched that way, ACC is in the big letters as if it’s all him. I dunno, just seems slightly misleading. But I digress.

Baxter turns out to write some cool “big idea” books, I’d recommend the Destiny’s Children (yeah, I know. Close, right?) series (Coalescent and Exultant are the ones I’ve read so far) in addition to Evolution (which I just read… very cool hypothetical evolutionary history starting with the earliest primates during the time of the dinosaurs).

Bill Bryson is absolutely hilarious and insightful in whatever he writes. I managed to get Short History of Nearly Everything for 2.50 ($5) at the local market. Very good read and actually goes well with Evolution a bit.

As you can tell, I try to have a fairly eclectic mix of books; I try not to read only SciFi or technical but also “literature”, mystery, thriller, history, etc.

May 7, 2007

First Geocaching Adventure

Filed under: daily life, technology, uk life — Josh DeWald @ 6:06 pm

Rachel and I headed into London today to go the “Science of Spying” exhibit at the National Science Museum. I would not recommend it for adults, it really is meant for kids and, possibly, teenagers. But, it get us into London. Before we went something clicked in me and I remembered the concept of ‘geocaching’ where you hide and seek items based on GPS. I figured that would be a great way to spend some time around the museums.

I ended up on the Geocaching website and created a login form myself. There are tons of sites in London so I specifically searched around the South Kensington area. After reading them, I downloaded the .loc file and used GPSBabel to transfer it to my Garmin eTrex Venture. I happened to do GC104M3, GCY0D5 and GCXWJD. I was unsuccessful at the first one, but amazingly Rachel was still willing to walk with me to try to locate the second one which was at a park near St. Luke’s search. We got there and there was a couple hanging around where the GPS unit said the cache was so Rachel and I had to wander around a bit nonchalantly. Blessedly, they left pretty quickly and were locating the cache. It was pretty exciting. It was just a film canister with a piece of paper (the “log”) but it now made us part of this sort of game that tons of people play without the rest of the world being aware. I mean, it really was in plain site for the most part but nobody really notices it. In fact, I’m still paranoid that I didn’t put it back hidden enough, because it just seems so damn obvious.

Because I’m such a nerd, here’s a screencap from Google Earth with our track around the cache. Some of the lines seem a bit stray and I don’t know if those are artifacts of the unit or if Google Earth is off by 25 feet or so (which seems reasonable). I’ve taken off the waypoint for the actual cache.

Geocaching around St. Luke’s

For the second one, GCXWJD we ended up around Sloane Square station at the Royal Hospital (the label for the cache is Chelsea Pensioners but I didn’t see that anywhere). Now that I knew what I was looking for I pretty easily spotted where I thought it might be, even when the GPS lost the signal. Amazingly though, I wasn’t able to locate it until I was sure (when the unit got the satellite back). Again, hidden in plain side. Exciting!

While Rachel wasn’t amazingly enthused, she was more into it after the initial skepticism that came about when I couldn’t locate the first one. It really didn’t help that I had grabbed the camera from the house but forgotten to put the memory chip back into it! She now wants to buy a bunch of buttons to put into the canisters (or whatever is the ‘treasure’) as our sort of ‘calling card’. Works for me!

Anyhow, I’m really looking forward to doing some geocaching around the Woking area, there are apparently quite a few of them. Humorously, people in the area who are not part of the hunt are known as ‘Muggles’ from the Harry Potter series. Seems very appropriate actually. You also get to feel a bit like a spy… grabbing these things without looking too terribly suspicious. Sort of like a dead letter drop, which seems particularly appropriate after having gone to the “Science of Spying” exhibit mentioned before.

May 6, 2007

And they say England has bad weather

Filed under: daily life, uk life — Josh DeWald @ 8:54 am

The view outside our apartment on May 1st (not that that’s the only day we’ve had glorious weather).

From Beautiful Morning in Woking

When we first got here around February, it rained every other day and we definitely wouldn’t go a week without rain. The past few weeks have been awesome. Don’t even need a sweatshirt anymore. It is May, so I shouldn’t be surprised.

April 17, 2007

A great past few days

Filed under: coding, daily life, uk life — Tags: — Josh DeWald @ 9:10 am

Great Weather

First off the weather here in my neck of England has been amazing. Haven’t really needed any warm gear and there’s been absolutely no rain. Of course as I write this it’s a bit cloudy but, no matter, it’s been amazing. Rachel and I made good use of this weather on Saturday and had a great time walking around Notting Hill. I’ve never seen so many antique stands/shops in my life. Naturally we hit the first book store we found, Notting Hill Book and Comic Exchange on Pembridge Road. Ended up getting about 20 books between us for the equivalent of $2 a book (some only 10p!). In my haste I didn’t notice that one of the Len Deighton books I’d grabbed didn’t have the second half of the book contained within it. Such is life.

Super Mario Brothers 3 

On Saturday and Sunday I did some more work on my Java-based NES emulator and on Saturday managed to get Super Mario Brothers 3 and Zelda both working in fully playable states. I think this is something of a Holy Grail for me and in fact when I started this in January, my wife said all she wanted to play was her favorite game (Super Mario Brothers 3) so that has kept the drive. She had beat it already on the real system and still loved it. So it made me enormously proud when she asked excitedly if she could play it (she had seen that it looked decent). Quickly into playing as reality hit, we both wanted to have a tad more lives (how about infinite?) and to use an actual controller. Had to spend an hour or so figuring out how the Game Genie worked (more on that in a bit). Yesterday she was able to turn that on and played for 4 hours and got through most of World 3. Will have to use the GG again to get her back there (SMB3 doesn’t have save game feature and I haven’t implemented state dumping, doh!). Have also ordered an adapter for my PS2 controllers so we can hook it up, that turned out to be cheaper than getting a modified NES controller (although that would have been more authentic, but ah well). Rachel has apparently never played the NES version of Legend of Zelda, so she’ll be trying that next.


I fixed a lot of bugs in getting SMB3 to look and play decently. I had about halfway understood the documentation around rendering 8×16 sprites but managed to combine the PPU documentation from Everything2 (btw that’s one of the greatest sites ever, easy to spend hours on) in the 2c02 Technical Reference. My predecessors have spent an amazing amount of time accurately documenting things on the real NES/Famicom and have produced awesome documentation for it. Most larger NES cartridges use circuitry-based “mappers” which handle the requests for Program ROM and Character/Pattern ROM to serve out the correct data based on internal state. So a note for people writing NES emulators is don’t make the assumption that the cartridge (or whatever your representation of it) is necessarily read-only (the Character ROM is) because writes can be performed to the registers of the mapper. They will look like writes to the program address space (0x8000 – 0xFFFF) because that’s all the NES’s CPU knows about. Anyhow, Super Mario Brothers 3 uses the MMC3 mapper and there a few documents out there but the one I found the most useful was Kevin Horton’s MMC3 guide. It looks like he has physical ones that he tests for their behavior. I actually learned that I completely wasn’t even thinking about or emulating the built-in timer of the 2A03 (The NES’s modified 6502). Thankfully SMB3 doesn’t seem to need it, as it uses raster counting from the mapper intercepting read calls from the 2c02 PPU (Picture Processing Unit). I’ve got loads of other documentation but I think those were the main ones for getting that game working (as well as tons of other things). Kevin Horton has documented some of the other mappers as well (I used his MMC1 guide for Zelda). I almost forgot, throughout I’ve used Nestopia as my “reference” emulator for how things should look and behave. It’s an open source project, but I never looked at the code.

Game Genie

 As I’ve mentioned before, I may be dense but when looking for documentation on the Game Genie I wanted something that actually said “this is how it works.” All the documentation was really around how to translate the Game Genie codes into memory address + value + check value. So what I ended up doing is loading the Game Genie as a normal game and handing it the game’s ROM. Once a write of 0x00 occurred to address 0 (0x8000 to the CPU) then I put the genie in “passthrough” mode and reset the CPU. Now any reads that occurred would be checked against what was stored in the codes and if they didn’t match it would just pass through. My holdup was that I was somehow thinking that the ROM would actually do this (but of course that’s impossible since it’s being emulated and is just a bunch of instructions to the CPU and so won’t be able to make “real” reads to the cartridge on it’s own). Once it clicked that I had to do the final step of actually checking the addresses, it all came together. I guess when I just plug in my own Game Genie it just works and so I expected this too as well 🙂


I still need to get sound working. Didn’t ever do that on the C64 but I want to do that on this one definitely. After that I will probably move on to another system. Writing hardware emulators is really fun, but I actually don’t care too much about playing with them. However I do have that option now and I’m sure I will take it up. When I started my Commodore 64 Emulator I had really never dealt with machine architecture except in some basic classes at University. Perhaps surprisingly, it will still take me quite a while to write anything in Assembly (at least I think so, I haven’t tried or needed to). When you are the machine you get to be “dumb” and only worry about things at the level of each instruction and store some state in registers. It’s actually up to the programmer to be “smart” and make use of those registers and instructions in a smart way, especially on the older 8-bit machines. So I really have to hand it to those who can crank out beautiful and complex programs written in 6502 Assembler. My job is actually fairly easy here, it’s all been documented by people before me and each part does one thing. I’ve learned a lot more about sprite rendering and double buffering and “interface-based” OO development than I ever really had to before. It’s been a great experience. You put it all together and you have…

 Super Mario Brothers 3 Home screen

March 15, 2007

Moving to Europe? Use Vonage!

Filed under: daily life, technology, uk life — Josh DeWald @ 4:00 pm

Even before moving to the UK I was a Vonage user. When the local bell was charging around $30 for essentially basic services I happened to get a mailing advertising Vonage (I guess those ads are effective!). I called up and within a week had my phone equipment and within 2 weeks my phone number was switched over to Vonage’s control.

I opted for their $24.99 (or thereabouts) unlimited plan which is unlimited minutes which obviously includes long distance as well (is there anybody in the United States still paying for long distance?!). Even better it has free calls to Europe! Not that part has proved to be all that useful, but while still in the states I did have a couple of occasions to call the UK, and it didn’t cost me a dime!


As I was moving to the UK I realized that most likely I’d get to continue to use the Vonage service, which I had been really happy with. I called them up just to make sure and they did notify me that it wouldn’t be a problem.

I had to live in a hotel for about 2 weeks during my relocation and so didn’t have reliable internet. So I purchased the Vonage V-Phone (about $35 I think) which just plugs into the USB port and includes a headphone and mic as well as all of the software on the USB stick (it acts as a 64MB thumb drive as well as a CD to enable autostart).

It took me a bit, but I managed to find the link on the Vonage website (on the front page!) for “I have bought a device” which allowed me to register the V-Phone and enable it for my current account. If you’re in this same situation, make sure you don’t use the built in software to register the device, as that will assume that you are a new customer. Once it was set up, I was able to go into my “Add Ons” section and redirect the phone to the V-Phone rather than my actual phone adapter. Vonage only allows one device at a time per phone number (which makes sense).

So my wife and I were able to make free (except for the hotel internet price) calls back to the US for friends and family.

Once we got internet access in our apartment we purchased a phone, hooked it up to the original adapter, and redirected the line back to the adapter.

You will need a UK to US adapter (*not* a US to UK adapter) for the phone line unless you bring a US phone with you, as the wiring is slightly different. I ended up just splicing a two wires together because I couldn’t find the adapter. The actual plug is the same which hooks into the phone, but it switches the active wires. If you’re DIY inclined, just cut open a wire that comes with the phone and a standard US plug and splice the RED and GREEN wires together.

So yeah, we’re here in the UK making free phone calls to our family in the US. The best part is that they can make calls to us using our Los Angeles number so it’s a local call for them! They just have to watch out for the 8 hour time difference 🙂  I’ve also been able to make calls to the IRS, 800 numbers (difficult on a calling card), and other business numbers for dealing with US matters.

I haven’t tried Skype, but I’ve been told it’s not generally used as a land line replacement but rather as a way to make computer to computer calls (though it does support going to a physical line). So I can’t actually compare but I’d highly recommend Vonage.

March 12, 2007

Really? Harry Potter?

Filed under: books, daily life, uk life — Josh DeWald @ 1:51 pm

Revealed – the books we just can’t finish | Top News | Reuters

The list mostly makes sense… except that #2 is “Harry Potter: The Goblet of Fire”. This is sad given that these are books directed at children and adolescents, who can easily breeze through the entire thing.

“Ulysses” by James Joyce is #3. More people can finish “Ulysses” (percentage-wise) than a Harry Potter book!? Granted, the sample size is quite different.

Older Posts »

Create a free website or blog at