Re: [Flashforth-devel] AVR assembler and disassembler
Brought to you by:
oh2aun
From: Stefan <fli...@gm...> - 2022-01-02 08:30:21
|
Hallo Helge, disassembled code is: 9a58 -> sbi PORTD,0 (that's 8 mod 8 because only values from 0 to 7 are allowed) 9a5c -> sbi PORTD,4 ... because cbi/sbi use the bitnumber and not the bitmask. use: 3 constant txd_pin 2 constant rxd_pin greetz bitflipser Am 31.12.2021 um 12:35 schrieb Helge Kruse: > 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 > > > > > > _______________________________________________ > Flashforth-devel mailing list > Fla...@li... > https://lists.sourceforge.net/lists/listinfo/flashforth-devel |