Software breakpoints in CodeScape
I’ve been busy. Not in the way that I want to be (i.e. time working on Shambler), but at my job. We’re winding down on work for the launch and I should get some more time in two months than I’m currently getting to work on Shambler in my spare time.
With that out of the way; breakpoints! For those who have done any kind of a DebugBreak function for x86, it’s very simple. Just add an int 3 and you’re done. Other architectures have quirks to implement breakpoints in software. I spent a while combing through the Katana documentation until I realised that what I wanted wasn’t anywhere to be found. Instead, I turned to the SH4 Hardware Manual (thanks to Marcus, yet again). Section 20 on User Break Controller is what I needed. It’s simple, but involves a bit of setup. There’s the address, ASID, mask, and how to break to set. CodeScape will pick up the breakpoint and stop as expected. I use the PR register when entering the debug break function as the target address for break channel A (I may get fancy later on and add conditions as well as use channel B). It’s one of those things that I thought was going to take several days to figure out because I thought it may only be viable to use CodeScape to set hardware breakpoints and software breakpoints would be ignored.
I’ve also been getting back up-to-speed with Erlang and Java. It’s been quite a bit of fun since it’s been a very long time since I touched either language. At the moment, I’m thinking of shelving the CI server until later. Mostly because I can’t justify the time spent on it right now. It’s a shame as I really was hoping to get it at least workable by the end of next month. Instead, I’m focusing on the UI and scripting side of things. UI is still something I struggle with. I want to do it right, but don’t know what right really is in this context. It all seems very clunky to setup at the moment, getting UI elements contained and positioned is fickle to say the least. Striking the balance between being easy to construct and performant is the big hurdle. If no consideration is put into performance, it’s going to be much more difficult to untangle and make easy to assemble UIs while keeping the framerate up. A curse and blessing is the PowerVR video processor. The screen is split into a grid of 32x32 pixels which can save on redrawing areas but with the downside of thinking about how an anamorphic 16:9 may impact that. Something that’s 32x32 at 4:3 may be 24x32 at 16:9, resulting in a misalignment if the grid is relied on. I’m probably getting hung up on the details which don’t matter.
Scripting is something that I really want to get working soon, as it’s pretty much required for the UGC approach of making this game work in the long run. I’ve checked out the section on micro threads in Game Programming Gems 2 that helped put everything into place as far as how I can handle threading. Outside of relying on Pthreads for my day-to-day stuff, I had my reservations about being able to implement threads. Now I at least have something to base the implementation off of. Working toward the demo I wanted to send out in October last year, I realise that I overestimated my willingness to cobble it together instead of doing it right. The risk of throwing it together is that when it’s out, people will expect constant updates, otherwise it’s another little demo that goes nowhere for maybe a year. Among that, there’s the hardware projects, that will take up more time. A network demo would be nice. No idea what it would be at this stage as I don’t know if bugs lingering in it would be an issue for me to get around to fixing while also working on the game proper.
One of these days, I’ll post something coherent. I really want to just write down what I have and get back to it. The long-and-short is that I’m working on implementing micro threads for scripting right now and want to get back to the UI as soon as possible to support the basic demo that I don’t want to release without at least a solid foundation to build off of. Smoke and mirrors isn’t what I’m aiming for.