Posts Tagged ‘technology’

My Virtual Machine

Thursday, February 26th, 2015

I’ve been head down, working all spare hours on my virtual machine. It is 100% original code written from scratch in C. I can’t give details yet, but it’s a register-based 32-bit VM that runs within a 32-bit or 64-bit parent application (depending on the host OS) that permits me to run multiple VMs simultaneously, each of which can run the same or different applications.

The last few days have been a whirlwind of ISA tweaks code refactoring and general mania, but today I got to the point I could run a simple test. The test application ran two loops, one nested within the other, that both iterate 65,535 times for a total of 4,294,836,225 iterations.

Turns out my VM, running within a VMWare Fusion-hosted guest Ubuntu OS on my 2.26Ghz Mac, executes 117,131,896 instructions per second.

I knew that going for a register based VM (as opposed to stack based) was a good idea 🙂

I also have a number of additional things on the plan that will radically increase the effective performance. High on the agenda at this point is to finish my assembler for it, as currently I have to hand-assemble my instructions. I should get that done in the next couple of days. Later, there will be direct assembly to native code, depending on whether the VM is running on x86 or ARM… I’ve already done some successful prototyping of the concept. At that point, I start hitting the billions of instructions/sec.

Very, very happy with the way this is going!

Apple Swift

Friday, January 23rd, 2015

These days there are a lot of programming languages to choose from. New languages have appeared regularly over the last couple of decades, many of which are designed to facilitate quick development of web applications. As an ‘old school’ programmer, I have a strong preference for low level languages which are very tightly coupled to the way in which the underlying hardware works. It is for this reason that I love C, as you can write in C and maintain a reasonably good awareness of the number of machine code instructions it is turned into when it is compiled.

Personally, I like this. It means that I, as the programmer, have a huge amount of control over how my code runs. It also means that code written in C runs faster than code written in just about anything else. That said, there are a few downsides to writing in C which are primarily based around the fact that C gives you the raw tools to work with and it’s completely up to you to use them properly. The language itself has virtually no built-in protection against you doing something stupid and crashing your program as a result.

Another issue with working in C is that you end up having to write a lot of code to cater for possible errors and to manage the use of memory during runtime. I’ll repeat; for me this is not an issue, as I rather enjoy that process and I have a number of techniques for handling errors in nested functions such that I can gracefully recover. However, it remains true that this is an overhead and although a well-written C program is a thing of true beauty it is also true that mistakes can creep in which in other languages would be detected for you.

The upshot of all this is that I have resolutely remained with C as my primary programming language, and I do not see this changing, ever. However, I’m quite interested in learning a language that is a lot more modern. My requirements for such a language are as follows:

  • It must be a compiled, not an interpreted language (I like fast code!)
  • It should not force object orientated programming on you (I prefer functional programming to OO programming)
  • It should permit development of modern apps on at least one modern system (my preference is OS X)
  • It should not have a syntax that I find ridiculous (objective-C… shudder)
  • It should be accessible and easy to set up the development environment (I want to code, not mess around with IDEs)

It is for these reasons that I have spent some time recently getting into Swift from Apple. Swift seems likely to incrementally replace Objective-C for OS X and IOS development going forwards. I rather like the syntax, it is well integrated with existing Objective-C libraries and it looks extremely likely that it will be the language of choice for OS X and IOS development going forwards.

Although it was only released in June 2014, it has rocketed up the popularity ladder, and I can see why. Although the support for Swift in XCode is still a little clunky, it’s vey usable and quite fun to work with. I have a couple of projects I want to create for OS X (including a rather cool plugin idea I have for Logic Pro X) and I’m enjoying the learning process.

 

“Science vs Music”

Saturday, December 13th, 2014

Well, it’s not really Science versus Music but a very cool project involving the visualisation of music using physical phenomena.

Korg Kronos update

Friday, December 5th, 2014

Ooh, nice early Christmas present it seems. Korg have released an update to the Kronos operating system which adds a bunch of new cool features. Downloading as I type. I had already planned to spend some time on it this weekend with a view to adding a brand new bit of audio to this site so this will make the experience all the more fun. I’ve been feeling the urge to get stuck into a bit of audio engineering for a while, and over the next couple of days I’ll finally get some time to do so. Wahey!

A brief history of computer graphics

Sunday, November 30th, 2014

A look back at the evolution of computer graphics (mainly games). Nostalgia alert 🙂