To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 2714
2713  |  2715
Subject: 
Re: anyone know how to check free space on RCX?
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Fri, 12 Jul 2002 02:40:14 GMT
Viewed: 
2335 times
  
On Thu, 11 Jul 2002, Joseph Woolley wrote:

That is very interesting Jason.  It is interesting that mm_free_mem()
returns a 16bit value using a 32bit return code.  Both int and long are
32bit value on most computers/compilers these days;  short would be a 16bit
value;  and char would be an 8bit value.  Maybe mm_free_mem() should return
an unsigned short instead.

int is defined as the natural width of the processor, which on a 16-bit
processor is 16 bits.  longs are 64 bits on some machines as well, so you
can't assume it is always 32 bits -- if your code cares, use sizeof.

I have used lcd_int and cputw to display 32bit values (although I am not
sure if lcd_int displays the value in hex or dec.  I may be wrong about it
displaying hex).  So lcd_int is looking only at the first word, whereas
cputw is looking at the second word.

Thank you for pointing this out!  I guess the next step is to check the
instruction timing for using 16bit values vs 32bit values.  If the
instruction timing is roughly the same, it may be worth updating some of the
code to use unsigned short instead of int or unsigned int.  On the other
hand, if a new RCX is released with more memory, we could run into problems.

32-bit math on the H8 is substantially slower than 16-bit as it requires
multiple instructions.  Any new version of the RCX that added more memory
would be so different that worrying about portability to a hypothetical
machine is wasted effort.

John A. Tamplin jat@jaet.org
770/436-5387 HOME 4116 Manson Ave
770/431-9459 FAX Smyrna, GA  30082-3723



Message is in Reply To:
  Re: anyone know how to check free space on RCX?
 
That is very interesting Jason. It is interesting that mm_free_mem() returns a 16bit value using a 32bit return code. Both int and long are 32bit value on most computers/compilers these days; short would be a 16bit value; and char would be an 8bit (...) (22 years ago, 11-Jul-02, to lugnet.robotics.rcx.legos)

13 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