Skip to content

CS401 - Computer Architecture and Assembly Language Programming

6 Topics 18 Posts
  • CS401 GDB 1 Solution and Discussion

    2
    0 Votes
    2 Posts
    813 Views
    F

    Total Marks 5
    Starting Date Thursday, February 11, 2021
    Closing Date Friday, February 12, 2021
    Status Closed
    Question Title Cortex-A OR Cortex-M
    Question Description
    A smartwatch is a very useful device developed by several companies these days including Apple, Samsung, Motorola and several others. It has a touch screen interface providing features like GPS tracking, heart rate and sleep monitoring etc. with power efficient batteries. The ARM Cortex processors are used in smartwatches providing several benefits.

    Suppose we have to choose between ARM Cortex-A or Cortex-M series architecture for our next generation smartwatch. Which one would you select between the two and why? Support your selection of either architecture with solid reasoning considering memory management, cost, performance and chip size.

    Important Instructions:

    Please note that no extra time will be given for posting comments on GDB. Use the font style “Times New Roman” with font size “12”. Do not copy or exchange your answer with other students. Two identical comments will be marked zero. Your comments should not exceed 120 words.
  • 0 Votes
    2 Posts
    190 Views
    zaasmiZ

  • 0 Votes
    4 Posts
    312 Views
    zaasmiZ

    @zaasmi said in CS401 Assignment 1 Solution and Discussion Spring 2020:

    Q 3. Calculate the offset when the physical address is 003Ch and the contents of segment register are 003Ah. (8)

    Solution:
    Physical address = (Segment Address0x10) + Offset address.
    Offset Address = Physical address – (Segment Address0x10).
    = 0003Ch – (003Ah*0x10)
    = 0003Ch - 003A0h
    = FC9Ch

  • CS401 Assignment 2 Solution and Discussion

    Solved
    3
    0 Votes
    3 Posts
    2k Views
    zareenZ

    Q1. Write a subroutine that will find the first even number from an array of your VU ID and calculate its factorial. (10 Marks)

    Note: Skip 0’s in your VU ID as shown below,
    VU ID: BC190206435
    After skipping 0’s, array would be:
    Array: 1, 9, 2, 6, 4, 3, 5
    The first even number is 2 in the array so its factorial will be calculated and saved in AX register.
    Solution:

    [org 0x100] jmp start data: dw 1, 9,2,6,4,3,5 ;initiliazation checkEven: mov dl,0002h mov ax,[data+bx] mov cx,[data+bx] xor ah,ah xor ch,ch div dl cmp ah,00h ;checking remainder je fact add bx,2 jmp checkEven fact: mov ax,0001 mov dx,0000 mult: mul cx loop mult ret start: mov si,00h mov bx,si call checkEven mov ax,0x4c00 int 0x21

    Q2. Write a code in assembly language (using appropriate jumps) equivalent to this given code in C. (10 Marks)
    #include <stdio.h>
    int main()
    {
    int n1=1, n2=2;
    int largest;
    if( n1>n2)
    largest=n1;
    else
    largest = n2;
    return 0;
    }

    Solution:

    Assembly code:

    [org 0x100] jmp start n1 db 1 n2 db 2 largest db 0 start: mov ax, [n1] xor ah,ah mov bx, [n2] cmp ax,bx ja large mov [largest],bx large: mov [largest],ax mov ax, 0x4c00 int 21h
  • CS401 Assignment 3 Solution and Discussion

    Solved
    3
    0 Votes
    3 Posts
    888 Views
    zareenZ
    [ORG 0X0100] start: mov ax, 0x000D int 0x10 mov ax, 0x0C02 xor bx, bx mov cx, 100 mov dx, 60 l1: int 0x10 inc cx cmp cx, 200 jne l1 mov cx, 100 mov dx, 60 l2: int 0x10 mov ax, 0x0C05 inc dx cmp dx, 120 jne l2 mov cx, 200 mov dx, 60 l3: int 0x10 mov ax, 0x0C08 inc dx cmp dx, 120 jne l3 mov cx, 100 mov dx, 120 l4: int 10h mov ax, 0x0C09 inc cx cmp cx, 200 jne l4 mov ah, 0 int 0x16 mov ax, 0x0003 int 0x10 mov ax, 0x4C00 int 0x21
  • CS401 Assignment 1 Solution and Discussion

    Solved
    4
    0 Votes
    4 Posts
    550 Views
    zareenZ

    Idea!
    e9b5adc9-884f-4606-8f28-a844df74c5f7-image.png