- Get link
- X
- Other Apps
Group A
Assignment No:1.1
hello db 'hello
world$',0ah
  mov eax,1
OUTPUT
ell-152@ell152-OptiPlex-390:~$
cd Desktop
Assignment No:1.2
section .data:
  mov rax,1
OUTPUT
ell-152@ell152-OptiPlex-390:~$
cd Desktop
Assignment No:2.2
section .data
msg3 db 'display
num:',10
section .bss
section .text
    mov
rax,4
L1:   
mov rax,3
       
mov rax,4
    mov
rsi,num
L3:   
mov rax,4
OUTPUT
ALP to accept ten 32-bit and 64 bit
Hexadecimal numbers from user and store then in data segment table and display
then numbers 
Assignment No:03
section .data:
      
mov eax,4
      
mov eax,3
     
      
mov eax,4
      
mov eax,4
     
mov eax,4
     
mov eax,1
OUTPUT
ell-152@ell152-OptiPlex-390:~$
cd Desktop
Assignment  No : 4.1
section   
.data
Section   .bss
%macro 
print   2
%macro  
 exit    0
; If U ARE MODIFYING 32-BIT PROGRAM then
section   
.text
  
 mov    rsi, arr64  
next_num:
    add
    rsi,8          
 ; 64 bit nos i.e. 8 bytes
  
 mov    [sum], rax        ;
store sum
  
 print    msg, msg_len
    mov
    rax,[sum]        ; load value
of sum in rax
  
 print    nline, nline_len
disp64_proc:
    mov
    rsi,char_sum+15        ; load
last byte address of char_sum buffer in rsi
cnt:  
 mov     rdx,0      
     ; make rdx=0 (as in div instruction rdx:rax/rbx)
    dec
    rcx          
 ; decrement count
OUTPUT
The sum of 64-bit array
elements (without carry) is :    000000000055AAFF
ell-152@ell152-OptiPlex-390:~/Desktop$
Assignment  No : 4.5
section   
.data
Section   .bss
%macro 
print   2
%macro   
exit    0
; If U ARE MODIFYING 32-BIT PROGRAM then
section   
.text
   
mov    rsi, arr64   
next_num:
    add
    rsi,8       
    ; 64 bit nos i.e. 8 bytes
   
mov    [ans], rax        ; store
ans
   
print    msg, msg_len
    mov
    rax,[ans]        ; load value
of ans in rax
    print   
nline, nline_len
disp64_proc:
    mov
    rsi,char_ans+15        ; load
last byte address of char_ans buffer in rsi
cnt:   
mov     rdx,0       
    ; make rdx=0 (as in div instruction rdx:rax/rbx)
    dec
    rcx           
; decrement count
The result of AND
operation on 64-bit array elements is :    0000000011111111
ell-152@ell152-OptiPlex-390:~/Desktop$
Assignment No:4.4
section   
.data
Section   .bss
%macro 
print   2
%macro   
exit    0
; If U ARE MODIFYING 32-BIT PROGRAM then
section   
.text
   
mov    rsi, arr64   
next_num:
    add
    rsi,8       
    ; 64 bit nos i.e. 8 bytes
   
mov    [ans], rax        ; store
ans
   
print    msg, msg_len
    mov
    rax,[ans]        ; load value
of ans in rax
   
print    nline, nline_len
disp64_proc:
    mov
    rsi,char_ans+15        ; load
last byte address of char_ans buffer in rsi
cnt:   
mov     rdx,0       
    ; make rdx=0 (as in div instruction rdx:rax/rbx)
    dec
    rcx           
; decrement count
OUTPUT
ell-152@ell152-OptiPlex-390:~$
cd Desktop
The result of OR
operation on 64-bit array elements is :    0000000055555555
ell-152@ell152-OptiPlex-390:~/Desktop$
Assignment No:4.3
section   
.data
Section   .bss
%macro 
print   2
%macro   
exit    0
; If U ARE MODIFYING 32-BIT PROGRAM then
section   
.text
   
mov    rsi, arr64   
next_num:
   
mov    [ans], rax        ; store
sub
   
print    msg, msg_len
    mov
    rax,[ans]        ; load value
of sub in rax
   
