📄 parentpointor.asm
字号:
//======================================================
// The information contained herein is the exclusive property of
// Sunnnorth Technology Co. And shall not be distributed, reproduced,
// or disclosed in whole in part without prior written permission.
// (C) COPYRIGHT 2003 SUNNORTH TECHNOLOGY CO.
// ALL RIGHTS RESERVED
// The entire notice above must be reproduced on all authorized copies.
//========================================================
//========================================================
// Filename: ParentPointor.asm
// Programmer: Zhifa Lee (email: zhifa/sunnorth) (ext: 2913)
// Version: 1.0.0
// Date: 2003-5-20
// Applied body: unsp serial
// Description:
// Revision history:
// ----------------------------------------------------------------------------------------
// Version, YYYY-MM-DD-Index, File-Name: Modified By, Description
// ----------------------------------------------------------------------------------------
//
//============================================================
//======================================================
// Function Name: F_ParentPointor_AccessRootFirst
// Description: gothrough the tree by RootFirst,which be stored in linked table with Parent pointor.
// Input: InputBuf Address,OutputBuf Address;push the parameter in stack.
// Output: None
// Destroy: r2,r3,r4;
// Used: r2,r3,r4,bp,sp;
// Stacks: 5+4*C_TreeDepth;
//======================================================
.INCLUDE ParentPointor.inc
.CODE
.PUBLIC F_ParentPointor_AccessRootFirst;
.PUBLIC _F_ParentPointor_AccessRootFirst
F_ParentPointor_AccessRootFirst:
_F_ParentPointor_AccessRootFirst: .PROC
push bp to [sp];
bp=sp+5;
r2=[bp--]; //r2=OutputBuf
bp=[bp]; //bp=InputBuf
call F_FirstRootArithmetic; //gothrough the tree by root first
?L_ExitFunc:
pop bp from [sp];
retf;
.ENDP
//======================================================
// Function Name: F_FirstRootArithmetic
// Description: recursive function to access tree.
// Input: r2:output pointor
// bp:current node address
// Output: None
// Destroy: r2,r3,r4,bp;
// Used: r2,r3,r4,bp,sp;
// Stacks: 4*C_TreeDepth;
//======================================================
F_FirstRootArithmetic:
_F_FirstRootArithmetic: .PROC
r4=[bp]; //get the root node
[r2++]=r4; //output the node
r4=bp;
?L_NextNode:
bp+=TREENODE_SIZE;
cmp bp,L_EndOfTree;
jae ?L_ExitFunc;
r3=[bp+CONTENT_SIZE]; //get the Parent pointor
cmp r3,r4;
jb ?L_NextNode;
ja ?L_ExitFunc;
push r4,r5 to [sp]; //store the current node
call F_FirstRootArithmetic; //gothrough the child tree
pop r4,r5 from [sp]; //get the current node from stack
jmp ?L_NextNode;
?L_ExitFunc:
retf;
.ENDP
//======================================================
// Function Name: F_ParentPointor_AccessRootLast
// Description: gothrough the tree by RootMiddle,which be stored in linked table with Parent pointor.
// Input: InputBuf Address,OutputBuf Address;push the parameter in stack.
// Output: None
// Destroy: r2,r4;
// Used: r2,r4,bp,sp;
// Stacks: 5+4*C_TreeDepth;
//======================================================
.PUBLIC F_ParentPointor_AccessRootLast;
.PUBLIC _F_ParentPointor_AccessRootLast;
F_ParentPointor_AccessRootLast:
_F_ParentPointor_AccessRootLast: .PROC
push bp to [sp];
bp=sp+5;
r2=[bp--]; //r2=OutputBuf
bp=[bp]; //bp=InputBuf
call F_LastRootArithmetic; //gothrough the tree by root last
?L_ExitFunc:
pop bp from [sp];
retf;
.ENDP
//======================================================
// Function Name: F_LastRootArithmetic
// Description: recursive function to access tree.
// Input: r1:current node number
// r2:output pointor
// bp:start address of whole tree
// Output: None
// Destroy: r2,r4;
// Used: r2,r4,bp,sp;
// Stacks: 4*C_TreeDepth;
//======================================================
F_LastRootArithmetic:
_F_LastRootArithmetic: .PROC
r4=bp;
?L_NextNode:
bp+=TREENODE_SIZE;
cmp bp,L_EndOfTree;
jae ?L_ExitFunc;
r3=[bp+CONTENT_SIZE]; //get the Parent pointor
cmp r3,r4;
jb ?L_NextNode;
ja ?L_ExitFunc;
push r4,r5 to [sp]; //store the current node
call F_FirstRootArithmetic; //gothrough the child tree
pop r4,r5 from [sp]; //get the current node from stack
jmp ?L_NextNode;
?L_ExitFunc:
r4=[r4];
[r2++]=r4; //output the node
retf;
.ENDP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -