Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download
# file opened: operators.asm1 0000 ; simple tests of each operator2 0000 34 12 CC ED DW +0x1234, -0x12343 0004 CB ED DW ~0x12344 0006 00 00 00 00 DW !0x1234, not 0x12345 000A 34 00 12 00 DW low 0x1234, high 0x12346 000E 83 46 C3 BB DW 0x123 + 0x4560, 0x123 - 0x45607 0012 A8 03 E8 02 DW 0x12 * 0x34, 0x3456 / 0x128 0016 06 00 06 00 DW 0x3456 % 0x12, 0x3456 mod 0x129 001A A0 91 A0 91 DW 0x1234 << 3, 0x1234 shl 310 001E 53 F7 53 F7 DW -17768 >> 3, -17768 shr 3 ; -17768 = 0xFFFFBA9811 0022 53 17 53 17 DW 0xBA98 >> 3, 0xBA98 shr 3 ; expressions are calculated in 32b! 0xBA98 => positiveoperators.asm(12): warning: value 0x1FFFF753 is truncated to 16bit value: 0xF75312 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 0x123414 002E 4C 44 4C 44 DW 0x1234 ^ 0x5678, 0x5678 xor 0x123415 0032 7C 56 7C 56 DW 0x1234 | 0x5678, 0x5678 or 0x123416 0036 34 12 34 12 DW 0x1234 <? 0x5678, 0x5678 <? 0x123417 003A 78 56 78 56 DW 0x1234 >? 0x5678, 0x5678 >? 0x123418 003E FF 00 00 DB 0x1234 < 0x5678, 0x5678 < 0x1234, 0x1234 < 0x123419 0041 00 FF 00 DB 0x1234 > 0x5678, 0x5678 > 0x1234, 0x1234 > 0x123420 0044 FF 00 FF DB 0x1234 <= 0x5678, 0x5678 <= 0x1234, 0x1234 <= 0x123421 0047 00 FF FF DB 0x1234 >= 0x5678, 0x5678 >= 0x1234, 0x1234 >= 0x123422 004A 00 00 FF DB 0x1234 = 0x5678, 0x5678 = 0x1234, 0x1234 = 0x123423 004D 00 00 FF DB 0x1234 == 0x5678, 0x5678 == 0x1234, 0x1234 == 0x123424 0050 FF FF 00 DB 0x1234 != 0x5678, 0x5678 != 0x1234, 0x1234 != 0x123425 0053 FF 00 00 00 DB 0x0012 && 0x3400, 0 && 0x3400, 0x0012 && 0, 0 && 026 0057 FF FF FF 00 DB 0x0012 || 0x3400, 0 || 0x3400, 0x0012 || 0, 0 || 027 005B 0A 00 0E 00 DW (2 * 3) + 4, 2 * (3 + 4)28 005F 5F 00 DW $29 006130 0061 ; shifts vs 32bit evaluator, more (tricky) tests:operators.asm(31): warning: value 0x5E6891A0 is truncated to 16bit value: 0x91A0operators.asm(31): warning: value 0x5E6891A0 is truncated to 16bit value: 0x91A031 0061 A0 91 A0 91 DW 0xABCD1234 << 3, 0xABCD1234 shl 332 0065 53 F7 53 F7 DW -1164413356 >> 19, -1164413356 shr 19 ; -1164413356 = 0xBA98765433 0069 53 F7 53 F7 DW 0xBA987654 >> 19, 0xBA987654 shr 1934 006D 53 17 53 17 DW -1164413356 >>> 19, 0xBA987654 >>> 1935 007136 0071 ; simple error statesoperators.asm(37): error: Syntax error:37 0071 DB !operators.asm(37): error: Syntax error:37 0071 DB notoperators.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 lowoperators.asm(37): error: Syntax error:37 0071 DB highoperators.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 modoperators.asm(39): error: Division by zero39 0071 00 DB 8 / 0operators.asm(39): error: Division by zero39 0072 00 DB 9 % 0operators.asm(39): error: Division by zero39 0073 00 DB 10 mod 0operators.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 shloperators.asm(41): error: Syntax error:41 0074 DB 15 >>operators.asm(41): error: Syntax error:41 0074 DB 16 shroperators.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 andoperators.asm(42): error: Syntax error:42 0074 DB 20 ^operators.asm(42): error: Syntax error:42 0074 DB 21 xoroperators.asm(42): error: Syntax error:42 0074 DB 22 |operators.asm(42): error: Syntax error:42 0074 DB 23 oroperators.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: ')' expectedoperators.asm(45): error: Syntax error:45 0074 DB (operators.asm(45): error: Syntax error: )45 0074 DB )46 007447 0074 DEVICE NONE48 0074 ORG 049 0000 34 12 DW 0x1234operators.asm(50): error: Unexpected: $50 0002 02 00 DW $$ ; error when not in device modeoperators.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 ZXSPECTRUM4854 0004 ORG 055 0000 34 12 DW 0x123456 0002 00 00 DW $$ ; should be OK57 0004 34 12 DW { 0 }58 0006 34 00 DW {b 0 }59 000860 0008 notoperators.asm(61): warning: ?<symbol> operator is deprecated and will be removed in v2.x: ?not61 0008 21 08 00 ld hl,?not ; deprecated, use "@not" with full global name, or don't use keywords for label names at all62 000B# file closed: operators.asmValue Label------ - -----------------------------------------------------------0x0008 not