Named system_cmd arguments

This commit is contained in:
Devine Lu Linvega 2023-02-02 10:39:57 -08:00
parent 5ceffe233f
commit 2039e0fb4a
2 changed files with 7 additions and 9 deletions

View File

@ -41,7 +41,7 @@
;&mmu #02 DEO2 ;&mmu #02 DEO2
BRK BRK
&mmu 01 0001 0002 89ab 0003 3333 &mmu 01 1234 4567 789a 2345 6789
@draw-polycat ( -- ) @draw-polycat ( -- )

View File

@ -36,14 +36,12 @@ static void
system_cmd(Uint8 *ram, Uint16 addr) system_cmd(Uint8 *ram, Uint16 addr)
{ {
if(ram[addr] == 0x01) { if(ram[addr] == 0x01) {
int src, dst; Uint16 i, length = PEEK16(ram + addr + 1);
Uint16 i, args[5]; /* length, a_page, a_addr, b_page, b_addr */ Uint16 a_page = PEEK16(ram + addr + 1 + 2), a_addr = PEEK16(ram + addr + 1 + 4);
for(i = 0; i < 5; i++) Uint16 b_page = PEEK16(ram + addr + 1 + 6), b_addr = PEEK16(ram + addr + 1 + 8);
args[i] = PEEK16(ram + addr + 1 + i * 2); int src = (a_page % RAM_PAGES) * 0x10000, dst = (b_page % RAM_PAGES) * 0x10000;
src = (args[1] % RAM_PAGES) * 0x10000; for(i = 0; i < length; i++)
dst = (args[3] % RAM_PAGES) * 0x10000; ram[dst + (Uint16)(b_addr + i)] = ram[src + (Uint16)(a_addr + i)];
for(i = 0; i < args[0]; i++)
ram[dst + (Uint16)(args[4] + i)] = ram[src + (Uint16)(args[2] + i)];
} }
} }