Tuesday, 6 November 2007
Typical Assembly language instructions :
Typical Arithmetical operations (and their Op Codes) :
Addition : Add
Subtraction : Sub
Multiplication : Mul
Division : Div
Addressing Modes
- Register Addressing : If data is transferred from a source register to a destination register.
- Immediate Addressing : Where the data appears immediately after the op code, as part of th instruction.
- Direct Addressing : When the operand refers to a specific memory location.
- Indirect Addressing : When the operand takes a specific memory location, and refers it to where actual data can be found.
- Indexed Addressing : A number contained in one register is combined with another to point to the actual location.
Assembly Language
The four parts are :
- Label
- Op Code
- Operands
- Comments
An example of these in operation would be :
- Label - Start:
- Op Code - mov
- Operands - bx,80h
- Comments - ;Load Character Count
The label is used as a reference and is useful when calculating relative jumps, for example. The operation code contains the mnemonic (a mnemonic to MOVe data) which describes the operation being carried out. The operands describe the source and destination of the data to be operated on. The comments are only to help the programmer.
Thursday, 18 October 2007
PHP
PHP is a powerful server-side scripting language for creating dynamic and interactive websites
Variables in PHP are used to store values, like text,numbers or arrays. A variable which has been stored can be used over and over again.
Variables in PHP start with "$"
- $variable_name = value;
With PHP, a variable doesn't have to be declared as "string" or "int" as PHP can identify what type a variable is when it is called.
---
Friday, 5 October 2007
Task 29
a) 0000 0001 0100 0111.
Mantissa : 0000 0001 01
Decimal : 0.000000101
Decimal : 0.101000000
Exponent : 000111 = 7 in denary.
To get back to the original we must move the decimal point 6 places to the left.
So, I subtract 6 from the current exponent.
The new Exponent becomes : 000001
Putting this back together, I get :
0101000000000001
b) 0000 0111 0000 1011
Mantissa : 0000 0111 00
Decimal : 0.000011100
Decimal 0.111000000
Exponent : 001011 = 11 in denary.
To get back to the original mantissa, we must move the decimal place 4 places to the left.
Therefore, I need to subtract 4 from the Exponent, leaving me with 7.
The new Exponent : 000111
Putting this back together, I get :
0111000000000111
Task 27
Step 1 : 11.125 in binary is 1011.001
Step 2 : Mantissa : 0001011.001
Step 3 : 2s complement : 1110100.111
Step 4 : Normalised Form : 1.001110000
Step 5 : The decimal place needs to be moved 2 places to the
left.
Step 6 : The exponenent : 111110
Step 7 : 1001 1100 0011 1110
Task 26
Step 1 : 8.5 in binary is : 1000.1
Step 2 : Mantissa : 000001000.1
Step 3 : 2s complement : 111110111.1
Step 4 : Normalised form : 1.011110000
Step 5 : Needs to be moved 4 places to the left.
Step 6 : The exponent is therefore 111100 = -4
Step 7 : The final answer is : 1011 1100 0011 1100
Thursday, 4 October 2007
Task 25
Step 1 : The number is negative because it starts with a 1.
Step 2 : The mantissa is : 1.011111111
Step 3 : The mantissa in Negative Binary : -(0.100000001)
Step 4 : The exponent is negative because it starts with a 1.
Step 5 : Exponent = 111111. Negative Binary = -(000001)
Step 6 : The decimal point in the mantissa must now be moved
1 place to the left.
Step 7 : The mantissa now becomes : -(0.0100000001)
Step 8 : The mantissa stays the same : -(0.0100000001)
Step 9 : Denary : 0.250976562
Task 24
Step 1 : This number is negative because it begins with a 1.
Step 2 : Mantissa : 1.010011010
Step 3 : -(0.101100110)
Step 4 : The exponent is : 000111 = 7
Step 5 : The decimal point must now be moved 7 places to the
right.
Step 6 : New Mantissa : -(01011001.10)
Step 7 : Removing unnecessary 0's : -(1011001.1)
Step 8 : Denary : -(89.5) or simply -89.5
Task 23
Step 1 : It begins with a 1
Step 2 : The mantissa is : 1.010110000
Step 3 : Negative Binary : -(0.101010000)
Step 4 : The exponent is : 000011
Step 5 : Decimal Point must be moved 3 places to the right.
Step 6 : The mantissa now becomes : -(1010.110000)
Step 7 : Removing unnecessary zeros gives : -(1010.11)
Step 8 : Denary : -(10.75) or simply -10.75
Task 22
Step 1 : 4.0 in binary : 100
Step 2 : Mantissa : 00100
Step 3 : 2s Complement : 11100
Step 4 : Normalised : 111.00
Step 5 : Proper Normalised : 1.0000
Step 6 : Decimal place needs to be moved 4 to right to get the pre-normalised form.
Step 7 : The exponent is therefore : 100
Step 8 : Final answer : 10000100
Task 21
Step 1 : 1.5 in binary : 1.1
Step 2 : Mantissa : 0001.1
Step 3 : 2s Complement: 1110.1
Step 4 : Normalised : 111.01
Step 5 : Proper Normalised : 1.0100
Step 6 : The decimal point needs to be moved 1 place to the
right
Step 7 : Exponent is : 001
Step 8 : 10100001
Task 20
Step 1 : The number begins with a 1.
Step 2 : Mantissa : 1.0011
Step 3 : Mantissa as Negative Binary : -(0.1101)
Step 4 : Exponent = 111
Step 5 : The decimal place in the mantissa must now be moved 1 place to the left.
Step 6 : New Mantissa : -(0.01101)
Step 7 : Removing extra 0's : -(0.01101)
Step 8 : Denary : -(0.40625) or simply 0.40625.
Task 19
Step 1 : It begins with a 1.
Step 2 : 1.0111
Step 3 : -(0.1001)
Step 4 : 010
Step 5 : The decimal point in the mantissa must now be moved
2 places to the right.
Step 6 : New Mantissa : -(010.01)
Step 7 : Removing 0's : -(10.01)
Step 8 : Denary : -(2.25) or simply -2.25.
Task 18
Step 1 : Converting 2.75 gives us 10.11
Step 2 : 0.101100000
Step 3 : The decimal place needs to be moved 2 places to the right.
Step 4 : 000010
Step 5 : Final Floating-Point number : 0101 1000 0000 0010
Task 17
Step 1 : 12.5 as a fixed-point number is 1100.1
Step 2 : 0.110010000
Step 3 : Needs moved 4 places to the right.
Step 4 : 000100
Step 5 : 0110 0100 0000 0100
Task 16
Step 1 : The first bit is a 0.
Step 2 : 0.100000000
Step 3 : The first bit is a 1.
Step 4 : -3
Step 5 : 3 places to the left.
Step 6 : 0.000100000000
Step 7 : 0.0001
Step 8 : 1/16
Task 15
Step 1 : The first bit is a 0.
Step 2 : 0.110000110
Step 3 : The first bit is a 0.
Step 4 : 6
Step 5 : The decimal place must be moved 6 places to the right.
Step 6 : 0110000.110
Step 7 : 110000.11
Step 8 : 48.75
Task 14
Step 1 : The first bit is a 0.
Step 2 : 0.111101000
Step 3 : The first bit is a 0.
Step 4 : Denary Equivalent : 5
Step 5 : The Decimal place must be moved 5 places to the right.
Step 6 : 011110.1000
Step 7 : 11110.1
Step 8 : 30.5
Task 13
Step 1 : 1.1
Step 2 : 0.1100
Step 3 : 1 Place to the right.
Step 4 : 001
Step 5 : 01100001
Task 12
Step 1: 10.01
Step 2: 0.1001
Step 3: 2 Places to the right
Step 4: 010
Step 5: 01001010
Task 11
Step 1 : The first bit is a 0.
Step 2 : The Mantissa: 0.1110
Step 3 : Negative because it starts with a 1
Step 4 : Denary Equivalent of 111 = -1
Step 5 : The Decimal Place must be moved 1 place to the left because the Exponent = -1
Step 6 : Mantissa: 0.01110
Step 7 : New Mantissa: 0.0111
Step 8 : Final Denary Value: 0.475 or 7/16
Wednesday, 3 October 2007
Task 10
Step 1 : I know this because the left most bit is 0
Step 2 : Mantissa : 0.1100
Step 3 : It starts out with a 0.
Step 4 : 011 = 3 in Denary
Step 5 : The deimal place must be moved 3 places to the right.
Step 6 : Mantissa : 0110.0
Step 7 : New Mantissa :110
Step 8 : Final Number : 6
Task 8 + 9
a) 01111100 : 7 1/2
b) 00000100 : 1/2
c) 11000001 : 24 1/8
Task 9. Convert these denary numbers into binary using the fixed-point numbering system:
a)4.75 : 00100110
b)10.5 : 01010100
c)7.25 : 00111010
d)1.125 :00001001
Task 6 + 7
a)10001 : -15
b)11000 : -8
c)00010: 2
d)01000 : 8
e)11110 : -2
f)01110 : 13
Task 7. Convert the following 7 bit 2s complement binary numbers into decima;. Show your working.
a) 1000100 : -60
b) 1011000 : -40
c) 0110001 : 49
Task 4 - 5
a) -4
11100
b) -11
10101
c) -2
11110
Task 5- Using the above method and showing your working, convert
a)-12 into a 2s complement number
11100
b)-14 into a 2s complement number
11110
c)-1 into a 2s complement number
11111
Tasks 1-3
a) What is the weighting of each bit?
[-4],[2],[1]
b) What is the largest number that can be represented?
3
c) What is the smallest number?
-4
Task 2: Suppose you had 7 bits to represent 2s complement number.
a) What is the weighting of each bit?
[-64],[32],[16],[8],[4],[2],[1]
b) What is the largest number that can be represented?
63
c) What is the smallest number?
-64
Task 3: How would you represent:
a)4
00100
b) 8
01000
c) 11
01111
Tuesday, 18 September 2007
Review Questions
that is used to design, configure, and code an application.
a. Toolbox
b. Code Editor
c. IDE
d. Output window
2. A window that can be dragged to any location on the screen is a
_______________ window.
a. docked
b. floating
c. hidden
d. visible
3. The main window that is displayed when you start Visual Studio .NET is
the _______________ .
a. Start Page
b. Options dialog box
c. Visual Basic .NET editor
d. Designer window
4. Many of the settings that affect the IDE can be modified from the
_______________ dialog box.
a. Design
b. Open Project
c. Options
d. Edit
5. If Auto Hide is turned on for a window and the mouse pointer is not in
that window, the window will be shown as a(n) _______________ on the
side of the IDE.
a. tab
b. button
c. list
d. icon
6. A console application is different from a Windows application because it
runs or executes in a _______________ window.
a. Designer
b. DOS-style
c. Form
d. Property
7. The naming convention that uses a capital letter for each significant word
in the name is called _______________.
a. Pascal-casing
b. Camel-casing
c. Hungarian Notation
d. Class-casing
8. Which of the following is not a type of project that can be created in
Visual Studio .NET?
a. Visual C# Projects
b. Visual Basic Projects
c. Visual C++ Projects
d. Visual D+ Projects
9. The small white squares that appear on all four corners and sides of a
selected form are called _______________.
a. sizing handles
b. dragging handles
c. control squares
d. sizing squares
10. Code that should run when an event is raised for an object should be
placed in a(n) ________________.
a. object handler
b. method
c. event handler
d. property
11. Visual Studio .NET is part of the Visual Basic .NET suite of programming
languages and tools. True or false?
False
12. Dynamic Help will display appropriate Help topics depending on what
you are doing in the Visual Studio .NET IDE. True or false?
True
13. The Toolbox, Output window, Start Page, and Solution Explorer are all
part of the Visual Studio .NET IDE. True or false?
True
14. The Auto Hide All item on the Window menu is used to “unpin” all windows
at the same time. True or false?
False
15. IntelliSense is the ability of Visual Studio .NET to create the forms you
need for your project after you have typed the code. True or false?
True
16. The Window menu is the menu that is used to locate the windows
that make up the Visual Studio .NET IDE.
17. The most commonly used toolbar in Visual Studio .NET is the
Toolbox toolbar.
18. The default location used to save your projects, in addition to other settings,
can be configured in the Options dialog box.
19. The Visual Studio .NET window that displays a list of the files and references
in a Visual Basic .NET project is called Solution Explorer.
20. A grouping of projects in Visual Studio .NET is called a(n)
Data Source.
Monday, 17 September 2007
Freemind...

