|
|
|
@ -73,21 +73,31 @@ system_expansion(const Uint16 addr) |
|
|
|
Uint8 *aptr = uxn.ram + addr; |
|
|
|
Uint8 *aptr = uxn.ram + addr; |
|
|
|
Uint16 length = PEEK2(aptr + 1); |
|
|
|
Uint16 length = PEEK2(aptr + 1); |
|
|
|
if(uxn.ram[addr] == 0x0) { |
|
|
|
if(uxn.ram[addr] == 0x0) { |
|
|
|
unsigned int a = PEEK2(aptr + 3) * 0x10000 + PEEK2(aptr + 5); |
|
|
|
unsigned int src_bank = PEEK2(aptr + 3); |
|
|
|
|
|
|
|
unsigned int src_addr = PEEK2(aptr + 5); |
|
|
|
|
|
|
|
unsigned int src_value = uxn.ram[addr + 7]; |
|
|
|
|
|
|
|
unsigned int a = src_bank * 0x10000 + src_addr; |
|
|
|
unsigned int b = a + length; |
|
|
|
unsigned int b = a + length; |
|
|
|
unsigned int value = uxn.ram[addr + 7]; |
|
|
|
for(b = b < BANKS_CAP ? b : BANKS_CAP; a < b; uxn.ram[a++] = src_value); |
|
|
|
for(b = b < BANKS_CAP ? b : BANKS_CAP; a < b; uxn.ram[a++] = value); |
|
|
|
|
|
|
|
} else if(uxn.ram[addr] == 0x1) { |
|
|
|
} else if(uxn.ram[addr] == 0x1) { |
|
|
|
unsigned int a = PEEK2(aptr + 3) * 0x10000 + PEEK2(aptr + 5); |
|
|
|
unsigned int src_bank = PEEK2(aptr + 3); |
|
|
|
|
|
|
|
unsigned int src_addr = PEEK2(aptr + 5); |
|
|
|
|
|
|
|
unsigned int dst_bank = PEEK2(aptr + 7); |
|
|
|
|
|
|
|
unsigned int dst_addr = PEEK2(aptr + 9); |
|
|
|
|
|
|
|
unsigned int a = src_bank * 0x10000 + src_addr; |
|
|
|
unsigned int b = a + length; |
|
|
|
unsigned int b = a + length; |
|
|
|
unsigned int c = PEEK2(aptr + 7) * 0x10000 + PEEK2(aptr + 9); |
|
|
|
unsigned int c = dst_bank * 0x10000 + dst_addr; |
|
|
|
for(b = b < BANKS_CAP ? b : BANKS_CAP; a < b; uxn.ram[c++] = uxn.ram[a++]); |
|
|
|
for(b = b < BANKS_CAP ? b : BANKS_CAP; a < b; uxn.ram[c++] = uxn.ram[a++]); |
|
|
|
} else if(uxn.ram[addr] == 0x2) { |
|
|
|
} else if(uxn.ram[addr] == 0x2) { |
|
|
|
unsigned int a = PEEK2(aptr + 3) * 0x10000 + PEEK2(aptr + 5); |
|
|
|
unsigned int src_bank = PEEK2(aptr + 3); |
|
|
|
|
|
|
|
unsigned int src_addr = PEEK2(aptr + 5); |
|
|
|
|
|
|
|
unsigned int dst_bank = PEEK2(aptr + 7); |
|
|
|
|
|
|
|
unsigned int dst_addr = PEEK2(aptr + 9); |
|
|
|
|
|
|
|
unsigned int a = src_bank * 0x10000 + src_addr; |
|
|
|
unsigned int b = a + length; |
|
|
|
unsigned int b = a + length; |
|
|
|
unsigned int c = PEEK2(aptr + 7) * 0x10000 + PEEK2(aptr + 9); |
|
|
|
unsigned int c = dst_bank * 0x10000 + dst_addr; |
|
|
|
unsigned int d = c + length; |
|
|
|
unsigned int d = c + length; |
|
|
|
for(; b >= a; uxn.ram[--d] = uxn.ram[--b]); |
|
|
|
for(; b > a; uxn.ram[--d] = uxn.ram[--b]); |
|
|
|
} else |
|
|
|
} else |
|
|
|
fprintf(stderr, "Unknown command: %s\n", &uxn.ram[addr]); |
|
|
|
fprintf(stderr, "Unknown command: %s\n", &uxn.ram[addr]); |
|
|
|
} |
|
|
|
} |
|
|
|
|