62 lines
1.4 KiB
NASM
62 lines
1.4 KiB
NASM
; ***************************************************************************
|
|
; copyright : (C) 2023 by Martin Preuss
|
|
; email : martin@libchipcard.de
|
|
;
|
|
; ***************************************************************************
|
|
; * This file is part of the project "AqHome". *
|
|
; * Please see toplevel file COPYING of that project for license details. *
|
|
; ***************************************************************************
|
|
|
|
|
|
|
|
; ***************************************************************************
|
|
; code
|
|
|
|
|
|
.cseg
|
|
|
|
|
|
|
|
|
|
; ---------------------------------------------------------------------------
|
|
; Handle FLASH START packet.
|
|
;
|
|
; IN:
|
|
; - X : buffer containing the message
|
|
; OUT:
|
|
; - CFLAG: set if message is for us, cleared otherwise
|
|
; REGS: r16, r18, r19, r20, r21, X, Y (R15, R17, R22)
|
|
|
|
flashHandleFlashStart:
|
|
ldi yh, HIGH(flashUid)
|
|
ldi yl, LOW(flashUid)
|
|
ld r18, Y+
|
|
ld r19, Y+
|
|
ld r20, Y+
|
|
ld r21, Y
|
|
adiw xh:xl, FLASH_PACKET_START_OFFS_UID
|
|
ld r16, X+
|
|
cp r16, r18
|
|
brne flashHandleFlashStart_notMe
|
|
ld r16, X+
|
|
cp r16, r19
|
|
brne flashHandleFlashStart_notMe
|
|
ld r16, X+
|
|
cp r16, r20
|
|
brne flashHandleFlashStart_notMe
|
|
ld r16, X
|
|
cp r16, r21
|
|
brne flashHandleFlashStart_notMe
|
|
; okay, flash start message is for us
|
|
rcall flashWaitFor100ms
|
|
clr r16
|
|
rcall flashSendFlashResponse ; (R15, R16, R17, R18, R19, R20, R21, R22, X)
|
|
sec
|
|
ret
|
|
flashHandleFlashStart_notMe:
|
|
clc
|
|
ret
|
|
|
|
|
|
|