PROCESS OF FLASHING OF YUPHORIA

Some YUPHORIA devices gives problem after updating to 12.1 so you need to re flash the device to previous version 12.0 below are the steps for flashing YUPHORIA device.
1. Before following below steps please take the backup of your device data as your entire phone data will be wiped. This process may take some 40-45 mins for full boot up.
2. Make sure that your phone has enough battery power for the installation process (and the download too, if set to manual). The update process will work best if your phone has at least half of its battery life available, or if you plug it into an outlet during the installation process.
3. Follow the CM12S OTA flashing process for lollipop update with incremental OTA update mentioned below to resolve the issuewith the new updates:
Steps to flash factory image:
2. Extract the contents of the Fastboot package into a folder.
3. Download this flashing tools package from
4. Extract the contents of the flashing tools zip into the same folder
5. To make sure, check that system.img, boot.img etc files are in the same folder as flash-all.bat, fastboot.exe etc
6. Connect your phone in Fastboot mode, steps for which are: –
a. Power off your phone
b. Press and hold the Volume Up key
c. With the Volume Up key, connect the phone to your PC/Laptop with USB cable
d. You can let go off the Volume Up key when Fastboot Mode is displayed on the screen
7. Run flash-all.bat by double clicking on it.
8. A command window will open and flashing procedure will start
9. DO NOT disconnect the device during flashing procedure
10. The command window will close after the flashing process is over.
11. Disconnect the USB cable, and boot the phone normally by long pressing the Power button.
Share Button

3. Microprocessor and Interfacing Techniques SE Computer Engineering April/May 2014

Q.6 (a) With the help of neat diagram explain minimum mode configuration of 8086.

ANS: The minimum mode is selected by using logic 1 to the MN / MX# input pin. This is a single microprocessor configuration i.e. suppose we want to use single microprocessor like 80386 then we should use minimum mode.

Untitled

HOLD: Hold is used to accept request from DMA controller it is input signal.

HLDA: It is nothing but the acknowledgment to the DMA if microprocessor is ready to accept the request from DMA then it generates HLDA signal, It is the output signals.

WR#: it is use to control the write operations.

M/IO#: When this signal is 1 then memory is selected for read and write operations. When this signal is 0 then I/O devices are selected for read and write operations.

DT/R#: When this signal is 1 then data transmission is selected i.e. data is transmitted from processor to external devices.When this signal is 0 then data receiver is selected i.e. data is received from external devices to processor.

DEN#: The DEN signal indicates the direction of data, i.e. from or to the processor. The system contains memory for the monitor and users program storage.

ALE: Address Latch Enable means out of 16 AD0-AD15 multiplexed line the address bus is in used.

INTA#: Interrupt Acknowledgement INTA pin used to issue two interrupt acknowledge pulses to the interrupt controller or to an interrupting device.

Q.6 (b) Draw and explain format of control and status word of 8087 NDP.

ANS:

Q.6 (b) Explain the following 8087 instructions with one example each :
(i) FSQRT
(ii) FLDZ
(iii) FADD

ANS:

(i) FSQRT: FSQRT instruction is use to calculate the square root of a number.

; Compute Z := sqrt(x**2 + y**2);

                fld     x       ;Load X.
                fld     st(0)   ;Duplicate X on TOS.
                fmul            ;Compute X**2.

                fld     y       ;Load Y.
                fld     st(0)   ;Duplicate Y on TOS.
                fmul            ;Compute Y**2.

                fadd            ;Compute X**2 + Y**2.
                fsqrt           ;Compute sqrt(x**2 + y**2).
                fst     Z       ;Store away result in Z.

(ii) FLDZ: This instruction decrements the TOP register pointer in the Status Word and loads the value of +0.0 into the new TOP data register.

Syntax:    fldz  (no operand)

Exception flags: Stack Fault, Invalid operation

(iii) FADD: Adds the destination and source operands and stores the sum in the destination location. The destination operand is always an FPU register; the source operand can be a register or a memory location. Source operands in memory can be in single-precision or double-precision floating-point format or in word or double word integer format.

EX: FADD ST(1),ST(2) ;this instruction add the second memory location with first memory location and the result is store in first memory location.

Q.7 (a) Explain the features of 82801 IJR I/O Controller Hub.

ANS:

  1. I/O Controller hub used to manage communication between CPU and Motherboard.
  2. It support Advanced Configuration and Power Interface.
  3. It is integrated with IDE support.
  4. It support 24 interrupt sources. It support 33MHz PCI operation.

Q.7 (b) Draw and explain block diagram of X58 Chipset.

ANS:f367-1c

