Integers and Arithmatic Operations |
---|
Integers |
---|
The NESHLA compiler supports a number of different types of immediate integer declarations. The types are as follows:
Operator |
Description |
Examples |
---|---|---|
decimal | A normal number. | 123, 1234, 128, 255 |
kilo | The number preceding the "K" is multiplied by 1024. For example, 32K is 32768. | 1K, 2K, 4K, 32K |
hex (C style) | Hexadecimal numbers in the "0x" C style. | 0x0123, 0x1234, 0x80, 0xFF |
hex ($ style) | Hexadecimal numbers in the "$" ASM/Pascal style. | $0123, $1234, $80, $FF |
binary | Binary integers are preceded with a "%" character. | %10011010, %01001011 |
Arithmatic Operations |
---|
The arithmatic operators and keywords perform integer arithmatic operations. They can be used with addresses, variable addresses, and anywhere else an immediate integer can be placed. Multiple operators and keywords can be used together, and brackets can be used along them to define more specific operations.
Operators |
---|
Operator |
Description |
Example |
---|---|---|
+ | Add | A + B |
- | Subtract | A - B |
* | Multiply | A * B |
/ | Divide | A / B |
% | Modulo | A % B |
>> | Binary Shift Right | A >> B |
<< | Binary Shift Left | A << B |
^ | Binary Exclusive OR | A ^ B |
& | Binary AND | A & B |
| | Binary OR | A | B |
== | Boolean Equal To | A == B (results in 1 on true, 0 on false) |
!= | Boolean Not Equal To | A != B (results in 1 on true, 0 on false) |
>= | Boolean Greater Than or Equal To | A >= B (results in 1 on true, 0 on false) |
<= | Boolean Less Than or Equal To | A <= B (results in 1 on true, 0 on false) |
> | Boolean Greater Than | A > B (results in 1 on true, 0 on false) |
< | Boolean Less Than | A < B (results in 1 on true, 0 on false) |
! | Not | !A (results in 1 on true, 0 on false) |
~ | Binary Not | ~A (results in the inverted integer of A) |
Keywords |
---|
Operator |
Description |
Example |
---|---|---|
lo | Lo byte of word | lo(0x1234) (results in 0x34) |
hi | Hi byte of word | hi(0x1234) (results in 0x12) |
nylo | Lo nybble of byte | nylo(0x12) (results in 0x02) |
nyhi | Hi nybble of byte | nyhi(0x12) (results in 0x01) |
sizeof | Size of Variable | sizeof(word) (results in 2) |
Examples |
---|
|