Q4a.txt - TITLE My First Program(Test.asm INCLUDE Irvine32.inc.data array SWORD 30 DUP result SWORD 0 temp SWORD.code main proc call randomize;activate

Q4a.txt - TITLE My First Program(Test.asm INCLUDE...

This preview shows page 1 - 2 out of 2 pages.

TITLE My First Program (Test.asm) INCLUDE Irvine32.inc .data array SWORD 30 DUP(?) result SWORD 0 temp SWORD ? .code main proc call randomize ;activate the seed mov ecx,15 mov esi, 0 L1: mov eax,100 call randomrange ;Generate random no in range of 0-100 as defined in eax. sub eax,55 mov [array+esi],ax mov ax,[array+esi] call WriteInt add esi,2 Loop L1 mov ecx,15 mov esi, OFFSET array call sumODD call Crlf mov ax,result call WriteInt exit main ENDP sumODD proc
Image of page 1

Subscribe to view the full document.

Image of page 2

Unformatted text preview: cmp ecx,0 ; check counter value je L2 mov eax,0 mov ax,[esi] cmp ax,0 JGE pos JL negi negi: mov ax,[esi] cwd mov temp,ax mov dx,0 mov bx, 2 idiv bx cmp dx, 0 je L3 mov ax,temp add result,ax add esi,2 dec ecx jmp rec pos: mov temp,ax mov dx,0 mov bx, 2 div bx cmp dx, 0 je L3 mov ax,temp add result,ax add esi,2 dec ecx jmp rec L3: add esi,2 dec ecx jmp rec rec: call sumODD L2 : ret sumODD ENDP END main...
View Full Document

  • Fall '19

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes