Subject:
|
Re: Bug in RCX 2.0 beta (Was: RIS 2.0 software now in beta)
|
Newsgroups:
|
lugnet.robotics.rcx, lugnet.robotics
|
Date:
|
Sun, 4 Mar 2001 17:41:59 GMT
|
Viewed:
|
1876 times
|
| |
| |
Dear all,
I have managed to pin down the problem a bit further. Please look at the
following program:
program foo {
const c10 = 10
main { forever {} }
task test {
local v2f
local v2e
local v2d
v2f = 1
v2e = 2
v2d = v2e * c10
}
}
If you download this script to the brick, and the upload it again, you will
receive the following:
task,0,2,0,0x27,0x81
task,1,25,0,0x14,0x2f,0x02,0x01,0x00,0x14,0x2e,0x02,0x02,0x00,0x14,0x2f,0x00
,0x2e,0x00,0x54,0x2f,0x02,0x0a,0x00,0x14,0x2d,0x00,0x2f,0x00
Task 1 (the task test) translates as following into LASM:
task
1
25
0
0x14 setv 0x2f const 0x0001
0x2f
0x02
0x01
0x00
0x14 setv 0x2e const 0x0002
0x2e
0x02
0x02
0x00
0x14 setv 0x2f var 0x002e
0x2f
0x00
0x2e
0x00
0x54 mulv 0x2f const 0x000a
0x2f
0x02
0x0a
0x00
0x14 setv 0x2d var 0x002f
0x2d
0x00
0x2f
0x00
As you can see the compiler translates the general multiplication v2d = v2e
* c10 into a setv tmp v2e, mulv tmp c10, setv v2d tmp sequence. When
allocating the temporary local variable if fails to respect the user-defined
local variables, though -- it should have used the next free local variable
0x2c for this operation!
Hope this help fixing the problem.
Regards,
Sebastian
--
Dipl.-Inform. Sebastian Wangnick
Familie Wangick <familie.wangnick@t-online.de> schrieb in im Newsbeitrag:
G9oKJq.1y2@lugnet.com...
> Dear all,
>
> I'm experiencing a strange phenomenon in my MindScript program which I
> believe to be a bug, where within a task the assignment of a multiplication
> of a local variable (containing value 0) and a constant (set to 10) to a
> second local variable would set a third local variable (containing 1) to
> zero! If rewritten as a simple assignment and then a multiplying assignment
> the phenomenon disappears.
>
> Please find attached the script exemplifying the issue. It expects a light
> sensor on 1, a motor turning the light sensor on B and a touch sensor on 2
> being triggered when the motor turned the light sensor to 180° resp. -180°.
>
> As a newbie to LEGO robotics (which both my son and me find fantastic) I
> don't exclude that I overlooked some finesse of the RCX environment though
> ...
|
|
Message has 1 Reply:
Message is in Reply To:
8 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|