quiz حل الأسئلة الجامعية manage_search الأرشيف

تم الحل ✓
categoryهندسة الحاسبات schoolبكالوريوس event_available2026-07-15

السؤال

Transcribed Image Text:

***** ******* Q3.Write an assembly program to find the average of 20 numbers byte array defined in the data segment, and then define two different macros. The first one will take the average value found as input and check all the array to put all the numbers less than the average in new array name it below_arr The second macro will take the average value found as input and check all the array to put all the numbers larger than the average in new array name it larger_arr. 005 Avg db ? 006 sum dw ? 007 below arr db? 008 009 010 011 012 .code 013 014 015 larger arr db? LEN DW $-My_Num start up test1 macro below 016 017 mov ax, data 018 mov ds, ax 019 020 LEA SI,My_Num 021 022 023 024 025 026 L1: 027 828 029 030 031 032 833 834 035 836 837 838 839 940 041 642 MOU CX 20 LEA DI be low_arr Local L1, L2, L3, finish Mov al, be low cmp [sil, al JGE L2 JC L3 L2: inc si loop L1 jmp finish L3 Mov dl, Isil Mov [DI], dl inc si inc di I 043 844 045 046 Loop Li 3,14,15,16,17,18,19,20 820 finish: nop 849 050 endn 051 852 second macro_2 053 054 test2 macro large 055 856 057 058 LEA SI My Num 059 MOU CX.20 060 061 062 063 064 065 066 867 LEA DI, larger_arr Local LL1, LL2, LL3, done, finis LL1 nov al, large cmp al. [SI] JG LL3 JNGE LL2 868 I 069 870 LL3: loope LL1 071 jmp finis 072 873 LL2: 074 Mov al, [si] 875 076 877 Mov [DI 1.al inc si inc di 078 829 loope LL1 888 881 finis: nop 882 883 884 885 886 endn 887 088 889 898 nov ax, data 991 nov ds, ax 992 403 Tos i M.. N.m inc di 878 879 loope LL1 080 081 finis: nop 882 083 084 085 086 endm 087 088 089 090 mov ax, data 091 mov ds, ax 092 093 lea si, My_Num 094 mov cx, 20 095 mov dh .0 096 097 L1: Mov D1, [SI] 898 Add sum,dx 099 inc si 100 Loop Li 101 102 Mov AX, sum 103 Mov bx, 20 104 div bl 105 mov avg, al 106 107 test2 avg 108 mov bl, avg 109 testi bl 110 111 end T

check_circle الجواب — حل مفصل خطوة بخطوة

hourglass_top