Commit | Line | Data |
---|---|---|
6e917903 TW |
1 | * |
2 | * Various sections directives | |
3 | * .bss, .data, .sect, .text, .usect | |
4 | * .align, .space, .bes | |
5 | * | |
6 | ; default section (should be .text) | |
7 | .word 0x1234 ; this should be put in .text | |
8 | ||
9 | ; initialized data | |
10 | .data | |
11 | .global coeff | |
12 | coeff .word 011h,022h,033h | |
13 | ||
14 | ; uninitialized data | |
15 | .global B1, buffer | |
16 | .bss buffer, 10 | |
17 | B1: .usect ".bss", 10 ; alocate 10 words | |
18 | ||
19 | ; more initialized data in .data | |
20 | .global ptr | |
21 | ptr .word 0123h | |
22 | ||
23 | ; .text section | |
24 | .text | |
25 | .global add, aloop | |
26 | add: ld 0fh,a | |
27 | aloop: sub #1,a | |
28 | bc aloop,ageq | |
29 | ||
30 | ; more initialized data into .data | |
31 | .data | |
32 | .global ivals | |
33 | ivals .word 0aah, 0bbh, 0cch | |
34 | ||
35 | ; define another section for more variables | |
36 | .global var2, inbuf, align2 | |
37 | var2 .usect "newvars", 1 ; with quotes | |
38 | inbuf .usect newvars, 7, 1 ; w/o quotes, block 7 words | |
39 | align2 .usect newvars, 15, ,1 ; 15 words aligned | |
40 | ||
41 | ; more code | |
42 | .text | |
43 | .global mpy, mloop | |
44 | mpy: ld 0ah,b | |
45 | mloop: mpy #0ah,b | |
46 | bc mloop,bnov | |
47 | .global space, bes, spacep, besp | |
48 | space: .space 64 ; points to first word of block | |
49 | bes: .bes 64 ; points to last word of block | |
50 | spacep: .word space | |
51 | besp: .word bes | |
52 | .global pk1, pk2, pk3, endpk1, endpk2, endpk3 | |
53 | pk1: .space 20 | |
54 | endpk1: .space 12 | |
55 | pk2: .bes 20 | |
56 | endpk2 .bes 12 | |
57 | pk3: .space 20 | |
58 | endpk3: .bes 12 | |
59 | ; named initialized section (CODE) | |
60 | .sect "vectors" | |
61 | nop | |
62 | nop | |
63 | ||
64 | ; named, initialized section, no quotes (DATA) | |
65 | .sect clink | |
66 | .clink ; mark section clink as STYP_CLINK | |
67 | .word 022h, 044h | |
68 | ||
69 | .sect "blksect" ; (DATA) | |
70 | .word 0x1234,0x4321 | |
71 | .sblock "blksect", vectors ; set block flag on blksect and vectors | |
72 | ||
73 | .end |