In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains the "assembly language function to achieve data replication case analysis", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's way of thinking slowly in-depth, together to study and learn "assembly language function to achieve data replication case analysis"!
Problem 1: copy the data from the in-memory ffff:0~ffff:b unit to the 0RH 2000RU 20b unit.
Analysis.
1. How to represent the unit 0, 0, 0, 0, 0, 0, and 20 b
0020VOUB0020RGB can be equated to the above unit, and the offset address of the unit starts at 0, which is the same as the unit to be copied.
2. Can the data in the unit be copied and transferred directly?
No, you need to transfer with a register.
Assume cs:codecode segment; practice 1;-- mov bx,0; because the offset address of the data source and destination is the same, use bx agreement instead of mov cx,12 s: mov ax,offffh Because you need to reuse ax, you need to set mov ds,ax mov dl,ds: [bx]; copy data to the lower 8 bits of dx mov ax,0020h mov ds,ax mov ds: [bx], dl; copy data to the specified memory unit inc bx; move loop s to the next unit Practice 2. In the previous practice, you need to set ds repeatedly, which can be improved here. -- mov ax,0ffffh mov ds,ax mov ax 0020h mov es,ax mov bx,0 mov cx,12 s: mov dl,ds: [bx] mov es: [bx], dl inc bx loop s -- mov ax,4c00h int 21h code endsend question 2: copy the instruction before "mov ax,4c00h" to memory 0VRO 200
Analysis:
1. How to know the starting address of the code
Using cs points to the start address of the code.
2. How to know the length of the code
The length of the code can be obtained by subtracting (offset label)
Assume cs:codecode segmentstart: mov ax,cs mov ds,ax mov ax,0020h mov es,ax; sets the source and destination mov bx,0 mov cx,offset last-offset start of replicated data Set the length of the code s: mov al,ds: [bx] mov es: [bx], al; realize data transfer inc bxlast: loop s mov ax,4c00h int 21hcode endsend problem 3: store the data defined in the program in reverse order
Analysis: how to realize the reverse order using the characteristics of the stack
Assume cs:codecode segment dw 0123h dw 0456h dup 0789h line 0abchline 0defhline 0fedhline 0cbah line 0987h dw 16 dup (0); use of stack space start: mov ax,cs mov ss,ax mov sp,30h Stack space is added from back to front, and the top of the stack points to 30h mov bx,0 mov cx,8 s: push cs: [bx] add bx,2 loop s Push the data from unit 015 in the data segment into the stack mov bx,0 mov cx,8 S0: pop cs: [bx] add bx,2 loop S0; take out 8 font data in turn mov ax,4c00h int 21h code endsend start
Improved version: the contents of the above programs are not stored in segments and can be improved.
Assume cs:code,ds:data,ss:stackdate segment dw 0123h endsstack segment dw 0456h dup 0789h line 0abchline 0defhline 0fedhline 0cbah line 0987hdate endsstack segment dw 16 dup (0); use of stack space stack ends code segmentstart: mov ax,stack mov ss,ax mov sp,20h The address at the beginning of the stack no longer includes the contents of the data segment 20h mov ax,data mov ds,ax mov bx,0 mov cx,8 s: push ds: [bx] add bx,2 loop s mov bx,0 mov cx,8 S0: pop ds: [bx] add bx 2 loop S0 mov ax,4c00h int 21hcode ends end start question 4: copy the string "welcome to masm" to the data area that follows it
Analysis.
1. To copy to where the data is
The starting address of the data is in data:0
2. Where to copy it
The length of the copied data is 16 bytes, and the offset address of the following data area is 16.
3. Several copies have been made.
Because it uses 16-bit registers and can transfer two bytes at a time, it only needs to be executed 8 times.
Assume cs:code,ds:data data segment db 'welcome to masquerade' Db 16 dup (0) data ends;--; practice 1: code segmentstart: mov ax,data mov ds,ax mov si,0; set the starting position of the data source mov di,16; set the starting position of the data destination mov cx,8 To copy with a register, it only takes 8 times for s: mov ax,ds: [si] mov ds: [di], ax add si,2 add di,2 loop s mov ax,4c00h int 21hcode ends -- Practice 2: code segmentstart: mov ax,data mov ds,ax mov si,0 mov cx,8s: mov ax,ds: [si] mov ds: [si+16], ax add si,2 loop s mov ax can be achieved by using only one register 4c00h int 21hcode ends end start, thank you for your reading. The above is the content of "assembler language function to realize data replication case analysis". After the study of this article, I believe you have a deeper understanding of the problem of assembler language function to realize data replication case analysis. the specific use situation still needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.