|
13 | 13 | ; 04-05 : 00 00 |
14 | 14 | ; 06 : Inchangé |
15 | 15 | .proc compute_all_offset_ORI2 |
| 16 | + .out .sprintf("|MODIFY:KERNEL_CREATE_PROCESS_PTR1:compute_all_offset_ORI2") |
| 17 | + .out .sprintf("|MODIFY:RESD:compute_all_offset_ORI2") |
| 18 | + .out .sprintf("|MODIFY:RESE:compute_all_offset_ORI2") |
| 19 | + .out .sprintf("|MODIFY:PTR_READ_DEST:compute_all_offset_ORI2") |
| 20 | + |
| 21 | + |
| 22 | + ; RESD contains header |
16 | 23 |
|
17 | 24 | ; Set the adress in the kernel struct |
18 | | - ldx kernel_process+kernel_process_struct::kernel_current_process |
19 | | - lda kernel_process+kernel_process_struct::kernel_one_process_struct_ptr_low,x |
| 25 | + ldx kernel_process + kernel_process_struct::kernel_current_process |
| 26 | + lda kernel_process + kernel_process_struct::kernel_one_process_struct_ptr_low,x |
20 | 27 | sta KERNEL_CREATE_PROCESS_PTR1 |
21 | | - lda kernel_process+kernel_process_struct::kernel_one_process_struct_ptr_high,x |
22 | | - sta KERNEL_CREATE_PROCESS_PTR1+1 |
| 28 | + lda kernel_process + kernel_process_struct::kernel_one_process_struct_ptr_high,x |
| 29 | + sta KERNEL_CREATE_PROCESS_PTR1 + 1 |
23 | 30 |
|
24 | 31 |
|
25 | 32 | ; Get execution address low |
|
44 | 51 | sta RESE |
45 | 52 |
|
46 | 53 |
|
47 | | - ldy #kernel_one_process_struct::kernel_process_addr+1 |
| 54 | + ldy #kernel_one_process_struct::kernel_process_addr + 1 |
48 | 55 |
|
49 | | - ldx RESD+1 |
| 56 | + ldx RESD + 1 |
50 | 57 | inx |
51 | 58 | txa |
52 | 59 | clc |
53 | 60 | adc RESE |
54 | 61 | sta (KERNEL_CREATE_PROCESS_PTR1),y |
55 | 62 |
|
56 | 63 |
|
57 | | - ldy RESD+1 ; the ptr of the address allocated |
| 64 | + ldy RESD + 1 ; the ptr of the address allocated |
58 | 65 | iny |
59 | 66 |
|
60 | | - sty ORI2_PROGRAM_ADRESS+1 ; addr $62: $0B |
61 | | - sty ORI2_MAP_ADRESS+1 ; Prepare adresse map but does not compute yet ; $0B |
62 | | - sty RESE+1 ; Set address execution ; 0B |
63 | | - sty PTR_READ_DEST+1 ; Set address to load the next part of the program |
64 | | - sty ORI2_PROGRAM_ADRESS+1 |
| 67 | + sty ORI2_PROGRAM_ADRESS + 1 ; addr $62: $0B |
| 68 | + sty ORI2_MAP_ADRESS + 1 ; Prepare adresse map but does not compute yet ; $0B |
| 69 | + sty RESE + 1 ; Set address execution ; 0B |
| 70 | + sty PTR_READ_DEST + 1 ; Set address to load the next part of the program |
| 71 | + sty ORI2_PROGRAM_ADRESS + 1 |
65 | 72 | ; |
66 | 73 |
|
67 | 74 | .IFPC02 |
|
70 | 77 | stz ORI2_MAP_ADRESS |
71 | 78 | stz RESE ; Set address execution |
72 | 79 | stz PTR_READ_DEST |
73 | | - stz ORI2_PAGE_LOAD ; Set to 0 for instance before compute |
| 80 | + stz ORI2_PAGE_LOAD ; Set to 0 for instance before compute |
74 | 81 | .p02 |
75 | 82 | .else |
76 | 83 | lda #$00 |
|
83 | 90 |
|
84 | 91 |
|
85 | 92 | ldy #15 ; High start adress |
86 | | - lda RESD+1 ; Align |
| 93 | + lda RESD + 1 ; Align |
87 | 94 | clc |
88 | 95 | adc #$01 |
89 | 96 | cmp (RESD),y |
|
101 | 108 |
|
102 | 109 | ldy #$08 |
103 | 110 | lda (RESD),y |
104 | | - sta ORI2_LENGTH_MAP+1 |
| 111 | + sta ORI2_LENGTH_MAP + 1 |
105 | 112 |
|
106 | 113 | ldy #12 |
107 | 114 | lda (RESD),y |
108 | 115 | clc |
109 | 116 | adc ORI2_MAP_ADRESS |
110 | 117 | bcc @S2 |
111 | | - inc ORI2_MAP_ADRESS+1 |
| 118 | + inc ORI2_MAP_ADRESS + 1 |
112 | 119 | @S2: |
113 | 120 | sta ORI2_MAP_ADRESS |
114 | 121 |
|
115 | 122 | ldy #13 |
116 | 123 | lda (RESD),y ; fixme 65c02 |
117 | 124 | clc |
118 | | - adc ORI2_MAP_ADRESS+1 |
119 | | - sta ORI2_MAP_ADRESS+1 |
| 125 | + adc ORI2_MAP_ADRESS + 1 |
| 126 | + sta ORI2_MAP_ADRESS + 1 |
120 | 127 |
|
121 | 128 |
|
122 | 129 | rts |
123 | 130 | .endproc |
124 | 131 |
|
125 | 132 |
|
126 | | -.proc relocate_ORI2 |
127 | | - |
128 | | - ; On suppose que A = page de chargement du programme (chargé en début de page) |
129 | | - ; On suppose également que z02-z05 ont été mis à jour par l'appelant (adresse et longueur de la bitmap) |
130 | | - lda ORI2_PAGE_LOAD ; offset à appliquer |
131 | | - beq rel_end |
132 | | - |
133 | | - ; Length map $47 |
134 | | - ldy #$00 ; Au cas ou on parte directement vers "reste" |
135 | | - lda ORI2_LENGTH_MAP+1 |
136 | | - |
137 | | - beq reste |
138 | | - |
139 | | -boucle: |
140 | | - lda (ORI2_MAP_ADRESS),y ; On prend un octet de la MAP |
141 | | - beq skip8 ; 0 -> On saute directement 8 octets du programme |
142 | | - |
143 | | - tax ; Sauvegarde ACC |
144 | | - tya ; Sauvegarde Y |
145 | | - pha |
146 | | - |
147 | | - ldy #$07 ; 8 Bits |
148 | | - txa ; Restaure ACC |
149 | | -reloc: |
150 | | - lsr a |
151 | | - bcc next |
152 | | - |
153 | | - tax ; Sauvegarde ACC |
154 | | - clc ; On ajuste l'adresse |
155 | | - lda (ORI2_PROGRAM_ADRESS),y |
156 | | - adc ORI2_PAGE_LOAD |
157 | | - sta (ORI2_PROGRAM_ADRESS),y |
158 | | - txa ; Restaure ACC |
159 | | -next: |
160 | | - dey |
161 | | - bpl reloc |
162 | | - pla ; Restaure Y |
163 | | - tay |
164 | | - ; |
165 | | - ; On saute 8 octets |
166 | | - ; |
167 | | -skip8: |
168 | | - clc ; On saute 8 octets du programme |
169 | | - lda ORI2_PROGRAM_ADRESS |
170 | | - adc #$08 |
171 | | - sta ORI2_PROGRAM_ADRESS |
172 | | - bcc *+4 |
173 | | - inc ORI2_PROGRAM_ADRESS+1 |
174 | | -suite: |
175 | | -; $1248 don't relocate |
176 | | -; $1268 |
177 | | - |
178 | | - |
179 | | - iny |
180 | | - bne *+6 |
181 | | - inc ORI2_MAP_ADRESS+1 ; Page suivante dans la MAP |
182 | | - dec ORI2_LENGTH_MAP+1 |
183 | | - bne boucle |
184 | | - |
185 | | - ; |
186 | | - ; On a traité toutes les pages entières |
187 | | - ; On traite les octets restants |
188 | | - ; |
189 | | - ; On arrive ici avec Y=0 |
190 | | - ; |
191 | | -reste: |
192 | | - lda ORI2_LENGTH_MAP |
193 | | - beq rel_end |
194 | | - |
195 | | -boucle2: |
196 | | - lda (ORI2_MAP_ADRESS),y ; On prend un octet de la MAP |
197 | | - beq skip82 ; 0 -> On saute directement 8 octets du programme |
198 | | - |
199 | | - tax ; Sauvegarde ACC |
200 | | - tya ; Sauvegarde Y |
201 | | - pha |
202 | | - |
203 | | - |
204 | | - ldy #$07 ; 8 Bits |
205 | | - txa ; Restaure ACC |
206 | | -reloc2: |
207 | | - lsr a |
208 | | - bcc next2 |
209 | | - |
210 | | - tax ; Sauvegarde ACC |
211 | | - clc ; On ajuste l'adresse |
212 | | - lda (ORI2_PROGRAM_ADRESS),y |
213 | | - adc ORI2_PAGE_LOAD |
214 | | - sta (ORI2_PROGRAM_ADRESS),y |
215 | | - txa ; Restaure ACC |
216 | | -next2: |
217 | | - dey |
218 | | - bpl reloc2 |
219 | | - pla ; Restaure Y |
220 | | - tay |
221 | | - ; |
222 | | - ; On saute 8 octets |
223 | | - ; |
224 | | -skip82: |
225 | | - clc ; On saute 8 octets du programme |
226 | | - lda ORI2_PROGRAM_ADRESS |
227 | | - adc #$08 |
228 | | - sta ORI2_PROGRAM_ADRESS |
229 | | - bcc *+4 |
230 | | - inc ORI2_PROGRAM_ADRESS+1 |
231 | | - |
232 | | -suite2: |
233 | | - iny |
234 | | - |
235 | | - dec ORI2_LENGTH_MAP |
236 | | - bne boucle2 |
237 | | - |
238 | | -rel_end: |
239 | | - inc ORI2_PAGE_LOAD ; On remet la page de chargement à sa valeur initiale |
240 | | - |
241 | | - |
242 | | - rts ; Pour utilisation éventuelle par une autre routine |
243 | | -.endproc |
244 | | - |
245 | | - |
0 commit comments