From 6b9117977909ca4250d9f002f04cf20294c3146f Mon Sep 17 00:00:00 2001 From: Tobias Girstmair Date: Wed, 28 Apr 2021 09:26:25 +0200 Subject: [PATCH] properly clear pa,tm2b,pwm; explain paph use --- bsv.asm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bsv.asm b/bsv.asm index f7bb7ff..2c34bc9 100644 --- a/bsv.asm +++ b/bsv.asm @@ -231,8 +231,12 @@ init: MOV pac, a ; (conserves power, apparently) MOV a, #(( 1<<4 )) MOV padier, a ; disable pin wakeup, except on audio pin + MOV paph, a ; enable pull-up on audio pin + ; Line input typically has an impedance of 10k-100kOhm, so we need our + ; pull-ups to be even higher. Since the ones of the PMS150C are + ; typically 100k-220k, we can use it and don't need an external one. + MOV a, #0 MOV pa, a ; PortA data = 0 - MOV paph, a ; disable all pull-ups ; timer2/pwm setup: ; Since (unlike in the ATTiny4 version) the interrupt timer is not tied @@ -355,6 +359,7 @@ interrupt: MOV tm2b, a ; generate new sample: +voice1: MOV a, i2; "mov mem,mem" MOV n, a; does not exist SL n @@ -372,6 +377,7 @@ interrupt: AND a, #0x1 MOV pwm, a +voice2: MOV a, i2 SL a SL a @@ -390,6 +396,7 @@ interrupt: AND a, #3 ADD pwm, a +voice3: MOV a, i2 MOV mod3hi, a SR mod3hi @@ -429,6 +436,7 @@ interrupt: AND a, #3 ADD pwm, a +voice4: MOV a, i2 MOV mod3hi, a SR mod3hi @@ -468,6 +476,7 @@ interrupt: AND a, #3 ADD a, pwm + SWAP a MOV pwm, a ; next sample is now ready. -- 2.39.3