Tuesday, 6 November 2007

Assembly cntd...

Typical assembly language instructions:
Made up of
  • Arithmetical instructions.
  • Logical instructions like 'AND', 'OR' and 'NOT'.
  • Rotate instructions.
  • Bit set or reset instructions.

    Examples:

    [add] [al,bl] - [;Add bl to al and store the result in al]
    [sub] [ax, 08h] - [;Subtract 8 (hex) from ax and store the result in ax]
    [mul] [bl] - [;al is multiplied by bl and stored in ax]
    Note: ax is double the width of al and bl
    [div] [cx] - [;The dx-ax register pair is divided by the cx with the quotient being placed in the ax register and the remainder being placed in the dx register]

  • Assembly Language

  • Second generation low-level language
  • Consists of four parts: [Label]-[Op Code]-[Operands]-[Comments]
    eg [Start:]-[mov]-[bx,80h]-[;Load character count]
  • Label: Used as a reference and good for calculating relative jumps.
  • Operation Code: Contains mnemonic which describes operation.
  • Operands: Describe source and destination of the data to be operated on.
  • Comments: Used for convenience of programmer. Helps readability.
  • Advantages: Can be quicker than some high level languages.
    - can access registers and exact memory addresses.

    Addressing Modes:

  • Register addressing
    - Data is transferred from a source register to a destination register
    ----
  • Immediate addressing
    - The data to be addressed is in the op code.
    ----
  • Direct addressing
    - Data is copied from a specified location in memory to the register.
    ----
  • Indirect addressing
    - Uses a number inside the register to point to location in memory.
    ----
  • Indexed addressing
    - Number within a register is used in combination with another number in another register to point to a location in memory.
    ----
  • Monday, 22 October 2007

    PHP

    Basics:

    The PHP portion of code looks like this:
    < ? php
    ? >


    Each line of code is ended with " ; "

    To declare a variable with PHP you declare it as you need it. This is done with a " $ "

    Example: $txt = "Hello World!";
    PHP will automatically assign the variable a type: string, integer etc.

    Putting a (.) into a line of code will concat two variables. Example:
    < ? php
    $txt1="Hello World";
    $txt2="1234";
    echo $txt1 . " " . $txt2;
    ? >

    The output of the code above will be:

    Hello World 1234


    Other Functions:
    Strlen: finds string length
    echo strlen("Hello world!");
    Strpos: finds specified string in another string:
    < ? php
    echo strpos("Hello world!","world");
    ? >
    The output of the code above will be: 6

    Wednesday, 17 October 2007

    Petrol Pumps (ticking display)

    To get the ticking display to display the numbers in order instead of from left to right, I had to make sure the display always used three digits in processing. I used this code:

    totalvalues = totalvalues + 1
    Label1.Text = totalvalues

    If Label1.Text.Length = 1 Then
    Label1.Text = ("00") + Label1.Text
    ElseIf Label1.Text.Length = 2 Then
    Label1.Text = ("0") + Label1.Text
    End If

    Where "Label1" is the value of the petrol and it is this value to be displayed.
    (this is on the tick event of the timer).

    Monday, 15 October 2007

    Binary worksheets.

    Examples:

    2's Complement: If first digit is "1", the number it represents is negative.

    E.G: [4 2 1]
    2's = 1 0 1 This means that the first digit in the binary represents -4.

    This equation will be (-4) + 1 = -3

    Mantissa and exponent:

    A one-byte floating point numbering system uses 5 places for the mantissa and 3 for the exponent. Convert the number 01100011 into decimal by filling in the following table :

    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

    Normalising:
    A two-byte floating-point numbering system uses 10 places for the mantissa and 6 for the exponent. Convert the number -8.5 into a normalised floating-point number by filling in the following table:

    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

    Tuesday, 18 September 2007

    VB.NET PG58

    Review Questions:

    1. The IDE is the working area provided by Visual Studio .NET
    that is used to design, configure, and code an application.

    2. A window that can be dragged to any location on the screen is a
    Floating window.

    3. The main window that is displayed when you start Visual Studio .NET is
    the Start Page .

    4. Many of the settings that affect the IDE can be modified from the
    Options dialog box.

    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) Tab on the
    side of the IDE.

    6. A console application is different from a Windows application because it
    runs or executes in a DOS-style window.

    7. The naming convention that uses a capital letter for each significant word
    in the name is called Class Casing.

    8. Which of the following is not a type of project that can be created in
    Visual Studio .NET?
    d. Visual D+ Projects

    9. The small white squares that appear on all four corners and sides of a
    selected form are called Sizing handles.

    10. Code that should run when an event is raised for an object should be
    placed in a(n) Event Handler.

    11. Visual Studio .NET is part of the Visual Basic .NET suite of programming
    languages and tools. True or false?

    12. Dynamic Help will display appropriate Help topics depending on what
    you are doing in the Visual Studio .NET IDE. True or false?

    13. The Toolbox, Output window, Start Page, and Solution Explorer are all
    part of the Visual Studio .NET IDE. True or false?

    14. The Auto Hide All item on the Window menu is used to “unpin” all windows
    at the same time. True or 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?

    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 Save all 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 Sources.

    Monday, 17 September 2007

    Mind Map

    We made some mind maps summarising the chapter in our text books dealing with Programming languages, basically, the differences and features of High level and Low level languages.



    Sunday, 16 September 2007

    Petrol Pumps

    We started on the petrol pumps course work. I had to make a 7 segment LCD. I did this using case statements and a user controlled text box.
    Case 1
    img1.visible = true (etc.)


    After I had got that working, i tried to add in more screens for the display, showing more numbers. So far, I have got it working but the code is very bulky as it uses different case statements for each number. I figure this could be done by creating a new number display as it is needed using arrays. i am still trying to figure that out.

    I have created an image of what I think the console and display of the petrol pumps program should look like, here:

    Wednesday, 12 September 2007

    More VB Browser stuff.

    I was tasked with adding a few more features to the browser. Mainly, adding a second form that I could use to control the webbrowser object in the first form. To do this, I added a new form and had it load up along with the first form in the first forms Form_load event.

    Linking forms



    To link up the two forms and control one form from the other, I used FormName.control.property.

    This would semd values and events from one form to the other. This way, a "remote" form could be used to control my browser.


    Another thing I did was remove the border from the second form and use the TransparencyKey property to round it off. That property uses a color shown in the form and makes in invisible.

    ---Click







    Tuesday, 11 September 2007

    We just started into Visual Basic a couple of days ago. I am already fairly familiar with the environment and workspace of the program.
    We were asked to create a web browser. Here are the basic steps to create a basic browser:
    1. Open a new project in Visual Basic.





    2. Name the file and save.
    3. Add a few features to the form:

    • Text Box (for the user to enter a web address)
    • "Go" button.
    • Web Page frame.
    • Status Bar accross bottom.







      --Other Browser Stuff--


      I have been experimenting with a few different features that could be added to a browser.
      One of these has been the idea of "tabbed browsing". By adding extra WebBrowser windows layered on top of each other and made to switch out using ".visible" properties, I have found a really basic way of doing this.
      I am still experimenting and intend on trying to use arrays to make more tabs "on the fly" instead of having them set in the browser from the start.

      Wednesday, 5 September 2007

      HTML Further revision

      HTML tags can have format properties held within the tag;

      • "bgcolor",
      • "Font Color",
      • "Width/Height"
      • "Align"

      Another tag is the "OL" tag. This creates an ordered list. It should look like this:

      <ol>
      <li>List Item 1
      <li>Item 2
      </ol>

      Forms have a name and a value. The name defines the object in the html document and the value is whatever the user inputs into the form. These are sent to the server as (e.g) Username="...".

      Types of form: <INPUT TYPE="Text/Password/Radio/Submit/Reset">

      Tables

      Tuesday, 4 September 2007

      HTML tags

      Tags and effects:
      • <.br> - line break: the following text is moved to a new line.
      • <.title> - page title: the text within the tags is used for the text in the title bar of the explorer.
      • <.h1> -- <.h6> - headers: creates a header on the page, size getting smaller as the numbers increase.
      • <.hr> - horizontal rule: creates a separation line on the page.
      • < .p> - paragraph: text within the tags is grouped into and formatted into a paragraph.
      • <.body> - body of the page: the main part of the html (the main part of the page)
      • <.!--comments--> - comments: used to create comments within the code.
      • <.a href="..."> <./a> - anchor: creates link to new page, href="..." is the url of the page.
        ~ anchor points can be used to locate a specific part of a page. For example, to create an anchor point on a page you use <.a name="example"> Example <./a>
        Then, to locate this in a url, you use '#' and the 'name' of the section: <.a href " www. . .com # example " > (no spaces).
        ~ also, adding target = "_blank" will cause the link to open in a new explorer window.

      <<-- click...


      1. I used Notepad++ to write up a HTML page in text.
      2. Tried some types of forms, text entries and radio buttons.
      3. Listed some tags I didn't know before.

      Monday, 3 September 2007

      HTML/XHTML

      -Revise[d] html/xhtml on http://www.w3schools.com/ for test: Friday.
      -Have to get memory stick!!

      Sunday, 2 September 2007

      Done!

      OK, blog is set up.
      *Note to self...* grab a memory stick.
      Got the books and stuff needed for computing.