?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download

  1.     ; docs example:
  2. ptr = $4000
  3.     WHILE ptr < $4020
  4.         DB low ptr
  5. ptr = ptr + 1
  6.     EDUP
  7.  
  8.     ; other tests
  9.     DEVICE ZXSPECTRUMNEXT : ORG $8000
  10. searchMem:
  11.     DB  0, 0, 0, 0
  12. needle:
  13.     DB  1
  14.     DB  0, 0, 0, 0
  15. searchMemEnd:
  16.  
  17. ptr = searchMem
  18.     WHILE (ptr < searchMemEnd) && ({b ptr} == 0)    ; search for "1" in memory
  19.         ; ^ keep in mind {b ..} reads as zero until last pass
  20. ptr = ptr + 1
  21.     ENDW
  22.     ASSERT needle == ptr
  23.  
  24.     WHILE needle <= ptr + 3     ; nested whiles
  25.         WHILE needle <= ptr + 1
  26. ptr = ptr - 1
  27.         ENDW
  28. ptr = ptr - 1
  29.     ENDW
  30.     ASSERT needle == ptr + 4
  31.  
  32.     ; syntax errors/warnings
  33.     WHILE
  34.     ENDW
  35.  
  36.     WHILE @
  37.         nop
  38.     ENDW
  39.  
  40.     WHILE fwdLabel < $8000
  41.         ASSERT 0
  42.     ENDW
  43.  
  44. fwdLabel:
  45.  
  46.     ; test the infinite-loop guardian (default 100k)
  47. cnt = 0
  48.     OPT push listmc
  49.     WHILE cnt <= 100000
  50. cnt = cnt + 1
  51.     ENDW
  52.     OPT pop
  53.  
  54.     ; test custom-explicit infinite-loop guardian
  55. cnt = 0
  56.     WHILE cnt < 2, 2   ; looping twice with guardian "2" => without error
  57. cnt = cnt + 1
  58.     ENDW
  59.  
  60. cnt = 0
  61.     WHILE cnt < 4, 2   ; looping trice with guardian "2" => error
  62. cnt = cnt + 1
  63.     ENDW
  64.  
  65. cnt = 0
  66.     WHILE cnt < 2, @   ; syntax error in guardian-couner value
  67. cnt = cnt + 1
  68.     ENDW
  69.