Merge pull request #1 from Mtgxyz/master

You asked for it
This commit is contained in:
Felix Queißner 2016-06-05 16:03:04 +02:00
commit 5cbf686047
2 changed files with 23 additions and 4 deletions

View file

@ -9,12 +9,31 @@ static void cmd_copy(CommandInfo *info)
static void cmd_load(Process *p, CommandInfo *info)
{
info->output = vm_read_byte(p, info->input0);
info->output = 0;
switch(info->additional) {
case 2:
info->output|=(uint32_t)(vm_read_byte(p, info->input0+3))<<24;
info->output|=(uint32_t)(vm_read_byte(p, info->input0+2))<<16;
case 1:
info->output|=(uint32_t)(vm_read_byte(p, info->input0+1))<< 8;
case 0:
info->output|=(uint32_t)(vm_read_byte(p, info->input0+0))<< 0;
break;
}
}
static void cmd_store(Process *p, CommandInfo *info)
{
switch(info->additional) {
case 2:
vm_write_byte(p, info->input0+3, info->input1>>24);
vm_write_byte(p, info->input0+2, info->input1>>16);
case 1:
vm_write_byte(p, info->input0+1, info->input1>>8);
case 0:
vm_write_byte(p, info->input0, info->input1);
break;
}
info->output = info->input1;
}