metron9
04-27-2007, 12:44 PM
I have not quite figured out how to come back from program 2 yet. My goal was to make a memory swap function to run subroutines written compiled and stored on external memory for the BS2. I am just using data statements in this to see if it could be done.
If I knew how the tokenizer handled pointers for goto and returns it would be easier.
As it stands now though, one could use a setup program almost 2000 bytes long then pull in the main program but once it was done rebooting the stamp would only run the first program. Unles I can find a way to jump to the bootloader code fafter the first swap it could only be done once.
Fun to play with though, reminds me of my C64 days.
' {$STAMP BS2}
' {$PBASIC 2.5}
' {$PORT COM2}
BUFFER VAR Byte
FN VAR Byte
WL VAR Word
DATA 0,0,0,0
DATA $00,$00,$A6
DATA $D9,$D3,$EC,$69,$36,$34,$53,$36,$35,$4B,$9A,$29,$9 B,$9A,$25
DATA $CD,$90,$66,$54,$13,$84,$4C,$35,$07,$C0
MAIN:
DEBUG "This is program 1"
BOOT:
WL=$07E0
FOR FN=0 TO 31
READ FN,BUFFER
WRITE WL,BUFFER
WL=WL+1
NEXT
DEBUG CR,"STARTING PROGRAM 2",CR
GOTO MAIN
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think Inside the box first and if that doesn't work..
Re-arrange what's inside the box then...
Think outside the BOX!
If I knew how the tokenizer handled pointers for goto and returns it would be easier.
As it stands now though, one could use a setup program almost 2000 bytes long then pull in the main program but once it was done rebooting the stamp would only run the first program. Unles I can find a way to jump to the bootloader code fafter the first swap it could only be done once.
Fun to play with though, reminds me of my C64 days.
' {$STAMP BS2}
' {$PBASIC 2.5}
' {$PORT COM2}
BUFFER VAR Byte
FN VAR Byte
WL VAR Word
DATA 0,0,0,0
DATA $00,$00,$A6
DATA $D9,$D3,$EC,$69,$36,$34,$53,$36,$35,$4B,$9A,$29,$9 B,$9A,$25
DATA $CD,$90,$66,$54,$13,$84,$4C,$35,$07,$C0
MAIN:
DEBUG "This is program 1"
BOOT:
WL=$07E0
FOR FN=0 TO 31
READ FN,BUFFER
WRITE WL,BUFFER
WL=WL+1
NEXT
DEBUG CR,"STARTING PROGRAM 2",CR
GOTO MAIN
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think Inside the box first and if that doesn't work..
Re-arrange what's inside the box then...
Think outside the BOX!