Experimental task 1
1. Task 1-1
To program task1_1.asm assembles and connects, loads and tracks debugging with debug, and answers questions based on the results.
task1_1.asm
assume ds:data, cs:code, ss:stack data segment db 16 dup(0) data ends stack segment db 16 dup(0) stack ends code segment start: mov ax, data mov ds, ax mov ax, stack mov ss, ax mov sp, 16 mov ah, 4ch int 21h code ends end start
① In debug, execute until the end of line17 and before line19. Record this time: register (DS) =__ 076A__, Register (SS)=
__ 076B__, Register (CS) =_ 076C___
② Assuming that the segment address of the code segment is X after the program is loaded, the segment address of the data segment is X__ X-2__, The segment address of stack is__ X-1__.
2. Task 1-2
task1_2.asm
assume ds:data, cs:code, ss:stack data segment db 4 dup(0) data ends stack segment db 8 dup(0) stack ends code segment start: mov ax, data mov ds, ax mov ax, stack mov ss, ax mov sp, 8 mov ah, 4ch int 21h code ends end start
① In debug, execute until the end of line17 and before line19. Record this time: register (DS) =__ 076A__, Register (SS)=
__ 076B__, Register (CS) =_ 076C___
② Assuming that the segment address of the code segment is X after the program is loaded, the segment address of the data segment is X__ X-2__, The segment address of stack is__ X-1__.
3. Tasks 1-3
task1_3.asm
assume ds:data, cs:code, ss:stack data segment db 20 dup(0) data ends stack segment db 20 dup(0) stack ends code segment start: mov ax, data mov ds, ax mov ax, stack mov ss, ax mov sp, 20 mov ah, 4ch int 21h code ends end start
① In debug, execute until the end of line17 and before line19. Record this time: register (DS) =__ 076A__, Register (SS)
= __ 076C__, Register (CS) =__ 076E__
② Assuming that the segment address of the code segment is X after the program is loaded, the segment address of the data segment is X__ X-4__, The segment address of stack is
__X-2__.
4. Tasks 1-4
To program task1_4.asm assembles and connects, loads and tracks debugging with debug, and answers questions based on the results.
task1_4.asm
assume ds:data, cs:code, ss:stack code segment start: mov ax, data mov ds, ax mov ax, stack mov ss, ax mov sp, 20 mov ah, 4ch int 21h code ends data segment db 20 dup(0) data ends stack segment db 20 dup(0) stack ends end start
① In debug, execute until the end of line9 and before line11. Record this time: register (DS) =__ 076CH__, Register (SS)=
__ 076EH__, Register (CS) =__ 076AH__
② Assuming that the segment address of the code segment is X after the program is loaded, the segment address of the data segment is X__ X+2__, The segment address of stack is
__X+4__.
5. Tasks 1-5
Based on the practice and observation of the above four experimental tasks, summarize and answer:
① For the segment defined below, after the program is loaded, the actual memory space allocated to the segment is__ (N/16+1)*16B__.
② If the program Task1_ 1.asm, task1_ 2.asm, task1_ 3.asm, task1_ 4. In ASM, the pseudo instruction end start is changed to
end, which program can still execute correctly? The reasons are analyzed and explained in combination with the conclusions obtained from practical observation
Answer: task1_4.asm can still be executed because Task1_ 4. The program entry of ASM is at the beginning.
Experimental task 2
Write an assembly source program to realize 160 consecutive bytes to memory units b800:0f00 ~ b800:0f9f, and fill hexadecimal numbers repeatedly in turn
According to 03 04.
assume cs:code code segment start: mov ax, 0B800h mov ds, ax mov bx, 0F00h mov ax, 0403h mov cx, 80 s:mov [bx],ax add bx,2h loop s mov ax,4c00h int 21h code ends end start
Experimental task 3
It is known that the 8086 assembly source program task3.asm code fragment is as follows.
assume cs:code data1 segment db 50, 48, 50, 50, 0, 48, 49, 0, 48, 49 ; ten numbers data1 ends data2 segment db 0, 0, 0, 0, 47, 0, 0, 47, 0, 0 ; ten numbers data2 ends data3 segment db 16 dup(0) data3 ends code segment start: ; ××× mov ah, 4ch int 21h code ends end start
requirement:
① the data of logic segment data1 and logic segment data2 are added in turn by programming, and the results are saved in logic segment data3.
assume cs:code data1 segment db 50, 48, 50, 50, 0, 48, 49, 0, 48, 49 ; ten numbers data1 ends data2 segment db 0, 0, 0, 0, 47, 0, 0, 47, 0, 0 ; ten numbers data2 ends data3 segment db 16 dup(0) data3 ends code segment start: mov ax,data1 mov ds,ax mov ax,data2 mov es,ax mov cx,10 mov bx,0 s1: mov ax, es:[bx] add [bx],ax inc bx inc bx loop s1 mov ax,data3 mov es,ax mov bx,0 mov cx,10 s2: mov ax,[bx] mov es:[bx],ax inc bx loop s2 mov ah,4ch int 21h code ends end start
② Load, disassemble and debug in debug. Before and after the data items are added in turn, view the three logical segments data1 respectively,
Confirm that the memory space corresponding to data2 and data3 is added one by one to ensure that the result exists in the logical segment data3.

