aboutsummaryrefslogtreecommitdiffgithub
path: root/novice/assembler/opspec/word.ts
blob: 4125045be47a5cad425d39abe6c16d35ca6b83c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { maskTo } from '../../util';
import { AsmContext, oneWord, OpOperands, PseudoOpSpec } from './opspec';

const wordOpSpec: PseudoOpSpec = {
    ops: [
        {name: 'word',
         operands: [{kind: 'int', name: 'num'}],
         asm: (ctx: AsmContext, operands: OpOperands) =>
            // TODO: complain if too big
            [maskTo(operands.ints.num, ctx.isa.mem.addressability)]},

        {name: 'word',
         operands: [{kind: 'label', name: 'label'}],
         size: oneWord,
         asm: (ctx: AsmContext, operands: OpOperands) =>
            // TODO: complain if nonexistent
            [ctx.symbtable[operands.labels.label]]},
    ],
};

export { wordOpSpec };