Use assembly language to find the number of the middle size of three numbers and output it.

Updated on educate 2024-03-08
4 answers
  1. Anonymous users2024-02-06

    24) Designator: mm Function: Find the extreme value of a single-byte hexadecimal unsigned data block.

    Ingress condition: The first address of the data block is in DPTR, and the number of data blocks is in R7.

    Impact Resources: PSW, A, B, R1 R7 Stack Requirements: 4 bytes.

    mm: mov b,r7 ;The number of data that can be saved.

    movx a,@dptr ;Read the first data.

    mov r6,a ;as the initial value of the maximum value.

    mov r7,a ;Also as the initial value of the minimum value.

    mov a,dpl ;Take the address of the first data.

    mov r3,a ;The initial value of the address is stored as the maximum value.

    mov r5,a ;It is also used as a minimum value to store the initial value of the address.

    mov a,dph

    mov r2,a

    mov r4,a

    mov a,b ;The number of data to be retrieved.

    dec a ;Subtract one to get the number of times you need to compare.

    jz mme ;There is only one data, and there is no need to compare.

    mov r1,a ;Save the number of comparisons.

    push dpl ;The first address of the protected data block.

    push dph

    mm1: inc dptr ;Point to a new piece of data.

    movx a,@dptr ;Read this data.

    mov b,a ;Save.

    setb c ;Compare with the maximum.

    subb a,r6

    jc mm2 ;Do not exceed the current maximum and maintain the current maximum.

    mov r6,b ;If the current maximum value is exceeded, the maximum storage address is updated.

    mov r2,dph ;Also update the maximum storage address.

    mov r3,dpl

    sjmp mm3

    mm2: mov a,b ;Compare with the minimum.

    clr csubb a,r7

    jnc mm3 ;Greater than or equal to the current minimum, maintain the current minimum.

    mov r7,b ;Update the minimum value.

    mov r4,dph ;Update the minimum storage address.

    mov r5,dpl

    mm3: djnz r1,mm1 ;Handle all data.

    pop dph ;Restore the data address.

    pop dpl

    mme: ret

  2. Anonymous users2024-02-05

    The program should be written by itself, and what you ask others is not your own.

  3. Anonymous users2024-02-04

    A: There are three syntax errors in the landlord program:

    Error 1: The segment register DS is not initialized, ASSUME only associates the DSEG with the DS register, and does not store the segment base address of the data segment in the segment register DS, so it is necessary to add the statement:"mov ax,dseg mov ds,ax";

    Error 2: Because all the data in the date in this program is 8-bit binary, if the 8-bit register is assigned to a 16-bit register, the indefinite number of the 8-bit higher register will disrupt the program;

    Error 3: The RET instruction is the return instruction of the subroutine (there is no subroutine in this program), RET cannot achieve the exit program operation that the landlord wants, you can use jmp to jump to the end of the program to exit the program.

    Program logic: The logic of the landlord is to deposit the maximum number into CL and the minimum number into AL by way of bubble sorting. The modified program has achieved this effect through debug traces and found that there are no logical errors.

    Figure A is the modified source program, and Figure B is the data storage in the register before the program is executed and exited during the debugging process (as can be seen from the annotations: Al stores the minimum number, BL stores the middle number, and CL stores the maximum number).

    Figure A: Figure B:

  4. Anonymous users2024-02-03

    1. Enter a number on the keyboard, if it is greater than 7, it is required to re-enter 0 7, and you don't need to re-enter it.

    2. If it is less than 7, the calculation result of *2 will be displayed, note that there are two cases here:

    Equals 7, what should I do?

    a, if the input number is less than or equal to 4, the result of the calculation is the number (0-9) display.

    b, if the input number is greater than 4, the result is that the letters (a to f) are displayed a, c.

    Equals 7, what should I do?

Related questions
10 answers2024-03-08

Assembly language can be said to be machine language, and what deals directly with hardware is to transform computer language into 1001 that machines can recognize. It's not going to go out of style, at least not for this decade. It's mostly about the hardware side though. >>>More

7 answers2024-03-08

The latter instruction is div bx, indicating that you are doing 16-bit division, then the default dividend is [dx,ax], where dx is the higher 16 bits of the dividend, ax is the lower 16 bits of the dividend, and in fact your dividend is only stored in ax, then the high position of the dividend should be cleared to zero, for example, if you want to calculate 72 8, but the dividend must be 4 digits, so should your dividend be written as 0072? >>>More

4 answers2024-03-08

There are four segments in it, which are A, B, C, and Code. >>>More

2 answers2024-03-08

The void ziq() part doesn't say anything Sark, just turn it around. >>>More

6 answers2024-03-08

**The Way of Microsoft Core Technology Series.

Executive summary. From the perspective of a Microsoft insider, this book reveals all aspects of software coding, software testing, and project management. >>>More