Re: [Flashforth-devel] AVR assembler and disassembler
Brought to you by:
oh2aun
From: Helge K. <Hel...@gm...> - 2022-01-02 10:22:53
|
Hi Stefan, > because cbi/sbi use the bitnumber and not the bitmask. Yes, now I understand why the code didn't work. I put two questions in one mail. Therefore the second question about the missing implementation for SBI/CBI in *see *is somehow lost. It was just a pity that see could not be used to verify the compiled code. I added some lines to see.fs: : .xbi ( addr -- addr) *@ dup 3 rshift 1f and ." r" decimal 2 u.r hex ." ," 7 and . cell+ ; : ?cbi ( addr -- addr f ) *@ ff00 and 9800 - ; : ?sbi ( addr -- addr f ) *@ ff00 and 9a00 - ; ?sbi 0= if 5sp ." sbi " .xbi else ?cbi 0= if 5sp ." cbi " .xbi else With these lines I get more info, at least for CBI/SBI. I wasn't aware that the implementation in see.fs is far from a complete discompiler. Best regards, Helge Am 02.01.2022 um 09:30 schrieb Stefan: > 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 > > > > _______________________________________________ > Flashforth-devel mailing list > Fla...@li... > https://lists.sourceforge.net/lists/listinfo/flashforth-devel |