;************************************** ;addsub.asm ;This program uses a procedure to add ;and subtract several pairs of data ;************************************** stk segment stack dw 16 dup(?) stk ends data segment x1 db 75 ;first two numbers y1 db 23 add1 db ? ;first two results sub1 db ? x2 db 117 ;second two numbers y2 db 65 add2 db ? ;second results sub2 db ? data ends code segment assume cs:code,ds:data main proc far push ds ;bookkeeping sub ax,ax push ax mov ax,data mov ds,ax ;end bookkeeping ;add and subtract x1 and y1 mov al,x1 mov ah,y1 call addsub mov add1,cl mov sub1,ch ;add and subtract x2 and y2 mov al,x2 mov ah,y2 call addsub mov add2,cl mov sub2,ch ret main endp addsub proc near ;********************************** ;adds and subtracts two numbers ;al must contain the first number ;ah must contain the second number ;sum will be in cl ;difference will be in ch ;********************************** mov cl,al add cl,ah mov ch,al sub ch,ah ret addsub endp code ends end main