Skip to content

Commit

Permalink
doc comments for fx75/fx85
Browse files Browse the repository at this point in the history
  • Loading branch information
190n committed May 16, 2024
1 parent 7dfe60a commit 7b5f42a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/instruction.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,7 @@ test "FX65 load registers" {
try std.testing.expectEqual(std.mem.zeroes([16]u8), cpu.V);
}

/// FX75: store registers [V0, VX] in flags. X < 8
fn opSaveFlags(self: Instruction, cpu: *Cpu) !?u12 {
if (self.regX > 8) return error.FlagOverflow;
@memcpy(cpu.flags[0 .. self.regX + 1], cpu.V[0 .. self.regX + 1]);
Expand All @@ -1042,6 +1043,7 @@ test "FX75 save flags" {
try std.testing.expectEqual([_]u8{ 0x11, 0x22, 0, 0, 0, 0, 0, 0xff }, cpu.flags);
}

/// FX75: load flags into [V0, VX]. X < 8
fn opLoadFlags(self: Instruction, cpu: *Cpu) !?u12 {
if (self.regX > 8) return error.FlagOverflow;
@memcpy(cpu.V[0 .. self.regX + 1], cpu.flags[0 .. self.regX + 1]);
Expand Down

0 comments on commit 7b5f42a

Please sign in to comment.