print    nline, nline_len
disp64_proc:
    mov
    rsi,char_ans+15        ; load
last byte address of char_ans buffer in rsi
cnt:   
mov     rdx,0       
    ; make rdx=0 (as in div instruction rdx:rax/rbx)
    dec
    rcx           
; decrement count
OUTPUT
ell-152@ell152-OptiPlex-390:~$
cd Desktop
The subtraction of
64-bit array elements is :    0000000011111111
ell-152@ell152-OptiPlex-390:~/Desktop$
Group A
section   
.data
Section   .bss
%macro 
print   2
%macro   
exit    0
; If U ARE MODIFYING 32-BIT PROGRAM then
section   
.text
   
mov    rsi, arr64   
next_num:
    add
    rsi,8       
    ; 64 bit nos i.e. 8 bytes
   
mov    [ans], rax        ; store
ans
   
print    msg, msg_len
    mov
    rax,[ans]        ; load value
of ans in rax
   
print    nline, nline_len
disp64_proc:
    mov
    rsi,char_ans+15        ; load
last byte address of char_ans buffer in rsi
cnt:   
mov     rdx,0       
    ; make rdx=0 (as in div instruction rdx:rax/rbx)
    dec
    rcx           
; decrement count
OUTPUT
The result of XOR
operation on 64-bit array elements is :    0000000055555555
ell-152@ell152-OptiPlex-390:~/Desktop$
Assignment No:06
section   
.data
    rmsg
        db     10,'To use
GDTR,LDTR,IDTR in Real mode'
section   
.text
SMSW  
 [MSW]
        
mov  eax, 1
Group B
Assignment No:01
section .data
  
 nwline db 10
    array
dd 0fa100001h,0b2000002h,0ffffffffh,0d400004h, 0500005h  
     ;array elements
section .bss
%macro dispmsg 2
section .text
lup1:  
 cmp eax,[array+esi*4]    ;Compare accumulator with array
element
    mov
[large],eax
  
 dispmsg larg_msg,larg_len
  
 dispmsg nwline,1
exit:  
 mov eax,01
disp_num:
    mov
ecx,8        ;load number of digits to display
OUTPUT
;[mahendra@(none) alp]$
nasm -f elf64 msmalb01.asm
Assignment No:06
section  .data
  
 menu        db    10,"
-Menu- "
  
 amsg        db  
 10,10,"Addition Result is :    "
  
 smsg        db  
 10,10,"subtraction Result is :    "
  
 mmsg        db    10,10,"multiplication
Result is :    "
  
 dmsg        db  
 10,10,"Division Result is :    "
  
 emsg        db  
 10,10,"Exit from the Pgogram....", 10,10
Section  .bss
  
 ans        resq  
 1      
%macro 
print   2
%macro 
read   2
%macro  
 exit    0
; If U ARE MODIFYING 32-BIT PROGRAM then
section   
.text
case2:  
case3:  
case4:  
caseexit:
add64_proc:  
  
 add    rax,rbx
  
 print    amsg, amsg_len
  
 print    nline, nline_len
sub64_proc:  
  
 sub    rax,rbx
  
 print    smsg, smsg_len
  
 print    nline, nline_len
mul64_proc:  
  
 mul    rbx
  
 print    mmsg, mmsg_len
  
 print    nline, nline_len
div64_proc:  
  
 div    rbx      
         ;(rdx:rax)/rbx
  
 print    dmsg, dmsg_len
  
 print    nline, nline_len
disp64_proc:
    mov
    rsi,char_ans+15        ; load
last byte address of char_ans buffer in rsi
cnt:  
 mov     rdx,0          
     ; make rdx=0 (as in div instruction rdx:rax/rbx)
    dec
    rcx          
     ; decrement count
OUTPUT
ell-152@ell152-OptiPlex-390:~/Desktop$
nasm -f elf64 switch64.asm  -o
switch64.oell-152@ell152-OptiPlex-390:~/Desktop$ ld -o switch64 switch64.o
 -Menu-
   Enter Your
Choice: 1
Addition Result is
:    0000000000224466
 -Menu-
   Enter Your
Choice: 2
subtraction Result is
:    0000000000000000
 -Menu-
   Enter Your
