[Flashforth-devel] AVR assembler and disassembler
Brought to you by:
oh2aun
From: Helge K. <Hel...@gm...> - 2021-12-31 11:36:07
|
Hello, I'm new to FlashForth. I want to use it for ATmega328 and ATmega2560. I try to implement an ISR for a bit bang serial port, since the ATmega328 has only one USART. My minimum code example is: $002b constant portd $002a constant ddrd $08 constant txd \ bit 3 $04 constant rxd \ bit 2 \ make an I/O addres from memory address for sbi and cbi. : >IO ( a - io ) $20 invert and ; : t2CompAIsr txd portd mset rxd portd mset rxd portd mclr txd portd mclr ; : t2CompAIsr_ [ portd >IO txd sbi, portd >IO rxd sbi, portd >IO rxd cbi, portd >IO txd cbi, ] ;i : irqCompAInit rxd ddrd mset \ to see write to rxd txd portd mset txd ddrd mset ['] t2CompAIsr_ compAIvec int! 208 ocr2a c! \ set comparator A register 2 tccr2a c! \ set CTC mode (WGM = 2) 6 tccr2b c! \ activate counter 2, clock source = clk_T2S/1 2 timsk2 mset \ activate timer2 comparatorA interrupt OCIE2A ; If I use mclr/mset to set the bits, I see the changes on the pins with a logic analyzer. But unfortunately I can't see any change on the PORTD pins if I use the word t2CompAIsr_. What's wrong with my assembler code? I want to verify what I compiled with the disassembler: see t2CompAIsr_ 975a 9a58 975c 9a5c 975e 985c 9760 9858 9762 940c 3c33 jmp ............... ok<$,ram> All the CBI/SBI is not decompiled. Probably this is not implemented in "forth/avr/see.fs". I also tried "forth/avr/see2.fs". The later file can't be compiled, a word sy1 is missing. How can I verify what's wrong with my simple code? Best regards, Helge |