?login_element?

Subversion Repositories NedoOS

Rev

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

  1. ; since v1.19.0 it is possible to use temporary labels also in expressions,
  2. ; but it was not test-covered for relocation use cases, adding the test (and fix) now
  3.  
  4. ; first section is not part of relocation table
  5.     ORG $1000
  6. 2:
  7.  
  8.     ld      hl,2_B
  9.     ld      hl,2_F
  10.     ld      hl,3_F              ; not in relocation table, even with relocatable label
  11.  
  12. 2:
  13.  
  14. ; second section does test relocation
  15.  
  16.     RELOCATE_START
  17.  
  18.     ASSERT 2 * relocate_count == relocate_size
  19.     ASSERT 8 == relocate_count
  20.     dw      relocate_count
  21.     dw      relocate_size
  22.  
  23. 3:                              ; usage of this label should trigger relocation
  24.  
  25.     ORG $2000
  26.     ; no relocation cases
  27.     ld      hl,2_B
  28.     ld      hl,2_F
  29.     ld      hl,norel 3_B
  30.     ld      hl,norel 3_F
  31.     ld      hl,norel 3_B + 0x1234
  32.     ld      hl,norel 3_F + 0x1234
  33.     ld      hl,0x1234 + norel 3_B
  34.     ld      hl,0x1234 + norel 3_F
  35.     ld      hl,3_F - 3_B
  36.     jp      norel 3_B
  37.     jp      norel 3_F
  38.  
  39.     ORG $3000
  40.     ; relocation cases
  41.     ld      hl,3_B
  42.     ld      hl,3_F
  43.     ld      hl,3_B + 0x1234
  44.     ld      hl,3_F + 0x1234
  45.     ld      hl,0x1234 + 3_B
  46.     ld      hl,0x1234 + 3_F
  47.     jp      3_B
  48.     jp      3_F
  49.  
  50.     ORG $4000
  51.     ; unstable expressions
  52.     ld      hl,low 3_B
  53.     ld      hl,low 3_F
  54.     ld      hl,high 3_B
  55.     ld      hl,high 3_F
  56.     ld      hl,3*3_F - 3_B
  57.  
  58. 3:                              ; usage of this label should trigger relocation
  59.  
  60.     ; the relocation table must be after all temporary labels, as those don't manage
  61.     ; to settle down within 3 passes if there's dynamic-size table ahead, and "forward"
  62.     ; labels are referenced
  63.     RELOCATE_TABLE              ; should emit the 16 addresses of opcode data
  64.  
  65.     RELOCATE_END
  66.  
  67. 2:
  68.