Watching a movie is a different experience every time!

February 14th, 2008

Our attempts to watch a movie...Last night we decided that it’d be a good idea to watch a movie. After an enormous amount of time deciding what to watch we started the process of working out exactly how we were going to watch it. This is always a most interesting experience and usually results in us getting every computer, TV, monitor and media capable device in the living room and then connect everything to everything else wondering why 2 hours have passed and we’ve still not seen the opening titles.

In last nights case, 2 laptops, 2 TVs, 1 set of speakers and 1 XBox later we finally managed to get some kind of output…

In our naivety we’re about to try and watch another movie tonight - who knows what mayhem will ensue…

MouthOS Development Environment

February 12th, 2008

After my French explorations I booked Friday off and went home for the weekend. I had a nice time back in sunny Wales except for the fact that my family had literally managed to break every single computer in the house - and when I say break, I don’t just mean a few viruses or malfunctions, I literally mean motherboards broken, screens damaged, graphics cards frizzled and who knows whatever else. By the end of the weekend I’d managed to pull the few working parts remaining into two systems - the server (which for the most part was working to begin with except that it wouldn’t boot because it couldn’t find the floppy disk drive) and a computer upstairs for everything else. To be fair I think they’ve had some kind of power surge as one computers PSU fuse had blown along with the fuse in the plug… I think they now plan on buying a few surge protectors :p

When I returned today Paul (my boss) asked for a quick chat in the office. He had some not so great news and some excellent news for me. The first bit of news was that the presentation he and I were going to do at Sheffield university had been taken over by some other guys in the office. This turned out not to be so bad after all as I realised that it was the 29th February anyway - at which point I’m back off home anyway for my sisters 5th birthday. However, the good news (which is very good indeed) is that he has managed to get one of the guys in the Solaris Kernel Engineering department (who works with DTrace) to mentor me (after showing him some of the stuff I’d been doing with MouthOS) for my last two years at university. During this time I will be doing things like fixing DTrace bugs via the Open Solaris community - opening some real possibilities for when I finish to come back and work for Sun in their Solaris engineering department! I’ve got a meeting at 11am tomorrow morning with Jonathan, my mentor to be, which I’m really looking forward to as I’m raring to go and I really can’t wait now until the 10th March when I will be going on the Solaris Internals course - thanks Paul :)

So, what else has happened over the last few days? On Thursday I got another phone call from ‘Private’ offering me a new phone. I keep telling these people that “I’m not interested and that I’ll deal with Orange directly thank you very much.” However, this prompted me to actually ring Orange and see if I really was entitled to a new phone. The answer was no, not really, but we’ll give you one anyway. Apparently these companies will ring you up, offer you a contract and then (only then) contact Orange to see if it’s going to be alright! The cheek!

