Lecture 5 Program structure, syntax and program to print single character in assembly language urdu

Programology
18 Mar 201724:47

Summary

TLDRThe video script is a detailed lecture on assembly language programming, focusing on the structure of a program and the syntax for printing a single character on the screen. It discusses the importance of understanding program structure, segments like data and code, and the use of directives such as 'dot model', 'dot stack', and 'dot data'. The lecture also covers the process of defining space in RAM, managing stack memory, and writing executable instructions using registers like the accumulator for output operations. The goal is to provide clarity on how to write, structure, and execute assembly language programs efficiently.

Takeaways

  • 📝 The lecture covers the basics of program structure, syntax, and the process of printing a single character on the screen using assembly language.
  • 🔍 The importance of understanding the structure and instructions of a program before writing it in the DOS Box is emphasized for ease of programming.
  • 💾 The concept of 'Dot Model' is introduced, explaining how to define the space required for assembly code within the RAM, including data and code segments.
  • 🔢 The script discusses different memory models like 'Tiny', 'Small', 'Medium', 'Compact', and 'Large', and their specific uses in reserving memory space.
  • 📐 The 'Stack' segment is explained, detailing how to define its size within the RAM for managing temporary data storage.
  • 🔄 The process of defining and using variables within the 'Data' segment and writing executable instructions in the 'Code' segment is covered.
  • 👨‍🏫 The script serves as an educational guide for beginners, simplifying complex concepts of assembly language programming.
  • 🔠 The use of specific registers for input and output operations, such as printing a character, is explained, highlighting the role of the 'A' register.
  • 👷‍♂️ The script provides a step-by-step guide on writing a program to print a character on the screen, including the use of service routines and interrupts.
  • 🔚 The necessity of proper exit and return procedures after executing a task within a program is discussed, using 'RET' and 'INT 21h' instructions.
  • 📋 The importance of syntax rules in programming, such as starting comments with a semicolon and the arrangement of segments like 'DOSSEG', 'MODEL SMALL', 'STACK 100h', 'DATA', and 'CODE'.

Q & A

  • What is the main topic of the lecture?

    -The main topic of the lecture is the structure of a program, specifically how to write a program to print a single character on the screen.

  • Why is it important to understand the structure of a program before writing it?

    -Understanding the structure of a program before writing it is important because it helps in organizing the instructions and segments of the program, making it easier to write and debug the code.

  • What is the purpose of the 'dot model' directive in assembly language programming?

    -The 'dot model' directive is used to define the amount of memory space required for the assembly code, specifying the size of the code and data segments.

  • What does the 'dot stack' directive represent in the context of the lecture?

    -The 'dot stack' directive represents the stack segment of the program, defining the size of the stack memory used for temporary storage during program execution.

  • How is the 'dot data' directive used in the script?

    -The 'dot data' directive is used to define the data segment of the program, where variables are declared and initialized.

  • What is the role of the 'dot code' directive in the program structure?

    -The 'dot code' directive is used to define the code segment of the program, where the actual instructions or executable code is written.

  • Why is the 'dot model small' directive used in the lecture?

    -The 'dot model small' directive is used to specify that the program is small in size, with limited code and data segments, which helps in managing the memory allocation efficiently.

  • What is the significance of the 'end' directive in the program?

    -The 'end' directive signifies the termination of the program, marking the end of the code segment and indicating that there is no more executable code.

  • How does the script discuss the use of comments in programming?

    -The script explains that comments in programming start with a semicolon and are used to explain or annotate the code, without affecting the program's execution.

  • What is the purpose of the 'mov' instruction in the context of printing a character?

    -The 'mov' instruction is used to move the character to be printed into a register, from where it can be passed to the appropriate service routine for output.

  • How does the script explain the use of the 'int 21h' service routine for printing a character?

    -The script explains that 'int 21h' is a software interrupt used for various input and output functions in DOS, and when the character to be printed is passed to it with the appropriate function number, it handles the printing to the screen.

Outlines

00:00

😀 Introduction to Program Structure and Syntax

The speaker begins by discussing the importance of understanding the structure and syntax of a program before writing it in the DOSBox environment. They emphasize the need to learn the program's structure, instructions, and how to reserve space in memory for code and data segments. The explanation includes the use of the 'dot model' directive to define the size of the assembly code space, which is crucial for the CPU to access and execute the program properly. The speaker also mentions different types of memory segments used in programming languages, such as data and code segments, and their significance in the program's execution.

05:01

📚 Detailed Explanation of Memory Segmentation

This paragraph delves deeper into the concept of memory segmentation, explaining how to define and reserve memory spaces for stack, data, and code segments. The speaker introduces the 'dot stack' directive for defining the stack size and the 'dot data' directive for declaring variables within the data segment. They also discuss the 'dot code' directive, which is used to write executable instructions for the program. The paragraph highlights the importance of proper memory management for efficient program execution and the role of different segments in organizing the program's components.

10:03

🛠️ Assembly Language Programming Basics

The speaker provides an overview of writing assembly language programs, focusing on the structure and syntax required for creating a simple program to print a character on the screen. They discuss the process of defining a procedure within the program, explaining the use of different procedures for various tasks. The paragraph also covers the importance of understanding the interaction between registers and how to use the accumulator register for output operations. The speaker illustrates the use of specific instructions, such as 'move' and 'print', to manipulate data and execute program tasks.

15:04

🔍 Understanding Register Interaction and Program Flow

This section focuses on the intricacies of register interaction within a program and the flow of execution. The speaker explains how to use the accumulator register for moving and printing characters, emphasizing the importance of correct register matching and size compatibility. They also discuss the use of service routines for input and output operations, highlighting the necessity of using interrupts for interacting with hardware. The paragraph provides insights into the program's exit strategy, explaining how to return from a procedure using specific instructions.

20:06

📝 Conclusion and Future Program Execution with DOSBox

The speaker concludes the lecture by summarizing the key points discussed in the previous paragraphs, including the program's structure, syntax rules, and the importance of memory segmentation. They mention the plan to use DOSBox for storing and running the program in the next session. The speaker also reminds the audience to subscribe for more content, emphasizing the educational value of the lecture series.

Mindmap

Keywords

💡Program Structure

