Advertisement
Advertisement
| 03.26.2008 at 12:57AM PDT, ID: 23269676 | Points: 500 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: |
tfr A,B /* move A to B */
neg B /* B negated, negative result is converted to positive */
move.w B1,X0 /* move MSB of B to X0 */
clr B /* clear B */
move.w X0,B0 /* move X0 to LSB of B */
dec.w C /* decrement C, C contains ProportionalGainScale -> negative value */
asrr.l C,B /* shift B to the right by the value contained in C, since the
C is negative B is shifted to the left */
|
| Microsoft |
| Apple |
| Internet |
| Gamers |
| Digital Living |
| Virus & Spyware |
| Hardware |
| Software |
| ITPro |
| Developer |
| Storage |
| OS |
| Database |
| Security |
| Programming |
| Web Development |
| Networking |
| Other |
| Community Support |
| 03.26.2008 at 01:24AM PDT, ID: 21209690 |
| 03.26.2008 at 02:57AM PDT, ID: 21210030 |
| 03.26.2008 at 04:39AM PDT, ID: 21210542 |
| 03.26.2008 at 04:43AM PDT, ID: 21210570 |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: |
sub Y1,Y0 /* Y0 <= Y0 - Y1 */
/* Y0 <= desiredValue - measuredValue */
move.w X:(R2+0x0006),C /* C <= ProportionalGainScale */
tst.l C /* test C (ProportionalGainScale) */
bge POSITIVE_PROP_SHIFT /* if C (ProportionalGainScale) is positive, jump to POSITIVE_PROP_SHIFT.
Positive C means shift to right, overflow cannot occur */
move.w X:(R2),A /* A <= ProportionalGain */
mpy Y0,A1,A /* A <= Y0*A1 */
nop /* A <= ProportionalGain * (desiredValue - measuredValue) */
/* arithmetic left or right shift according to ProportionalGainScale
value, member of the mc_sPIparams1_limitSc structure */
//---------------------------------------------------------------------
bge POS_PROP /* if the result in A is positive, jump to POS_PROP otherwise
is negative and then continue */
tfr A,B /* move A to B */
neg B /* B negated, negative result is converted to positive */
move.w B1,X0 /* move MSB of B to X0 */
clr B /* clear B */
move.w X0,B0 /* move X0 to LSB of B */
dec.w C /* decrement C, C contains ProportionalGainScale -> negative value */
asrr.l C,B /* shift B to the right by the value contained in C, since the
C is negative B is shifted to the left */
nop
tst.w B1 /* test B1 */
beq STANDARD_PROP_CALC /* if B1 is zero, jump to STANDARD_PROP_CALC */
move.l #0x80000000,A /* otherwise A is saturated to minimal negative value */
jmp PROP_PART_SAT /* jump to PROP_PART_SAT */
POS_PROP: /* jump here in case of positive A */
clr B /* clear B */
move.w A1,B0 /* move MSB of A to B0 */
dec.w C /* decrement C, C contains ProportionalGainScale -> negative value */
asrr.l C,B /* shift B to the right by the value contained in C, since the
C is negative B is shifted to the left */
nop
tst.w B1 /* test B1 */
beq STANDARD_PROP_CALC /* if B1 is zero, jump to STANDARD_PROP_CALC */
move.l #0x7FFFFFFF,A /* otherwise A is saturated to maximal positive value */
jmp PROP_PART_SAT /* jump to PROP_PART_SAT */
|
| 03.26.2008 at 06:32AM PDT, ID: 21211359 |
| 03.26.2008 at 07:03AM PDT, ID: 21211692 |
| 03.26.2008 at 07:06AM PDT, ID: 21211722 |
| 03.26.2008 at 07:49AM PDT, ID: 21212201 |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: |
short X0 = 0; short *A0, *A1, *B0, *B1, *C0, *C1; int A = 0, B = 0, C = 0; A0 = (short*) &A; A1 = A0 + 1; B0 = (short*) &B; B1 = B0 + 1; C0 = (short*) &C; C1 = C0 + 1; *A1 = -1000; *C1 = -7; B = A; B = -B; X0 = *B1; B = 0; *B0 = X0; /* equivalent: B = (B >> 16) & 0x0000FFFF; */ (*C1)--; B = (*C1 > 0) ? (B >> *C1) : (B << -(*C1)); |
| 03.26.2008 at 07:02PM PDT, ID: 21218005 |
1: 2: 3: |
/* to manage saturation flag, R1=0 & R0 =1 */
moveu.w #0,R1
moveu.w #1,R0
|
| 03.27.2008 at 05:49AM PDT, ID: 21220696 |