assembler: Some r15 fixes
[b43-tools.git] / assembler / test.asm
index b0e86d903188819ee087ac739751fbe2d89ce6eb..a228d45c5fcf606e26f0374bd82881657b61fef3 100644 (file)
@@ -1,14 +1,13 @@
 /* This is a bcm43xx microcode assembly example.
- *
- * In this example file, r0 and r1 are always input
- * registers and r2 is output.
- * For input we can always have constant values or (one) memory
- * operand instead of the input registers shown here.
  *
  * Registers:
- *     GPRs:                   r0 - r63
+ *     GPRs:                   r0 - r63        (General Purpose Register)
  *     Offset Registers:       off0 - off5
- *     SPRs:                   spr000
+ *     SPRs:                   spr000          (Special Purpose Register)
+ *
+ * SPRs map to the driver-side IHR registers.
+ * An SPR offset is converted to an IHR offset by the following
+ * calculation:  IHR = (SPR + 0x400) * 2
  *
  * To access memory, two methods can be used. Examples follow.
  * Direct linear:
 
 #define ECOND_MAC_ON   (0x20 | 4)
 
+%assert ((((1))) == ((((2 - 1) & 0xFF))))
+%assert ((1 == 2) || (1 == (0xFF & 1)))
+%assert (1 != (~1))
+%assert ((1 == (2 - 1)) && (2 == 2))
 
 .text
 
+       /* Inline assertion inside of a complex immediate.
+        * The %assert() expression will always return zero. */
+       mov     (1 + (%assert(1 == ((1 + 2) - 2)))), r0
+
 label:
        /* ADD instructions */
        add     r0,r1,r2        /* add */
@@ -169,6 +176,7 @@ function_b:
        mov     testlabel, r0           /* Can use label as immediate value */
        mov r0,r1;mov r2, r3            /* ; does split instructions */
        mov     [(1+1)],[(2+2),off0]    /* Can use complex immediates as memory offsets */
+       orx     (0 + 1), (1 * 2), 0, 0, r0 /* Allow complex immediates as M or S */
 
 
 /* The .initvals section generates an "Initial Values" file
@@ -185,6 +193,7 @@ function_b:
        radio   0x1234, 0xABC                   /* Write 0x1234 to RADIO register 0xABC */
        shm16   0x1234, 0x0001, 0x0002          /* Write 0x1234 to SHM routing 0x0001, register 0x0002 */
        shm32   0x12345678, 0x0001, 0x0002      /* Write 0x12345678 to SHM routing 0x0001, register 0x0002 */
+       tram    0x12345678, 0x1234              /* Write 0x12345678 to Template Ram offset 0x1234 */
 
 
 // vim: syntax=b43 ts=8