Find the answer to your Linux question:
Results 1 to 3 of 3
!BITPATTERN = 0xAB01CDFF .global main main: save %sp, -96, %sp set BITPATTERN, %l0 clr %l1 ! checkpoint 1 sll %l0, 24, %l2 add %l2, %l1, %l1 ! checkpoint 2 srl ...
  1. #1
    Just Joined!
    Join Date
    Oct 2009
    Posts
    1

    What does the following assembly language script do?

    !BITPATTERN = 0xAB01CDFF
    .global main
    main:
    save %sp, -96, %sp


    set BITPATTERN, %l0

    clr %l1 ! checkpoint 1


    sll %l0, 24, %l2
    add %l2, %l1, %l1 ! checkpoint 2

    srl %l0, 8, %l2
    sll %l2, 24, %l2
    srl %l2, 8, %l2

    add %l2, %l1, %l1 ! checkpoint 3


    srl %l0, 16, %l2
    sll %l2, 24, %l2
    srl %l2, 16, %l2
    add %l2, %l1, %l1 ! checkpoint 4


    srl %l0, 24, %l2
    add %l2, %l1, %l1 ! checkpoint 5

    ret
    restore

    In unix..using sparc
    What does ths assembly language script do? I am a beginnerr..and I have no clue plz help me understand this

  2. #2
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    You take a sheet of paper and draw a table on it.
    On the rows you put the line numbers and the columns are the registers and variables.

    Then you look up what every single line does to the registers and write in your table what the contents of the registers are after execution of each line.

    When you reach the last line, you will understand what the program does.
    Debian GNU/Linux -- You know you want it.

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    This is sparc assembly language. Get the Sun/Sparc assembler documentation to find out what this does. You can probably download or access it from Sun's web site.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...