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