Skip to content

Commit 619a487

Browse files
Fix empty-buffer crash on '#'; CI now verifies all three PART_SELECT configs
- DisplayMessage: guard with tst r21 / breq Checkpress3 so pressing '#' with no characters buffered does not read uninitialized SRAM (r21=0 wraps to 255 and displays 256 garbage entries) - CI: assemble Lab 7 three times via sed substitution of PART_SELECT (1=timer LED roll, 2=keypad ASCII lookup, 3=SRAM message buffer)
1 parent 16e80cf commit 619a487

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

.github/workflows/avr-build.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,19 @@ jobs:
2626
- name: Assemble Lab 6 (external interrupts)
2727
run: avra -I "$AVRA_INC" Lab6_Interrupts/lab6_interrupts.asm
2828

29-
- name: Assemble Lab 7 (timers / keypad, Part 3)
29+
- name: Assemble Lab 7 Part 1 (timer LED roll)
30+
run: |
31+
sed 's/^\.equ PART_SELECT = ./.equ PART_SELECT = 1/' \
32+
Lab7_Timers_Keypad/lab7_timers_keypad.asm > /tmp/lab7_p1.asm
33+
avra -I "$AVRA_INC" /tmp/lab7_p1.asm
34+
35+
- name: Assemble Lab 7 Part 2 (keypad ASCII lookup)
36+
run: |
37+
sed 's/^\.equ PART_SELECT = ./.equ PART_SELECT = 2/' \
38+
Lab7_Timers_Keypad/lab7_timers_keypad.asm > /tmp/lab7_p2.asm
39+
avra -I "$AVRA_INC" /tmp/lab7_p2.asm
40+
41+
- name: Assemble Lab 7 Part 3 (SRAM message buffer)
3042
run: avra -I "$AVRA_INC" Lab7_Timers_Keypad/lab7_timers_keypad.asm
3143

3244
- name: Assemble Lab 8 Part 2 (PWM servo)

Lab7_Timers_Keypad/lab7_timers_keypad.asm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ ReleaseSecond3:
196196
rjmp Checkpress3
197197

198198
DisplayMessage:
199+
tst r21 ; any characters buffered?
200+
breq Checkpress3 ; no -- ignore '#' and keep waiting
199201
ldi r16, 12
200202
out TCNT0, r16
201203
ldi r16, 0x05 ; start timer, prescaler 1024

0 commit comments

Comments
 (0)