This document outlines an experiment on assembly language programming focused on code conversion, detailing the learning objectives, outcomes, and key string operations. It includes specific problem statements for converting numbers into grey code, ASCII to BCD, and BCD to hexadecimal, along with the necessary software and theoretical background. The conclusion emphasizes the efficiency of assembly language for string manipulation tasks in resource-constrained environments.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
15 views7 pages
Exp8 17 A Prateek - Kumar - Das
This document outlines an experiment on assembly language programming focused on code conversion, detailing the learning objectives, outcomes, and key string operations. It includes specific problem statements for converting numbers into grey code, ASCII to BCD, and BCD to hexadecimal, along with the necessary software and theoretical background. The conclusion emphasizes the efficiency of assembly language for string manipulation tasks in resource-constrained environments.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7
EXPERIMENT NO: 8
Title: Assembly Language Programming based on code conversion
NAME: Prashant Dhond
DIV :A
BATCH:B
ROLL NO:23 EXPERIMENT NO: 8
AI WAP to perform code conversion using assembly language programming.
M LEARNING To perform some operations on code conversion using assembly language OBJECTIVE programming. LEARNING Ability of a student to perform code conversions using assembly language OUTCOME CSL404.2 Ability to use and apply appropriate instructions to program a microprocessor LAB OUTCOME to perform various tasks. CSL404.6 Ability to write and execute assembly code for code conversions PROGRAM PO11, OUTCOME PO52, PO83, PO93, PO122, PSO12 BLOOM'S Understanding, Creating TAXONOMY LEVEL THEORY STRING INSTRUCTIONS A series of data byte or word available in memory at consecutive locations, to be referred as byte string or word string. A string of characters may be located in consecutive memory locations, where each character may be represented by its ASCII equivalent. The 8086 supports a set of more powerful instructions for string manipulations for referring to a string, two parameters are required: Starting and end address of a string and length of a string. The length of the string is usually stored as count in the CX register. The incrementing or decrementing of the pointer, in string instructions, depends upon the direction flag (DF) status. If it is a byte string operation, the index registers are updated by one. On the other hand, if it is a word string operation, the index registers are updated by two. • REP: Repeat Instruction Prefix This instruction is used as a prefix to other instructions, the instruction to which the REP prefix is provided is executed repeatedly until the CX register becomes zero (at each iteration the CX is automatically decremented by one). REPE / REPZ - Repeat operation while equal / zero. REPNE / REPNZ - Repeat operation while not equal / zero. These are used for CMPS, SCAS instructions only as instruction prefixes. • MOVSB/ MOVSW: Move string byte or string word. Suppose a string of bytes stored in a set of consecutive memory locations is to be moved to another set of destination locations. The starting byte of source string is located in the memory location whose address may be computed using SI and DS contents. The starting address of the destination locations where this string has to be relocated is given by DI ( Destination Index) and ES (Extra segment) contents. • CMPS: Compare string byte or string word. The CMPS instruction can be used to compare two strings of byte or words. The length of the string must be stored in the register CX. If both the byte or word strings are equal, zero flag is set. The REP instruction prefix is used to repeat the operation till CX (counter) becomes zero or the condition specified by the REP prefix is false. • SCAN: Scan string byte or string word. This instruction scans a string of bytes or words for an operand byte or word specified in the register AL or AX. The string is pointed to by ES:DI register pair. The length of the string is stored in CX. The DF controls the mode for scanning of the string. Whenever a match to the specified operand is found in the string, execution stops and the zero flag is set. If no match is found the zero flag is reset. • LODS: Load string byte or string word The LODS instruction loads the AL / AX register by the content of a string pointed to by the DS:SI pair. The SI is modified automatically depending upon DF. If it is a byte transfer (LODSB), the SI is modified by one and if it is a word transfer (LODSW), the SI is modified by two. No other flags are affected by the instruction. • STOS: Store string byte or string word. The STOS instruction stores the AL /AX register contents to a location in the string pointed by the ES:DI pair. The DI is modified accordingly. No flags are affected by this instruction. The direction flag controls the string instruction execution. The SI and DI are modified after each iteration automatically. If DI = 1, then the execution follows auto decrement mode, SI and DI are decremented automatically after each iteration. IF DS = 0, then the execution follows auto increment mode. In this mode, SI and DI are incremented automatically after each iteration.
SOFTWARE Emu8086 Emulation Software
USED PROBLEM Note: Show snapshots of input /output memory strings and output register. STATEMENTS 1) To convert a series of numbers stored on memory locations into their grey code equivalents. Consider source string from 3000:4000H and destination string from 6000:7000H. Note: Count value is stored on first memory location. 2) To convert a series of ASCII numbers stored on memory locations into their BCD equivalents. Consider source string from 3000:4000H and destination string from 6000:7000H. Note: Count value is stored on first memory location. 3) To convert a series of BCD numbers stored on memory locations into their hex equivalents. Consider source string from 3000:4000H and destination string from 6000:7000H. Note: Count value is stored on first memory location. OUTPUT 1 To convert a series of numbers stored on memory locations into their grey code equivalents. Consider source string from 3000:4000H and destination string from 6000:7000H. 2) To convert a series of ASCII numbers stored on memory locations into their BCD equivalents. Consider source string from 3000:4000H and destination string from 6000:7000H. 3) To convert a series of BCD numbers stored on memory locations into their hex equivalents. Consider source string from 3000:4000H and destination string from 6000:7000H. CONCLUSION In this experiment we learned how strings are typically represented as sequences of characters stored in memory, and operations on these strings often require direct manipulation of individual characters in memory locations. Since assembly language provides low-level control over memory and registers, it is an ideal choice for performing efficient string manipulation operations, especially in environments where performance and resource constraints are critical. • Key String Operations in Assembly Language 1. String Copy: Copying one string to another is one of the most common operations, typically achieved using loops and direct memory access in assembly. 2. String Comparison: Comparing two strings involves checking each character individually in a loop and comparing their ASCII values. Assembly language can compare strings by loading characters into registers and using comparison instructions (CMP). 3. String Reverse: Reversing a string involves swapping characters from both Don Bosco Institute of Technology, Kurla Academic Year 2024-25 Class: S.E Comps (Sem IV) Lecturer: Sejal.M.Chopra Subject: MP Lab ends towards the center. This requires pointers or registers that track both the start and the end of the string. 4. String Search: Searching for a specific character or substring within a string is commonly done with a loop that compares each character against the target string REFERENCES 1. Intel Microprocessors: Barry B. Brey, 8th Edition, Pearson Education India 2. 8086/8088 family: Design Programming and Interfacing: John Uffenbeck , PHI. 3. Advanced Microprocessors and Peripherals: K M Bhurchandani, A k Ray McGraw Hill 4. Advanced MS DOS Programming – Ray Duncan BPB