To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 26433
26432  |  26434
Subject: 
NBC beta news
Newsgroups: 
lugnet.robotics
Date: 
Wed, 13 Sep 2006 17:31:26 GMT
Viewed: 
2416 times
  
I've just uploaded a new NBC beta (b8).  The sourcecode and Mac OSX and Linux
builds will be up later today.  This beta has some cool new features.

Unused variable declarations and unused threads/subroutines are removed before
generating the executable.  When including libraries of common routines into
your program this feature can significantly reduce the size of the executable.

There are now a few standard macros for motor control in NXTDefs.h (OnFwd,
OnRev, Off, and Coast as well as arrays for controlling more than one motor at a
time: OUT_AB, OUT_AC, OUT_BC, OUT_ABC).  The OnFwd and OnRev macros can take a
constant or a variable power level.  More standard API macros are in the works
(with a lot of help from volunteers - THANKS!!!).

NBC now has support for the wait opcode with a constant argument, the waitv
opcode with a variable (or constant) argument, the abs opcode which takes an
output and an input variable argument, and the sign opcode which does the same
(and sets the output argument to -1, 0, or 1 depending on the value of the input
argument).  Both of these (abs and sign) only work on scalar arguments, unlike
many of the other built-in math opcodes which can also handle aggregate types.

Additionally, when you define subroutines in NBC using the

subroutine SubroutineName
ends

mode of thread declaration rather than thread/endt the compiler creates a return
address variable automatically for you and in this new beta you can now use the
call opcode and the return opcode which automatically handle using the
compiler-generated return address variable.  Like so:

thread main
  call MySub
endt

subroutine MySub
  return
ends

If you want, you can even leave off the return at the end of a subroutine and
the compiler will stick one in there for you if the entire subroutine has no
other "exit" point (i.e., you haven't used a conditional subret, return, exit,
or exitto elsewhere in the routine).

There are also some new sample programs up on the NBC website.  And an NBC Guide
and NBC Tutorial (like the ones included in BricxCC for NQC) are in the works as
we speak.

Oh, yeah, and NBC can also compile this sort of code too (if you know the
top-secret password):

int x, y, z;
bool p, d, q;
mutex myMutex;
char c;
unsigned short s;

sub Weird()
{
  Write(z);
}

task main()
{
  x=0;
//  z = 10;
  z = 40;
  while (x < 10)
  {
/*
    z += 2;
*/
    Weird();
    z -= 4;
    if (0) { continue; }
    Wait(500);
    x++;
  }

  Cls();

  s = 500;
  Wait(s+500);

  for (z=0; z < 10; z++)
  {
    Weird();
    if (z < 0) {
      break;
    }
    Wait(500);
  }

  Wait(3000);
}


John Hansen



Message has 5 Replies:
  Re: NBC beta news
 
(...) Yeah! Speaking from the minority OS here, Thank You! Drat, another fun way to use gobs of my (rapidly shrinking to non-existance) free time. Thanks for keeping up on this stuff, and providing stuff like Mac builds. You're making me a very (...) (18 years ago, 13-Sep-06, to lugnet.robotics)
  Re: NBC beta news
 
HI. (...) What's this password thing? NBC compiler can really parse such high-level-shaped code? Please, forgive me if I haven't understood a joke, since I'm as slow in English as I can be funny in Italian! Bye. (18 years ago, 15-Sep-06, to lugnet.robotics)
  Re: NBC beta news
 
(...) Thanks for your continued work on this John. One question: Even after invoking the Coast() macro, there's still some resistance when manually turning the motor output by hand. Is this unavoidable due to the gearing, or is there a way to lessen (...) (18 years ago, 16-Sep-06, to lugnet.robotics)
  Re: NBC beta news
 
Hello John, (...) Will the Linux build be available soon ? The link given for beta 8 has a 404 error. Thanks for your great work on NBC and thanks for compiling it under Linux. Jean-Louis Bergamo, who has just received his NXT :-) (18 years ago, 18-Sep-06, to lugnet.robotics)
  Re: NBC beta news
 
(...) Looks pretty cool, John. OK - so what is the password? Roger (18 years ago, 30-Oct-06, to lugnet.robotics)

12 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