Hi, I'd like to know if anybody has succeeded to simulate the AVR running amforth ( http://amforth.sf.net ) in VMLAB ( http://www.amctools.com/vmlab.htm ). I'd like to use this setup for simple tests without using the real hardware. Unfortunately, even though VMLAB worked perfectly with my C or Assembly programs, and even though amforth works perfectly on real ATmega32 or ATmega16, they do not work together :-(. I've placed some more details on the VMLAB forum ( http://www.amctools.com/cgi-bin/yabb2/YaBB.pl?num=1240766206 ). -- TIA & Regards, WZab
Problems with simulation of amforth in VMLAB...
Started by ●April 28, 2009
Reply by ●September 15, 20092009-09-15
A few months ago I've reported problems related to simulation of amforth ( http://amforth.sf.net ) in the VMLAB ( http://www.amctools.com/vmlab.htm) details are described here: http://www.amctools.com/cgi-bin/yabb2/YaBB.pl?num=1240766206 I have discovered that the problems are caused by the fact, that VMLAB does not simulate correctly behaviour of the AVR when the flash memory is reprogrammed but only with '1' changed to '0'. The amforth uses "inteligent" algorithm, which erases the page only when any '0' is changed to '1' otherwise the page is reprogrammed without erasing, which causes, that VMLAB assumes that operation fails. If anyone wants to simulate the amforth with the current version of the VMLAB, it is necessary to switch off this mechanism (only for the version used in simulation, do not do it in the version burned into the real AVR): The change has to done in file core/words/istore_nrww.asm I have done it in the way which keeps the size and location of the code unchanged (only the jump destination is modified). The original amforth 3.5 code: [code] ; an erase cycle is only necessary ; when changing a bit from 0 to 1 .dw XT_OVER .dw XT_OVER .dw XT_IFETCH .dw XT_INVERT .dw XT_AND .dw XT_DOCONDBRANCH .dw PFA_ISTORE_WRITE .dw XT_DUP .dw XT_SPMERASE PFA_ISTORE_WRITE: .dw XT_DUP .dw XT_SPMWRITE .dw XT_SPMRWW .dw XT_DROP .dw XT_DROP .dw XT_R_FROM .dw XT_INTRESTORE .dw XT_EXIT [/code] The changed amforth code - simulates correctly (erase always): [code] ; an erase cycle is only necessary ; when changing a bit from 0 to 1 .dw XT_OVER .dw XT_OVER .dw XT_IFETCH .dw XT_INVERT .dw XT_AND .dw XT_DOCONDBRANCH ; Jump to the next instruction - erase always .dw PFA_ISTORE_ERASE PFA_ISTORE_ERASE: .dw XT_DUP .dw XT_SPMERASE PFA_ISTORE_WRITE: .dw XT_DUP .dw XT_SPMWRITE .dw XT_SPMRWW .dw XT_DROP .dw XT_DROP .dw XT_R_FROM .dw XT_INTRESTORE .dw XT_EXIT [/code] -- HTH & Regards, Wojtek