Go to Post Dont give up, because that is when you lose what you have. FIRST is the best experience that I have had throughout my entire life and there is no way ANYONE can make me quit FIRST. - Arefin Bari [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Spotlight this post!  
Unread 07-11-2001, 08:18
Lloyd Burns Lloyd Burns is offline
Registered User
FRC #1246 (Agincourt Robotics)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Toronto
Posts: 292
Lloyd Burns is an unknown quantity at this point
Why not a CASE x OF statement ?

The structure of the PIC code (was this what Microchip and Scenix were sqabbling over) would make it easy to construct a CASE statement.

CASE x OF
~~0 : y = 3;
~~6 : y = 7
~~1..5 : y = 4
ELSE y = 0;

~~~~~~~~MOVF X,f
~~~~~~~~BTFSC ZERO
~~~~~~~~GOTO YIS3
~~~~~~~~MOVLW .6
~~~~~~~~SUBWF X,w
~~~~~~~~BTFSC ZERO
~~~~~~~~GOTO YIS7
~~~~~~~~BTFSC CARRY 'PIC CODES NOT ~~~~~~~~~~~~~~~~~~~~~~~~' HANDY:BTFSS?
~~~~~~~~GOTO YIS0
~~~~~~~~MOVLW .4
~~~~~~~~MOVWF Y
~~~~~~~~GOTO ENDCASE
YIS3 MOVLW .3
~~~~~~~~MOVWF Y
~~~~~~~~GOTO ENDCASE
YIS7 MOVLW .7
~~~~~~~~MOVWF Y
~~~~~~~~GOTO ENDCASE
YIS0 MOVLW .0
~~~~~~~~MOVWF Y
ENDCASE

And yes, a special case could zero Y differently.
Another alternate would be the table of RETLWs, as in the PBASIC lookup/down instructions.

BTW is there an option available to NOT delete leading spaces when this BB program edits a post ?
 


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
PBASIC ARCTAN function Greg Ross Programming 14 11-05-2003 12:28
Obscure PBASIC for RoboEmu rbayer Programming 1 28-03-2003 23:57
PBasic 2.5 vs. 2.0 Anthony Kesich Programming 6 09-02-2003 22:06
emulationFIRST (aka PBasic emulator) Matt Leese Programming 5 30-06-2002 12:06
PBASIC Loop Speed? archiver 2001 3 23-06-2002 23:46


All times are GMT -5. The time now is 00:09.

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