From: hackbard Date: Thu, 22 Jan 2004 03:09:04 +0000 (+0000) Subject: reworked part of the code X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db9964b83523d6892548d2e55cbfede35c33d473;p=my-code%2Fatmel.git reworked part of the code --- diff --git a/beginners/season_junior.asm b/beginners/season_junior.asm index 78c7962..703b29f 100644 --- a/beginners/season_junior.asm +++ b/beginners/season_junior.asm @@ -33,8 +33,9 @@ ; ; buffer/parse whole strings and decide whether to send to card or not. -; some defines -; ------------ +; ####### +; defines +; ####### ; baudrate = clock freq / etu ; std smartcard etu: 372 @@ -52,17 +53,43 @@ .define tmp2 r19 .define byte r20 .define overflow_counter r21 +.define counter_l r22 +.define counter_h r23 +.define state r24 +.define state_m r25 +.define mode r26 +.define counter_l_tmp r27 +.define counter_h_tmp r28 .define one r1 .define zero r0 - -; +; state +.define LOW (1<<0) +.define LOW_F 1 +.define HIGH (1<<1) +.define HIGH_F 2 +; mode +.define STUPID (1<<0) ; forward cam <-> card communication +.define STUPID_F 1 +.define COOL (1<<1) ; send time (clocks) & state via uart +.define COOL_F 2 +.define ELITE (1<<2) ; create bytes, maybe even whole command arrays +.define ELITE_F 3 +.define GODLIKE (1<<3) ; filter and mask for commands to card - send rejected via uart only +.define GODLIKE_F 4 +.define INCREDIBLE_HACK (1<<4) ; destroy all your hardware +.define INCREDIBLE_HACK_F 5 + +; but there is only stupid and cool mode right now %) + + +; ############# ; programm code -; ------------- +; ############# -; +; ------------------ ; interrupt vectors: -; +; ------------------ ; reset rjmp INIT @@ -97,9 +124,9 @@ reti ; analog comparator reti -; +; ------------ ; init routine -; +; ------------ INIT: @@ -118,7 +145,7 @@ out MCUCR,tmp ldi tmp,((1< calc delta, store to counter_l_tmp, counter_h_tmp -reti +; send time and state via uart +sbrc mode,COOL_F +rcall SEND_TO_UART ; -> prepare date & enable uart dre interrupt (sbi UCR,UDRIE) -REC_CARD_LOW: +; return +reti -; save counter -in r27,ICR1L -in r28,ICR1H +; ------------------------ +; toggle_icp_sense routine +; ------------------------ -; output low on port to cam -cbi PORTD,PD3 +TOGGLE_ICP_SENSE: -; toggle icp sense +; toggle according to state +cbi TCCR1B,ICES1 +sbrs state,HIGH sbi TCCR1B,ICES1 -; status to submit -ldi r26,0 +; return +ret -; enable uart dre interrupt -sbi UCR,UDRIE +; ------------------ +; fwd_to_cam routine +; ------------------ -reti +; output state on port to cam +mov tmp,state +andi tmp,HIGH +lsl tmp ; as we have to set pd3 (dirty, shorter way?) +sbi DDRD,DDD3 +out PORTD,tmp ; <- hunz: low or high if pd3 bit is set ? + +; return +ret + + +; zzZZzZzZZZ .... hier gehts weiter !!! ; ; rec_cam routines