Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 9297

Other programming languages • Re: Basic on Raspberry

$
0
0
PureBasic is a really nice programming language.
I haven't looked at it for many years, so it may have been fixed since, but back then it had a serious flaw: strings were NUL-terminated! A key feature of all BASICs is (or at least should be) that strings can contain arbitrary binary data, without resorting to some special encoding like base64. In BBC BASIC that is essential to allow strings to contain VDU commands, such as for changing colour, plotting sprites etc.

Code:

   10 MODE 9 : OFF   20 VDU 23,23,4;0;0;0;   30 head$ = CHR$25 + CHR$145 + CHR$0   + CHR$0   + CHR$80  + CHR$0   40 up$   = CHR$25 + CHR$0   + CHR$0   + CHR$0   + CHR$32  + CHR$0   50 down$ = CHR$25 + CHR$0   + CHR$0   + CHR$0   + CHR$&B0 + CHR$&FF   60 left$ = CHR$25 + CHR$0   + CHR$&D0 + CHR$&FF + CHR$0   + CHR$0   70 eye$  = CHR$25 + CHR$153 + CHR$&F4 + CHR$&FF + CHR$0   + CHR$0   80 grin$ = CHR$25 + CHR$161 + CHR$80  + CHR$0   + CHR$0   + CHR$0   90  100 smiley$ = head$ + down$ + left$ + grin$ + up$ + eye$ + left$ + eye$  110  120 REPEAT  130   MOVE RND(1280),RND(1000)  140   GCOL RND(7)  150   PRINT smiley$;  160   D% = INKEY(60)  170 UNTIL FALSE  180 END

Statistics: Posted by RichardRussell — Wed Apr 02, 2025 11:25 am



Viewing all articles
Browse latest Browse all 9297

Trending Articles