Flash Force Wiki Interactive browser →
Wiki / Protocols
#protocol#rcx#ir#reference

RCX opcode table

The full RCX command set sent over the RCX IR protocol (two-way IR via the tower). Source: *Kekoa Proudfoot, RCX Internals*** + opcodes (mralligator) — check exact argument bit-layouts there.

How opcodes work

Requests (PC ↔ RCX, act immediately)

OpcodeCommandArgs
0x10Alive / ping
0x12Get Valuesource, argument → short
0x13Set Motor Powermotors, source, power 0–7
0x16Set Motor Directioncode (bits: A/B/C, 0x40 flip, 0x80 fwd)
0x21Set Motor On/Offcode (bits: A/B/C, 0x40 off, 0x80 on)
0x23Play Tonefrequency (Hz, short), duration (1/100 s)
0x51Play Soundsound 0–5
0x14Set Variableindex 0–31, source, value
0x24Add to Variableindex, source, value
0x34Subtract from Variableindex, source, value
0x44Divide Variableindex, source, value
0x54Multiply Variableindex, source, value
0x63Or Variableindex, source, value
0x73And Variableindex, source, value
0x64Sign Variableindex, source, value
0x74Absolute Valueindex, source, value
0x32Set Sensor Typesensor 0–2, type 0–4
0x42Set Sensor Modesensor, mode / slope
0x26Clear Sensor Valuesensor
0x56Clear Timertimer
0x66Set Program Numberprogram 0–4
0x71Start Tasktask
0x76Stop Tasktask
0x50Stop All Tasks
0x61Delete Tasktask
0x40Delete All Tasks
0x36Delete Subroutinesubroutine
0x70Delete All Subroutines
0x25Start Task Downloadtask, length
0x35Start Subroutine Downloadsubroutine, length
0x45Transfer Dataindex, length, data[], checksum
0x75Start Firmware Downloadaddress, checksum
0x65Delete Firmwarekey[5]
0x52Set Datalog Size / Unlock Firmwaresize · or · key[5]
0x53Upload Datalogfirst, count
0x62Datalog Nextsource, argument
0x15Get Versionskey[5] → ROM + firmware
0x20Get Memory Map
0x30Get Battery Power→ millivolts
0x31Set Transmitter Rangerange (short / long)
0x22Set Timehours, minutes
0x33Set Displaysource, argument
0x46Set Power Down Delayminutes
0x60Power Off

Bytecode (inside a downloaded program; no reply)

OpcodeCommandArgs
0x43Waitsource, argument
0x17Call Subroutinesubroutine
0xf6Return from Subroutine
0x27Branch Always (near)offset
0x72Branch Always (far)offset (2-byte)
0x85Test and Branch (near)sources, args, offset
0x95Test and Branch (far)sources, args, offset
0x82Set Loop Countersource, argument
0x37Decrement Loop Counter (near)offset
0x92Decrement Loop Counter (far)offset
0x90Clear Message
0xf7Set Messagemessage byte (only request with no reply)
0xb2Send Messagesource, argument (broadcasts over IR)

See RCX IR protocol for messaging detail (Set Message vs Send Message).

Value sources (the source byte)

0 Variable · 1 Timer · 2 Immediate (constant) · 3 Motor state · 4 Random · 5–7 reserved · 8 Current program · 9 Sensor value · 10 Sensor type · 11 Sensor mode · 12 Raw sensor · 13 Boolean sensor · 14 Clock · 15 Message.

→ e.g. Send Message with source = 2 sends a constant; source = 0 sends a variable's value.