Experimental task 4
It is known that the 8086 assembly source program task4.asm code fragment is as follows.
task4.asm
assume cs:code data1 segment dw 2, 0, 4, 9, 2, 0, 1, 9 data1 ends data2 segment dw 8 dup(?) data2 ends code segment start: mov ax,data1 mov ds,ax mov ax,data2 mov ss,ax mov sp,16 mov bx,0 mov cx,8 s: push [bx] add bx,2 loop s mov ah, 4ch int 21h code ends end start
requirement:
① Complete the program to store the eight word data in logical segment data1 in reverse order in logical segment b.
② After assembly and connection, load the program in debug and run it to line15. Before the program exits, use the d command to view the data corresponding to data segment data2
Memory space, confirm whether the subject requirements are met.

Experimental task 5
Read the source program, theoretically analyze the functions of the source code, especially line15-25. What are the functions realized by the loop, and understand each reference line by line
The function of the command.
Assemble and link the program to get the executable file, run and observe the results.
Use the debug tool to debug the program. Before the program returns, that is, after line25 and before line27, observe
result.
What is the function of line19 in the source code?
A: if the lower address is a lowercase letter, turn it into an uppercase letter. By bitwise and, turn the fifth bit of the binary Ascii code corresponding to the lowercase letter into 0, that is, subtract 32 from the Ascii value to become an uppercase letter.
What is the purpose of the byte data in the data segment line4 in the source code?
A: set the color of the word.
Modify the value of 5 byte units in line4, reassemble, link, run and observe the results.

Experimental task 6
It is known that the 8086 assembly source program task6.asm code fragment is as follows.
task6.asm
assume cs:code, ds:data data segment db 'Pink Floyd ' db 'JOAN Baez ' db 'NEIL Young ' db 'Joan Lennon ' data ends code segment start: mov ax,data mov ds,ax mov bx,0 mov cx,4 s: or [bx],byte ptr 00100000b add bx,16 loop s mov ah, 4ch int 21h code ends end start
requirement:
① Complete the program and change the first word of each line in the data section from uppercase to lowercase.
② Load the program in debug, disassemble it, and check the memory space corresponding to the data segment with the d command before exiting line13, and confirm that each
The first word of the line has been changed from uppercase - > lowercase.
Experimental task 7
requirement:
① Complete the program, realize the title requirements, and write the year, income, number of employees and per capita income into the table section in a structured way.
In the table, each row of data occupies 16 bytes in the logical segment table, and the byte size of each data is allocated as follows. Interim, between data
Space spacing.
assume cs:code, ds:data, es:table data segment db '1975', '1976', '1977', '1978', '1979' dw 16, 22, 382, 1356, 2390 dw 3, 7, 9, 13, 28 data ends table segment db 5 dup( 16 dup(' ') ) ; table ends code segment start: mov ax,data mov ds,ax mov ax,table mov es,ax mov cx,5 mov si,0 mov bx,0 s: mov ax,[si] mov es:[bx],ax mov ax,[si+2] mov es:[bx+2],ax add bx,10h add si,4 loop s ;particular year mov cx,5 mov si,20 mov bx,5 s1:mov ax,[si] mov es:[bx],ax mov ax,0 mov es:[bx+2],ax add bx,16 add si,2 loop s1; ;income mov cx,5 mov si,30 mov bx,10 s2:mov ax,[si] mov es:[bx],ax add bx,16 add si,2 loop s2 ;Number of employees mov cx,5 mov si,5 s3:mov ax,es:[si] mov bl,es:[si+5] div bl mov es:[si+8],al add si,16 loop s3 ;Per capita income mov ah, 4ch int 21h code ends end start