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 / 285
284  |  286
Subject: 
Re: NQC's future
Newsgroups: 
lugnet.robotics.rcx.nqc, lugnet.robotics.spybotics
Date: 
Wed, 10 Dec 2003 01:41:33 GMT
Viewed: 
660 times
  
In lugnet.robotics.rcx.nqc, Dirk Schlei wrote:
Even if it requires a firmware replacement, please add:

- more variables,
- float type variables,
- string type variables,
- certain math library (sin, cos, exp, ...) - at least good approximations,
- more subs,
- functions with return values,

NQC is a language/compiler which works with the standard LEGO firmware(s).  I
don't anticipate that ever changing.

But here's a glimpse of something new for the Spybot target that might be
interesting to NQC users.  Would 256 (or 128, if you want to protect your Spybot
game data) byte-sized storage locations be useful?  Because these are byte-size
locations, there may currently be some problems with the tranformations that
certain operators use to calculate their result (such as >>).

#define a @(0x140000 + 0x80)
#define b @(0x140000 + 0x81)

task main()
{
  a = 5;
  b = 3;
  a = a + 1;
  a = a << 1;
  a >>= 2;
  a <<= 1;
  a = a % 2;
  a %= 2;
  a = a + b;
  a += b;
  a %= b;
  a *= 3;
  a &= b;
  a |= 3;
  a ||= b;
  b = -1;
  a +-= b;
  a ^= 0x80;
}


And I still think pointers are cool.  I'm currently working on getting them to
work with inline function calls.  But a lot of stuff works already.

int i = 30;

task main()
{
  int x = 3;
  int* y = &x;
//  *&x = 4; // not supported
  MyFred(y); // not emitted correctly
  *y = 4;
  int z = *y;
  z = 4;
  MyFred(&z); // not emitted correctly
//047 setv       var[32], 33
//052 setv       var[32], 4
//  z = (*y)++; // not supported
//  z = ++(*y); // not supported
  int a[5];
  a[2] = 2;
  z = x*y;
  z = x**y;
  z = x & *y;
  z = x&y;
  y = &a[2];
  y = &a;
}

void MyFred(int *x)
{
  *x = 4;
//  x = &i;
}



Message has 1 Reply:
  Re: NQC's future
 
(...) Very! I don't expect to use the game data often, but it would be nice to have the option of having it available or not. thanks for the great work! (21 years ago, 28-Jan-04, to lugnet.robotics.rcx.nqc, lugnet.robotics.spybotics)

Message is in Reply To:
  Re: NQC's future
 
(...) Dear John, Even if it requires a firmware replacement, please add: - more variables, - float type variables, - string type variables, - certain math library (sin, cos, exp, ...) - at least good approximations, - more subs, - functions with (...) (21 years ago, 9-Dec-03, to lugnet.robotics.rcx.nqc, lugnet.robotics.spybotics)

29 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
    

Custom Search

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