Sunday, 16 September 2007
The Petrol Pump Design
So, the name of the company is "Peters Petrol Pumps" which, when you think about it, is an awful name for a company. For this company to have success, it needs to have a catchy name and playing on the basic english technique of alliteration isn't a successful name. K-Fox or something, is much better.
But, on with the designs.
There will be two basic displays needed for this program, or two forms in Visual Basic. One will be for the customer, the other will be for Peter Pumpkin who'll need to check how much money his Petrol Pumps are raising, never mind his Diesel Pumps. So, first off, we have the customers petrol pump, which needs to display the amount being put into the car, the amount it costs for the amount they've put in, and the cost per litre.
The form, should look something like this :

Then, we have Peters Form, which has to display, the total for the day and the amount of money made per day :

More design information will be posted in the next few days.
Peters Petrol Pumps
This took a few hours to get working sucessfully for numbers up to and including "999" but the program still had a few bugs (Such as, if the user was to enter "1000", the display would only show "100" and the end 0 would be dropped off.) which have yet to be fixed.
It would be pretty easy to get it working for a fourth digit, but the coding that goes into this is a bit clumsy and instead of just expanding on it so that the program can work with numbers up to 9999, I'm still working on getting a shorter amount of code to be able to cope with any number which is inserted into the program rather than the numbers I have set aside.
The reason we've been working on this LCD Display program was for the build up to the Module 3 resit paper which requires you to create a program for a petrol station and the display has to be an LCD one.
Computing AS/A2 Page:
http://www.aqa.org.uk/qual/gceasa/comp.php
This is the coursework/program which I'll be looking at over the next few months.
Tuesday, 11 September 2007
Part 5 : Adding a Title Bar
So, open Visual Basic, and open your website project.
So, from the tool bar, scroll down through the toolbox and go to Menus & Toolbars, what we're looking to add is a Menu Strip.
Drag it onto the form and you'll be greeted with an extra slot at the top of your page which allows you to create a menu like you're used to seeing in all your usual applications.
I'll add a "Close Program" command and a Back And Forward navigation to the application and leave the rest for you.
So, in your menu bar, put the tags you want in but, make sure you include "Close", "Back" and "Forward" in there somewhere.
Coding for "Close"
The Code for ending an application is really simple, and can be done by simply putting "End" in your code somewhere. Because we want the program to close when "Close" is clicked, what you do is, double click on your "Close" command tag in your Form and it will again bring you to the code of your program. Just type in End and that is all. Now, when End is clicked, the program will exit.
Going Back
Going back is coded quite similiar to Close in that, all you have to do is type one line of code in the "Back" section. So, Double Click on Back and it will take you to the code section. All you have to do is type :
Now, when Back is clicked, your browser will go back a page.

