?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1.     ORG $1000
  2.     RELOCATE_START
  3.     ASSERT 2 * relocate_count == relocate_size
  4.     ASSERT 17 == relocate_count
  5.     dw      relocate_count
  6.     dw      relocate_size
  7.  
  8.     STRUCT st1
  9. x       BYTE    $12
  10. y       WORD    absolute1
  11. relInit WORD    reloc1          ; the default init value should be relocated
  12. noRel   WORD    reloc2-reloc1
  13. badRel  WORD    2*reloc1        ; warning about not simple "+offset"
  14. badRel2 WORD    2*reloc1        ; reldiverts-ok ; suppressed warning
  15. warn1   BYTE    high reloc1     ; warning because unstable
  16. warn2   D24     reloc1          ; warning - D24 is not supported for relocation
  17. warn3   DWORD   reloc1          ; warning - D24 is not supported for relocation
  18. Swarn1  BYTE    high reloc1     ; relunstable-ok ; suppressed warning
  19. Swarn2  D24     reloc1          ; relunstable-ok ; suppressed warning
  20. Swarn3  DWORD   reloc1          ; relunstable-ok ; suppressed warning
  21.     ENDS
  22.  
  23. reloc1:
  24.  
  25.     ; instancing the struct in relocatable block
  26. .t1 st1     {}                  ; default "relInit" value is to be relocated
  27. .t2 st1     {,reloc1,absolute1} ; "y" to be relocated, "relInit" NOT (absolute value)
  28.     ; warning about non-word members
  29. .t3 st1     {high reloc1, $3412, $7856}
  30. .t4 st1     {high reloc1, $3412, $7856}     ; relunstable-ok ; suppressed warning
  31.     ; warning about unrelocatable value
  32. .t5 st1     {,, 2*reloc1}
  33. .t6 st1     {,, 2*reloc1}       ; reldiverts-ok ; suppressed warning
  34.  
  35.     ld      ix,reloc1.t1        ; to be relocated (address of instance)
  36.     ld      iy,.t2              ; to be relocated (address of instance)
  37.  
  38.     ; using the struct offsets - no relocation data needed (offsets are relative values)
  39.     ld      a,(ix+st1.x)
  40.     ld      a,(ix+st1.y)
  41.     ld      a,(ix+st1.relInit)
  42.     ld      a,(ix+st1.noRel)
  43.     ld      a,st1               ; struct length is absolute
  44.  
  45.     ; using struct addresses - to be relocated
  46.     ld      a,(reloc1.t1.x)
  47.     ld      hl,(reloc1.t1.y)
  48.     ld      de,(reloc1.t1.relInit)
  49.     ld      bc,(reloc1.t1.noRel)
  50.     ld      a,(.t2.x)
  51.     ld      hl,(.t2.y)
  52.     ld      de,(.t2.relInit)
  53.     ld      bc,(.t2.noRel)
  54.  
  55.     ; using absolute struct instance = to be ignored
  56.     ld      a,(absolute1.t1.x)
  57.     ld      hl,(absolute1.t1.y)
  58.     ld      de,(absolute1.t1.relInit)
  59.     ld      bc,(absolute1.t1.noRel)
  60.  
  61.     ; using alias instance placed at particular address
  62. akaT1   st1 = .t1               ; transitive relocation - to be relocated
  63.     ld      a,(akaT1.x)
  64.     ld      hl,(akaT1.y)
  65.     ld      de,(akaT1.relInit)
  66.     ld      bc,(akaT1.noRel)
  67.     ld      ix,akaT1
  68.  
  69.     ; same alias test, but with absolute instance = no relocation data
  70. akaA1   st1 = absolute1.t1
  71.     ld      a,(akaA1.x)
  72.     ld      hl,(akaA1.y)
  73.     ld      de,(akaA1.relInit)
  74.     ld      bc,(akaA1.noRel)
  75.     ld      ix,akaA1
  76.  
  77. reloc2:
  78.     RELOCATE_END
  79.  
  80.     ORG $2000
  81.     RELOCATE_TABLE
  82.  
  83. ; no relocation area (no warnings, no relocation data)
  84.     ORG $87DC
  85. absolute1:
  86.  
  87.     ; instancing the struct in absolute block - NOTHING to be relocated
  88. .t1 st1     {}
  89. .t2 st1     {,reloc1,absolute1}
  90.     ; no warning about unstable values or value being different
  91. .t3 st1     {high reloc1}
  92. .t5 st1     {,, 2*reloc1}
  93.  
  94.     ld      ix,reloc1.t1        ; not to be relocated even when using relocatable instance
  95.     ld      iy,absolute1.t2
  96.  
  97.     ; using the struct offsets - no relocation data needed (offsets are relative values)
  98.     ld      a,(ix+st1.x)
  99.     ld      a,(ix+st1.y)
  100.     ld      a,(ix+st1.relInit)
  101.     ld      a,(ix+st1.noRel)
  102.  
  103.     ; using struct addresses (relocatable ones and absolute ones - either should be NOT relocated)
  104.     ld      a,(reloc1.t1.x)
  105.     ld      hl,(reloc1.t1.y)
  106.     ld      de,(reloc1.t1.relInit)
  107.     ld      bc,(reloc1.t1.noRel)
  108.     ld      a,(absolute1.t2.x)
  109.     ld      hl,(absolute1.t2.y)
  110.     ld      de,(absolute1.t2.relInit)
  111.     ld      bc,(absolute1.t2.noRel)
  112.  
  113.     ; using relocatable alias (not outside of block = no relocation)
  114.     ld      a,(akaT1.x)
  115.     ld      hl,(akaT1.y)
  116.     ld      de,(akaT1.relInit)
  117.     ld      bc,(akaT1.noRel)
  118.     ld      ix,akaT1
  119.  
  120.     ASSERT 0 == __ERRORS__
  121.     ASSERT 6 == __WARNINGS__
  122.