mirror of
https://github.com/DaanVandenBosch/phantasmal-world.git
synced 2025-04-05 23:38:30 +08:00
[VM] Made the implementation of opcodes letb and letw more correct.
This commit is contained in:
parent
4b7e03931c
commit
cd52ca4576
@ -248,8 +248,10 @@ export class VirtualMachine {
|
||||
this.set_register_signed(arg0, arg1);
|
||||
break;
|
||||
case OP_LETB.code:
|
||||
this.set_register_byte(arg0, arg1);
|
||||
break;
|
||||
case OP_LETW.code:
|
||||
this.set_register_unsigned(arg0, arg1);
|
||||
this.set_register_word(arg0, arg1);
|
||||
break;
|
||||
case OP_LETA.code:
|
||||
this.set_register_unsigned(arg0, this.get_register_address(arg0));
|
||||
@ -596,6 +598,22 @@ export class VirtualMachine {
|
||||
this.registers.write_u32_at(REGISTER_SIZE * reg, value);
|
||||
}
|
||||
|
||||
public get_register_word(reg: number): number {
|
||||
return this.registers.u16_at(REGISTER_SIZE * reg);
|
||||
}
|
||||
|
||||
private set_register_word(reg: number, value: number): void {
|
||||
this.registers.write_u16_at(REGISTER_SIZE * reg, value);
|
||||
}
|
||||
|
||||
public get_register_byte(reg: number): number {
|
||||
return this.registers.u8_at(REGISTER_SIZE * reg);
|
||||
}
|
||||
|
||||
public set_register_byte(reg: number, value: number): void {
|
||||
this.registers.write_u8_at(REGISTER_SIZE * reg, value)
|
||||
}
|
||||
|
||||
public get_register_float(reg: number): number {
|
||||
return this.registers.f32_at(REGISTER_SIZE * reg);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user