summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorChris Boesch <chrboesch@noreply.codeberg.org>2025-02-13 22:27:29 +0000
committerChris Boesch <chrboesch@noreply.codeberg.org>2025-02-13 22:27:29 +0000
commit0e0cafb71ea7adc40fbc1844c60d89126c2bda3e (patch)
treec32eaedcb06f3ee2db7f8cf7a3f49ed236b7565e /build.zig
parent0af4f75e070ddc200b4de250425425cf145c2717 (diff)
parent064184c8a78d460b1d20837ef0064274f4730905 (diff)
Merge pull request 'Suggesting a third exercise for bit manipulation' (#202) from alexsisco/zigling-exercises:bit_man3 into main
Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/202
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig31
1 files changed, 31 insertions, 0 deletions
diff --git a/build.zig b/build.zig
index 54479cb..25d831c 100644
--- a/build.zig
+++ b/build.zig
@@ -1269,6 +1269,37 @@ const exercises = [_]Exercise{
\\Max difference (new fn): 0.014
,
},
+ .{ .main_file = "110_quiz9.zig", .output =
+ \\Toggle pins with XOR on PORTB
+ \\-----------------------------
+ \\ 1100 // (initial state of PORTB)
+ \\^ 0101 // (bitmask)
+ \\= 1001
+ \\
+ \\ 1100 // (initial state of PORTB)
+ \\^ 0011 // (bitmask)
+ \\= 1111
+ \\
+ \\Set pins with OR on PORTB
+ \\-------------------------
+ \\ 1001 // (initial state of PORTB)
+ \\| 0100 // (bitmask)
+ \\= 1101
+ \\
+ \\ 1001 // (reset state)
+ \\| 0100 // (bitmask)
+ \\= 1101
+ \\
+ \\Clear pins with AND and NOT on PORTB
+ \\------------------------------------
+ \\ 1110 // (initial state of PORTB)
+ \\& 1011 // (bitmask)
+ \\= 1010
+ \\
+ \\ 0111 // (reset state)
+ \\& 1110 // (bitmask)
+ \\= 0110
+ },
.{
.main_file = "999_the_end.zig",
.output =