Choice: 3
multiplication Result is
:    000001258F579629
 -Menu-
   Enter Your
Choice: 4
Division Result is
:    0000000000000001
 -Menu-
   Enter Your
Choice:
Assignment No:08
section   
.data
  
 nmsg        db  
 10,10,"The no. of Negative elements from 64-bit array :  
 "
-
%macro 
print   2
%macro  
 exit    0
-
section   
.text
  
 mov    rsi, arr64  
next_num:
positive:
negative:
next:
  
 mov    [p_count], rbx      
 ; store positive count
  
 print    pmsg, pmsg_len
    print  
 nmsg, nmsg_len
  
 print    nline, nline_len
    mov
    rsi,char_count+15    ; load last byte address
of char_count buffer in rsi
cnt:  
 mov     rdx,0      
     ; make rdx=0 (as in div instruction rdx:rax/rbx)
    dec
    rcx          
 ; decrement count
OUTPUT
ell-152@ell152-OptiPlex-390:~/Desktop$
nasm -f elf64 pn64.asm  -o pn64.o
The no. of Positive
elements from 64-bit array :    0000000000000003
The no. of Negative
elements from 64-bit array :    0000000000000002
ell-152@ell152-OptiPlex-390:~/Desktop$
Assignment No:10
section .data
    array
dd 0ffff4587h,0f7ff89ffh, 0ffff0022h,0abcdffffh
section .bss
%macro print 2
section .text
  
 global _start
    mov
esi,array
    mov
ebx,arrcnt
    mov
[avg],eax
    print
resmsg,rmsg_len
    mov
eax,01
disp32num:
    print
dispbuff,8
OUTPUT
ell-152@ell152-OptiPlex-390:~/Desktop$
nasm -f elf64 msmalb10.asm
Average = E8F2F3E9
Assignment No:11
;This is 32 bit code
;I have already created 'MAL_LAB.txt' file and written some text
in it.
;0777 is the PERMISSION MODE for this refer the document CHANING
FILE PERMISSIONS. I have attached this document with mail.
%macro DISPLAY 2
%endmacro
section .data
    msg
db 'FILE CONTENTS ARE:-',0xA,0xD
section .bss
section .text
  
           
  
     mov [fd_in],eax        ;
file descriptor
  
     DISPLAY msg,len
    ;print the info
  
     DISPLAY msg1,len1
    ;exit
OUTPUT
ell-152@ell152-OptiPlex-390:~/Desktop$
nasm -f elf64 fileread32bit.asm
FILE CONTENTS ARE:-
DEPARTMENT OF COMPUTER
ENGINEERING
FILE READ SUCESSFULLY!
ell-152@ell152-OptiPlex-390:~/Desktop$
Group C
Assignment No:01
;using 64-bit registers
section   
.data
    rmsg
        db     10,'Processor is in
Real Mode...'
  
 gmsg        db  
 10,"GDTR (Global Descriptor Table Register)    :
"
  
 imsg        db  
 10,"IDTR (Interrupt Descriptor Table Register)    :
"
    lmsg  
     db    10,"LDTR (Local Descriptor
Table Register)    : "
  
 tmsg        db  
 10,"TR (Task Register)        : "
  
 mmsg        db  
 10,"MSW (Machine Status Word)    : "
%macro 
print   2
%macro  
 exit    0
-
section   
.text
  
 SMSW    [MSW]
  
 mov    rax,[MSW]
p_mode:  
next:
  
 print    gmsg, gmsg_len      
 ;GDTR (Global Descriptor Table Register)
  
 print    imsg, imsg_len      
 ;IDTR (Interrupt Descriptor Table Register)
  
 print    lmsg, lmsg_len      
 ;LDTR (Local Descriptor Table Register)
  
 print    tmsg, tmsg_len      
 ;TR (Task Register)  
  
 print    mmsg, mmsg_len      
 ;MSW (Machine Status Word)  
  
 print    nline, nline_len
    mov
    rsi,char_sum+3        ; load
last byte address of char_sum buffer in rsi
    dec
    rcx          
     ; decrement count
OUTPUT
Processor is in
Protected Mode...
- Get link
- X
- Other Apps