Intel Quick Path Interconnect (QPI): Intel’s latest system interconnect design increases bandwidth and lowers latency. Supports the Intel Core i7-965 processor Extreme Edition at 6.4 and 4.8 GT/s and Intel Core i7-940 and i7-920 processors.
PCI Express 2.0 Interface: PCI Express 2.0 delivers up to 16GB/s bandwidth per port, providing leading edge graphics performance and flexibility with support for dual x16 and up to quad x8 graphic card configurations, or any combinations in between. The Intel X58 IOH provides an additional 4 lanes that can be used for graphics or I/O for a total of 36 PCI Express lanes.
Intel High Definition Audio: Integrated audio support enables premium digital surround sound and delivers advanced features such as multiple audio streams and jack re tasking.
Intel Matrix Storage Technology: With additional hard drives added, provides quicker access to digital photo, video and data files with RAID 0, 5, and 10, and greater data protection against a hard disk drive failure with RAID 1, 5, and 10. Support for external SATA (eSATA) enables the full SATA interface speed outside the chassis, up to 3 Gb/s.
Intel Rapid Recover Technology: Intel’s latest data protection technology provides a recovery point that can be used to quickly recover a system should a hard drive fail or if there is data corruption. The clone can also be mounted as a read only volume to allow a user to recover individual files.
Intel Turbo Memory: Intel’s innovative NAND cache designed to improve the responsiveness of applications, application load times, and system boot performance. Intel Turbo Memory, paired with the Intel X58 Express Chip set, also allows the user to easily control the applications or data in the cache using the new Intel Turbo Memory Dashboard interface, boosting performance further. Serial ATA (SATA) 3 Gb/s High speed storage interface supports faster transfer rate for improved data access with up to 6 SATA ports.
eSATA: SATA interface designed for use with external SATA devices. It provides a link for 3 Gb/s data speeds to eliminate bottlenecks found with current external storage solutions. SATA Port Disable Enables individual SATA ports to be enabled or disabled as needed. This feature provides added protection of data by preventing malicious removal or insertion of data through SATA ports. Especially targeted for eSATA ports. USB Port Disable Enables individual USB ports to be enabled or disabled as needed. This feature provides added protection of data by preventing malicious removal or insertion of data through USB ports.

Q.8 (a) Draw and explain block diagram of i5 motherboard.

ANS:

New Bitmap Image

System Memory Support: System memory features include:
• One or two channels of unbuffered DDR3 memory with a maximum of two UDIMMs per channel.
• Single and dual channel memory organization modes.
• Data burst length of eight for all memory organization modes.
• Memory DDR3 data transfer rates of 1066 MT/s and 1333 MT/s.
• 64-bit wide channels
• DDR3 I/O Voltage of 1.5 V
Direct Media Interface (DMI):
• Four lanes in each direction.
• 2.5 GT/s point-to-point DMI interface to PCH is supported.
• Raw bit-rate on the data pins of 2.5 GB/s, resulting in a real bandwidth per pair of 250 MB/s given the 8b/10b encoding used to transmit data across this interface. Does not account for packet overhead and link maintenance.
• Maximum theoretical bandwidth on interface of 1 GB/s in each direction
simultaneously, for an aggregate of 2 GB/s when DMI x4.
• Shares 100-MHz PCI Express reference clock.
• 64-bit downstream address format, but the processor never generates an address above 64 GB (Bits 63:36 will always be zeros).
• 64-bit upstream address format, but the processor responds to upstream read transactions to addresses above 64 GB (addresses where any of Bits 63:36 are nonzero) with an Unsupported Request response. Upstream write transactions to addresses above 64 GB will be dropped.
Thermal Management Support:
• Digital Thermal Sensor
•Intel Adaptive Thermal Monitor
• THERMTRIP and PROCHOT support
• On Demand Mode
• Memory Thermal Throttling
• External Thermal Sensor
• Render Thermal Throttling
• Fan Speed Control with DTS

Q.8 (b) Write a short note on Intel’s QPI Technology.

ANS:New Bitmap Image (2)

Quick Path Interconnect(QPI): This architecture generally includes memory controllers integrated into the microprocessors, which are connected together with a high speed, point to point interconnect. The new Intel Quick Path Interconnect provides high bandwidth and low latency, which deliver the interconnect performance needed to unleash the new micro architecture and deliver the Reliability, Availability, and Serviceability (RAS) features expected in enterprise applications. This new interconnect is one piece of a balanced platform approach to achieving superior performance. It is a key ingredient in keeping pace with the next generation of microprocessors.

back-button-hiBACK

Share Button

How to apply for AdSense

