A quick note
I've had some feedback to say that the notation used is a little peculiar, and why don't I use
The notation used has been used in the RISC OS world for a long long time. It is very simple, I'll give you a crash course, with the most important things first...
0xF00D hF00D F00Dh $F00D (see later comment on the use of $) &F00Dare all identical, but using different ways to denote base 16.
We shall be using the
%1111000000001101 ( which equals &F00D )
my_integer% = 123 my_float = 456.78
<<is a left shift.
>>is a right shift.
>>>is an unsigned right shift.
MOV R0, value% << 4). Much more useful and sensible is the use of the barrel shifter (ASL, ASR, etc).
%00110010 shifted left once is %01100100 %01011000 shifted right twice is %00010110
block%!4 = 0 ; set word at block% + 4 to zero block%!8 = 12 ; set word at block% + 8 to 12
block%?0 = 17 ; set byte at block% + 0 to 17 block%?1 = 7 ; set byte at block% + 1 to 8 block%?2 = 0 ; set byte at block% + 2 to 0 block%?3 = 0 ; set byte at block% + 3 to 0 myvar% = !block% ; load word at block% into myvar%You can see, here, that
!block%is an alternative form of
block%!0; the result loaded into myvar% (an integer) being 1809. If you do not have BASIC to try this out on (no excuse though, with Brandy available), you can work out:
17 + (7 << 8) = 1809
my_string$ = "This is a string!"
Some further examples:
DIM mymemory% 32 ; allocate 32 bytes of memory userid% = 123 ; set the userid variable flags% = %10101011 ; ...the flags pointer% = &1DEADBED ; ...the pointer name$ = "Rick Murray" ; ...the name spare% = 0 ; ...and finally spare mymemory%?0 = userid% ; set the first byte to the value of userid mymemory%?1 = flags% ; ...next byte to flags mymemory%!2 = pointer% ; ...next word to pointer $(mymemory%+6) = LEFT$(name$, 22) ; ...next 22 bytes to name, with bounding mymemory%!26 = spare% ; and set the final word to spare FOR outer% = 0 TO 3 FOR inner% = 0 TO 7 PRINT RIGHT$("00"+STR$~(mymemory%?(inner% + (outer% * 8))))+" "; NEXT PRINT NEXT ENDThis is not a proper BASIC program as I've used ';' comments. Remove the comments or replace the ';' with ":REM".
7B AB ED DB EA 1D 52 69 63 6B 20 4D 75 72 72 61 79 0D 00 00 00 00 00 00 00 00 00 00 00 00 00 00Apart from saying to watch for the word order (1DEADBED becomes ED DB EA 1D - backwards), I'll leave the rest up to you.
execute do [this|that]This means your command is
executeand your first parameter is
do. Your second parameter can be
execute when [doing [something]|being [somebody|someplace]] [before|after]I'll leave you to figure out the permutations of that one...
This is not used in BASIC, but is used in the Programmer's Reference Manuals. They also use
angle brackets to denote a
<variable>, but I try to stay away from that when
writing web pages, for obvious reasons. :-)
FOR loop% = 0 TO 2 STEP 2loop; and also know to insert them if/when the example(s) omit the wrapper code for clarity and/or space.