|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
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 |
|
|
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 |