Step 1: Create quality knowledge based stuff online for that you can choose either free platform like blogger.com, wordpress.com for creating quality blogs and technical writing or you can purchase domain and hosting from godaddy.com, bigrock.com and create your own blogging site.

Step 2: Make sure that your site must contain more than 16 quality posts. If you use free blogging sites like blogger and you are from india and china you should run it successfully more than 6 months because AdSense does not approve blogs which is less than 6 months old.

Step 3: Sign up for AdSense for that use your gmail account, enter the url on which you want to display adds after that enter the payee name as per the bank account. After registration click on My ads then create new add unit, after that click on get code, copy this code and past it on your webpages.

Step 4: Wait for a week for AdSense reply. If everything is fine you received acknowledgment from AdSense but in case of some requirements they assist you to fulfill this requirements. If AdSense rejected your application don’t worry made the changes which are suggested by their representative and reapply for AdSense.

Share Button

2. Microprocessor and Interfacing Techniques SE Computer Engineering April/May 2014

Q.3 (b) Define Resolution and Offset error terms of ADC.

Resolution: The number of bits in the output code of the ADC, this term has no real bearing on the performance of the ADC except that all performance parameters are measured against the theoretical best ADC of equal resolution.
Offset Error (E0): The difference between the actual and ideal first transition voltages.
Q.4 (a) Design a control word format for square wave generator with 1ms period, the input frequency for 8253 is 1 MHz.
Square Wave Generator:
Mode 3 is used for square wave generator, the control word format is as follows.
New Bitmap Image (5)
In this control word format
D0= Binary counter so D0=0
D1, D2, D3 bits are used to define mode so for square wave generator we require mode 3, so mode 3=0(M2),1(M1),1(M2).
D4 & D5 are use for Read/load least significant byte first, then most significant byte. So D4=1 & D5=1.
D6 & D7 are use to select the counter so for square wave generator we require counter 0, so D6=0 & D7=0.
So the final control word= 00110110
i.e 36H is the control word.
MOV AX, 36H (Control word is move into AX register).
Q.4 (b) Draw and explain the following 8279 commands :
(i) Keyboard/Display mode set command
(ii) Read FIFO/Sensor RAM command.
ANS: (i) Keyboard/Display mode set command:
All the command words or status words are written and read with A0=1
 D5=0, D6=0 & D7=0 configuration is used for mode set.
Now D3=D & D4=D is used to set display configuration as follows.
DD Function
00 8-digit display with left entry
01 16-digit display with left entry
10 8-digit display with right entry
11 16-digit display with right entry

Keyboard Interface of 8279 is as follows

KKK Function
000 Encoded keyboard with 2-key lockout
001 Decoded keyboard with 2-key lockout
010 Encoded keyboard with N-key rollover
011 Decoded keyboard with N-key rollover
100 Encoded sensor matrix
101 Decoded sensor matrix
110 Strobed keyboard, encoded display scan
111 Strobed keyboard, decoded display scan

Q.4 (c) Explain with neat diagram sequence of DMA operation.

Direct Memory Access:

New Bitmap Image (5)

  1. For devices that transfer large amount of data (such as disk controllers ), it is wasteful to tie up the CPU transferring data in and out of registers 8 bit at a time.
  2. Instead this work can be off loaded to a special processor, known as the Direct Memory Access, DMA and Controller.
  3. The host issues a command to the DMA controller, indicating the location where the data is located, the location where the data is to be transferred to, and the number of bytes of data to transfer. The DMA controller handles the data transfer, and then interrupts the CPU when the transfer is complete.
  4. A simple DMA controller is a standard component in modern PCs, and many bus mastering I/O cards contain their own DMA hardware.
  5. Handshaking between DMA controllers and their devices is accomplished through two wires called the DMA request and DMA acknowledge wires.
  6. While the DMA transfer is going on the CPU does not have access to the PCI bus (including main memory), but it does have access to its internal registers and primary and secondary caches.
  7. DMA can be done in terms of either physical addresses or virtual addresses that are mapped to physical addresses. The latter approach is known as Direct Virtual Memory Access, DVMA, and allows direct data transfer from one memory-mapped device to another without using the main memory chips.
  8. Direct DMA access by user processes can speed up operations, but is generally forbidden by modern systems for security and protection reasons. (I.e. DMA is a kernel-mode operation.)
  9. Figure illustrates the DMA process.
Q.5 (a) Draw and discuss the interface between 8086 and 8087.
ANS:
clip_image002