Program Structure refers to the organization and layout of a program's code. In the video, it is the foundation for understanding how the program is built and how it will execute. The script discusses the importance of learning the structure before writing the program, which includes defining segments for data and code, and is essential for beginners to grasp the logic and flow of programming.

💡Directive Dot Model

The Directive Dot Model, mentioned as 'dot model' in the script, is a command used in assembly language programming to define the memory model for the program. It specifies the amount of memory space the program will use. The script uses it to illustrate how to reserve memory for the program's code and data segments, which is crucial for managing the program's execution environment.

💡Memory Segments

Memory Segments are distinct areas of memory allocated for different purposes within a computer's RAM. The script explains the concept of segments such as the data segment for variables and the code segment for instructions. Understanding segments is key to organizing a program's memory efficiently and is demonstrated through the use of directives like 'dot data' and 'dot code'.

💡Assembly Language

Assembly Language is a low-level programming language that is specific to a particular computer architecture. It is used in the script to explain the process of writing and understanding low-level instructions that directly control a computer's hardware. The video's theme revolves around teaching assembly language programming, starting from the basics of program structure to executing simple tasks like printing a character.

💡Instruction Execution

Instruction Execution is the process by which a computer carries out the tasks defined by its program's instructions. The script refers to this concept when explaining how to write and execute assembly language instructions, such as moving a character to a register and then printing it, which is a fundamental operation in the video's program.

💡Registers

Registers are small, fast storage locations within the CPU that are used for holding temporary data during processing. The script discusses the importance of registers in assembly language programming, especially when dealing with operations like moving data and printing characters to the screen. Understanding register usage is crucial for effective program execution.

💡Service Routine

A Service Routine is a part of a program that performs a specific service or task, such as input/output operations. In the script, the term is used in the context of printing a character to the screen using a service routine labeled '21h'. This concept is essential for understanding how programs interact with hardware at a low level.

💡Stack Memory

Stack Memory is a region of RAM used for temporary storage of data, particularly for function calls and returns in programming. The script mentions 'dot stack 100h' to define the size of the stack segment, which is important for managing the program's function calls and local variables.

💡Comments

Comments are annotations in the code that the compiler or interpreter does not execute. They are used to explain the code, making it easier to understand. The script introduces the concept of comments starting with a semicolon, which is a syntax rule allowing programmers to add notes or explanations throughout the program.

💡Syntax Rules

Syntax Rules are the grammatical and structural guidelines that must be followed when writing code in a programming language. The script discusses the importance of syntax in assembly language, including the correct order of directives and the use of comments, to ensure the program is written and executed correctly.

💡Program Execution

Program Execution refers to the process of running a program so that the computer performs the tasks defined by its code. The script provides an overview of how a program is structured and the steps involved in executing a simple program that prints a character to the screen, illustrating the fundamental process of program execution.

Highlights

Introduction to the lecture on program structure syntax and printing a single character on the screen.

Explanation of using DJ Box Max and Link to run the program.

Importance of understanding program structure and instructions before writing the program.

Description of the program structure and how it is written in assembly code.

Introduction to the Dot Model (Directive Dot Model) and its function in defining the space for assembly code.

Explanation of how space is reserved in RAM and accessed by the CPU.

Discussion on the two segments used in every programming language: data and code.

Detailing the need for separate space for data and code in assembly language.

Decision on the size of space needed for data and code, suggesting 64KB for both.

Introduction to the tuning model (Dot Model Tiny) and its purpose in defining the space for assembly code.

Explanation of the use of the Dot Stack directive for defining stack memory.

Description of the Dot Data directive for defining a segment for variables.

Introduction to the Dot Code directive for writing executable instructions.

Explanation of how to write a program to print a character on the screen using the AMULET register.

Discussion on the interaction of registers and their role in printing characters.

Detailing the process of moving a character to the data register and using the print command.

Explanation of using the service routine for printing a single character and the need for hardware interaction.

Description of the exit process from the register using the service routine for search.

Finalization of the program structure with the END directive and its significance.

Emphasis on the importance of commenting in the program and the syntax rules for comments.

Conclusion of the lecture with a summary of the program structure and syntax rules.

Transcripts

play00:00

लेक्चर फाइ प्रोग्राम स्ट्रक्चर सिंटेक्स

play00:03

एंड प्रोग्राम टू प्रिंट अ सिंगल कैरेक्टर

play00:05

ऑन

play00:07

स्क्रीन लेक्चर फोर में मैंने कहा था कि

play00:09

हम इस लेक्चर में डज बॉक्स मेजम एंड लिंक

play00:13

इंस्टॉल करके प्रोग्राम रन करेंगे लेकिन

play00:17

फिर मैंने सोचा कि

play00:19

प्रोग्राम डोज बॉक्स पर लिखने से पहले हम

play00:23

प्रोग्राम को सीख ले उसके स्ट्रक्चर को

play00:26

समझ ले उसमें यूज होने वाली इंस्ट्रक्शन

play00:28

को समझ ले

play00:30

तो ज्यादा बेहतर रहेगा उससे हमें आसानी

play00:34

होगी डॉज बॉक्स जब प्रोग्राम लिख रहे

play00:36

होंगे इस प्रोग्राम में हम एक छोटा

play00:39

प्रोग्राम बनाएंगे एक करेक्टर स्क्रीन पर

play00:41

प्रिंट भी करेंगे सबसे पहले स्टार्ट करते

play00:44

हैं प्रोग्राम स्ट्रक्चर से कि प्रोग्राम

play00:47

का स्ट्रक्चर किस तरह होता है कि किस वे

play00:49

में हम प्रोग्राम

play00:50

लिखेंगे सबसे पहले जब हम असेंबली कोड

play00:53

लिखेंगे कोई भी ए का प्रोग्राम बनाएंगे तो

play00:56

उसमें सबसे पहले हम यूज करते हैं डॉट मॉडल

play01:00

इसे हम कहते हैं डायरेक्टिव डॉट मॉडल

play01:03

डायरेक्टिव इसका काम यह होता है कि हम

play01:06

सबसे पहले डिफाइन करते हैं कि हमारे

play01:09

असेंबली कोड का स्पेस कितना होगा रेम के

play01:12

अंदर आप कुछ भी देखते हो पीसी के अंदर कुछ

play01:15

भी पड़ा हुआ चाहे म्यूजिक सोंग्स कुछ भी

play01:17

