October 31, 2024, 09:33:51 PM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


Converting Prop-1 Programs to the Prop-2

Started by JonnyMac, February 12, 2007, 10:15:39 PM

Previous topic - Next topic

JonnyMac

Since the Prop-1 and Prop-2 both use flavors of PBASIC, most conversions are pretty easy.  Use these guidelines to make sure you don't miss anything.

1) Change your directives:

'   {$STAMP BS1}
'   {$PBASIC 1.0}


becomes...

'   {$STAMP BS2}
'   {$PBASIC 2.5}



2) Change SYMBOL to PIN, CON, or VAR

Instead of:

SYMBOL  Trigger         = PIN7

... use:

Trigger         PIN     7


Instead of:

SYMBOL  IsOn            = 1

... use:

IsOn            CON     1


Instead of:

SYMBOL  secs            = B2

... use:

secs            VAR     Byte

... and remember that you have Bit, Nib (4 bits), Byte, and Word variables.


3) PBASIC 2.5 add nice features like IF-THEN-ELSE and DO-LOOP that minimize user-created labels.  Here's one example:

Instead of:

Run_Timer:
  IF tix = 0 THEN Timer_Done
    PAUSE 100
    tix = tix - 1
    GOTO Run_Timer

Timer_Done:
  RETURN


... you can use:

Run_Timer:
  DO WHILE tix > 0
    PAUSE 100
    tix = tix - 1
  LOOP
  RETURN



4) Functions with parameter lists use square brackets, [ ], in PBASIC 2.5.

5) SERIN and SEROUT are more flexible and require the biggest changes as there are no built-in baud constants.  These, however, can be built into code like this:

T2400           CON     396
T38K4           CON     6
Open            CON     $8000
Baud            CON     Open + T38K4

Jon McPhalen
EFX-TEK Hollywood Office