8087 math co processor can be connected with CPU only in maximum mode, i.e when MN/MX# pin is 0. In maximum mode, all control signals are derived using a bus controller. Multiplexed address data bus lines are connected directly from the 8086 to 8087. The status lines and the queue status lines connected directly from 8086 to 8087. The QS0 and QS1 lines may be directly connected to corresponding pins in case of 8086 based systems. The Request/Grant signal RQ#/GT0# of 8087 is connected to RQ#/GT1# of 8086.The clock pin of 8087 connected with CPU 8086 clock input. The interrupt output of 8087 is routed to 8086 via a programmable interrupt controller 8259.The pins AD0-AD15, BHE#/S7, RESET, A19/S6-A16/S3 are connected  to corresponding pins of 8086. BUSY# signal 8087 is connected to TEST pin of 8086. Interrupt output INT of the 8087 to NMI input of 8086. This intimates an error condition. A WAIT instruction is passed to keep looking at its TEST pin s, until it finds pin Low to indicates that the 8087 has completed the computation. SYNCHRONIZATION must be established between the processor and co-processor in two situations.

a) The execution of an ESC instruction that require the participation of the processor must not be initiated if the processor has not completed the execution of the previous instruction.

b) When a processor instruction accesses a memory location that is an operand of a previous co-processor instruction. In this case CPU must synchronize with processor to ensure that it has completed its instruction. Processor WAIT instruction is provided.

Q.5 (b) With proper timing diagram explain Read cycle in minimum mode of 8086 microprocessor.
ANS:

Figure shows the read cycle timing diagram. The read cycle begins in T1 with the enabling of the address latch enable (ALE) signal and also M/IO# signal. During the -ve going edge of this signal, the valid address is presented on the local bus. The BHE# and A0 signals address low, high or both bytes. From Tl to T4, the M/IO# signal indicates a memory or I/O operation. At T2 the address is removed from the local bus and is sent to the output. The bus is then enabled. The read (RD#) control signal is also activated in T2 .The read (RD#) signal causes the addressed device to enable its data bus drivers. After RD# goes negative, the valid data is available on the data bus. The addressed device will drive the READY line high, when the processor returns the read signal to high level, the addressed device will again enables its bus drivers.

rd MINIMUM MODE 8086 SYSTEM AND TIMINGS4

back-button-hiblafibuttonBACK

  NEXT

Share Button

Write ALP to switch from real mode to protected mode and display the values of GDTR, LDTR, IDTR, TR and MSW Registers.

Write ALP to switch from real mode to protected mode and display the values of GDTR, LDTR, IDTR, TR and MSW Registers.

;This program first check the mode of processor(Real or Protected),
;then reads GDTR, LDTR, IDTR, TR & MSW and displays the same.

section .data
rmodemsg db 10,’Processor is in Real Mode’
rmsg_len:equ $-rmodemsg

pmodemsg db 10,’Processor is in Protected Mode’
pmsg_len:equ $-pmodemsg

gdtmsg db 10,’GDT Contents are::’
gmsg_len:equ $-gdtmsg

ldtmsg db 10,’LDT Contents are::’
lmsg_len:equ $-ldtmsg

idtmsg db 10,’IDT Contents are::’
imsg_len:equ $-idtmsg

trmsg db 10,’Task Register Contents are::’
tmsg_len: equ $-trmsg

mswmsg db 10,’Machine Status Word::’
mmsg_len:equ $-mswmsg

colmsg db ‘:’

nwline db 10

section .bss
gdt resd 1
resw 1
ldt resw 1
idt resd 1
resw 1
tr  resw 1

cr0_data resd 1

dnum_buff resb 04

%macro disp 2
mov eax,04
mov ebx,01
mov ecx,%1
mov edx,%2
int 80h
%endmacro

section .text
global _start
_start:
smsw eax        ;Reading CR0

mov [cr0_data],eax

bt eax,0        ;Checking PE bit(LSB), if 1=Protected Mode, else Real Mode
jc prmode
disp rmodemsg,rmsg_len
jmp nxt1

prmode:    disp pmodemsg,pmsg_len

nxt1:    sgdt [gdt]
sldt [ldt]
sidt [idt]
str [tr]

disp gdtmsg,gmsg_len

mov bx,[gdt+4]
call disp_num

mov bx,[gdt+2]
call disp_num

disp colmsg,1

mov bx,[gdt]
call disp_num

disp ldtmsg,lmsg_len
mov bx,[ldt]
call disp_num

disp idtmsg,imsg_len

mov bx,[idt+4]
call disp_num

mov bx,[idt+2]
call disp_num

disp colmsg,1

mov bx,[idt]
call disp_num

disp trmsg,tmsg_len

mov bx,[tr]
call disp_num

disp mswmsg,mmsg_len

mov bx,[cr0_data+2]
call disp_num