पड़े हुए हैं वीडियोस पड़े हुए हैं

play01:20

डॉक्यूमेंट फाइल पड़ी हुई है टेक्स्ट

play01:21

फाइल्स पड़ी हुई है कुछ भी पड़ा हुआ है तो

play01:24

उसने एक हार्ड डिस्क का हिस्सा रिजर्व

play01:27

किया होता है स्पेस रिजर्व किया होता है

play01:30

केबी में एमबी में जीबी में लेकिन स्पेस

play01:33

रिजर्व किया होता है और जब आप उसको रन

play01:36

करते हो तो वह पार्ट्स में डिवाइड होकर रम

play01:38

के पास जाता है और रम से सीपीयू से एक्सेस

play01:42

करके चलाता

play01:44

है तो हम रम में सबसे पहले अपने प्रोग्राम

play01:47

का एक हिस्सा रिजर्व करेंगे जो हम कोड

play01:50

लिखेंगे वह वहां पर होगा और सीपीयू वहां

play01:53

से उसको एक्सेस करेगा और हमारे प्रोग्राम

play01:55

को समझेगा कि हमारा प्रोग्राम किस लिए है

play01:59

क्या

play02:00

और उस हिसाब से वह बिहेव करेगा तो हम सबसे

play02:04

पहले डॉट मॉडल लिख के डिफाइन करते हैं

play02:06

हमारा स्पेस कितना है बिल फर्ज यह रम है

play02:10

तो रेम के अंदर हम स्पेस किस तरह डिफाइन

play02:12

करेंगे हमें रम के अंदर किस तरह का हिस्सा

play02:14

चाहिए कितना हिस्सा चाहिए तो उससे पहले आप

play02:17

सोचे कि हर लैंग्वेज में हर प्रोग्रामिंग

play02:21

लैंग्वेज में हम दो सेगमेंट यूज करते हैं

play02:25

एक टा डिफाइन करते हैं और फिर उसको

play02:28

एजीक्यू करते हैं बस दो ही काम होते हैं

play02:31

एक डटा डिफाइन करना और दूसरा उसको

play02:33

एग्जीक्यूट करना उसको चलाना तो हमें दो

play02:37

तरह का स्पेस चाहिए होगा एक डाटा का और

play02:40

दूसरा कोड का असेंबली में भी यही है

play02:43

असेंबली में हमें डाटा का और कोड का

play02:45

हिस्सा चाहिए होगा डाटा के अंदर हमारे

play02:48

वेरिएबल डिफाइंड होंगे और कोड के अंदर

play02:50

हमारी इंस्ट्रक्शंस लिखी हुई होंगी तो

play02:52

हमें दो हिस्से चाहिए रेम के अंदर अब इसका

play02:55

स्पेस कितना चाहिए बिल फर्ज मैं कहता हूं

play02:58

कि मुझे डाटा और कोड दोनों का मिलाकर

play03:03

स्पेस लेस देन 64 केबी चाहिए डाटा और कोट

play03:09

इन दोनों का स्पेस मिलाकर लेस देन 64 केबी

play03:13

चाहिए तो मैं यूज करूंगा टाइनिंग मतलब डॉट

play03:17

मॉडल टाइनी इसका मतलब होगा कि मैं जो

play03:19

असेंबली कोड लिखने वाला हूं उसका स्पेस

play03:22

कितना होगा रम के अंदर 64 केबी से कम होगा

play03:26

या बराबर होगा और बिल फर्ज में चाहता हूं

play03:30

इसका अलग हो इसका अलग हो इसका लेस देन 64

play03:34

के भी इसका भी लेसन 64 केबी इस तरह कोड का

play03:38

अलग और डाटा का अलग तो इस में यूज करूंगा

play03:45

स्मल अगर मैं चाहता

play03:48

हूं कि कोड एनी साइज

play03:51

हो कोड जितना चाहे मैं लिखूं और उस हिसाब

play03:55

से अपना इसपे रिजर्व करता जा रम के अंदर

play03:59

और

play04:00

एक लिमिटेड रख दिया मैंने 64 केबी

play04:05

से कम या बराबर हो तो उस लिए मैं यूज

play04:09

करूंगा

play04:10

मीडियम और अगर मैं चाहता हूं कि कोड

play04:14

लिमिटेड हो 64 केबी से डाटा में जितना

play04:17

डिफाइन करू तो उस हाल में उस सिचुएशन में

play04:21

कॉम्पेक्टो और अगर मैं चाहूं कि कोड किसी

play04:24

भी साइज का हो डाटा किसी भी साइज का हो

play04:27

मतलब मैं प्रोग्राम बना रहा हूं उस हिसाब

play04:28

से वो मैनेज कर ले अपना स्पेस रिजर्व कर

play04:32

ले कितनी साइज का डाटा भी कितनी साइज का

play04:35

तो लार्ज

play04:37

होगा इसी तरह लार्ज से ज्यादा चाहिए तो हम

play04:40

य ू यूज करेंगे ह्यूज कोड एनी साइज डाटा

play04:44

भी एनी साइज लेकिन ये लार्ज से ज्यादा हो

play04:47

जाता है लेकिन हमें इतना स्पेस चाहिए नहीं

play04:51

ना इतना ना इतना ना इतना ना ही कम हमें

play04:54

चाहिए स्मल क्यों क्योंकि हम एक प्रोफेशन

play04:58

नहीं है हम बिगिनर्स हैं हम स्टार्ट कर

play05:00

रहे हैं तो हमारा प्रोग्राम कभी भी इतना

play05:02

बड़ा नहीं होगा और ना ही कितना इतना छोटा

play05:04

होगा तो हम खामखा में रम का इतना स्पेस

play05:07

क्यों रिजर्व करें तो हम अपने प्रोग्राम

play05:10

के हिसाब से हमेशा डॉट मॉडल स्मॉल लिखेंगे

play05:14

क्योंकि वह हमें लेस देन 64 के भी कोड का

play05:17

अलग डाटा का अलग देगा रम के अंदर पार्ट्स

play05:21

तो हम लिखेंगे डॉट मॉडल स्मल मैं आपको यह

play05:24

डायरेक्ट बता सकता था लेकिन मैंने आपको

play05:27

बताया कितने मॉडल्स होते हैं किसकिस तरह

play05:29

