Exercise 4            Name       _____________________    Points ___/21

Translate the following from C++ fragments to corresponding structured Assembler. Assume that eAx, eBx, eCX, eDX are the normal register definitions, i , j and sum are defined as double words. Use the i/o commands in the Irvine libraries.

1. (3)    if (ieAx) {
            eAx++;
            cout << eAx;
          }
 
 
 
 

2. (5)    if (ieAx) {
            eAx--;
            cout << eAx;
          }
          else {
            eAx++;
            cout << eAx;
          }
 
 
 

3. (3)    while (eAx ≠ 1) {
            eAx = eAx / 4;
            cout << eAx;
          }
 
 
 
 

4. (5)    for (i=0; i≤10; i++)
            for (j=10; j≥7; j--) {
                eDx = i*j;
                cout << eBx;
            }
 
 
 
 
 
 

5. (5)    sum = 0;
          do {
            cin >> eAx;
            if (eCx ≤ 0)
                eAx = -eAx;
            sum = sum + (5*eAx);
          while (eAx ≠ 0);


Document last modified: