assume cs:code,ds:data,ss:stack
data segment
data ends
stack segment
stack ends
code segment
start:
mov ax,data
mov ds,ax
mov ax,4c00h
int 21h
code ends
end start
2. 数组求和
assume cs:code,ds:data,ss:stack
data segment
arr db 1,2,3,4,10,20,30,40
db 'hello world'
data ends
stack segment
db 100 dup (0)
stack ends
code segment
start:
mov ax,data
mov ds,ax
mov ax,0
mov bx,0
mov cx,8
for:
add al,ds:arr[bx]
adc ah,0
inc bx
loop for
mov ax,4c00h
int 21h
code ends
end start
comment*
vector<int>arr={1,2,3,4,10,20,30,40};
int sum = 0;
for (int = 0;i < arr.size();i++)sum += arr[i];
*comment
3. 拷贝数组
assume cs:code,ds:data,ss:stack
data segment
arr db 1,2,3,4,10,20,30,40
res db 8 dup (0)
data ends
stack segment
db 100 dup (0)
stack ends
code segment
start:
mov ax,data
mov ds,ax
mov bx,0
mov cx,8
for:
mov al,ds:arr[bx]
mov ds:res[bx],al
inc bx
loop for
mov ax,4c00h
int 21h
code ends
end start
comment*
vector<int>arr={1,2,3,4,10,20,30,40};
int res[8]
for (int i = 0;i < 8;i++)res[i] = arr [i];
*comment
4. 反转数组
assume cs:code,ds:data,ss:stack
data segment
arr db 1,2,3,4,10,20,30,40
res db 8 dup (0)
data ends
stack segment
db 100 dup (0)
stack ends
code segment
start:
mov ax,data
mov ds,ax
mov si,0
mov di,7
mov cx,8
for:
mov al,arr[si]
mov ds:res[di],al
inc si
dec di
loop for
mov ax,4c00h
int 21h
code ends
end start
comment*
vector<int>arr={1,2,3,4,10,20,30,40};
int res[8]
for (int i = 0;i < 8;i++)res[7-i] = arr [i];
for (int i = 0,j=7;i<8;i++,j--)res[j] = arr[i];
*comment
HTTP协议
在网络通信中,我们可以自己进行定制协议,但是也有许多已经十分成熟的应用层协议,比如我们下面说的HTTP协议。
HTTP协议简介
HTTP(Hyper Text Transfer Protocol)协议又叫做超文本传输协议,是一…
Linux Shell:cat命令
Linux 系统中的 cat 命令是一种多用途的工具,主要用于查看、创建、连接和追加文件内容。其名称来源于 concatenate 的缩写,意味着它可以用来连接文件内容到标准输出(屏幕)。在日常使用中…