Going Forward
Going forward is the exact same as going backwards exact that in the ".GoBack" tab, you type ".GoForward". Now you've got a browser which can go back and forward pages like every other browser.

That's all for now, next I'll show you how to create a bar at the bottom which shows the complete URL of the page you're visiting.
Making A Web Browser Pt4
Part 4 : Coding
So, we're ready to start. This should be the hardest part but to create a working web browser in Visual Basic, it's ridiculously easy.
We have to think about what we want this browser to do:
- User Types in URL
- User Presses Go
- Page Loads
So, really, it's only when the user presses go that the program does something.
What we're looking to do therefore, is insert our program instructions into the Go button. In Visual Basic, this is done by double clicking the item which we are looking to code for. Now, there are other ways to do this, but, this is the easiest way in this situation. So, double click "Go" which is still referred to "Button1" within the program.
You should be greeted with a page of code. This is where your entire program is run from!
If you look closely, it says "Button1_Click". This means that whatever you type inside this section will run when Button1 is Clicked. So, we want (if you've kept the item names the same) Webbrowser1 to navigate to the address typed in Textbox1.
This is done by typing in :

This code, when we analyse it isn't that complicted. With Visual Basic, if you type a controls name (I.E : WebBrowser1), and press ".", it will bring up a list of controls within that item. You'll notice this when you type in WebBrowser1 yourself and you'll see a lot of other useful expressions which this item can perform (GoBack for example will help if you want to go back a page.).
Navigate makes the browser go to a page and whatever you type in the brackets is the page it goes to. If we wanted the browser to go to a set page, we could have typed in "www.google.com" and the browser would have went to Google everytime we pressed go but because we wanted the Browser to go to whatever URL which was typed in the textbox, we type "TextBox1.Text".
Simple... Now, run your browser and see what happens when you type a URl and press go.
Making a Web Browser Pt3
Part 3 : Clean-up and Prep.
So,at this stage, we have our interface for which we'll build the Web Browser. Next up, I'm going to clean up some of the smaller things so that the browser is easy to use .
Click on the Web Browser component (Titled : WebBrowser1) and look at the properties window on the right. Find the tag called "Anchor", and change it so that the top, bottom, left & Right are greyed out. This means that when the browser is resized, the page will resize too.

Next, you can change the "Text" in the button box so that it says "Go" so that the user will know to hit go when they've typed in the URL.
Next up I'd advise that you resize and move your text box and stuff about the page so that you're happy with what you have. Then we can move on to coding.
Browser Ready to be Coded :
Making A Web Browser Pt2
Part 2 : Layout
So, you've opened up Visual Basic and you've created the project that will become your web browser.Before I start, I recommend 'pinning' the toolbox open because we'll be using it quite a bit.
Drag and drop a text box onto your form and place it where you want.
Now we need to drag our Go button onto the page.It's basically just a button so what we use is a 'Button'.
Next up, we do what is in theory a hard part, but, Visual Basic makes dragging a web utility onto a page easy. What you do is, drag a "Web Browser" onto the page. As mentioned before, all these items are found on the toolbar, and the Web Browser is found at the bottom of the "common controls" section.
Next up, we'll look at how we code this program, in the mean-time though, I'll show you how to clean up some of the little problems that you might want to fix after you finish creating the browser.
Making A Web Browser
Part 1 : What's Needed?
I'm going to create a webbrowser using Visual Basic 2005 Express Edition which is free to download and use.
This is the step by step guide on how to do it.
So, open up Visual basic 2005 and we'll get started.
Click on Create : Project on the left side of the program and create a windows application.
Then, you'll be shown the form which will become your program in design view. The visual basic suites are good to use because they allow you to create programs and applications with ease.
Have a play around with some of the properties in the right window to see what they do.
I.E : Change the name of your form to something which you can relate to, like Frm1 (but, for the sake of this post, I'm going to leave everything the default name it is given.
So, first off, we need to work out what is needed in a basic web browser.
- Address Bar.
- Go Button.
- Page Display.
I'll show you how we're going to start in the next post.
Wednesday, 5 September 2007
Tables
So, continuing on form where I left off, over the past few days I've been learning HTML and now, past the more basic <b> code, I'm onto more difficult stuff which I'll mention in this post...
Because this blog uses html, when I try and post a command it automatically converts it so for that reason, I'm going to use Notepadd++ and take screenshots whilst I'm explaining what I am doing.
Tables
To create a table using HTML you use the <table> syntax:
The image above shows you of some of the table commands which help distinguish between headings, row and cells.
I'll continue with another post as I work on ...
Tuesday, 4 September 2007
Mondays Class and Revision
Some of the stuff I learnt was that :
- HTML files are Text files.
- They give the browser commands i.e:
Bold Italic and Underlined text.- BUT, they need to be closed using commands, i.e:
More commands are :
- Line Breaks which put text onto a new line
- Paragraph makes text take a new paragraph.
Also in the class, we worked on Notepad++, which is just like Notepad only it has far more functions and support for coding.
HTML Codes:

Links :
http://www.w3schools.com/html/html_examples.asp
http://www.w3schools.com/html/tryit.asp?filename=tryhtml_basic
http://www.w3schools.com/html/html_quiz.asp
http://sourceforge.net/projects/notepad-plus/
Sunday, 2 September 2007
Right so...
Coursework blog.
Here.
:)
Q: Can we post some random stuff on here as well (I.E : Windows is Lethal, Linux isn't.)
A: Yes.
:D




