Appendix IV: Reflex map file Disassembly.

The arc compile can provide a disassembly of a .map bytecode file for easier debugging of opcodes, and instructions. An example disassembly file is given below, with explanation.

Reflex file flasymyled.reflex

The reflex file that will be shown in the disassembly example.

#include <a40PinModule.reflex>
a40PinModule stem;

#define DELAY 500000
#define ON 1
#define OFF 0

pad[0:0] unsigned char state;

reflex mapEnable()
{
  state = ON;

  stem.system.setLED(state);
  stem.timer[0].setMode(1);
  stem.timer[0].setExpiration(DELAY);
}

reflex timer[0].expiration() {
    if (state == ON) {
        state = OFF;
    } else {
        state = ON;
    }

    stem.system.setLED(state);
}

reflex mapDisable() {
    stem.timer[0].setExpiration(0);
    stem.timer[0].setMode(0);
    stem.system.setLED(OFF);
}

Header Lines

The disassembly header provides information about the arc version.

Acroname Reflex Machine file
Version 1.0
--------------------------------------

Reflex and Routine Jump Table

The next section of the disassembly is the jump table within the bytecode for the entry points to each declared reflex and routine. The routine symbol is followed by the byte location of the entry instruction of the routine, or reflex.

3 Reflex Maps
mapEnable() -> 0x0000
timer[0].expiration(void) -> 0x0024
mapDisable() -> 0x004A
--------------------------------------

VM Instruction lines

Instruction lines are read left to right and then down on the right. The fields are: [byteOffset, VM operation, operation parameter, byte sequence]. The byte sequence is the raw bytecode represented vertically.

offset VMop param bytes
0x0002 pushls 0x0000
0x04
0x00
0x00

Disassembly (.dsm) of the flashmyled reflex.

Acroname Reflex Machine file
Version 1.0
--------------------------------------
3 Reflex Maps
mapEnable() -> 0x0000
timer[0].expiration(void) -> 0x0024
mapDisable() -> 0x004A
--------------------------------------
0x0000  pushlc      0x01          0x03
                                  0x01
0x0002  pushls      0x0000        0x04
                                  0x00
                                  0x00
0x0005  poppc                     0x3C
0x0006  pushls      0x0000        0x04
                                  0x00
                                  0x00
0x0009  pushpc                    0x39
0x000A  popec       0x038460      0x74
                                  0x03
                                  0x84
                                  0x60
0x000E  popn        0x01          0x02
                                  0x01
0x0010  pushlc      0x01          0x03
                                  0x01
0x0012  popec       0x4F8260      0x74
                                  0x4F
                                  0x82
                                  0x60
0x0016  popn        0x01          0x02
                                  0x01
0x0018  pushli      0x0007A120    0x05
                                  0x20
                                  0xA1
                                  0x07
                                  0x00
0x001D  popei       0x4F8160      0x76
                                  0x4F
                                  0x81
                                  0x60
0x0021  popn        0x01          0x02
                                  0x01
0x0023  exit                      0x01
0x0024  pushls      0x0000        0x04
                                  0x00
                                  0x00
0x0027  pushpc                    0x39
0x0028  pushlc      0x01          0x03
                                  0x01
0x002A  eqc                       0x54
0x002B  popn        0x01          0x02
                                  0x01
0x002D  brz         0x0039        0x12
                                  0x39
                                  0x00
0x0030  pushlc      0x00          0x03
                                  0x00
0x0032  pushls      0x0000        0x04
                                  0x00
                                  0x00
0x0035  poppc                     0x3C
0x0036  br          0x003F        0x11
                                  0x3F
                                  0x00
0x0039  pushlc      0x01          0x03
                                  0x01
0x003B  pushls      0x0000        0x04
                                  0x00
                                  0x00
0x003E  poppc                     0x3C
0x003F  pushls      0x0000        0x04
                                  0x00
                                  0x00
0x0042  pushpc                    0x39
0x0043  popec       0x038460      0x74
                                  0x03
                                  0x84
                                  0x60
0x0047  popn        0x01          0x02
                                  0x01
0x0049  exit                      0x01
0x004A  pushlc      0x00          0x03
                                  0x00
0x004C  convci                    0x1C
0x004D  popei       0x4F8160      0x76
                                  0x4F
                                  0x81
                                  0x60
0x0051  popn        0x01          0x02
                                  0x01
0x0053  pushlc      0x00          0x03
                                  0x00
0x0055  popec       0x4F8260      0x74
                                  0x4F
                                  0x82
                                  0x60
0x0059  popn        0x01          0x02
                                  0x01
0x005B  pushlc      0x00          0x03
                                  0x00
0x005D  popec       0x038460      0x74
                                  0x03
                                  0x84
                                  0x60
0x0061  popn        0x01          0x02
                                  0x01
0x0063  exit                      0x01