Debian Codegraph @

test/align_mod_mac.asm

raw
1
2
3 .PROCESSOR 6502
4
5 .TRACE 1
6
7 .ifnconst FLASH_START
8 FLASH_START .EQU $F800
9 .endif
10
11 .ifnconst segmentModding
12 segmentModding .EQU 1
13 .endif
14
15 ;
16 ; the macro alignspace let you fill up memory until the next {block_size} boundary
17 ; one must give a unique {name}
18 ;
19 .mac alignspace ; {name},{block_size}
20 _alMod{1} .EQU ({2}-(. % {2}))
21 _alSpace{1} .DS _alMod{1},$ac
22 .endm
23
24 ;
25 ; the macro modspacer fills up memory with {char} until the next {block_size}
26 ; one must give a unique {name}
27 ;
28 .mac modspacer ; {name},{block_size},{char}
29 _mark{1}:
30 _delta{1} .EQU (_mark{1} - FLASH_START)
31 .IF (_delta{1} > 0)
32 _modulo{1} .EQU ({2}-(_delta{1} % {2}))
33
34 .IF ({3} > 0)
35 _modpos{1} .EQU (32-(. % 32))
36 .IF (_modpos{1} < 16)
37 .DS 32,{3}
38 .ENDIF
39 .ENDIF
40 _spacer{1} .DS _modulo{1},{3}
41 .ENDIF
42 .ENDM
43
44 ;
45 ; the macro codesegmarker fills up memory
46 ; the string {name} is padded with ' ' to length 16 and put at the beginning, the remaining is filled with 0xFF
47 ; one must give a unique {ID}
48 ;
49 ; this is useful if you want to speed-up flash programming with a larger code base and the need to incorporate small changes
50 ; because of the aligned segments a small code change may not introduce a complete shift of the following code and thus
51 ; avoid to re-program the following pages
52 ;
53 ; if the symbol 'segmentModding' == 0 the segment starts at address (FLASH_START + block_size)
54 ; if 'segmentModding' == 1 the segment starts at next 32 byte boundary address
55 ;
56 .mac codesegmarker ; {name},{uniqueID},{block_size}
57 .IF (segmentModding > 0)
58 modspacer {2}a,32,$ff
59 .ELSE
60 .ORG ({3} + FLASH_START)
61 .ENDIF
62 .DC {1}
63 modspacer {2}b,16,32
64 .ENDM
65
66
67 .ORG FLASH_START
68
69 alignspace Registers,$40
70
71 codesegmarker "serialFunc",5,$2a0
72
73 ; .INCLUDE<------>../common/serialFunc.asm
74 nop
75
76 codesegmarker "serialISR",6,$2e0
77
78 ; .INCLUDE<------>../common/serialISR.asm
79 nop
80 nop
81
82 codesegmarker "timerISR",7,$400
83
84 nop
85 ; .INCLUDE<------>../common/timerISR.asm
86
87
88
89
90
91
92
93
94 <-