The stack in assembler (notes)
来源:互联网 发布:哈尔滨淘宝代运营 编辑:程序博客网 时间:2024/04/30 07:11
http://www.emu8086.com/assembler_tutorial/asm_tutorial_09.html
1.
keep temporary data;
used by CALL;
RET--compared with IRET used in INT.
2.
PUSH-stores 16 bit value (REG/SREG/memory/immediate)(immediate for 80186 and later)
POP-gets 16 bit value (REG/SRET/memory)(Note: SREG except CS)
they're useful due to
a. limited number of registers.
b. for exchange the values
example:
ORG 100hMOV AX, 1212h ; store 1212h in AX.MOV BX, 3434h ; store 3434h in BXPUSH AX ; store value of AX in stack.PUSH BX ; store value of BX in stack.POP AX ; set AX to original value of BX.POP BX ; set BX to original value of AX.RETEND
3.LIFO
impt to do equal number of PUSHs and POPs
otherwise the stack maybe corrupted and it will be impossible to return to os
when program starts there is a return address in stack.(genrally 0000h)
4. memory area: SS and SP.
PUSH sourse: (SP-2)-->(SP), write source to SS:SP
POP destination: write the value at SS:SP to destination, (SP+2)-->(SP)
5. The top of the stack: the current address pointed by SS:SP
6. For COM files, stack seg is generally the code seg and SP=0FFFEh
AT SS:0FFFEh stored a return address of RET that is executed in the end of the program.
- The stack in assembler (notes)
- Study notes in the first week in GeekBand
- Study notes in the second week in GeekBand
- return the minimum value in a stack
- Scaling in the Linux Networking Stack
- Queueing in the Linux Network Stack
- QUEUEING IN THE LINUX NETWORK STACK
- the stack of function in golang
- the notes
- A few notes about the CommDb (use in Symbian OS)
- Notes on the implementation of encryption in Android 3.0
- Notes on the implementation of encryption in Android 3.0
- Notes on the implementation of encryption in Android 3.0
- Count the depth of the stack in JVM.
- Memory management in C: The heap and the stack
- Print assembler hex in one pass
- MOV Instruction Syntax Format In Diferent Assembler
- The Netwide Assembler (NASM) 汇编语言笔记
- Program flow control (Notes)
- JNI学习笔记4——本地代码创建Java对象(包括javaString)
- 了解并选择产品版本。
- Procedures
- loadjava
- The stack in assembler (notes)
- Macros (notes)
- 搭建Eclipse C/C++开发环境
- JGSA SDAGD
- Pair Project 初体验(By Cuilin Lan & Xiao Fang)
- VC++程序开机自启动(注册表上注册)
- 「あく(開く)」と「ひらく(開く)」はどのように使い分ければいいですか。
- ToDoList如何从Word或者写字板复制任务列表进来
- ToDoList中如何添加重复执行的任务