Write a simple subprogram, what is a subprogram, and how to use it???

Updated on technology 2024-04-06
7 answers
  1. Anonymous users2024-02-07

    fun proc near

    mov bl,10d

    div bl

    mov bh,al

    mov bl,ah

    retfun endp

    div is a division instruction, divide by 10 and then put it in al, the remainder ah

  2. Anonymous users2024-02-06

    The steps to write a subroutine are as follows:

    1. First think clearly about the function of the subprogram in your mind, and sort out the preconditions and postconditions of the subprogram. 2. Give the subroutine a good name. This is a sign of a good subroutine.

    3. Write test cases. 4. Write and optimize the pseudo-inspection of the old **. There should be no methodological elements of specific language when writing pseudo-**; When writing pseudo-**, it also stands at a relatively high level and writes in more detail.

    5. Convert pseudo** into sentences in specific languages.

    6. After the subprogram is written, the first and most important thing is to execute the subprogram in your own mind, and check all possible execution paths, endpoints and all abnormal conditions of the subprogram. Usually this process can find the vast majority of errors. 7. Compile subroutines.

    Set the compiler's warning level to the highest during compilation, and pay attention to each warning message generated by the compiler. 8. Execute subroutines line by line in the debugger9. Execute unit tests. The test cases written in step 3 are also used in the process of high availability.

    10. Modify the problems found in the test, if there are many problems, do not modify the subprogram, but directly rewrite the subprogram. 11. Check whether the subprogram conforms to some basic ideas of the software process. Such as coupling, naming of variables, layout of statements, comments, etc.

  3. Anonymous users2024-02-05

    Summary. Dear, hello, I'm glad for your question, can the use of subroutines make the program more convenient, help you find the following answers: Yes, the use of subroutines can make the program more convenient.

    The use of subroutines makes the program more readable and easier to understand than any feature of any programming language. Subroutines are also the most important means of saving space and improving performance that have been invented to date. Unified modifications in one place.

    The use of subroutines makes modern programming possible.

    Dear, hello, I'm glad for your question, can the use of subprograms make the program more convenient, help you find the following answers: Yes, the use of subprograms can make the program more convenient. The use of subroutines makes the program easier to read and easier to guess than any feature of any programming language.

    Subroutine resistance is also the most important means of saving space and improving performance that has been invented so far. Unified modifications in one place. The use of subroutines makes modern programming possible.

    Pro, subprogram is a program structure often used in program design, by making some fixed, frequently used functions into the form of subprograms, the source program and the target program can be greatly shortened, and the efficiency and reliability of program design can be improved. A subroutine (English: subroutine, procedure, function, routine, method, subprogram, callable unit) is a rotten part of a large program, consisting of one or more blocks of statements.

    The use of subroutines can be saved, using structured and modeled programming.

    Pro, the primary reason to use subroutines is to reduce the complexity of the program, and subroutines can be used to imply information.

  4. Anonymous users2024-02-04

    Subroutine is a general term for any program called by a high-level program. It is often used at the assembly language level. The body of a subroutine is a chunk that goes into operation when it is called.

    Programming languages in general contain two basic abstractions: process abstraction and data abstraction. Process abstraction is sometimes referred to as control abstraction.

    Subroutines are the primary process abstraction mechanism. Methods in object-oriented languages are very similar to the concept of subroutines, except in their invocation and the way they relate to a class or object. There is only one entry per subroutine.

    During execution, the invoker unit is stopped, i.e., only one subroutine at any given time always returns control to the invoker after the execution of the subroutine has been executed.

  5. Anonymous users2024-02-03

    The so-called subprogram is a program module that can complete a certain function, and it cannot be executed automatically, but can only be executed by the upper-level program.

    The execution of a subroutine consists of at least two steps: invocation and return. By executing the subroutine invocation instruction, the CPU automatically saves the current program breakpoint (where the program is interrupted), and then moves to execute the invoked subroutine; When the subroutine is executed, the CPU returns to the breakpoint by executing the subroutine return instruction to continue executing the instruction. Hope mine is helpful to you!

  6. Anonymous users2024-02-02

    1) There are several places on the part with the same contour shape, in this case, only a subprogram for processing the contour shape is written, and then the method of calling the subprogram multiple times with the main program completes the processing of the workpiece.

    2) the path of the code book with the same trajectory repeatedly appears in the processing, if the path of the same trajectory appears in a certain processing area or at all levels in this area, it is more convenient to use the subprogram to write the machining program, and the increment value is commonly used in the program to determine the cutting depth.

    3) when processing more complex parts, often contains many independent processes, sometimes the process needs to be properly adjusted and merged, in order to optimize the processing program, each independent process is programmed into a sub-program, so that a modular program structure is formed, which is convenient for the adjustment of the processing sequence, and there are only instructions such as tool change and calling sub-program in the main program.

  7. Anonymous users2024-02-01

    【注音】: zǐ chéng xùIn computer science, a subprogram (English: subroutine, procedure, function, routine, method, subprogram, callable unit) is a part of a large program, consisting of one or more blocks of statements.

    It is responsible for completing a specific task and is relatively independent compared to others. 1 There will generally be input parameters with return values, providing encapsulation and concealment of the details of the process. These are often integrated as software libraries.

    1 Functions are already present in process-oriented languages. It is the predecessor of structs and classes. In itself, it is a categorization of relevant statements and an abstraction of a process.

Related questions
6 answers2024-04-06

Okay, I'll give you a simple one.

5 answers2024-04-06

Some exe files are encrypted (packed), you can't see it directly, you have to unshell it first. >>>More

11 answers2024-04-06

Cheng Yu. In the Romance of the Three Kingdoms.

, it's Cao Cao. >>>More

7 answers2024-04-06

Enter the following command in the command prompt:

for %1 in (%windir%\system32\*.dll) do /s %1 >>>More