Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

This article is about microprocessors. For central processing units more generally, see Ce, Lecture notes of Microcontrollers

This article is about microprocessors. For central processing units more generally, see Central processing unit. See also: Processor (computing), System on a chip, Microcontroller, and Digital signal processor Texas Instruments TMS1000 Intel 4004 Motorola 6800 (MC6800) A modern 64 bit x86-64 processor (AMD Ryzen 5 2600, Based on Zen+, 2017) AMD Ryzen 7 1800X (2016, based on Zen) processor in a AM4 socket on a motherboard A microprocessor is a computer processor where the data processing logic a

Typology: Lecture notes

2021/2022

Uploaded on 01/02/2023

al-imran_shuvo
al-imran_shuvo 🇧🇩

3 documents

1 / 4

Toggle sidebar

Related documents


Partial preview of the text

Download This article is about microprocessors. For central processing units more generally, see Ce and more Lecture notes Microcontrollers in PDF only on Docsity! Department of Computer Science and Engineering Title: Implement Array and String in Assembly Language Programming Microprocessors and Microcontrollers Lab CSE 304 Green University of Bangladesh 1 Objective(s) • To understand the use of Array in Assembly Language Program. • To understand the use of String in Assembly Language Program. 2 Problem analysis 2.1 Array Arrays can be seen as chains of variables. A text string is an example of a byte array; each character is presented as an ASCII code value (0..255). Here are some array definition examples: a DB 48h, 65h, 6Ch, 6Ch, 6Fh, 00h b DB ’Hello’, 0 b is an exact copy of the a array, when compiler sees a string inside quotes it automatically converts it to set of bytes. This chart shows a part of the memory where these arrays are declared: Figure 1: Array Structure You can access the value of any element in array using square brackets, for example: MOV AL, a[3] You can also use any of the memory index registers BX, SI, DI, BP, for example: MOV SI, 3 MOV AL, a[SI] If you need to declare a large array you can use DUP operator. The syntax for DUP: For example: c DB 5 DUP(9) c DB 9, 9, 9, 9, 9 ; is an alternative way of declaring: one more example: d DB 5 DUP(1, 2) d DB 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 ; is an alternative way of declaring: Of course, you can use DW instead of DB if it’s required to keep values larger then 255, or smaller then -128. DW cannot be used to declare strings! 2.2 String We can store a string in .data segment. Here we have provided an example : .DATA S1 DW ’Hello World$’ To print a string, we have to write the following instructions: LEA DX,S1 MOV AH,09h int 21h 3 Example of Array and String Code in Assembly © Dept. of Computer Science and Engineering, GUB
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved