Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

Computer Architecture and Assembly Language Programming (CS401)

Assignment No. 1

 

Total marks = 20                                                                              

 

Deadline Date

December 09, 2021

 

Please carefully read the following instructions before attempting assignment.

RULES FOR MARKING

It should be clear that your assignment would not get any credit if:

  • The assignment is submitted after the due date.
  • The submitted assignment does not open or file is corrupt.
  • Strict action will be taken if submitted solution is copied from any other student or from the internet.

You should concern the recommended books to clarify your concepts as handouts are not sufficient.

You are supposed to submit your assignment in .doc or docx format.

Any other formats like scan images, PDF, zip, rar, ppt and bmp etc. will not be accepted.

Lectures covered: 1-6

Topics covered: Indirect Addressing

 

NOTE

No assignment will be accepted after the due date via email in any case (whether it is the case of load shedding or internet malfunctioning). Hence refrain from uploading assignment in the last hour of the deadline. It is recommended to upload solution file at least two days before its closing date.

If you find any mistake or confusion in the assignment (Question statement), please contact your instructor before the deadline. After the deadline, no queries will be entertained in this regard.

For any query, feel free to email at cs401@vu.edu.pk

 

  1. Write an assembly language program to swap the first four digits of your VUID with the last four digits leaving the middle one intact. For example, if the digits in your VUID are 1423 5 0986, then the VUID should be converted to 0986 5 1423.

Note: Make it sure to use the last 5 digits of your own VUID as name of the .asm file, otherwise zero marks will be awarded.

Requirements:

Following are required in a single MS-Word document:

  • Assembly language program.
  • Screenshot of the NASM command (assembling the .asm file).
  • Screenshot of AFD debugger showing the final values in memory.

 

Best of luck!

Views: 942

Attachments:

Replies to This Discussion

Stay touched with this discussion, Solution idea will be uploaded as soon as possible in replies here before the due date.

CS401 Assignment 1 Solution Spring 2021

Code

 

[org 0x0100]

 

jmp begin

 

VU_ID:  dw      1,      8,      0,      2,      0,      0,      1,      1,      6              ; array - consecutive memory locations (2 bytes per index)

sum:    dw      0                                                                           ; variable

 

; mnemonic destination, source

 

begin:                         mov ax, 0                             ; the result of addition will be stored in the AX register

                               mov bx, VU_ID                  ; address will be stored in the BX register

                               mov cx, 9                             ; the count of nine digits will be stored in the CX register

                      

                                      ; 0 - 0 == 0

continue_Process:      cmp word [bx], 0                                             ; non-destructive subtraction in other words, the result of subtraction does not store anywhere but this result

                                                                                                            ; is used to set the flags only

                       je check_Is_Entire_Array_Traversed            ; if the value of index is equal to zero then jump (conditional jump)

                       add ax, [bx]                                                 ; add index's value to the AX register's value

                      

                                     

check_Is_Entire_Array_Traversed:              add bx, 2                                     ; move to the next index (remember this is a address)

                                              sub cx, 1                                     ; decrement our count

                                              jnz continue_Process           ; continue process if the entire is not traversed

 

mov [sum], ax                                                                                               ; total sum is stored in variable

                      

                      

                      

 

terminate:     mov ax, 0x4c00                                                                        ; ending instructions

                       int 0x21

 

 

The end

 

CS 401 Assignment 1 Fall 2021 Solution link 

CS401-Assignment-01-Solution-Fall-2021_VU_Ning.docx

CS401 Assignment 1 Solution Fall 2021 100% Correct Solution

#cs401assignment1solutionfall2021 #cs401assignment1solution2022
CS401 Assignment 1 Solution Fall 2021 | CS401 Assignment Solution 2022

CS401 Assignment 1 Fall 2021 solution idea:

 

Code:

[org 0x0100]

jmp begin

VU_ID: dw 1, 8, 0, 2, 0, 0, 1, 1, 6 ; array - consecutive memory locations (2 bytes per index)
sum: dw 0 ; variable

; mnemonic destination, source

begin: mov ax, 0 ; the result of addition will be stored in the AX register
mov bx, VU_ID ; address will be stored in the BX register
mov cx, 9 ; the count of nine digits will be stored in the CX register

; 0 - 0 == 0
continue_Process: cmp word [bx], 0 ; non-destructive subtraction in other words, the result of subtraction does not store anywhere but this result
; is used to set the flags only
je check_Is_Entire_Array_Traversed ; if the value of index is equal to zero then jump (conditional jump)
add ax, [bx] ; add index's value to the AX register's value


check_Is_Entire_Array_Traversed: add bx, 2 ; move to the next index (remember this is a address)
sub cx, 1 ; decrement our count
jnz continue_Process ; continue process if the entire is not traversed

mov [sum], ax ; total sum is stored in variable

terminate: mov ax, 0x4c00 ; ending instructions
int 0x21

kindly mjy bna dy koi plz.....

RSS

Looking For Something? Search Below

Latest Activity

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

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