mov bx,[cr0_data]
call disp_num

disp nwline,1
exit:    mov eax,01
mov ebx,00
int 80h

disp_num:
mov esi,dnum_buff    ;point esi to buffer

mov ecx,04        ;load number of digits to display

up1:
rol bx,4        ;rotate number left by four bits
mov dl,bl        ;move lower byte in dl
and dl,0fh        ;mask upper digit of byte in dl
add dl,30h        ;add 30h to calculate ASCII code
cmp dl,39h        ;compare with 39h
jbe skip1        ;if less than 39h skip adding 07 more
add dl,07h        ;else add 07
skip1:
mov [esi],dl        ;store ASCII code in buffer
inc esi            ;point to next byte
loop up1        ;decrement the count of digits to display
;if not zero jump to repeat

disp dnum_buff,4    ;display the number from buffer
ret

OUTPUT:

cg-151@cg151:~$ cd Final\ MA/
cg-151@cg151:~/Final MA$ cd A10
cg-151@cg151:~/Final MA/A10$ nasm -f elf msmalc03.asm
cg-151@cg151:~/Final MA/A10$ ld -m elf_i386 -s -o msmalc03 msmalc03.o
cg-151@cg151:~/Final MA/A10$ ./msmalc03

Processor is in Protected Mode
GDT Contents are::0030A000:007F
LDT Contents are::0000
IDT Contents are::FF576000:0FFF
Task Register Contents are::0040
Machine Status Word::80050033
cg-151@cg151:~/Final MA/A10$

Share Button

Write ALP to find average of n numbers stored in memory.

Write ALP to find average of n numbers stored in memory.

; ALP for average of 32 bit numbers
;——————————————————————-
section    .data
nline        db    10,10
nline_len:    equ    $-nline

arr32        dd    00112233H, 00112233H, 00112233H, 00112233H, 00112233H
n:        equ    5
msg        db    10,10,”The average of 32-bit array elements is :    ”
msg_len:    equ    $-msg

;———————————————————————
Section   .bss
avg        resd    1
char_sum    resb    8
;———————————————————————
%macro  print   2
mov   eax, 4
mov   ebx, 1
mov   ecx, %1
mov   edx, %2
int   80h
%endmacro

%macro    exit    0
mov  eax, 1
mov  ebx, 0
int  80h
%endmacro

;———————————————————————
section    .text
global   _start
_start:

mov    esi, arr32
mov    edi, n

mov    eax, 0            ; sum register
mov    edx, 0            ; carry register
next_num:
add    eax,[esi]
jnc    skip
inc    edx
skip:
add     esi,4            ; 32 bit nos i.e. 4 bytes
dec     edi
jnz      next_num

mov    ebx,n            ; store array size in ebx
div    ebx            ; edx:eax / ebx
; average is in eax, remainder is in edx
mov    [avg], eax        ; store average

print    msg, msg_len

mov     eax,[avg]        ; load value of average in eax
call     disp32_proc        ; display average

print    nline, nline_len
exit
;——————————————————————–
disp32_proc:

mov     esi,char_sum+7        ; load last byte address of char_sum buffer in esi
mov     ecx,8            ; number of digits

cnt:    mov     edx,0            ; make edx=0 (as in div instruction edx:eax/ebx)
mov     ebx,16            ; divisor=16
div     ebx
cmp     dl, 9            ; check for remainder in EDX
jbe      add30
add      dl, 07h
add30:
add     dl,30h            ; calculate ASCII code
mov     [esi],dl        ; store it in buffer
dec     esi            ; point to one byte back

dec     ecx            ; decrement count
jnz     cnt            ; if not zero repeat

print char_sum,8        ; display result on screen
ret
;———————————————————–

OUTPUT:

cg-151@cg151:~$ cd Final\ MA/
cg-151@cg151:~/Final MA$ cd A8
cg-151@cg151:~/Final MA/A8$ nasm -f elf pn32.asm
cg-151@cg151:~/Final MA/A8$ ld -m elf_i386 -s -o pn32 pn32.o
cg-151@cg151:~/Final MA/A8$ ./pn32

The no. of Positive elements in 32-bit array :    00000003
The no. of Negative elements in 32-bit array :    00000002
cg-151@cg151:~/Final MA/A8$

Share Button

Write an ALP to count no. of positive and negative numbers from the array.

Write an ALP to count no. of positive and negative numbers from the array.

; ALP to find no. of positive / negative elements from 32-bit array
;——————————————————————-
section    .data
nline        db    10,10
nline_len:    equ    $-nline

