RDBYTE rxHead, head
RDBYTE rxTail, tail
IF head >= tail THEN
bufcnt = head - tail
bufcnt = tail - head
This should be pretty obvious; we’re returning the
difference between the head and tail buffers. The buffer is
circular and the tail chases the head, so we use IF.. THEN
to prevent returning a negative value when the head
pointer has wrapped around past zero and is less than the
Most of us enjoy compilers because they make
writing programs faster and keep us from the nitty-gritty
details of assembly. Still, there are times when using
assembly is helpful. In PropBASIC, we can include inline
assembly using an ASM..ENDASM block, or one line at a
time using \. PropBASIC generates
very nice code so we won’t need to
use inline assembly often, but it’s
comforting to know that we can if
we choose to do so.
NEW! HIDmaker FS for Full Speed FLASH PIC18F4550
Creates complete PC and Peripheral
programs that talk to each other over
USB. Ready to compile and run!
• Large data Reports
• 64,000 bytes/sec per Interface
• Easily creates devices with multiple
Interfaces, even multiple Identities!
• Automatically does MULTITASKING
• Makes standard or special USB HID
NEW! “Developers Guide for USB HID
Peripherals” shows you how to make
devices for special requirements.
Both PC and Peripheral programs
understand your data items (even odd
sized ones), and give you convenient
variables to handle them.
PIC18F Compilers: PICBASIC Pro,
MPASM, C18, Hi-Tech C.
PIC16C Compilers: PICBASIC Pro,
MPASM, Hi-Tech C, CCS C.
PC Compilers: Delphi, C++ Builder,
Visual Basic 6.
HIDmaker FS Combo: Only $599.95
LET’S WRAP IT UP
I can’t cover every aspect of
PropBASIC in one issue, but I think
by now you have an idea of what it is
and how to get started with it. As
with its SX/B predecessor, PropBASIC
includes conditional compilation
directives, and the ability to include
external assembly and PropBASIC
files. It really does have a lot of
muscle for a first-generation product
— and you can’t beat the price ($0).
DOWNLOAD the HIDmaker FS Test Drive today!
THE FUTURE OF
In a word: exciting. For those of
us that use SX/B, we’ll tell you that it
started out with very humble
beginnings and grew into an
extremely nice tool. PropBASIC 1.0 is
light years ahead of SX/B 1.0 in terms
of capability and will just get better.
It’s natural that the language will
expand as we all spend more time
with it and offer suggestions to Bean,
and the migration to LMM will let us
create very large programs, yet still
running at the speed of assembly.
So, if you’ve been waiting for
BASIC to play with the Propeller,
your wait is over. No more excuses
because the compiler is free. Come
on, jump on — the ride will be fun. I
Until next time, have fun, and
keep spinning and winning with the
Propeller and PropBASIC. NV