1 | #asm |
---|
2 | (main)test.asm |
---|
3 | |
---|
4 | _DKDRV EQU $6049 |
---|
5 | _DKOPC EQU $6048 |
---|
6 | _DKTRK EQU $604B |
---|
7 | _DKVAL EQU $6052 |
---|
8 | _DKSEC EQU $604C |
---|
9 | _DKERR EQU $604E |
---|
10 | |
---|
11 | ORG $8000 | debut de l'impementation en 9000 |
---|
12 | ORCC #$50 | Gel des interruptions |
---|
13 | |
---|
14 | TFR S,Y | store old S |
---|
15 | STY $62FE |
---|
16 | |
---|
17 | LDA #$60 | Fixe le |
---|
18 | TFR A,DP | DP a $60 |
---|
19 | LDS #$6600-_GLOBALS | share 6300-6400 for stack and globals |
---|
20 | TFR S,Y | Y is GLOBAL pointer |
---|
21 | |
---|
22 | CLR $6019 | Plus dinterruptions |
---|
23 | CLRB |
---|
24 | STB _DKDRV | drive 0 |
---|
25 | |
---|
26 | LDX #$6300 |
---|
27 | STX $604F | sector buffer |
---|
28 | #endasm |
---|
29 | |
---|
30 | |
---|
31 | |
---|
32 | /* le main doit être en premier */ |
---|
33 | |
---|
34 | int |
---|
35 | main() { |
---|
36 | int ii,i,j,k; |
---|
37 | |
---|
38 | char *longname; |
---|
39 | int longOff; |
---|
40 | int longIdx; |
---|
41 | |
---|
42 | int nfic; |
---|
43 | int dirEnd; |
---|
44 | |
---|
45 | int t; |
---|
46 | int piste; |
---|
47 | |
---|
48 | char *p; |
---|
49 | char *buf; |
---|
50 | char *buf2; /* big dir buffer in A000 enough for 127 entries */ |
---|
51 | |
---|
52 | int ret; |
---|
53 | char c; |
---|
54 | char s2; |
---|
55 | int cfgnum; |
---|
56 | |
---|
57 | /* LBA, MBR and all (V)FAT stuff */ |
---|
58 | unsigned int lbaBeg_h; |
---|
59 | unsigned int lbaBeg_l; |
---|
60 | unsigned int f_clusz; |
---|
61 | unsigned int f_shift; |
---|
62 | unsigned int f_res; |
---|
63 | |
---|
64 | unsigned int f_nbfat; |
---|
65 | |
---|
66 | unsigned int f_fatsh; |
---|
67 | unsigned int f_fatsl; |
---|
68 | |
---|
69 | unsigned int f_rooth; |
---|
70 | unsigned int f_rootl; |
---|
71 | |
---|
72 | unsigned int f_firsth; |
---|
73 | unsigned int f_firstl; |
---|
74 | |
---|
75 | unsigned int f_tmph; |
---|
76 | unsigned int f_tmpl; |
---|
77 | |
---|
78 | unsigned int f_cfgh; |
---|
79 | unsigned int f_cfgl; |
---|
80 | |
---|
81 | int page,select,maxpage; |
---|
82 | |
---|
83 | border(0); |
---|
84 | |
---|
85 | cls(); |
---|
86 | |
---|
87 | cfgnum=-1; |
---|
88 | |
---|
89 | i=0x6300;buf=i; |
---|
90 | i=0xA000;buf2=i; |
---|
91 | i=(0xAFFF-17);longname=i; |
---|
92 | |
---|
93 | |
---|
94 | i=0x604E;p=i;*p=0; /* clear error */ |
---|
95 | ret=go_trk255(); |
---|
96 | border(1); |
---|
97 | /* dump16b(1,16,ret); */ |
---|
98 | border(2); |
---|
99 | ret=rd_lba(0,0); |
---|
100 | lbaBeg_l=mk_16(buf[446+9],buf[446+8]); |
---|
101 | lbaBeg_h=mk_16(buf[446+11],buf[446+10]); |
---|
102 | |
---|
103 | /* |
---|
104 | dump16b(0,17,lbaBeg_h); |
---|
105 | dump16b(4,17,lbaBeg_l); |
---|
106 | */ |
---|
107 | rd_lba(lbaBeg_h,lbaBeg_l); |
---|
108 | |
---|
109 | /* get all fat stuf */ |
---|
110 | f_clusz=buf[0x0D]; |
---|
111 | f_shift=siz2shif(f_clusz); |
---|
112 | f_res=mk_16(buf[0x0F],buf[0x0E]); |
---|
113 | f_nbfat=buf[0x10]; |
---|
114 | f_fatsl=mk_16(buf[0x25],buf[0x24]); |
---|
115 | f_fatsh=mk_16(buf[0x27],buf[0x26]); |
---|
116 | f_rootl=mk_16(buf[0x2D],buf[0x2C]); |
---|
117 | f_rooth=mk_16(buf[0x2F],buf[0x2E]); |
---|
118 | |
---|
119 | /* |
---|
120 | dump16b(0,18,f_rooth); |
---|
121 | dump16b(4,18,f_rootl); |
---|
122 | */ |
---|
123 | |
---|
124 | /* (unsigned long)cluster_begin_lba = Partition_LBA_Begin + Number_of_Reserved_Sectors + (Number_of_FATs * Sectors_Per_FAT); */ |
---|
125 | add_32(lbaBeg_h,lbaBeg_l,0,f_res,&f_firsth,&f_firstl); |
---|
126 | |
---|
127 | for (i=0;i<f_nbfat;i++) { |
---|
128 | add_32(f_firsth,f_firstl,f_fatsh,f_fatsl,&f_firsth,&f_firstl); |
---|
129 | } |
---|
130 | /* |
---|
131 | dump16b(0,19,f_firsth); |
---|
132 | dump16b(4,19,f_firstl); |
---|
133 | */ |
---|
134 | |
---|
135 | /* address = lba_start+((clust-2)*size) */ |
---|
136 | sub_32(f_rooth,f_rootl,0,2,&f_tmph,&f_tmpl); /* clu-2 */ |
---|
137 | clu2lba(f_tmph,f_tmpl,f_shift,&f_tmph,&f_tmpl); /* *size */ |
---|
138 | add_32(f_firsth,f_firstl,f_tmph,f_tmpl,&f_tmph,&f_tmpl); /* + lba_start */ |
---|
139 | |
---|
140 | /* |
---|
141 | dump16b(0,20,f_tmph); |
---|
142 | dump16b(4,20,f_tmpl); |
---|
143 | |
---|
144 | dump16b(10,18,f_clusz); |
---|
145 | dump16b(14,18,f_shift); |
---|
146 | */ |
---|
147 | |
---|
148 | |
---|
149 | |
---|
150 | nfic=0; |
---|
151 | longname[0]='\0'; |
---|
152 | longname[13]='\0'; |
---|
153 | |
---|
154 | border(3); |
---|
155 | |
---|
156 | dirEnd=0; |
---|
157 | |
---|
158 | for (ii=0;ii<f_clusz;ii++) { |
---|
159 | if (dirEnd==1) { |
---|
160 | break; |
---|
161 | } |
---|
162 | /* read the directory sector */ |
---|
163 | rd_lba(f_tmph,f_tmpl); |
---|
164 | |
---|
165 | for (i=0;i<16;i++) { |
---|
166 | if ((buf[i<<5]&0xFF)==0x00) { |
---|
167 | dirEnd=1; |
---|
168 | break; |
---|
169 | } |
---|
170 | if ((buf[(i<<5)+11]&0x0F)==0x0F) { |
---|
171 | longIdx=buf[i<<5]&0xF; |
---|
172 | longOff=(longIdx-1)*13; |
---|
173 | for (j=0;j<5;j++) { |
---|
174 | if (longOff+j<17) { |
---|
175 | k=(i<<5)+(j<<1)+1; |
---|
176 | longname[longOff+j]=buf[k]; |
---|
177 | } |
---|
178 | } |
---|
179 | for (j=0;j<6;j++) { |
---|
180 | if (longOff+j+5<17) { |
---|
181 | k=(i<<5)+(j<<1)+0xE; |
---|
182 | longname[longOff+j+5]=buf[k]; |
---|
183 | } |
---|
184 | } |
---|
185 | for (j=0;j<2;j++) { |
---|
186 | if (longOff+j+11<17) { |
---|
187 | k=(i<<5)+(j<<1)+0x1C; |
---|
188 | longname[longOff+j+11]=buf[k]; |
---|
189 | } |
---|
190 | } |
---|
191 | continue; /* skip long filenames */ |
---|
192 | } |
---|
193 | |
---|
194 | if ((buf[i<<5]&0xFF)!=0xE5) { |
---|
195 | for (j=0;j<8;j++) { |
---|
196 | buf2[(nfic<<5)+j]=buf[(i<<5)+j]; |
---|
197 | } |
---|
198 | for (j=0;j<3;j++) { |
---|
199 | buf2[(nfic<<5)+j+8]=buf[(i<<5)+j+8]; |
---|
200 | } |
---|
201 | for (j=0;j<17;j++) { |
---|
202 | buf2[(nfic<<5)+11+j]=longname[j]; |
---|
203 | } |
---|
204 | longname[0]='\0'; |
---|
205 | longname[13]='\0'; |
---|
206 | |
---|
207 | /* also copy first cluster */ |
---|
208 | buf2[(nfic<<5)+31]=buf[(i<<5)+0x1A]; |
---|
209 | buf2[(nfic<<5)+30]=buf[(i<<5)+0x1B]; |
---|
210 | buf2[(nfic<<5)+29]=buf[(i<<5)+0x14]; |
---|
211 | buf2[(nfic<<5)+28]=buf[(i<<5)+0x15]; |
---|
212 | nfic++; |
---|
213 | if (nfic>126) { |
---|
214 | dirEnd=1; |
---|
215 | break; |
---|
216 | } |
---|
217 | } else { |
---|
218 | longname[0]='\0'; |
---|
219 | longname[13]='\0'; |
---|
220 | } |
---|
221 | } |
---|
222 | add_32(f_tmph,f_tmpl,0x0000,0x0001,&f_tmph,&f_tmpl); /* increment LBA */ |
---|
223 | |
---|
224 | } |
---|
225 | |
---|
226 | border(0); |
---|
227 | |
---|
228 | banner(); |
---|
229 | for (i=0;i<nfic;i++) { |
---|
230 | if (find83("HXCSDFE CFG",&buf2[i<<5])==0) { |
---|
231 | string(0,22,"Found cfg:",10); |
---|
232 | dump16b(11,22,i); |
---|
233 | cfgnum=i; |
---|
234 | f_cfgh=mk_16(buf2[(cfgnum<<5)+28],buf2[(cfgnum<<5)+29]); |
---|
235 | f_cfgl=mk_16(buf2[(cfgnum<<5)+30],buf2[(cfgnum<<5)+31]); |
---|
236 | break; |
---|
237 | } |
---|
238 | } |
---|
239 | |
---|
240 | |
---|
241 | select=0; |
---|
242 | page=0; |
---|
243 | maxpage=((nfic-1)>>4); |
---|
244 | fic_list(select,page,nfic); |
---|
245 | hi_line(select+4,0xC7); |
---|
246 | |
---|
247 | irq(); |
---|
248 | while (1) { |
---|
249 | i=getc(); |
---|
250 | dump16b(0,24,i); |
---|
251 | if ((i==0x08) && (page>0)) { |
---|
252 | page--; |
---|
253 | hi_line(select+4,0xF8); |
---|
254 | select=0; |
---|
255 | fic_list(select,page,nfic); |
---|
256 | hi_line(select+4,0xC7); |
---|
257 | } |
---|
258 | if ((i==0x09) && (page<maxpage)) { |
---|
259 | page++; |
---|
260 | hi_line(select+4,0xF8); |
---|
261 | select=0; |
---|
262 | fic_list(select,page,nfic); |
---|
263 | hi_line(select+4,0xC7); |
---|
264 | } |
---|
265 | if ((i==0x0B) && (select>0)) { |
---|
266 | hi_line(select+4,0xF8); |
---|
267 | select--; |
---|
268 | hi_line(select+4,0xC7); |
---|
269 | } |
---|
270 | else |
---|
271 | if ((i==0x0B) && (page>0)) { |
---|
272 | page--; |
---|
273 | hi_line(select+4,0xF8); |
---|
274 | select=15; |
---|
275 | fic_list(select,page,nfic); |
---|
276 | hi_line(select+4,0xC7); |
---|
277 | } |
---|
278 | |
---|
279 | if ((i==0x0A) && (select<15)) { |
---|
280 | hi_line(select+4,0xF8); |
---|
281 | if ((page<<4)+select+1<nfic) { |
---|
282 | select++; |
---|
283 | } |
---|
284 | hi_line(select+4,0xC7); |
---|
285 | } |
---|
286 | else |
---|
287 | if ((i==0x0A) && (page<maxpage)) { |
---|
288 | page++; |
---|
289 | hi_line(select+4,0xF8); |
---|
290 | select=0; |
---|
291 | fic_list(select,page,nfic); |
---|
292 | hi_line(select+4,0xC7); |
---|
293 | } |
---|
294 | if (i==0x0D) { |
---|
295 | |
---|
296 | if (cfgnum==-1) { |
---|
297 | cls(); |
---|
298 | string(0,2,"Sorry, no HXCSDFE.CFG found. read only..",40); |
---|
299 | k=getc(); |
---|
300 | cls(); |
---|
301 | banner(); |
---|
302 | fic_list(select,page,nfic); |
---|
303 | |
---|
304 | continue; |
---|
305 | } |
---|
306 | if (f_clusz<2) { |
---|
307 | cls(); |
---|
308 | string(0,2,"Sorry, cluster size 1 is unsupported..",38); |
---|
309 | k=getc(); |
---|
310 | cls(); |
---|
311 | banner(); |
---|
312 | fic_list(select,page,nfic); |
---|
313 | |
---|
314 | continue; |
---|
315 | } |
---|
316 | cls(); |
---|
317 | string(0,2,"Confirm loading of file ? (y/n)",31); |
---|
318 | |
---|
319 | j=(page<<4)+select; |
---|
320 | string(1,4,&buf2[j<<5],8); |
---|
321 | charxy(8,4,'.'); |
---|
322 | string(10,4,&buf2[(j<<5)+8],3); |
---|
323 | string(14,4,&buf2[(j<<5)+11],17); |
---|
324 | |
---|
325 | k=getc(); |
---|
326 | if ((k==0x79) || (k==0x59)) { |
---|
327 | /* go */ |
---|
328 | /* read config first sector */ |
---|
329 | /* address = lba_start+((clust-2)*size) */ |
---|
330 | sub_32(f_cfgh,f_cfgl,0,2,&f_tmph,&f_tmpl); /* clu-2 */ |
---|
331 | clu2lba(f_tmph,f_tmpl,f_shift,&f_tmph,&f_tmpl); /* *size */ |
---|
332 | add_32(f_firsth,f_firstl,f_tmph,f_tmpl,&f_tmph,&f_tmpl); /* + lba_start */ |
---|
333 | |
---|
334 | rd_lba(f_tmph,f_tmpl); |
---|
335 | string(0,5,"CFG SECTOR0",11); |
---|
336 | buf[22]=0x02; |
---|
337 | buf[23]=0x01; |
---|
338 | |
---|
339 | ret=wt_sec(1); |
---|
340 | |
---|
341 | |
---|
342 | string(0,5,&buf[0],32); |
---|
343 | add_32(f_tmph,f_tmpl,0x0000,0x0001,&f_tmph,&f_tmpl); /* increment LBA */ |
---|
344 | |
---|
345 | string(0,6,"CFG SECTOR1",11); |
---|
346 | rd_lba(f_tmph,f_tmpl); |
---|
347 | string(0,7,&buf[0],11);string(12,7,&buf[21],16); |
---|
348 | |
---|
349 | for (ii=0;ii<11;ii++) { |
---|
350 | buf[ii]=buf2[(j<<5)+ii]; |
---|
351 | } |
---|
352 | buf[11]='\0'; |
---|
353 | buf[12]='\0'; |
---|
354 | buf[13]=buf2[(j<<5)+31]; |
---|
355 | buf[14]=buf2[(j<<5)+30]; |
---|
356 | buf[15]=buf2[(j<<5)+29]; |
---|
357 | buf[16]=buf2[(j<<5)+28]; |
---|
358 | |
---|
359 | /* fixed size for HFE thomson */ |
---|
360 | buf[17]=0x00; |
---|
361 | buf[18]=0xA4; |
---|
362 | buf[19]=0x1E; |
---|
363 | buf[20]=0x00; |
---|
364 | for (ii=0;ii<16;ii++) { |
---|
365 | buf[21+ii]=buf2[(j<<5)+ii+11]; |
---|
366 | } |
---|
367 | buf[37]='\0'; |
---|
368 | for (ii=38;ii<0x40;ii++) { |
---|
369 | buf[ii]='\0'; |
---|
370 | } |
---|
371 | |
---|
372 | /* just write back sector (LBA is still correct) */ |
---|
373 | ret=wt_sec(1); |
---|
374 | dump16b(0,24,ret); |
---|
375 | string(0,8,"WRT SECTOR1",11); |
---|
376 | string(0,9,&buf[0],11);string(12,9,&buf[21],16); |
---|
377 | |
---|
378 | /* just write back sector (LBA is still correct) */ |
---|
379 | ret=rd_sec(1); |
---|
380 | dump16b(0,24,ret); |
---|
381 | string(0,10,"READ BACK SECTOR1",17); |
---|
382 | string(0,11,&buf[0],11);string(12,11,&buf[21],16); |
---|
383 | |
---|
384 | |
---|
385 | add_32(f_tmph,f_tmpl,0x0000,0x0001,&f_tmph,&f_tmpl); /* increment LBA */ |
---|
386 | rd_lba(f_tmph,f_tmpl); |
---|
387 | |
---|
388 | for (ii=0;ii<11;ii++) { |
---|
389 | buf[ii+0x80]=buf2[(j<<5)+ii]; |
---|
390 | } |
---|
391 | buf[11+0x80]='\0'; |
---|
392 | buf[12+0x80]='\0'; |
---|
393 | buf[13+0x80]=buf2[(j<<5)+31]; |
---|
394 | buf[14+0x80]=buf2[(j<<5)+30]; |
---|
395 | buf[15+0x80]=buf2[(j<<5)+29]; |
---|
396 | buf[16+0x80]=buf2[(j<<5)+28]; |
---|
397 | |
---|
398 | /* fixed size for HFE thomson */ |
---|
399 | buf[17+0x80]=0x00; |
---|
400 | buf[18+0x80]=0xA4; |
---|
401 | buf[19+0x80]=0x1E; |
---|
402 | buf[20+0x80]=0x00; |
---|
403 | for (ii=0;ii<16;ii++) { |
---|
404 | buf[21+ii+0x80]=buf2[(j<<5)+ii+11]; |
---|
405 | } |
---|
406 | buf[37+0x80]='\0'; |
---|
407 | for (ii=38;ii<0x40;ii++) { |
---|
408 | buf[ii]='\0'; |
---|
409 | } |
---|
410 | |
---|
411 | /* just write back sector (LBA is still correct) */ |
---|
412 | ret=wt_sec(1); |
---|
413 | dump16b(0,24,ret); |
---|
414 | |
---|
415 | string(0,13,"Press a key...",14); |
---|
416 | |
---|
417 | k=getc(); |
---|
418 | |
---|
419 | |
---|
420 | /* leave LBA (need 3 times) */ |
---|
421 | go_track(0); |
---|
422 | go_track(0); |
---|
423 | go_track(0); |
---|
424 | |
---|
425 | string(0,14,"... REBOOT ...",10); |
---|
426 | /* and reset */ |
---|
427 | { |
---|
428 | #asm |
---|
429 | TFR S,Y |
---|
430 | STY $62FC |
---|
431 | LDY $62FE |
---|
432 | TFR Y,S |
---|
433 | |
---|
434 | JMP [$FFFE] |
---|
435 | #endasm |
---|
436 | } |
---|
437 | |
---|
438 | } |
---|
439 | cls(); |
---|
440 | banner(); |
---|
441 | fic_list(select,page,nfic); |
---|
442 | |
---|
443 | } |
---|
444 | |
---|
445 | } |
---|
446 | return 0; |
---|
447 | } |
---|
448 | cls() |
---|
449 | { |
---|
450 | set_col(); |
---|
451 | fill(0xF8); |
---|
452 | set_pt(); |
---|
453 | fill(0x00); |
---|
454 | return 0; |
---|
455 | } |
---|
456 | banner() |
---|
457 | { |
---|
458 | string(0,0,"HxC TO8 File selector by VitalMotion",38); |
---|
459 | string(0,2,"Select your File:\0",17); |
---|
460 | return 0; |
---|
461 | } |
---|
462 | |
---|
463 | fic_list(select,page,nfic) |
---|
464 | int select; |
---|
465 | int page; |
---|
466 | int nfic; |
---|
467 | { |
---|
468 | int i,j; |
---|
469 | int start; |
---|
470 | int line; |
---|
471 | char *buf2; |
---|
472 | |
---|
473 | i=0xA000;buf2=i; |
---|
474 | |
---|
475 | start=(page<<4); |
---|
476 | |
---|
477 | line=0; |
---|
478 | for (i=start;i<(start+16);i++) { |
---|
479 | if (i>=nfic) { |
---|
480 | string(1,line+4," ",39); |
---|
481 | line++; |
---|
482 | continue; |
---|
483 | } |
---|
484 | |
---|
485 | string(1,line+4,&buf2[i<<5],8); |
---|
486 | charxy(9,line+4,'.'); |
---|
487 | string(10,line+4,&buf2[(i<<5)+8],3); |
---|
488 | |
---|
489 | string(14,line+4,&buf2[(i<<5)+11],17); |
---|
490 | |
---|
491 | dump16b(32,line+4,mk_16(buf2[(i<<5)+28],buf2[(i<<5)+29])); |
---|
492 | dump16b(36,line+4,mk_16(buf2[(i<<5)+30],buf2[(i<<5)+31])); |
---|
493 | line++; |
---|
494 | } |
---|
495 | return 0; |
---|
496 | } |
---|
497 | /* |
---|
498 | cfg is |
---|
499 | * |
---|
500 | |
---|
501 | |
---|
502 | struct ShortDirectoryEntry { |
---|
503 | unsigned char name[12]; |
---|
504 | unsigned char attributes; |
---|
505 | unsigned long firstCluster; |
---|
506 | unsigned long size; |
---|
507 | unsigned char longName[17]; // boolean |
---|
508 | }; |
---|
509 | |
---|
510 | extern struct DirectoryEntry directoryEntry; |
---|
511 | |
---|
512 | |
---|
513 | typedef struct disk_in_drive_ |
---|
514 | { |
---|
515 | struct ShortDirectoryEntry DirEnt; |
---|
516 | unsigned char numberoftrack; |
---|
517 | unsigned char numberofside; |
---|
518 | unsigned short rpm; |
---|
519 | unsigned short bitrate; |
---|
520 | unsigned short tracklistoffset; |
---|
521 | }disk_in_drive; |
---|
522 | |
---|
523 | at 0x100 (in first LBA sector) |
---|
524 | * |
---|
525 | */ |
---|
526 | string(x,y,s,sz) |
---|
527 | int x; |
---|
528 | int y; |
---|
529 | char *s; |
---|
530 | int sz; |
---|
531 | { |
---|
532 | int i; |
---|
533 | int ii; |
---|
534 | for (i=0;i<sz;i++) { |
---|
535 | if (s[i]=='\0') { |
---|
536 | for (ii=i;ii<sz;ii++) { |
---|
537 | charxy(x,y,' '); |
---|
538 | x++; |
---|
539 | } |
---|
540 | break; |
---|
541 | } |
---|
542 | charxy(x,y,s[i]); |
---|
543 | x++; |
---|
544 | } |
---|
545 | return 0; |
---|
546 | } |
---|
547 | |
---|
548 | |
---|
549 | find83(s1,s2) |
---|
550 | char *s1; |
---|
551 | char *s2; |
---|
552 | { |
---|
553 | int i; |
---|
554 | int ret; |
---|
555 | ret=0; |
---|
556 | for (i=0;i<11;i++) { |
---|
557 | if (s1[i]!=s2[i]) { |
---|
558 | ret=1; |
---|
559 | break; |
---|
560 | } |
---|
561 | } |
---|
562 | return ret; |
---|
563 | } |
---|
564 | |
---|
565 | char hexchar(c) |
---|
566 | char c; |
---|
567 | { |
---|
568 | if (c<10) { return '0'+c; } |
---|
569 | return 'A'+c-10; |
---|
570 | } |
---|
571 | |
---|
572 | dump16b(x,y,v) |
---|
573 | int x; |
---|
574 | int y; |
---|
575 | unsigned int v; |
---|
576 | { |
---|
577 | unsigned int ii,jj; |
---|
578 | jj=(v&0xF000)>>12; |
---|
579 | ii=hexchar(jj); |
---|
580 | charxy(x,y,ii); |
---|
581 | jj=(v&0xF00)>>8; |
---|
582 | ii=hexchar(jj); |
---|
583 | charxy(x+1,y,ii); |
---|
584 | jj=(v&0xF0)>>4; |
---|
585 | ii=hexchar(jj); |
---|
586 | charxy(x+2,y,ii); |
---|
587 | jj=v&0xF; |
---|
588 | ii=hexchar(jj); |
---|
589 | charxy(x+3,y,ii); |
---|
590 | return 0; |
---|
591 | } |
---|
592 | |
---|
593 | go_trk255() |
---|
594 | { |
---|
595 | { |
---|
596 | #asm |
---|
597 | LDA #$01 | reset lecteur |
---|
598 | STA _DKOPC |
---|
599 | JSR $E004 |
---|
600 | LDA #$20 | rech piste 0 |
---|
601 | STA _DKOPC |
---|
602 | JSR $E004 |
---|
603 | CLR _DKVAL |
---|
604 | LDA #$02 | read a sector to start motor |
---|
605 | STA _DKTRK |
---|
606 | LDA #$01 | read a sector to start motor |
---|
607 | STB _DKSEC |
---|
608 | LDA #$02 |
---|
609 | STA _DKOPC |
---|
610 | LDA #127 | goto 127 |
---|
611 | STA _DKTRK |
---|
612 | LDA #$40 |
---|
613 | STA _DKOPC |
---|
614 | JSR $E004 |
---|
615 | CLR _DKVAL |
---|
616 | LDA #127 | 127 more... |
---|
617 | STA _DKTRK |
---|
618 | LDA #$40 |
---|
619 | STA _DKOPC |
---|
620 | JSR $E004 |
---|
621 | CLR _DKVAL |
---|
622 | LDA #1 | 1 more... |
---|
623 | STA _DKTRK |
---|
624 | LDA #$40 |
---|
625 | STA _DKOPC |
---|
626 | JSR $E004 |
---|
627 | LDA #$FF |
---|
628 | STA _DKVAL | make monitor think we are in track 255 |
---|
629 | STA _DKTRK |
---|
630 | LDA #$00 |
---|
631 | LDB _DKERR |
---|
632 | TFR D,X | return in X |
---|
633 | #endasm |
---|
634 | } |
---|
635 | return 0; |
---|
636 | } |
---|
637 | |
---|
638 | go_track(track) |
---|
639 | char track; |
---|
640 | { |
---|
641 | { |
---|
642 | #asm |
---|
643 | LDA #$20 | rech piste 0 |
---|
644 | STA _DKOPC |
---|
645 | JSR $E004 |
---|
646 | CLR _DKVAL |
---|
647 | LDB 5,U |
---|
648 | STB _DKTRK |
---|
649 | LDA #$40 |
---|
650 | STA _DKOPC |
---|
651 | JSR $E004 |
---|
652 | LDA #$00 |
---|
653 | LDB _DKERR |
---|
654 | TFR D,X | return in X |
---|
655 | #endasm |
---|
656 | } |
---|
657 | } |
---|
658 | |
---|
659 | rd_lba(high,low) |
---|
660 | unsigned int high,low; |
---|
661 | { |
---|
662 | int i; |
---|
663 | char *p; |
---|
664 | |
---|
665 | for (i=0x6300;i<0x6500;i++) { |
---|
666 | p=i; |
---|
667 | *p=0x00; |
---|
668 | } |
---|
669 | i=0x6300;p=i; |
---|
670 | p[0]='H'; |
---|
671 | p[1]='x'; |
---|
672 | p[2]='C'; |
---|
673 | p[3]='F'; |
---|
674 | p[4]='E'; |
---|
675 | p[5]='D'; |
---|
676 | p[6]='A'; |
---|
677 | p[7]=0; |
---|
678 | |
---|
679 | p[8]=0x01; |
---|
680 | p[9]=(low & 0xFF); |
---|
681 | p[10]=((low >> 8) & 0xFF); |
---|
682 | p[11]=(high & 0xFF); |
---|
683 | p[12]=((high >> 8) & 0xFF); |
---|
684 | p[13]=0xA5; |
---|
685 | p[14]=0x08; |
---|
686 | |
---|
687 | /* init fields with a read */ |
---|
688 | wt_sec(0); |
---|
689 | i=rd_sec(1); |
---|
690 | return i; |
---|
691 | } |
---|
692 | |
---|
693 | mk_16(c1,c2) |
---|
694 | char c1; |
---|
695 | char c2; |
---|
696 | { |
---|
697 | { |
---|
698 | #asm |
---|
699 | LDA 5,U | read from stack |
---|
700 | LDB 7,U | read from stack |
---|
701 | TFR D,X | return in X |
---|
702 | #endasm |
---|
703 | } |
---|
704 | } |
---|
705 | |
---|
706 | add_32(h1,l1,h2,l2,rh,rl) |
---|
707 | unsigned int h1,l1; |
---|
708 | unsigned int h2,l2; |
---|
709 | unsigned int *rh,*rl; |
---|
710 | { |
---|
711 | { |
---|
712 | #asm |
---|
713 | LEAX 4,U | h1 |
---|
714 | LEAY 8,U | h2 |
---|
715 | ANDCC #$FE |
---|
716 | LDA 3,X |
---|
717 | ADCA 3,Y |
---|
718 | STA 3,Y |
---|
719 | LDA 2,X |
---|
720 | ADCA 2,Y |
---|
721 | STA 2,Y |
---|
722 | LDA 1,X |
---|
723 | ADCA 1,Y |
---|
724 | STA 1,Y |
---|
725 | LDA ,X |
---|
726 | ADCA ,Y |
---|
727 | STA ,Y |
---|
728 | |
---|
729 | LDX 8,U |
---|
730 | STX [12,U] | rh |
---|
731 | |
---|
732 | LDX 10,U |
---|
733 | STX [14,U] | rl |
---|
734 | #endasm |
---|
735 | } |
---|
736 | } |
---|
737 | |
---|
738 | sub_32(h1,l1,h2,l2,rh,rl) |
---|
739 | unsigned int h1,l1; |
---|
740 | unsigned int h2,l2; |
---|
741 | unsigned int *rh,*rl; |
---|
742 | { |
---|
743 | { |
---|
744 | #asm |
---|
745 | LEAX 4,U | h1 |
---|
746 | LEAY 8,U | h2 |
---|
747 | ANDCC #$FE |
---|
748 | LDA 3,X |
---|
749 | SBCA 3,Y |
---|
750 | STA 3,Y |
---|
751 | LDA 2,X |
---|
752 | SBCA 2,Y |
---|
753 | STA 2,Y |
---|
754 | LDA 1,X |
---|
755 | SBCA 1,Y |
---|
756 | STA 1,Y |
---|
757 | LDA ,X |
---|
758 | SBCA ,Y |
---|
759 | STA ,Y |
---|
760 | |
---|
761 | LDX 8,U |
---|
762 | STX [12,U] | rh |
---|
763 | |
---|
764 | LDX 10,U |
---|
765 | STX [14,U] | rl |
---|
766 | #endasm |
---|
767 | } |
---|
768 | } |
---|
769 | siz2shif(sz) |
---|
770 | int sz; |
---|
771 | { |
---|
772 | int i; |
---|
773 | switch (sz) { |
---|
774 | case 1 : i=0; |
---|
775 | break; |
---|
776 | case 2 : i=1; |
---|
777 | break; |
---|
778 | case 4 : i=2; |
---|
779 | break; |
---|
780 | case 8 : i=3; |
---|
781 | break; |
---|
782 | case 16 : i=4; |
---|
783 | break; |
---|
784 | case 32 : i=5; |
---|
785 | break; |
---|
786 | case 64 : i=6; |
---|
787 | break; |
---|
788 | case 128 : i=7; |
---|
789 | break; |
---|
790 | default : i=0; |
---|
791 | } |
---|
792 | return i; |
---|
793 | } |
---|
794 | |
---|
795 | clu2lba(h,l,shift,rh,rl) |
---|
796 | unsigned int h,l; |
---|
797 | unsigned int shift; |
---|
798 | unsigned int *rh,*rl; |
---|
799 | { |
---|
800 | { |
---|
801 | #asm |
---|
802 | LEAX 4,U | h (+l) |
---|
803 | |
---|
804 | LDB 9,U | shift |
---|
805 | L_CLU2LBA |
---|
806 | CMPB #$00 |
---|
807 | BEQ L_CLU2END |
---|
808 | ANDCC #$FE |
---|
809 | |
---|
810 | LDA 3,X |
---|
811 | LSLA |
---|
812 | STA 3,X |
---|
813 | LDA 2,X |
---|
814 | ROLA |
---|
815 | STA 2,X |
---|
816 | LDA 1,X |
---|
817 | ROLA |
---|
818 | STA 1,X |
---|
819 | LDA ,X |
---|
820 | ROLA |
---|
821 | STA ,X |
---|
822 | DECB |
---|
823 | BRA L_CLU2LBA |
---|
824 | |
---|
825 | L_CLU2END |
---|
826 | LDX 4,U |
---|
827 | STX [10,U] | rh |
---|
828 | |
---|
829 | LDX 6,U |
---|
830 | STX [12,U] | rl |
---|
831 | #endasm |
---|
832 | } |
---|
833 | } |
---|
834 | |
---|
835 | rd_sec(sect) |
---|
836 | char sect; |
---|
837 | { |
---|
838 | { |
---|
839 | #asm |
---|
840 | LDB 5,U | read from stack |
---|
841 | LDA #$02 | read sector (monitor) |
---|
842 | STA _DKOPC |
---|
843 | STB _DKSEC |
---|
844 | PSHS U,DP |
---|
845 | LDX #$6300 |
---|
846 | STX $604F | sector buffer |
---|
847 | JSR $789D |
---|
848 | JSR $78A7 |
---|
849 | PSHS A | |
---|
850 | JSR $7C5A | activate drive... |
---|
851 | JSR $7965 | wait some time |
---|
852 | JSR $7CA8 |
---|
853 | LDA #$FF |
---|
854 | STA 6,X | force track FF in THFMC reg |
---|
855 | JSR $7BAE |
---|
856 | PULS A | E0EE |
---|
857 | JSR $78B9 | motor off |
---|
858 | PULS DP,U |
---|
859 | LDA #$00 |
---|
860 | LDB _DKERR |
---|
861 | TFR D,X | return in X |
---|
862 | #endasm |
---|
863 | } |
---|
864 | } |
---|
865 | |
---|
866 | wt_sec(sect) |
---|
867 | char sect; |
---|
868 | { |
---|
869 | { |
---|
870 | #asm |
---|
871 | LDB 5,U | read from stack |
---|
872 | LDA #$08 | read sector (monitor) |
---|
873 | STA _DKOPC |
---|
874 | STB _DKSEC |
---|
875 | PSHS U,DP |
---|
876 | LDX #$6300 |
---|
877 | STX $604F | sector buffer |
---|
878 | JSR $789D |
---|
879 | JSR $78A7 |
---|
880 | PSHS A | |
---|
881 | JSR $7C5A | activate drive... |
---|
882 | JSR $7965 | wait some time |
---|
883 | JSR $7CA8 |
---|
884 | LDA #$FF |
---|
885 | STA 6,X | force track FF in THFMC reg |
---|
886 | JSR $797A |
---|
887 | PULS A | E0EE |
---|
888 | JSR $78B9 | motor off |
---|
889 | PULS DP,U |
---|
890 | LDA #$00 |
---|
891 | LDB _DKERR |
---|
892 | TFR D,X | return in X |
---|
893 | #endasm |
---|
894 | } |
---|
895 | } |
---|
896 | |
---|
897 | irq() |
---|
898 | { |
---|
899 | { |
---|
900 | #asm |
---|
901 | |
---|
902 | #endasm |
---|
903 | } |
---|
904 | } |
---|
905 | |
---|
906 | noirq() |
---|
907 | { |
---|
908 | { |
---|
909 | #asm |
---|
910 | |
---|
911 | #endasm |
---|
912 | } |
---|
913 | } |
---|
914 | |
---|
915 | getc() |
---|
916 | { |
---|
917 | { |
---|
918 | #asm |
---|
919 | TFR S,Y |
---|
920 | STY $62FC |
---|
921 | LDY $62FE |
---|
922 | TFR Y,S |
---|
923 | |
---|
924 | ANDCC #$EF |
---|
925 | |
---|
926 | L_GETC |
---|
927 | |
---|
928 | JSR $E806 | call monitor |
---|
929 | BCC L_GETC |
---|
930 | |
---|
931 | ORCC #$50 |
---|
932 | |
---|
933 | TFR S,Y |
---|
934 | STY $62FE |
---|
935 | LDY $62FC |
---|
936 | TFR Y,S |
---|
937 | |
---|
938 | |
---|
939 | LDA #$00 |
---|
940 | TFR D,X | return in X |
---|
941 | |
---|
942 | |
---|
943 | #endasm |
---|
944 | } |
---|
945 | } |
---|
946 | fill(v) |
---|
947 | char v; |
---|
948 | { |
---|
949 | { |
---|
950 | #asm |
---|
951 | LDB 5,U |
---|
952 | LDX #$4000 |
---|
953 | FILL_L |
---|
954 | STB ,X+ |
---|
955 | CMPX #$5F40 |
---|
956 | BNE FILL_L |
---|
957 | #endasm |
---|
958 | } |
---|
959 | } |
---|
960 | |
---|
961 | |
---|
962 | |
---|
963 | set_resolution(res) |
---|
964 | char res; |
---|
965 | { |
---|
966 | { |
---|
967 | #asm |
---|
968 | LDB 5,U |
---|
969 | STB $E7DC |
---|
970 | #endasm |
---|
971 | } |
---|
972 | } |
---|
973 | |
---|
974 | |
---|
975 | set_pt() |
---|
976 | { |
---|
977 | { |
---|
978 | #asm |
---|
979 | LDB #$01 |
---|
980 | ORB $E7C3 |
---|
981 | STB $E7C3 |
---|
982 | #endasm |
---|
983 | } |
---|
984 | } |
---|
985 | |
---|
986 | set_col() |
---|
987 | { |
---|
988 | { |
---|
989 | #asm |
---|
990 | LDB #$FE |
---|
991 | ANDB $E7C3 |
---|
992 | STB $E7C3 |
---|
993 | #endasm |
---|
994 | } |
---|
995 | } |
---|
996 | |
---|
997 | border(idx) |
---|
998 | int idx; |
---|
999 | { |
---|
1000 | { |
---|
1001 | #asm |
---|
1002 | LDB #$F0 |
---|
1003 | ANDB $E7E4 |
---|
1004 | ORB 5,U |
---|
1005 | STB $E7DD |
---|
1006 | #endasm |
---|
1007 | } |
---|
1008 | } |
---|
1009 | |
---|
1010 | hi_line(l,c) |
---|
1011 | int l; |
---|
1012 | int c; |
---|
1013 | { |
---|
1014 | set_col(); |
---|
1015 | { |
---|
1016 | #asm |
---|
1017 | * screen base address is x+y*40*8 -> Y |
---|
1018 | LDB 5,U |
---|
1019 | LSLB |
---|
1020 | LDX #BASE_TXT_ADR |
---|
1021 | LEAX [B,X] |
---|
1022 | LDB 7,U |
---|
1023 | LDY #320 |
---|
1024 | L_HILINE |
---|
1025 | STB ,X+ |
---|
1026 | |
---|
1027 | LEAY -1,Y |
---|
1028 | CMPY #$0000 |
---|
1029 | BNE L_HILINE |
---|
1030 | #endasm |
---|
1031 | } |
---|
1032 | set_pt(); |
---|
1033 | } |
---|
1034 | |
---|
1035 | charxy(x,y,c) |
---|
1036 | char x; |
---|
1037 | char y; |
---|
1038 | char c; |
---|
1039 | { |
---|
1040 | { |
---|
1041 | #asm |
---|
1042 | * screen base address is x+y*40*8 -> Y |
---|
1043 | LDB 7,U |
---|
1044 | LSLB |
---|
1045 | LDX #BASE_TXT_ADR |
---|
1046 | LEAX [B,X] |
---|
1047 | LDB 5,U |
---|
1048 | ABX |
---|
1049 | TFR X,Y |
---|
1050 | |
---|
1051 | * font base is font adress + 8*c -> X |
---|
1052 | LDB 9,U |
---|
1053 | ANDB #$7F |
---|
1054 | LDX #FONT8 |
---|
1055 | LDA #8 |
---|
1056 | MUL |
---|
1057 | LEAX D,X |
---|
1058 | |
---|
1059 | * put a byte every 40 screen byte |
---|
1060 | LDB #40 |
---|
1061 | LDA ,X+ |
---|
1062 | STA ,Y |
---|
1063 | LEAY B,Y |
---|
1064 | LDA ,X+ |
---|
1065 | STA ,Y |
---|
1066 | LEAY B,Y |
---|
1067 | LDA ,X+ |
---|
1068 | STA ,Y |
---|
1069 | LEAY B,Y |
---|
1070 | LDA ,X+ |
---|
1071 | STA ,Y |
---|
1072 | LEAY B,Y |
---|
1073 | LDA ,X+ |
---|
1074 | STA ,Y |
---|
1075 | LEAY B,Y |
---|
1076 | LDA ,X+ |
---|
1077 | STA ,Y |
---|
1078 | LEAY B,Y |
---|
1079 | LDA ,X+ |
---|
1080 | STA ,Y |
---|
1081 | LEAY B,Y |
---|
1082 | LDA ,X+ |
---|
1083 | STA ,Y |
---|
1084 | |
---|
1085 | PULS U,PC ; retour de fonction compatible mini C |
---|
1086 | |
---|
1087 | |
---|
1088 | BASE_TXT_ADR |
---|
1089 | FDB 0+$4000 |
---|
1090 | FDB 1*40*8+$4000 |
---|
1091 | FDB 2*40*8+$4000 |
---|
1092 | FDB 3*40*8+$4000 |
---|
1093 | FDB 4*40*8+$4000 |
---|
1094 | FDB 5*40*8+$4000 |
---|
1095 | FDB 6*40*8+$4000 |
---|
1096 | FDB 7*40*8+$4000 |
---|
1097 | FDB 8*40*8+$4000 |
---|
1098 | FDB 9*40*8+$4000 |
---|
1099 | FDB 10*40*8+$4000 |
---|
1100 | FDB 11*40*8+$4000 |
---|
1101 | FDB 12*40*8+$4000 |
---|
1102 | FDB 13*40*8+$4000 |
---|
1103 | FDB 14*40*8+$4000 |
---|
1104 | FDB 15*40*8+$4000 |
---|
1105 | FDB 16*40*8+$4000 |
---|
1106 | FDB 17*40*8+$4000 |
---|
1107 | FDB 18*40*8+$4000 |
---|
1108 | FDB 19*40*8+$4000 |
---|
1109 | FDB 20*40*8+$4000 |
---|
1110 | FDB 21*40*8+$4000 |
---|
1111 | FDB 22*40*8+$4000 |
---|
1112 | FDB 23*40*8+$4000 |
---|
1113 | FDB 24*40*8+$4000 |
---|
1114 | |
---|
1115 | FONT8 |
---|
1116 | FCB $0,$0,$0,$0,$0,$0,$0,$0 |
---|
1117 | FCB $7E,$81,$A5,$81,$BD,$99,$81,$7E |
---|
1118 | FCB $7E,$FF,$DB,$FF,$C3,$E7,$FF,$7E |
---|
1119 | FCB $6C,$FE,$FE,$FE,$7C,$38,$10,$0 |
---|
1120 | FCB $10,$38,$7C,$FE,$7C,$38,$10,$0 |
---|
1121 | FCB $38,$7C,$38,$FE,$FE,$D6,$10,$38 |
---|
1122 | FCB $10,$10,$38,$7C,$FE,$7C,$10,$38 |
---|
1123 | FCB $0,$0,$18,$3C,$3C,$18,$0,$0 |
---|
1124 | FCB $FF,$FF,$E7,$C3,$C3,$E7,$FF,$FF |
---|
1125 | FCB $0,$3C,$66,$42,$42,$66,$3C,$0 |
---|
1126 | FCB $FF,$C3,$99,$BD,$BD,$99,$C3,$FF |
---|
1127 | FCB $F,$3,$5,$7D,$84,$84,$84,$78 |
---|
1128 | FCB $3C,$42,$42,$42,$3C,$18,$7E,$18 |
---|
1129 | FCB $3F,$21,$3F,$20,$20,$60,$E0,$C0 |
---|
1130 | FCB $3F,$21,$3F,$21,$23,$67,$E6,$C0 |
---|
1131 | FCB $18,$DB,$3C,$E7,$E7,$3C,$DB,$18 |
---|
1132 | FCB $80,$E0,$F8,$FE,$F8,$E0,$80,$0 |
---|
1133 | FCB $2,$E,$3E,$FE,$3E,$E,$2,$0 |
---|
1134 | FCB $18,$3C,$7E,$18,$18,$7E,$3C,$18 |
---|
1135 | FCB $24,$24,$24,$24,$24,$0,$24,$0 |
---|
1136 | FCB $7F,$92,$92,$72,$12,$12,$12,$0 |
---|
1137 | FCB $3E,$63,$38,$44,$44,$38,$CC,$78 |
---|
1138 | FCB $0,$0,$0,$0,$7E,$7E,$7E,$0 |
---|
1139 | FCB $18,$3C,$7E,$18,$7E,$3C,$18,$FF |
---|
1140 | FCB $10,$38,$7C,$54,$10,$10,$10,$0 |
---|
1141 | FCB $10,$10,$10,$54,$7C,$38,$10,$0 |
---|
1142 | FCB $0,$18,$C,$FE,$C,$18,$0,$0 |
---|
1143 | FCB $0,$30,$60,$FE,$60,$30,$0,$0 |
---|
1144 | FCB $0,$0,$40,$40,$40,$7E,$0,$0 |
---|
1145 | FCB $0,$24,$66,$FF,$66,$24,$0,$0 |
---|
1146 | FCB $0,$10,$38,$7C,$FE,$FE,$0,$0 |
---|
1147 | FCB $0,$FE,$FE,$7C,$38,$10,$0,$0 |
---|
1148 | FCB $0,$0,$0,$0,$0,$0,$0,$0 |
---|
1149 | FCB $10,$38,$38,$10,$10,$0,$10,$0 |
---|
1150 | FCB $24,$24,$24,$0,$0,$0,$0,$0 |
---|
1151 | FCB $24,$24,$7E,$24,$7E,$24,$24,$0 |
---|
1152 | FCB $18,$3E,$40,$3C,$2,$7C,$18,$0 |
---|
1153 | FCB $0,$62,$64,$8,$10,$26,$46,$0 |
---|
1154 | FCB $30,$48,$30,$56,$88,$88,$76,$0 |
---|
1155 | FCB $10,$10,$20,$0,$0,$0,$0,$0 |
---|
1156 | FCB $10,$20,$40,$40,$40,$20,$10,$0 |
---|
1157 | FCB $20,$10,$8,$8,$8,$10,$20,$0 |
---|
1158 | FCB $0,$44,$38,$FE,$38,$44,$0,$0 |
---|
1159 | FCB $0,$10,$10,$7C,$10,$10,$0,$0 |
---|
1160 | FCB $0,$0,$0,$0,$0,$10,$10,$20 |
---|
1161 | FCB $0,$0,$0,$7E,$0,$0,$0,$0 |
---|
1162 | FCB $0,$0,$0,$0,$0,$10,$10,$0 |
---|
1163 | FCB $0,$2,$4,$8,$10,$20,$40,$0 |
---|
1164 | FCB $3C,$42,$46,$4A,$52,$62,$3C,$0 |
---|
1165 | FCB $10,$30,$50,$10,$10,$10,$7C,$0 |
---|
1166 | FCB $3C,$42,$2,$C,$30,$42,$7E,$0 |
---|
1167 | FCB $3C,$42,$2,$1C,$2,$42,$3C,$0 |
---|
1168 | FCB $8,$18,$28,$48,$FE,$8,$1C,$0 |
---|
1169 | FCB $7E,$40,$7C,$2,$2,$42,$3C,$0 |
---|
1170 | FCB $1C,$20,$40,$7C,$42,$42,$3C,$0 |
---|
1171 | FCB $7E,$42,$4,$8,$10,$10,$10,$0 |
---|
1172 | FCB $3C,$42,$42,$3C,$42,$42,$3C,$0 |
---|
1173 | FCB $3C,$42,$42,$3E,$2,$4,$38,$0 |
---|
1174 | FCB $0,$10,$10,$0,$0,$10,$10,$0 |
---|
1175 | FCB $0,$10,$10,$0,$0,$10,$10,$20 |
---|
1176 | FCB $8,$10,$20,$40,$20,$10,$8,$0 |
---|
1177 | FCB $0,$0,$7E,$0,$0,$7E,$0,$0 |
---|
1178 | FCB $10,$8,$4,$2,$4,$8,$10,$0 |
---|
1179 | FCB $3C,$42,$2,$4,$8,$0,$8,$0 |
---|
1180 | FCB $3C,$42,$5E,$52,$5E,$40,$3C,$0 |
---|
1181 | FCB $18,$24,$42,$42,$7E,$42,$42,$0 |
---|
1182 | FCB $7C,$22,$22,$3C,$22,$22,$7C,$0 |
---|
1183 | FCB $1C,$22,$40,$40,$40,$22,$1C,$0 |
---|
1184 | FCB $78,$24,$22,$22,$22,$24,$78,$0 |
---|
1185 | FCB $7E,$22,$28,$38,$28,$22,$7E,$0 |
---|
1186 | FCB $7E,$22,$28,$38,$28,$20,$70,$0 |
---|
1187 | FCB $1C,$22,$40,$40,$4E,$22,$1E,$0 |
---|
1188 | FCB $42,$42,$42,$7E,$42,$42,$42,$0 |
---|
1189 | FCB $38,$10,$10,$10,$10,$10,$38,$0 |
---|
1190 | FCB $E,$4,$4,$4,$44,$44,$38,$0 |
---|
1191 | FCB $62,$24,$28,$30,$28,$24,$63,$0 |
---|
1192 | FCB $70,$20,$20,$20,$20,$22,$7E,$0 |
---|
1193 | FCB $63,$55,$49,$41,$41,$41,$41,$0 |
---|
1194 | FCB $62,$52,$4A,$46,$42,$42,$42,$0 |
---|
1195 | FCB $18,$24,$42,$42,$42,$24,$18,$0 |
---|
1196 | FCB $7C,$22,$22,$3C,$20,$20,$70,$0 |
---|
1197 | FCB $3C,$42,$42,$42,$4A,$3C,$3,$0 |
---|
1198 | FCB $7C,$22,$22,$3C,$28,$24,$72,$0 |
---|
1199 | FCB $3C,$42,$40,$3C,$2,$42,$3C,$0 |
---|
1200 | FCB $7F,$49,$8,$8,$8,$8,$1C,$0 |
---|
1201 | FCB $42,$42,$42,$42,$42,$42,$3C,$0 |
---|
1202 | FCB $41,$41,$41,$41,$22,$14,$8,$0 |
---|
1203 | FCB $41,$41,$41,$49,$49,$49,$36,$0 |
---|
1204 | FCB $41,$22,$14,$8,$14,$22,$41,$0 |
---|
1205 | FCB $41,$22,$14,$8,$8,$8,$1C,$0 |
---|
1206 | FCB $7F,$42,$4,$8,$10,$21,$7F,$0 |
---|
1207 | FCB $78,$40,$40,$40,$40,$40,$78,$0 |
---|
1208 | FCB $80,$40,$20,$10,$8,$4,$2,$0 |
---|
1209 | FCB $78,$8,$8,$8,$8,$8,$78,$0 |
---|
1210 | FCB $10,$28,$44,$82,$0,$0,$0,$0 |
---|
1211 | FCB $0,$0,$0,$0,$0,$0,$0,$FF |
---|
1212 | FCB $10,$10,$8,$0,$0,$0,$0,$0 |
---|
1213 | FCB $0,$0,$3C,$2,$3E,$42,$3F,$0 |
---|
1214 | FCB $60,$20,$20,$2E,$31,$31,$2E,$0 |
---|
1215 | FCB $0,$0,$3C,$42,$40,$42,$3C,$0 |
---|
1216 | FCB $6,$2,$2,$3A,$46,$46,$3B,$0 |
---|
1217 | FCB $0,$0,$3C,$42,$7E,$40,$3C,$0 |
---|
1218 | FCB $C,$12,$10,$38,$10,$10,$38,$0 |
---|
1219 | FCB $0,$0,$3D,$42,$42,$3E,$2,$7C |
---|
1220 | FCB $60,$20,$2C,$32,$22,$22,$62,$0 |
---|
1221 | FCB $10,$0,$30,$10,$10,$10,$38,$0 |
---|
1222 | FCB $2,$0,$6,$2,$2,$42,$42,$3C |
---|
1223 | FCB $60,$20,$24,$28,$30,$28,$26,$0 |
---|
1224 | FCB $30,$10,$10,$10,$10,$10,$38,$0 |
---|
1225 | FCB $0,$0,$76,$49,$49,$49,$49,$0 |
---|
1226 | FCB $0,$0,$5C,$62,$42,$42,$42,$0 |
---|
1227 | FCB $0,$0,$3C,$42,$42,$42,$3C,$0 |
---|
1228 | FCB $0,$0,$6C,$32,$32,$2C,$20,$70 |
---|
1229 | FCB $0,$0,$36,$4C,$4C,$34,$4,$E |
---|
1230 | FCB $0,$0,$6C,$32,$22,$20,$70,$0 |
---|
1231 | FCB $0,$0,$3E,$40,$3C,$2,$7C,$0 |
---|
1232 | FCB $10,$10,$7C,$10,$10,$12,$C,$0 |
---|
1233 | FCB $0,$0,$42,$42,$42,$46,$3A,$0 |
---|
1234 | FCB $0,$0,$41,$41,$22,$14,$8,$0 |
---|
1235 | FCB $0,$0,$41,$49,$49,$49,$36,$0 |
---|
1236 | FCB $0,$0,$44,$28,$10,$28,$44,$0 |
---|
1237 | FCB $0,$0,$42,$42,$42,$3E,$2,$7C |
---|
1238 | FCB $0,$0,$7C,$8,$10,$20,$7C,$0 |
---|
1239 | FCB $C,$10,$10,$60,$10,$10,$C,$0 |
---|
1240 | FCB $10,$10,$10,$0,$10,$10,$10,$0 |
---|
1241 | FCB $30,$8,$8,$6,$8,$8,$30,$0 |
---|
1242 | FCB $32,$4C,$0,$0,$0,$0,$0,$0 |
---|
1243 | FCB $0,$8,$14,$22,$41,$41,$7F,$0 |
---|
1244 | |
---|
1245 | * MC09 internal functions/lib |
---|
1246 | |
---|
1247 | _00001 PSHS D,X,Y multiply |
---|
1248 | |
---|
1249 | LDA ,S |
---|
1250 | LDB 3,S |
---|
1251 | MUL |
---|
1252 | STB 4,S |
---|
1253 | |
---|
1254 | LDD 1,S |
---|
1255 | MUL |
---|
1256 | STB 5,S |
---|
1257 | |
---|
1258 | LDA 1,S |
---|
1259 | LDB 3,S |
---|
1260 | MUL |
---|
1261 | ADDA 4,S |
---|
1262 | ADDA 5,S |
---|
1263 | |
---|
1264 | LEAS 6,S |
---|
1265 | RTS |
---|
1266 | |
---|
1267 | _00006 CMPX #0 signed left shift |
---|
1268 | BMI _06001 |
---|
1269 | |
---|
1270 | _06000 BEQ _06009 |
---|
1271 | LSLB |
---|
1272 | ROLA |
---|
1273 | LEAX -1,X |
---|
1274 | BRA _06000 |
---|
1275 | |
---|
1276 | _06001 BEQ _06009 |
---|
1277 | ASRA |
---|
1278 | RORB |
---|
1279 | LEAX 1,X |
---|
1280 | BRA _06001 |
---|
1281 | |
---|
1282 | _06009 RTS |
---|
1283 | _00008 CMPX #0 sined right shift |
---|
1284 | BMI _08001 |
---|
1285 | |
---|
1286 | _08000 BEQ _08009 |
---|
1287 | ASRA |
---|
1288 | RORB |
---|
1289 | LEAX -1,X |
---|
1290 | BRA _08000 |
---|
1291 | |
---|
1292 | _08001 BEQ _08009 |
---|
1293 | LSLB |
---|
1294 | ROLA |
---|
1295 | LEAX 1,X |
---|
1296 | BRA _08001 |
---|
1297 | |
---|
1298 | _08009 RTS |
---|
1299 | _00009 CMPX #0 unsined right shift |
---|
1300 | BMI _09001 |
---|
1301 | |
---|
1302 | _09000 BEQ _09009 |
---|
1303 | LSRA |
---|
1304 | RORB |
---|
1305 | LEAX -1,X |
---|
1306 | BRA _09000 |
---|
1307 | |
---|
1308 | _09001 BEQ _09009 |
---|
1309 | LSLB |
---|
1310 | ROLA |
---|
1311 | LEAX 1,X |
---|
1312 | BRA _09001 |
---|
1313 | |
---|
1314 | _09009 RTS |
---|
1315 | #endasm |
---|
1316 | } |
---|
1317 | } |
---|