X86 series CPUs can operate in 16-bit real mode and 32-bit protected mode, the real mode is characterized by address bus only 20 bits, that is, only 1MB of addressing space, in order to be compatible with the old Cpu,intel x86 series CPU including the latest CPU in the power-up run in 16-bit real mode, At the same time on the hardware to force CS into 0xf000,ip 0xfff0, then Cs:ip point to 0xffff0 this address, that is, the power of the instantaneous code from the place to execute, and the BIOS i
this is the most important point.
The __cdecl rule requires the caller to be responsible for the stack's recovery, and in the assembly's perspective, the location of the recovery stack is within the calling function, considering such a C + + code (in VC Debug)
Copy Code code as follows:
#include
void __cdecl func (int param1, int param2, int param3) {int var1 = param1;int var2 = param2;int var3 = PARAM3;
printf ("%ld\n", Long (param1));printf ("%ld\n", Long (param2));prin
1. count the number of negative elements in a font Array
. 486
Data Segment
Array DW 54,-1050,-6800, 0, 853 ,-
Count equ $-array; space occupied by statistics
Result DW?
Data ends
Code segment
Assume Cs: code, DS: Data
Start:
MoV ax, Data
MoV ds, ax
MoV Si, offset array; pointer Initialization
MoV CX, count/2; the num
This is exactly the same as the logic commands of Delphi.
// Logical non-not: {not 1 = 0; not 0 = 1;} var bytenum: byte; begin // assign a value of 111111b (255); reverse: ASM mov Al, 11111111b {eax contains ax; ax contains al; Al is the low eight bits of eax} Not Al {returns 11111111} mov bytenum to the 00000000 reverse, al {give the value in register Al to the variable bytenum} end; showmessage (in
This is a small experiment we want to do when learning the compilation. It feels interesting and I want to post it to my blog. For more information, see.
Lab requirements:
After the program is executed, an operation prompt is displayed. Enter the user name and password. When you type the password, the program does not display the entered characters, the welcome page is displayed and DOS is returned only when the user name, password string, and program string are the same.
The Code contains detai
The two integers are stored with non-compressed BCD codes.
; Addition of two numbers of any length; input non-numeric characters will be ignored
Dseg segment
Msg1 DB "Please input the first number:", 0dh, 0ah, "$"
Msg2 DB "Please input the second number:", 0dh, 0ah, "$"
Remsg DB "The reslut is: $"
Msg3 DB "any ket to quit $"
Bw.len DW 0
Buf_1 dB 100 DUP (0)
B2_len DW 0
Buf_2 dB 100 DUP (0)
Dseg ends
; ######################################## ################
Cseg segment
Assume Cs: cseg, DS: dse
Mul: Unsigned Multiplication
; Influence of, CF flag bit; Command Format:; Mul R/m; parameter is the multiplier; if the parameter is R8/M8, the Al will be used as the multiplier and the result will be placed in ax; if the parameter is R16/M16, ax will be used as the multiplier and the result will be placed in eax; if the parameter is R32/M32, eax will be used as the multiplier and the result will be placed in edX: eax
; Test27_1.asm.386.model flat, stdcallinclude windows. incincl
X86 series CPUs can run in 16-bit real-time mode and 32-bit protection mode. The real-time mode features that the address bus only has 20 bits, that is, only 1 MB of addressing space, to be compatible with old CPUs, Intel x86 series CPUs, including the latest CPUs, run in 16-bit real-time mode during power-on. At the same time, on the hardware, the strong lines set CS to 0xF000 and IP to 0xFFF0, CS: the IP address points to the address 0xFFFF0, that is, the code is executed from the address when
Eight, logical operation instructionNumbers are stored in the computer as binary, with each bit number being 0 or 1, when two binary digits are logically bitwise , logical bitwise |, logical XOR, or ^ operation,Can use assembly language to provide logic operation instruction And,or, xor,not and other instructions.and directives:C Language operation, 01101101 results to 0100The C language code isif (Flag Maskit) count+ +;Assembly language advanced directives can be implemented:mov eax, flag.i
NASM differs from the MASM of VS, such as the NASM source program can have only instructions, without the need for segment distribution, main functions and so on. Here is an example:
mov eax, 0
inc eaxCompile with NASM:
A test.bin is generated when the compilation is complete:
Open this test.bin to see the machine code of the instruction:
The disassembly of the corresponding source code in VS:
A 66 More, what do you mean .
To modify the NASM comp
If you have time to write a study note, first note the reference article:Http://www.cnblogs.com/aguncn/archive/2012/11/14/2769989.htmlHttp://www.cnblogs.com/aguncn/archive/2012/11/14/2769814.htmlhttp://segmentfault.com/q/1010000000627497http://blog.csdn.net/herecles/article/details/6080226My understanding: pointers are indirect addressing using the Mov method. To understand the pointer, you must understand the difference between the Lea and the
Operating System: WIN2KTools: OLLYDBG1.1, ImportREC, LordPE: Http://www.ultraprotect.com/acpr_pro.exeTarget Program: ACProtect 1.21 professional moderator program.
Shelling Process:1. Find the Stolen code deformation and its pseudo OEP.After loading with OLLYDBG1.1, stay at the entry of the program:006D4000 pushad006D4001 dec ecx006D4002 sbb esi, B59B7C21006D4008 clc006D4009 mov ecx, ebx006D400B dec ecxUse the IsDebug 1.4 plug-in to remove the Ollydbg
completionroutine will be called. Can we hook up the IRP completion function of the query file? During debugging, we found that when majorfunction = irp_mj_directory_control and minorfunction = irp_mn_query_directory, The completionroutine in irpstacklocation is empty. How can this problem be solved? To sum up, there are two problems:
1. How can I obtain the IRP from icesword?2. How do I set a callback completion function for the captured IRP?
Next I will make breakthroughs one by one:After all
I have been wondering whether C can return a struct over the past few days. I have seen a post on the Internet and I think it is good. I would like to share it with you:
To check the alignment of the structure set by Vc by default, the special definition structure is as follows:1: typedef struct _ ctest2 :{3: Char acharacter;4: int inumber1;5: Char bcharacter;6: Char ccharacter;7: int inumber2;8:} ctest, * pctest;9:The getdata () function returns the structure defined above, so that you can obs
the arguments of the constructor, and is initialized with 1, which omits a step, speeds up the operation, and achieves the same effect. Note: In the above assembly, Visual Studio compiler optimizations have been turned off, indicating that this approach has been used as a general method of Visual Studio, rather than as a vs-perceived optimization tool.Initialize 3:classtest ct3 = Ct1Classtest ct3 = ct1;//Copy Initialization00b09538 Lea Eax,[ct1]00b0953e push EAX00b0953f Lea ECX,[CT3]00b09545 ca
the contents of RAM inside pull. You can go to "see the snow" to learn a simple assembler command.
004f3b9c/$ PUSH EBX
004f3b9d |. 83C4 F8 ADD esp,-8
004f3ba0 |. 8BDA MOV Ebx,edx; Data Destination address after decryption
004f3ba2 |. 8bd4 MOV Edx,esp; Data Delivery Destination Address
004f3ba4 |. B9 04000000 MOV ecx,4; The number of passes is 4
004f3ba9 |. E8 1
that some characters have been entered in the "Serial Number" column. Leave it empty, enter 123456789 in the "Registration Code" column, and then press the "register" button.ProgramInterrupt at 0x004f0b60, trace and find that the input length is required, re-enter 1234567890 abcdef in the "Registration Code" column, and then press the "register" button. After the interruption, the following code will be tracked:
Code: 004f0bbb mov eax, [EBP + var_10
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.