Fix order of operations.

This commit is contained in:
Toni Wilen 2022-12-26 10:59:54 +02:00
parent 0256436e0a
commit 9f169b3c4b
4 changed files with 6 additions and 6 deletions

View File

@ -1886,7 +1886,7 @@ int scsi_cd_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len,
strack++;
}
addtocentry (&p2, &maxlen, 0xa2, 0xaa, msf, p, toc);
int tlen = addrdiff(p2, p + 2);
int tlen = addrdiff(p2, p) + 2;
p[0] = tlen >> 8;
p[1] = tlen >> 0;
scsi_len = tlen + 2;

View File

@ -338,11 +338,11 @@ static int getsub_deinterleaved (uae_u8 *dst, struct cdunit *cdu, struct cdtoc *
// regenerate Q-subchannel
uae_u8 *s = dst + SUB_ENTRY_SIZE;
s[0] = (t->ctrl << 4) | (t->adr << 0);
s[1] = tobcd(addrdiff(t, &cdu->toc[0] + 1));
s[1] = tobcd(addrdiff(t, &cdu->toc[0]) + 1);
s[2] = tobcd(1);
int msf = lsn2msf(sector);
tolongbcd(s + 7, msf);
msf = lsn2msf(addrdiff(sector, t->address - 150));
msf = lsn2msf(addrdiff(sector, t->address) - 150);
tolongbcd(s + 3, msf);
ret = 2;
}

View File

@ -1278,7 +1278,7 @@ static void initscideattr (int readonly)
strcpy ((char*)p, "Generic Emulated PCMCIA IDE");
p += strlen ((char*)p) + 1;
*p++= 0xff;
*rp = addrdiff(p, rp - 1);
*rp = addrdiff(p, rp) - 1;
/* CISTPL_FUNCID */
*p++ = 0x21;
@ -1380,7 +1380,7 @@ static void initsramattr (int size, int readonly)
sprintf ((char*)p, "Generic Emulated %dKB PCMCIA SRAM Card", size >> 10);
p += strlen ((char*)p) + 1;
*p++= 0xff;
*rp = addrdiff(p, rp - 1);
*rp = addrdiff(p, rp) - 1;
/* CISTPL_FUNCID */
*p++ = 0x21;

View File

@ -241,7 +241,7 @@ void WriteOutput(const TCHAR *out, int len)
for(;;) {
p = _tcschr(tmp, '\n');
if (p) {
pos = addrdiff(p, tmp + 1);
pos = addrdiff(p, tmp) + 1;
if (pos > (MAX_LINEWIDTH + 1))
pos = MAX_LINEWIDTH + 1;
buf = xcalloc(TCHAR, pos + 2);