के मॉडल्स होते हैं और वो कितना हिस्सा

play05:32

रिजर्व करते हैं उसके अंदर लेकिन हम हम

play05:34

यूज करेंगे डॉट मॉडल स्मल इसे हम कहते हैं

play05:38

मॉडल

play05:41

डायरेक्टिव इसका मकसद क्या था मैंने आपको

play05:43

बता दिया स्टार्ट में कि स्पेसिफाई द टोटल

play05:46

अमाउंट ऑफ मेमोरी द प्रोग्राम वड टक कि हम

play05:50

कितना हिस्सा रम के अंदर चाहते हैं वह हम

play05:52

डिफाइन करते हैं उसके बाद बिल फर्स आप यूज

play05:57

करते हो स्टैक मेमोरी जो कि मैंने आपको

play05:59

लेक्चर थ्री में रजिस्टर के टाइम बताया था

play06:02

कि स्टेक मैनेजमेंट क्या होती है उसमें

play06:05

पहले जो डाटा डालते हैं वो हमेशा लास्ट

play06:07

में निकलता

play06:08

है तो उस तरह की मैनेजमेंट अगर आप यूज

play06:11

करेंगे तो आपको वो डिफाइन करना पड़ेगा बिल

play06:13

फज आप रेम में ये दो पार्ट्स लिए हुए हैं

play06:16

और एक आप एक्स्ट्रा लेते हो स्टेक के लिए

play06:18

इस तरह तो आप उसके लिए फिर स्टेक का

play06:21

लिखोगे डॉट स्टेक 100 एच साइज है कितना

play06:25

साइज है इसमें तो मॉडल्स थे टाइनी स्मॉल

play06:28

मीडियम कंपैट ला ूज तो हमने स्मल यूज कर

play06:31

लिया लेकिन स्टेक में क्या होगा स्टेक में

play06:34

हम हेक्साडेसिमल

play06:36

से डिफाइन कर देंगे कितना स्पे सही है वो

play06:39

100 ए हमेशा यूज करते हैं क्योंकि 100 एच

play06:41

का मतलब है 100 हेक्सा डेसीमल में तो ये

play06:44

बहुत बड़ा साइज स्टेक का हम हमेशा जब भी

play06:47

स्टेक का काम आएगा स्टेक यूज करेंगे तो

play06:49

डॉट स्टेक 100 ए लिखेंगे लेकिन किस

play06:54

सिचुएशन में जब हमें स्टेक यूज करना होगा

play06:57

तो और बिल फर्स अगर आप ऐसे लिख भी दो तो

play06:59

फर्क नहीं पड़ता अगर आप यूज कर भी रहे हो

play07:02

या नहीं भी कर रहे तो आप डॉट स्टेक एच लिख

play07:04

सकते हो यह स्टेक डायरेक्टिव कहलाता है

play07:08

स्टेक सेगमेंट डायरेक्टिव इसका काम होता

play07:10

है स्पेसिफाई द स्टोरेज फॉर स्टेक जिस तरह

play07:13

मैंने आपको रेम में दिखाया कि ये हिस्सा

play07:15

था वह इसने स्पेसिफाई कर दिया अगर हम यह

play07:18

यूज करते हैं

play07:20

तो उसके बाद

play07:23

अब यह साइज बता दिया और स्टेक का साइज बता

play07:27

दिया कि हमने अपने प्रोग्राम और स्टेक का

play07:29

साइज बता दिया अब डाटा में जो कोड लिखेंगे

play07:35

मतलब डाटा में जो हम वेरिएबल डिफाइन

play07:36

करेंगे उसका यहां पर एक सेगमेंट होगा कि

play07:39

वोह सारा डाटा इसमें सेव हो रहा होगा तो

play07:42

हम लिखेंगे डॉट डाटा डॉट डाटा के अंदर हम

play07:46

लिखेंगे

play07:47

वेरिएबल इसे हम कहते हैं डॉट

play07:51

डटा डाटा सेगमेंट डायरेक्टिव डॉट डाटा इसे

play07:55

हम कहते हैं डाटा सेगमेंट डायरेक्टिव यह

play07:58

क्या करेगा इसके अंदर हम जो भी कोड

play08:00

लिखेंगे जो भी वेरिएबल डिफाइन करेंगे वो

play08:03

डाटा के अंदर चले जाएंगे मतलब यहां के

play08:05

अंदर इसके अंदर हम डिफाइन करते हैं

play08:08

वेरिएबल जिस तरह आप दूसरी लैंग्वेज में

play08:10

वेरिएबल डिफाइन करते हो a इ 3 या कोई

play08:13

स्टिंग करते हो कोई करेक्टर करते हो आप

play08:16

कोई भी वेरिएबल डिफाइन करते

play08:18

हो तो वह हम असेंबली के अंदर इस सेक्शन

play08:21

में करेंगे इस सेगमेंट में करेंगे इसे

play08:24

हमने क्यों कहा डॉट डाटा डाटा सेगमेंट

play08:28

डायरेक्टिव क्यों क्योंकि ये

play08:30

डिफाइन कर रहा है ये डायरेक्ट कर रहा है

play08:32

कि यह वाला जो पार्ट होगा वो सारा इसके

play08:35

अंदर रम के इस पार्ट के अंदर रिजर्व

play08:39

होगा तो वेरिएबल हमें जब डिफाइन करने

play08:41

होंगे तो हम डॉट डाटा के नीचे

play08:45

लिखेंगे और उसके बाद आएगा डॉट

play08:48

कोड अब जब वेरिएबल डिफाइन करने होंगे हम

play08:53

इसके दरमियान इसको डॉट कोड और डॉट डाटा के

play08:57

दरमियान सारे वेरिएबल डिफाइन करेंगे

play09:00

उसके बाद डॉट कोड इसके अंदर हम लिखेंगे

play09:03

इंस्ट्रक्शन अपनी जो रन करनी होंगी इसे हम

play09:06

कहते हैं कोड सेगमेंट डायरेक्टिव इसके

play09:10

अंदर हम

play09:11

हमेशा अपनी इंस्ट्रक्शन लिखेंगे अपना कोड

play09:15

लिखेंगे जो हमें रन करना होगा और वह सारा

play09:18

यहां पर जाके रिजर्व हो जाएगा कोड सेगमेंट

play09:20

