I
1-1.
(1)task1_1.asm source code
assume ds:data, cs:code, ss:stack data segment db 16 dup(0) ;16 byte units are reserved, and the initial values are 0 data ends stack segment db 16 dup(0) ;16 byte units are reserved, and the initial values are 0 stack ends code segment start: mov ax, data mov ds, ax mov ax, stack mov ss, ax mov sp, 16 ;Set stack top mov ah, 4ch int 21h code ends end start
(2)task1_1 screenshot before the end of line17 and line19


(3) Question answer
① 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_. // ds=cs-2,ss=cs-1
1-2.
(1) Task task1_2.asm source code
assume ds:data, cs:code, ss:stack data segment db 4 dup(0) ; Four byte units are reserved, and the initial value is 0 data ends stack segment db 8 dup(0) ; 8 byte units are reserved, and the initial values are 0 stack ends code segment start: mov ax, data mov ds, ax mov ax, stack mov ss, ax mov sp, 8 ; Set stack top mov ah, 4ch int 21h code ends end start
(2)task1_2. After debugging to the end of line17 and before line19, observe the screenshot of register DS, CS and SS values


(3) Question answer
① 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_.
1-3.
(1) Task task1_3.asm source code
assume ds:data, cs:code, ss:stack data segment db 20 dup(0) ; 20 byte units are reserved, and the initial values are 0 data ends stack segment db 20 dup(0) ; 20 byte units are reserved, and the initial values are 0 stack ends code segment start: mov ax, data mov ds, ax mov ax, stack mov ss, ax mov sp, 20 ; Set initial stack top mov ah, 4ch int 21h code ends end start
(2)task1_3. Screenshot of the values of registers DS, CS and SS before the end of debugging to line17 and line19


(3) Question answer
① 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_.
1-4.
(1) Task task1_4.asm source code
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
(2)task1_4. After debugging to the end of line17 and before line19, observe the screenshot of register DS, CS and SS values



(3) Question answer
① In debug, execute until the end of line9 and before line11. Record this time: register (DS) =_ 076c_, Register (SS) =_ 076e_, Register (CS) =_ 076a_
② 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_.
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+15)/16)*16_.
xxx segment db N dup(0) xxx ends
② If the program Task1_ 1.asm, task1_ 2.asm, task1_ 3.asm, task1_ 4. In ASM, if the pseudo instruction end start is changed to end, which program can still be executed correctly. The reasons are analyzed and explained in combination with the conclusions obtained from practical observation.
task1_4.asm can be executed correctly. If the entry location is not specified, the program will be executed from the allocated space, only task1_4.asm starts with the instruction code.
II
(1) Assembly source code
assume cs:code code segment mov ax,0b800h mov ds,ax mov bx,0f00h mov cx,160 s: mov ax,0304h mov [bx],al inc bx loop s mov ax,4c00h int 21h code ends end
(2) Screenshot of operation results



III
(1) Complete assembly source code
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 bx,0 mov cx,10 s: mov al,[bx] add es:[bx],al inc bx loop s mov ax,data3 mov ds,ax mov bx,0 mov cx,10
s0: mov al,es:[bx] mov [bx],al inc bx loop s0 mov ax,4c00h int 21h code ends end start
(2) Load, disassemble and debug screenshots in debug
It is required to give the debug command and screenshot to view the original value of memory space data corresponding to logical segments data1, data2 and data3 before the data items are added in turn, and the debug command and screenshot to view the original value of memory space data corresponding to logical segments data1, data2 and data3 after the data items are added in turn




After adding in sequence:


IV
(1) Complete assembly source code
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 bx,0 mov ss,ax mov sp,16 mov cx,8 s: push [bx] add bx,2 loop s mov ah, 4ch int 21h code ends end start
(2) Screenshots of loading, disassembly and debugging in debug are required. Before the program exits, use the d command to view the screenshot of the memory space corresponding to data segment data2.



V
(1)task5.asm source code
assume cs:code, ds:data data segment db 'Nuist' db 2, 3, 4, 5, 6 data ends code segment start: mov ax, data mov ds, ax mov ax, 0b800H mov es, ax mov cx, 5 mov si, 0 mov di, 0f00h s: mov al, [si] and al, 0dfh mov es:[di], al mov al, [5+si] mov es:[di+1], al inc si add di, 2 loop s mov ah, 4ch int 21h code ends end start
(2) Screenshot of operation results


(3) Use the debug tool to debug the program, and use the g command to execute the screenshot before the program returns (i.e. after ine25 and before line27)



(4) What is the function of line19 in the source code?
Combine al and DF (1101, 1111) of the single chip microcomputer, and clear the third digit on the left of al to 0
(5) What is the purpose of the byte data in the data segment line4 in the source code?Modify the value of 5 byte units in line4, reassemble, link, run and observe the results.
db 2,3,4,5,6 --> Change to: db 5 dup(2) or db 5 dup(5)
The byte data of line4 is used to set the color of the word
Vi
(1)task6.asm source code
assume cs:code, ds:data, ss: stack
stack segment
dw 0,0,0,0,0,0,0,0
stack ends
data segment
db 'Pink Floyd '
db 'JOAN Baez '
db 'NEIL Young '
db 'Joan Lennon '
data ends
code segment
start:
mov ax, stack
mov ss, ax
mov ax, data
mov ds, ax
mov bx, 0
mov cx, 4
s0: push cx
mov si, 0
mov cx, 4
s1: mov al, [bx+si]
or al, 00100000b
mov [bx+si], al
inc si
loop s1
add bx, 16
pop cx
loop s0
mov ax, 4c00h
int 21h
code ends
end start
(2) Load, disassemble and debug screenshots in debug
It is required to give a screenshot of the memory space corresponding to the data segment data by using the d command before the program exits



VII
1.task7.asm source code
qassume cs:code, ds:data, es:table data segment db '1975', '1976', '1977', '1978', '1979' dd 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 ss,ax mov bx,0 mov si,0 mov cx,5 s0: mov ax,[bx+si] mov [bp+0],ax add si,2 mov ax,[bx+si] mov [bp+2],ax add si,2 add bp,10h loop s0 mov cx,5 mov bp,0 mov si,0 s1: mov ax,[bx+si+20] mov [bp+5],ax add si,2 mov ax,[bx+si+20] mov [bp+7],ax add si,2 add bp,10h loop s1 mov cx,5 mov bp,0 mov si,0 s2: mov ax,[bx+si+40] mov [bp+10],ax add si,2 add bp,10h loop s2 mov cx,5 mov bp,0 s3: mov ax,[bp+5] mov dx,[bp+7] div word ptr [bp+10] mov [bp+13],ax add bp,10h loop s3 mov ah, 4ch int 21h code ends end start
2. Commissioning screenshot
(1) View screenshot of original data information of table segment

(2) Run in debug until the program exits, use the d command to view the screenshot of the memory space corresponding to the table segment, and confirm whether the information is structurally written to the specified memory as required
