To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.spyboticsOpen lugnet.robotics.spybotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Spybotics / 37
36  |  38
Subject: 
Re: Interesting Mindscript Bits
Newsgroups: 
lugnet.robotics.spybotics
Date: 
Sun, 4 Aug 2002 00:35:58 GMT
Viewed: 
4992 times
  
Here's a few things I've gleaned:

Some new opcodes:

push n, m // n is ?, m is value to push
pop n // n is number of items to pop
sound n..ends // define a sound effect
tones n, f // n is time, f is frequency? (tone 223 for 10)
pauses n // n is time (wait 5)
freqs n,f1,f2 // n is time; f1 & f2 are frequency? (glide 6000..3000 for 60)
startg n,m // n is ?; m is ? (gate 3 in 7)
freqv n,f1,f2 // n is time; f1 & f2 are frequency? (vibrato 440..1740 for 20)

You can start/stop the 4 timers (source 19[0..3] = 0|1).

eeprom[n] == source 20 value n


Here's a LASM file showing the byte code values of some of the new opcodes:

;Main task
task 8
Main:
;        push 2, 5 //  0xE3, 0x02, 0x05
;        push 2, 6 //  0xE3, 0x02, 0x06
;        push 2, 7 //  0xE3, 0x02, 0x07
;        pop 2     //  0x01, 0x02
;        pop 1     //  0x01, 0x01
;        pauses 5  //  0x21, 0x05
;        startg 7, 3 // 0x62, 0x07, 0x03
;        freqs 10, 400, 500 // 0x45, 0x0A, 0x90, 0x01, 0xF4, 0x01
;        freqv 10, 400, 500 // 0x55, 0x0A, 0x90, 0x01, 0xF4, 0x01
;        tones 5, 400 // 0x33, 0x05, 0x24, 0x45
;        tones 5, 0xff  // 0x33, 0x05, 0xFF, 0x00


EndMain:
endt

Here's a MindScript program that doesn't do anything useful:

program SpybotMission
{
#include<Spybot.h>
var nBots = 2
var a0 = 0

timer tGameTimer
timer tStateTimer
timer tTickTimer
timer tFred

counter nBioTick

main
{
        nBioTick += 1
        start tGameTimer
        start tStateTimer
        start tTickTimer
        start tFred
        a0 = VLL
        a0 = tStateTimer
                a0 = eeprom[eMotorControl]
        a0 = eeprom[eFirstToken]
        a0 = eeprom[eLastToken]
        eeprom[0x80] = 45
        eeprom[0xff] = 50
        a0 = world[nBots, iRange]
        a0 = LED[iDisplay]
        a0 = target[iRange]
        a0 = message[iRxChannel]
        a0 = link[iRxChannel]
        a0 = ping[iMyID]
        stop tGameTimer
        stop tStateTimer
        stop tTickTimer
        stop tFred
}
}


And here's the LASM translation of the above MindScript program.

;Main task
task 8
Main:

senm 0,1,0 // sensor 0, raw mode, 0 slope
senm 1,4,0 // sensor 1, pct full scale mode, 0 slope

setv 31,2,2    // nBots = 2
setv 30,2,0    // a0 = 0

cnti 0           // nBioTick += 1
set 19,0,2,1    // 19[0] = 1 (start tGateTimer)
set 19,1,2,1    // 19[1] = 1 (start tStateTimer)
set 19,2,2,1    // 19[2] = 1 (start tTickTimer)
set 19,3,2,1    // 19[3] = 1 (start tFred)
setv 30,15,0     // a0 = VLL
setv 30,1,1      // a0 = tStateTimer
setv 30,20,0     // a0 = eeprom[0], eMotorControl = 0
setv 30,20,72    // a0 = eeprom[eFirstToken]
setv 30,20,126   // a0 = eeprom[eLastToken]
set 20,128,2,45 // eeprom[0x80] = 45
set 20,255,2,50 // eeprom[0xff] = 50
setv 30,45,31    // a0 = world[nBots, iRange]
setv 30,22,0     // a0 = LED[iDisplay]
setv 30,50,3     // a0 = target[iRange]
set 0,30,33,25  // a0 = message[iRxChannel]
setv 30,52,1     // a0 = link[iRxChannel]
setv 30,51,2     // a0 = ping[iMyID]
set 19,0,2,0    // stop tGameTimer
set 19,1,2,0    // stop tStateTimer
set 19,2,2,0    // stop tTickTimer
set 19,3,2,0    // stop tFred
EndMain:
endt


Using BricxCC to edit/compile/download MindScript & LASM along with NQC is
pretty cool, imho. :-)

John Hansen



Message is in Reply To:
  Re: Interesting Mindscript Bits
 
In the same vein, "C:\Program Files\LEGO Software\Products\Sp...nCore.lif" contains (after a binary header) the sourcecode of spybot program for mission "***mission_name***". For example, Critical Countdown mission program begins as : "{ //Critical (...) (22 years ago, 3-Aug-02, to lugnet.robotics.spybotics)

3 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR