Skip to content
Tactiverge
Level 2DebuggingWrite a program

Debug: the larger of two

This program should read a and b and output the larger one. It works for some inputs and not others. Find the bug and fix it. (Remember: after SUB, C = 1 means a borrow, so the first number was smaller.)

Public tests

  • input 3, 9 → 9
  • input 9, 3 → 9
  • input 5, 5 → 5
  • input 0, 255 → 255
  • input 200, 199 → 200

Scored on correctness: every test must pass. Skills: flags, JC, reading a bug.

New to this? Silicon Studio 11: Arithmetic logic unit

How results are computed: model assumptions.

One instruction per line. Labels end with a colon, comments start with a semicolon. Numbers can be 12, 0x0C or 0b1100.