Q BgQuestion:

Rookie
Karma Points: 0
Respect (79%):
posted by  kashmala on 7/22/2008 8:30:50 AM  |  status: Live  

assembly pls.explain the purpose of the code and its working.Pleeeeeeeeeez

Course Textbook Chapter Problem
N/A N/A N/A N/A
Question Details:

Q.Explain the purpose and working of each instruction written

in the following lines

Hint: three codes are mentioned separately regarding about the multitasking kernel.

Code # 1

; subroutine to run as first thread

mytask: push bp

mov bp, sp

sub sp, 2 ; thread local variable

push ax

push bx

xor ax, ax ; use line number 0

mov bx, 70 ; use column number 70

mov word [bp-2], 0 ; initialize local variable

 Code # 2

; subroutine to run as second thread

mytask2: push ax

push bx

push es

mov ax, 0xb800

mov es, ax ; point es to video base

xor bx, bx ; initialize to use first shape

Code # 3

; subroutine to run as third thread

mytask3: push bp

mov bp, sp

sub sp, 2 ; thread local variable

push ax

push bx

push cx

AAnswers:

Answer Question
(Cramster SME)
posted by Reena on 7/30/2008 12:01:53 AM  |  status: Live
Asker's Rating: Lifesaver   
kashmala's comment:
"thanxxxxxxxxxxxxxxxxxx"
Response Details:
Dear.....
 
code #1
 
push bp            : save value of bp
mov bp, sp       : mark start of stack frame
sub sp, 2         : subtracts value of sp by 2
push ax           : save value of ax
push bx           : save value of bx 
xor ax, ax       : Performs boolean exclusive-OR between operands and stores value in ax
mov bx, 70      : sets 70 value to bx
mov word [bp-2], 0 : save bp and assign to 0
 
 
code #2
 
push ax   : place ax value on the top of  stack, top is incremented by 1
push bx            : place bx value on the top of stack
push es            : place bx value on the top of stack
mov ax, 0xb800 : assign  value at 0xb800 to ax 
mov es, ax         : move the value of ax to es  
xor bx, bx          : Performs boolean exclusive-OR between operands and stores value in ax
 
code #3
 
push bp           : save value of bp
mov bp, sp      : mark start of stack frame
sub sp, 2         : subtracts value of sp by 2
push ax           : save value of ax
push bx           : save value of bx 
push cx           : save value of cx
Answer Question
Ask New Question

Join Cramster's Community

Cramster.com brings together students, educators and subject enthusiasts in an online study community. With around-the-clock expert help and a community of over 100,000 knowledgeable members, you can find the help you need, whenever you need it. Join for free today »