Skip to content

Commit ef867db

Browse files
ZERICO2005mateoconlechuga
authored andcommitted
optimized clock zeroize
1 parent e99291d commit ef867db

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

src/crt/crt0.S

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,16 @@ ___libload_libs_ret:
288288
res ti.bTmr1Enable, (hl)
289289
set ti.bTmr1Crystal, (hl)
290290
res ti.bTmr1Overflow, (hl)
291-
ld l, (ti.mpTmr1Counter + 1) & 0xFF
292-
ld de, 0 ; Set the counter to zero
293-
ld (hl), de
294-
dec hl
295-
ld (hl), e
291+
292+
; Set the counter to zero
293+
.errif (ti.mpTmr1Counter & 0xFFFF) != 0
294+
ld l, h ; ld hl, ti.mpTmr1Counter
295+
ld b, 4
296+
.L.zeroize_counter:
297+
ld (hl), h
298+
inc hl
299+
djnz .L.zeroize_counter
300+
296301
ld l, ti.mpTmrCtrl & 0xFF
297302
set ti.bTmr1Enable, (hl) ; Enable the timer
298303
#endif

0 commit comments

Comments
 (0)