Bms/ece/manuals/AMP

Manual for Advanced Microprocessor Lab for 5th semester

Some simple programs
title compare 8 bit or 16 bit and display result suitably .model small .data num1 dw 0013h num2 dw 0013h .code mov ax,@data mov ds,ax mov cx,num1 mov bx,num2 cmp cx,bx jz equal mov ax,0000h jmp stop equal:mov ax,0001h stop:int 3 end

title add a block of 8 bit binary numbers .model small .data num db 67h,76h,86h res dw ? .code mov ax,@data mov ds,ax mov bx,offset num mov cl,03h mov ax,00h back: add al,[bx] adc ah,00h inc bx      dec cl       jnz back mov res,ax int 3 end

title add a block of 8 bit BCD numbers .model small .data num db 67h,76h,86h res dw ? .code mov ax,@data mov ds,ax mov bx,offset num mov cl,03h mov ax,00h back: add al,[bx] daa adc ah,00h inc bx       dec cl        jnz back mov res,ax int 3 end

title add a block of 16 bit binary numbers .model small .data num dw 2367h,0f76h,4586h res dw ? .code mov ax,@data mov ds,ax mov bx,offset num mov cl,03h mov ax,00h mov dx,00h back: add ax,[bx] adc dx,00h inc bx       inc bx        dec cl        jnz back mov res,ax mov res+1,dx int 3 end

Block Transfer With or Without Overlap
title block transfer with or without overlap .model small blk_len equ 0ah source equ 0010h destin equ 0015h .data nums db 01h,02h,03h,04h,05h,06h,07h,09h,0ah,0bh .stack 50 .code start: mov ax,@data mov ds,ax mov si,00h mov cx,blk_len load: mov dl,nums[si] mov source[si],dl inc si       dec cx        jnz load mov si,source mov di,destin mov cx,blk_len cmp si,di jc bot_trf top_trf: mov al,[si] mov[di],al inc si         inc di          dec cx          jnz top_trf jmp over bot_trf: add si,blk_len-1 add di,blk_len-1 back: mov al,[si] mov [di],al dec si        dec cx         jnz back over: int 3 align 16 end start