simple microprocessor prog.

Welcome to this page.Here I have tried to post few microprocessor programming using masm(macro assembler)

1. To display string

CODE:
                            title:To display simple strings
                           .MODEL SMALL

                .STACK

                .DATA

                                STR DB"Hi this is me$"; string is displayed until ta $ sign

                .CODE

                 main proc

                mov ax,@data

                mov ds,ax

                LEA dx,str

                MOV AH,09H

                INT 21H

                mov ax,4c00h

                INT 21H

main endp

end main

 

2. To multiply two 8-bit numbers
CODE:

title: To multiply two 8-bit numbers

                .model small

                .stack

                .data

                                v1 db 16

                                v2 db 15

                .code

                main proc

 

                mov ax,@data

                mov ds,ax

                mov al,v1

                mov bl,v2

                mul bl

                mov bh,10

                div bh

                push ax

                mov ah,00

                div bh

                push ax

                mov ah,00

                div bh

                push ax

                mov ah,00

                div bh

                push ax

                pop dx

                mov dl,dh

                add dl,30h

                mov ah,02h

                int 21h

                pop dx

                mov dl,dh

                add dl,30h

                mov ah,02h

                int 21h

                pop dx

                mov dl,dh

                add dl,30h

                mov ah,02h

                int 21h

                pop dx

                mov dl,dh

                add dl,30h

                mov ah,02h

                int 21h

                mov ah,4ch

                int 21h

   main endp

   end main

 3. To print strings using loop
CODE

Title: To print "Microprocessor Programming"

                .model small

                .stack

                .Data

                                str db'Microprocessor Programming$'

                .code

                main proc

                                mov ax,@data

                                mov ds,ax

                                mov cx,0026

                                LEA bx,str

                                mov SI,0000H

                                mov AH,02H

                                l1:

                                mov dl,[BX+SI]

                                INT 21H

                                INC SI

                                loop l1

                                mov ah,4ch

                                INT 21h

                main endp

                end main