-
There are four segments in it, which are A, B, C, and Code.
Segments a, b, and c can all be considered data segments.
Started writing like this.
mov ax,a
mov es,ax
mov ax,c
mov ds,ax
The results of paragraphs A and B are added up and finally put together in paragraph C.
====All the programs are as follows***************==assume cs:code
a segment
db 1,2,3,4,5,6,7,8
a ends
b segment
db 1,2,3,4,5,6,7,8
b ends
c segment
db 0,0,0,0,0,0,0,0
c ends
code segment
start:mov ax,a
mov es,ax
mov ax,c
mov ds,ax
mov bx,0
mov cx,8
s1:mov ax,es:[bx]
add [bx],ax
add bx,2
loop s1
mov ax,b
mov es,ax
mov ds,ax
mov bx,0
mov cx,8
s2:mov ax,es:[bx]
add [bx],ax
add bx,2
loop s2
mov ax,4c00h
int 21h
code ends
end start
-
The number of both cycles should be 4 instead of 8, so mov cx,8 should be changed to mov cx,4
-
Why can't the image be uploaded?
-
The start position of the CPU execution instruction is confirmed by CS:IP, and the initial CS=2000H, IP=0
i.e.: mov ax,6622h cs=2000h ip=0003hjmp 0ff0,0100 cs=0ff0h ip=0100h; The JMP command modifies the values of the CS and IP registers. The address you will be directed to is:
0ff0h*16+0100h=10000h
mov ax,2000h cs=0ff0h ip=0103hmov ds,ax cs=0ff0h ip=0105hmov ax,[0008] cs=0ff0h ip=0108hmov ax,[0002] cs=0ff0h ip=010bhWhen there is no jump command, the value of the ip always points to the position of the next command. That is, the value of the next IP address is the current IP value + the current instruction length.
With this understood, the above is not a problem.
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
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