summary refs log tree commit diff
path: root/pc-thing/instructions/swpm.ts
blob: f4856a22300b989855a0e5efb53705493338e540 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import { PC } from "../pc.ts";

export default {
    function(this: PC, [reg1, reg2]: number[]) {
        const addr1 = this.registers[this.lib.parseReg(reg1)]
        const addr2 = this.registers[this.lib.parseReg(reg2)]
        const data1 = 0 + this.getMem(+addr1)
        const data2 = 0 + this.getMem(+addr2)
        this.setMem(+addr1, data2)
        this.setMem(+addr2, data1)
    },
    args: 2
}