astring &cpy(const char *src, int count);
astring &cpysubstr(const astring &src, int start, int count = -1);
astring &cpy(const astring &src) { return cpy(src.cstr(), src.len()); }
- astring &cpy(const char *src) { return cpy(src, strlen(src)); }
+ astring &cpy(const char *src) { return cpy(src, uaestrlen(src)); }
// insertion helpers
astring &ins(int insbefore, const char *src, int count);
astring &inssubstr(int insbefore, const astring &src, int start, int count = -1);
astring &ins(int insbefore, const astring &src) { return ins(insbefore, src.cstr(), src.len()); }
- astring &ins(int insbefore, const char *src) { return ins(insbefore, src, strlen(src)); }
+ astring &ins(int insbefore, const char *src) { return ins(insbefore, src, uaestrlen(src)); }
// concatenation helpers (== insert at end)
astring &cat(const char *src, int count) { return ins(-1, src, count); }
astring &catsubstr(const astring &src, int start, int count = -1) { return inssubstr(-1, src, start, count); }
astring &cat(const astring &src) { return ins(-1, src.cstr(), src.len()); }
- astring &cat(const char *src) { return ins(-1, src, strlen(src)); }
+ astring &cat(const char *src) { return ins(-1, src, uaestrlen(src)); }
astring &cat(char ch) { return ins(-1, &ch, 1); }
// substring helpers
int cmp(const char *str2, int count) const;
int cmpsubstr(const astring &str2, int start, int count = -1) const;
int cmp(const astring &str2) const { return cmp(str2.cstr(), str2.len()); }
- int cmp(const char *str2) const { return cmp(str2, strlen(str2)); }
+ int cmp(const char *str2) const { return cmp(str2, uaestrlen(str2)); }
// case-insensitive comparison helpers
int icmp(const char *str2, int count) const;
int icmpsubstr(const astring &str2, int start, int count = -1) const;
int icmp(const astring &str2) const { return icmp(str2.cstr(), str2.len()); }
- int icmp(const char *str2) const { return icmp(str2, strlen(str2)); }
+ int icmp(const char *str2) const { return icmp(str2, uaestrlen(str2)); }
// character searching helpers
int chr(int start, int ch) const;
{
int l;
- l = _tcslen (s) - 1;
+ l = uaetcslen(s) - 1;
while (l >= 0) {
if (s[l] == '.')
s[l] = 0;
* backward. store pointer at current address
*/
-uae_u32 ds_ansi (const uae_char *str)
+uae_u32 ds_ansi(const uae_char *str)
{
int len;
if (!str)
- return addr (rt_straddr);
- len = strlen (str) + 1;
+ return addr(rt_straddr);
+ len = uaestrlen(str) + 1;
rt_straddr -= len;
- strcpy ((uae_char*)rtarea_bank.baseaddr + rt_straddr, str);
- return addr (rt_straddr);
+ strcpy((uae_char*)rtarea_bank.baseaddr + rt_straddr, str);
+ return addr(rt_straddr);
}
uae_u32 ds (const TCHAR *str)
{
int len;
- len = strlen (str) + 2;
+ len = uaestrlen(str) + 2;
rt_straddr -= len;
while (rt_straddr & 3)
rt_straddr--;
uae_u32 res = *dst;
int len;
char *s = ua(src);
- len = strlen(s) + 1;
+ len = uaestrlen(s) + 1;
if (trap_is_indirect()) {
trap_put_bytes(ctx, dst, res, len);
} else {
{
uae_u32 res = *dst;
int len;
- len = strlen (src) + 1;
+ len = uaestrlen (src) + 1;
if (trap_is_indirect()) {
trap_put_bytes(ctx, dst, res, len);
} else {
_stprintf(verStr, _T("UAE %d.%d.%d"), UAEMAJOR, UAEMINOR, UAESUBREV);
tmp1 = 0;
for (i = number_sys_error; i--;)
- tmp1 += _tcslen (errortexts[i]) + 1;
+ tmp1 += uaetcslen (errortexts[i]) + 1;
for (i = number_host_error; i--;)
- tmp1 += _tcslen (herrortexts[i]) + 1;
+ tmp1 += uaetcslen (herrortexts[i]) + 1;
for (i = number_sana2io_error; i--;)
- tmp1 += _tcslen (sana2io_errlist[i]) + 1;
+ tmp1 += uaetcslen (sana2io_errlist[i]) + 1;
for (i = number_sana2wire_error; i--;)
- tmp1 += _tcslen (sana2wire_errlist[i]) + 1;
- tmp1 += _tcslen(strErr) + 1;
- tmp1 += _tcslen(verStr) + 1;
+ tmp1 += uaetcslen (sana2wire_errlist[i]) + 1;
+ tmp1 += uaetcslen(strErr) + 1;
+ tmp1 += uaetcslen(verStr) + 1;
#if NEWTRAP
trap_call_add_dreg(ctx, 0, tmp1);
break;
case 0x83:
if (cdrom_command_cnt_in == 7) {
- memcpy (cdrom_command_output, MODEL_NAME, strlen (MODEL_NAME));
- cdrom_command_accepted (strlen (MODEL_NAME), s, &cdrom_command_cnt_in);
+ memcpy (cdrom_command_output, MODEL_NAME, uaestrlen(MODEL_NAME));
+ cdrom_command_accepted (uaestrlen(MODEL_NAME), s, &cdrom_command_cnt_in);
cd_finished = 1;
}
case 0x84:
static void trimwsa (char *s)
{
/* Delete trailing whitespace. */
- int len = strlen (s);
+ int len = uaestrlen(s);
while (len > 0 && strcspn (s + len - 1, "\t \r\n") == 0)
s[--len] = '\0';
}
int l;
TCHAR *p2, *p = xmalloc (TCHAR, _tcslen (file) + _tcslen (subst) + 2);
_tcscpy (p, subst);
- l = _tcslen (p);
+ l = uaetcslen(p);
while (l > 0 && p[l - 1] == '/')
p[--l] = '\0';
- l = _tcslen (path);
+ l = uaetcslen(path);
while (file[l] == '/')
l++;
- _tcscat (p, _T("/"));
- _tcscat (p, file + l);
+ _tcscat(p, _T("/"));
+ _tcscat(p, file + l);
p2 = target_expand_environment (p, NULL, 0);
xfree (p);
if (p2 && p2[0] == '$') {
const TCHAR *ext = _tcsrchr(control, '_');
if (ext) {
ext++;
- int len = _tcslen(ext);
+ int len = uaetcslen(ext);
if (len > 2 && ext[len - 2] == '-' && ext[len - 1] >= '2' && ext[len - 1] <= '9') {
idx = ext[len - 1] - '1';
len -= 2;
*line2++ = '\0';
/* Get rid of whitespace. */
- i = strlen (line2);
+ i = uaestrlen(line2);
while (i > 0 && (line2[i - 1] == '\t' || line2[i - 1] == ' '
|| line2[i - 1] == '\r' || line2[i - 1] == '\n'))
line2[--i] = '\0';
line2 += strspn (line2, "\t \r\n");
- i = strlen (line);
+ i = uaestrlen(line);
while (i > 0 && (line[i - 1] == '\t' || line[i - 1] == ' '
|| line[i - 1] == '\r' || line[i - 1] == '\n'))
line[--i] = '\0';
*line2++ = '\0';
/* Get rid of whitespace. */
- i = _tcslen (line2);
+ i = uaetcslen(line2);
while (i > 0 && (line2[i - 1] == '\t' || line2[i - 1] == ' '
|| line2[i - 1] == '\r' || line2[i - 1] == '\n'))
line2[--i] = '\0';
line2 += _tcsspn (line2, _T("\t \r\n"));
_tcscpy (line2b, line2);
- i = _tcslen (line);
+ i = uaetcslen(line);
while (i > 0 && (line[i - 1] == '\t' || line[i - 1] == ' '
|| line[i - 1] == '\r' || line[i - 1] == '\n'))
line[--i] = '\0';
{
TCHAR tmp[CONFIG_BLEN];
int j = 0;
- int inlen = _tcslen (in);
+ int inlen = uaetcslen(in);
int joker = 0;
uae_u32 err = 0;
bool configsearchfound = false;
xfree (parms_in);
if (out && outsize > 0) {
parms_out = ua (out_p);
- if (!trap_valid_address(ctx, out, strlen(parms_out) + 1 > outsize ? outsize : strlen(parms_out) + 1))
+ if (!trap_valid_address(ctx, out, strlen(parms_out) + 1 > outsize ? outsize : uaestrlen(parms_out) + 1))
return 0;
trap_put_string(ctx, parms_out, out, outsize - 1);
}
strlist *sl;
int len = 0;
for (sl = error_lines; sl; sl = sl->next) {
- len += _tcslen (sl->option) + 1;
+ len += uaetcslen(sl->option) + 1;
}
if (!len)
return NULL;
if (len == -1) {
dbuf = xmalloc(char, MAX_DPATH);
trap_get_string(ctx, dbuf, io_data, MAX_DPATH);
- len = strlen(dbuf);
+ len = uaestrlen(dbuf);
} else {
dbuf = xmalloc(char, len);
trap_get_bytes(ctx, dbuf, io_data, len);
while (*cs) {
for (int i = 0; memwatch_access_masks[i].mask; i++) {
const TCHAR *n = memwatch_access_masks[i].name;
- int len = _tcslen(n);
+ int len = uaetcslen(n);
if (!_tcsnicmp(cs, n, len)) {
if (cs[len] == 0 || cs[len] == 10 || cs[len] == 13 || cs[len] == ' ') {
mwn->access_mask |= memwatch_access_masks[i].mask;
static int parsetrainerdata(const TCHAR *data, uae_u16 *outdata, uae_u16 *outmask)
{
- int len = _tcslen(data);
+ int len = uaetcslen(data);
uae_u16 v = 0, vm = 0;
int j = 0;
for (int i = 0; i < len; ) {
struct trainerpatch *tp = xcalloc(struct trainerpatch, 1);
- int datalen = (_tcslen(data) + 3) / 4;
+ int datalen = (uaetcslen(data) + 3) / 4;
tp->data = xcalloc(uae_u16, datalen);
tp->maskdata = xcalloc(uae_u16, datalen);
tp->length = parsetrainerdata(data, tp->data, tp->maskdata);
tp->offset = 0;
if (ini_getstring_multi(ini, section, _T("replacedata"), &data, &ictx)) {
- int replacedatalen = (_tcslen(data) + 3) / 4;
+ int replacedatalen = (uaetcslen(data) + 3) / 4;
tp->replacedata = xcalloc(uae_u16, replacedatalen);
tp->replacemaskdata = xcalloc(uae_u16, replacedatalen);
tp->replacelength = parsetrainerdata(data, tp->replacedata, tp->replacemaskdata);
break;
if (gotm) {
bool got = false;
- buffersize = MAX_DPATH - strlen(out);
+ buffersize = MAX_DPATH - uaestrlen(out);
if (buffersize <= 1)
break;
if (c == '%') {
s[MAX_SOURCELINELEN] = 0;
}
cf->lineptr[linecnt++] = s;
- int len = strlen((char*)s);
+ int len = uaestrlen((char*)s);
if (len > 0 && s[len - 1] == 13)
s[len - 1] = 0;
}
if (!zfile_fgetsa(line, sizeof(line), zf))
break;
for (;;) {
- int len = strlen(line);
+ int len = uaestrlen(line);
if (len < 1)
break;
char c = line[len - 1];
{
for (int i = 0; i < libnamecnt; i++) {
struct libname *libname = &libnames[i];
- int lnlen = _tcslen(libname->name);
+ int lnlen = uaetcslen(libname->name);
// "libname/lvoname"?
if (!_tcsnicmp(name, libname->name, lnlen) && _tcslen(name) > lnlen + 1 && name[lnlen] == '/') {
for (int j = 0; j < libsymbolcnt; j++) {
}
#endif
- if (maxsize > _tcslen(txt)) {
+ if (maxsize > uaetcslen(txt)) {
if (found)
_tcscat(out, _T("\n"));
_tcscat(out, txt);
- maxsize -= _tcslen(txt);
+ maxsize -= uaetcslen(txt);
}
}
found = i + 1;
TCHAR txt[256];
last_codefile = cf;
_stprintf(txt, _T("Source file: %s\n"), cf->name);
- if (maxsize > _tcslen(txt)) {
+ if (maxsize > uaetcslen(txt)) {
_tcscat(out, txt);
- maxsize -= _tcslen(txt);
+ maxsize -= uaetcslen(txt);
}
}
if (lastline - line > 10)
for (int j = line; j < lastline; j++) {
TCHAR txt[256];
TCHAR *s = au((uae_char*)cf->lineptr[j]);
- if (maxsize > 6 + _tcslen(s) + 2) {
+ if (maxsize > 6 + uaetcslen(s) + 2) {
_stprintf(txt, _T("%5d %s\n"), j, s);
_tcscat(out, txt);
- maxsize -= _tcslen(txt) + 2;
+ maxsize -= uaetcslen(txt) + 2;
}
xfree(s);
}
}
const TCHAR *s2 = _tcschr(tmp, '%');
if (s2) {
- int len = _tcslen(disasm_hexprefix);
+ int len = uaetcslen(disasm_hexprefix);
if (s2 > tmp && s2[-1] == '$') {
len--;
s2--;
}
if (len < 0) {
- memmove(tmp + (s2 - tmp), tmp + (s2 - tmp) - len, (_tcslen(tmp + (s2 - tmp) - len) + 1) * sizeof(TCHAR));
+ memmove(tmp + (s2 - tmp), tmp + (s2 - tmp) - len, (uaetcslen(tmp + (s2 - tmp) - len) + 1) * sizeof(TCHAR));
} else {
if (len > 0) {
- memmove(tmp + (s2 - tmp) + len, s2, (_tcslen(s2) + 1) * sizeof(TCHAR));
+ memmove(tmp + (s2 - tmp) + len, s2, (uaetcslen(s2) + 1) * sizeof(TCHAR));
}
- memcpy(tmp + (s2 - tmp), disasm_hexprefix, _tcslen(disasm_hexprefix) * sizeof(TCHAR));
+ memcpy(tmp + (s2 - tmp), disasm_hexprefix, uaetcslen(disasm_hexprefix) * sizeof(TCHAR));
}
}
return tmp;
int quick = 0;
bool immrelpc = false;
- if (_tcslen(sline) > 100)
+ if (uaetcslen(sline) > 100)
return -1;
srcea[0] = dstea[0] = 0;
}
*p = 0;
- to_upper(line, _tcslen(line));
+ to_upper(line, uaetcslen(line));
p = line;
while (*p && *p != ' ')
}
_tcscpy(ins, line);
- if (_tcslen(ins) == 0)
+ if (uaetcslen(ins) == 0)
return 0;
int size = 1;
}
if (dmode == Areg) {
- int l = _tcslen(ins);
+ int l = uaetcslen(ins);
if (l <= 2)
return -1;
TCHAR last = ins[l- 1];
bool fp = ins[0] == 'F';
int tsize = size;
- if (ins[_tcslen(ins) - 1] == 'Q' && _tcslen(ins) > 3 && !fp) {
+ if (ins[uaetcslen(ins) - 1] == 'Q' && uaetcslen(ins) > 3 && !fp) {
quick = 1;
- ins[_tcslen(ins) - 1] = 0;
+ ins[uaetcslen(ins) - 1] = 0;
if (inssize < 0)
tsize = 2;
}
TCHAR segout[256];
if (debugmem_get_symbol(segpc, segout, sizeof(segout) / sizeof(TCHAR))) {
_tcscat(segout, _T(":\n"));
- if (bufsize > _tcslen(segout)) {
- memmove(symbolpos + _tcslen(segout), symbolpos, (_tcslen(symbolpos) + 1) * sizeof(TCHAR));
- memcpy(symbolpos, segout, _tcslen(segout) * sizeof(TCHAR));
- bufsize -= _tcslen(segout);
- buf += _tcslen(segout);
- symbolpos += _tcslen(segout);
+ if (bufsize > uaetcslen(segout)) {
+ memmove(symbolpos + uaetcslen(segout), symbolpos, (uaetcslen(symbolpos) + 1) * sizeof(TCHAR));
+ memcpy(symbolpos, segout, uaetcslen(segout) * sizeof(TCHAR));
+ bufsize -= uaetcslen(segout);
+ buf += uaetcslen(segout);
+ symbolpos += uaetcslen(segout);
}
}
}
uae_u32 hash;
int i;
- hash = strlen (name);
- for(i = 0; i < strlen (name); i++) {
+ hash = uaestrlen(name);
+ for(i = 0; i < uaestrlen(name); i++) {
hash = hash * 13;
- hash = hash + toupper (name[i]);
+ hash = hash + toupper(name[i]);
hash = hash & 0x7ff;
}
hash = hash % ((FS_FLOPPY_BLOCKSIZE / 4) - 56);
{
int i;
- i = _tcslen (name) - 1;
+ i = uaetcslen(name) - 1;
while (i > 0) {
if (name[i] == '/' || name[i] == '\\') {
name[i] = 0;
int i;
_tcscpy(tmp, name);
- i = _tcslen (tmp) - 1;
+ i = uaetcslen(tmp) - 1;
while (i > 0) {
if (tmp[i] == '/' || tmp[i] == '\\') {
_tcscpy(name, tmp + i + 1);
oldaddrs[i] = addr;
if (j == i && addr != pc) {
if (enforcer_decode_hunk_and_offset (buf, addr)) {
- int l = _tcslen (buf);
+ int l = uaetcslen (buf);
if (ENFORCER_BUF_SIZE - (enforcer_buf_ptr - enforcer_buf) > l + 256) {
_tcscpy (enforcer_buf_ptr, buf);
{
if (!s)
return;
- while (_tcslen(s) > 0 && s[_tcslen(s) - 1] == ':')
- s[_tcslen(s) - 1] = 0;
+ while (uaetcslen(s) > 0 && s[uaetcslen(s) - 1] == ':')
+ s[uaetcslen(s) - 1] = 0;
}
static void stripspace (TCHAR *s)
{
if (!s)
return;
- for (int i = 0; i < _tcslen (s); i++) {
+ for (int i = 0; i < uaetcslen (s); i++) {
if (s[i] == ' ')
s[i] = '_';
}
{
if (!s)
return;
- if (_tcslen (s) <= len)
+ if (uaetcslen (s) <= len)
return;
s[len] = 0;
}
-static void fixcharset (TCHAR *s)
+static void fixcharset(TCHAR *s)
{
char tmp[MAX_DPATH];
if (!s)
return;
- ua_fs_copy (tmp, MAX_DPATH - 1, s, '_');
- au_fs_copy (s, strlen (tmp) + 1, tmp);
+ ua_fs_copy(tmp, MAX_DPATH - 1, s, '_');
+ au_fs_copy(s, uaestrlen(tmp) + 1, tmp);
}
TCHAR *validatevolumename (TCHAR *s, const TCHAR *def)
stripsemicolon (s);
fixcharset (s);
striplength (s, 30);
- if (_tcslen(s) == 0 && def) {
+ if (uaetcslen(s) == 0 && def) {
xfree(s);
s = my_strdup(def);
}
stripspace (s);
fixcharset (s);
striplength (s, 30);
- if (_tcslen(s) == 0 && def) {
+ if (uaetcslen(s) == 0 && def) {
xfree(s);
s = my_strdup(def);
}
else if (my_existsdir (path))
archivehd = 0;
- if (zv && zv->volumename && _tcslen(zv->volumename) > 0) {
+ if (zv && zv->volumename && uaetcslen(zv->volumename) > 0) {
nvol = my_strdup(zv->volumename);
nvol = validatevolumename (nvol, def);
return nvol;
}
- if ((!volname || _tcslen (volname) == 0) && path && archivehd >= 0) {
+ if ((!volname || uaetcslen (volname) == 0) && path && archivehd >= 0) {
p = my_strdup (path);
- for (i = _tcslen (p) - 1; i >= 0; i--) {
+ for (i = uaetcslen (p) - 1; i >= 0; i--) {
TCHAR c = p[i];
if (c == ':' || c == '/' || c == '\\') {
- if (i == _tcslen (p) - 1)
+ if (i == uaetcslen (p) - 1)
continue;
if (!_tcscmp (p + i, _T(":\\"))) {
xfree (p);
nvol = my_strdup (p + i);
}
if (!nvol && archivehd >= 0) {
- if (volname && _tcslen (volname) > 0)
+ if (volname && uaetcslen (volname) > 0)
nvol = my_strdup (volname);
else
nvol = my_strdup (def);
}
if (!nvol) {
- if (volname && _tcslen (volname))
+ if (volname && uaetcslen (volname))
nvol = my_strdup (volname);
else
nvol = my_strdup (_T(""));
for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
if (nr == i || !mountinfo.ui[i].open || mountinfo.ui[i].rootdir == NULL || is_hardfile (i) == FILESYS_CD)
continue;
- if (_tcslen(c.rootdir) > 0 && samepath(mountinfo.ui[i].rootdir, c.rootdir)) {
+ if (uaetcslen(c.rootdir) > 0 && samepath(mountinfo.ui[i].rootdir, c.rootdir)) {
error_log (_T("directory/hardfile '%s' already added."), c.rootdir);
return -1;
}
ui->volname = filesys_createvolname (c.volname, c.rootdir, ui->zarchive, _T("harddrive"));
ui->volflags = flags;
TCHAR *vs = au(UAEFS_VERSION);
- TCHAR *vsp = vs + _tcslen(vs) - 1;
+ TCHAR *vsp = vs + uaetcslen(vs) - 1;
while (vsp != vs) {
if (*vsp == ' ') {
*vsp++ = 0;
char *s;
s = ua_fs (unit->ui.volname, -1);
- namelen = strlen (s);
+ namelen = uaestrlen(s);
if (namelen >= 58)
namelen = 58;
put_byte(unit->volume + 64, namelen);
if (volume)
u->newvolume = my_strdup (volume);
filesys_eject (u->unit);
- if (!rootdir || _tcslen (rootdir) == 0)
+ if (!rootdir || uaetcslen (rootdir) == 0)
u->reinsertdelay = 0;
if (u->reinsertdelay > 0)
write_log (_T("FILESYS: delayed insert %d: '%s' ('%s')\n"), u->unit, volume ? volume : _T("<none>"), rootdir);
if (is_virtual (u->unit)) {
ui = &mountinfo.ui[u->unit];
// inserted >= 2: drag&drop insert, do not replace existing normal drives
- if (inserted < 2 && ui->rootdir && !memcmp (ui->rootdir, rootdir, _tcslen (rootdir)) && _tcslen (rootdir) + 3 >= _tcslen (ui->rootdir)) {
+ if (inserted < 2 && ui->rootdir && !memcmp (ui->rootdir, rootdir, uaetcslen (rootdir)) && uaetcslen (rootdir) + 3 >= uaetcslen (ui->rootdir)) {
if (filesys_isvolume(u) && inserted) {
if (uci)ctx,
filesys_delayed_change (u, 50, rootdir, uci->ci.volname, uci->ci.readonly, 0);
static void update_child_names (Unit *unit, a_inode *a, a_inode *parent)
{
- int l0 = _tcslen (parent->nname) + 2;
+ int l0 = uaetcslen (parent->nname) + 2;
while (a != 0) {
TCHAR *name_start;
write_log (_T("malformed file name"));
}
name_start++;
- new_name = xmalloc (TCHAR, _tcslen (name_start) + l0);
+ new_name = xmalloc (TCHAR, uaetcslen (name_start) + l0);
_tcscpy (new_name, parent->nname);
_tcscat (new_name, dirsep);
_tcscat (new_name, name_start);
TCHAR *build_nname (const TCHAR *d, const TCHAR *n)
{
TCHAR dsep[2] = { FSDB_DIR_SEPARATOR, 0 };
- TCHAR *p = xmalloc (TCHAR, _tcslen (d) + 1 + _tcslen (n) + 1);
+ TCHAR *p = xmalloc (TCHAR, uaetcslen (d) + 1 + uaetcslen (n) + 1);
_tcscpy (p, d);
_tcscat (p, dsep);
_tcscat (p, n);
TCHAR *build_aname (const TCHAR *d, const TCHAR *n)
{
- TCHAR *p = xmalloc (TCHAR, _tcslen (d) + 1 + _tcslen (n) + 1);
+ TCHAR *p = xmalloc (TCHAR, uaetcslen (d) + 1 + uaetcslen (n) + 1);
_tcscpy (p, d);
_tcscat (p, _T("/"));
_tcscat (p, n);
static a_inode *lookup_child_aino (Unit *unit, a_inode *base, TCHAR *rel, int *err)
{
a_inode *c = base->child;
- int l0 = _tcslen (rel);
+ int l0 = uaetcslen (rel);
aino_test (base);
aino_test (c);
}
while (c != 0) {
- int l1 = _tcslen (c->aname);
+ int l1 = uaetcslen (c->aname);
if (l0 <= l1 && same_aname (rel, c->aname + l1 - l0)
&& (l0 == l1 || c->aname[l1-l0-1] == '/') && c->mountcount == unit->mountcount)
break;
static a_inode *lookup_child_aino_for_exnext (Unit *unit, a_inode *base, TCHAR *rel, uae_u32 *err, uae_u64 uniq_external, struct virtualfilesysobject *vfso)
{
a_inode *c = base->child;
- int l0 = _tcslen (rel);
+ int l0 = uaetcslen (rel);
int isvirtual = unit->volflags & (MYVOLUMEINFO_ARCHIVE | MYVOLUMEINFO_CDFS);
aino_test (base);
*err = 0;
while (c != 0) {
- int l1 = _tcslen (c->nname);
+ int l1 = uaetcslen (c->nname);
/* Note: using _tcscmp here. */
if (l0 <= l1 && _tcscmp (rel, c->nname + l1 - l0) == 0
&& (l0 == l1 || c->nname[l1-l0-1] == FSDB_DIR_SEPARATOR) && c->mountcount == unit->mountcount)
}
#endif
- p = name + _tcslen (name) - 1;
+ p = name + uaetcslen (name) - 1;
if (p[0] == ':')
p--;
while (p > name && p[0] != ':' && p[0] != '/')
_tcscat (path, a->aname);
_tcscat (path, _T(":"));
} else {
- if (path[0] && path[_tcslen (path) - 1] != ':')
+ if (path[0] && path[uaetcslen (path) - 1] != ':')
_tcscat (path, _T("/"));
_tcscat (path, a->aname);
}
a = find_aino(ctx, unit, lock, namep, &err);
if (err != ERROR_IS_SOFT_LINK)
break;
- for (i = _tcslen (namep) - 1; i > 0; i--) {
+ for (i = uaetcslen (namep) - 1; i > 0; i--) {
if (namep[i] == '/') {
namep[i] = 0;
xfree (extrapath);
TRACE((_T("name=\"%s\"\n"), xs));
x2 = x = ua_fs (xs, -1);
- n = strlen (x);
+ n = uaestrlen(x);
if (n > 107)
n = 107;
if (n > abs(currprefs.filesys_max_name))
if (!xs)
xs= _T("");
x2 = x = ua_fs(xs, -1);
- n = strlen(x);
+ n = uaestrlen(x);
if (n > 78)
n = 78;
put_byte_host(buf + i, n); i++;
size2 = 4;
if (type >= 1) {
size2 += 4;
- size += strlen (x) + 1;
+ size += uaestrlen(x) + 1;
size = (size + 3) & ~3;
}
if (type >= 2)
commentx = _T("");
else
commentx = aino->comment;
- comment = ua_fs (commentx, -1);
- size += strlen (comment) + 1;
+ comment = ua_fs(commentx, -1);
+ size += uaestrlen(comment) + 1;
size = (size + 3) & ~3;
}
if (type >= 7) {
static bool filesys_name_invalid(const TCHAR *fn)
{
- return _tcslen (fn) > currprefs.filesys_max_name;
+ return uaetcslen (fn) > currprefs.filesys_max_name;
}
static int filesys_readdir(struct fs_dirhandle *d, TCHAR *fn, uae_u64 *uniq)
static void inject_icons_to_directory(Unit *unit, a_inode *base)
{
for (a_inode *aino = base->child; aino; aino = aino->sibling) {
- int len = _tcslen(aino->aname);
+ int len = uaetcslen(aino->aname);
if (len >= 5 && !_tcsicmp(aino->aname + len - 5, _T(".info")))
continue;
TCHAR tmp[256];
if (fsdb_cando (unit)) {
commented = bstr(ctx, unit, comment);
- if (_tcslen (commented) > 80) {
+ if (uaetcslen (commented) > 80) {
PUT_PCK_RES1 (packet, DOS_FALSE);
PUT_PCK_RES2 (packet, ERROR_COMMENT_TOO_BIG);
return;
}
- if (_tcslen (commented) > 0) {
+ if (uaetcslen (commented) > 0) {
TCHAR *p = commented;
commented = xmalloc (TCHAR, 81);
_tcsncpy (commented, p, 80);
while (modified) {
modified = 0;
if (device_isdup (ctx, expbase, newname)) {
- if (_tcslen (newname) > 2 && newname[_tcslen (newname) - 2] == '_') {
- newname[_tcslen (newname) - 1]++;
+ if (uaetcslen (newname) > 2 && newname[uaetcslen (newname) - 2] == '_') {
+ newname[uaetcslen (newname) - 1]++;
} else {
_tcscat (newname, _T("_0"));
}
} else {
dt[j++] = '\\';
_stprintf (&dt[j], _T("%d"), c);
- j += _tcslen (&dt[j]);
+ j += uaetcslen (&dt[j]);
}
}
dt[j] = 0;
TCHAR buffer[80];
uaecptr expbase = trap_get_long(ctx, parmpacket + PP_EXPLIB);
- if (*devname == 0 || _tcslen (*devname) == 0) {
+ if (*devname == 0 || uaetcslen (*devname) == 0) {
int un = unit_no;
for (;;) {
_stprintf (buffer, type == FILESYS_CD ? _T("CD%d") : _T("DH%d"), un++);
static uaecptr getfakefilesysseg (UnitInfo *uip)
{
- if (uip->filesysdir && _tcslen (uip->filesysdir) > 0) {
+ if (uip->filesysdir && uaetcslen (uip->filesysdir) > 0) {
for (int i = 0; &mountinfo.ui[i] != uip; i++) {
UnitInfo *uip2 = &mountinfo.ui[i];
if (!uip2->filesysdir)
}
tmp[0] = 0;
- if (uip->filesysdir && _tcslen (uip->filesysdir) > 0) {
+ if (uip->filesysdir && uaetcslen (uip->filesysdir) > 0) {
cfgfile_resolve_path_out_load(uip->filesysdir, tmp, MAX_DPATH, PATH_HDF);
} else if ((dostype & 0xffffff00) == DISK_TYPE_DOS) {
_tcscpy (tmp, currprefs.romfile);
- int i = _tcslen (tmp);
+ int i = uaetcslen (tmp);
while (i > 0 && tmp[i - 1] != '/' && tmp[i - 1] != '\\')
i--;
_tcscpy (tmp + i, _T("FastFileSystem"));
/* iterate from root to last to previous path part,
* create ainos if not already created.
*/
- path = xcalloc(TCHAR, _tcslen (npath) + 2);
+ path = xcalloc(TCHAR, uaetcslen (npath) + 2);
cnt = 1;
for (;;) {
_tcscpy (path, npath);
{
TCHAR *pn;
/* create native path. FIXME: handle 'illegal' characters */
- pn = xcalloc (TCHAR, _tcslen (apath) + 1 + _tcslen (ui->rootdir) + 1);
+ pn = xcalloc (TCHAR, uaetcslen (apath) + 1 + uaetcslen (ui->rootdir) + 1);
_stprintf (pn, _T("%s/%s"), ui->rootdir, apath);
if (FSDB_DIR_SEPARATOR != '/') {
- for (int i = 0; i < _tcslen (pn); i++) {
+ for (int i = 0; i < uaetcslen (pn); i++) {
if (pn[i] == '/')
pn[i] = FSDB_DIR_SEPARATOR;
}
n->notifyrequest = restore_u32 ();
s = restore_string ();
- n->fullname = xmalloc (TCHAR, _tcslen (ui->volname) + 2 + _tcslen (s) + 1);
+ n->fullname = xmalloc (TCHAR, uaetcslen (ui->volname) + 2 + uaetcslen (s) + 1);
_stprintf (n->fullname, _T("%s:%s"), ui->volname, s);
xfree(s);
s = _tcsrchr (n->fullname, '/');
p = xcalloc (TCHAR, MAX_DPATH);
while (a) {
- int len = _tcslen (a->aname);
- memmove (p + len + 1, p, (_tcslen (p) + 1) * sizeof (TCHAR));
+ int len = uaetcslen (a->aname);
+ memmove (p + len + 1, p, (uaetcslen (p) + 1) * sizeof (TCHAR));
memcpy (p, a->aname, len * sizeof (TCHAR));
if (!first)
p[len] = '/';
TCHAR *s;
save_u32 (n->notifyrequest);
s = n->fullname;
- if (_tcslen (s) >= _tcslen (ui->volname) && !_tcsncmp (n->fullname, ui->volname, _tcslen (ui->volname)))
- s = n->fullname + _tcslen (ui->volname) + 1;
+ if (uaetcslen (s) >= uaetcslen (ui->volname) && !_tcsncmp (n->fullname, ui->volname, uaetcslen (ui->volname)))
+ s = n->fullname + uaetcslen (ui->volname) + 1;
save_string (s);
write_log (_T("FS: notify %08X '%s'\n"), n->notifyrequest, n->fullname);
return dst;
se2->file = strdup(tmp);
}
int size = ShellExecute2_Struct_Start + ShellExecute2_Struct_Start2;
- size += 2 * (strlen(se2->file) + 1);
+ size += 2 * (uaestrlen(se2->file) + 1);
if (oldks) {
- size += 4 + strlen(se2->currentdir) + 2; // CD_""\n
+ size += 4 + uaestrlen(se2->currentdir) + 2; // CD_""\n
}
- size += strlen(se2->currentdir) + 1;
- size += 2 * (strlen(se2->parms) + 1);
+ size += uaestrlen(se2->currentdir) + 1;
+ size += 2 * (uaestrlen(se2->parms) + 1);
size += 32; // space for tmp_out
size += 256; // space for out buffer
size++;
strp[1] = strp[0];
strp++;
// add trailing zeros
- i = strlen (strp);
+ i = uaestrlen(strp);
cp = strp + i;
while (i < ndigits) {
*cp++ = '0';
int i, len;
char *s;
- s = ua (src);
- len = strlen (s);
+ s = ua(src);
+ len = uaestrlen(s);
for (i = 0; i < max; i += 2) {
char c1 = ' ';
if (i < len)
extern void unicode_init (void);
extern void to_lower (TCHAR *s, int len);
extern void to_upper (TCHAR *s, int len);
+extern int uaestrlen(const char*);
+extern int uaetcslen(const TCHAR*);
#define ENUMDECL typedef enum
#define ENUMNAME(name) name
void trap_put_quad(TrapContext *ctx, uaecptr addr, uae_u64 v);
void trap_put_long(TrapContext *ctx, uaecptr addr, uae_u32 v);
+void trap_put_longt(TrapContext *ctx, uaecptr addr, size_t v);
void trap_put_word(TrapContext *ctx, uaecptr addr, uae_u16 v);
void trap_put_byte(TrapContext *ctx, uaecptr addr, uae_u8 v);
if (!ini_getstring_multi(ini, section, key, &out2, ctx))
return false;
- len = _tcslen(out2);
+ len = uaetcslen(out2);
outp = xcalloc(uae_u8, len);
if (!outp)
goto err;
int l = p[0];
char t = p[l];
p[l] = 0;
- au_copy (inode->i_comment + _tcslen (inode->i_comment), maxcomment + 1 - _tcslen (inode->i_comment), p + 1);
+ au_copy (inode->i_comment + uaetcslen (inode->i_comment), maxcomment + 1 - uaetcslen (inode->i_comment), p + 1);
p[l] = t;
}
break;
uae_s8 *target_p = (uae_s8 *)x86_get_target() + 1;
JCCSii(cc^1, 0);
MOVLrr(s, d);
- *target_p = (uintptr)x86_get_target() - ((uintptr)target_p + 1);
+ *target_p = JITPTR x86_get_target() - (JITPTR target_p + 1);
}
}
uae_s8 *target_p = (uae_s8 *)x86_get_target() + 1;
JCCSii(cond^1, 0);
ADDR32 MOVLmr(base, X86_NOREG, index, factor, d);
- *target_p = (uintptr)x86_get_target() - ((uintptr)target_p + 1);
+ *target_p = JITPTR x86_get_target() - (JITPTR target_p + 1);
}
}
uae_s8 *target_p = (uae_s8 *)x86_get_target() + 1;
JCCSii(cond^1, 0);
ADDR32 MOVLmr(mem, X86_NOREG, X86_NOREG, 1, d);
- *target_p = (uintptr)x86_get_target() - ((uintptr)target_p + 1);
+ *target_p = JITPTR x86_get_target() - (JITPTR target_p + 1);
}
}
static inline void raw_jl(uae_u32 t)
{
raw_jcc_l_oponly(NATIVE_CC_LT);
- emit_long(t-(uae_u32)(uintptr)target-4);
+ emit_long(t-(uae_u32)JITPTR target-4);
}
static inline void raw_jz(uae_u32 t)
{
raw_jz_l_oponly();
- emit_long(t-(uae_u32)(uintptr)target-4);
+ emit_long(t-(uae_u32)JITPTR target-4);
}
static inline void raw_jnz(uae_u32 t)
{
raw_jnz_l_oponly();
- emit_long(t-(uae_u32)(uintptr)target-4);
+ emit_long(t-(uae_u32)JITPTR target-4);
}
static inline void raw_jcc_b_oponly(int cc)
{
raw_lahf(0); /* Most flags in AH */
//raw_setcc(r,0); /* V flag in AL */
- raw_setcc_m((uintptr)live.state[FLAGTMP].mem,0);
+ raw_setcc_m(JITPTR live.state[FLAGTMP].mem,0);
#if 1 /* Let's avoid those nasty partial register stalls */
- //raw_mov_b_mr((uintptr)live.state[FLAGTMP].mem,r);
- raw_mov_b_mr(((uintptr)live.state[FLAGTMP].mem)+1,AH_INDEX);
+ //raw_mov_b_mr(JITPTR live.state[FLAGTMP].mem,r);
+ raw_mov_b_mr((JITPTR live.state[FLAGTMP].mem)+1,AH_INDEX);
raw_flags_evicted(r);
#endif
}
{
raw_pushfl();
raw_pop_l_r(r);
- raw_mov_l_mr((uintptr)live.state[FLAGTMP].mem,r);
+ raw_mov_l_mr(JITPTR live.state[FLAGTMP].mem,r);
raw_flags_evicted(r);
}
assert(r == 0);
raw_setcc(r,0); /* V flag in AL */
raw_lea_l_r_scaled(0,0,8); /* move it to its EFLAGS location */
- raw_mov_b_mr(((uintptr)live.state[FLAGTMP].mem)+1,0);
+ raw_mov_b_mr((JITPTR live.state[FLAGTMP].mem)+1,0);
raw_lahf(0); /* most flags in AH */
- raw_mov_b_mr((uintptr)live.state[FLAGTMP].mem,AH_INDEX);
+ raw_mov_b_mr(JITPTR live.state[FLAGTMP].mem,AH_INDEX);
raw_flags_evicted(r);
}
else
static inline void raw_load_flagreg(uae_u32 target)
{
/* attention: in 64bit mode, relies on LITTE_ENDIANESS of regflags.cznv */
- raw_mov_l_rm(target,(uintptr)live.state[FLAGTMP].mem);
+ raw_mov_l_rm(target,JITPTR live.state[FLAGTMP].mem);
}
static inline void raw_load_flagx(uae_u32 target)
{
#if FLAGBIT_X < 8
if (live.nat[target].canbyte)
- raw_mov_b_rm(target,(uintptr)live.state[FLAGX].mem);
+ raw_mov_b_rm(target,JITPTR live.state[FLAGX].mem);
else
#endif
if (live.nat[target].canword)
- raw_mov_w_rm(target,(uintptr)live.state[FLAGX].mem);
+ raw_mov_w_rm(target,JITPTR live.state[FLAGX].mem);
else
- raw_mov_l_rm(target,(uintptr)live.state[FLAGX].mem);
+ raw_mov_l_rm(target,JITPTR live.state[FLAGX].mem);
}
static inline void raw_dec_sp(int off)
rs = stackpos(r)+1;
/* Lower bound onto stack */
- raw_fldl((uintptr) &bounds[0]); /* fld double from lower */
+ raw_fldl(JITPTR &bounds[0]); /* fld double from lower */
/* Clamp to lower */
emit_byte(0xdb);
/* Upper bound onto stack */
emit_byte(0xdd);
emit_byte(0xd8); /* fstp st(0) */
- raw_fldl((uintptr) &bounds[1]); /* fld double from upper */
+ raw_fldl(JITPTR &bounds[1]); /* fld double from upper */
/* Clamp to upper */
emit_byte(0xdb);
emit_byte(0xe1); /* fsub frac(x) = x - int(x) */
emit_byte(0xd9);
emit_byte(0xf0); /* f2xm1 (2^frac(x))-1 */
- x86_fadd_m((uintptr) &one); /* Add '1' without using extra stack space */
+ x86_fadd_m(JITPTR &one); /* Add '1' without using extra stack space */
emit_byte(0xd9);
emit_byte(0xfd); /* fscale (2^frac(x))*2^int(x) */
emit_byte(0xdd);
emit_byte(0xe1); /* subtract rounded from original */
emit_byte(0xd9);
emit_byte(0xf0); /* f2xm1 */
- x86_fadd_m((uintptr)&one); /* Add '1' without using extra stack space */
+ x86_fadd_m(JITPTR &one); /* Add '1' without using extra stack space */
emit_byte(0xd9);
emit_byte(0xfd); /* and scale it */
emit_byte(0xdd);
emit_byte(0xe1); /* fsub x*log2(10) - int(x*log2(10)) */
emit_byte(0xd9);
emit_byte(0xf0); /* f2xm1 (2^frac(x))-1 */
- x86_fadd_m((uintptr) &one);
+ x86_fadd_m(JITPTR &one);
emit_byte(0xd9);
emit_byte(0xfd); /* fscale (2^frac(x))*2^int(x*log2(10)) */
emit_byte(0xdd);
emit_byte(0xc9); /* fxch swap x with sqrt(1-(x^2)) */
emit_byte(0xd9);
emit_byte(0xf3); /* fpatan atan(x/sqrt(1-(x^2))) & pop */
- raw_fldt((uintptr) &pihalf); /* fld load pi/2 from pihalf */
+ raw_fldt(JITPTR &pihalf); /* fld load pi/2 from pihalf */
emit_byte(0xde);
emit_byte(0xe1); /* fsubrp pi/2 - asin(x) & pop */
tos_make(d); /* store y=acos(x) */
emit_byte(0xe1); /* fsub -x*log2(e) - int(-x*log2(e)) */
emit_byte(0xd9);
emit_byte(0xf0); /* f2xm1 (2^frac(x))-1 */
- x86_fadd_m((uintptr) &one);
+ x86_fadd_m(JITPTR &one);
emit_byte(0xd9);
emit_byte(0xfd); /* fscale (2^frac(x))*2^int(x*log2(e)) */
emit_byte(0xd9);
emit_byte(0xe1); /* fsub x*log2(e) - int(x*log2(e)) */
emit_byte(0xd9);
emit_byte(0xf0); /* f2xm1 (2^frac(x))-1 */
- x86_fadd_m((uintptr) &one);
+ x86_fadd_m(JITPTR &one);
emit_byte(0xd9);
emit_byte(0xfd); /* fscale (2^frac(x))*2^int(x*log2(e)) */
emit_byte(0xdd);
emit_byte(0xe1); /* fsub -x*log2(e) - int(-x*log2(e)) */
emit_byte(0xd9);
emit_byte(0xf0); /* f2xm1 (2^frac(x))-1 */
- x86_fadd_m((uintptr) &one);
+ x86_fadd_m(JITPTR &one);
emit_byte(0xd9);
emit_byte(0xfd); /* fscale (2^frac(x))*2^int(x*log2(e)) */
emit_byte(0xd9);
emit_byte(0xe1); /* fsub x*log2(e) - int(x*log2(e)) */
emit_byte(0xd9);
emit_byte(0xf0); /* f2xm1 (2^frac(x))-1 */
- x86_fadd_m((uintptr) &one);
+ x86_fadd_m(JITPTR &one);
emit_byte(0xd9);
emit_byte(0xfd); /* fscale (2^frac(x))*2^int(x*log2(e)) */
emit_byte(0xdd);
emit_byte(0xe1); /* fsub -x*log2(e) - int(-x*log2(e)) */
emit_byte(0xd9);
emit_byte(0xf0); /* f2xm1 (2^frac(x))-1 */
- x86_fadd_m((uintptr) &one);
+ x86_fadd_m(JITPTR &one);
emit_byte(0xd9);
emit_byte(0xfd); /* fscale (2^frac(x))*2^int(x*log2(e)) */
emit_byte(0xd9);
emit_byte(0xe1); /* fsub x*log2(e) - int(x*log2(e)) */
emit_byte(0xd9);
emit_byte(0xf0); /* f2xm1 (2^frac(x))-1 */
- x86_fadd_m((uintptr) &one);
+ x86_fadd_m(JITPTR &one);
emit_byte(0xd9);
emit_byte(0xfd); /* fscale (2^frac(x))*2^int(x*log2(e)) */
emit_byte(0xdd);
{
case 6: /* byte */
sign_extend_8_rr(S1, reg);
- mov_l_mr((uintptr) temp_fp, S1);
+ mov_l_mr(JITPTR temp_fp, S1);
delay2;
- fmovi_rm(FS1, (uintptr) temp_fp);
+ fmovi_rm(FS1, JITPTR temp_fp);
return FS1;
case 4: /* word */
sign_extend_16_rr(S1, reg);
- mov_l_mr((uintptr) temp_fp, S1);
+ mov_l_mr(JITPTR temp_fp, S1);
delay2;
- fmovi_rm(FS1, (uintptr) temp_fp);
+ fmovi_rm(FS1, JITPTR temp_fp);
return FS1;
case 0: /* long */
- mov_l_mr((uintptr) temp_fp, reg);
+ mov_l_mr(JITPTR temp_fp, reg);
delay2;
- fmovi_rm(FS1, (uintptr) temp_fp);
+ fmovi_rm(FS1, JITPTR temp_fp);
return FS1;
case 1: /* single precision */
- mov_l_mr((uintptr) temp_fp, reg);
+ mov_l_mr(JITPTR temp_fp, reg);
delay2;
- fmovs_rm(FS1, (uintptr) temp_fp);
+ fmovs_rm(FS1, JITPTR temp_fp);
return FS1;
default:
return -1;
break;
case 2: /* d16(pc) */
{
- uae_u32 address = start_pc + ((char *) comp_pc_p - (char *) start_pc_p) + m68k_pc_offset;
+ uae_u32 address = (uae_u32)(start_pc + ((char *) comp_pc_p - (char *) start_pc_p) + m68k_pc_offset);
uae_s32 PC16off = (uae_s32) (uae_s16) comp_get_iword((m68k_pc_offset += 2) - 2);
ad = S1;
return -1;
case 4: /* #imm */
{
- uae_u32 address = start_pc + ((char *) comp_pc_p - (char *) start_pc_p) + m68k_pc_offset;
+ uae_u32 address = (uae_u32)(start_pc + ((char *) comp_pc_p - (char *) start_pc_p) + m68k_pc_offset);
ad = S1;
// Immediate addressing mode && Operation Length == Byte ->
{
case 0: /* long */
readlong(ad, S2, S3);
- mov_l_mr((uintptr) temp_fp, S2);
+ mov_l_mr(JITPTR temp_fp, S2);
delay2;
- fmovi_rm(FS1, (uintptr) temp_fp);
+ fmovi_rm(FS1, JITPTR temp_fp);
break;
case 1: /* single precision */
readlong(ad, S2, S3);
- mov_l_mr((uintptr) temp_fp, S2);
+ mov_l_mr(JITPTR temp_fp, S2);
delay2;
- fmovs_rm(FS1, (uintptr) temp_fp);
+ fmovs_rm(FS1, JITPTR temp_fp);
break;
case 2: /* extended precision */
readword(ad, S2, S3);
- mov_w_mr(((uintptr) temp_fp) + 8, S2);
+ mov_w_mr((JITPTR temp_fp) + 8, S2);
add_l_ri(ad, 4);
readlong(ad, S2, S3);
// always set the explicit integer bit.
or_l_ri(S2, 0x80000000);
- mov_l_mr((uintptr) (temp_fp) + 4, S2);
+ mov_l_mr(JITPTR (temp_fp) + 4, S2);
add_l_ri(ad, 4);
readlong(ad, S2, S3);
- mov_l_mr((uintptr) (temp_fp), S2);
+ mov_l_mr(JITPTR (temp_fp), S2);
delay2;
- fmov_ext_rm(FS1, (uintptr) (temp_fp));
+ fmov_ext_rm(FS1, JITPTR (temp_fp));
break;
case 3: /* packed decimal static */
return -1; /* Some silly "packed" stuff */
case 4: /* word */
readword(ad, S2, S3);
sign_extend_16_rr(S2, S2);
- mov_l_mr((uintptr) temp_fp, S2);
+ mov_l_mr(JITPTR temp_fp, S2);
delay2;
- fmovi_rm(FS1, (uintptr) temp_fp);
+ fmovi_rm(FS1, JITPTR temp_fp);
break;
case 5: /* double precision */
readlong(ad, S2, S3);
- mov_l_mr(((uintptr) temp_fp) + 4, S2);
+ mov_l_mr((JITPTR temp_fp) + 4, S2);
add_l_ri(ad, 4);
readlong(ad, S2, S3);
- mov_l_mr((uintptr) (temp_fp), S2);
+ mov_l_mr(JITPTR (temp_fp), S2);
delay2;
- fmov_rm(FS1, (uintptr) (temp_fp));
+ fmov_rm(FS1, JITPTR (temp_fp));
break;
case 6: /* byte */
readbyte(ad, S2, S3);
sign_extend_8_rr(S2, S2);
- mov_l_mr((uintptr) temp_fp, S2);
+ mov_l_mr(JITPTR temp_fp, S2);
delay2;
- fmovi_rm(FS1, (uintptr) temp_fp);
+ fmovi_rm(FS1, JITPTR temp_fp);
break;
default:
return -1;
switch (size)
{
case 6: /* byte */
- fmovi_mrb((uintptr) temp_fp, val, clamp_bounds.b);
+ fmovi_mrb(JITPTR temp_fp, val, clamp_bounds.b);
delay;
- mov_b_rm(reg, (uintptr) temp_fp);
+ mov_b_rm(reg, JITPTR temp_fp);
return 0;
case 4: /* word */
- fmovi_mrb((uintptr) temp_fp, val, clamp_bounds.w);
+ fmovi_mrb(JITPTR temp_fp, val, clamp_bounds.w);
delay;
- mov_w_rm(reg, (uintptr) temp_fp);
+ mov_w_rm(reg, JITPTR temp_fp);
return 0;
case 0: /* long */
- fmovi_mrb((uintptr) temp_fp, val, clamp_bounds.l);
- fmovi_mr((uintptr) temp_fp, val);
+ fmovi_mrb(JITPTR temp_fp, val, clamp_bounds.l);
+ fmovi_mr(JITPTR temp_fp, val);
delay;
- mov_l_rm(reg, (uintptr) temp_fp);
+ mov_l_rm(reg, JITPTR temp_fp);
return 0;
case 1: /* single precision */
- fmovs_mr((uintptr) temp_fp, val);
+ fmovs_mr(JITPTR temp_fp, val);
delay;
- mov_l_rm(reg, (uintptr) temp_fp);
+ mov_l_rm(reg, JITPTR temp_fp);
return 0;
default:
return -1;
break;
case 2: /* d16(pc) */
{
- uae_u32 address = start_pc + ((char *) comp_pc_p - (char *) start_pc_p) + m68k_pc_offset;
+ uae_u32 address = (uae_u32)(start_pc + ((char *) comp_pc_p - (char *) start_pc_p) + m68k_pc_offset);
uae_s32 PC16off = (uae_s32) (uae_s16) comp_get_iword((m68k_pc_offset += 2) - 2);
ad = S1;
return -1;
case 4: /* #imm */
{
- uae_u32 address = start_pc + ((char *) comp_pc_p - (char *) start_pc_p) + m68k_pc_offset;
+ uae_u32 address = (uae_u32)(start_pc + ((char *) comp_pc_p - (char *) start_pc_p) + m68k_pc_offset);
ad = S1;
mov_l_ri(ad, address);
switch (size)
{
case 0: /* long */
- fmovi_mrb((uintptr) temp_fp, val, clamp_bounds.l);
+ fmovi_mrb(JITPTR temp_fp, val, clamp_bounds.l);
delay;
- mov_l_rm(S2, (uintptr) temp_fp);
+ mov_l_rm(S2, JITPTR temp_fp);
writelong_clobber(ad, S2, S3);
break;
case 1: /* single precision */
- fmovs_mr((uintptr) temp_fp, val);
+ fmovs_mr(JITPTR temp_fp, val);
delay;
- mov_l_rm(S2, (uintptr) temp_fp);
+ mov_l_rm(S2, JITPTR temp_fp);
writelong_clobber(ad, S2, S3);
break;
case 2: /* extended precision */
- fmov_ext_mr((uintptr) temp_fp, val);
+ fmov_ext_mr(JITPTR temp_fp, val);
delay;
- mov_w_rm(S2, (uintptr) temp_fp + 8);
+ mov_w_rm(S2, JITPTR temp_fp + 8);
writeword_clobber(ad, S2, S3);
add_l_ri(ad, 4);
- mov_l_rm(S2, (uintptr) temp_fp + 4);
+ mov_l_rm(S2, JITPTR temp_fp + 4);
writelong_clobber(ad, S2, S3);
add_l_ri(ad, 4);
- mov_l_rm(S2, (uintptr) temp_fp);
+ mov_l_rm(S2, JITPTR temp_fp);
writelong_clobber(ad, S2, S3);
break;
case 3: /* packed decimal static */
return -1; /* Packed */
case 4: /* word */
- fmovi_mrb((uintptr) temp_fp, val, clamp_bounds.w);
+ fmovi_mrb(JITPTR temp_fp, val, clamp_bounds.w);
delay;
- mov_l_rm(S2, (uintptr) temp_fp);
+ mov_l_rm(S2, JITPTR temp_fp);
writeword_clobber(ad, S2, S3);
break;
case 5: /* double precision */
- fmov_mr((uintptr) temp_fp, val);
+ fmov_mr(JITPTR temp_fp, val);
delay;
- mov_l_rm(S2, (uintptr) temp_fp + 4);
+ mov_l_rm(S2, JITPTR temp_fp + 4);
writelong_clobber(ad, S2, S3);
add_l_ri(ad, 4);
- mov_l_rm(S2, (uintptr) temp_fp);
+ mov_l_rm(S2, JITPTR temp_fp);
writelong_clobber(ad, S2, S3);
break;
case 6: /* byte */
- fmovi_mrb((uintptr) temp_fp, val, clamp_bounds.b);
+ fmovi_mrb(JITPTR temp_fp, val, clamp_bounds.b);
delay;
- mov_l_rm(S2, (uintptr) temp_fp);
+ mov_l_rm(S2, JITPTR temp_fp);
writebyte(ad, S2, S3);
break;
default:
mov_l_ri(S1, off);
return S1;
case 2: /* d16(pc) */
- off = start_pc + ((char *) comp_pc_p - (char *) start_pc_p) + m68k_pc_offset;
+ off = (uae_s32)(start_pc + ((char *) comp_pc_p - (char *) start_pc_p) + m68k_pc_offset);
off += (uae_s32) (uae_s16) comp_get_iword((m68k_pc_offset += 2) - 2);
mov_l_ri(S1, off);
return S1;
{
off = comp_get_ilong((m68k_pc_offset += 4) - 4);
}
- mov_l_ri(S1, (uintptr) (comp_pc_p + off - (m68k_pc_offset - start_68k_offset)));
- mov_l_ri(PC_P, (uintptr) comp_pc_p);
+ mov_l_ri(S1, JITPTR (comp_pc_p + off - (m68k_pc_offset - start_68k_offset)));
+ mov_l_ri(PC_P, JITPTR comp_pc_p);
/* Now they are both constant. Might as well fold in m68k_pc_offset */
add_l_ri(S1, m68k_pc_offset);
{
if (list & 0x80)
{
- fmov_ext_mr((uintptr) temp_fp, reg);
+ fmov_ext_mr(JITPTR temp_fp, reg);
delay;
sub_l_ri(ad, 4);
- mov_l_rm(S2, (uintptr) temp_fp);
+ mov_l_rm(S2, JITPTR temp_fp);
writelong_clobber(ad, S2, S3);
sub_l_ri(ad, 4);
- mov_l_rm(S2, (uintptr) temp_fp + 4);
+ mov_l_rm(S2, JITPTR temp_fp + 4);
writelong_clobber(ad, S2, S3);
sub_l_ri(ad, 4);
- mov_w_rm(S2, (uintptr) temp_fp + 8);
+ mov_w_rm(S2, JITPTR temp_fp + 8);
writeword_clobber(ad, S2, S3);
}
list <<= 1;
{
if (list & 0x80)
{
- fmov_ext_mr((uintptr) temp_fp, reg);
+ fmov_ext_mr(JITPTR temp_fp, reg);
delay;
- mov_w_rm(S2, (uintptr) temp_fp + 8);
+ mov_w_rm(S2, JITPTR temp_fp + 8);
writeword_clobber(ad, S2, S3);
add_l_ri(ad, 4);
- mov_l_rm(S2, (uintptr) temp_fp + 4);
+ mov_l_rm(S2, JITPTR temp_fp + 4);
writelong_clobber(ad, S2, S3);
add_l_ri(ad, 4);
- mov_l_rm(S2, (uintptr) temp_fp);
+ mov_l_rm(S2, JITPTR temp_fp);
writelong_clobber(ad, S2, S3);
add_l_ri(ad, 4);
}
{
sub_l_ri(ad, 4);
readlong(ad, S2, S3);
- mov_l_mr((uintptr) (temp_fp), S2);
+ mov_l_mr(JITPTR (temp_fp), S2);
sub_l_ri(ad, 4);
readlong(ad, S2, S3);
- mov_l_mr((uintptr) (temp_fp) + 4, S2);
+ mov_l_mr(JITPTR (temp_fp) + 4, S2);
sub_l_ri(ad, 4);
readword(ad, S2, S3);
- mov_w_mr(((uintptr) temp_fp) + 8, S2);
+ mov_w_mr((JITPTR temp_fp) + 8, S2);
delay2;
- fmov_ext_rm(reg, (uintptr) (temp_fp));
+ fmov_ext_rm(reg, JITPTR (temp_fp));
}
list <<= 1;
}
if (list & 0x80)
{
readword(ad, S2, S3);
- mov_w_mr(((uintptr) temp_fp) + 8, S2);
+ mov_w_mr((JITPTR temp_fp) + 8, S2);
add_l_ri(ad, 4);
readlong(ad, S2, S3);
- mov_l_mr((uintptr) (temp_fp) + 4, S2);
+ mov_l_mr(JITPTR (temp_fp) + 4, S2);
add_l_ri(ad, 4);
readlong(ad, S2, S3);
- mov_l_mr((uintptr) (temp_fp), S2);
+ mov_l_mr(JITPTR(temp_fp), S2);
add_l_ri(ad, 4);
delay2;
- fmov_ext_rm(reg, (uintptr) (temp_fp));
+ fmov_ext_rm(reg, JITPTR (temp_fp));
}
list <<= 1;
}
{
/* FPIAR: fixme; we cannot correctly return the address from compiled code */
#ifdef UAE
- mov_l_rm(opcode & 15, (uintptr)®s.fpiar);
+ mov_l_rm(opcode & 15, JITPTR ®s.fpiar);
#else
- mov_l_rm(opcode & 15, (uintptr) & fpu.instruction_address);
+ mov_l_rm(opcode & 15, JITPTR &fpu.instruction_address);
#endif
return;
}
{
/* FPIAR: does that make sense at all? */
#ifdef UAE
- mov_l_mr((uintptr)®s.fpiar, opcode & 15);
+ mov_l_mr(JITPTR ®s.fpiar, opcode & 15);
#else
- mov_l_mr((uintptr) & fpu.instruction_address, opcode & 15);
+ mov_l_mr(JITPTR &fpu.instruction_address, opcode & 15);
#endif
}
return;
{
uae_u32 val = comp_get_ilong((m68k_pc_offset += 4) - 4);
#ifdef UAE
- mov_l_mi((uintptr)®s.fpiar, val);
+ mov_l_mi(JITPTR ®s.fpiar, val);
#else
- mov_l_mi((uintptr) & fpu.instruction_address, val);
+ mov_l_mi(JITPTR &fpu.instruction_address, val);
#endif
}
return;
return;
}
mov_l_ri(S1, 16); /* Switch to "round to zero" mode */
- fldcw_m_indexed(S1, (uintptr) x86_fpucw);
+ fldcw_m_indexed(S1, JITPTR x86_fpucw);
frndint_rr(reg, src);
/* restore control word */
- mov_l_rm(S1, (uintptr) & regs.fpcr);
+ mov_l_rm(S1, JITPTR ®s.fpcr);
and_l_ri(S1, 0x000000f0);
- fldcw_m_indexed(S1, (uintptr) x86_fpucw);
+ fldcw_m_indexed(S1, JITPTR x86_fpucw);
MAKE_FPSR(reg);
break;
{
evict(FLAGX);
make_flags_live_internal();
- COMPCALL(setcc_m)((uintptr)live.state[FLAGX].mem, NATIVE_CC_CS);
+ COMPCALL(setcc_m)(JITPTR live.state[FLAGX].mem, NATIVE_CC_CS);
log_vwrite(FLAGX);
}
branchadd2 = get_target();
skip_byte();
- *branchadd4 = (uintptr)get_target() - ((uintptr)branchadd4 + 1);
+ *branchadd4 = JITPTR get_target() - (JITPTR branchadd4 + 1);
// Shift count: zero, same or larger than data size
// Need to update C, N and Z.
raw_popfl();
// Non-zero shift count.
// Do not modify C, N and Z.
// C -> X
- *branchadd2 = (uintptr)get_target() - ((uintptr)branchadd2 + 1);
+ *branchadd2 = JITPTR get_target() - (JITPTR branchadd2 + 1);
raw_popfl();
// Execute "duplicate_carry()"
- COMPCALL(setcc_m)((uintptr)live.state[FLAGX].mem, NATIVE_CC_CS);
+ COMPCALL(setcc_m)(JITPTR live.state[FLAGX].mem, NATIVE_CC_CS);
log_vwrite(FLAGX);
raw_jmp_b_oponly();
branchadd3 = get_target();
skip_byte();
// Zero shift count after CNZ adjustments
- *branchadd1 = (uintptr)get_target() - ((uintptr)branchadd1 + 1);
+ *branchadd1 = JITPTR get_target() - (JITPTR branchadd1 + 1);
raw_popfl();
- *branchadd3 = (uintptr)get_target() - ((uintptr)branchadd3 + 1);
+ *branchadd3 = JITPTR get_target() - (JITPTR branchadd3 + 1);
}
/*
}
static inline void emit_jmp_target(uae_u32 a) {
- emit_long(a-((uintptr)target+4));
+ emit_long(a-(JITPTR target+4));
}
#define vm_protect(address, size, protect) uae_vm_protect(address, size, protect)
#define vm_release(address, size) uae_vm_free(address, size)
-static inline void *vm_acquire(size_t size, int options = VM_MAP_DEFAULT)
+static inline void *vm_acquire(uae_u32 size, int options = VM_MAP_DEFAULT)
{
assert(options == (VM_MAP_DEFAULT | VM_MAP_32BIT));
return uae_vm_alloc(size, UAE_VM_32BIT, UAE_VM_READ_WRITE);
else if (r == FLAGX)
raw_load_flagx(n);
else
- compemu_raw_mov_l_rm(n, (uintptr) live.state[r].mem);
+ compemu_raw_mov_l_rm(n, JITPTR live.state[r].mem);
}
#if 0
if (live.state[r].status==DIRTY) {
switch (live.state[r].dirtysize) {
- case 1: compemu_raw_mov_b_mr((uintptr)live.state[r].mem,rr); break;
- case 2: compemu_raw_mov_w_mr((uintptr)live.state[r].mem,rr); break;
- case 4: compemu_raw_mov_l_mr((uintptr)live.state[r].mem,rr); break;
+ case 1: compemu_raw_mov_b_mr(JITPTR live.state[r].mem,rr); break;
+ case 2: compemu_raw_mov_w_mr(JITPTR live.state[r].mem,rr); break;
+ case 4: compemu_raw_mov_l_mr(JITPTR live.state[r].mem,rr); break;
default: abort();
}
log_vwrite(r);
jit_abort("Trying to write back constant NF_HANDLER!");
}
- compemu_raw_mov_l_mi((uintptr)live.state[r].mem,live.state[r].val);
+ compemu_raw_mov_l_mi(JITPTR live.state[r].mem,live.state[r].val);
log_vwrite(r);
live.state[r].val=0;
set_status(r,INMEM);
if (size==4 && live.state[r].validsize==2) {
log_isused(bestreg);
log_visused(r);
- compemu_raw_mov_l_rm(bestreg,(uintptr)live.state[r].mem);
+ compemu_raw_mov_l_rm(bestreg, JITPTR live.state[r].mem);
compemu_raw_bswap_32(bestreg);
compemu_raw_zero_extend_16_rr(rr,rr);
compemu_raw_zero_extend_16_rr(bestreg,bestreg);
uae_u8 *branchadd = get_target();
skip_byte();
#endif
- mov_l_mr((uintptr)®s.usp, SP_REG);
+ mov_l_mr(JITPTR ®s.usp, SP_REG);
mov_l_rm(SP_REG, uae_p32(®s.isp));
mov_b_mi(uae_p32(®s.s), 1);
#if defined(CPU_i386) || defined(CPU_x86_64)
- *branchadd = get_target() - (branchadd + 1);
+ *branchadd = JITPTR get_target() - (JITPTR branchadd + 1);
#elif defined(CPU_arm)
*((uae_u32 *)branchadd - 3) = get_target() - (branchadd + 1);
#endif
}
live.state[PC_P].mem=(uae_u32*)&(regs.pc_p);
live.state[PC_P].needflush=NF_TOMEM;
- set_const(PC_P,(uintptr)comp_pc_p);
+ set_const(PC_P, JITPTR comp_pc_p);
live.state[FLAGX].mem=(uae_u32*)&(regflags.x);
live.state[FLAGX].needflush=NF_TOMEM;
case INMEM:
if (live.state[reg].val)
{
- compemu_raw_add_l_mi((uintptr)live.state[reg].mem, live.state[reg].val);
+ compemu_raw_add_l_mi(JITPTR live.state[reg].mem, live.state[reg].val);
log_vwrite(reg);
live.state[reg].val = 0;
}
uae_u32 get_jitted_size(void)
{
if (compiled_code)
- return current_compile_p-compiled_code;
+ return JITPTR current_compile_p - JITPTR compiled_code;
return 0;
}
set_target(current_compile_p);
align_target(align_jumps);
bi->direct_pen=(cpuop_func*)get_target();
- compemu_raw_mov_l_rm(0,(uintptr)&(bi->pc_p));
- compemu_raw_mov_l_mr((uintptr)®s.pc_p,0);
- compemu_raw_jmp((uintptr)popall_execute_normal);
+ compemu_raw_mov_l_rm(0, JITPTR &(bi->pc_p));
+ compemu_raw_mov_l_mr(JITPTR ®s.pc_p,0);
+ compemu_raw_jmp(JITPTR popall_execute_normal);
align_target(align_jumps);
bi->direct_pcc=(cpuop_func*)get_target();
- compemu_raw_mov_l_rm(0,(uintptr)&(bi->pc_p));
- compemu_raw_mov_l_mr((uintptr)®s.pc_p,0);
- compemu_raw_jmp((uintptr)popall_check_checksum);
+ compemu_raw_mov_l_rm(0, JITPTR &(bi->pc_p));
+ compemu_raw_mov_l_mr(JITPTR ®s.pc_p,0);
+ compemu_raw_jmp(JITPTR popall_check_checksum);
flush_cpu_icache((void *)current_compile_p, (void *)target);
current_compile_p=get_target();
{ "ftst", &jit_disable.ftst },
};
-static bool read_fpu_opcode(const char *p, int len)
+static bool read_fpu_opcode(const char *p, size_t len)
{
unsigned int i;
if (blacklist[0] != '\0') {
const char *p = blacklist;
for (;;) {
- int len;
+ size_t len;
if (*p == 0)
return true;
if (endp) {
len = endp - p;
} else {
- len = strlen(p);
+ len = uaestrlen(p);
}
TCHAR *s = au(p);
optlev++;
bi->count=optcount[optlev]-1;
}
- current_block_pc_p=(uintptr)pc_hist[0].location;
+ current_block_pc_p= JITPTR pc_hist[0].location;
remove_deps(bi); /* We are about to create new code */
bi->optlevel=optlev;
if (follow_const_jumps && is_const_jump(op)) {
checksum_info *csi = alloc_checksum_info();
csi->start_p = (uae_u8 *)min_pcp;
- csi->length = max_pcp - min_pcp + LONGEST_68K_INST;
+ csi->length = JITPTR max_pcp - JITPTR min_pcp + LONGEST_68K_INST;
csi->next = bi->csi;
bi->csi = csi;
max_pcp = (uintptr)currpcp;
#if USE_CHECKSUM_INFO
checksum_info *csi = alloc_checksum_info();
csi->start_p = (uae_u8 *)min_pcp;
- csi->length = max_pcp - min_pcp + LONGEST_68K_INST;
+ csi->length = JITPTR max_pcp - JITPTR min_pcp + LONGEST_68K_INST;
csi->next = bi->csi;
bi->csi = csi;
#endif
bi->direct_handler=(cpuop_func*)get_target();
set_dhtu(bi,bi->direct_handler);
bi->status=BI_COMPILING;
- current_block_start_target=(uintptr)get_target();
+ current_block_start_target= JITPTR get_target();
log_startblock();
if (bi->count>=0) { /* Need to generate countdown code */
- compemu_raw_mov_l_mi((uintptr)®s.pc_p,(uintptr)pc_hist[0].location);
- compemu_raw_sub_l_mi((uintptr)&(bi->count),1);
- compemu_raw_jl((uintptr)popall_recompile_block);
+ compemu_raw_mov_l_mi(JITPTR ®s.pc_p, JITPTR pc_hist[0].location);
+ compemu_raw_sub_l_mi(JITPTR &(bi->count),1);
+ compemu_raw_jl(JITPTR popall_recompile_block);
}
if (optlev==0) { /* No need to actually translate */
/* Execute normally without keeping stats */
- compemu_raw_mov_l_mi((uintptr)®s.pc_p,(uintptr)pc_hist[0].location);
- compemu_raw_jmp((uintptr)popall_exec_nostats);
+ compemu_raw_mov_l_mi(JITPTR ®s.pc_p, JITPTR pc_hist[0].location);
+ compemu_raw_jmp(JITPTR popall_exec_nostats);
}
else {
reg_alloc_run=0;
#if USE_NORMAL_CALLING_CONVENTION
raw_push_l_r(REG_PAR1);
#endif
- compemu_raw_mov_l_mi((uintptr)®s.pc_p,
- (uintptr)pc_hist[i].location);
+ compemu_raw_mov_l_mi(JITPTR ®s.pc_p, JITPTR pc_hist[i].location);
raw_dec_sp(STACK_SHADOW_SPACE);
- compemu_raw_call((uintptr)cputbl[opcode]);
+ compemu_raw_call(JITPTR cputbl[opcode]);
raw_inc_sp(STACK_SHADOW_SPACE);
#ifdef PROFILE_UNTRANSLATED_INSNS
// raw_cputbl_count[] is indexed with plain opcode (in m68k order)
uae_u8* branchadd;
/* if (SPCFLAGS_TEST(SPCFLAG_ALL)) popall_do_nothing() */
- compemu_raw_mov_l_rm(0, (uintptr)specflags);
+ compemu_raw_mov_l_rm(0, JITPTR specflags);
compemu_raw_test_l_rr(0,0);
#if defined(USE_DATA_BUFFER)
data_check_end(8, 64); // just a pessimistic guess...
#ifdef UAE
raw_sub_l_mi(uae_p32(&countdown),scaled_cycles(totcycles));
#endif
- compemu_raw_jmp((uintptr)popall_do_nothing);
- *branchadd = get_target() - (branchadd + 1);
+ compemu_raw_jmp(JITPTR popall_do_nothing);
+ *branchadd = JITPTR get_target() - (JITPTR branchadd + 1);
}
}
}
compemu_raw_jcc_l_oponly(NATIVE_CC_EQ);
#endif
tba=(uae_u32*)get_target();
- emit_jmp_target(get_handler(t1));
- compemu_raw_mov_l_mi((uintptr)®s.pc_p,t1);
+ emit_jmp_target(JITPTR get_handler(t1));
+ compemu_raw_mov_l_mi(JITPTR ®s.pc_p, JITPTR t1);
flush_reg_count();
- compemu_raw_jmp((uintptr)popall_do_nothing);
- create_jmpdep(bi,0,tba,t1);
+ compemu_raw_jmp(JITPTR popall_do_nothing);
+ create_jmpdep(bi,0,tba, JITPTR t1);
align_target(align_jumps);
/* not-predicted outcome */
compemu_raw_jcc_l_oponly(NATIVE_CC_EQ);
#endif
tba=(uae_u32*)get_target();
- emit_jmp_target(get_handler(t2));
- compemu_raw_mov_l_mi((uintptr)®s.pc_p,t2);
+ emit_jmp_target(JITPTR get_handler(t2));
+ compemu_raw_mov_l_mi(JITPTR ®s.pc_p, JITPTR t2);
flush_reg_count();
- compemu_raw_jmp((uintptr)popall_do_nothing);
- create_jmpdep(bi,1,tba,t2);
+ compemu_raw_jmp(JITPTR popall_do_nothing);
+ create_jmpdep(bi,1,tba, JITPTR t2);
}
else
{
r=live.state[PC_P].realreg;
compemu_raw_and_l_ri(r,TAGMASK);
int r2 = (r==0) ? 1 : 0;
- compemu_raw_mov_l_ri(r2,(uintptr)popall_do_nothing);
+ compemu_raw_mov_l_ri(r2, JITPTR popall_do_nothing);
#ifdef UAE
raw_sub_l_mi(uae_p32(&countdown),scaled_cycles(totcycles));
- raw_cmov_l_rm_indexed(r2,(uintptr)cache_tags,r,sizeof(void *),NATIVE_CC_PL);
+ raw_cmov_l_rm_indexed(r2, JITPTR cache_tags,r,sizeof(void *),NATIVE_CC_PL);
#else
compemu_raw_cmp_l_mi8((uintptr)specflags,0);
compemu_raw_cmov_l_rm_indexed(r2,(uintptr)cache_tags,r,sizeof(void *),NATIVE_CC_EQ);
compemu_raw_jcc_l_oponly(NATIVE_CC_EQ);
#endif
tba=(uae_u32*)get_target();
- emit_jmp_target(get_handler(v));
- compemu_raw_mov_l_mi((uintptr)®s.pc_p,v);
- compemu_raw_jmp((uintptr)popall_do_nothing);
- create_jmpdep(bi,0,tba,v);
+ emit_jmp_target(JITPTR get_handler(v));
+ compemu_raw_mov_l_mi(JITPTR ®s.pc_p, JITPTR v);
+ compemu_raw_jmp(JITPTR popall_do_nothing);
+ create_jmpdep(bi,0,tba, JITPTR v);
}
else {
r=REG_PC_TMP;
- compemu_raw_mov_l_rm(r,(uintptr)®s.pc_p);
+ compemu_raw_mov_l_rm(r,JITPTR ®s.pc_p);
compemu_raw_and_l_ri(r,TAGMASK);
int r2 = (r==0) ? 1 : 0;
- compemu_raw_mov_l_ri(r2,(uintptr)popall_do_nothing);
+ compemu_raw_mov_l_ri(r2, JITPTR popall_do_nothing);
#ifdef UAE
raw_sub_l_mi(uae_p32(&countdown),scaled_cycles(totcycles));
- raw_cmov_l_rm_indexed(r2,(uintptr)cache_tags,r,sizeof(void *),NATIVE_CC_PL);
+ raw_cmov_l_rm_indexed(r2, JITPTR cache_tags,r,sizeof(void *),NATIVE_CC_PL);
#else
compemu_raw_cmp_l_mi8((uintptr)specflags,0);
compemu_raw_cmov_l_rm_indexed(r2,(uintptr)cache_tags,r,sizeof(void *),NATIVE_CC_EQ);
}
#endif
- current_cache_size += get_target() - current_compile_p;
+ current_cache_size += JITPTR get_target() - JITPTR current_compile_p;
#ifdef JIT_DEBUG
bi->direct_handler_size = get_target() - (uae_u8 *)current_block_start_target;
/* This is the non-direct handler */
bi->handler=
bi->handler_to_use=(cpuop_func *)get_target();
- compemu_raw_cmp_l_mi((uintptr)®s.pc_p,(uintptr)pc_hist[0].location);
- compemu_raw_jnz((uintptr)popall_cache_miss);
+ compemu_raw_cmp_l_mi(JITPTR ®s.pc_p, JITPTR pc_hist[0].location);
+ compemu_raw_jnz(JITPTR popall_cache_miss);
comp_pc_p=(uae_u8*)pc_hist[0].location;
bi->status=BI_FINALIZING;
match_states(bi);
flush(1);
- compemu_raw_jmp((uintptr)bi->direct_handler);
+ compemu_raw_jmp(JITPTR bi->direct_handler);
flush_cpu_icache((void *)current_block_start_target, (void *)target);
current_compile_p=get_target();
}
}
for (int i = 0; i < 5; i++) {
- raw_mov_b_mi(CONTEXT_PC(context) + i, vecbuf[i]);
+ raw_mov_b_mi(JITPTR CONTEXT_PC(context) + i, vecbuf[i]);
}
raw_mov_l_mi(uae_p32(&in_handler), 0);
raw_jmp(uae_p32(CONTEXT_PC(context)) + len);
const char *s = luaL_checkstring(L, 1);
TCHAR *ts = au(s);
TCHAR out[MAX_DPATH];
- cfgfile_modify(-1, ts, _tcslen(ts), out, sizeof out / sizeof(TCHAR));
+ cfgfile_modify(-1, ts, uaetcslen(ts), out, sizeof out / sizeof(TCHAR));
char *c = ua(out);
lua_pushstring(L, c);
xfree(c);
return randseed;
}
-void my_trim (TCHAR *s)
+void my_trim(TCHAR *s)
{
int len;
- while (_tcslen (s) > 0 && _tcscspn (s, _T("\t \r\n")) == 0)
- memmove (s, s + 1, (_tcslen (s + 1) + 1) * sizeof (TCHAR));
- len = _tcslen (s);
- while (len > 0 && _tcscspn (s + len - 1, _T("\t \r\n")) == 0)
+ while (uaetcslen(s) > 0 && _tcscspn(s, _T("\t \r\n")) == 0)
+ memmove (s, s + 1, (uaetcslen(s + 1) + 1) * sizeof (TCHAR));
+ len = uaetcslen(s);
+ while (len > 0 && _tcscspn(s + len - 1, _T("\t \r\n")) == 0)
s[--len] = '\0';
}
if (s[0] == 0)
return my_strdup(s);
- while (_tcscspn (s, _T("\t \r\n")) == 0)
+ while (_tcscspn(s, _T("\t \r\n")) == 0)
s++;
- len = _tcslen (s);
- while (len > 0 && _tcscspn (s + len - 1, _T("\t \r\n")) == 0)
+ len = uaetcslen(s);
+ while (len > 0 && _tcscspn(s + len - 1, _T("\t \r\n")) == 0)
len--;
- out = xmalloc (TCHAR, len + 1);
- memcpy (out, s, len * sizeof (TCHAR));
+ out = xmalloc(TCHAR, len + 1);
+ memcpy(out, s, len * sizeof (TCHAR));
out[len] = 0;
return out;
}
struct d3dstruct
{
+ int num;
int psEnabled, psActive;
struct shaderdata shaders[MAX_SHADERS];
LPDIRECT3DTEXTURE9 lpPostTempTexture;
if (Errors)
s = au ((char*)Errors->GetBufferPointer ());
- size = (s == NULL ? 0 : _tcslen (s)) + 1000;
+ size = (s == NULL ? 0 : uaetcslen (s)) + 1000;
if (size + 1000 > buffersize) {
xfree (buffer);
buffer = xmalloc (TCHAR, size);
}
if (FAILED (hr)) {
const char *str = d3d->psEnabled ? fx20 : fx10;
- int len = strlen (str);
+ int len = uaestrlen(str);
if (!existsfile && plugin_path) {
struct zfile *z = zfile_fopen (tmp, _T("w"));
if (z) {
for (int y = 0; y < d3d->ledheight; y++) {
uae_u8 *buf = (uae_u8*)locked.pBits + y * locked.Pitch;
- statusline_single_erase(d3d - d3ddata, buf, 32 / 8, y, d3d->ledwidth);
+ statusline_single_erase(d3d->num, buf, 32 / 8, y, d3d->ledwidth);
}
- statusline_render(d3d - d3ddata, (uae_u8*)locked.pBits, 32 / 8, locked.Pitch, d3d->ledwidth, d3d->ledheight, rc, gc, bc, a);
+ statusline_render(d3d->num, (uae_u8*)locked.pBits, 32 / 8, locked.Pitch, d3d->ledwidth, d3d->ledheight, rc, gc, bc, a);
for (int y = 0; y < d3d->ledheight; y++) {
uae_u8 *buf = (uae_u8*)locked.pBits + y * locked.Pitch;
- draw_status_line_single(d3d - d3ddata, buf, 32 / 8, y, d3d->ledwidth, rc, gc, bc, a);
+ draw_status_line_single(d3d->num, buf, 32 / 8, y, d3d->ledwidth, rc, gc, bc, a);
}
d3d->ledtexture->UnlockRect (0);
struct png_cb
{
uae_u8 *ptr;
- int size;
+ size_t size;
};
static void __cdecl readcallback(png_structp png_ptr, png_bytep out, png_size_t count)
D3DXIMAGE_INFO dinfo;
TCHAR tmp[MAX_DPATH];
int maskwidth, maskheight;
- int idx = sd - &d3d->shaders[0];
+ int idx = (int)(sd - &d3d->shaders[0]);
if (filename[0] == 0)
return 0;
static void setupscenecoords (struct d3dstruct *d3d, bool normalrender)
{
- int monid = d3d - d3ddata;
+ int monid = d3d->num;
struct vidbuf_description *vidinfo = &adisplays[monid].gfxvidinfo;
RECT sr, dr, zr;
float w, h;
static const TCHAR *D3D_init2 (struct d3dstruct *d3d, HWND ahwnd, int w_w, int w_h, int depth, int *freq, int mmulth, int mmultv)
{
- int monid = d3d - d3ddata;
+ int monid = d3d->num;
struct amigadisplay *ad = &adisplays[monid];
HRESULT ret, hr;
static TCHAR errmsg[300] = { 0 };
d3d->dmultxh = mmulth;
d3d->dmultxv = mmultv;
- d3d->dmult = S2X_getmult(d3d - d3ddata);
+ d3d->dmult = S2X_getmult(d3d->num);
d3d->window_w = w_w;
d3d->window_h = w_h;
}
if (d3d->ledtexture && (((currprefs.leds_on_screen & STATUSLINE_RTG) && WIN32GFX_IsPicassoScreen(mon)) || ((currprefs.leds_on_screen & STATUSLINE_CHIPSET) && !WIN32GFX_IsPicassoScreen(mon)))) {
int slx, sly;
- statusline_getpos(d3d - d3ddata, &slx, &sly, d3d->window_w, d3d->window_h);
+ statusline_getpos(d3d->num, &slx, &sly, d3d->window_w, d3d->window_h);
v.x = (float)slx;
v.y = (float)sly;
v.z = 0.0f;
void d3d9_select(void)
{
+ for (int i = 0; i < MAX_AMIGAMONITORS; i++) {
+ d3ddata[i].num = i;
+ }
D3D_free = xD3D_free;
D3D_init = xD3D_init;
D3D_alloctexture = xD3D_alloctexture;
struct d3d11struct
{
+ int num;
IDXGISwapChain1 *m_swapChain;
ID3D11Device *m_device;
ID3D11DeviceContext *m_deviceContext;
static bool fxneedconvert(char *s)
{
char *t = s;
- int len = strlen(s);
+ int len = uaestrlen(s);
while (len > 0) {
if (t != s && isws(t[-1]) && (!strnicmp(t, "technique10", 11) || !strnicmp(t, "technique11", 11)) && isws(t[11])) {
return false;
char *t = s;
char *d = dst;
*d = 0;
- int len = strlen(s);
+ int len = uaestrlen(s);
while (len > 0) {
bool found = false;
if (t != s && !strnicmp(t, "minfilter", 9) && (isws(t[9]) || t[9] == '=') && isws(t[-1])) {
while (!islf(*t) && len > 0) {
if (!strnicmp(t, "point", 5)) {
strcpy(d, "Filter=MIN_MAG_MIP_POINT");
- d += strlen(d);
+ d += uaestrlen(d);
write_log("FX: 'minfilter' -> 'Filter=MIN_MAG_MIP_POINT'\n");
}
if (!strnicmp(t, "linear", 6)) {
strcpy(d, "Filter=MIN_MAG_MIP_LINEAR");
- d += strlen(d);
+ d += uaestrlen(d);
write_log("FX: 'minfiler' -> 'Filter=MIN_MAG_MIP_LINEAR'\n");
}
t++;
{
char *t = s;
char *d = dst;
- int len = strlen(s);
+ int len = uaestrlen(s);
while (len > 0) {
bool found = false;
for (int i = 0; convert1[i]; i++) {
- int slen = strlen(convert1[i]);
- int dlen = strlen(convert2[i]);
+ int slen = uaestrlen(convert1[i]);
+ int dlen = uaestrlen(convert2[i]);
if (len > slen && !strnicmp(t, convert1[i], slen)) {
if ((t == s || isws(t[-1])) && isws(t[slen])) {
memcpy(d, convert2[i], dlen);
{
char *t = s;
char *d = dst;
- int len = strlen(s);
+ int len = uaestrlen(s);
while (len > 0) {
bool found = false;
for (int i = 0; lines[i]; i++) {
- int slen = strlen(lines[i]);
+ int slen = uaestrlen(lines[i]);
if (len > slen && !strnicmp(t, lines[i], slen)) {
d--;
while (d != dst) {
if (!normalrender)
return;
- getfilterrect2(d3d - d3d11data, &dr, &sr, &zr, d3d->m_screenWidth, d3d->m_screenHeight, d3d->m_bitmapWidth / d3d->dmult, d3d->m_bitmapHeight / d3d->dmult, d3d->dmult, d3d->m_bitmapWidth, d3d->m_bitmapHeight);
+ getfilterrect2(d3d->num, &dr, &sr, &zr, d3d->m_screenWidth, d3d->m_screenHeight, d3d->m_bitmapWidth / d3d->dmult, d3d->m_bitmapHeight / d3d->dmult, d3d->dmult, d3d->m_bitmapWidth, d3d->m_bitmapHeight);
if (!memcmp(&sr, &d3d->sr2, sizeof RECT) && !memcmp(&dr, &d3d->dr2, sizeof RECT) && !memcmp(&zr, &d3d->zr2, sizeof RECT)) {
return;
if (!d3d->osd.texture || d3d != d3d11data)
return;
- statusline_getpos(d3d - d3d11data, &osdx, &osdy, d3d->m_screenWidth, d3d->m_screenHeight);
+ statusline_getpos(d3d->num, &osdx, &osdy, d3d->m_screenWidth, d3d->m_screenHeight);
d3d->osd.x = (float)osdx;
d3d->osd.y = (float)osdy;
}
for (int y = 0; y < d3d->osd.height; y++) {
uae_u8 *buf = (uae_u8*)map.pData + y * map.RowPitch;
- statusline_single_erase(d3d - d3d11data, buf, 32 / 8, y, d3d->ledwidth);
+ statusline_single_erase(d3d->num, buf, 32 / 8, y, d3d->ledwidth);
}
- statusline_render(d3d - d3d11data, (uae_u8*)map.pData, 32 / 8, map.RowPitch, d3d->ledwidth, d3d->ledheight, rc, gc, bc, a);
+ statusline_render(d3d->num, (uae_u8*)map.pData, 32 / 8, map.RowPitch, d3d->ledwidth, d3d->ledheight, rc, gc, bc, a);
for (int y = 0; y < d3d->osd.height; y++) {
uae_u8 *buf = (uae_u8*)map.pData + y * map.RowPitch;
- draw_status_line_single(d3d - d3d11data, buf, 32 / 8, y, d3d->ledwidth, rc, gc, bc, a);
+ draw_status_line_single(d3d->num, buf, 32 / 8, y, d3d->ledwidth, rc, gc, bc, a);
}
d3d->m_deviceContext->Unmap(d3d->osd.texture, 0);
static void erasetexture(struct d3d11struct *d3d)
{
int pitch;
- uae_u8 *p = D3D_locktexture(d3d - &d3d11data[0], &pitch, NULL, true);
+ uae_u8 *p = D3D_locktexture(d3d->num, &pitch, NULL, true);
if (p) {
for (int i = 0; i < d3d->m_bitmapHeight; i++) {
memset(p, 255, d3d->m_bitmapWidth * d3d->texdepth / 8);
p += pitch;
}
- D3D_unlocktexture(d3d - &d3d11data[0], -1, -1);
+ D3D_unlocktexture(d3d->num, -1, -1);
}
}
#endif
static bool CreateTexture(struct d3d11struct *d3d)
{
- struct AmigaMonitor *mon = &AMonitors[d3d - d3d11data];
+ struct AmigaMonitor *mon = &AMonitors[d3d->num];
D3D11_TEXTURE2D_DESC desc;
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
HRESULT hr;
static bool allocextratextures(struct d3d11struct *d3d, struct shaderdata11 *s, int w, int h)
{
- if (!allocshadertex(d3d, &s->lpWorkTexture1, w, h, s - &d3d->shaders[0]))
+ int scnt = (int)(s - &d3d->shaders[0]);
+ if (!allocshadertex(d3d, &s->lpWorkTexture1, w, h, scnt))
return false;
- if (!allocshadertex(d3d, &s->lpWorkTexture2, w, h, s - &d3d->shaders[0]))
+ if (!allocshadertex(d3d, &s->lpWorkTexture2, w, h, scnt))
return false;
- write_log(_T("D3D11 %d*%d working texture:%d\n"), w, h, s - &d3d->shaders[0]);
+ write_log(_T("D3D11 %d*%d working texture:%d\n"), w, h, scnt);
return true;
}
}
d3d->shaders[i].targettex_width = w2;
d3d->shaders[i].targettex_height = h2;
- if (!allocshadertex(d3d, &s->lpTempTexture, w2, h2, s - &d3d->shaders[0]))
+ if (!allocshadertex(d3d, &s->lpTempTexture, w2, h2, (int)(s - &d3d->shaders[0])))
return false;
write_log(_T("D3D11 %d*%d temp texture:%d:%d\n"), w2, h2, i, d3d->shaders[i].type);
d3d->shaders[i].worktex_width = w;
struct png_cb
{
uae_u8 *ptr;
- int size;
+ size_t size;
};
static void __cdecl readcallback(png_structp png_ptr, png_bytep out, png_size_t count)
static int createmask2texture(struct d3d11struct *d3d, const TCHAR *filename)
{
- struct AmigaMonitor *mon = &AMonitors[d3d - d3d11data];
+ struct AmigaMonitor *mon = &AMonitors[d3d->num];
struct zfile *zf;
TCHAR tmp[MAX_DPATH];
ID3D11Texture2D *tx = NULL;
static void setswapchainmode(struct d3d11struct *d3d, int fs)
{
- struct amigadisplay *ad = &adisplays[d3d - d3d11data];
+ struct amigadisplay *ad = &adisplays[d3d->num];
struct apmode *apm = ad->picasso_on ? &currprefs.gfx_apmode[APMODE_RTG] : &currprefs.gfx_apmode[APMODE_NATIVE];
// It is recommended to always use the tearing flag when it is supported.
d3d->swapChainDesc.Flags &= ~DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING;
static void do_present(struct d3d11struct *d3d)
{
- struct amigadisplay *ad = &adisplays[d3d - d3d11data];
+ struct amigadisplay *ad = &adisplays[d3d->num];
struct apmode *apm = ad->picasso_on ? &currprefs.gfx_apmode[APMODE_RTG] : &currprefs.gfx_apmode[APMODE_NATIVE];
HRESULT hr;
UINT presentFlags = 0;
UINT syncinterval = d3d->vblankintervals;
// only if no vsync or low latency vsync
if (d3d->m_tearingSupport && (d3d->swapChainDesc.Flags & DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING) && (!vsync || apm->gfx_vsyncmode)) {
- if (apm->gfx_vsyncmode || d3d - d3d11data > 0 || currprefs.turbo_emulation || currprefs.gfx_variable_sync) {
+ if (apm->gfx_vsyncmode || d3d->num > 0 || currprefs.turbo_emulation || currprefs.gfx_variable_sync) {
presentFlags |= DXGI_PRESENT_ALLOW_TEARING;
syncinterval = 0;
}
hr = d3d->m_swapChain->SetFullscreenState(TRUE, d3d->outputAdapter);
if (FAILED(hr)) {
write_log(_T("SetFullscreenState(TRUE) failed %08X\n"), hr);
- toggle_fullscreen(d3d - d3d11data, 10);
+ toggle_fullscreen(d3d->num, 10);
} else {
d3d->fsmode = 0;
}
}
if (!d3d->delayedfs)
return r;
- xD3D11_free(d3d - d3d11data, true);
+ xD3D11_free(d3d->num, true);
d3d->delayedfs = 0;
ShowWindow(d3d->ahwnd, SW_SHOWNORMAL);
int freq = 0;
- if (!xxD3D11_init2(d3d->ahwnd, d3d - d3d11data, d3d->m_screenWidth, d3d->m_screenHeight, d3d->m_bitmapWidth2, d3d->m_bitmapHeight2, 32, &freq, d3d->dmultxh, d3d->dmultxv))
+ if (!xxD3D11_init2(d3d->ahwnd, d3d->num, d3d->m_screenWidth, d3d->m_screenHeight, d3d->m_bitmapWidth2, d3d->m_bitmapHeight2, 32, &freq, d3d->dmultxh, d3d->dmultxv))
d3d->invalidmode = true;
return false;
}
}
if (!d3d->invalidmode) {
if (!initd3d(d3d)) {
- xD3D11_free(d3d - d3d11data, true);
+ xD3D11_free(d3d->num, true);
gui_message(_T("D3D11 Resize failed."));
d3d->invalidmode = true;
} else {
- xD3D11_alloctexture(d3d - d3d11data, d3d->m_bitmapWidth, d3d->m_bitmapHeight);
+ xD3D11_alloctexture(d3d->num, d3d->m_bitmapWidth, d3d->m_bitmapHeight);
}
}
write_log(_T("D3D11 resizemode end\n"));
write_log(_T("fs guimode %d\n"), guion);
d3d->guimode = guion;
if (guion > 0) {
- xD3D11_free(d3d - d3d11data, true);
+ xD3D11_free(d3d->num, true);
ShowWindow(d3d->ahwnd, SW_HIDE);
} else if (guion == 0) {
d3d->delayedfs = 1;
void d3d_select(struct uae_prefs *p)
{
+ for (int i = 0; i < MAX_AMIGAMONITORS; i++) {
+ d3d11data[i].num = i;
+ }
if (p->gfx_api >= 2)
d3d11_select();
else
void to_lower(TCHAR *s, int len)
{
if (len < 0) {
- len = _tcslen(s);
+ len = uaetcslen(s);
}
CharLowerBuff(s, len);
}
void to_upper(TCHAR *s, int len)
{
if (len < 0) {
- len = _tcslen(s);
+ len = uaetcslen(s);
}
CharUpperBuff(s, len);
-}
\ No newline at end of file
+}
+
+int uaestrlen(const char* s)
+{
+ return (int)strlen(s);
+}
+int uaetcslen(const TCHAR* s)
+{
+ return (int)_tcslen(s);
+}
else
_stprintf (ptr , _T("%02d"), gui_data.drives[led - 1].drive_track);
p = gui_data.drives[led - 1].df;
- j = _tcslen (p) - 1;
+ j = uaetcslen(p) - 1;
if (j < 0)
j = 0;
while (j > 0) {
}
tt = dfx[led - 1];
tt[0] = 0;
- if (_tcslen (p + j) > 0)
+ if (uaetcslen(p + j) > 0)
_stprintf (tt, _T("%s [CRC=%08X]"), p + j, gui_data.drives[led - 1].crc32);
center = 1;
if (gui_data.drives[led - 1].drive_writing)
static void check_blit(int32_t addr, uint32_t mask, int pitch, int width, int *height, int depth, int dir)
{
int h = *height;
+ int maskp1 = mask + 1;
int32_t off;
if (!h || !width || (!addr && !mask))
return;
} else {
off -= width * (depth / 8);
}
- if (off > mask + 1) {
+ if (off > maskp1) {
if (pitch)
- h -= (off - (mask + 1) + pitch - 1) / pitch;
+ h -= (off - maskp1 + pitch - 1) / pitch;
else
h = 0;
} else if (off < 0) {
*
***************************************/
-static void cirrus_update_bank_ptr(CirrusVGAState * s, unsigned bank_index)
+static void cirrus_update_bank_ptr(CirrusVGAState * s, uint32_t bank_index)
{
- unsigned offset;
- unsigned limit;
+ int32_t offset;
+ int32_t limit;
if ((s->vga.gr[0x0b] & 0x01) != 0) /* dual bank */
offset = s->vga.gr[0x09 + bank_index];
return;
if ((s->vga.sr[0x07] & 0x01) == 0) {
- vga_mem_writeb(&s->vga, addr, mem_value);
+ vga_mem_writeb(&s->vga, addr, (uint32_t)mem_value);
return;
}
bank_offset &= s->cirrus_addr_mask;
mode = s->vga.gr[0x05] & 0x7;
if (mode < 4 || mode > 5 || ((s->vga.gr[0x0B] & 0x4) == 0)) {
- *(s->vga.vram_ptr + bank_offset) = mem_value;
+ *(s->vga.vram_ptr + bank_offset) = (uint8_t)mem_value;
linear_memory_region_set_dirty(&s->vga.vram, bank_offset,
sizeof(mem_value));
} else {
if ((s->vga.gr[0x0B] & 0x14) != 0x14) {
cirrus_mem_writeb_mode4and5_8bpp(s, mode,
bank_offset,
- mem_value);
+ (uint32_t)mem_value);
} else {
cirrus_mem_writeb_mode4and5_16bpp(s, mode,
bank_offset,
- mem_value);
+ (uint32_t)mem_value);
}
}
}
} else if (addr >= 0x18000 && addr < 0x18100) {
/* memory-mapped I/O */
if ((s->vga.sr[0x17] & 0x44) == 0x04) {
- cirrus_mmio_blt_write(s, addr & 0xff, mem_value);
+ cirrus_mmio_blt_write(s, addr & 0xff, (uint8_t)mem_value);
}
} else {
#ifdef DEBUG_CIRRUS
}
static void cirrus_linear_write(void *opaque, hwaddr addr,
- uint64_t val, unsigned size)
+ uint64_t val64, unsigned size)
{
CirrusVGAState *s = (CirrusVGAState*)opaque;
unsigned mode;
+ uint32_t val = (uint32_t)val64;
addr &= s->cirrus_addr_mask;
return val;
}
-static void cirrus_vga_ioport_write(void *opaque, hwaddr addr, uint64_t val,
+static void cirrus_vga_ioport_write(void *opaque, hwaddr addr, uint64_t val64,
unsigned size)
{
CirrusVGAState *c = (CirrusVGAState*)opaque;
VGACommonState *s = &c->vga;
int index;
+ uint32_t val = (uint32_t)val64;
qemu_flush_coalesced_mmio_buffer();
addr += 0x3b0;
CirrusVGAState *s = (CirrusVGAState*)opaque;
if (addr >= 0x100) {
- cirrus_mmio_blt_write(s, addr - 0x100, val);
+ cirrus_mmio_blt_write(s, addr - 0x100, (uint8_t)val);
} else {
cirrus_vga_ioport_write(s, addr + 0x10, val, size);
}
}
}
-static void es1370_write(void *opaque, hwaddr addr, uint64_t val,
+static void es1370_write(void *opaque, hwaddr addr, uint64_t val64,
unsigned size)
{
+ uint32_t val = (uint32_t)val64;
switch (size) {
case 1:
es1370_writeb(opaque, addr, val);
static int handle_ti(ESPState *s)
{
- uint32_t dmalen, minlen;
+ int32_t dmalen, minlen;
s->fifo_on = 1;
s->transfer_complete = 0;
}
-void esp_reg_write(void *opaque, uint32_t saddr, uint64_t val)
+void esp_reg_write(void *opaque, uint32_t saddr, uint64_t val64)
{
ESPState *s = (ESPState*)opaque;
+ uint32_t val = (uint32_t)val64;
if ((s->fas4xxextra & 1) && (s->wregs[ESP_RES3] & 0x80)) {
saddr += ESP_REGS;
uint32_t dsa;
uint32_t temp;
uint32_t dnad;
- uint32_t dbc;
+ int32_t dbc;
uint8_t istat;
uint8_t dcmd;
uint8_t dstat;
{
LSIState710 *s = (LSIState710*)opaque;
- lsi_reg_writeb(s, addr & 0xff, val);
+ lsi_reg_writeb(s, addr & 0xff, (uint8_t)val);
}
uint64_t lsi710_mmio_read(void *opaque, hwaddr addr,
uint32_t dsa;
uint32_t temp;
uint32_t dnad;
- uint32_t dbc;
+ int32_t dbc;
uint8_t istat0;
uint8_t istat1;
uint8_t dcmd;
{
LSIState *s = (LSIState*)opaque;
- lsi_reg_writeb(s, addr & 0xff, val);
+ lsi_reg_writeb(s, addr & 0xff, (uint8_t)val);
}
uint64_t lsi_mmio_read(void *opaque, hwaddr addr,
static ssize_t ne2000_receive(NetClientState *nc, const uint8_t *buf, size_t size_)
{
NE2000State *s = qemu_get_nic_opaque(nc);
- int size = size_;
+ int size = (int)size_;
uint8_t *p;
unsigned int total_len, next, avail, len, index;
uint8_t buf1[60];
s->isr |= ENISR_RX;
ne2000_update_irq(s);
- return size_;
+ return (ssize_t)size_;
}
static void ne2000_ioport_write(void *opaque, uint32_t addr, uint32_t val)
return v;
}
-static void ne2000_write(void *opaque, hwaddr addr, uint64_t data, unsigned size)
+static void ne2000_write(void *opaque, hwaddr addr, uint64_t data64, unsigned size)
{
NE2000State *s = (NE2000State*)opaque;
+ uint32_t data = (uint32_t)data64;
#if defined(DEBUG_NE2000)
write_log(_T("NE2000_WRITE %08x %08x %d\n"), addr, (uae_u32)data, size);
}
static uae_u32 REGPARAM2 ne2000_bget(struct pci_board_state *pcibs, uaecptr addr)
{
- uae_u32 v = ne2000_read(ncs.ne2000state, addr, 1);
+ uae_u32 v = (uae_u32)ne2000_read(ncs.ne2000state, addr, 1);
return v;
}
static uae_u32 REGPARAM2 ne2000_wget(struct pci_board_state *pcibs, uaecptr addr)
{
- uae_u32 v = ne2000_read(ncs.ne2000state, addr, 2);
+ uae_u32 v = (uae_u32)ne2000_read(ncs.ne2000state, addr, 2);
return v;
}
static uae_u32 REGPARAM2 ne2000_lget(struct pci_board_state *pcibs, uaecptr addr)
{
- uae_u32 v = ne2000_read(ncs.ne2000state, addr, 4);
+ uae_u32 v = (uae_u32)ne2000_read(ncs.ne2000state, addr, 4);
return v;
}
uint32_t cirrus_bank_base[2];
uint32_t cirrus_bank_limit[2];
uint8_t cirrus_hidden_palette[48];
- uint32_t hw_cursor_x;
- uint32_t hw_cursor_y;
+ int32_t hw_cursor_x;
+ int32_t hw_cursor_y;
int cirrus_blt_pixelwidth;
int cirrus_blt_width;
int cirrus_blt_height;
uint8_t tchi_has_id;
int32_t ti_size;
int32_t dma_len;
- uint32_t ti_rptr, ti_wptr;
+ int32_t ti_rptr, ti_wptr;
uint32_t status;
uint32_t dma;
uint8_t ti_buf[TI_BUFSZ];
uint32_t dma_pending; // fakedma pending count
/* The size of the current DMA transfer. Zero if no transfer is in
progress. */
- uint32_t dma_counter;
+ int32_t dma_counter;
int dma_enabled;
int pio_on;
int fifo_on;
int transfer_complete;
- uint32_t async_len;
+ int32_t async_len;
uint8_t *async_buf;
ESPDMAMemoryReadWriteFunc dma_memory_read;
cur_tick = qemu_get_clock_ns(vm_clock);
- cur_char = (cur_tick / r->ticks_per_char) % r->total_chars;
+ cur_char = (int)((cur_tick / r->ticks_per_char) % r->total_chars);
cur_line = cur_char / r->htotal;
if (cur_line >= r->vstart && cur_line <= r->vend) {
uint32_t r2sz = s->cr[0x34] | (((s->cr[0x36] >> 2) & 3) << 8);
uint32_t r2adjust = (s->cr[0x5d] >> 4) & 3;
uint32_t r2dsz = s->cr[0x35] | (((s->cr[0x36] >> 4) & 3) << 8);
- uint32_t wvs = s->cr[0x37] | (((s->cr[0x39] >> 0) & 3) << 8);
- uint32_t wve = s->cr[0x38] | (((s->cr[0x39] >> 2) & 3) << 8);
+ int32_t wvs = s->cr[0x37] | (((s->cr[0x39] >> 0) & 3) << 8);
+ int32_t wve = s->cr[0x38] | (((s->cr[0x39] >> 2) & 3) << 8);
bool occlusion = ((s->cr[0x3e] >> 7) & 1) != 0 && bits < 24;
uint32_t region1size = 32 * r1sz / gfxbpp + (r1adjust * 8 / gfxbpp);
uint32_t region2size = 32 * r2sz / gfxbpp + (r2adjust * 8 / gfxbpp);
{
VGACommonState *s = (VGACommonState*)opaque;
- return vga_mem_writeb(s, addr, data);
+ return vga_mem_writeb(s, addr, (uint32_t)data);
}
const MemoryRegionOps vga_mem_ops = {
uint8_t double_scan;
uint8_t double_scan2;
uint32_t line_offset;
- uint32_t line_compare;
+ int32_t line_compare;
uint32_t start_addr;
uint32_t plane_updated;
uint32_t last_line_offset;
uint8_t last_cw, last_ch;
- uint32_t last_width, last_height; /* in chars or pixels */
- uint32_t last_scr_width, last_scr_height; /* in pixels */
+ int32_t last_width, last_height; /* in chars or pixels */
+ int32_t last_scr_width, last_scr_height; /* in pixels */
uint32_t last_depth; /* in bits */
uint8_t cursor_start, cursor_end;
bool cursor_visible_phase;
((uint32_t *)d)[2] = (dmask4[(font_data >> 2) & 3] & xorcol) ^ bgcol;
((uint32_t *)d)[3] = (dmask4[(font_data >> 0) & 3] & xorcol) ^ bgcol;
#else
- ((uint32_t *)d)[0] = (-((font_data >> 7)) & xorcol) ^ bgcol;
- ((uint32_t *)d)[1] = (-((font_data >> 6) & 1) & xorcol) ^ bgcol;
- ((uint32_t *)d)[2] = (-((font_data >> 5) & 1) & xorcol) ^ bgcol;
- ((uint32_t *)d)[3] = (-((font_data >> 4) & 1) & xorcol) ^ bgcol;
- ((uint32_t *)d)[4] = (-((font_data >> 3) & 1) & xorcol) ^ bgcol;
- ((uint32_t *)d)[5] = (-((font_data >> 2) & 1) & xorcol) ^ bgcol;
- ((uint32_t *)d)[6] = (-((font_data >> 1) & 1) & xorcol) ^ bgcol;
- ((uint32_t *)d)[7] = (-((font_data >> 0) & 1) & xorcol) ^ bgcol;
+ ((uint32_t *)d)[0] = (0-((font_data >> 7)) & xorcol) ^ bgcol;
+ ((uint32_t *)d)[1] = (0-((font_data >> 6) & 1) & xorcol) ^ bgcol;
+ ((uint32_t *)d)[2] = (0-((font_data >> 5) & 1) & xorcol) ^ bgcol;
+ ((uint32_t *)d)[3] = (0-((font_data >> 4) & 1) & xorcol) ^ bgcol;
+ ((uint32_t *)d)[4] = (0-((font_data >> 3) & 1) & xorcol) ^ bgcol;
+ ((uint32_t *)d)[5] = (0-((font_data >> 2) & 1) & xorcol) ^ bgcol;
+ ((uint32_t *)d)[6] = (0-((font_data >> 1) & 1) & xorcol) ^ bgcol;
+ ((uint32_t *)d)[7] = (0-((font_data >> 0) & 1) & xorcol) ^ bgcol;
#endif
}
else
((uint16_t *)d)[8] = bgcol;
#else
- ((uint32_t *)d)[0] = (-((font_data >> 7)) & xorcol) ^ bgcol;
- ((uint32_t *)d)[1] = (-((font_data >> 6) & 1) & xorcol) ^ bgcol;
- ((uint32_t *)d)[2] = (-((font_data >> 5) & 1) & xorcol) ^ bgcol;
- ((uint32_t *)d)[3] = (-((font_data >> 4) & 1) & xorcol) ^ bgcol;
- ((uint32_t *)d)[4] = (-((font_data >> 3) & 1) & xorcol) ^ bgcol;
- ((uint32_t *)d)[5] = (-((font_data >> 2) & 1) & xorcol) ^ bgcol;
- ((uint32_t *)d)[6] = (-((font_data >> 1) & 1) & xorcol) ^ bgcol;
- v = (-((font_data >> 0) & 1) & xorcol) ^ bgcol;
+ ((uint32_t *)d)[0] = (0-((font_data >> 7)) & xorcol) ^ bgcol;
+ ((uint32_t *)d)[1] = (0-((font_data >> 6) & 1) & xorcol) ^ bgcol;
+ ((uint32_t *)d)[2] = (0-((font_data >> 5) & 1) & xorcol) ^ bgcol;
+ ((uint32_t *)d)[3] = (0-((font_data >> 4) & 1) & xorcol) ^ bgcol;
+ ((uint32_t *)d)[4] = (0-((font_data >> 3) & 1) & xorcol) ^ bgcol;
+ ((uint32_t *)d)[5] = (0-((font_data >> 2) & 1) & xorcol) ^ bgcol;
+ ((uint32_t *)d)[6] = (0-((font_data >> 1) & 1) & xorcol) ^ bgcol;
+ v = (0-((font_data >> 0) & 1) & xorcol) ^ bgcol;
((uint32_t *)d)[7] = v;
if (dup9)
((uint32_t *)d)[8] = v;
zfile_fclose (f);
}
-void addkeydir (const TCHAR *path)
+void addkeydir(const TCHAR *path)
{
TCHAR tmp[MAX_DPATH];
- _tcscpy (tmp, path);
- if (zfile_exists (tmp)) {
+ _tcscpy(tmp, path);
+ if (zfile_exists(tmp)) {
int i;
- for (i = _tcslen (tmp) - 1; i > 0; i--) {
+ for (i = uaetcslen(tmp) - 1; i > 0; i--) {
if (tmp[i] == '\\' || tmp[i] == '/')
break;
}
tmp[i] = 0;
}
- _tcscat (tmp, _T("/"));
- _tcscat (tmp, _T("rom.key"));
- addkeyfile (tmp);
+ _tcscat(tmp, _T("/"));
+ _tcscat(tmp, _T("rom.key"));
+ addkeyfile(tmp);
}
int get_keyring (void)
struct zfile *f;
const TCHAR *name;
- for (i = _tcslen (filename) - 1; i >= 0; i--) {
+ for (i = uaetcslen(filename) - 1; i >= 0; i--) {
if (filename[i] == '/' || filename[i] == '\\')
break;
}
for (i = 0; i < romlist_cnt; i++) {
TCHAR *n = rl[i].path;
- for (j = _tcslen (n) - 1; j >= 0; j--) {
+ for (j = uaetcslen(n) - 1; j >= 0; j--) {
if (n[j] == '/' || n[j] == '\\')
break;
}
if (j < 0)
continue;
- if (!_tcsicmp (name, n + j)) {
+ if (!_tcsicmp(name, n + j)) {
struct romdata *rd = rl[i].rd;
f = read_rom (rd);
if (f) {
if (i == MAX_OPEN_DEVICES)
return openfail(ctx, ioreq, IOERR_UNITBUSY);
- trap_put_long(ctx, ioreq + 24, pdev - pdevst);
+ trap_put_longt(ctx, ioreq + 24, pdev - pdevst);
pdev->unit = unit;
pdev->flags = flags;
pdev->inuse = 1;
char *top, *to;
TCHAR *s;
- len = strlen ((char*)dst) + 1;
+ len = uaestrlen((char*)dst) + 1;
top = to = xmalloc (char, len);
do {
v = *dst++;
void savestate_quick (int slot, int save)
{
- int i, len = _tcslen (savestate_fname);
+ int i, len = uaetcslen(savestate_fname);
i = len - 1;
while (i >= 0 && savestate_fname[i] != '_')
i--;
pdev->unit = unit;
pdev->flags = flags;
pdev->inuse = 1;
- trap_put_long(ctx, ioreq + 24, pdev - pdevst);
+ trap_put_longt(ctx, ioreq + 24, pdev - pdevst);
start_thread (dev);
} else {
for (i = 0; i < MAX_OPEN_DEVICES; i++) {
}
if (i == MAX_OPEN_DEVICES)
return openfail(ctx, ioreq, IOERR_OPENFAIL);
- trap_put_long(ctx, ioreq + 24, pdev - pdevst);
+ trap_put_longt(ctx, ioreq + 24, pdev - pdevst);
}
dev->opencnt++;
put_long(addr, v);
}
}
+void trap_put_longt(TrapContext* ctx, uaecptr addr, size_t v)
+{
+ if (trap_is_indirect_null(ctx)) {
+ call_hardware_trap_back(ctx, TRAPCMD_PUT_LONG, addr, (uae_u32)v, 0, 0);
+ }
+ else {
+ put_long(addr, (uae_u32)v);
+ }
+}
+
void trap_put_word(TrapContext *ctx, uaecptr addr, uae_u16 v)
{
if (trap_is_indirect_null(ctx)) {
zippath[0] = 0;
_tcscpy (name, pname);
- i = _tcslen (name) - 2;
+ i = uaetcslen (name) - 2;
while (i > 0) {
if ((name[i] == '/' || name[i] == '\\') && i > 4) {
v = name[i];
name[i] = 0;
for (j = 0; plugins_7z[j]; j++) {
- int len = _tcslen (plugins_7z[j]);
+ int len = uaetcslen (plugins_7z[j]);
if (name[i - len - 1] == '.' && !strcasecmp (name + i - len, plugins_7z[j])) {
struct zfile *f = zfile_fopen_nozip (name, _T("rb"));
if (f) {
p++;
}
*p = 0;
- if (size > strlen (s2) + 1)
- size = strlen (s2) + 1;
- au_copy (s, size, s2);
+ if (size > uaestrlen(s2) + 1)
+ size = uaestrlen(s2) + 1;
+ au_copy(s, size, s2);
return s + size;
} else {
bool alloc = false;
}
return NULL;
}
- if (size > strlen (s2) + 1)
- size = strlen (s2) + 1;
- au_copy (s, size, s2);
+ if (size > uaestrlen(s2) + 1)
+ size = uaestrlen(s2) + 1;
+ au_copy(s, size, s2);
if (alloc) {
xfree(s2);
}
int i;
if (f->name == NULL)
return NULL;
- for (i = _tcslen (f->name) - 1; i >= 0; i--) {
+ for (i = uaetcslen(f->name) - 1; i >= 0; i--) {
if (f->name[i] == '\\' || f->name[i] == '/' || f->name[i] == ':') {
i++;
return &f->name[i];
if (ext && ext > tmpname + 2 && ext[-2] == '.') {
ext[-1]++;
} else if (ext) {
- memmove (ext + 2, ext, (_tcslen (ext) + 1) * sizeof (TCHAR));
+ memmove (ext + 2, ext, (uaetcslen(ext) + 1) * sizeof (TCHAR));
ext[0] = '.';
ext[1] = '1';
} else {
- int len = _tcslen (tmpname);
+ int len = uaetcslen(tmpname);
tmpname[len] = '.';
tmpname[len + 1] = '1';
tmpname[len + 2] = 0;
i = 0;
if (name[0] != '/' && name[0] != '\\' && _tcsncmp(name, _T(".\\"), 2) != 0 && _tcsncmp(name, _T("..\\"), 3) != 0) {
if (_tcschr (name, ':') == 0) {
- for (i = _tcslen (name) - 1; i > 0; i--) {
+ for (i = uaetcslen (name) - 1; i > 0; i--) {
if (name[i] == FSDB_DIR_SEPARATOR) {
i++;
break;
if (!_tcsicmp (zpath, path))
return zn;
} else {
- int len = _tcslen (zpath);
- if (_tcslen (path) >= len && (path[len] == 0 || path[len] == FSDB_DIR_SEPARATOR) && !_tcsnicmp (zpath, path, len)) {
+ int len = uaetcslen(zpath);
+ if (uaetcslen(path) >= len && (path[len] == 0 || path[len] == FSDB_DIR_SEPARATOR) && !_tcsnicmp (zpath, path, len)) {
if (path[len] == 0)
return zn;
if (zn->vchild) {
char *an = ua (zai.name);
char *data = xmalloc (char, 1 + strlen (an) + 1 + 1 + 1);
sprintf (data, "\"%s\"\n", an);
- zn = addfile (zv, z, _T("s/startup-sequence"), (uae_u8*)data, strlen (data));
+ zn = addfile (zv, z, _T("s/startup-sequence"), (uae_u8*)data, uaestrlen (data));
xfree (data);
xfree (an);
}