Problems with simulation of amforth in VMLAB...

Hi,

I'd like to know if anybody has succeeded to simulate the AVR running amforth (

formatting link
) in VMLAB (
formatting link
). 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 (
formatting link
).

--
TIA & Regards,
WZab
Reply to
wzab
Loading thread data ...

A few months ago I've reported problems related to simulation of amforth (

formatting link
) in the VMLAB (
formatting link
details are described here:
formatting link
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:

     ; 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 

The changed amforth code - simulates correctly (erase always):

     ; 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 

--
HTH & Regards,
Wojtek
Reply to
wzab

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.