Hi D Williams -

I managed to get Amforth running on a Mega128. There are three 
undocumented file changes you need to make:

“core/devices/atmega128/device.asm”: add these lines (I put them after 
'ifndef EEPME' etc…)
.ifndef MCUSR
.equ MCUSR = MCUCSR
.endif

For some reason the Mega128 doesn't have the MCUSR register, but the 
MCUCSR does the same job (and a bit more...). Adding these lines ensures 
the code will compile with the Mega128 as well as the others supported.

“core/words/istore_nrww.asm” (or "core/words/store-i_nrww.asm")
edit line 114 from
in temp1, SPMCSR to
in_ temp1, SPMCSR ,
and line 122 from
out SPMCSR,temp0 to
out_ SPMCSR,temp0

The 'in' and 'out' commands only work for a limited range of addresses. 
Fortunately the macros 'in_' and 'out_' do the same job for all addresses.

Finally,

“core/drivers/usart_0.asm”: change lines 1 to 6 to:
.equ BAUDRATE_LOW = UBRR0L + $20
.equ BAUDRATE_HIGH = UBRR0H
.equ USART_C = UCSR0C
.equ USART_B = UCSR0B + $20
.equ USART_A = UCSR0A + $20
.equ USART_DATA = UDR0 + $20

These changes are caused by the Mega128 trying to cram a quart into a 
pint bottle. Some addresses are double booked, and this offset is needed 
to fix things.

With these modifications to the code I was able to get the system up and 
running in the AVR Studio (version 4) simulator - and even talk to it 
using 'Hapsim', which permits you to make a virtual serial connection to 
the emulated code.

Hope that's helpful -

David Jeffrey

On 9/15/2011 12:03 PM, Erich Waelde wrote:
> Hello,
>
>
> On 09/15/2011 05:22 PM, D Williams wrote:
>> FWIW - The last version that worked for me on the amtega128 was amforth 3.1
>> After that, I could not sort out the interrupts.
> There was a Problem with interrupt addresses being off by a factor of 2. But
> I don't recall, which version it was. And maybe it was a trunk version only,
> not a release. I'm using amforth 4.5 routinely on atmega32.
>
>>> Hello guys,
>>> I'm trying to build amforth for an ATmega128.
>>> It won't compile, searching for a definition of MCUSR.
>>> Attached you'll find the folder content I'm using (a standard template).
>>> amforth ver. 4.5
>>> AVR Studio 4 (latest build)
> Have you spotted Karl Lunts userguide on the webpage?
> http://amforth.sourceforge.net/amforth-userguide.pdf
>
> I'm not using AvrStudio, so I cannot comment on that other than
> asking: what is the exact error message you are getting?
>
>
> Cheers,
> Erich
>
> ------------------------------------------------------------------------------
> Doing More with Less: The Next Generation Virtual Desktop
> What are the key obstacles that have prevented many mid-market businesses
> from deploying virtual desktops?   How do next-generation virtual desktops
> provide companies an easier-to-deploy, easier-to-manage and more affordable
> virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
> _______________________________________________
> Amforth-devel mailing list for http://amforth.sf.net/
> Amforth-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/amforth-devel
>

------------------------------------------------------------------------------
Doing More with Less: The Next Generation Virtual Desktop 
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops?   How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to