.... How to Find Your Subject Study Group & Join ....   .... Find Your Subject Study Group & Join ....  

We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Study Groups By Subject code Wise (Click Below on your university link & Join Your Subject Group)

[ + VU Study Groups Subject Code Wise ]  [ + COMSATS Virtual Campus Study Groups Subject Code Wise ]

Looking For Something at vustudents.ning.com?Search Here

GDB – Graded Discussion Board CS401 – Computer Architecture & Assembly Language Programming GDB Topic Suppose we have to call the following two subroutines in our assembly code: Bubblesort_S Bubblesort_R There are two basic techniques in order to pass parameters into a subroutine: stack-based and register-based. Bubblesort_S subroutine uses the stack-based technique and Bubblesort_R subroutine uses the register-based approach. Now you are required to choose that which subroutine you will use in your assembly program in order to obtain the following features: The operation must be faster The limited number of parameters Justify your answer with valid reasons. GDB’s Instructions Provide precise and to the point answer, not more than 5 to 6 lines, avoid irrelevant details. Post your answer on the Graded Discussion Board (GDB), not on the Moderated Discussion Board (MDB). GDB will only be open for 48 hours, no more time or grace day will be provided. GDB cannot be accepted via email after the due date. Copy from the internet or other student will get zero marks

Share This With Friends......


How to Find Your Subject Study Group & Join.

Find Your Subject Study Group & Join.

+ Click Here To Join also Our facebook study Group.


This Content Originally Published by a member of VU Students.

+ Prohibited Content On Site + Report a violation + Report an Issue


Views: 2228

See Your Saved Posts Timeline

Replies to This Discussion

come discuss plzzz??

Read Hand out following heading for answer
5.5. PARAMETER PASSING THROUGH STACK

??????

Bubble sort-r

Because it uses register based approach 

registers will always be fastest, because that is where execution "takes place". but registers are VERY limited in terms of storage. e.g. x86 processors only had 4 general purpose registers you could store things in to, and even those were dual-purposed for certain thing.The maximum parameters a subroutine can receive are seven when all the general registers are used. Also, with the subroutines are themselves limited in their use of registers, and this limited increases when the subroutine has to make a nested call thereby using certain registers as its parameters. Due to this, parameter passing by registers is not expandable and generalizable. However this is the fastest mechanism available for passing parameters and is used where speed is important.

baqi khud explain kro

in this case register base subroutine is better to use

Register-based is much faster because the registers where data is stored are directly located on the CPU. Where a stack-based implementation would have to push/pop data from memory (RAM) which is a much slower process. Registers are the fastest possible memory access you can get. 

disadvantage of the call stack mechanism is the increased cost of a procedure call and its matching return The extra cost includes incrementing and decrementing the stack pointer , and accessing the local variables and parameters by frame-relative addresses, instead of absolute addresses. The cost may be realized in increased execution time, or increased processor complexity, or both.

solution

Attachments:

dear Bushra

               plz help me my id and password not work properly bcz some people change my ID and Password not wrok. please help me my brother angry with me .plz help me 

Asslam-u-Alaikum

send you email through your VU email Id they will fix that, or just send your e-mail to misuse@vu.edu.pk they will help you.

Regards,

Omer

v funny..atleast dont guide others wrongly,,

BITS 16 ;Set code generation to 16 bit mode
ORG 0x0100 ;Set code start address to 0000h

MAIN:
jmp START

DISP:
mov ah,09h ;String Print int service
int 21h
ret

OFF:
mov al,00h ;All LEDs OFF
mov dx, 378h
out dx, al
jmp MAIN
ON:
mov al,0FFh ;All LEDs ON
mov dx, 378h
out dx, al

START:
lea dx,[msg1] ;Display message
call DISP
mov ah, 01h ;keyboard interrupt
int 21h
cmp al,'1' ;press 1 to ON
je ON
cmp al,'0' ;press 0 to OFF
je OFF
END:
mov al, 00h ;OFF LEDs and motor
mov dx, 378h
out dx, al
mov ah, 4Ch ;End of program
int 21h

section .data
msg1 db 13,10,'Press 1/0(press any key to exit): ','$'

; Description : A simple example of
;parallel interfacing file programmed

bits 16 ; Set 16 bit code generation
org 0x0100 ; Set code start address to ; 100h (COM file)


MAIN:
jmp START ; Jump to label 'START'

DISPLAY: ; Subroutine program
lea dx,[msg1] ; string print
mov ah,09h ; service no 09h
int $21 ; interrupt 21h
ret

DELAY: ;Delay program
MOV CX, 01Fh ;outer loop
.NEXT: MOV BX,0FFFFH ;inner loop
.NEXT2: NOP
NOP
NOP
DEC BX
JNZ .NEXT2
LOOP .NEXT
RET

END: ;Define label 'END'
mov ah, $4C ;service no =4ch
int $21
ret ;return to calling

PATTERN:
;1st pattern
mov dx,$378 ;set data port address
mov al,$03 ;set two LEDs ON
out dx,al ;output to data port
call DELAY ;call delay subroutine


;2nd pattern
mov dx,$378 ;set data port address
mov al,$02 ;set one LED = OFF, another LED=ON
out dx,al ;output to data port
call DELAY ;call delay subroutine
;3rd pattern
mov dx,$378 ;set data port address
mov al,$01 ;set one LED = ON, another LED=OFF
out dx,al ;output to data port
call DELAY ;call delay subroutine
;4th pattern
mov dx,$378 ;set data port address
mov al,$00 ;set two LEDs = OFF
out dx,al ;output to data port
call DELAY ;call delay subroutine
ret

START:
call DISPLAY ; display message on screen
call PATTERN ; display pattern
call END ; end program

section .data
msg1 db 13,10,Program running? ','$'

BITS 16 ;Set code generation to 16 bit mode
ORG 0x0100 ;Set code start address to 0000h


[section .text]

MAIN:
jmp START

DISP:
mov ah,09h ;String Print int service
int 21h
ret


ON2:
lea dx,[msg3] ;Display message
call DISP
mov al,0F0h ;2nd 7-seg ON
mov dx, 378h
out dx, al
jmp MAIN

ON1:
lea dx,[msg2] ;Display message
call DISP
mov al,0Fh ;1st 7-seg ON
mov dx, 378h
out dx, al


START:
lea dx,[msg1] ;Display message
call DISP

mov ah, 01h ;keyboard interrupt
int 21h

cmp al,'1' ;press 1 to ON1
je ON1
cmp al,'2' ;press 2 to ON2
je ON2

END:
mov al, 00h ;LEDs OFF
mov dx, 378h
out dx, al
mov ah, 4Ch ;End of program
int 21h

section .data
msg1 db 13,10,'Press 1/0: ','$'
msg2 db 13,10,'First 7-SEG ON...','$'
msg3 db 13,10,'Second 7-SEG ON...','$'

RSS

Forum Categorizes

Job's & Careers (Latest Jobs)

Admissions (Latest Admissons)

Scholarship (Latest Scholarships)

Internship (Latest Internships)

VU Study

Other Universities/Colleges/Schools Help

    ::::::::::: More Categorizes :::::::::::

Latest Activity

Member of The Month

1. Angry Bird

Lahore, Pakistan

© 2018   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service