arr32        dd    -11111111H, 22222222H, -33333333H, 44444444H, 55555555H
n:        equ    5
pmsg        db    10,10,”The no. of Positive elements in 32-bit array :    ”
pmsg_len:    equ    $-pmsg

nmsg        db    10,10,”The no. of Negative elements in 32-bit array :    ”
nmsg_len:    equ    $-nmsg

;———————————————————————
Section   .bss
p_count        resq    1
n_count        resq    1
char_count    resb    8    ; for 32-bit nos.
;———————————————————————

%macro  print   2
mov   eax, 4
mov   ebx, 1
mov   ecx, %1
mov   edx, %2
int   80h
%endmacro

%macro    exit    0
mov  eax, 1
mov  ebx, 0
int  80h
%endmacro

;———————————————————————

section    .text
global   _start
_start:

mov    esi, arr32
mov    edi, n

mov    ebx,0;            ; counter for     +ve nos.
mov    ecx,0;            ; counter for    -ve nos.

next_num:
mov    eax,[esi]        ; take no. in RAX
RCL    eax,1            ; rotate left 1 bit to check for sign bit
jc    negative

positive:
inc    ebx            ; no carry, so no. is +ve
jmp    next

negative:
inc    ecx            ; carry, so no. is -ve

next:
add     esi,4            ; 32 bit nos i.e. 4 bytes
dec     edi
jnz      next_num

mov    [p_count], ebx        ; store positive count
mov    [n_count], ecx        ; store negative count

print    pmsg, pmsg_len
mov     eax,[p_count]        ; load value of p_count in rax
call     disp32_proc        ; display p_count

print    nmsg, nmsg_len
mov     eax,[n_count]        ; load value of n_count in rax
call     disp32_proc        ; display n_count

print    nline, nline_len
exit
;——————————————————————–
disp32_proc:

mov     esi,char_count+7    ; load last byte address of char_count buffer in rsi
mov     ecx,8            ; number of digits

cnt:    mov     edx,0            ; make rdx=0 (as in div instruction rdx:rax/rbx)
mov     ebx,16            ; divisor=16 for hex
div     ebx
cmp     dl, 09h            ; check for remainder in RDX
jbe      add30
add      dl, 07h
add30:
add     dl,30h            ; calculate ASCII code
mov     [esi],dl        ; store it in buffer
dec     esi            ; point to one byte back

dec     ecx            ; decrement count
jnz     cnt            ; if not zero repeat

print char_count,8        ; display result on screen
ret
;———————————————————–

HOW TO RUN ?

cg-151@cg151:~$ cd Final\ MA/
cg-151@cg151:~/Final MA$ cd A8
cg-151@cg151:~/Final MA/A8$ nasm -f elf pn32.asm
cg-151@cg151:~/Final MA/A8$ ld -m elf_i386 -s -o pn32 pn32.o
cg-151@cg151:~/Final MA/A8$ ./pn32

The no. of Positive elements in 32-bit array :    00000003
The no. of Negative elements in 32-bit array :    00000002
cg-151@cg151:~/Final MA/A8$

 

Share Button

Write an ALP to read command line arguments passed to a program.

Write an ALP to read command line arguments passed to a program.

;Code for Write an ALP to read command line arguments passed to a program.
;Program displays the number of arguments and then the arguments

;No.of arguments:6

;Arguments are::

section .data
nomsg db 10,”No.of arguments:”
nomsg_len: equ $-nomsg

argmsg db 10,10,”Arguments are::”,10
argmsg_len: equ $-argmsg

nwline db 10
section .bss
arg resd 1
argcnt resd 1

%macro dispmsg 2
mov eax,4
mov ebx,1
mov ecx,%1
mov edx,%2
int 0x80
%endmacro

section .text
global _start
_start:
dispmsg nomsg,nomsg_len

;get no. of arguments
pop ecx
mov [argcnt],ecx

add ecx,’0′    ;Calculate ASCII code by adding 30h i.e. ‘0’
cmp ecx,39h
jbe skip
add ecx,07
skip:
mov [arg],ecx    ;store ASCII in temp location

;display no. of arguments
dispmsg arg,1

;display argument message
dispmsg argmsg,argmsg_len

;get pointer for args
next:     pop ecx
mov edx,00
up:     cmp byte [ecx+edx],0    ;check for end of argument
jz l1
inc edx
jmp up
l1:
mov eax,4
mov ebx,1
int 0x80

dispmsg nwline,1
dec dword [argcnt]
jnz next
exit:
mov eax,1
mov ebx,0
int 0x80

HOW TO RUN ?

;Code for Write an ALP to read command line arguments passed to a program.
;Program displays the number of arguments and then the arguments

