Removed indirection in system_deo
This commit is contained in:
parent
f785d15d65
commit
d49514e257
|
@ -101,43 +101,41 @@ system_dei(Uint8 addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
system_deo(Uxn *u, Uint8 *d, Uint8 port)
|
system_deo(Uint8 *d, Uint8 port)
|
||||||
{
|
{
|
||||||
Uint8 *ram;
|
|
||||||
Uint16 addr;
|
Uint16 addr;
|
||||||
switch(port) {
|
switch(port) {
|
||||||
case 0x3:
|
case 0x3:
|
||||||
ram = u->ram;
|
|
||||||
addr = PEEK2(d + 2);
|
addr = PEEK2(d + 2);
|
||||||
if(ram[addr] == 0x0) {
|
if(uxn.ram[addr] == 0x0) {
|
||||||
Uint8 value = ram[addr + 7];
|
Uint8 value = uxn.ram[addr + 7];
|
||||||
Uint16 i, length = PEEK2(ram + addr + 1);
|
Uint16 i, length = PEEK2(uxn.ram + addr + 1);
|
||||||
Uint16 dst_page = PEEK2(ram + addr + 3), dst_addr = PEEK2(ram + addr + 5);
|
Uint16 dst_page = PEEK2(uxn.ram + addr + 3), dst_addr = PEEK2(uxn.ram + addr + 5);
|
||||||
int dst = (dst_page % RAM_PAGES) * 0x10000;
|
int dst = (dst_page % RAM_PAGES) * 0x10000;
|
||||||
for(i = 0; i < length; i++)
|
for(i = 0; i < length; i++)
|
||||||
ram[dst + (Uint16)(dst_addr + i)] = value;
|
uxn.ram[dst + (Uint16)(dst_addr + i)] = value;
|
||||||
} else if(ram[addr] == 0x1) {
|
} else if(uxn.ram[addr] == 0x1) {
|
||||||
Uint16 i, length = PEEK2(ram + addr + 1);
|
Uint16 i, length = PEEK2(uxn.ram + addr + 1);
|
||||||
Uint16 a_page = PEEK2(ram + addr + 3), a_addr = PEEK2(ram + addr + 5);
|
Uint16 a_page = PEEK2(uxn.ram + addr + 3), a_addr = PEEK2(uxn.ram + addr + 5);
|
||||||
Uint16 b_page = PEEK2(ram + addr + 7), b_addr = PEEK2(ram + addr + 9);
|
Uint16 b_page = PEEK2(uxn.ram + addr + 7), b_addr = PEEK2(uxn.ram + addr + 9);
|
||||||
int src = (a_page % RAM_PAGES) * 0x10000, dst = (b_page % RAM_PAGES) * 0x10000;
|
int src = (a_page % RAM_PAGES) * 0x10000, dst = (b_page % RAM_PAGES) * 0x10000;
|
||||||
for(i = 0; i < length; i++)
|
for(i = 0; i < length; i++)
|
||||||
ram[dst + (Uint16)(b_addr + i)] = ram[src + (Uint16)(a_addr + i)];
|
uxn.ram[dst + (Uint16)(b_addr + i)] = uxn.ram[src + (Uint16)(a_addr + i)];
|
||||||
} else if(ram[addr] == 0x2) {
|
} else if(uxn.ram[addr] == 0x2) {
|
||||||
Uint16 i, length = PEEK2(ram + addr + 1);
|
Uint16 i, length = PEEK2(uxn.ram + addr + 1);
|
||||||
Uint16 a_page = PEEK2(ram + addr + 3), a_addr = PEEK2(ram + addr + 5);
|
Uint16 a_page = PEEK2(uxn.ram + addr + 3), a_addr = PEEK2(uxn.ram + addr + 5);
|
||||||
Uint16 b_page = PEEK2(ram + addr + 7), b_addr = PEEK2(ram + addr + 9);
|
Uint16 b_page = PEEK2(uxn.ram + addr + 7), b_addr = PEEK2(uxn.ram + addr + 9);
|
||||||
int src = (a_page % RAM_PAGES) * 0x10000, dst = (b_page % RAM_PAGES) * 0x10000;
|
int src = (a_page % RAM_PAGES) * 0x10000, dst = (b_page % RAM_PAGES) * 0x10000;
|
||||||
for(i = length - 1; i != 0xffff; i--)
|
for(i = length - 1; i != 0xffff; i--)
|
||||||
ram[dst + (Uint16)(b_addr + i)] = ram[src + (Uint16)(a_addr + i)];
|
uxn.ram[dst + (Uint16)(b_addr + i)] = uxn.ram[src + (Uint16)(a_addr + i)];
|
||||||
} else
|
} else
|
||||||
fprintf(stderr, "Unknown Expansion Command 0x%02x\n", ram[addr]);
|
fprintf(stderr, "Unknown Expansion Command 0x%02x\n", uxn.ram[addr]);
|
||||||
break;
|
break;
|
||||||
case 0x4:
|
case 0x4:
|
||||||
u->wst.ptr = d[4];
|
uxn.wst.ptr = d[4];
|
||||||
break;
|
break;
|
||||||
case 0x5:
|
case 0x5:
|
||||||
u->rst.ptr = d[5];
|
uxn.rst.ptr = d[5];
|
||||||
break;
|
break;
|
||||||
case 0xe:
|
case 0xe:
|
||||||
system_inspect();
|
system_inspect();
|
||||||
|
|
|
@ -18,6 +18,6 @@ int system_error(char *msg, const char *err);
|
||||||
int system_boot(Uint8 *ram, char *rom);
|
int system_boot(Uint8 *ram, char *rom);
|
||||||
|
|
||||||
Uint8 system_dei(Uint8 addr);
|
Uint8 system_dei(Uint8 addr);
|
||||||
void system_deo(Uxn *u, Uint8 *d, Uint8 port);
|
void system_deo(Uint8 *d, Uint8 port);
|
||||||
|
|
||||||
extern char *boot_rom;
|
extern char *boot_rom;
|
|
@ -63,7 +63,7 @@ emu_deo(Uint8 addr, Uint8 value)
|
||||||
uxn.dev[addr] = value;
|
uxn.dev[addr] = value;
|
||||||
switch(d) {
|
switch(d) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
system_deo(&uxn, &uxn.dev[d], p);
|
system_deo(&uxn.dev[d], p);
|
||||||
if(p > 0x7 && p < 0xe)
|
if(p > 0x7 && p < 0xe)
|
||||||
screen_palette(&uxn.dev[0x8]);
|
screen_palette(&uxn.dev[0x8]);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -37,7 +37,7 @@ emu_deo(Uint8 addr, Uint8 value)
|
||||||
Uint8 p = addr & 0x0f, d = addr & 0xf0;
|
Uint8 p = addr & 0x0f, d = addr & 0xf0;
|
||||||
uxn.dev[addr] = value;
|
uxn.dev[addr] = value;
|
||||||
switch(d) {
|
switch(d) {
|
||||||
case 0x00: system_deo(&uxn, &uxn.dev[d], p); break;
|
case 0x00: system_deo(&uxn.dev[d], p); break;
|
||||||
case 0x10: console_deo(&uxn, &uxn.dev[d], p); break;
|
case 0x10: console_deo(&uxn, &uxn.dev[d], p); break;
|
||||||
case 0xa0: file_deo(0, uxn.ram, &uxn.dev[d], p); break;
|
case 0xa0: file_deo(0, uxn.ram, &uxn.dev[d], p); break;
|
||||||
case 0xb0: file_deo(1, uxn.ram, &uxn.dev[d], p); break;
|
case 0xb0: file_deo(1, uxn.ram, &uxn.dev[d], p); break;
|
||||||
|
|
Loading…
Reference in New Issue