Hi Bean,
Years ago I played with Borland's Turbo Pascal- Prolog was also lots of fun! I don't have any experience with Delphi.
I now program in C# and have had good success using Mono to support OSX and Linux. I really like the PropBasic interface (especially the .err file) - I'd prefer to keep things simple where ViewPort passes files and arguments to PropBasic and gets back files- I don't think we need a closer integration- at least for now. Some quick searching reveals that Delphi can output binaries that can run on the Mono CLR- do you know anything about that? Or on outputting binaries for OSX/Linux? Do you mind if I include the PropBasic compiler in the ViewPort installer?
Hanno
Some quick searching reveals that Delphi can output binaries that can run on the Mono CLR- do you know anything about that? Or on outputting binaries for OSX/Linux?
I don't think Delphi will work on Mono because it is not a .net language. But I could be wrong about that...
I don't have a Mac or Linux box, but if I did I would use "Free Pascal"/Lazarus www.freepascal.org to compile for them.
Do you mind if I include the PropBasic compiler in the ViewPort installer?
I do not mind at all. I would be greatful. The more people using PropBasic the better.
P.S. If you want to try compiling with free pascal just shoot me a PM with an e-mail address and I'll send you the source code.
I'm downloading freepascal right now. I'll see if there are any changes needed to cross-compile.
Hello,
where does PropBasic look for LOAD and INCLUDE files?
Only in the same directory as the source is?
It would be nice to be able to specify a lib/asm directory, perhaps as a switch?
Cheers, Friedrich
Hello,
where does PropBasic look for LOAD and INCLUDE files?
Only in the same directory as the source is?
It would be nice to be able to specify a lib/asm directory, perhaps as a switch?
Cheers, Friedrich
That sounds like a good idea. I'll look into it.
Here is a demo program that shows the speed of PropBasic. It draws random lines on the video feed. It avergaes about 8300-8400 lines per second.
' Viewport video demo showing speed of PropBasic
' Draws random lines shows how many lines per second(lps) are drawn
DEVICE P8X32A, XTAL1, PLL16X
FREQ 80_000_000
vidBuffer HUB BYTE(19200) = 0
PROGRAM Start
Plot SUB 2 ' X, Y
Line SUB 4 ' X1, Y1, X2, Y2
x1 VAR LONG
y1 VAR LONG
x2 VAR LONG
y2 VAR LONG
color VAR LONG
rand VAR LONG
lineCnt VAR LONG
tempCnt VAR LONG
lps VAR LONG
temp VAR LONG
WATCH lps
Start:
VPVideo vidBuffer
DO
lineCnt = 0
tempCnt = cnt
DO
RANDOM rand, x1
x1 = x1 AND 159
RANDOM rand, y1
y1 = y1 AND 119
RANDOM rand, x2
x2 = x2 AND 159
RANDOM rand, y2
y2 = y2 AND 119
RANDOM rand, color
color = color AND 252
Line x1, y1, x2, y2
INC lineCnt
temp = cnt - tempCnt
LOOP UNTIL temp >= 80_000_000
lps = lineCnt
LOOP
END
SUB Plot ' X, Y
__param2 = __param2 * 160
__param1 = __param1 + __param2
WRBYTE vidBuffer(__param1), color
ENDSUB
SUB Line ' xStart, yStart, xEnd, yEnd
_x1 VAR LONG
_y1 VAR LONG
_x2 VAR LONG
_y2 VAR LONG
_dirX VAR LONG
_dirY VAR LONG
_deltaX VAR LONG
_deltaY VAR LONG
_temp VAR LONG
_x1 = __param1
_y1 = __param2
_x2 = __param3
_y2 = __param4
_deltaX = _x2 - _x1
_dirX = sgn _deltaX
_deltaX = abs _deltaX
_deltaY = _y2 - _y1
_dirY = sgn _deltaY
_deltaY = abs _deltaY
IF _deltaX > _deltaY THEN
' Horz line
_temp = _deltaX / 2
DO
Plot _x1, _y1
IF _x1 = _x2 THEN EXIT
_temp = _temp - _deltaY
IF _temp < 0 THEN
_temp = _temp + _deltaX
_y1 = _y1 + _dirY
ENDIF
_x1 = _x1 + _dirX
LOOP
ELSE
' Vert line
_temp = _deltaY / 2
DO
Plot _x1, _y1
IF _y1 = _y2 THEN EXIT
_temp = _temp - _deltaX
IF _temp < 0 THEN
_temp = _temp + _deltaY
_x1 = _x1 + _dirX
ENDIF
_y1 = _y1 + _dirY
LOOP
ENDIF
ENDSUB
Here is an optimized line program. This one gets almost 15,000 lines per second.
' Viewport video demo showing speed of PropBasic
' Draws random lines shows how many lines per second(lps) are drawn
DEVICE P8X32A, XTAL1, PLL16X
FREQ 80_000_000
vidBuffer HUB BYTE(19200) = 0
PROGRAM Start
Plot SUB 2 ' X, Y
Line SUB 4 ' X1, Y1, X2, Y2
x1 VAR LONG
y1 VAR LONG
x2 VAR LONG
y2 VAR LONG
color VAR LONG
rand VAR LONG
lineCnt VAR LONG
tempCnt VAR LONG
lps VAR LONG
temp VAR LONG
WATCH lps
Start:
VPVideo vidBuffer
DO
lineCnt = 0
tempCnt = cnt
DO
RANDOM rand, x1
x1 = x1 AND 159
RANDOM rand, y1
y1 = y1 AND 119
RANDOM rand, x2
x2 = x2 AND 159
RANDOM rand, y2
y2 = y2 AND 119
RANDOM rand, color
color = color AND 252
Line x1, y1, x2, y2
INC lineCnt
temp = cnt - tempCnt
LOOP UNTIL temp >= 80_000_000
lps = lineCnt
LOOP
END
SUB Line ' xStart, yStart, xEnd, yEnd
_x1 VAR __param1
_y1 VAR __param2
_x2 VAR __param3
_y2 VAR __param4
_dirX VAR LONG
_dirY VAR LONG
_deltaX VAR LONG
_deltaY VAR LONG
_temp VAR LONG
_addr VAR LONG ' Current pixel address
_deltaX = _x2 - _x1
_dirX = sgn _deltaX
_deltaX = abs _deltaX
_deltaY = _y2 - _y1
_dirY = sgn _deltaY
_dirY = _dirY * 160
_deltaY = abs _deltaY
' Set _addr to starting pixel address
_addr = GETADDR vidBuffer
_temp = _y1 * 160
INC _addr, _temp
INC _addr, _x1
IF _deltaX > _deltaY THEN
' Horz line
_x2 = _deltaX
_temp = _deltaX / 2
HLine:
WRBYTE _addr, color ' Plot pixel
_temp = _temp - _deltaY
IF _temp < 0 THEN
_temp = _temp + _deltaX
_addr = _addr + _dirY ' Adjust pixel address for change in Y
ENDIF
_addr = _addr + _dirX ' Adjust pixel address for change in X
DJNZ _x2,Hline
ELSE
' Vert line or single point
IF _deltaY <> 0 THEN
_y2 = _deltaY
_temp = _deltaY / 2
VLine:
WRBYTE _addr, color ' Plot pixel
_temp = _temp - _deltaX
IF _temp < 0 THEN
_temp = _temp + _deltaY
_addr = _addr + _dirX ' Adjust pixel address for change in X
ENDIF
_addr = _addr + _dirY ' Adjust pixel address for change in Y
DJNZ _y2,VLine
ELSE
WRBYTE _addr, color ' Plot single point line
ENDIF
ENDIF
ENDSUB
Husband: If I won the lottery would you take half and leave me ?
Wife: Of course not !
Husband: How about if I throw in the house too ?
I had a similar conversation with my ex-wife when she Said: "It's me or that $10,000 worth of flight simulator equipment you bought"!. I'm sure gonna miss her.....
I've been busy on some "modern" features for ViewPort- will make PropBasic much more fun! Will be revealed soon.
Does PropBasic do terminal IO yet? In current ViewPort you should use the 'terminal.spin' object to input/output bytes, strings, numbers... I'm improving that so you no won't need to "share" two longs for sending/receiving data- all ViewPort programs will have basic tx/rx/rxavailable functionality available. Here's a sample echo program:
con
clkfreq
clkmode
obj
vp:"conduit"
pub echo
vp.share(0,0) 'start conduit- no need to share anything
repeat
vp.tx(vp.rx)
I thought I ran across some Delphi tool that compiled delphi code to .net/mono bytecode- but I can't find it now... At some point osx and linux binaries would be nice. I'll include PropBasic in next installer with references to you and your website.
Hanno
Hi Sandfire,
I see this is your first post! Welcome to the Propeller community. We have school holidays right now so I'm not making as much progress as I'd like. I did put up some screenshots of OPA- the open protocol analyzer- but I want to wait until I have things nicely working before announcing the results of my current effort.
Hanno
Hi Sandfire,
I see this is your first post! Welcome to the Propeller community. We have school holidays right now so I'm not making as much progress as I'd like. I did put up some screenshots of OPA- the open protocol analyzer- but I want to wait until I have things nicely working before announcing the results of my current effort.
Hanno
Thanks Hanno.
Well, I am really looking forward to seeing what you've been working on.
hey hanno and bean,
i have been trying to watch a word value read from a data table. the value of tmp is erratic and never matches the values in table, am i doing this right? thanks!
DEVICE P8X32A, XTAL1, PLL16X
FREQ 80_000_000
Table WDATA 1500,2000,2200,1500,1500,1500,1500,1500
tmp VAR LONG
idx var long
watch tmp
watch idx
PROGRAM Start
Start:
FOR idx = 0 to 8
RDWORD table(idx), tmp
pause 500
NEXT
GOTO START
END
Skynugget,
I have fixed the problem (Thanks for finding it).
I have started a new thread to keep the latest version of PropBasic for Viewport in.
You can download version 1.26 from here http://forums.parallax.com/showthread.php?135678
Simon,
HUB variables cannot be used as a VAR. They are simply for storage to be used with RDxxxx and WRxxxx.
Change rxHead and rxTail to VAR LONG and it will work.
Arrgh! OK, I'll get the hang of this eventually. Thanks Bean, the following works (I need to keep the HUB variables because they're fed from another cog.):
rxHead HUB Byte = 0
rxTail HUB Byte = 0
rxBuffer HUB Byte( 64 ) = 0
idx VAR Long
temp VAR Long
hd VAR Long
tl VAR Long
FOR idx = hd TO tl
[B] temp = rxBuffer(idx)
TX_STR temp
[/B]NEXT
I've just set up propbasic and viewport (4.7.7 latest beta). Do breakpoints work with prop basic? It's sure handy to be able to step through a program. Thanks
Okay, I'm really confused. I downloaded VP from Hanno's site and paid my $89. Now I want to use PropBASIC but find that my new VP is V 4.5 [something] and that PropBASIC requires V 4.6.7(?)
So, I go to my Help menu in VP and select 'Check for updates' and, sure enough, I already get an update....but only to V4.6.2????? And the post previous to this discusses 4.7.7???
Comments
"A\000" would work for a single character string (but is not pretty).
I'll look into the spin CASE statement to see if I can implement something like it.
Bean
Years ago I played with Borland's Turbo Pascal- Prolog was also lots of fun! I don't have any experience with Delphi.
I now program in C# and have had good success using Mono to support OSX and Linux. I really like the PropBasic interface (especially the .err file) - I'd prefer to keep things simple where ViewPort passes files and arguments to PropBasic and gets back files- I don't think we need a closer integration- at least for now. Some quick searching reveals that Delphi can output binaries that can run on the Mono CLR- do you know anything about that? Or on outputting binaries for OSX/Linux? Do you mind if I include the PropBasic compiler in the ViewPort installer?
Hanno
I don't have a Mac or Linux box, but if I did I would use "Free Pascal"/Lazarus www.freepascal.org to compile for them.
I do not mind at all. I would be greatful. The more people using PropBasic the better.
P.S. If you want to try compiling with free pascal just shoot me a PM with an e-mail address and I'll send you the source code.
I'm downloading freepascal right now. I'll see if there are any changes needed to cross-compile.
Bean
where does PropBasic look for LOAD and INCLUDE files?
Only in the same directory as the source is?
It would be nice to be able to specify a lib/asm directory, perhaps as a switch?
Cheers, Friedrich
You need say --> It is Very Good if people Have 2 Very Good programs Married to use !!!
Here is a demo program that shows the speed of PropBasic. It draws random lines on the video feed. It avergaes about 8300-8400 lines per second.
Bean
Bean
Husband: If I won the lottery would you take half and leave me ?
Wife: Of course not !
Husband: How about if I throw in the house too ?
I had a similar conversation with my ex-wife when she Said: "It's me or that $10,000 worth of flight simulator equipment you bought"!. I'm sure gonna miss her.....
Mike B.
I've been busy on some "modern" features for ViewPort- will make PropBasic much more fun! Will be revealed soon.
Does PropBasic do terminal IO yet? In current ViewPort you should use the 'terminal.spin' object to input/output bytes, strings, numbers... I'm improving that so you no won't need to "share" two longs for sending/receiving data- all ViewPort programs will have basic tx/rx/rxavailable functionality available. Here's a sample echo program: I thought I ran across some Delphi tool that compiled delphi code to .net/mono bytecode- but I can't find it now... At some point osx and linux binaries would be nice. I'll include PropBasic in next installer with references to you and your website.
Hanno
Thanks. I don't have the website anymore though.
I'm about to run out on my trial. Could you give me a license code ?
I just posted version 1.25 in this thread http://forums.parallax.com/showthread.php?135098-PropBasic-Bug
Bean
How is this coming Hanno?
I see this is your first post! Welcome to the Propeller community. We have school holidays right now so I'm not making as much progress as I'd like. I did put up some screenshots of OPA- the open protocol analyzer- but I want to wait until I have things nicely working before announcing the results of my current effort.
Hanno
Thanks Hanno.
Well, I am really looking forward to seeing what you've been working on.
I won't ask any questions and just be patient.
Enjoy the time with your kids.
i have been trying to watch a word value read from a data table. the value of tmp is erratic and never matches the values in table, am i doing this right? thanks!
I confirmed that your table data don't show up. I think it's Bean's issue- since the spin file doesn't seem to contain the data.
Hanno
Bean
I have fixed the problem (Thanks for finding it).
I have started a new thread to keep the latest version of PropBasic for Viewport in.
You can download version 1.26 from here http://forums.parallax.com/showthread.php?135678
Let me know if this does indeed fix the issue.
Bean
Have I just found a bug, or am I trying to do something that won't work?:
When I try to run this (via ViewPort) I get a compile error: INVALID PARAMETER "rxTail".
I tried swapping rxTail and rxHead, but that gives "rxHead" as the invalid parameter. Does this mean I can't have two variables in the FOR loop?
HUB variables cannot be used as a VAR. They are simply for storage to be used with RDxxxx and WRxxxx.
Change rxHead and rxTail to VAR LONG and it will work.
Bean
So, I go to my Help menu in VP and select 'Check for updates' and, sure enough, I already get an update....but only to V4.6.2????? And the post previous to this discusses 4.7.7???
What am I missing here?
Mickster
Many, many thanks!
Mickster