You are on page 1of 1

multus32 proc near push di,push si push bp,mo v di, dx,mo v si, ax,mul bx push ax,push dx,mov ax,

di,mul bx push ax,push dx,mov ax, si,mul cx,push ax push dx,mo v ax, di,mul cx,mov si, ax, pop di,pop ax,pop cx,pop bp,pop bx,add bx, bp, adc cx, 0,adc dx, 0,add bx, ax,adc cx, 0 adc dx, 0,add cx, di,adc dx, 0,add cx, si adc dx, 0,pop ax,pop bp,pop si,pop di ,ret multus32,endp cseg ends end

.model small,,.stack,,.data,,Masc a,,dw,,0Fh correct,,dw,,3,,valcor,,dw,,4,,rez,,dw,,2 dup (?) .code,,binbcd proc push cx,,push bx,,mo v cx, 16,,xor dx, dx,,xor bx, bx bucla1: shl ax, 1,,rcl dx, 1,,rcl bx, 1,,cmp cx, 1,,jz et2,,push cx mov cx, 4,,mo v masca, 0Fh,,mo v corect, 3,,mov valcor, 4 bucla2: push cx,mov cl, 4,push dx,and dx, masca,cmp dx, valcor jbe et1,pop dx,,add dx, correct,push dx,et1:pop dx shl masca, cl,shl corect, cl,shl valcor, cl,,pop cx, loop bucla2pop cx,loop bucla1,et2:mov ax, dx,mov dx, bx,pop bx,pop cx,ret,binbcd,endp,start: mov ax, @data,mov ds, ax,mov ax, 0ffffh,call binbcd mov re z, ax,mov re z[2], dx,mov ax, 4C00h,int 21h end start

; pla51.asm - media aritmetica a unor cuvinte (16 biti) cu semn Date,,,segment,,,word,,,public,,,'data' Op,,,dw,,,8000h, 8000h, 8000h, 8000h, 8000h Lung,,,equ,,,($-op)/2 Result,,,dw,,,2 dup (0) dateends prog,,,segment,,,word,,,public,,,'code'assume,,,cs: prog, ds: date,,start:mov ax,date,,mo v ds,ax,,lea bx, op,,mov cx , lung,,call medie,,mov rezult, dx,,mov rezult[2 ], ax,, mov ax,4C00h,,int 21,,,medie,,,proc,,,near jcxz gatam,,push bx,,sub ax, ax,,sub dx, dx,,push cx, ,add_cuv:,,cmp word ptr [bx], 0,,js adun_neg,,add ax, [bx], ,adc dx, 0,,jo depasire,,,jmp cuv_ urmator,,adun_neg:,, add ax, [bx],,adc dx, 0ffffh,,jo depasire ,,,cuv_urmator:,, add bx, 2,,loop add_cuv,,pop cx,,idi v cx,,pop bx,,,clc,,gatam:ret,, depasire:,,stc,,add sp, 4,,ret,,medie,,endp,,prog,,ends stiva,,segment,,stack,,'stack',,dw 100 dup(?),,stiva,,ends,,end start