;OUTPUT
; nasm -f elf32 msmalb07.asm
; ld -o msmalb07 msmalb07.o -m elf_i386
; ./msmalb07

OUTPUT:

cg-151@cg151:~/Final MA/A7$ nasm -f elf msmalb07.asm
cg-151@cg151:~/Final MA/A7$ ld -m elf_i386 -s -o msmalb07 msmalb07.o
cg-151@cg151:~/Final MA/A7$ ./msmalb07
No.of arguments:1
Arguments are::
./msmalb07
cg-151@cg151:~/Final MA/A7$

Share Button

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

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

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

section .data
menumsg db 10,’****** Menu ******’,
db 10,’+: Addition’
db 10,’-: Subtraction’
db 10,’*: Multiplication’
db 10,’/: Division’
db 10,10,’Enter your choice:: ‘
menumsg_len: equ $-menumsg

addmsg db 10,’Welcome to additon’,10
addmsg_len equ $-addmsg
submsg db 10,’Welcome to subtraction’,10
submsg_len equ $-submsg
mulmsg db 10,’Welcome to Multiplication’,10
mulmsg_len equ $-mulmsg
divmsg db 10,’Welcome to Division’,10
divmsg_len equ $-divmsg
wrchmsg db 10,10,’Wrong CHoice Entered…!’,10
wrchmsg_len equ $-wrchmsg
msg db 10,10,”Dou want to continue?”
msglen equ $-msg

no1 dq 0ff05h
no2 dq 0ffh

resmsg db 10,’Result is:’
resmsg_len equ $-resmsg

qmsg db 10,’Quotient::’
qmsg_len equ $-qmsg

rmsg db 10,’Remainder::’
rmsg_len equ $-rmsg

nwmsg db 10

resh dq 0
resl dq 0

section .bss
accbuff resb 2
dispbuff resb 16

%macro  print   2
mov   eax, 4
mov   ebx, 1
mov   ecx, %1
mov   edx, %2
int   80h
%endmacro

section .text
global _start
_start:    print menumsg,menumsg_len

mov eax,03
mov ebx,01
mov ecx,accbuff
mov edx,02
int 80h

cmp byte [accbuff],’+’
jne case2

call add_proc
jmp exit
case2:
cmp byte [accbuff],’-‘
jne case3

call sub_proc
jmp exit
case3:
cmp byte [accbuff],’*’
jne case4

call mul_proc
jmp exit
case4:
cmp byte [accbuff],’/’
jne caseinv

call div_proc
jmp exit
caseinv:
print wrchmsg,wrchmsg_len

exit:    mov eax,01
mov ebx,0
int 80h

add_proc:
print addmsg,addmsg_len
mov rax,[no1]
add rax,[no2]
jnc addnxt1
inc qword [resh]
addnxt1:
mov [resl],rax
print resmsg,resmsg_len

mov rbx,[resh]
call disp64num
mov rbx,[resl]
call disp64num
print nwmsg,1
print msg,msglen
mov eax,03
mov ebx,01
mov ecx,accbuff
mov edx,02
int 80h
cmp byte [accbuff],’y’
jne rtlp

call _start

sub_proc:
print submsg,submsg_len

mov rax,[no1]
sub rax,[no2]
jnc addnxt1
inc qword [resh]
subnxt1:
mov [resl],rax
print resmsg,resmsg_len

mov rbx,[resh]
call disp64num
mov rbx,[resl]
call disp64num
print nwmsg,1
print msg,msglen
mov eax,03
mov ebx,01
mov ecx,accbuff
mov edx,02
int 80h
cmp byte [accbuff],’y’
jne rtlp

call _start

mul_proc:
print mulmsg,mulmsg_len
mov rax,[no1]
mov rbx,[no2]
mul rbx

mov [resh],rdx
mov [resl],rax

print resmsg,resmsg_len
mov rbx,[resh]
call disp64num
mov rbx,[resl]
call disp64num
print nwmsg,1

print msg,msglen
mov eax,03
mov ebx,01
mov ecx,accbuff
mov edx,02
int 80h
cmp byte [accbuff],’y’
jne rtlp

call _start

div_proc:
print divmsg,divmsg_len

mov rax,[no1]
mov rdx,0
mov rbx,[no2]
div rbx

mov [resh],rdx    ;Remainder
mov [resl],rax    ;Quotient

print rmsg,rmsg_len
mov rbx,[resh]
call disp64num
print qmsg,qmsg_len
mov rbx,[resl]
call disp64num
print nwmsg,1
print msg,msglen
mov eax,03
mov ebx,01
mov ecx,accbuff
mov edx,02
int 80h
cmp byte [accbuff],’y’
jne rtlp

