BitScope Command Set

Editors note:

This page was assembled from bits of the http://www.bitscope.com site for the purposes of highlighting the brilliance of the design. Another (less brilliant) language that uses this sort of syntax called meta-l is being developed.

The command set for the BitScope Virtual machine is a subset of the bytes values between 0 and 255. Initially, active commands are confined to the ASCII range from 0 to 128. Where ever possible, command values correspond to a character with a meaning related to the command function. This makes the byte-codes human readable - with some practice.

The general scheme for allocating byte-code values and their ASCII symbol is as follows:
numerals used for entering data
operators manipulation of register values
lower case general machine operation
upper case major machine functions
non-printables reserved for future commands

Unused bytecodes will be echoed if printable, else ignored.

Hex ASCII Name Description
00 (null) Reset Reset the machine. Print the machine ID string
23 # Load Source Register Store R0 into R2. Set up R2 which is a source Register. A Register to Register move may be done by pointing to a source (R2) and destination (R1).
2b + Inc REG Increment the register pointed to by R1
2d - Dec REG Decrement the register pointed to by R1
30 0 Enter nibble 0 Increment R0 by 0 and nibble swap R0
31 1 Enter nibble 1 Increment R0 by 1 and nibble swap R0
32 2 Enter nibble 2 Increment R0 by 2 and nibble swap R0
33 3 Enter nibble 3 Increment R0 by 3 and nibble swap R0
34 4 Enter nibble 4 Increment R0 by 4 and nibble swap R0
35 5 Enter nibble 5 Increment R0 by 5 and nibble swap R0
36 6 Enter nibble 6 Increment R0 by 6 and nibble swap R0
37 7 Enter nibble 7 Increment R0 by 7 and nibble swap R0
38 8 Enter nibble 8 Increment R0 by 8 and nibble swap R0
39 9 Enter nibble 9 Increment R0 by 9 and nibble swap R0
3c < Get counter value from Spock Shift the current 16 bit counter value from Spock into R9, R10
3e > Program Spock from Registers Load 5 bytes of data from R3..R7 into Spock. Previous contents of counter are destroyed
3f ? Print Machine ID Print <CR>Char8..CHAR1<CR> where CHARn is part of a string which identifies the type and revision of this device.
40 @ Load Address Register Store R0 into R1. Use to set up register pointer
53 S Dump Sample RAM (CSV) Dump lines of 16 Sample Ram values - digital and analog.
<CR>
ddaa,ddaa,ddaa,.....................ddaa,ddaa<CR>
ddaa,ddaa,ddaa,.....................ddaa,ddaa<CR>
54 T Trace with TRIG stop Begin Sample with OPTION mode, until TRIG then DELAY, Halt Sample Clk, and print Sample Address.
5b [ Clear R0 Register R0 is cleared. This usually precedes a nibble load
5d ] Nibble swap R0 R0:(0..3) is swapped with R0:(4..7). This operation follows a nibble entry and puts the entered nibbles in the correct order.
61 a Enter nibble ‘a’ hex Increment R0 by 10 and nibble swap R0
62 b Enter nibble ‘b’ hex Increment R0 by 11 and nibble swap R0
63 c Enter nibble ‘c’ hex Increment R0 by 12 and nibble swap R0
64 d Enter nibble ‘d’ hex Increment R0 by 13 and nibble swap R0
65 e Enter nibble ‘e’ hex Increment R0 by 14 and nibble swap R0
66 f Enter nibble ‘f’ hex Increment R0 by 15 and nibble swap R0
6c l Load R0 from @R2 Copy contents of register pointed to by R2 to R0
6e n Next Address Increment address register R1
70 p Print REG value @R1 Print <CR>ASCII,ASCII<CR>
73 s Store R0 to @R1 Copy contents of R0 to register pointed to by R1
75 u Update RAM pointers Copy contents of R3,4 to R9,10. Updates Sample Address value from Sample Preload registers.
78 x Exchange byte with POD Transmit byte in POD_TX to POD IO-0. Wait for reply byte on IO-1 and put it in POD_RX then return it to Host
7c | Pass Through byte to POD Transmit byte in POD_TX to POD IO-0. Connect IO-1 to Serial Out for Host.

Examples:
[6]@[5a]s loading R6 with 0x5a is:
[3]@ enter 3 into R0, then copy it to R1
[]s enter 0 into R0, then store it at (R1)
ns increment R1 to 4, then store R0 at (R1)
[aa]ns enter aa in R0, inc R1, then store R0 at (R1)
[f]ns enter f in R0, inc R1, then store R0 at (R1)
[]ns enter 0 in Ro, inc R1, then store R0 at (R1)
[12]@[70]s| set up R1, then ‘p’
4d the response will be piped through
[54]s| send the POD a ‘T’
506f the response will be piped through
> we are back talking to BitScope

The BitScope virtual machine has a set of 20 Registers R0..R19. The operation of the machine and all its instructions refer to these registers. All other resources in the PIC are outside the scope of the virtual machine. The function of all registers are detailed below. In some cases related commands are shown as examples of how these registers are used.
 
Rn Register Description Example of Register Use
R0 Byte Input Register assemble input data here [  clear R0 
0..f  inc R0 by 0..f , nibble swap 
]  nibble swap R0
R1 Register Pointer - pointer to R(0..ff) @  copy R0 to R1
s  move contents of R0 to R(R1)  - s(tore) 
R2 Register Source - pointer to R(0..ff) #  copy R0 to R2 
l   move contents of R(R2) to R0 - l(oad)
R3 Sample Preload L low byte of RAM addr to load to Spock  
R4 Sample Preload H high byte of RAM addr to load to Spock  
R5 TRIG Logic Byte - Logic levels for Spock to match  - loaded during  Spock Init
R6 TRIG Mask Byte - Don?t Care bits in trigger match  - loaded during  Spock Init
R7 Spock OPTION byte TRIG and PG1  - setup in Spock
R8 Trace Register Trace Option controls Sample operation of BitScope Machine R8(0..3)  - 4 bit vector to different 
Trigger and Chop modes. 

R8(4..7)  - 4 bit pointer to select one of the Data bus  MUX device channels

R9 Counter capture Lo Counter low byte shifted out of Spock  
R10 Counter capture Hi Counter high byte shifted out of Spock  
R11 DELAY-L    Post TRIG delay before halting  
R12 DELAY-H    Post TRIG delay before halting  
R13 TimeBase    TimeBase expander count  
R14 Channel-A/B  Channel Range settings for Chop  - H/L nibbles contain alternate values for RA(0..3)
R15 Dump Length - Counter for number of Samples transmitted per request  
R16 EEPROM Data  data register for EEPROM  
R17 EEPROM Address address register for EEPROM  
R18 POD Transmit  Register holds byte for POD  
R19 POD Receive  Register gets byte from POD