?login_element?

Subversion Repositories NedoOS

Rev

Rev 539 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;;;;;;; warning emitting test (for all affected instructions) ;;;;;;;;;;
  2.     OPT reset -Wrdlow       ; default syntax, enable rdlow warning
  3.     ; round parentheses memory access to low address 0..255 emits warning
  4.     ld  a,(1)
  5.     ld  hl,(2)
  6.     ld  bc,(3)
  7.     ld  de,(4)
  8.     ld  sp,(5)
  9.     ld  ix,(6)
  10.     ld  iy,(7)
  11.     ; addresses 256+ are of course OK by default
  12.     ld  a,(0x101)
  13.     ld  hl,(0x102)
  14.     ld  bc,(0x103)
  15.     ld  de,(0x104)
  16.     ld  sp,(0x105)
  17.     ld  ix,(0x106)
  18.     ld  iy,(0x107)
  19.     ; square brackets are without warning
  20.     ld  a,[1]
  21.     ld  hl,[2]
  22.     ld  bc,[3]
  23.     ld  de,[4]
  24.     ld  sp,[5]
  25.     ld  ix,[6]
  26.     ld  iy,[7]
  27.     ; immediates are also ok
  28.     ld  a,1
  29.     ld  hl,2
  30.     ld  bc,3
  31.     ld  de,4
  32.     ld  sp,5
  33.     ld  ix,6
  34.     ld  iy,7
  35.  
  36.     OPT reset --syntax=b    ; syntax "b" (round parentheses mark memory access only)
  37.                             ; should behave identically to default ("b" doesn't affect these)
  38.     ; round parentheses memory access to low address 0..255 emits warning
  39.     ld  a,(1)
  40.     ld  hl,(2)
  41.     ld  bc,(3)
  42.     ld  de,(4)
  43.     ld  sp,(5)
  44.     ld  ix,(6)
  45.     ld  iy,(7)
  46.     ; addresses 256+ are of course OK by default
  47.     ld  a,(0x101)
  48.     ld  hl,(0x102)
  49.     ld  bc,(0x103)
  50.     ld  de,(0x104)
  51.     ld  sp,(0x105)
  52.     ld  ix,(0x106)
  53.     ld  iy,(0x107)
  54.     ; square brackets are without warning
  55.     ld  a,[1]
  56.     ld  hl,[2]
  57.     ld  bc,[3]
  58.     ld  de,[4]
  59.     ld  sp,[5]
  60.     ld  ix,[6]
  61.     ld  iy,[7]
  62.     ; immediates are also ok
  63.     ld  a,1
  64.     ld  hl,2
  65.     ld  bc,3
  66.     ld  de,4
  67.     ld  sp,5
  68.     ld  ix,6
  69.     ld  iy,7
  70.  
  71.     OPT reset --syntax=B    ; syntax "B" (square brackets only for memory access)
  72.                             ; should turn round parentheses into immediates = no warning
  73.     ; immediates in round parentheses
  74.     ld  a,(1)
  75.     ld  hl,(2)
  76.     ld  bc,(3)
  77.     ld  de,(4)
  78.     ld  sp,(5)
  79.     ld  ix,(6)
  80.     ld  iy,(7)
  81.     ; still immediates
  82.     ld  a,(0x101)           ; correct warning about truncating value
  83.     ld  hl,(0x102)
  84.     ld  bc,(0x103)
  85.     ld  de,(0x104)
  86.     ld  sp,(0x105)
  87.     ld  ix,(0x106)
  88.     ld  iy,(0x107)
  89.     ; square brackets are without warning
  90.     ld  a,[1]
  91.     ld  hl,[2]
  92.     ld  bc,[3]
  93.     ld  de,[4]
  94.     ld  sp,[5]
  95.     ld  ix,[6]
  96.     ld  iy,[7]
  97.     ; immediates are also ok
  98.     ld  a,1
  99.     ld  hl,2
  100.     ld  bc,3
  101.     ld  de,4
  102.     ld  sp,5
  103.     ld  ix,6
  104.     ld  iy,7
  105.  
  106.  
  107. ;;;;;;; warning suppression mechanisms ;;;;;;;;;;
  108.     OPT reset --syntax=abfw
  109.     ; warning not suppressed or wrongly suppressed -> emit warning
  110.     ld  a,(1)
  111.     ld  a,(1)   ;
  112.     ld  a,(1)   ;      
  113.     ld  a,(1)   ;rdlow
  114.     ld  a,(1)   ;rdlow-
  115.     ld  a,(1)   ;rdlow-o
  116.     ld  a,(1)   ;rdlow-Ok
  117.     ld  a,(1)   ;rdlow-0k
  118.     ld  a,(1)   ;RDLOW-OK (big capitals don't work!)
  119.     ld  a,(1)   ;rdlow-oK
  120.     ld  a,(1)   ;RDLOW-ok
  121.     ld  a,(1)   ;Rdlow-ok
  122.     ld  a,(1)   ;rdlow-OK
  123.     ld  a,(1)   ;Rdlow-Ok
  124.  
  125.     ; warning suppressed correctly
  126.     ld  a,(1)   ;rdlow-ok
  127.     ld  a,(1)   ;;;;;;;;;;;rdlow-ok
  128.     ld  a,(1)   //rdlow-ok
  129.     ld  a,(1)   /////rdlow-ok
  130.  
  131.     ; with whitespace and letters ahead of suppressing text
  132.     ld  a,(1)   ;  blabla  rdlow-ok
  133.     ld  a,(1)   ;;;;;;;;;;;  blabla  rdlow-ok
  134.     ld  a,(1)   //  blabla  rdlow-ok
  135.     ld  a,(1)   /////  blabla  rdlow-ok
  136.  
  137.     ; following include TABs (mixed with spaces)! (make sure they stay there)
  138.     ld  a,(1)   ;               rdlow-ok
  139.     ld  a,(1)   ;;;;;;;;;;;             rdlow-ok
  140.     ld  a,(1)   //              rdlow-ok
  141.     ld  a,(1)   /////           rdlow-ok
  142.  
  143.     ld  a,(1)   ;rdlow-ok.
  144.     ld  a,(1)   ;rdlow-ok?
  145.     ld  a,(1)   ;rdlow-ok!
  146.     ld  a,(1)   ;rdlow-ok+
  147.     ld  a,(1)   ;rdlow-ok blabla
  148.  
  149.  
  150. ;;;;;;; test suppression for fake instructions ;;;;;;;;;;
  151.     OPT reset --syntax=abf
  152.     ldi a,(hl)  ; warning
  153.     ldi a,(hl)  ; this is "fake" instruction (warning suppressed by "fake")
  154.     ldi a,(hl)  ; iz fakeish instruztione (substring can be anywhere)
  155.     ; the "ok" way is removed since v1.19.0, use "fake"
  156.  
  157. ;;;;;;; docs-grade example ;;;;;;;;;;
  158.  
  159.     ld      a,(16|4)    ;warning when accidentally using parentheses around 0..255 value
  160.  
  161.     ld      a,(200)     ; rdlow-ok Intentionally accessing ROM data at address 200
  162.         ; the "rdlow-ok" in the end-of-line-comment does suppress the warning
  163.