Featured post

About the DCGLUG

images images (1)

DEVON AND CORNWALL GNU/LINUX USER GROUP


The Devon and Cornwall GNU/Linux User Group is for anyone who uses – or is interested in using – Free, Libre and Open Source Software.

The group is made up of a wide range of people from home users to professionals and between us we have a wide range of experience and knowledge.

Please feel free to join our discussion mailing list, or chat with us on IRC (chat). The Torbay meetings are now part of the Raspberry Pi jams as these are arranged by members.

 

raspberry_pi_logo android

Updates:

Basic OS development with Visual Studio

Recently I came across an add-on for Visual Studio 2013 named Cosmos, which lets you use C# or Visual Basic to develop a fully independent OS. I have been working on one now for a couple of weeks. Sadly, Cosmos is still in early development stages, but it is still possible to make basic graphical OS’s. This post uses C#, but it is just as easy to use Visual Basic. My current code is:

using System;
using System.Collections.Generic;
using System.Text;
using Sys = Cosmos.System;
using Cosmos.Hardware;
using Cosmos.Hardware.BlockDevice;
 
namespace CosmosOS
{
    public class Kernel : Sys.Kernel
    {
        protected override void BeforeRun()
        {
            while (true)
            {
                Run();
            }
        }
 
        protected override void Run()
        {
            string input = Console.ReadLine();
            string input1 = input.ToLower();
            if (input1 == "shutdown" || input1 == "quit" || input1 == "exit") Shutdown();
            else if (input1 == "reboot" || input1 == "restart" || input1 == "reload") Reboot();
 
            else Console.WriteLine("Command \"" + input1 + "\" not recognized!");
        public void Shutdown()
        {
            this.Stop();
            Cosmos.Core.Bootstrap.CPU.Halt();
        }
        public void Reboot()
        {
 
        }
        public static void WriteData(byte[] aData, ulong block)
        {
            if (BlockDevice.Devices.Count > 0)
            {
                for (int i = 0; i < BlockDevice.Devices.Count; i++)
                {
                    var xDevice = BlockDevice.Devices[i];
                    if (xDevice is Partition)
                    {
                        xDevice.WriteBlock(block, 1, aData);
                    }
                }
 
            }
 
        }
        public static byte[] ReadData(ulong block)
        {
            byte[] aData = new byte[] { 1 };
            if (BlockDevice.Devices.Count > 0)
            {
                for (int i = 0; i < BlockDevice.Devices.Count; i++)
                {
                    var xDevice = BlockDevice.Devices[i];
                    if (xDevice is Partition)
                    {
                        aData = xDevice.NewBlockArray(1);
                        xDevice.ReadBlock(block, 1, aData);
                    }
                }
 
            }
            return aData;
        }
    }
}

Lets go over some of this code.

protected override void BeforeRun()
        {
            while (true)
            {
                Run();
            }
        }

This Run function is looped by default anyway, but it loops slightly faster when this code is put in BeforeRun.

 

protected override void Run()
        {
            string input = Console.ReadLine();
            string input1 = input.ToLower();
            if (input1 == "shutdown" || input1 == "quit" || input1 == "exit") Shutdown();
            else if (input1 == "reboot" || input1 == "restart" || input1 == "reload") Reboot();
 
            else Console.WriteLine("Command \"" + input1 + "\" not recognized!");

This is fairly trivial code for a command-line OS, simple input.

 

public void Shutdown()
        {
            this.Stop();
            Cosmos.Core.Bootstrap.CPU.Halt();
        }
        public void Reboot()
        {
 
        }

This is my own shutdown code. I have yet to figure out reboot, though.

 

public static void WriteData(byte[] aData, ulong block)
        {
            if (BlockDevice.Devices.Count > 0)
            {
                for (int i = 0; i < BlockDevice.Devices.Count; i++)
                {
                    var xDevice = BlockDevice.Devices[i];
                    if (xDevice is Partition)
                    {
                        xDevice.WriteBlock(block, 1, aData);
                    }
                }
 
            }
 
        }
        public static byte[] ReadData(ulong block)
        {
            byte[] aData = new byte[] { 1 };
            if (BlockDevice.Devices.Count > 0)
            {
                for (int i = 0; i < BlockDevice.Devices.Count; i++)
                {
                    var xDevice = BlockDevice.Devices[i];
                    if (xDevice is Partition)
                    {
                        aData = xDevice.NewBlockArray(1);
                        xDevice.ReadBlock(block, 1, aData);
                    }
                }
 
            }
            return aData;
        }

I got this code from a forum and modified it a little to make it work – it writes arrays of bytes to the hard disk. Sadly the built-in FAT fileystem can currently only read files, so you will have to make your own.

 

This is a fun tool to just play around with, although it is extremely limited at the moment.

Windows 3.1 in Dosbox

Last night I decided to have a go at seeing if Windows 3.1 would run in dosbox. Surprisingly it does, and pretty quick too, you need to download the dos mouse driver and run that before starting windows but other than that it works.  The install was pretty quick too.

DOSBOX

Windows 3.1 running in DOSbox

I copied the folder i have all my dosbox items in over to the pi and tried this on that,  you need to run dosbox through x in order for the keyboard to work properly (or it seems by default you do) so this slows things down,  dosbox will run without X but the keyboard mapping was seriously messed up,

I guess this being a more proof of concept idea as I am not really sure what I would need windows 3.1 for,  mind you there was an excellent periodic table program with decay trees for elements which was pretty good.   Kinda out if date now as since then we have discovered and named more elements, and named beyond their initial Latin numerical names.

Raspberry Pi jam July 14 – Torbay

 

For anyone who missed out today,  we had another great pi jam,  Big thank you to those that turned up and the 4 young people who also made it.

Again today was a good mix,  Tom demonstrated his latest project: a face with a built in  webcam that can track a coloured ball using OpenCV!  This uses both Raspberry Pi and Arduino.

SAM_0204

Video

 

One of the young people showed me the fg and bg commands, so my pi-liter project can now run but be put in the background,  while it runs.  I showed him the cowsay command, and one of the other young people got cmatrix working.  These young people are uber L337.

I attempted to install Skype from Ubuntu software centre,  failed,  tried to download and then tell the installer to run through software centre,  that failed,  so just used dpkg and it worked fine without problems! I put a few notes on my website about this.

We could now do with more monitors and Pis, so we can get more people set up with Pis.  I think we may have a few laptops at a future jam.

 

Torbay Pi jam July 14

For anyone who missed out today,  we had another great pi jam,  Big thank you to those from the Lug that turned up and the 4 young people who also made it.

Again today was a good mix,  tom demonstrated his latest project a face with a built in webcam that can track a coloured ball using open CV,  this uses both Raspberry Pi and Arduino.

SAM_0204

Video

One of the young people showed me the fg and bg commands, so my pi-liter project can now run but be put in the backgroiund,  while it runs.  I showed him the cow say command, and one of the other young people got cmatrix working.

I attempted to install scratch from ubuntu software centre,  failed,  tried to download and then tell the installer to run through software centre,  that failed,  so just used dpkg  worked fine without problems.