You are on page 1of 3
;Assembly program that will get the sum and average of 3 numbers. clr macro mov ax, 03h int 10h endm pe macro a mov ah, 02h mov dl, a int 21h endm cseg segment para ‘code’ assume cs:cseg; ds:cseg; ss:cseg; es:eseg org 100h start: jmp begin >—f_num db ? s_num db ? tinum db? n_suml db? n_sum2 db ? tavel db? t_ave2 db? begin: clr mov ah, O1h int 21h sub al, 30h mov f_num, al mov ah, 01h int 21h sub al, 30h mov s_num, al mov ah, 01h int 21h sub al, 30h mov t_num, al mov al, f_ num add al, s_num add al, t_num mov ah, 0 mov n_sumt, al mov bl, 3 divbl mov t_avel, al mov t_ave2, ah emp n_suml, 10 jae sum2d add n_sum1, 30h pe n_suml jmp ave_p sum2d:mov ah, 0 mov al, n_sum) mov bl, 10 div bl add al, 30h add ah, 30h movn_sum1, al ave_p: pc'" add t_avel, 30h pet_avel pe'r’ add t_ave2, 30h pe t_ave2 int 20h cseg ends end start < € € x \_s we - t » ’ ;Assembly program that will input three digits and will arrange it from highest to lowest. clr macro mov ax, 03h int 10h endm @rdchar macro num mov ah, O1h int 21h sub al, ‘0° mov num, al endm @prtchar maeng nun add num, ‘0’ mov ah, 02h mov dl, num int 2Th endm cseg segment para ‘code’ assume es:eseg; ds:cseg; ss:eseg: es:cseg org 100h start: jmp begin fno db ? sno db ? tno db? begin: clr @rdchar fno @rdchar sno @rdchar tno first: mov al, fno cmp al, sno jbexl second: mov al, fno cmp al, tno jbex2 third: ex2: ex3: pnext: exit: mov al, sno cmp al, tno jbex3 jmp pnext XCHG al, sno mov fno, al jmp second XCHG al, tno mov fno, al jmp third XCHG al, tno mov sno, al mov ah, 02h mov dl,'' int 21h @prtchar fro @prtehar sno. @prtchar tno int 20h cseg ends end start comp bx, ax je BACK2 BACKI: ine tdigit cmp tdigit, 10 jne BACK_BRIDGE sAssembly program that will find a decimal three it digit numbers which are equal to the sum of the cmp sdigit, 10 cubes of their digits. From 100 to 999. jne BACK_BRIDGE clr macro mov sdigit, 0 mov ax, 03h ine fdigit int 10h cmp fdigit, 10 endm jne BACK_BRIDGE seg segment para ‘code! jmp EXIT assume cs:cseg; ds:cseg; ss:cseg; es:cseg org 100h BACK BRIDGE: jmp BACK start: jmp begin si faigit dw 1 BACK2: mov dx, fdigit sdigit dw 0 add dl, 30h tdigit dw 0 mov ah, 02 result dw ? int 21h : mov dx, sdigit begin: clr eee add ai, 30h back: mov bx, 0 7 mov ah, 02h mov ax, fidigit int 21h mov cx, fdigit mov dx, tdigit mul ex add dl, 30h mul cx mov ah, 02h mov bx, ax. int 21h mov ax, sdigit mov ab, 02h mov ex, sdigit mov dl, 10 mul ex int 2th mul ex imp BACK! add bx, ax mov ax, tdigit EXIT: int 20h mov ex, tdigit cseg ends mul ex end start mul ex add bx, ax mov ax, faigit mov ex, 100 mul ex mov result, ax mov ax, sdigit mov cx, 10 mul ex add ax, result add x, tdigit

You might also like