के अंदर इसी सेको कहा गया कोड सेगमेंट

play09:23

डायरेक्टिव ये डायरेक्ट कर रहा है कि यह

play09:25

वाला हिसा कोड सेगमेंट में जाएगा तो हमने

play09:30

इसके अंदर इसको एंड करना हो य आपके एंड

play09:33

मेन यह प्रोग्राम पूरा खत्म यहां से लेकर

play09:36

स्टार्ट हुआ और यहां पर एंड हो

play09:39

गया पहले हमने यूज किया मॉडल डायरेक्टिव

play09:43

कि हमने डिफाइन किया कि हमारा स्पेस कितना

play09:45

होगा प्रोग्राम का और अगर हम स्टेक यूज कर

play09:47

रहे तो हमने स्टेक का साइज बताया फिर डॉट

play09:51

डाटा केसके अंदर वेरिएबल डिफाइन करेंगे

play09:54

उसके बाद डॉट कोड जिसके अंदर हम पूरा कोड

play09:56

लिखेंगे फिर एंड में एंड में

play10:00

अब डॉट कोड में हम क्या लिखेंगे

play10:03

इंस्ट्रक्शंस एग्जीक्यूटेबल इंस्ट्रक्शंस

play10:05

जो हम चलाएंगे अपना प्रोग्राम लिखेंगे

play10:08

लेकिन प्रोग्राम भी एक लिखने का तरीका

play10:11

होगा के अगर हमारा प्रोग्राम एक सिंपल एक

play10:16

काम के लिए है मतलब एक प्रोसीजर के लिए है

play10:20

तो हम लिखेंगे इसके अंदर एक प्रोसीजर उसके

play10:22

अंदर प्रोग्राम लिखेंगे अब बहुत सारे

play10:24

प्रोर प्रोसीजर्स हैं डिफरेंट डिफरेंट तो

play10:26

हम डिफरेंट डिफरेंट प्रोसीजर्स इसके अंदर

play10:28

बनाएंगे

play10:30

लेकिन हम बिगिनर्स है हम प्रोफेशनल नहीं

play10:32

है तो हम एक ही प्रोसीजर यूज करेंगे तो हम

play10:35

लिखेंगे सबसे पहले मेन प्रोक प्रोक नाम है

play10:38

इसकी जगह पर हम कुछ भी लि सकते हैं प्रोक

play10:40

मैंने इसलिए लिखा कि इसका नाम प्रोसीजर

play10:43

मेन लिखेंगे उसके बाद नाम कोई लिख सकते

play10:45

हैं उसके बाद नीचे एंड प मतलब यह प्रोसीजर

play10:49

एंड हो गया यहां से लेकर यहां पर एक

play10:52

प्रोसीजर स्टार्ट हुआ यह हमने प्रोसीजर

play10:55

अलग से बनाया डॉट कोड के अंदर इस तरह हम

play10:59

कु बहुत सारे बना सकते हैं ये एक बना दिया

play11:01

फिर इस दूसरा बना दिया इसके नीचे इस तीसरा

play11:03

बना दिया लेकिन एंड में ये होगी कमांड ये

play11:05

तो प्रोसीजर के लिए थी ना पहले यूं था

play11:07

देखे ये यूं यहां से लेके यहां तक इसके

play11:10

अंदर हम कितने भी प्रोसीजर्स बना सकते हैं

play11:13

लेकिन उसका तरीका क्या होगा पहले हम

play11:14

लिखेंगे मेन प्रो और उसको फिर एंड कर

play11:16

देंगे इसके नीचे हम इसी तरह दोबारा बना

play11:18

सकते हैं ये प्रोक वन प्रोक टू ये प्रोक

play11:21

वन प्रोक टू इस तरह बहुत सारे बना सकते

play11:24

हैं नाम कोई भी दे सकते हैं लेकिन ये सेम

play11:26

होगा सिर्फ ये डिफरेंट हो सकता है नाम

play11:30

तो हम हमेशा एक ही प्रोसी यज करेंगे तो हम

play11:34

हमेशा य लिखेंगे एक ही प्रोसीजर होगा

play11:37

हमारा तो आप इसको समझने के यह स्ट्रक्चर

play11:40

है सबसे पहले डॉट मॉडल डॉट स्टेक डॉट डाटा

play11:44

डॉट कोड उसके अंदर मेन प्रोसीजर मेन एंड

play11:48

प्रोसीजर फ एंड मेन यह पूरा हो गया

play11:52

स्ट्रक्चर अब इसके अंदर हम

play11:56

लिखेंगे कोट

play12:01

कोड किस तरह लिखना

play12:03

है कोड हम बिल फर्ज लिखते हैं के करेक्टर

play12:07

प्रिंट करना

play12:08

है तो करेक्टर प्रिंट करने के लिए कौन सा

play12:13

रजिस्टर यूज होता है

play12:17

अमूलेट कोई भी प्रिंट करना हो आउटपुट देना

play12:20

हो या इनपुट लेना हो हम रजिस्टर यूज करते

play12:23

हैं

play12:24

अमूलेट तो प्रोग्राम हमें बनाना है एक

play12:28

करेक्टर स्क्रीन प्रिंट करना है प्रिंट

play12:30

करना है मतलब अमूलेट यूज होगा ठीक है तो

play12:34

अमूलेट क्या करेगा जब हम उसको कहेंगे कि

play12:36

भाई प्रिंट कर दो तो अमूलेट क्या करेगा

play12:39

सीधा जाएगा डाटा रजिस्टर के

play12:43

पास यहां पर जो भी होगा वह अमूलेट प्रिंट

play12:47

कर देगा सबसे पहले हम खुद सोचते हैं कि

play12:51

रजिस्टर्स किस तरह इंटरेक्शन कर रहा है

play12:54

कौन सा रजिस्टर किस लिए काम कर रहा है और

play12:57

वो कहां जाता है टा उठाने अगर हमने

play13:01

रजिस्टर की इंटरेक्शन को समझ लिया तो कोई

play13:04

भी प्रोग्राम हमारे लिए मुश्किल नहीं है

play13:06

हर प्रोग्राम सबसे आसान लगेगा हमें

play13:09

क्योंकि हम रजिस्टर्स के डीप से समझ चुके

play13:13

हैं डीप से समझ आ रहा है रजिस्टर किस तरह

play13:16

