?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download

  1.     DEVICE ZXSPECTRUM48
  2.     ORG $8000
  3.  
  4.     ; generally speaking, the `{<adr>}` operator is cancelling relocation
  5.     ; of <adr> expression and operates in absolute way with the assembling-time
  6.     ; address and memory content - seems this way it yields most logical outcomes
  7.  
  8.     RELOCATE_START
  9. label1: DW  0x1234
  10. label2: DW  label1              ; should be relocated
  11.  
  12.         IF 0x1234 == {label1}   ; should be true
  13.             ld  hl,label2       ; should be relocated
  14.         ENDIF
  15.         IF label1 == {label2}   ; should be true (relocation unstability doesn't matter)
  16.             ld  de,label1       ; should be relocated
  17.         ENDIF
  18.  
  19.         ld  hl,{label1}         ; regular 0x1234 value (reads the correct one always)
  20.  
  21.     ; ! this lost "needs relocation" property by indirection: be careful when using {adr}
  22.         ld  de,{label2}
  23.  
  24.     ; this should always evaluate to true (not affected by relocation juggling)
  25.         DB  0x1234 == {label1}
  26.  
  27.         DW  {label1} + label1           ; should be relocated (0x1234 + label1)
  28.         DB  low ({label1} + label1)     ; should warn (byte(0x1234 + label1) is affected)
  29.  
  30.     ; byte-reading variants use the same technique
  31.         DB  0x34 == {b label1}          ; should be true
  32.         DW  {b label1} + label1         ; should be relocated
  33.         DB  low ({b label1} + label1)   ; should warn
  34.  
  35.     RELOCATE_END
  36.  
  37.     RELOCATE_TABLE
  38.