{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

HW5_S10 Solutions

# HW5_S10 Solutions - CmpE 102 Homework 5(Spring 2010...

This preview shows pages 1–3. Sign up to view the full content.

CmpE 102 – Homework 5 (Spring 2010) – SOLUTIONS Chapter 6 Problems 1. Write code for the following conditional jump conditions: a. Jumps to label L1 if either bit 4, 5, or 6 is set in the BL register. test bl, 01110000b jnz L1 b. Jumps to label L1 if bits 4, 5, and 6 are all set in the BL register. push bx and bl, 01110000b cmp bl, 70h pop bx jz L1 c. Jumps to label L2 if AL has even parity. or al, al jpe L2 d. Jumps to label L3 if EAX is negative. cmp eax, 0 jl L3 e. Jumps to label L4 if the expression (EBX – ECX) is greater than zero sub ebx, ecx -or- cmp ebx,ecx cmp ebx, 0 jg L4 jg L4 2. Analysis the following code, and determine its function and justify sizes of equates and variables shown in the code: KEY = 239 ; can be any byte value BUFMAX = 128 .data buffer BYTE BUFMAX +1 DUP(0) bufSize DWORD BYTE BUFMAX .code mov ecx,bufSize ; loop counter mov esi,0 ; index 0 in buffer L1: xor buffer[esi],KEY ; translate a byte inc esi ; point to next byte loop L1 The code encrypts all the data in the 128-byte buffer with the KEY value.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
For example, 1 0 0 0 1 0 0 0 =
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 3

HW5_S10 Solutions - CmpE 102 Homework 5(Spring 2010...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online