music
OSdata.com: assembly language 

OSdata.com

Assembly Language

program control and condition codes/flags

summary

    This web page examines program control instructions in assembly language. Specific examples of instructions from various processors are used to illustrate the general nature of assembly language.

free computer programming text book project

If you like the idea of this project,
then please donate some money.

more information on donating

Google

Now building a For those with high speed connections, the very large single file summary is still on line.

program control

    Program control instructions change or modify the flow of a program.

    The most basic kind of program control is the unconditional branch or unconditional jump. Branch is usually an indication of a short change relative to the current program counter. Jump is usually an indication of a change in program counter that is not directly related to the current program counter (such as a jump to an absolute memory location or a jump using a dynamic or static table), and is often free of distance limits from the current program counter.

    The pentultimate kind of program control is the conditional branch or conditional jump. This gives computers their ability to make decisions and implement both loops and algorithms beyond simple formulas.

    Most computers have some kind of instructions for subroutine call and return from subroutines.

    There are often instructions for saving and restoring part or all of the processor state before and after subroutine calls. Some kinds of subroutine or return instructions will include some kinds of save and restore of the processor state.

    Even if there are no explicit hardware instructions for subroutine calls and returns, subroutines can be implemented using jumps (saving the return address in a register or memory location for the return jump). Even if there is no hardware support for saving the processor state as a group, most (if not all) of the processor state can be saved and restored one item at a time.

    NOP, or no operation, takes up the space of the smallest possible instruction and causes no change in the processor state other than an advancement of the program counter and any time related changes. It can be used to synchronize timing (at least crudely). It is often used during development cycles to temporarily or permanently wipe out a series of instructions without having to reassemble the surrounding code.

    Stop or halt instructions bring the processor to an orderly halt, remaining in an idle state until restarted by interrupt, trace, reset, or external action.

    Reset instructions reset the processor. This may include any or all of: setting registers to an initial value, setting the program counter to a standard starting location (restarting the computer), clearing or setting interrupts, and sending a reset signal to external devices.

condition codes

    Condition codes are the list of possible conditions that can be tested during conditional instructions. Typical conditional instructions include: conditional branches, conditional jumps, and conditional subroutine calls. Some processors have a few additional data related conditional instructions, and some processors make every instruction conditional. Not all condition codes available for a processor will be implemented for every conditional instruction.

    Zero is mathematically neither positive nor negative, but for processor condition codes, most processors treat zero as either a positive or a negative numbers. Processors that treat zero as a positive number include the Motorola 680x0 and Motorola 68300.

    Digital Equipment Corporation’s “VAX Architecture Reference Manual” gives the following example of the CASE instruction using the VAX PASCAL compiler (quoted under the fair use doctrine):

    case i of
        32:         x := sin(x);
        33:         x := cos(x);
        34:         x := exp(x);
        35:         x := ln(x);
        36, 37:     x := arctanh(x);
        otherwise   x := reserved
    end

          casel   i, #32, <#37-32>
    1$:   .word   sin - 1$      ; Selector is 32.
          .word   cos - 1$      ; Selector is 33.
          .word   exp - 1$      ; Selector is 34.
          .word   ln - 1$       ; Selector is 35.
          .word   arctanh - 1$  ; Selector is 36.
          .word   arctanh - 1$  ; Selector is 37.
    otherwise:
          movl    reserved, x   ; Selector is less than.
                                ; 32 or greater than 37

Now building a For those with high speed connections, the very large single file summary is still on line.

free music player coding example

    Programming example: I am making heavily documented and explained open source PHP/MySQL code for a method to play music for free — almost any song, no subscription fees, no download costs, no advertisements, all completely legal. This is done by building a front-end to YouTube (which checks the copyright permissions for you).

    View music player in action: www.musicinpublic.com/.

    Create your own copy from the original source code/ (presented for learning programming). Includes how to run this from your own computer if you don’t have a web site.


OSdata.com is used in more than 300 colleges and universities around the world

Read details here.

Some or all of the material on this web page appears in the
free downloadable college text book on computer programming.


return to table of contents
free downloadable college text book

view text book
HTML file

Because I no longer have the computer and software to make PDFs, the book is available as an HTML file, which you can convert into a PDF.


    A web site on dozens of operating systems simply can’t be maintained by one person. This is a cooperative effort. If you spot an error in fact, grammar, syntax, or spelling, or a broken link, or have additional information, commentary, or constructive criticism, please e-mail Milo. If you have any extra copies of docs, manuals, or other materials that can assist in accuracy and completeness, please send them to Milo, PO Box 1361, Tustin, CA, USA, 92781.

    Click here for our privacy policy.


previous page next page
previous page next page

home page

two levels up

special topics

one level up

peer level

free computer programming text book project

Building a free downloadable text book on computer programming for university, college, community college, and high school classes in computer programming.

If you like the idea of this project,
then please donate some money.

send donations to:
Milo
PO Box 1361
Tustin, California 92781

Supporting the entire project:

    If you have a business or organization that can support the entire cost of this project, please contact Pr Ntr Kmt (my church)

more information on donating

Some or all of the material on this web page appears in the
free downloadable college text book on computer programming.


I do the news as an unpaid volunteer for KOCI 101.5 FM, Newport Beach/Costa Mesa (also available on the web)


Google

Made with Macintosh

    This web site handcrafted on Macintosh computers using Tom Bender’s Tex-Edit Plus and served using FreeBSD .

Viewable With Any Browser


    Names and logos of various OSs are trademarks of their respective owners.

    Copyright © 2000, 2001, 2010 Milo

    Created: February 21, 2001 (from machcode.htm)

    Last Updated: November 30, 2010


return to table of contents
free downloadable college text book

previous page next page
previous page next page