Tracing and correcting LMC programs – OCR A Level Computer Science lesson (H446)
Students learn to dry run an LMC program in a trace table and correct errors by giving the line number and the corrected line.
Lesson 4 of 13 in unit 12.7 Assembly Language and Software Development, taught in Year 12, Spring 2. It answers one big question: How do we find and fix errors in assembly code?
By the end, students can dry run an LMC program in a trace table and correct errors by giving the line number and the corrected line.
- The Build (the main task)
- Trace Stridewise's LMC program with the inputs 3 and 5 in a trace table, then identify and correct its two errors, giving the line number and the corrected line for each (6 marks).
- Support version
- A part-filled trace table with the first four rows done and the columns (line, ACC, mailboxes, output) labelled.
- Challenge
- Explain what the processor would do if the program's HLT were removed, using the fetch–decode–execute cycle.
- Real-world link
- A Stridewise developer's wristband routine gives the wrong total and must be fixed before release.
- Key words
- Halt, Dry run and Correct, each with a definition, an icon and a common mix-up on the key vocabulary slide.
- Misconceptions it tackles
- “A program without HLT simply stops after its last line”; “OUT outputs the value at an address”.
- OCR H446 specification
- 1.2.4 (c).
Every lesson follows the same Code & Commerce structure: a Bell Task recall starter, key vocabulary with definitions and icons, short teaching chunks with a check before pupils move on, The Build (one main task), challenge questions that get harder, and an exit question. Answers reveal one at a time on the slides, and everything is editable PowerPoint and Word.
Students need computers for the main task.
Also sold in the Assembly Language and Software Development unit bundle, which includes the medium term plan, and in the full-year and complete-course bundles.
An independent resource written for OCR A Level Computer Science (H446). It is not endorsed by OCR or Cambridge University Press & Assessment. Programming project (NEA) lessons teach general skills on a made-up example project and give supervised time, within JCQ's rules on the help a centre may give.
What's included
- Slide deck (PowerPoint)
- Lesson plan (Word)
- Worksheet (Word)
- Support worksheet with scaffolds (Word)
- Single-teacher licence: use and adapt it with your own classes
More for A Level Computer Science
See allStudents learn to describe how assembly language relates to machine code and explain when a programmer would choose it.
Free sample lessonStudents learn to write LMC programs that input, store, add, subtract and output values, and identify the opcode and operand of each instruction.
Students learn to write LMC programs that use BRA, BRZ and BRP with labels to make decisions and loops.
Written for the specifications named. Not endorsed by or affiliated with any exam board.