एंटेट कर रहे आपस में तो अब प्रोग्राम हम

play13:19

बनाना है के एक करेक्टर स्क्रीन पर प्रिंट

play13:22

करना है मतलब प्रिंट करना है मतलब अमूलेट

play13:24

यूज होगा तो अमूलेट जाएगा डाटा रजिस्टर के

play13:27

पास क्योंकि यह रजिस्टर ही अपने पास

play13:29

आउटपुट संभालता है जो प्रिंट होना होता

play13:32

है तो हम अब अगर करेक्टर प्रिंट करना है

play13:35

तो करेक्टर सबसे पहले भेजना पड़ेगा किसके

play13:37

पास डाटा रजिस्टर के पास फिर इसको बोलना

play13:41

पड़ेगा जाके प्रिंट कर दो तो हम सबसे पहले

play13:43

लेट्स सपोज अगर हमें ए प्रिंट करना है एक

play13:46

करेक्टर ए तो हम डटा रितर में मूव करेंगे

play13:50

ए को इस तरह मूव लिखा फिर स्पेस आया फिर

play13:54

डीए लिखा फिर ए अब ए चला गया डील के अंदर

play14:00

यहां

play14:04

पर

play14:06

अब हमने लिखा मूव डीएल ए तो हम यह

play14:09

इंस्ट्रक्शन किस किस तरह से लिख सकते हैं

play14:12

मैंने आपको बताया था के एड्रेस मोड्स होते

play14:15

हैं लेक्चर फोर में उस तरीके से हम लिख

play14:18

सकते हैं इसके अलावा नहीं लिख सकते अभी

play14:20

यहां पर एक जनरल परपस र् यूज हुआ है डी एल

play14:23

फिर ए अब ये हमारा कौन सा मोड है इमीडिएट

play14:26

एसिंग मोड लेक्चर फोर मैंने आपको बता

play14:30

हम एक रजिस्टर लाजमी यूज करेंगे इस तरह

play14:32

नहीं यूज कर सकते एक करेक्टर हो दूसरा भी

play14:35

करेक्टर हो यह गलत है बिल्कुल गलत और ना

play14:39

ही दो नंबर्स इस तरह भी मूव नहीं कर सकते

play14:41

टू में कैसे मव होगा क्या है एक रजिस्टर

play14:44

होना लाजमी है यह भी गलत और यह भी गलत है

play14:48

कि एक हमारा 16 बिट्स का रर हो दूसरा आ

play14:52

बिट्स का रस्टर हो तो यह भी गलत है दोनों

play14:56

मैच होने चाहिए यह मिस मैच हो रहा है टाइप

play14:59

के यहां पर डील यूज हुआ बिल फर्ज हमारा ए

play15:02

पड़ा था ए एक्स के अंदर अगर मैं यहां पर ए

play15:04

एक् लिखता तो गलत होता यह भी गलत है यहां

play15:08

पर ए एल होना चाहिए या ए एच होना चाहिए कि

play15:11

टाइप मैच करें साइज मैच होना चाहिए दोनों

play15:14

का तो यह भी गलत

play15:16

है एक्सेप्टेबल कनकन से इंस्ट्रक्शन है इस

play15:19

तरह की एक रिर हो दूसरा करेक्टर भेज सकते

play15:22

हैं य कोई नंबर भेज सकते हैं एक र हो एक

play15:25

नंबर भेज सकते हैं दोनों एक्सेप्टेबल है

play15:26

इसके अलावा दोनों 16 बिट्स तो एक्सेप्टेबल

play15:30

है इसके अलावा दोनों अगर आठ आ बिट्स के तो

play15:33

यह भी एक्सेप्टेबल है तो सेंटेंस रूल्स

play15:36

क्या हुए हमारे पहले के मूव और डीएल के

play15:40

दरमियान स्पेस होना चाहिए मतलब ऑफ कोड के

play15:42

बाद स्पेस लाजमी हो अगर स्पेस नहीं होगा

play15:45

तो फिर यह एक ही वर्ड कहलाएगा इसलिए ऑफ

play15:48

कोड के बाद स्पेस होना लाजमी है स्पेस

play15:52

आफ्टर ऑफ कोड मूव के बाद एक स्पेस होना

play15:56

लाजमी है यहां के बाद स्पेस देंगे फिर

play15:58

लिखेंगे

play15:59

फिर रि लिखना हो या करेक्टर लिखना हो

play16:03

दूसरा क्या था के ऑपरेंट मस्ट बी जनरल

play16:08

रजिस्टर वन ऑपरेंट मस्ट बी जनरल परपस

play16:11

रजिस्टर मैंने आपको बता दिया गलत है एक

play16:16

होना ज परपस होना लाजमी है और मैंने वह

play16:19

बताया था आपको लेक्चर फोर में एड्रेस मोड

play16:21

कनकन से उन सब में एक रजिस्टर लाजमी यूज

play16:24

हुआ हुआ था जनरल परपस तो एक जन रस्टर होना

play16:28

ला लाजमी है इसके अलावा ऑपरेंट मस्ट बी ऑफ

play16:33

सेम साइज मैंने आपको बता दिया कि ये डीएल

play16:35

था आ बिट्स का ये था 16 बिट्स का तो ये

play16:37

गलत हो गया मिसमैच हो गया टाइप मैच होना

play16:40

लाजमी है दोनों 16 बिट्स यूज कर सकते हैं

play16:42

दोनों आ बिट्स भी यूज कर सकते

play16:45

हैं उसके अलावा कॉमा बिटवीन ओपंस डिसर आ

play16:50

गया उसके बाद मैंने करेक्टर यूज किया है

play16:53

तो कॉमा बीच में आएगा दो सेपरेट करेगा कि

play16:56

दो अलग-अलग चीजें है ये फर्स्ट ऑपरेंट

play16:59

सेकंड ऑपरेंट दोनों को सेपरेट करने के लिए

play17:01

हम कॉमा यूज

play17:03

करेंगे अब हमने डेटा रजिस्टर के अंदर ए

play17:08

डाल दिया अब इसको कहना है कि प्रिंट कर दो

play17:10

और यह खुद ही यहां पर आएगा और प्रिंट कर

play17:12

देगा तो हमने ए को टू भेज दिया मू एच टू

play17:17