Whilst I was on the phone I did say I wanted the Nokia N95. However, they wanted £89 for it. Instead I said I’d have the LG Shine (http://www.lgbloggers.com/)… this was fine except it was out of stock. In the end I decided on the Nokia 6500 Slide (in black which is apparently a Orange exclusive). So far I have been most impressed with the phone. However, as with all new gadgets it’s a requirement to test out every feature it has to offer, one of these features being the camera. I decided that it would be a good idea to take a couple of pictures of the MouthOS development centre (i.e. my desk)…

My desk

The books on my desk...

I have to admit that whilst I would love to be able to say that all of those books are mine, only the top C book and the bottom three Intel books are truly mine - the others are on loan from my house mate and friend Robin. However, I highly suspect that I will be buying my own copies before I have to give them back to him as they have been really useful for ideas and all that malarkey during the development of MouthOS so far - I think another thank you is in order - thanks Robin.

France and Dogs in the Office

February 7th, 2008

I’ve just got back today after a week in France working in the Paris office of Sun. I decided that it would be a very good idea to get up nice and early last Wednesday (5am to be precise) so that there would be no chance of missing my incredibly cheap, no refund, no modifications, return Eurostar journey at 10.30am. This proved to be more than sufficient as I arrived at St. Pancres at 8.30 with 2 hours to spare!

When I arrived in France (about 1.45pm) it then took me a further 2 hours to find my hotel. This was most unfortunate given that my hotel was quite literally 15 minutes walk away from the Eiffel Tower! Ah well. Once I’d finally found my hotel I went for a brief walk around the Eiffel Tower and towards the office - which I found with much more ease.

At the weekend a couple of Friends from University came over to visit. One of them (Ash) had a newspaper cutting which described “how to do the top 5 sights in Paris in one day”. I suspect that we were meant to do this via the Metro, however he insisted that it was a walking exercises. This meant about a 10 - 15 mile walk starting (and then finishing at) Gare du Nord. First we walked to the Pompidou Centre (which is one of the most bizzar places I have ever seen). Then from there we walked to Cathedral Notre dame. From there we walked to the Louvre, then onto the Arc de Triomphe and finally the Eiffel Tower. From there we walked back to Gare du Nord via the major shopping street in Paris. My friends thought this was all very exciting, unfortunately my feet were not too excited by this point having developed numerous blisters!

On Sunday, Monday and Tuesday I was in the office again working on getting the lab back up and running after the power work was completed. There were a few minor problems with the work completed such as the fact that the electrical engineers had used armored cable and not steel wire armored cable (tut tut tut) and the fact that they decided to use some of the 16AMP commandos off some 32AMP to 16AMP splitters we had in the lab because they ran out (go figure, they’ve had the numbers they’ve needed for over 3 months now!). However, on the whole the work went reasonably well and the three power phases are now much more balanced in terms of load.

The last couple of nights in France I went out with Paul (my boss) and JD (one of the old students who is looking after the French lab this year). This was nice, except that on the way back to his Hotel, Paul managed to walk into a glass door and now has quite a bad cut on his nose :( He said that the manager of the hotel was more interested in cleaning up the blood off the floor than helping him with a plaster.

So, here I am back in the UK and what awaits me in the office? The usual? Well, in reality I suppose the answer is yes, in so far as there is nothing ‘usual’ about our office… and so the usual is the ‘unusual’ most of the time….. Tim Uglow decided to bring his two Samoyeds’ into the office… Thanks to Matt for letting me use his photo….

Tim Uglow's Samoyeds' by Matt Johnson

The FAT File System and PrePay Credit Cards

January 21st, 2008

I’m sure that if you’ve read the title for this entry you’re most confused as to what the FAT file system has to do with PrePay Credit Cards. I have to admit that if I were in your position I would also be confused, indeed I have now confused myself in an attempt to see if there are any similarities, the answer to which I have concluded to be that there are none, other than perhaps they are both mentioned in this entry and have already taken up far too much space - having successfully distracted me totally from the originally point of this blog entry.  Good Oh!

I suppose I ought to explain. Last week I decided, in my infinite wisdom, that it might be a good idea to get one of these ‘PrePay Credit Card things’ that seem to be taking off. The idea is very simple. You buy a card (Visa, MasterCard or Maestro) and top it up with money online, via another credit/debit card, in the post office, or using top-up points in shops. Having done this you go out and spend all your money in places where normal debit cards are not accepted - one such example being hotel and flight reservations etc. As far as everyone who views and uses the card is concerned you’ve got a bog standard, normal credit card… as far as you’re concerned it’s the best credit card ever as you don’t have to pay anything back!

I think there are a number of focus groups for these cards. Those people with poor credit history who can’t get a credit card. Those people who don’t want a credit card - but need an alternative for paying for hotels, flights, hire cars etc, and teenagers who want a more ‘modern’ way of dealing with their pocket money/paper round wages. Personally I decided that getting one of these cards would be an excellent way to sort out my hotels and stuff in France without having to increase my real credit card limit - and so far I have been most impressed. My only gripe with the card that I got (but this could just be a Virgin Money thing) is that, instead of having embossed numbers it has printed numbers meaning that the card says “ELECTRONIC USE ONLY” on the front in small letters. Basically this means the card can’t be used in one of those old machines where they used to take a carbon copy of your card. Ah well, gone are the good old days I suppose.

Anyway - enough about PrePay cards. I spent this weekend programming some more stuff for MouthOS. Specifically I fixed a few bugs in my floppy disk driver (which now fully supports writing and reading of whole disk sectors) and started to implement my FAT file system driver.

I was truly amazed at how easy it was to start writing a FAT driver. Microsoft have for once (and I thought I would never ever say this) done something right and released a lovely (well, fairly good) document (found here)  which details  everything you could ever want to know about the FAT file system. Whilst FAT may be a bit antiquated nowadays it’s a nice simple file system that people writing Operating Systems can easily and quickly adapt so they don’t have to (initially) think about designing their own file system. Furthermore, because GRUB supports the FAT file system it means that you don’t have to go through all the hassle of partitioning a floppy disk into a FAT and a “MouthFS” partition… for the moment anyway.

Anyway. It’s now getting on a bit and I fear that if I don’t get to bed soon I shall have trouble getting up in the morning. Until my next post I bid you all good bye…

Sun to become the M in LAMP…

January 16th, 2008

Sun have today announced that they are buying MySQL AB, the company behind MySQL for $1 billion. This is both good news for Sun and for MySQL - not to mention all those MySQL users (including myself). MySQL will become a much more commercially viable product with Sun’s backing - reaching companies that previously wouldn’t have gone near it whilst at the same time it reaffirms Sun’s position as a leading provider of web technologies.

You can read more about the acquisition of MySQL on Jonathan Schwartz’s Blog and also on MySQLs and Sun’s websites!

OS Development: Video Memory and putchar…

January 15th, 2008

Well folks, as promised here is my next exciting installment of the ‘OS Development’ series!

Continuing on from my last post, ‘OS Development: Where to start?’, I’m now going to go over some simple things such as implementing a simple putchar(char c) function which you can then use to implement your printf function. This, apart from my boot-loader, was the first thing I developed in MouthOS. It’s a really good place to start as once you’ve got it sorted you can start printing out debug information such as stack traces, the CPU registers etc.

So, onto the theory! In order to put stuff on the screen you’re going to need to have access to the video memory. On the x86 architecture the video memory is found between 0×000A0000 and 0×000C7FFF. It is split up as follows:

0×000A0000 - 0×000BFFFF: Video RAM Memory.
0×000B0000 - 0×000B7777: Monochrome Video Memory (multiple pages).
0×000B8000 - 0×000BFFFF: Colour Video Memory (multiple pages).
0×000C0000 - 0×000C7FFF: Video ROM Memory.

To begin with the simplest thing to do would be to use the monochrome video memory. However, this is a bit boring as you may want to highlight things in different colours etc. As such the best place to start is to write to the Colour Video Memory.

When writing to the Colour Video Memory you should note that for every character you need two bytes worth of data. The first byte is the character to be displayed and the second is the colour to be used. To start with I just created a header file (video.h) with all my colours and video memory locations defined as below.

 	video.h
	/* Colours are defined as FOREGROUND_BACKGROUND */
	#define BLACK_WHITE             0×0
	#define BLUE_BLACK              0×1
	#define GREEN_BLACK             0×2
	#define CYAN_BLACK              0×3
	#define RED_BLACK               0×4
	#define MAGENTA_BLACK           0×5
	#define BROWN_BLACK             0×6
	#define GRAY_BLACK              0×7
	#define DARK_GRAY_BLACK         0×8
	#define BRIGHT_BLUE_BLACK       0×9
	#define BRIGHT_GREEN_BLACK      0xA
	#define BRIGHT_CYAN_BLACK       0xB
	#define PINK_BLACK              0xC
	#define BRIGHT_MAGENTA_BLACK    0xD
	#define YELLOW_BLACK            0xE
	#define WHITE_BLACK             0xF
	/* Locations for Video Memory. */
	#define VIDEO_MEM_RAM	0x000A0000
	#define VIDEO_MEM_MON	0x000B0000
	#define VIDEO_MEM_COL	0x000B8000
	#define VIDEO_MEM_ROM	0x000C0000
	/* Define the maximum rows and columns available on screen. */
	#define X_MAX	80
	#define Y_MAX	25
	/* Functions in video.c that the rest of the kernel is allowed to use. */
	extern void init_video(void);
	extern void cls(void);
	extern void setcolour(int _colour);
	extern void putchar(const char c);

With that done I started to implement my functions. The first one was the init_video(void) function. The aim of this function was two fold. Firstly it was to gain access to the video memory via a pointer and secondly it was to clear the contents of the video memory (as all the BIOS and/or GRUB loading information is still in video memory). On the whole this is a really simple function…

	video.c
	#include “video.h”

	unsigned char vidmemptr*;
	int colour, crsx, csry;	

	void move_csr(int _x, int _y);

	void init_video(void) {
		vidmemptr = (unsigned char *) VIDEO_MEM_COL;
		colour = WHITE_BLACK;
		cls();
	}

With this completed the next step was to implement the cls(void) function to clear the video memory. This simply involved moving along the entire video memory setting the characters to be equal to ‘ ‘ and the colour to be the currently selected colour (in this case WHITE_BLACK)…

	void cls(void) {
		int i;
		int j = Y_MAX * ( X_MAX * 2 );
		for ( i = 0; i < j; i++ ) {
			vidmemptr[i] = ' ';
			i++;
			vidmemptr[i] = colour;
		}

		move_csr(0, 0);

	}

As can be seen this still won’t compile as the function move_csr(int _x, int _y) still doesn’t exist. This function is used to position the cursor to a specific x, y co-ordinate. It is very simple in my implementation below, simply checking that the given values are not out of bounds of the screen and then setting csrx and csry. However in my full implementation in MouthOS it also sets the blinking cursor and calls another function ’scroll’ to scroll the text up the screen. Unfortunately adding the implementation of these functions to this blog entry would make it twice it’s current size - perhaps for my next entry I’ll go over implementing these extra functions. However for now here is a simple move_csr(int _x, int _y) function.

	void move_csr(int _x, int _y) {
		if ( _x <= X_MAX && _y <= Y_MAX ) {
			csrx = _x;
			csry = _y;
		}
	}

Having implemented move_csr there are two functions left. The first is the setcolour(int colour) function. This is a simple ’setter’ function…

	void setcolour(int _colour) {
		colour = _colour;
	}

Leaving the function you’ve all been waiting for - putchar(const char c)

	void putchar(const char c) {

		int position =  ( csrx * ( X_MAX * 2 ) ) + ( csrx * 2);
		int i;

		if ( c == '\n') {

			move_csr(0, csry + 1);
		} else {
			vidmemptr[position] = c;
			position++;
			vidmemptr[position] - colour;
			move_csr(csrx + 1, csry);
		}

	}

From here there are many places you could branch to. I implemented a scroll() function to scroll the text up as the screen got full. This also required me to implement a memcpy(src, dest, size) function. I also made some modifications to the move_csr(int _x, int _y) function to move the blinking cursor to where the text was appearing and I then went on to write printf(fmt, args) which required the implementation of the va_start, va_arg and va_end macros. As they say the sky is the limit.

MouthOS gains a RSOD as France Approaches…

January 13th, 2008

I’ve not had much chance recently to work on MouthOS or to write anything on my blog as I’ve been busy getting prepared for my trip to France at the end of the month. However, I’ve now finally booked my Euro Star tickets (at a very reasonable price of 49.00 return) and my hotel - “Hotel De L’exposition - Tour Eiffel”.

With this done I’ve spent some time this weekend working on MouthOS and I’ve made some excellent progress. I’ve written a new printf function which complies with the ANSI C standard (which also included implementing variable length argument function macros). I’ve also managed to get MouthOS to identify how much RAM a system has - putting me well on the way to finishing my memory manager.

However, the highlight has got to be the new “RSOD” or Red Screen of Death! Since I’ve now got a good printf I was able to start printing out the status of the CPU registers etc, and this has lead to the ability to add a lot of debug information to my panic() function…

MouthOS Red Screen of Death

Don’t worry folks - you shouldn’t see this too often. Also it should be noted that the exception was caused by a deliberate division by zero at the end of main() to test the panic function… I’m not that bad a coder - honestly!

	printf("\n   --> Low Memory:   %iK", _LOW_MEM);
	printf("\n   --> High Memory:  %iK\n", _HIGH_MEM);

	int i = 6 / 0;

Anyway, I think it’s time for an episode of ‘Allo ‘Allo before bed.

Student Interviews

January 4th, 2008

Today we had the first face-to-face interview with the new students. The interview is split into three sections. The first is conducted by Paul Humphreys and David Cole. It lasts for about 45 - 60 minutes and focuses on questions relating more to the students past technical experience.

After this one of the current students (this time me) takes the interviewee for a tour of the labs. This lasted about 30 - 40 minutes and is a great opportunity for the student being interviewed to ask questions and get a (if brief) overview of what the job really involves. The student is shown the production cage, the overflow lab and then the main lab.

When the tour is completed the interviewee returns to the office for another chat with Paul and David - this time regarding the Sun Ray technology (as is requested that they research when they are invited for a face-to-face interview) and also a few networking questions etc.

I have to admit that I spent a lot of the time during the tour trying to remember what my interview and tour was like. I was hoping to remember some of the cool things that I really liked so that I could show this guy (who also happened to be called Daivd) the stuff that really made me go ‘wow’. In the end I got the feeling that he really liked the high-end servers - specifically the 25K and the M9000+.

All in all it was quite a different experience being the interviewer as opposed to the interviewee!

Happy New Year!

January 1st, 2008

Happy New Year everyone!

To all those people who still haven’t received a text from me - I’ve been trying since 12… unfortunately, as I suspected, the mobile phone network is congested… now had they used products from Sun they would have been able to deal with the load :)

Thus far I have received one Happy New Year text from David Cole. It arrived pretty much spot on 12 - I can only assume that he, being the clever person he is, sent the text a couple of minutes before the rush - cunning! A trick to remember for next year indeed.

I wish everyone a Happy New Year :)

My Crash - Good news at last!

December 28th, 2007

As many of you will know, in June 2007 I was unfortunate enough to have a quite bad car crash. We were on our way to Go Karting as a end of exams trip and a guy in a red Fiesta drifted across the road and hit my car head on at a combined speed of about 100MPH. Fortunately everyone was (is now) okay from the accident. This accident in turn caused a smaller shunt further down the road. I promised in my old blog that I’d put up some photos of my car after the incident, however I never did - so I’ve included them now.

My Car Crash My Car Crash My Car Crash

Ever since then there have been legal battles between a whole host of people who all claimed that it wasn’t their fault. At the same time, the police investigation (which had six months allowance to be concluded) was crawling along. At the end of November (26th to be precise) I was informed at last that the guy in the red Fiesta was to be taken to court on the charge of ‘driving without due care and attention’.

This court hearing took place on the 19th December at 9.30am at Aberystwyth Magistrates Court and I’ve finally heard from the Police that he pleaded guilty! This is excellent news as it now means two things:

  • His claim that I was the cause of the accident to his insurance company is invalid (otherwise why would be plead guilty?)
  • My insurance company will finally pay out my excess and give me back my no claims.

Overall a pretty good day.