Subversion Repositories NedoOS

Rev

Details | Last modification | View Log

Rev Author Line No. Line
1537 lvd 1
; test to verify transitions of "relocatable" while using the structs and relocation data generation
2
    RELOCATE_START HIGH ; definition must be in relocation block too to track default values being rel
3
        STRUCT RELSTRUCT
4
ByteRel     BYTE        high rel_label
5
ByteFix     BYTE        high fix_label
6
WordRelMsb  WORD        high rel_label
7
WordFixMsb  WORD        high fix_label
8
WordRel     WORD        rel_label
9
WordFix     WORD        fix_label
10
        ENDS
11
    RELOCATE_END
12
 
13
        ORG $8800
14
fix_label:
15
 
16
        ; these are outside of relocation block -> no relocation data in any case
17
s_1     RELSTRUCT { high fix_label, high rel_label, high fix_label, high rel_label, fix_label, rel_label }
18
s_2     RELSTRUCT
19
 
20
        DW      relocate_count, relocate_size
21
 
22
        RELOCATE_TABLE      ; provides relocation addresses pointing directly at the high byte
23
 
24
        RELOCATE_TABLE +1   ; provides relocation addresses pointing one byte ahead of the high byte
25
 
26
    RELOCATE_START HIGH
27
        ORG $1100
28
rel_label:
29
 
30
        ; check struct defined "at" address
31
s_at_rel    RELSTRUCT = rel_label + $1000
32
s_at_fix    RELSTRUCT = fix_label + $1000
33
            ; these should be relocated
34
            ld      hl,s_at_rel
35
            ld      hl,high s_at_rel
36
            ld      a,high s_at_rel
37
            ld      hl,s_at_rel.ByteFix
38
            ld      hl,high s_at_rel.ByteFix
39
            ld      a,high s_at_rel.ByteFix
40
            ; these are fixed
41
            ld      hl,s_at_fix
42
            ld      hl,high s_at_fix
43
            ld      a,high s_at_fix
44
            ld      hl,s_at_fix.ByteFix
45
            ld      hl,high s_at_fix.ByteFix
46
            ld      a,high s_at_fix.ByteFix
47
 
48
            ld      hl,RELSTRUCT.ByteFix
49
            ld      hl,high RELSTRUCT.ByteFix
50
            ld      a,high RELSTRUCT.ByteFix
51
 
52
        ; check struct with explicit init values (switching relocatable/fixed) - half of them requires relocation
53
s_init      RELSTRUCT { high fix_label, high rel_label, high fix_label, high rel_label, fix_label, rel_label }
54
 
55
        ; check struct filled with default values (half of them needs relocation)
56
s_default   RELSTRUCT
57
 
58
        ; this makes no sense? should be treated as norel label
59
s_at_bogus  RELSTRUCT = high rel_label
60
            ld      hl,s_at_bogus
61
            ld      hl,high s_at_bogus
62
            ld      a,high s_at_bogus
63
            ld      hl,s_at_bogus.ByteFix
64
            ld      hl,high s_at_bogus.ByteFix
65
            ld      a,high s_at_bogus.ByteFix
66
 
67
    RELOCATE_END