Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download
# file opened: operators.asm
1 0000 ; simple tests of each operator
2 0000 34 12 CC ED DW +0x1234, -0x1234
3 0004 CB ED DW ~0x1234
4 0006 00 00 00 00 DW !0x1234, not 0x1234
5 000A 34 00 12 00 DW low 0x1234, high 0x1234
6 000E 83 46 C3 BB DW 0x123 + 0x4560, 0x123 - 0x4560
7 0012 A8 03 E8 02 DW 0x12 * 0x34, 0x3456 / 0x12
8 0016 06 00 06 00 DW 0x3456 % 0x12, 0x3456 mod 0x12
9 001A A0 91 A0 91 DW 0x1234 << 3, 0x1234 shl 3
10 001E 53 F7 53 F7 DW -17768 >> 3, -17768 shr 3 ; -17768 = 0xFFFFBA98
11 0022 53 17 53 17 DW 0xBA98 >> 3, 0xBA98 shr 3 ; expressions are calculated in 32b! 0xBA98 => positive
operators.asm(12): warning: value 0x1FFFF753 is truncated to 16bit value: 0xF753
12 0026 53 F7 53 17 DW -17768 >>> 3, 0xBA98 >>> 3 ; first is 0xFFFFBA98u>>3 (warning!)
13 002A 30 12 30 12 DW 0x1234 & 0x5678, 0x5678 and 0x1234
14 002E 4C 44 4C 44 DW 0x1234 ^ 0x5678, 0x5678 xor 0x1234
15 0032 7C 56 7C 56 DW 0x1234 | 0x5678, 0x5678 or 0x1234
16 0036 34 12 34 12 DW 0x1234 <? 0x5678, 0x5678 <? 0x1234
17 003A 78 56 78 56 DW 0x1234 >? 0x5678, 0x5678 >? 0x1234
18 003E FF 00 00 DB 0x1234 < 0x5678, 0x5678 < 0x1234, 0x1234 < 0x1234
19 0041 00 FF 00 DB 0x1234 > 0x5678, 0x5678 > 0x1234, 0x1234 > 0x1234
20 0044 FF 00 FF DB 0x1234 <= 0x5678, 0x5678 <= 0x1234, 0x1234 <= 0x1234
21 0047 00 FF FF DB 0x1234 >= 0x5678, 0x5678 >= 0x1234, 0x1234 >= 0x1234
22 004A 00 00 FF DB 0x1234 = 0x5678, 0x5678 = 0x1234, 0x1234 = 0x1234
23 004D 00 00 FF DB 0x1234 == 0x5678, 0x5678 == 0x1234, 0x1234 == 0x1234
24 0050 FF FF 00 DB 0x1234 != 0x5678, 0x5678 != 0x1234, 0x1234 != 0x1234
25 0053 FF 00 00 00 DB 0x0012 && 0x3400, 0 && 0x3400, 0x0012 && 0, 0 && 0
26 0057 FF FF FF 00 DB 0x0012 || 0x3400, 0 || 0x3400, 0x0012 || 0, 0 || 0
27 005B 0A 00 0E 00 DW (2 * 3) + 4, 2 * (3 + 4)
28 005F 5F 00 DW $
29 0061
30 0061 ; shifts vs 32bit evaluator, more (tricky) tests:
operators.asm(31): warning: value 0x5E6891A0 is truncated to 16bit value: 0x91A0
operators.asm(31): warning: value 0x5E6891A0 is truncated to 16bit value: 0x91A0
31 0061 A0 91 A0 91 DW 0xABCD1234 << 3, 0xABCD1234 shl 3
32 0065 53 F7 53 F7 DW -1164413356 >> 19, -1164413356 shr 19 ; -1164413356 = 0xBA987654
33 0069 53 F7 53 F7 DW 0xBA987654 >> 19, 0xBA987654 shr 19
34 006D 53 17 53 17 DW -1164413356 >>> 19, 0xBA987654 >>> 19
35 0071
36 0071 ; simple error states
operators.asm(37): error: Syntax error:
37 0071 DB !
operators.asm(37): error: Syntax error:
37 0071 DB not
operators.asm(37): error: Syntax error:
37 0071 DB ~
operators.asm(37): error: Syntax error:
37 0071 DB +
operators.asm(37): error: Syntax error:
37 0071 DB -
operators.asm(37): error: Syntax error:
37 0071 DB low
operators.asm(37): error: Syntax error:
37 0071 DB high
operators.asm(38): error: Syntax error:
38 0071 DB 4 *
operators.asm(38): error: Syntax error:
38 0071 DB 5 /
operators.asm(38): error: Syntax error:
38 0071 DB 6 %
operators.asm(38): error: Syntax error:
38 0071 DB 7 mod
operators.asm(39): error: Division by zero
39 0071 00 DB 8 / 0
operators.asm(39): error: Division by zero
39 0072 00 DB 9 % 0
operators.asm(39): error: Division by zero
39 0073 00 DB 10 mod 0
operators.asm(40): error: Syntax error:
40 0074 DB 11 +
operators.asm(40): error: Syntax error:
40 0074 DB 12 -
operators.asm(41): error: Syntax error:
41 0074 DB 13 <<
operators.asm(41): error: Syntax error:
41 0074 DB 14 shl
operators.asm(41): error: Syntax error:
41 0074 DB 15 >>
operators.asm(41): error: Syntax error:
41 0074 DB 16 shr
operators.asm(41): error: Syntax error:
41 0074 DB 17 >>>
operators.asm(42): error: Syntax error:
42 0074 DB 18 &
operators.asm(42): error: Syntax error:
42 0074 DB 19 and
operators.asm(42): error: Syntax error:
42 0074 DB 20 ^
operators.asm(42): error: Syntax error:
42 0074 DB 21 xor
operators.asm(42): error: Syntax error:
42 0074 DB 22 |
operators.asm(42): error: Syntax error:
42 0074 DB 23 or
operators.asm(43): error: Syntax error:
43 0074 DB 24 <?
operators.asm(43): error: Syntax error:
43 0074 DB 25 >?
operators.asm(44): error: Syntax error:
44 0074 DB 26 <
operators.asm(44): error: Syntax error:
44 0074 DB 27 >
operators.asm(44): error: Syntax error:
44 0074 DB 28 <=
operators.asm(44): error: Syntax error:
44 0074 DB 29 >=
operators.asm(44): error: Syntax error:
44 0074 DB 30 =
operators.asm(44): error: Syntax error:
44 0074 DB 31 ==
operators.asm(44): error: Syntax error:
44 0074 DB 32 !=
operators.asm(45): error: Syntax error:
45 0074 DB 33 &&
operators.asm(45): error: Syntax error:
45 0074 DB 34 ||
operators.asm(45): error: ')' expected
operators.asm(45): error: Syntax error:
45 0074 DB (
operators.asm(45): error: Syntax error: )
45 0074 DB )
46 0074
47 0074 DEVICE NONE
48 0074 ORG 0
49 0000 34 12 DW 0x1234
operators.asm(50): error: Unexpected: $
50 0002 02 00 DW $$ ; error when not in device mode
operators.asm(51): error: [DW/DEFW/WORD] Syntax error: { 0 }
51 0004 DW { 0 }
operators.asm(52): error: [DW/DEFW/WORD] Syntax error: {b 0 }
52 0004 DW {b 0 }
53 0004 DEVICE ZXSPECTRUM48
54 0004 ORG 0
55 0000 34 12 DW 0x1234
56 0002 00 00 DW $$ ; should be OK
57 0004 34 12 DW { 0 }
58 0006 34 00 DW {b 0 }
59 0008
60 0008 not
operators.asm(61): warning: ?<symbol> operator is deprecated and will be removed in v2.x: ?not
61 0008 21 08 00 ld hl,?not ; deprecated, use "@not" with full global name, or don't use keywords for label names at all
62 000B
# file closed: operators.asm
Value Label
------ - -----------------------------------------------------------
0x0008 not