diff --git a/src/instruction/atomic/index.ts b/src/instruction/atomic/index.ts index 95bce90..da1d01c 100644 --- a/src/instruction/atomic/index.ts +++ b/src/instruction/atomic/index.ts @@ -13,11 +13,13 @@ export * from "./greater_than"; export * from "./greater_than_equals"; export * from "./if"; export * from "./increment"; +export * from "./int"; export * from "./left_shift"; export * from "./less_than"; export * from "./less_than_equals"; export * from "./literal"; export * from "./load"; +export * from "./lodsb"; export * from "./marine"; export * from "./memory"; export * from "./next"; diff --git a/src/instruction/atomic/int.ts b/src/instruction/atomic/int.ts new file mode 100644 index 0000000..ad5b0e3 --- /dev/null +++ b/src/instruction/atomic/int.ts @@ -0,0 +1,10 @@ +import { Instruction } from "../instruction"; + +export class InterruptInstruction extends Instruction { + public to_asm(_instruction_index: number): string { + return "pop ax\nint ax"; + } + public to_wat(_instruction_index: number): string { + throw new Error("Method not implemented."); + } +} diff --git a/src/instruction/atomic/lodsb.ts b/src/instruction/atomic/lodsb.ts new file mode 100644 index 0000000..c125eb2 --- /dev/null +++ b/src/instruction/atomic/lodsb.ts @@ -0,0 +1,10 @@ +import { Instruction } from "../instruction"; + +export class LoadStringBytesInstruction extends Instruction { + public to_asm(_instruction_index: number): string { + return "lodsb"; + } + public to_wat(_instruction_index: number): string { + throw new Error("Method not implemented."); + } +} diff --git a/src/lexer/lookup_table.ts b/src/lexer/lookup_table.ts index abc4b64..2465ab7 100644 --- a/src/lexer/lookup_table.ts +++ b/src/lexer/lookup_table.ts @@ -8,14 +8,16 @@ import { DropInstruction, EndIfInstruction, EqualityInstruction, - GreaterThanInstruction, GreaterThanEqualsInstruction, + GreaterThanInstruction, IncrementInstruction, Instruction, + InterruptInstruction, LeftBinaryShiftInstruction, - LessThanInstruction, LessThanEqualsInstruction, + LessThanInstruction, LoadMemoryInstruction, + LoadStringBytesInstruction, MarineInstruction, NotEqualityInstruction, OverInstruction, @@ -79,7 +81,9 @@ export class InstructionLookupTable { else: UnreferencedElseInstruction, endif: EndIfInstruction, if: UnreferencedIfInstruction, + int: InterruptInstruction, load: LoadMemoryInstruction, + lodsb: LoadStringBytesInstruction, marine: MarineInstruction, mem: PushMemoryPointerInstruction, over: OverInstruction,