Subject:
|
Re: anyone know how to check free space on RCX?
|
Newsgroups:
|
lugnet.robotics.rcx.legos
|
Date:
|
Fri, 12 Jul 2002 18:23:58 GMT
|
Viewed:
|
2432 times
|
| |
| |
On Friday, 12. July 2002 17:54, Jason Clark wrote:
> In lugnet.robotics.rcx.legos, Joseph Woolley writes:
> > 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.
>
> According to config/h8300/h8300.h in the gcc sources, int is 32bit
> for the h8 cross compiler.
My sources (gcc-3.0) say:
#define INT_TYPE_SIZE (TARGET_INT32 ? 32 : 16)
A short experiment revealed that sizeof(short)=sizeof(int)=2,
sizeof(long)=4. So int is normally 16bit. Only with the switch
"-mint32" I get 32 bit ints. This is with a self-compiled gcc-3.0.
Many places in legOS use int where they only want a 16 bit value.
> > 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.
lcd_int display the value in decimal, but normally you have more than
10000 bytes free so it displays "9999". Only the hex value always
fits on the display.
> lcd_int() is actually a #define for a call to the ROM function
> lcd_number(), which prevents me from inspecting the source code :P
If you want to extract the ROM ;) see
http://graphics.stanford.edu/~kekoa/rcx/
This particular function is not very nice to disassemble, though.
> The comments in <rom/lcd.h> explain partially (it should display a
> signed integer, no decimal), but I can't tell how overflowing the
> size of the LCD is handled. And since I'm away from home visiting
> family, I am RCX-free this weekend (yuck), so I can't conduct any
> tests just now. I will probably write some code next week to put
> these call through their paces, as well as check on some data type
> sizes.
I would guess that it just prints 9999 if the number is too big to
fit, otherwise it prints the decimal value.
Jochen
|
|
Message has 1 Reply:
Message is in Reply To:
13 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
|
|
|
|