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 / 13106
13105  |  13107
Subject: 
Re: NQC on Scout
Newsgroups: 
lugnet.robotics
Date: 
Thu, 9 Nov 2000 01:28:57 GMT
Original-From: 
Steve Baker <SJBAKER1@avoidspamAIRMAIL.NET>
Reply-To: 
sjbaker1@airmail.%stopspam%net
Viewed: 
615 times
  
Martin wrote:

Okay, I wrote my first (sophomoric) piece of code for the scout, and I
have kind of lame question. I know that there's no good way to answer
this question, but about how much code can I stuff in the thing? I've
heard that it only has 1kbyte for code, is this true? And about (very
roughly) how many lines of code will that work out to, pre-compilation?

Well, if you run "nqc -Ofilename yourprogram.nqc", you'll save the compiled
code to 'filename' - look at the length of that file.

I don't think it's exactly the right size because it seems to contain
ASCII strings for the names of functions and such - and it doesn't
contain (presumably) the space taken up by your variables...but it's
a good first step.

I compiled a line-following robot's code (about 200 lines) and ended up
with a 500 byte output file.  Intuitively, that seems about right to me...
most lines in my program are simple - adding one to a variable, starting
a motor, reading a sensor.  Many of those will be single instructions
in the byte-code.  Lots of lines of my program will generate no code
at all (Lines that are comments - lines with just a '{' or a '}')...so
an average of 3 bytes per line seems very reasonable.

You know - it would be VERY cool if NQC would tell you what percentage
of memory your program has consumed when you compile it.  Since you
tell NQC which computer you are compiling for, it could work it out
accurately.

--
Steve Baker   HomeEmail: <sjbaker1@airmail.net>
              WorkEmail: <sjbaker@link.com>
              HomePage : http://web2.airmail.net/sjbaker1
              Projects : http://plib.sourceforge.net
                         http://tuxaqfh.sourceforge.net
                         http://tuxkart.sourceforge.net
                         http://prettypoly.sourceforge.net



Message has 1 Reply:
  Re: NQC on Scout
 
(...) Variables don't take up space (unfortunately). They're purely register variables. (24 years ago, 9-Nov-00, to lugnet.robotics)

Message is in Reply To:
  NQC on Scout
 
Okay, I wrote my first (sophomoric) piece of code for the scout, and I have kind of lame question. I know that there's no good way to answer this question, but about how much code can I stuff in the thing? I've heard that it only has 1kbyte for (...) (24 years ago, 8-Nov-00, to lugnet.robotics)

7 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