; pla57.asm - insumare a valorilor de tip cuvant dintr-un sir Date,,,segment word public 'data' sir dw,,,0cde4h,0543ah,08765h,0efh,043h,100,1000 lung_sir equ ($-sir)/2 rezult dw 2 dup (0)date,,ends prog,,,segment,,,word,,,,public,,,'code',,assumecs: prog, ds: date, ss: stiva start:mov ax, date,,mov ds, ax,,mov ax, 0,,mov bx, 0,,mov si, 0 mov cx,lung_sir,,jcxz gata,,reia:add ax, sir[si],,jnc urm,,inc bx urm:add si, type sirloop reia,,gata:mov re zult, ax,,mov re zult[2], bx mov ax, 4c00h,,int 21h,,prog,,,ends,,stiva,,,segment,,, word,,,stack,,,'stack',,,dw,,,100 dup (?),,,stiva,,,ends,,,end,,,start ; pla52.asm - adunarea a doua numere intregi pe 32 de biti, cu semn, Date,,,segment,,,word,,,public,,,'data',,op1,,,dw,,,8000h, 0ffffh op2,,,dw,,,8000h, 0ffffh,,result,,dw,,,2 dup (0),,mes_err,,,db,, ,date,,,ends,,prog,,,segment,,,word,,,public,,,'code' assume,,cs: prog, ds: date,,start:mov ax,date,,mov ds,ax mov bx, op1,,mov ax, op1[2],,mov dx, op2,,mov cx, op2[2],,c all adds32, ,jc afis_err,,mo v rezult, dx,,mo v re zult[2], cx,,jmp gatap,,afis_err: lea dx, mes_err,,mov ah, 9,,int 21h,,gatap:mo v ax,4C00h,,int 21h comp,,,macro,,,not lowreg,,add lo wreg, 1,,not highreg,,adc highreg, 0,, endmadds32,,,proc,,,near,,push ax,,push bx,,push cx,,or cx, ax, ,pop cx,,js negative ,,add dx, bx,,adc cx, ax,,jmp gata,,test ax, cx,, jns opuse,,comp ax, bx,,,comp cx, dx,,add dx, bx,,adc cx, ax, ,jo gata,,jmp reface,,add dx, bx,,adc cx, ax,,clc,,jmp iesire,, reface:comp cx, dx,,gata:stc,,jo iesire,,clc,,iesire:pop bx,, pop ax,,ret,,adds32,,,endp,,prog,,,ends,,stiva,,, segment,,,stack,,,'stack',,dw 100 dup(?),,stiva,,,ends,,end start ; pla82a.asm - conversie valoare (0-15) din binar in hexazecimal (ASCII) (binhex) Date,,,segment,,,,word,,,,public,,,'data',,val,,,,db,,,09h,,re z,,,db,,,?mes_dep,, ,db,,,'EROARE: depasire de format (AL >15)!!!', 0Dh, 0Ah, '$',,date,,,ends prog,,,segment,,,word,,,public,,,'code'assume,,,cs: prog, ds: date start:mov ax,date,,mov ds,ax,,mov al, val,,call binhex,,jc tip_mes_dep mov re z, al,,mov dl, al,,mo v ah, 2,,int 21h,,jmp gatap,,tip_mes_dep: lea dx, mes_dep,,mo v ah, 9,,int 21h,,gatap:mov ax,4C00h,,int 21h binhexproc,,cmp al, 9,,ja litera,,add al, 30h,,ret,,litera:cmp al, 15 ja eroare,,add al, 37h,,ret,,eroare:stc,,ret,,binhex,,,endp,,prog,,,ends stiva,,,segment,,,stack,,,'stack',,dw 100 dup(?),,stiva,,,ends,,end start ; pla91.asm - concatenarea a doua siruri (concat) Date,,,segment,,,word,,,public,,,'data'sir2,,,db,,,'-cel de-al doile a sir de concatenat' lung2,,,equ,,,$-sir2,,,db,,,0Dh, 0Ah, '$',,,sir1,,,db,,,lung1,,,equ,,,,$-sir1 loc_sir2 db,,0Dh, 0Ah, '$',,db,,,(lung2-3) dup(?), 0Dh, 0Ah, '$'mesaj,, db,,0Dh, 0 Ah, 'Sirurile concatenate sunt:', 0Dh, 0Ah, '$',,,date,,,ends prog,,,segment,,,word,,,public,,,'code',,assume,,,cs: prog, ds: date start:mov ax,dat,,mov ds,ax,,lea dx, sir1,,mov ah, 9,,int 21h,,lea dx, sir2,,mov ah, 9 int 21h,,le a di, sir1,,mov bx, lung1,,lea si, sir2,,mo v cx, lung2 , ,push ds,,pop es,,call conca,,jz gatap,,lea dx, mesaj,,mov ah, 9,,int 21h lea dx, sir1,,mov ah, 9,,int 21h,,gatap:mo v ax,4C00h,,int 21h concat,,,,proc,,,,ne ar,,jcxz iesire,,cmp bx, 0,,je iesire mov dim2, cx,,mo v off1, di,,add di, bx ,,cmp si, di,,je gata conc:cld,,rep movsb,,sub di, dim2,,mo v si, di,,add bx, dim2 gata:mov di, off1,,mov cx, dim2iesire:ret,,concat,,endp,,prog,,ends stiva,,segment,,stack,,'stack',,dw 100 dup(?),,stiva,,ends,,end start

You might also like