Raspberry Pi Assembly tutorial

I stumbled across this Raspberry Pi assembler tutorial which seemed like a fun thing to try out. Who would have thought you could spend your evening thinking carefully about the ramifications of parameter passing mechanisms.

Not something I plan to do seriously, but certainly interesting. Much in the same way that learning Cobol gave me insights into database query optimisers and variable scoping, this is giving me new appreciation for the underpinnings of C and python.

Posted in learn, Raspberry Pi | Comments Off on Raspberry Pi Assembly tutorial

Flashing the HTC Desire Bravo. A modern guide.

My most recent holiday project was flashing cyanogenmod onto a rather elderly HTC Desire Bravo. Released in 2010 this device is positively ancient by Internet standards, but it was very well received at the time and I still liked it even as I retired it. Not enough space for apps was the problem. A tiny 512MB drive had to hold everything and with updates required to unremovable apps I had no space for anything else.

Perhaps a custom ROM that didn’t need Facebook and Twitter apps would free up some space and get it back in service.

Continue reading

Posted in android | Comments Off on Flashing the HTC Desire Bravo. A modern guide.

Making moves

Our new board looks nice, but we’re not going to get anywhere unless we can make our pieces move around. In this step we’ll take an innocent looking ImageView and tell it how to start making moves on the enemy. Quite literally.
Continue reading

Posted in android | Tagged | Comments Off on Making moves

Regrouping the pieces

Somebody once said, “If it’s not broken, fix it anyway.” Not the traditional phrase for sure, but the old version relies on one assumption that can’t ever hold true. I don’t know if I pursued this project in the best possible way. The only way I’ll find out is if I try it differently.
Continue reading

Posted in android | Tagged | Comments Off on Regrouping the pieces

Nobody wants backup

Everyone wants restore.

My computer started having issues booting and random failures while I was working with it. This culminated in it completely failing to start. Fortunately it had a factory restore option (when did companies stop supplying Windows cds?) which got it back on its feet long enough to run a chkdsk and identify a lot of bad blocks.

Now I’ve recovered from that it’s behaving much better, although it still refuses to recover from hibernation. Fixing that is an investigation in progress.

I’ve not been updating this tutorial while the computer was in intensive care, but I reckon it’s good enough to be going on with just now. Which leaves me one last problem.

Factory restore trashed all my data and, like everyone else, I didn’t have a recent backup. Fortunately the factory restore option had a backup option, but I’m not sure how much it got due to the mentioned bad blocks. Getting back to where we were and finishing the next post is a job for the next couple of days, after which the regular schedule should return and we’ll wrap up this project and move onto the next. For the next project I’ll be taking on some of your requests and writing the articles as self-contained posts with all of the code posted each time.

Executive summary: Take a backup of your work today.

Posted in talky | Comments Off on Nobody wants backup

Would you care to see the menu?

I can still see two problems with the game. One obvious, one not so much. They both come from the same place though: What happens when you open the game up? It depends what else you have been up to. You might get a new game if it’s been a little while and the process manager has decided to evict the game process in favour of something more important, or you might get the results of the last game played. Depending on circumstances, we might want either of these situations but whichever one we want, we definitely don’t want to leave it to chance.

Today we are going to deal with getting to a new game. If the app hasn’t been run, or if it’s been terminated since the last game we have no problem because the user will be dropped into a brand new game, ready to go. If the the process was still runnning since the last game then we could just hold down the back button and rewind the game to the start but that’s really untidy. What we are going to do is grab the Menu button and make it work for us.
Continue reading

Posted in android | Tagged | 5 Comments

Everyday I’m shufflin’

Some of the people I’m play-testing against are starting to get good at this game. Proper development of supported attackers and blockading areas of the board to frustrate constructing a counter attack. The current problem is the starting ranks.

Rocks on the back row are initially pinned down, they simply can’t do anything. Papers are easy to bring out, but they can’t attack opposing rocks until there is a break in the line of scissors. The fastest and most obvious strategy is to bring scissors forward first and attack the opposing line of paper. Moving them forward also means the front rank of paper is protected by the back rank of rocks. Then it devolves into attrition. Not the most fun after a few games.

To avoid this, we’re going to mix things up a little bit. Literally. By laying out the starting pieces randomly, every game will likely make it easy to develop all types of pieces and it will leave a few well defended at the back.
Continue reading

Posted in android | Tagged | Comments Off on Everyday I’m shufflin’

Rip it up and start again

I said at the end of the last post that I didn’t like the architecture of the move validation code. It’s a bit inelegant to say the least, but I did allude to a simple fix that will make it substantially better.

Plan to throw one away; you will, anyhow.

--Eric S. Raymond
The Cathedral and the Bazaar

Large quantities of philosophy aside, if you don’t like something there’s probably something wrong with it. Even if it’s good, if you can think of a better way: do it. This project overall is pretty simple but by recognising something isn’t ideal and re-doing it when it’s not important, when the rubber hits the road you will have been through it a few times and understand the pros and cons of various approaches.
Continue reading

Posted in android | Tagged | 4 Comments

Ground rules

Our game is really starting to come together and I’ve been demanding anyone who sits still for too long plays a game with me. The primary problem there is of all of the people I meet day to day, I’m the only person who has heard of this game so my reluctant opponents have to keep brand new rules in their head while trying to pull together a strategy on the fly. It’s not too easy.

The other problem is the screen display is so small a fingertip covers the piece entirely so it’s possible to accidentally pick the wrong piece and not realise until the move is complete. This is why the undo post came up early.

My solution is to highlight the valid moves when a piece is selected. This leaves people spending less time thinking about what they are allowed to do and more time playing the game, and because the valid move area is going to be substantially larger than the finger of even the most sausage handed among us it’s easier to be sure the right piece has been selected.
Continue reading

Posted in android | Tagged | 17 Comments

Reduce, reuse, recycle

And in that order please.

One of the great things about Java, and by extension Android is the garbage collector. For those of you who don’t know, this will periodically sweep through your application and free any objects that you can’t access any more. Very, very handy, but there is a problem with it: in order to get a consistent view of your application, it has to stop your application. Normally this only takes a moment but if you are scrolling through a set of pictures which are going out of scope as they flow off the top of the screen the garbage collector will periodically freeze your application to clean up and cause the scrolling to stutter slightly.

The way to avoid this is to keep the number of discarded objects to a minimum.

Continue reading

Posted in android | Tagged | Comments Off on Reduce, reuse, recycle