मतलब टू क्या था सर्विस रूटीन एक्शन मैंने

play17:20

आपको लेक्चर फोर में बताया था कि कौन-कौन

play17:22

से एक्शन है कौन-कौन से सर्विस रूटीनस है

play17:25

प्रिंट करने के लिए एक सिंगल कैरेक्टर

play17:27

प्रिंट करने के लिए हम टू यू करते हैं तो

play17:29

टू ए के पास चला गया मतलब एच समझ गया कि

play17:34

मुझे क्या करना है उसे प्रिंट करना है वह

play17:37

सीधा जाएगा डटा सर के पास और प्रिंट कर

play17:40

देगा लेकिन उसके लिए कैसे प्रिंट करेगा

play17:43

स्क्रीन पर आना होगा और स्क्रीन पर आने के

play17:46

लिए इंटर चाहिए होगा क्योंकि वह हार्डवेयर

play17:49

से इंटरेक्ट कर रहा है मैंने आपको लेक्चर

play17:51

फोर में बताया था कि जब भी इनपुट की बात

play17:53

होगी आउटपुट की बात होगी तो हमेशा हम

play17:56

इंटरप्ट यूज करेंगे आई एनटी

play18:00

21 एच अगर टेक्स्ट का है

play18:03

तो तो पहले हमने डेटा रे अंदर ए डाल दिया

play18:08

फिर ए को हमने कॉल कर दिया मूव एच टू 21

play18:13

एच यह दोनों लाइंस जरूरी है प्रिंट हो या

play18:19

इनपुट हो मैंने आपको लेक्चर फोर में डिटेल

play18:21

से बताया था क्यों तो करेक्टर भेज दिया

play18:25

हमने कमांड भेज दी ए को हमें प्रिंट करना

play18:29

है तो ए के पास टू गया इसने समझा कि मुझे

play18:33

प्रिंट करना है फिर य सीधा इधर गया जहां

play18:35

पर हमने ए डाला हु था तो यह प्रिंट कर

play18:38

देगा तो यहां पर हमारा ए प्रिंट हो गया

play18:40

लेकिन आप सोचिए अब आप रजिस्टर के अंदर जा

play18:45

चुके हो मतलब यहां पर गए यहां से उठाया

play18:47

प्रिंट किया लेकिन अभी यहां से निकलना भी

play18:50

तो है एग्जिट भी तो होना है रजिस्टर के अब

play18:53

हमें यहां से निकल के वापसी आना है रिटर्न

play18:56

करना है जब रिटर्न करेंगे तो मैंने आपको

play18:58

बताया था कि कौन सा यूज होता है सर्विस

play19:00

रूटीन फोर सीच हम ए के पास दोबारा अब

play19:04

भेजेंगे

play19:06

मूव एमा फ सी इसका मतलब कि अब यहां से

play19:12

निकल के वापसी आ जाओ अब निकलना है तो इसके

play19:16

लिए हम यूज करेंगे इंटर 21 ए इंटरप्ट तो

play19:19

लाजमी चाहिए होगा इनपुट आउटपुट के लिए तो

play19:21

यह भी एक इंटरप्ट था कि हम इसको जब इस

play19:24

हार्डवेयर से इंट करवाया तो वापसी आ रहे

play19:26

हैं वापसी के लिए हमने यूज कर लिया इंट 21

play19:28

वही य होगा तो आप यूं समझ

play19:32

ले के यह भी पार्ट हो गया प्रोग्राम

play19:35

स्ट्रक्चर का कि एंड में हमेशा यह लाजमी

play19:38

लिखेंगे हमेशा यह वाला हिस्सा और यह वाला

play19:42

हिस्सा लाजमी लिखेंगे क्योंकि एंड में

play19:45

हमें रिटर्न भी तो होना है हम बीच में रिस

play19:48

के अंदर जाएंगे फिर वापसी एंड में

play19:50

निकलेंगे जरूर तो आप इसको प्रोग्राम का

play19:53

पार्ट समझ ले इसको और इन सबको सबसे पहले

play19:58

हम ने डॉट मॉडल डिफाइन किया स्पेस कितना

play20:01

चाहिए स्मॉल मतलब 64 केब का कोड होगा डाटा

play20:05

भी 64 केब या लेसन इक्वल टू उसके बाद अगर

play20:09

हम स्टेक यूज कर रहे हैं तो डॉट स्टेक 100

play20:12

एच लिखेंगे उसके बाद डॉट डाटा जिसके अंदर

play20:14

वेरिए बल्स हमारे डिफाइन होंगे उसके बाद

play20:17

डॉट कोड जिसके अंदर हम

play20:20

अपना कोड लिखेंगे तो उसमें मुख्तलिफ

play20:23

प्रोसीजर बना सकते हैं लेकिन हम हमेशा एक

play20:25

ही प्रोसीजर बनाएंगे तो हमने लिखा मेन

play20:27

प्रोसीजर का नाम प्रॉक लिख दिया मैंने और

play20:30

इस प्रोसीजर को एंड कर दिया मेन एंड

play20:31

प्रोसीजर और ये मैंने प्रोग्राम को एंड कर

play20:33

दिया एंड

play20:35

मेन अब यह देख रहे हैं आप यह मैंने सेमी

play20:38

कॉलन लगा के लिखा हुआ है हेयर वी राइट अवर

play20:40

प्रोग्राम एग्जीक्यूटेबल इंस्ट्रक्शंस इस

play20:43

कोड में हम अपने इंस्ट्रक्शन लिखेंगे

play20:45

लेकिन इस सेमीकलन का मतलब होता है कि यह

play20:49

पूरी लाइन एक कमेंट है जब कमेंट का मतलब

play20:52

होता है कि वो चीज प्रोग्राम में रन नहीं

play20:56

होगी तो इसे हम कहते हैं कमेंट तो

play20:58

सिंटेक्स रूल्स में हमारा एक यह भी ऐड हो

play21:01

गया कि सबसे

play21:04

पहले हम कमेंट लिख सकते हैं उसके लिए हम

play21:07

सेमीकलन

play21:09

लगाएंगे

play21:11

अब बिल फर्ज आप भूल जाते हो के मुझे डॉट

play21:17

मॉडल पहले लिखना था या डॉट स्टेक 100 ए

play21:19

पले लिखना था या डॉट डाटा पले लिखना था

