Go to Post We are not the families of competiting robot teams, but we are a family of Gracious and Professionalism, because we know it better than anyone in the world. - wsansewjs [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 08-06-2002, 00:30
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
Need list of features for PBASIC emulator.

I'm currently working on my OI/RC emulator for testing code with, and I'm wondering how much of the PBASIC language people actually use. I just ask because I don't want to spend hours coding support for an obscure command that nobody is using. On the other hand, even if only one person is using it, I would be happy to add support.

Here is the list of the obvious ones I have come up with so far:
+,-,*,/, =
and, or
&, |, ~, ^
Min, Max
Serin, Serout
VAR, CON
Output (for LEDs)
store, load
goto, labels
if

Other ones I'm not sure about (I haven't used them, but I can see where some teams might):
Lookup, Lookdown
Trig functions
for loops

Anyway, that's all I've been able to come up with so far. Others?
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php

Last edited by rbayer : 08-06-2002 at 00:38.
  #2   Spotlight this post!  
Unread 08-06-2002, 11:55
srawls's Avatar
srawls srawls is offline
Registered User
#0122 (Nasa Knights)
 
Join Date: Dec 2001
Location: Yorktown
Posts: 507
srawls is an unknown quantity at this point
Send a message via AIM to srawls
put/get
write
gosub (I've never personally been organized enough to break my pbasic into subrotines, but I have seen robot code that does)

That's all I can think of now. BTW, good luck with your emulator.

Stephen

P.S just in case it slipped your mind (it probably didn't, but just making sure), make sure in your VAR command you have the functionality to go var_name.bit0, etc.
  #3   Spotlight this post!  
Unread 08-06-2002, 22:15
VanWEric VanWEric is offline
Registered User
#0250 (Dynamos)
 
Join Date: Feb 2002
Location: NY
Posts: 86
VanWEric is an unknown quantity at this point
<<>>

I like using << and >>

aand make sure it truncates the numbers "correctly" we don't want any emulator that is better at math than the real thing...
  #4   Spotlight this post!  
Unread 09-06-2002, 00:13
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
lol

easy way i've found to truncate numbers in C++ like you do in PBASIC. declare a 'double' (probably works with 'float' too) variable which takes in the number, then just declare an 'int' variable, whcih then assumes the value of the double. like this...

Code:
double x;
int y;

x = 5.9;
y = x;

cout << y;
that would print out a 5. you will get a warning, but that's the best way i've found to truncate the numbers in C++. i'm sure there's some class that does it better, but i've yet to find it.
__________________
AIM --> Woloi
Email --> ian@woloschin.com
  #5   Spotlight this post!  
Unread 09-06-2002, 10:32
srawls's Avatar
srawls srawls is offline
Registered User
#0122 (Nasa Knights)
 
Join Date: Dec 2001
Location: Yorktown
Posts: 507
srawls is an unknown quantity at this point
Send a message via AIM to srawls
type casting

How about just using type casting instead. For example

Code:
int x;

x = 5.9; //this would give you a warning like in your example
x = int(5.9); //this truncates correctly, and gives no warning
Stephen
  #6   Spotlight this post!  
Unread 09-06-2002, 11:39
VanWEric VanWEric is offline
Registered User
#0250 (Dynamos)
 
Join Date: Feb 2002
Location: NY
Posts: 86
VanWEric is an unknown quantity at this point
word up homies

don't use any floats or doubles anywhere in the program. at all. not even one. the 2sx doesn't have the foggiest of what a decimal point was. What i was trying to say is that although an int will truncate correctly when all is said and told, the math inbetween will not. for example, in pbasic, 5/2*2=4, not 5. C++ will do all the math out with some ungodly precision and then truncate. you may need to change x=x/2*2 to x=x/2; x=x*2.
Also, declaring it as an unsigned might be better, so that you automatically get wrapping up top and below, ie 267 doesnt exist and neither does -6. don't know how to handle the 255 thing with out anal checking in the code.

BTW - i have used words as well (hence the title of the post) and have accessed specific bits in a byte. ie

var variable= 126
variable.bit5=1

good luck getting that to work. I think you'll need to use bit masking or some other craziness
  #7   Spotlight this post!  
Unread 09-06-2002, 14:04
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
Thanks for all the suggestions! PBASIC is not overly complicated (no order of operations!), so none of it should be too technically difficult. As for the 255 thing, I'm not going to check it. After all, if your code ends up producing 255's, you probably want to know! The way I've planned out the tokenizer, expressions such as x=5*y/z will be evaluated in two steps, so truncating shouldn't be an issue. The way I'm planning on doing individual bit assignments is to use different algorithms for 1 and 0. For setting a bit to 1, I will use | with everything set to 0's except the bit that needs setting. For clearing a bit, I will use & with a mask of all 1's except for the bit that needs clearing.

One more questions: has anyone ever had a need to access a specific nibble in a byte, or a specific byte in word? Is this even possible?
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #8   Spotlight this post!  
Unread 09-06-2002, 14:20
srawls's Avatar
srawls srawls is offline
Registered User
#0122 (Nasa Knights)
 
Join Date: Dec 2001
Location: Yorktown
Posts: 507
srawls is an unknown quantity at this point
Send a message via AIM to srawls
from the manual (it would be var_name.<entry from below>)
Code:
lowbyte
highbyte
byte0
byte1
lownib
highnib
nib0
nib1
nib2
nib3
i don't think it'd ever be nescasary to access a single byte in a word in the robot code since inputs and outputs are limited to bytes. maybe as a clever optimization or something, though.

Stephen
  #9   Spotlight this post!  
Unread 09-06-2002, 17:59
Jnadke Jnadke is offline
Go Badgers!
#0093
Team Role: Alumni
 
Join Date: Jan 2002
Location: Appleton, WI
Posts: 775
Jnadke is on a distinguished road
Send a message via ICQ to Jnadke Send a message via AIM to Jnadke Send a message via Yahoo to Jnadke
variable renaming
lookup/lookdown
gosub

That's all I used that wasn't in your list...

Here's our code that I created. The grabber subroutine is totally inefficent code-wise, but it works flawlessly. Our grabber is totally automated with 2 rocker switches... Also the code meshes well....
__________________
The best moments of our lives fall in two categories: those that did happen and those that did not.
  #10   Spotlight this post!  
Unread 09-06-2002, 18:02
Jnadke Jnadke is offline
Go Badgers!
#0093
Team Role: Alumni
 
Join Date: Jan 2002
Location: Appleton, WI
Posts: 775
Jnadke is on a distinguished road
Send a message via ICQ to Jnadke Send a message via AIM to Jnadke Send a message via Yahoo to Jnadke
Our code.
Attached Files
File Type: txt toborv 1.0.txt (24.8 KB, 59 views)
__________________
The best moments of our lives fall in two categories: those that did happen and those that did not.
  #11   Spotlight this post!  
Unread 09-06-2002, 19:10
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
By renaming, I assume you mean:
newVarName VAR oldVarName

If not, please explain as I just finished coding the support for the above type of operation (including .bitX, .nibX, .byteX, etc) and would like to be finished with this section ASAP because everything else depends on it.

My brain hurts from all the binary math, but other than that, everything seems to be working!
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #12   Spotlight this post!  
Unread 10-06-2002, 12:14
Jnadke Jnadke is offline
Go Badgers!
#0093
Team Role: Alumni
 
Join Date: Jan 2002
Location: Appleton, WI
Posts: 775
Jnadke is on a distinguished road
Send a message via ICQ to Jnadke Send a message via AIM to Jnadke Send a message via Yahoo to Jnadke
Yup... that's exactly what I mean... Thanks!
__________________
The best moments of our lives fall in two categories: those that did happen and those that did not.
  #13   Spotlight this post!  
Unread 10-06-2002, 22:11
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
Anyone use BRANCH? This will be in there for sure (now that I know about it, I'm definately going to use it next year), but I'm trying to prioritize.
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #14   Spotlight this post!  
Unread 10-06-2002, 22:40
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
BRANCH? never heard of it. of course, i've only used the easy commands, cause i didn't know anything this year .
__________________
AIM --> Woloi
Email --> ian@woloschin.com
  #15   Spotlight this post!  
Unread 10-06-2002, 23:14
Ulibrium Ulibrium is offline
Registered User
#0920 (Lancers)
 
Join Date: Jan 2002
Location: Philadelphia, PA
Posts: 29
Ulibrium is an unknown quantity at this point
Send a message via AIM to Ulibrium
Can you elaborate on the architecture of this emulator? Is it going to interpret object code or is it going to parse PBASIC code?
__________________
Three mathematicians slave over a board full of tensor calculus. One looks to the other and asks... "do you remember what we sent out to prove?"
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wheres the list, whats the secret? archiver 2001 3 24-06-2002 01:31
Full list of teams & competitions archiver 2001 14 24-06-2002 00:52
does anyone know where to obtain a regional team list archiver 2001 1 24-06-2002 00:44
Team list & Events archiver 2000 2 23-06-2002 22:39
Suggested list of things to bring to the regionals Andrew Wyatt Technical Discussion 1 06-03-2002 14:41


All times are GMT -5. The time now is 15:42.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi