How to execute ALP using MASM Software in Command prompt (PC/Laptop)

MASM Software Execution Procedure

Procedure to enter a program using MASM in PC

copy masm.exe & link.exe in to a folder named as masm copy this 'masm' folder into any drive (take any drive 'C:' or 'D:' or 'E:') [open command prompt] start - run - cmd - enter goto the drive in which the saved folder is available D: enter goto 'masm' folder using 'cd masm' display like D:\masm [open edit window] edit - enter type our ALP program in edit (blue colour) window file-save as- filename.asm - ok - file - exit (now we are in command prompt) [compile] masm filename.asm - enter(3 times) -If any errors are found then go back to the program and then correct them -if No errors were found then filename.obj is generated. [link] link filename.obj - enter(3 times) -if No warnings were found then filename.exe is generated. [debug] debug filename.exe - enter - use letter t for single step execution. - use letter d or u for program and opcode verification. - use letter e to give input and check for the output during runtime. si, di, bx - data segment bp - stack segment ip - code segment

8 bit Addition Program using Assembler Directives

assume cs:code, ds:data data segment oper1 db ? oper2 db ? result db 01 dup(?) carry db 01 dup(0) data ends code segment start:mov ax,data mov ds,ax mov bx,offset oper1 mov al,[bx] add al,[bx+1] mov si,offset result mov [si],al inc si jc l1 mov byte ptr [si],00h jmp l2 l1:mov byte ptr [si],01h l2:mov ah,4ch int 21h code ends end start
        (OR)
assume cs:code, ds:data
data segment org 2000h oper1 db ? oper2 db ? org 3000h result db 01 dup(?) carry db 01 dup(0) data ends
code segment start:mov ax,1000h mov ds,ax mov bx,offset oper1 mov al,[bx] add al,[bx+1] mov bp,offset result mov [bp],al inc bp jc car mov byte ptr [bp],00h jmp l1 car:mov byte ptr [bp],01h l1:mov ah,4ch int 21h code ends end start

16 bit Multiplication Program using Assembler Directives

assume cs:code, ds:data
data segment multiplicand dw ? multiplier dw ? result dd 01 dup(?) data ends
code segment start:mov ax,data mov ds,ax mov si,offset multiplicand mov di,offset multiplier mov bp,offset result mov ax,[si] mov bx,[di] mul bx mov [bp],ax mov [bp+2],dx mov ah,4ch int 21h code ends end start

32 bit/16 bit Divison Program using Assembler Directives

assume cs:code, ds:data
data segment dividand dd ? divisor dw ? result dd 01 dup(?) data ends code segment start:mov ax,data mov ds,ax mov si,offset dividand mov ax,[si] mov dx,[si+2] mov bx,[si+4] div bx mov di,offset result mov [di],ax mov [di+2],dx mov ah,4ch int 21h code ends end start

Comments