fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ibmpc: Support PSI approximate sector positions

+58 -21
+5 -5
src/arch/ibmpc/ibmpc.c
··· 5 5 /***************************************************************************** 6 6 * File name: src/arch/ibmpc/ibmpc.c * 7 7 * Created: 1999-04-16 by Hampa Hug <hampa@hampa.ch> * 8 - * Copyright: (C) 1999-2022 Hampa Hug <hampa@hampa.ch> * 8 + * Copyright: (C) 1999-2023 Hampa Hug <hampa@hampa.ch> * 9 9 *****************************************************************************/ 10 10 11 11 /***************************************************************************** ··· 2109 2109 } 2110 2110 } 2111 2111 2112 + if (pc->fdc != NULL) { 2113 + e8272_clock (&pc->fdc->e8272, clk); 2114 + } 2115 + 2112 2116 if (pc->clk_div[1] >= 1024) { 2113 2117 clk = pc->clk_div[1] & ~1023UL; 2114 2118 pc->clk_div[1] &= 1023; ··· 2120 2124 2121 2125 if (pc->atari_pc_rtc != NULL) { 2122 2126 mc146818a_clock (pc->atari_pc_rtc, clk); 2123 - } 2124 - 2125 - if (pc->fdc != NULL) { 2126 - e8272_clock (&pc->fdc->e8272, clk); 2127 2127 } 2128 2128 2129 2129 if (pc->hdc != NULL) {
+27 -5
src/chipset/82xx/e8272.c
··· 5 5 /***************************************************************************** 6 6 * File name: src/chipset/82xx/e8272.c * 7 7 * Created: 2005-03-06 by Hampa Hug <hampa@hampa.ch> * 8 - * Copyright: (C) 2005-2022 Hampa Hug <hampa@hampa.ch> * 8 + * Copyright: (C) 2005-2023 Hampa Hug <hampa@hampa.ch> * 9 9 *****************************************************************************/ 10 10 11 11 /***************************************************************************** ··· 298 298 p->ls = ls; 299 299 p->ln = ln; 300 300 301 + p->pos = 0; 302 + 301 303 p->buf = buf; 302 304 p->cnt = cnt; 303 305 ··· 384 386 static 385 387 unsigned e8272_diskop_readid (e8272_t *fdc, 386 388 unsigned pd, unsigned pc, unsigned ph, unsigned ps, 387 - unsigned char *id) 389 + unsigned char *id, unsigned long *pos) 388 390 { 389 391 unsigned r; 390 392 e8272_diskop_t p; ··· 402 404 id[2] = p.ls; 403 405 id[3] = p.ln; 404 406 407 + *pos = p.pos; 408 + 405 409 return (r); 406 410 } 407 411 ··· 411 415 static 412 416 void e8272_read_track (e8272_t *fdc) 413 417 { 414 - unsigned i; 418 + unsigned i, j, s; 415 419 unsigned char id[4]; 420 + unsigned long pos; 416 421 unsigned long ofs, cnt; 417 422 e8272_drive_t *drv; 418 423 ··· 424 429 425 430 drv->sct_cnt = 0; 426 431 432 + s = 0; 433 + 427 434 for (i = 0; i < E8272_MAX_SCT; i++) { 428 - if (e8272_diskop_readid (fdc, drv->d, drv->c, drv->h, i, id)) { 435 + if (e8272_diskop_readid (fdc, drv->d, drv->c, drv->h, i, id, &pos)) { 429 436 break; 430 437 } 431 438 ··· 434 441 drv->sct[i].s = id[2]; 435 442 drv->sct[i].n = id[3]; 436 443 444 + pos >>= s; 445 + 446 + while (pos >= fdc->track_size) { 447 + for (j = 0; j < i; j++) { 448 + drv->sct[j].ofs >>= 1; 449 + } 450 + 451 + s += 1; 452 + pos >>= 1; 453 + } 454 + 455 + drv->sct[i].ofs = pos; 456 + 437 457 drv->sct_cnt += 1; 438 458 } 439 459 ··· 441 461 cnt = fdc->track_size - ofs; 442 462 443 463 for (i = 0; i < drv->sct_cnt; i++) { 444 - drv->sct[i].ofs = ofs + (2UL * i * cnt) / (2UL * drv->sct_cnt + 1); 464 + if (drv->sct[i].ofs == 0) { 465 + drv->sct[i].ofs = ofs + (2UL * i * cnt) / (2UL * drv->sct_cnt + 1); 466 + } 445 467 } 446 468 447 469 drv->ok = 1;
+4 -2
src/chipset/82xx/e8272.h
··· 5 5 /***************************************************************************** 6 6 * File name: src/chipset/82xx/e8272.h * 7 7 * Created: 2005-03-06 by Hampa Hug <hampa@hampa.ch> * 8 - * Copyright: (C) 2005-2022 Hampa Hug <hampa@hampa.ch> * 8 + * Copyright: (C) 2005-2023 Hampa Hug <hampa@hampa.ch> * 9 9 *****************************************************************************/ 10 10 11 11 /***************************************************************************** ··· 47 47 unsigned char h; 48 48 unsigned char s; 49 49 unsigned short n; 50 - unsigned short ofs; 50 + unsigned long ofs; 51 51 } e8272_sct_t; 52 52 53 53 ··· 72 72 unsigned char lh; 73 73 unsigned char ls; 74 74 unsigned char ln; 75 + 76 + unsigned long pos; 75 77 76 78 void *buf; 77 79 unsigned cnt;
+5 -3
src/devices/fdc.c
··· 5 5 /***************************************************************************** 6 6 * File name: src/devices/fdc.c * 7 7 * Created: 2007-09-06 by Hampa Hug <hampa@hampa.ch> * 8 - * Copyright: (C) 2007-2013 Hampa Hug <hampa@hampa.ch> * 8 + * Copyright: (C) 2007-2023 Hampa Hug <hampa@hampa.ch> * 9 9 *****************************************************************************/ 10 10 11 11 /***************************************************************************** ··· 15 15 * * 16 16 * This program is distributed in the hope that it will be useful, but * 17 17 * WITHOUT ANY WARRANTY, without even the implied warranty of * 18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * 18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * 19 19 * Public License for more details. * 20 20 *****************************************************************************/ 21 21 ··· 197 197 disk_t *dsk; 198 198 unsigned char buf[512]; 199 199 unsigned lc, lh, ls, cnt, cnt_id; 200 + unsigned long pos; 200 201 201 202 dsk = dsks_get_disk (fdc->dsks, fdc->drive[p->pd & 3]); 202 203 ··· 217 218 return (0); 218 219 } 219 220 220 - if (dsk_psi_read_id (dsk->ext, p->pc, p->ph, p->ps, &lc, &lh, &ls, &cnt, &cnt_id)) { 221 + if (dsk_psi_read_id (dsk->ext, p->pc, p->ph, p->ps, &lc, &lh, &ls, &cnt, &cnt_id, &pos)) { 221 222 return (E8272_ERR_NO_ID); 222 223 } 223 224 ··· 225 226 p->lh = lh; 226 227 p->ls = ls; 227 228 p->ln = 0; 229 + p->pos = pos; 228 230 229 231 while (cnt_id > 128) { 230 232 cnt_id >>= 1;
+13 -3
src/drivers/block/blkpsi.c
··· 5 5 /***************************************************************************** 6 6 * File name: src/drivers/block/blkfdc.c * 7 7 * Created: 2010-08-11 by Hampa Hug <hampa@hampa.ch> * 8 - * Copyright: (C) 2010-2019 Hampa Hug <hampa@hampa.ch> * 8 + * Copyright: (C) 2010-2023 Hampa Hug <hampa@hampa.ch> * 9 9 *****************************************************************************/ 10 10 11 11 /***************************************************************************** ··· 15 15 * * 16 16 * This program is distributed in the hope that it will be useful, but * 17 17 * WITHOUT ANY WARRANTY, without even the implied warranty of * 18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * 18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * 19 19 * Public License for more details. * 20 20 *****************************************************************************/ 21 21 ··· 321 321 322 322 int dsk_psi_read_id (disk_psi_t *fdc, 323 323 unsigned pc, unsigned ph, unsigned ps, 324 - unsigned *c, unsigned *h, unsigned *s, unsigned *cnt, unsigned *cnt_id) 324 + unsigned *c, unsigned *h, unsigned *s, unsigned *cnt, unsigned *cnt_id, 325 + unsigned long *pos) 325 326 { 326 327 unsigned mfm_size; 327 328 psi_sct_t *sct; ··· 341 342 *s = sct->s; 342 343 *cnt = sct->n; 343 344 *cnt_id = sct->n; 345 + 346 + if (pos != NULL) { 347 + if (sct->position == (unsigned long) -1) { 348 + *pos = 0; 349 + } 350 + else { 351 + *pos = sct->position; 352 + } 353 + } 344 354 345 355 if (sct->have_mfm_size) { 346 356 mfm_size = psi_sct_get_mfm_size (sct);
+4 -3
src/drivers/block/blkpsi.h
··· 5 5 /***************************************************************************** 6 6 * File name: src/drivers/block/blkpsi.h * 7 7 * Created: 2010-08-11 by Hampa Hug <hampa@hampa.ch> * 8 - * Copyright: (C) 2010-2019 Hampa Hug <hampa@hampa.ch> * 8 + * Copyright: (C) 2010-2023 Hampa Hug <hampa@hampa.ch> * 9 9 *****************************************************************************/ 10 10 11 11 /***************************************************************************** ··· 15 15 * * 16 16 * This program is distributed in the hope that it will be useful, but * 17 17 * WITHOUT ANY WARRANTY, without even the implied warranty of * 18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * 18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * 19 19 * Public License for more details. * 20 20 *****************************************************************************/ 21 21 ··· 88 88 89 89 int dsk_psi_read_id (disk_psi_t *fdc, 90 90 unsigned pc, unsigned ph, unsigned ps, 91 - unsigned *c, unsigned *h, unsigned *s, unsigned *cnt, unsigned *cnt_id 91 + unsigned *c, unsigned *h, unsigned *s, unsigned *cnt, unsigned *cnt_id, 92 + unsigned long *pos 92 93 ); 93 94 94 95