call _start

disp64num:
mov ecx,16
mov edi,dispbuff
dup1:
rol rbx,4
mov al,bl
and al,0fh
cmp al,09
jbe dskip
add al,07h
dskip:    add al,30h
mov [edi],al
inc edi
loop dup1

print dispbuff,16
ret
rtlp:
ret

OUTPUT:

cg-151@cg151:~/Final MA/A6$ nasm -f elf64 swcase.asm
cg-151@cg151:~/Final MA/A6$ ld -o swcase swcase.o
cg-151@cg151:~/Final MA/A6$ ./swcase

****** Menu ******
+: Addition
-: Subtraction
*: Multiplication
/: Division

Enter your choice:: +

Welcome to additon

Result is:00000000000000000000000000010004

Dou want to continue?y

****** Menu ******
+: Addition
-: Subtraction
*: Multiplication
/: Division

Enter your choice:: –

Welcome to subtraction

Result is:0000000000000000000000000000FE06

Dou want to continue?y

****** Menu ******
+: Addition
-: Subtraction
*: Multiplication
/: Division

Enter your choice:: *

Welcome to Multiplication

Result is:00000000000000000000000000FE05FB

Dou want to continue?y

****** Menu ******
+: Addition
-: Subtraction
*: Multiplication
/: Division

Enter your choice:: /

Welcome to Division

Remainder::0000000000000005
Quotient::0000000000000100

Dou want to continue?n
cg-151@cg151:~/Final MA/A6$

Share Button

Write an ALP to fond the largest of given byte/Word/Dword/64-bit numbers.

Write an ALP to fond the largest of given byte/Word/Dword/64-bit numbers

;     Find largest number from the array of 32-bit numbers.
;    Program first displays all the elements of array.
;    Then it search for largest number and display the same.

section .data

wel_msg db ‘Welcome to find largest number by MBS!’,10
wel_len: equ $-wel_msg

arr_msg db ‘Array Elements Are:: ‘,10
arr_len : equ $-arr_msg

larg_msg db ‘Largest Number is::’
larg_len: equ $-larg_msg

thankmsg db 10,’THANK YOU BY SSIERAS RAHATA’,10
thank_len : equ $-thankmsg

nwline db 10

array dd 0fa100001h,0b200002h,0fff0003h,0d400004h, 0500005h        ;array elements
arrcnt dd 05h

section .bss
dnum_buff resb 8
large resd 1

%macro dispmsg 2
mov eax,4    ;System call for write
mov ebx,1    ;standard output stream
mov ecx,%1    ;message start address
mov edx,%2    ;message length
int 80h
%endmacro

section .text
global _start
_start:
dispmsg wel_msg,wel_len
dispmsg arr_msg,arr_len
mov esi,array
mov ecx,[arrcnt]

up1:    mov ebx,[esi]
push ecx
call disp_num
dispmsg nwline,1
pop ecx
add esi,04    ;Point to next element

loop up1

mov esi,array
mov ecx,[arrcnt]
mov eax,[esi]
dec ecx

lup1:    add esi,04    ;Point to next element
cmp eax,[esi]
ja lskip1
xchg eax,[esi]
lskip1:
loop lup1
mov [large],eax

dispmsg larg_msg,larg_len
mov ebx,[large]
call disp_num

dispmsg thankmsg,thank_len

exit:    mov eax,01
mov ebx,0
int 80h

disp_num:
mov edi,dnum_buff    ;point esi to buffer

mov ecx,8        ;load number of digits to display

dispup1:
rol ebx,4        ;rotate number left by four bits
mov dl,bl        ;move lower byte in dl
and dl,0fh        ;mask upper digit of byte in dl
add dl,30h        ;add 30h to calculate ASCII code
cmp dl,39h        ;compare with 39h
jbe dispskip1        ;if less than 39h akip adding 07 more
add dl,07h        ;else add 07

dispskip1:
mov [edi],dl        ;store ASCII code in buffer
inc edi            ;point to next byte
loop dispup1        ;decrement the count of digits to display
;if not zero jump to repeat

dispmsg dnum_buff,8
ret

OUTPUT:

cg-151@cg151:~/Final MA/A5$ nasm -f elf largest32.asm
cg-151@cg151:~/Final MA/A5$ ld -m elf_i386 -o largest32 largest32.o
cg-151@cg151:~/Final MA/A5$ ./largest32
Welcome to find largest number by MBS!
Array Elements Are::
FA100001
0B200002
0FFF0003
0D400004
00500005
Largest Number is::FA100001
THANK YOU BY SSIERAS RAHATA
cg-151@cg151:~/Final MA/A5$

Share Button