summaryrefslogtreecommitdiff
path: root/Software/pinlock.asm
diff options
context:
space:
mode:
Diffstat (limited to 'Software/pinlock.asm')
-rw-r--r--Software/pinlock.asm29
1 files changed, 27 insertions, 2 deletions
diff --git a/Software/pinlock.asm b/Software/pinlock.asm
index ee80741..ba12dc9 100644
--- a/Software/pinlock.asm
+++ b/Software/pinlock.asm
@@ -5,6 +5,8 @@
.def cnt = r19
.def tmp1 = r20
.def tmp2 = r21
+.def ret0 = r22
+.def ret1 = r23
init:
ldi tmp0, HIGH(RAMEND)
@@ -18,7 +20,7 @@ init:
out DDRA, tmp0
ldi tmp0, 0b11111111
out DDRB, tmp0
- ldi tmp0, 0b11000000
+ ldi tmp0, 0b11101100
out DDRD, tmp0
ldi tmp0, 0b00000000
out PORTD, tmp0
@@ -39,6 +41,7 @@ init:
main:
ldi par0, 0b11111111
rcall status
+ rjmp [tmp0]
wait:
mov tmp0, par0
@@ -52,7 +55,10 @@ wait:
ret
; Output the status
+; Parameters:
; par0 = Status bits
+; Returns:
+; None
status:
ldi tmp0, 1
status_loop:
@@ -77,9 +83,12 @@ status_end:
brne status_loop
ret
-; Display the digit on a given display
+; Display the digit on a given display.
+; Parameters:
; par0 = Display number
; par1 = Digit
+; Returns:
+; None
display:
mov tmp0, par1
andi tmp0, 0x0F
@@ -124,3 +133,19 @@ display_3:
or tmp1, tmp0
out PORTB, tmp1
ret
+
+; Read the input buttons.
+; Parameters:
+; None
+; Returns:
+; ret0 = 123A456B
+; ret1 = 789C*0#D
+input:
+ ; Write selection rows
+ ldi tmp0, 1
+ ldi tmp1, 1
+input_loop:
+ mov tmp2, tmp0
+ and tmp2, tmp1
+ cp tmp1, tmp2
+ breq input_set