Assembly
Mar/090
Assembly language is one of the lowest level programming languages around. There are many different dialects of it around too, (one for each processor architecture) making it possible that any programs written in assembly may be completely useless on a machine that has a different processor.
This is one of the reasons why high level languages such as BASIC and C became so popular. They were far more portable between architectures that simple Assembly. However compilers these days tend to add a fair amount of bloat to any assembly code that they generate. For example, a simple Hello World application written in C compiled with GCC 4 weighs around 32KB (29,248 bytes). However, after rewriting the application myself in Assembler it only weighed 16KB (12,608 bytes).
This is a pretty hefty size difference. Heck, its over twice as big!! If your dealing with programs that are large anyway this is kind of a none issue.
I have recently begun learning the Core 2 Duo assembly language (my seconds assembly language) and all though the concepts behind it are rather peculiar and a lot of concepts and rules from higher level languages just go straight out the window its surprisingly easy to pick up.
Here’s a comparison of Hello World in a few languages.
C:
#importint main() { printf("Hello World\n"); return 0; }
PHP:
echo "Hello World\n";
REALbasic:
msgbox "Hello World"
Assembly (i686):
.cstring output: .ascii "Hello World\12\0" .text .globl _main .private_extern _main _main: pushl %ebp movl %esp, %ebp subl $24, %esp movl $output, (%esp) call _printf_stub movl $0, %eax leave ret .section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5 _printf_stub: .indirect_symbol _printf hlt ; hlt ; hlt ; hlt ; hlt .subsections_via_symbols
As you can see, assembly has a lot of VERY symbolic code and is the most incomprehensible to anyone who doesn’t know it. The other 3 you could at least take a guess at!
New MacBook Pro; Updates as well
Mar/092
Hello to all who are reading this!
I finally have a new laptop, and it only took 6 months after my old MacBook got sent back to Apple due to it constantly needing repairs. I should clarify that I did get a replacement almost as soon as it left, but I sold that not wanting to put up with the old plastic MacBook model any further. Of course new MacBooks had just come out and putting money aside for one was a strong reason for selling it :).
Well I have finally got one of the new MacBook Pro! I’ve got to say it’s very nice. Its good being able to go do some of my development work else where around the house, or even in the garden (weather permitting; lousy unpredictable UK weather). I’ve noticed a few glitchy things with it (though that seems to be more software than anything, so maybe 10.5.7 will fix it?)
Updates
On to the second part of this post. A while I go I said about the possibility of TuneBar 4 having a public beta released. Unfortunately other ventures of mine of distracted me from getting any beta like prepared with TuneBar 4, so its still not beta ready, though I will say that given the sheer number of “iTunes controllers” out there now, I’m having to think slightly outside of the box and offer something that they aren’t. It hasn’t been easy, but I’ve come up with a feature that I think will totally rock.
This feature also stems from another app I’m dabbling around with and thinking about creating, and basically I think the two would interface with each other quite nicely. If you want to try and guess the feature, or even the app feel free to do so. I will say nothing as to what they are, until I’m writing the webpage for TuneBar 4
As for what I’ve been distracted with. Project D as I like to call it is Top Secret, and should have as few people in the loop as possible according to my contractor. However, the instant I’m allowed I’m posting it up here! Some you may have figured that it has stuff to do with networking given the sheer amount I have been ranting about the stuff
Well I suppose I should get off and get some TuneBar 4 done :). Oh for all my real old web friends, back from the ev-nova.net forums (which I notice is no longer going
) I have restarted the editor I began shortly before I stopped visiting the boards; iNova. Its going to be full Cocoa and will still encompass everything I said, and more.
Deepening my understanding of programming…
Mar/090
I’ve been programming for a long time; 11 years. This is just over half of my current age! I can confidently program in 4 different languages (and several markup languages) as well as get by in about 8 others.
One languages I began using 5 years ago, Objective-C is the only language not to follow the same trend as the other languages whilst learning it. When learning Objective-C, most programmers will be tying and making themselves almost dependent on Cocoa. This is not necessarily a bad thing. Cocoa is an excellent Framework, one which I very much enjoy having in my toolbox, but there are sometimes being able to use Objective-C without Cocoa may be advantageous.
I’ve recently run in to one such thing. I small experimental utility I’ve made for myself needs to run on Windows, Mac OS X and Linux. I fully had in mind that I was going to be using C# on Windows, C++ on Linux and Objective-C on the Mac. I know I could use C++ on all 3, but C++ is not my strong suit. I know it, and can program it well enough, but prefer not to.
Well, whilst visiting the website for GCC in order to download it to my Windows setup, I noticed the Objective-C compiler in it. I knew it was there, but I just never even considered Objective-C outside of the Mac. Seeing that I decided to try and create a small application with Objective-C.
I should stress that although stripping out Cocoa from Objective-C is a relatively painless task, there are some differences to basic method names and a lot of functionality that we take for granted is not there. For instance you a stuck at Text only applications unless you want to code a GUI from the ground up.
I set about creating a basic application that would display the infamous Hello World to the screen, but do it in a slightly overkill way… it would create a new class to print to the screen.
Here is the code for the header and implementation files for the class.
hello.h
#import <stdio.h>
#import <objc/Object.h>
@interface Hello : Object {
const char * message;
}
- (id)initWithMessage:(const char *)m;
- (void)setMessage:(const char *)m;
- (void)displayMessage;
- (void)free;
@end
hello.m
#import "hello.h"
@implementation Hello
- (id)initWithMessage:(const char *)m {
if (self = [super init]) {
message = m;
}
return self;
}
- (void)setMessage:(const char *)m {
message = m;
}
- (void)displayMessage {
printf("%s\n", message);
}
- (void)free {
[super free];
}
@end
main.m
#import <stdio.h>
#import "hello.h"
int main (void) {
Hello *hello = [[Hello alloc] initWithMessage:"Hello World"];
[hello displayMessage];
[hello free];
return 0;
}
Notice the lack of any NS naming? This example has used Objective-C, but has ditched Foundation and Cocoa. You may even notice the lack of -dealloc, which has been replaced by -free.
There are a few things to watch out for however. On Mac OS X plain Objective-C with out Cocoa has been severely crippled, due to the absence of some key classes. Namely NXConstantString. This is the class in Objective-C that allows for the @”" style string creation. Apple has replaced the class inside of Cocoa and Foundation to use NSConstantString, and the developer tools tell GCC to look for this class rather than NXConstantString. You should (I have not tested this yet) be able to use NXConstantString on Windows and Linux.
This is draw back on the Mac, but we do have Cocoa and Foundation in its place. NSConstantString is a much better version of NXConstantString, as it descends from NSString which includes all the encoding information for localizing applications.
Objective-C itself is a very small thing. Its got may be a dozen or so header files inside GCC. Lets put this in perspective. Cocoa and Foundation combined have about several hundred header files. This is what most Objective-C programmers are learning. Its Cocoa and Foundation. Yes they know the Objective-C syntax and can program it, but the majority will never program plain Objective-C.
I find this to be rather interesting. For all other languages we learn the actual languages, but with Objective-C we spend a tiny amount of time learning the syntax and the rest learning the frameworks. Perhaps this is why its seen to be such a difficult thing to learn, because of the sheer overwhelming size of it. If people learnt Objective-C with out Cocoa to begin with, and then eased in things like Foundation, perhaps it might be that bit easier for new comers.
Then again I could have just been spouting crap :). Anyone got any experience programming plain Objective-C, or have any thoughts on my thoughts?
An idea… Opinions please.
Feb/092
The idea has come from watching an episode of Top Gear. Not quite the standard source of inspiration for Software, but still inspiration can come from weird places. I won’t say the exact bit that inspired me, but rather what my idea is. I should say that I’m looking for feedback on to what people think of this (both Developers and Users).
My idea is for a group of developers (as many as willing to participate) to create a a fully featured application ( such as a Graphics package, or some such thing ) in the shortest possible period of time and to ultimately release it as freeware or open source.
Why?
Well a few of reasons.
1. My thought is that it would be one hell of a good collaboration project for everyone, a real community project, and hopefully something that looks professional at the end.
2. Sheer curiosity to see if such a thing is even possible. Several developers, different places, different time zones working to get a fully featured application built as fast as possible to be released as fast as possible.
3. The Challenge it presents.
I’m not stupid, I realize A LOT of developers will think this is a waste of time, there’s no profit involved for them. My intent is that the rights to the application will be held by ALL the people involved in creating it. Anyone those people can update the application when and if they choose to do so.
Let me know what you all think of this idea. Crap? Interesting? A winner? This is just something that popped in to my head about 5 minutes ago, so its not been completely thought through so some planning is going to be required.
Anyone who is interested or would like to take part (be it graphic designers/developers/etc) should be willing to get no profit from this.
Opinions and thoughts please.
Gaming
Jan/096
I spend a fair amount of time on the computer, writing code/software/websites and also doing a lot of stuff in Photoshop, but I also spend a reasonable amount of time gaming.
I’m not a “hardcore” gamer. Never have been, never will be. Doesn’t interest me to be. But I am a casual gamer, and I do like to think that I have some skill.
The game(s) that I play more than any other has got to Halo. I play Halo quite a bit of Halo, and have beaten the game several times, on Easy, Heroic and Legendary (curiously enough I’ve never done it on Normal :\). Now my time on Halo is spent on Xbox Live and match making, playing against others from around the world. On the whole this is a lot of fun (provided you mute all the players in the playlist. A lot of the ones chatting on the public chat seem to be 12/13 year old kids with voices so high pitched they actually make ears feel as though they’re about to bleed!)
Anyway, my reason for this post, is not to rant about my Halo gaming habits, but rather to announce the first gallery that I plan on doing. This gallery will be off screen grabs/movies that I have taken from numerous games that I have played. The screen grabs will be done in the format of desktop backgrounds, so anyone interested can take a look. Most of the grabs will be things from unique “freeze frame” moments, or quite arty looking ones.
Anyone who has Xbox Live and wants to friend feel free to do so!





