Difference between revisions of "CSC231 Exercises with conditional jumps"

From dftwiki3
Jump to: navigation, search
(Characters and lower/upper case conversion)
(Scanning an array)
Line 16: Line 16:
 
Find the '''largest''' element of a 1-dimensional array of '''signed double-words'''.  
 
Find the '''largest''' element of a 1-dimensional array of '''signed double-words'''.  
  
Same question, but with  '''unsigned double words'''.
+
Same question, but with  '''unsigned double-words'''.
 
 
  
 
==Characters and lower/upper case conversion==
 
==Characters and lower/upper case conversion==

Revision as of 09:22, 15 October 2012

Exercises on Conditional Jumps

Finding the minimum

Find the minimum of 3 signed int variables a, b, and c

Loop until overflow

Print fibonacci numbers coded as unsigned words until the result overflows. Don't print erroneous numbers!


Scanning an array

Find the largest element of a 1-dimensional array of signed double-words.

Same question, but with unsigned double-words.

Characters and lower/upper case conversion

The program makeUpper.asm transforms all characters in a string to uppercase, but will also transform other characters that are not letters.

Modify the program so that it modifies only characters between 'a' and 'z' included.

Characters and lower/upper case conversion. Version 2

Use a boolean function that returns true or false depending on whether the character it receives is lowercase or not.

Long/short jumps

Conditional jumps can jump only +127 bytes down, -128 bytes up in the code. How can we code something like this:

                 cmp     eax,10
                 jl      there
                 ...
                 ...
        there:   ...


when the instruction at Label there is 1000 bytes away from the jl conditional jump?