Week 1 & 2 date: 08. 02. 2017



Download 20.75 Kb.
Date07.08.2017
Size20.75 Kb.
#28149

WEEK 1 & 2 DATE:08.02.2017.


جامعة سلمان بن عبد العزيز

كلية الآداب والعلـوم بوادي الدواسر

قســـم علوم الحاسب

LAB Experiments

1438/1437 IInd Semester



CS 225 المقرر:

الشعبة: 365 4 المستوي:

Computer Organization & Assembly Language Programming.

جامعة سلمان بن عبدالعزيز

Attendance: /0.3

Execution: /0.4

Exercise: /0.3

Total: /1.0



Student Name:

Academic Number:

Learning Objective: Making familiar with TASM environment and helping to perform the instruction sets operations.

Part A: Practice

Program name: Assembling & compiling programs using TASM & Learning about Instructions sets of assembly language programming.

Assembly language programming

  • Assembly language is a low-level programming language for a computer or other programmable device specific to particular computer architecture in contrast to most high-level programming languages.

  • Which are generally portable across multiple systems.

  • Assembly language is converted into executable machine code by a utility program referred to as an assembler like NASM, MASM, etc.

  • Each personal computer has a microprocessor that manages the computer's arithmetical, logical and control activities.

  • Processor understands only machine language instructions, which are strings of 1's and 0's.

Assembling Procedure:

  • Open the editor and execute the program.

  • Save with filename.asm extension

  • Assemble or run the program using MASM software

  • Show if there is any errors,

  • If no errors found internally generate filename.lib, filename.exe file

  • Link these files to gather

  • Run the executable file shows the output.


Types of instructions:


  1. Data moving instructions:

MOV AX,BX

MVI AX,05

LOAD AX,05

PUSH AX


  1. Arithmetic Operations

ADD
DIV
IDIV
MUL
IMUL
SBB
SUB

  1. Logic instructions

AND AX,BX


NEG AX
NOT AX
OR AX,BX
TEST
XOR AX, BX


  1. Shift & Rotate Instructions

SHL AX

SHR AX


ROL AX

ROR AX


  1. Counting instructions

DEC AX


INC AX


  1. Comparison instructions

CMP
CMPS (CMPSB) (CMPSW


  1. Control instructions

JA (JNBE)


JAE (JNBE)
JB (JNAE)
JBE (JNA)
JE (JZ)
JNE (JNZ)
JG (JNLE)
JGE (JNL)
JL (JNGE)
JLE (JNG)
JC
JNC
JNO
JNP (JPO)
JNS
JO
JP (JPE)
JS


  1. Stack instructions

POP
PUSH





Sample Program

section .text

global _start ;must be declared for linker (ld)

_start: ;tells linker entry point

mov edx,len ;message length

mov ecx,msg ;message to write

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 'Hello, world!', 0xa ;our dear string

len equ $ - msg ;length of our dear string



Output:

Part B: Exercise

  1. List few arithmetic instructions with it is operations?



  1. How to compile the assembly language program?



  1. List few shift instructions?



| Page

225CS G(365) /Lab Manual/Week 1


Download 20.75 Kb.

Share with your friends:




The database is protected by copyright ©ininet.org 2024
send message

    Main page