Write a switch case driven Assembly Language Program (ALP) to perform 64-bit hexadecimal arithmetic operations (+,-,*, /) using suitable macros. Define procedure for each operation.


32 Bit Code              64 Bit Code 32 Bit NASM Code %macro scall 4         mov eax,%1         mov ebx,%2         mov ecx,%3         mov edx,%4         int 80h %endmacro section .data arr dq 0000003h,00000002h n equ 2 menu db 10d,13d,”**********MENU**********” db 10d,13d,”1. Addition” db 10d,13d,”2. Subtraction” db 10d,13d,”3. Multiplication” db 10d,13d,”4. Division” db 10d,13d,”5. Exit” db 10d,13d,”Enter your Choice: ” menu_len equ $-menu m1 db 10d,13d,”Addition: ” … Continue reading Write a switch case driven Assembly Language Program (ALP) to perform 64-bit hexadecimal arithmetic operations (+,-,*, /) using suitable macros. Define procedure for each operation.

Write an Assembly Language Program (ALP) to find the largest of given byte / Word / Double-word / 64-bit numbers.


32 Bit Code (Byte)             32 Bit Code (Double Word)             64 Bit Code (Quad Word) 32 Bit NASM Code for Byte %macro scall 4 ;macro declaration with 4 parameters         mov eax,%1 ;1st parameter has been moved to eax         mov ebx,%2 ;2nd parameter has been moved to ebx         mov ecx,%3 ;3rd parameter has been moved to ecx … Continue reading Write an Assembly Language Program (ALP) to find the largest of given byte / Word / Double-word / 64-bit numbers.

Write an Assembly Level Program (ALP) to program to use GDTR, LDTR and IDTR in Real Mode.


32 Bit Code               32 Bit NASM Code %macro scall 4 mov eax,%1 mov ebx,%2 mov ecx,%3 mov edx,%4 int 80h %endmacro section .data rmsg db 10d,13d,”Processor is in Real Mode. ” rlen equ $-rmsg pmsg db 10d,13d,”Processor is in Protected Mode. ” plen equ $-pmsg gmsg db 10d,13d,”GDT Contents are ” glen equ $-gmsg imsg db 10d,13d,”IDT Contents … Continue reading Write an Assembly Level Program (ALP) to program to use GDTR, LDTR and IDTR in Real Mode.

Write Assembly language program (ALP) to perform memory segment and register load/store operations using different addressing modes.


64 Bit Code               64 Bit NASM Code %macro print 2 ;macro declaration with 4 parameters mov rax,1 ;1st parameter has been moved to rax mov rdi,1 ;2nd parameter has been moved to rdi mov rsi,%1 ;3rd parameter has been moved to rsi mov rdx,%2 ;4th parameter has been moved to rdx syscall ;Call the Kernel %endmacro ;end of … Continue reading Write Assembly language program (ALP) to perform memory segment and register load/store operations using different addressing modes.

Write Assembly language program (ALP) to add array of N hexadecimal numbers stored in the memory. Accept input from the user.


16 Bit Code              64 Bit Code 16 Bit TASM Code .model small ;memory model .data ;.data begins here m1 db 10d,13d,”Enter number of elements: $” m2 db 10d,13d,”Enter Nos: $” m3 db 10d,13d,”Entered numbers are: $” m4 db 10d,13d,”The sum is: $” newln db 10d,13d,”$” arr db 12 dup(‘0’) answer db 00h num db 00H carry db 00H .code ;.code … Continue reading Write Assembly language program (ALP) to add array of N hexadecimal numbers stored in the memory. Accept input from the user.

Write ALP to perform arithmetic and logical operations using numbers stored in array.


32 Bit Code %macro scall 4 ;macro declaration with 4 parameters mov eax,%1 ;1st parameter has been moved to eax mov ebx,%2 ;2nd parameter has been moved to ebx mov ecx,%3 ;3rd parameter has been moved to ecx mov edx,%4 ;4th parameter has been moved to edx int 80h ;Call the Kernel %endmacro ;end of macro section .data ;.data begins here arr dd 55555555h,11111111h ;array … Continue reading Write ALP to perform arithmetic and logical operations using numbers stored in array.

Write an ALP to accept a string and display its length.


16 Bit Code .model small ;defines the memory model to be used for the ALP .data ;data segment begins here msg1 db 10d,13d,”Enter a string: $” ;String gets stored in msg1 msg2 db 10d,13d,”Entered String: $” ;String gets stored in msg2 arr db 0Bh dup(0) ;array declaration & initialising with 0 len db 00h ;variable initialisation with 0 msg3 db 10d,13d,”Length: $” ;String gets stored … Continue reading Write an ALP to accept a string and display its length.

Write ALP to accept ten Hexadecimal numbers, store it in data segment table and then display the numbers


32 Bit Code %macro scall 4 ;macro declaration with 4 parameters mov eax,%1 ;1st parameter has been moved to eax mov ebx,%2 ;2nd parameter has been moved to ebx mov ecx,%3 ;3rd parameter has been moved to ecx mov edx,%4 ;4th parameter has been moved to edx int 80h ;Call the Kernel %endmacro ;end of macro section .data ;.data begins here msg1 db 10d,13d,”Enter 10 … Continue reading Write ALP to accept ten Hexadecimal numbers, store it in data segment table and then display the numbers

Write Assembly Language Program to print “Hello World” program.


16 Bit Code .model small ;defines the memory model to be used for the ALP .data ;data segment begins here msg db 10d,13d,”Hello World$” ;String Hello World gets stored in msg .code ;code segment begins here mov ax,@data ;moving base address of data to ax mov ds,ax ;moving contents of ax into ds ;data section now gets initialized lea dx,msg ;load the offset address of … Continue reading Write Assembly Language Program to print “Hello World” program.

Assemblers : A Quick Guide


Currently there are multiple Assemblers available in the market. Some popular ones are NASM, YASM and TASM. NASM General Introduction : The Netwide Assembler (NASM) is an assembler and disassembler for the Intel x86 architecture. It can be used to write 16-bit, 32-bit (IA-32) and 64-bit (x86-64) programs. NASM is considered to be one of the most popular assemblers for Linux. NASM was originally written … Continue reading Assemblers : A Quick Guide