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