CS401 assignment 1 solution of question 1
CS401 Assignment Solution:
[org 0x0100]
mov ax, [NUM1]
mov bx, [NUM2]
mov cx, [NUM3]
mov dx, [NUM4]
mov ds, [NUM5]
mov cs, [NUM6]
mov es, [NUM7]
mov ss, [NUM8]
mov si, [NUM9]
mov sp, [NUM10]
mov bp, [NUM11]
mov di, [NUM12]

add [bx+di], cx
mov ax, 0x4c00
int 0x21
NUM1: dw 0x0150
NUM2: dw 0xab5d
NUM3: dw 0xff0a
NUM4: dw 0x1234
NUM5: dw 0xcc20
NUM6: dw 0xef10
NUM7: dw 0x225f
NUM8: dw 0xe25f
NUM9: dw 0x1212
NUM10: dw 0xcd0f
NUM11: dw 0x95f8
NUM12: dw 0xbdef
section .text global _start ;must be declared for using gcc _start: ;tell linker entry point mov eax,'3' sub eax, '0' mov ebx, '4' sub ebx, '0' add eax, ebx add eax, '0' mov [sum], eax mov ecx,msg mov edx, len mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel mov ecx,sum mov edx, 1 mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel mov eax,1 ;system call number (sys_exit) int 0x80 ;call kernel section .data msg db "The sum is:", 0xA,0xD len equ $ - msg segment .bss sum resb 1

Attached Files
.docx   CS401 Q#1 Solution.docx (Size: 12.31 KB / Downloads: 6)

Possibly Related Threads...
Thread Author Replies Views Last Post
  Assignment Solutions Iram shahzad 2 47 05-22-2017, 08:21 AM
Last Post: Rana
  CS301 Assignment 2 Solution - Spring 2017 Rana 0 274 05-17-2017, 08:54 PM
Last Post: Rana
  cs504 assignment 1 help needed Syed Muhammad Taha 3 139 05-10-2017, 04:44 PM
Last Post: Rana
  CS403 Assignment 1 help required Syed Muhammad Taha 3 125 05-06-2017, 06:50 PM
Last Post: Rana
  CS506 Assignment No1 Solved 2017 Rubaisha(Moody Girl) 0 235 05-05-2017, 02:11 PM
Last Post: Rubaisha(Moody Girl)
Thumbs Up cs402 Assignment jamshed Ansari 1 117 05-03-2017, 06:05 PM
Last Post: Rana
  CS610 Assignment 1 Pakistani 3 374 05-03-2017, 01:50 PM
Last Post: jamshed Ansari
  CS601 Data Communication Assignment Solution Rana 2 1,241 02-07-2017, 06:00 PM
Last Post: Pakistani
  CS301 Assignment 3 Solution Rana 8 1,350 01-21-2017, 02:25 PM
Last Post: Rana
  CS601 Assignment 3 Solution Rana 0 502 01-12-2017, 01:41 PM
Last Post: Rana

Users browsing this thread:
2 Guest(s)