# ASL+

the latest iASL compiler (ver20141107) implements an extension support for symbolic (C-style) operations for math and logical expressions, so ASL code can be more humanity. ASL with these language extensions is called ASL+.

ASL+ compatible with legacy AML interpreters, no need new AML opcodes, compiler transforms expressions into legacy ASL/AML equivalents at compile time.

ASL+ Syntax Legacy ASL Equivalent // Math operators Z = X + Y Add (X, Y, Z) Z = X - Y Subtract (X, Y, Z) Z = X * Y Multiply (X, Y, Z) Z = X / Y Divide (X, Y, , Z) Z = X % Y Mod (X, Y, Z) Z = X << Y ShiftLeft (X, Y, Z) Z = X >> Y ShiftRight (X, Y, Z) Z = X & Y And (X, Y, Z) Z = X | Y Or (X, Y, Z) Z = X ^ Y Xor (X, Y, Z) Z = ~X Not (X, Z) X++ Increment (X) X-- Decrement (X) // Logical operators (X == Y) LEqual (X, Y) (X != Y) LNotEqual (X, Y) (X < Y) LLess (X, Y) (X > Y) LGreater (X, Y) (X <= Y) LLessEqual (X, Y) (X >= Y) LGreaterEqual (X, Y) (X && Y) LAnd (X, Y) (X || Y) LOr (X, Y) (!X) LNot (X) // Compound assignment operations X = Y Store (Y, X) X += Y Add (X, Y, X) X -= Y Subtract (X, Y, X) X *= Y Multiply (X, Y, X) X /= Y Divide (X, Y, , X) X %= Y Mod (X, Y, X) X <<= Y ShiftLeft (X, Y, X) X >>= Y ShiftRight (X, Y, X) X &= Y And (X, Y, X) X |= Y Or (X, Y, X) X ^= Y Xor (X, Y, X)

### Verify and Test

Let’s test this with coreboot acpi code:

*1. copy “coreboot\src\arch\x86\acpi\debug.asl” to a test folder

*2. create a test.asl in the same folder, content as below

```
DefinitionBlock (
"DSDT.AML",
"DSDT",
0x01,
"XXXXXX",
"XXXXXXXX",
0x00010001
)
{
#include "debug.asl"
}
```

*3. modify line 122
`add(Local0, 0x37, Local0)`

to
`Local0 += 0x37`

*4. compile with iASL ver20141107 and iASL ver20130927, check out the differences.

D:\test>iasl test.asl Intel ACPI Component Architecture ASL+ Optimizing Compiler version 20141107-32 [Nov 7 2014] Copyright (c) 2000 - 2014 Intel Corporation debug.asl 166: ethod(DBGO, 1) Remark 2120 - ^ Control Method should be made Serialized (due to cr eation of named objects within) ASL Input: test.asl - 13 lines, 1571 bytes, 59 keywords AML Output: DSDT.aml - 443 bytes, 16 named objects, 43 executable opcodes Compilation complete. 0 Errors, 0 Warnings, 1 Remarks, 10 Optimizations D:\test>iasl20130927 test.asl Intel ACPI Component Architecture ASL Optimizing Compiler version 20130927-32 [Sep 27 2013] Copyright (c) 2000 - 2013 Intel Corporation Compiler aborting due to parser-detected syntax error(s) debug.asl 123: Local0 += 0x37 Error 6126 - ^ syntax error, unexpected PARSEOP_LOCAL0 debug.asl 123: Local0 += 0x37 Error 6126 - ^ Invalid character (0x2B), expecting ASL keywor d or name debug.asl 123: Local0 += 0x37 Error 6126 - ^ Invalid character (0x3D), expecting ASL keywo rd or name ASL Input: test.asl - 12 lines, 1561 bytes, 57 keywords Compilation complete. 3 Errors, 0 Warnings, 0 Remarks, 0 Optimizations