play21:22

अगर आपकी अरेंजमेंट सही नहीं है आप भूल

play21:25

जाते हो कि कौन सा मुझे पहले लिखना था कौन

play21:27

सा बाद में लिखना

play21:29

तो अरेंजमेंट अगर आपको समझनी हो आपसे गलती

play21:33

हो रही हो तो आप सबसे पहले

play21:35

लिखोगे डी ओ एस एस ई जी इसका मतलब होता है

play21:39

डॉट सेगमेंट यह खुद ब खुद आपके प्रोग्राम

play21:44

के सेगमेंट्स को अरेंज कर देगा अगर आपने

play21:47

कोई गलती की है तो उसको सही करके रन कर

play21:50

देगा तो हम सबसे पहले हमेशा यह लिखेंगे

play21:52

इसका काम होता है मैनेज द अरेंजमेंट ऑफ

play21:55

सेगमेंट इन प्रोग्राम यह हमारे प्रोग्राम

play21:59

स्ट्रक्चर का पार्ट नहीं है लेकिन हम ये

play22:02

ऐड करते

play22:03

हैं किसलिए अगर हमसे गलती हो सेगमेंट्स

play22:06

आगे पीछे करने में तो यह डोज सेगमेंट डोज

play22:10

को बता देगा कि भाई तुम देख लो अपने हिसाब

play22:13

से कोई मैंने गलती की हुई है तो तुम खुद

play22:15

सेट कर लो प्रोग्राम को रन कर दो कोई गलती

play22:18

शो ना करो तो हम सबसे पहले यूज करेंगे डॉट

play22:20

डॉज

play22:22

सेगमेंट अब सबसे पहले स्टार्ट में क्या

play22:25

आया हमारे पास डोज सेगमेंट तो आप जब भी

play22:27

प्रोग्राम लिखो जब भी लिखो अगर आप 100% शर

play22:31

हो तो य लिखने की जरूरत नहीं है लेकिन

play22:34

बेस्ट प्रैक्टिस यही रहेगी कि हम सबसे

play22:36

पहले यह लिखें हम इंसान है गलती हो सकती

play22:39

है तो सबसे पहले यह लिखेंगे उसके बाद डॉट

play22:41

मॉडल आ गया स्टेक आ गया यह सब जो मैं आपको

play22:44

बता दिया इसके अलावा मैंने आपको कमेंट के

play22:46

बारे में बताया कि कमेंट सेमीकलन से

play22:49

स्टार्ट होगा व सिंटेक्स रूल का हमारा

play22:51

हिस्सा हो गया तो हम य इसको लिख देते हैं

play22:53

कमेंट मस्ट स्टार्ट विद सेमीकलन जिस तर य

play22:57

हो गया अब आप

play22:59

ये कमेंट मैंने यहां पर लिखा है मैं यहां

play23:01

पर लिख सकता हूं इसके आगे लिख सकता हूं

play23:03

इसके आगे लिख सकता हूं मैं इसको कहीं भी

play23:05

लिख सकता हूं क्योंकि यह प्रोग्राम का

play23:07

पार्ट नहीं है प्रोग्राम इसका रन नहीं

play23:09

करेगा इसको तो अगर मैं इसी लाइन को यहां

play23:13

पर सबसे पहले लिखूं तब भी कोई फर्क नहीं

play23:15

पड़ता इससे फायदा क्या होगा कि बिल फर्ज

play23:18

हम प्रोग्राम को नाम देना चाहते हैं अभय

play23:21

मैंने प्रोग्राम बनाया है प्रोग्राम टू

play23:22

प्रिंट अ सिंगल कैरेक्टर ऑन स्क्रीन तो

play23:25

मैं इसको एज अ टाइटल यहां पे लिख सकता हूं

play23:28

स्टार्ट लेकिन एस अ कमेंट सेमीकलन लगाया

play23:31

उसके बाद मैंने नाम लिख दिया प्रोग्राम टू

play23:34

प्रिंट अ सिंगल कैरेक्टर ऑन स्क्रीन अब

play23:37

कंप्लीट हमारा प्रोग्राम बन गया सबसे पहले

play23:41

टाइटल लिख दिया

play23:43

हमें सेम कलन लगा के पूरा लिख दिया उसके

play23:47

बाद डॉ सेगमेंट जो हमारा सेगमेंट्स मैनेज

play23:51

करेगा उसके बाद डॉट मॉडल स्मल हमने साइज

play23:54

डिफाइन कर दिया कि हमें स्पर्श कितना

play23:56

चाहिए उसके बाद स्टेक एच अगर हम यूज कर

play23:58

रहे हैं तो उसके बाद डॉट डटा जिसके अंदर

play24:01

हम वेरिएबल डिफाइन करेंगे उसके बाद डॉट

play24:04

कोड जिसके अंदर हम अपना कोड लिखेंगे एसिट

play24:08

इंस्ट्रक्शन य आखिर में एंड हो जाएगा इसके

play24:12

अंदर हम प्रोसे डिफाइन करेंगे लिखना

play24:13

चाहेंगे उसके अंदर हम पूरा कोड लिखेंगे तो

play24:17

यह कंप्लीट हो गया प्र प्रोग्राम

play24:19

स्ट्रक्चर किस तरह होता है

play24:21

सिंटेक्स रूल्स क्या होते हैं और हमने एक

play24:25

प्रोग्राम बना लिया टू प्रिंट स कटन

play24:27

स्क्रीन ए को हमने डीएल हमने ए

play24:31

भेजा ए के पास टू भेजा प्रिंट करने के लिए

play24:33

एंटर कॉल किया फिर वापसी आ गए फिर

play24:36

प्रोग्राम खत्म हो गया थैंक यू सो मच अगले

play24:39

प्रोग्राम में हम डज बॉक्स स्टॉल करेंगे

play24:41

और यही प्रोग्राम वहां बना के रन करेंगे

play24:44

एंड यस डोंट फॉरगेट टू सब्सक्राइब

Rate This

5.0 / 5 (0 votes)

الوسوم ذات الصلة
Assembly LanguageMemory ManagementScreen PrintingProgramming StructureCode SegmentData SegmentStack DirectiveInstruction ExecutionBeginners GuideProgramming TutorialSyntax Rules
هل تحتاج إلى تلخيص باللغة الإنجليزية؟