Removed uxn_port

This commit is contained in:
neauoire 2022-04-05 10:48:13 -07:00
parent 5d80ab088c
commit 121f61e459
5 changed files with 8 additions and 36 deletions

View File

@ -154,7 +154,7 @@ file_delete(UxnFile *c)
/* IO */
void
file_deo(Uint8 id, Device *d, Uint8 port)
file_deo(Uint8 id, Uint8 *ram, Device *d, Uint8 port)
{
UxnFile *c = &uxn_file[id];
Uint16 addr, len, res;
@ -164,7 +164,7 @@ file_deo(Uint8 id, Device *d, Uint8 port)
DEVPEEK16(len, 0xa);
if(len > 0x10000 - addr)
len = 0x10000 - addr;
res = file_stat(c, &d->u->ram[addr], len);
res = file_stat(c, &ram[addr], len);
DEVPOKE16(0x2, res);
break;
case 0x6:
@ -173,7 +173,7 @@ file_deo(Uint8 id, Device *d, Uint8 port)
break;
case 0x9:
DEVPEEK16(addr, 0x8);
res = file_init(c, (char *)&d->u->ram[addr], 0x10000 - addr);
res = file_init(c, (char *)&ram[addr], 0x10000 - addr);
DEVPOKE16(0x2, res);
break;
case 0xd:
@ -181,7 +181,7 @@ file_deo(Uint8 id, Device *d, Uint8 port)
DEVPEEK16(len, 0xa);
if(len > 0x10000 - addr)
len = 0x10000 - addr;
res = file_read(c, &d->u->ram[addr], len);
res = file_read(c, &ram[addr], len);
DEVPOKE16(0x2, res);
break;
case 0xf:
@ -189,7 +189,7 @@ file_deo(Uint8 id, Device *d, Uint8 port)
DEVPEEK16(len, 0xa);
if(len > 0x10000 - addr)
len = 0x10000 - addr;
res = file_write(c, &d->u->ram[addr], len, d->dat[0x7]);
res = file_write(c, &ram[addr], len, d->dat[0x7]);
DEVPOKE16(0x2, res);
break;
}

View File

@ -13,6 +13,6 @@ WITH REGARD TO THIS SOFTWARE.
#define POLYFILEY 2
#define DEV_FILE0 0xa
void file_deo(Uint8 id, Device *d, Uint8 port);
void file_deo(Uint8 id, Uint8 *ram, Device *d, Uint8 port);
Uint8 file_dei(Uint8 id, Uint8 *d, Uint8 port);
int load_rom(Uxn *u, char *filename);

View File

@ -113,11 +113,3 @@ uxn_boot(Uxn *u, Uint8 *ram)
u->dpg = (Uint8*)(ram + 0x10200);
return 1;
}
Device *
uxn_port(Uxn *u, Uint8 id)
{
Device *d = &u->dev[id];
d->u = u;
return d;
}

View File

@ -34,7 +34,6 @@ typedef struct {
} Stack;
typedef struct Device {
struct Uxn *u;
Uint8 dat[16];
} Device;
@ -49,4 +48,3 @@ typedef struct Uxn {
int uxn_boot(Uxn *u, Uint8 *ram);
int uxn_eval(Uxn *u, Uint16 pc);
int uxn_halt(Uxn *u, Uint8 error, Uint16 addr);
Device *uxn_port(Uxn *u, Uint8 id);

View File

@ -80,8 +80,8 @@ uxn11_deo(Uxn *u, Uint8 addr, Uint8 v)
case 0x00: system_deo(u, d->dat, p); break;
case 0x10: console_deo(d->dat, p); break;
case 0x20: screen_deo(u->ram, d->dat, p); break;
case 0xa0: file_deo(0, d, p); break;
case 0xb0: file_deo(1, d, p); break;
case 0xa0: file_deo(0, u->ram, d, p); break;
case 0xb0: file_deo(1, u->ram, d, p); break;
}
}
@ -176,24 +176,6 @@ start(Uxn *u, char *rom)
fprintf(stderr, "Loaded %s\n", rom);
u->dei = uxn11_dei;
u->deo = uxn11_deo;
/* system */ uxn_port(u, 0x0);
/* console */ uxn_port(u, 0x1);
/* screen */ uxn_port(u, 0x2);
/* empty */ uxn_port(u, 0x3);
/* empty */ uxn_port(u, 0x4);
/* empty */ uxn_port(u, 0x5);
/* empty */ uxn_port(u, 0x6);
/* empty */ uxn_port(u, 0x7);
/* control */ uxn_port(u, 0x8);
/* mouse */ uxn_port(u, 0x9);
/* file0 */ uxn_port(u, 0xa);
/* file1 */ uxn_port(u, 0xb);
/* datetime */ uxn_port(u, 0xc);
/* empty */ uxn_port(u, 0xd);
/* reserved */ uxn_port(u, 0xe);
/* reserved */ uxn_port(u, 0xf);
screen_resize(&uxn_screen, WIDTH, HEIGHT);
if(!uxn_eval(u, PAGE_PROGRAM))
return error("Boot", "Failed to start rom.");