Re: [Flashforth-devel] AVR assembler and disassembler
Brought to you by:
oh2aun
From: Mikael N. <mik...@fl...> - 2021-12-31 14:59:20
|
<div dir='auto'>See2 requires that you compile asm2 first.<div dir="auto"><br></div><div dir="auto">: toIO $20 - ;</div><div dir="auto"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 31 Dec 2021 13:35, Helge Kruse <Hel...@gm...> wrote:<br type="attribution" /><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Hello,</p> <p dir="ltr">I'm new to FlashForth. I want to use it for ATmega328 and ATmega2560.</p> <p dir="ltr">I try to implement an ISR for a bit bang serial port, since the<br> ATmega328 has only one USART. My minimum code example is:</p> <p dir="ltr">$002b constant portd<br> $002a constant ddrd<br> $08 constant txd    \ bit 3<br> $04 constant rxd    \ bit 2</p> <p dir="ltr">\ make an I/O addres from memory address for sbi and cbi.<br> : >IO  ( a - io )  $20 invert and ;</p> <p dir="ltr">: t2CompAIsr  txd portd mset  rxd portd mset  rxd portd mclr  txd portd<br> mclr ;</p> <p dir="ltr">: t2CompAIsr_<br>     [<br>       portd >IO txd sbi,<br>       portd >IO rxd sbi,<br>       portd >IO rxd cbi,<br>       portd >IO txd cbi,<br>     ]<br> ;i</p> <p dir="ltr">: irqCompAInit<br>     rxd ddrd mset \ to see write to rxd<br>     txd portd mset  txd ddrd mset</p> <p dir="ltr">     ['] t2CompAIsr_ compAIvec int!<br>     208 ocr2a c!  \ set comparator A register<br>     2 tccr2a c!   \ set CTC mode (WGM = 2)<br>     6 tccr2b c!   \ activate counter 2, clock source = clk_T2S/1<br>     2 timsk2 mset \ activate timer2 comparatorA interrupt OCIE2A<br> ;</p> <p dir="ltr">If I use mclr/mset to set the bits, I see the changes on the pins with a<br> logic analyzer. But unfortunately I can't see any change on the PORTD<br> pins if I use the word t2CompAIsr_.</p> <p dir="ltr">What's wrong with my assembler code? I  want to verify what I compiled<br> with the disassembler:</p> <p dir="ltr">see t2CompAIsr_<br> 975a 9a58<br> 975c 9a5c<br> 975e 985c<br> 9760 9858<br> 9762 940c 3c33 jmp   ...............<br>  ok<$,ram></p> <p dir="ltr">All the CBI/SBI is not decompiled. Probably this is not implemented in<br> "forth/avr/see.fs". I also tried "forth/avr/see2.fs". The later file<br> can't be compiled, a word sy1 is missing.</p> <p dir="ltr">How can I verify what's wrong with my simple code?</p> <p dir="ltr">Best regards,<br> Helge<br><br><br><br></p> <p dir="ltr">_______________________________________________<br> Flashforth-devel mailing list<br> Fla...@li...<br> https://lists.sourceforge.net/lists/listinfo/flashforth-devel<br> </p> </blockquote></div><br></div> |