?login_element?

Subversion Repositories NedoOS

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download

  1.     ; simple tests of each operator
  2.     DW  +0x1234, -0x1234
  3.     DW  ~0x1234
  4.     DW  !0x1234, not 0x1234
  5.     DW  low 0x1234, high 0x1234
  6.     DW  0x123 + 0x4560, 0x123 - 0x4560
  7.     DW  0x12 * 0x34, 0x3456 / 0x12
  8.     DW  0x3456 % 0x12, 0x3456 mod 0x12
  9.     DW  0x1234 << 3, 0x1234 shl 3
  10.     DW  -17768 >> 3, -17768 shr 3   ; -17768 = 0xFFFFBA98
  11.     DW  0xBA98 >> 3, 0xBA98 shr 3   ; expressions are calculated in 32b! 0xBA98 => positive
  12.     DW  -17768 >>> 3, 0xBA98 >>> 3  ; first is 0xFFFFBA98u>>3 (warning!)
  13.     DW  0x1234 & 0x5678, 0x5678 and 0x1234
  14.     DW  0x1234 ^ 0x5678, 0x5678 xor 0x1234
  15.     DW  0x1234 | 0x5678, 0x5678 or 0x1234
  16.     DW  0x1234 <? 0x5678, 0x5678 <? 0x1234
  17.     DW  0x1234 >? 0x5678, 0x5678 >? 0x1234
  18.     DB  0x1234 < 0x5678, 0x5678 < 0x1234, 0x1234 < 0x1234
  19.     DB  0x1234 > 0x5678, 0x5678 > 0x1234, 0x1234 > 0x1234
  20.     DB  0x1234 <= 0x5678, 0x5678 <= 0x1234, 0x1234 <= 0x1234
  21.     DB  0x1234 >= 0x5678, 0x5678 >= 0x1234, 0x1234 >= 0x1234
  22.     DB  0x1234 = 0x5678, 0x5678 = 0x1234, 0x1234 = 0x1234
  23.     DB  0x1234 == 0x5678, 0x5678 == 0x1234, 0x1234 == 0x1234
  24.     DB  0x1234 != 0x5678, 0x5678 != 0x1234, 0x1234 != 0x1234
  25.     DB  0x0012 && 0x3400, 0 && 0x3400, 0x0012 && 0, 0 && 0
  26.     DB  0x0012 || 0x3400, 0 || 0x3400, 0x0012 || 0, 0 || 0
  27.     DW  (2 * 3) + 4, 2 * (3 + 4)
  28.     DW  $
  29.  
  30.     ; shifts vs 32bit evaluator, more (tricky) tests:
  31.     DW  0xABCD1234 << 3, 0xABCD1234 shl 3
  32.     DW  -1164413356 >> 19, -1164413356 shr 19   ; -1164413356 = 0xBA987654
  33.     DW  0xBA987654 >> 19, 0xBA987654 shr 19
  34.     DW  -1164413356 >>> 19, 0xBA987654 >>> 19
  35.  
  36.     ; simple error states
  37.     DB ! : DB not : DB ~ : DB + : DB - : DB low : DB high
  38.     DB 4 * : DB 5 / : DB 6 % : DB 7 mod
  39.     DB 8 / 0 : DB 9 % 0 : DB 10 mod 0
  40.     DB 11 + : DB 12 -
  41.     DB 13 << : DB 14 shl : DB 15 >> : DB 16 shr : DB 17 >>>
  42.     DB 18 & : DB 19 and : DB 20 ^ : DB 21 xor : DB 22 | : DB 23 or
  43.     DB 24 <? : DB 25 >?
  44.     DB 26 < : DB 27 > : DB 28 <= : DB 29 >= : DB 30 = : DB 31 == : DB 32 !=
  45.     DB 33 && : DB 34 || : DB ( : DB )
  46.  
  47.     DEVICE NONE
  48.     ORG 0
  49.     DW  0x1234
  50.     DW  $$      ; error when not in device mode
  51.     DW  { 0 }
  52.     DW  {b 0 }
  53.     DEVICE ZXSPECTRUM48
  54.     ORG 0
  55.     DW  0x1234
  56.     DW  $$      ; should be OK
  57.     DW  { 0 }
  58.     DW  {b 0 }
  59.  
  60. not
  61.     ld  hl,?not     ; deprecated, use "@not" with full global name, or don't use keywords for label names at all
  62.