📄 chazhi.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: chazhi.asm
// Programmer: Zhifa Lee (email: zhifa/sunnorth) (ext: 2913)
// Version: 1.0.0
// Date: 2003-5-30
// Applied body: unsp serial
// Description:
// Revision history:
// ----------------------------------------------------------------------------------------
// Version, YYYY-MM-DD-Index, File-Name: Modified By, Description
// ----------------------------------------------------------------------------------------
//
//============================================================
.include chazhi.inc
.external __subf2;
.external __divf2;
.external __addf2;
.external __mulf2;
.code
//======================================================
// Function Name: F_LinearInsert
// Description: calculate (x-x0)x(y1-y0)/(x1-x0)+y0.
// Input: Address of x0,y0,x1,y1,x
// Output: r1,r2->y
// Destroy: r1,r2,r3,r4;
// Used: r1,r2,r3,r4,bp,sp;
// Stacks: 14;
//======================================================
.public F_LinearInsert;
.public _F_LinearInsert;
.code
F_LinearInsert:
_F_LinearInsert: .proc
push bp to [sp];
bp=sp;
bp+=4; //bp->x0
M_GetValue 0; //get x0
push r3,r4 to [sp];
M_GetValue 4; //get x
push r3,r4 to [sp];
call __subf2; //x-x0
sp+=4;
M_StoreValue 4; //x-x0->x
M_GetValue 1; //get y0
push r3,r4 to [sp];
M_GetValue 3; //get y1
push r3,r4 to [sp];
call __subf2; //y1-y0
sp+=4;
M_StoreValue 3; //y1-y0->y1
M_GetValue 0; //get x0
push r3,r4 to [sp];
M_GetValue 2; //get x1
push r3,r4 to [sp];
call __subf2; //x1-x0
sp+=4;
M_StoreValue 2; //x1-x0->x1
M_GetValue 4; //get x->x-x0
push r3,r4 to [sp];
M_GetValue 3; //get y1->y1-y0
push r3,r4 to [sp];
call __mulf2; //(x-x0)x(y1-y0)
sp+=4;
M_StoreValue 4; //(x-x0)x(y1-y0)->x
M_GetValue 2; //get x1->x1-x0
push r3,r4 to [sp];
M_GetValue 4; //get x->(x-x0)x(y1-y0)
push r3,r4 to [sp];
call __divf2; //(x-x0)x(y1-y0)/(x1-x0)
sp+=4;
push r1,r2 to [sp];
M_GetValue 1; //get y0
push r3,r4 to [sp];
call __addf2; //(x-x0)x(y1-y0)/(x1-x0)+y0
sp+=4;
pop bp from [sp];
retf;
.endp
//======================================================
// Function Name: F_QuadraticInsert
// Description: 1、calculate L01=y0+(y1-y0)(x-x0)/(x1-x0)
// 2、calculate L02=y0+(y2-y0)(x-x0)/(x2-x0)
// 3、calculate L012=L01+(L02-L01)(x-x1)/(x2-x1)
// Input: x0,y0,x1,y1,x2,y2,x
// Output: r1,r2->y
// Destroy: r1,r2,r3,r4;
// Used: r1,r2,r3,r4,bp,sp;
// Stacks: 28;
//======================================================
.public F_QuadraticInsert;
.public _F_QuadraticInsert;
F_QuadraticInsert:
_F_QuadraticInsert: .proc
push bp to [sp];
bp=sp+4;
M_GetValue 6; //get x
push r3,r4 to [sp];
M_GetValue 3; //get y1
push r3,r4 to [sp];
M_GetValue 2; //get x1
push r3,r4 to [sp];
M_GetValue 1; //get y0
push r3,r4 to [sp];
M_GetValue 0; //get x0
push r3,r4 to [sp];
call F_LinearInsert; //get L01
sp+=10;
M_StoreValue 3; //L01->y1
M_GetValue 6; //get x
push r3,r4 to [sp];
M_GetValue 5; //get y2
push r3,r4 to [sp];
M_GetValue 4; //get x2
push r3,r4 to [sp];
M_GetValue 1; //get y0
push r3,r4 to [sp];
M_GetValue 0; //get x0
push r3,r4 to [sp];
call F_LinearInsert; //get L02
sp+=10;
M_StoreValue 5; //L02->y2
M_GetValue 6; //get x
push r3,r4 to [sp];
M_GetValue 5; //get L02
push r3,r4 to [sp];
M_GetValue 4; //get x2
push r3,r4 to [sp];
M_GetValue 3; //get L01
push r3,r4 to [sp];
M_GetValue 2; //get x1
push r3,r4 to [sp];
call F_LinearInsert; //get L012
sp+=10;
pop bp from [sp];
retf;
.endp
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -