Hi David
Just found your response and time, so I tried it on amforth 4.8
Works great!
I had to use AVR Simulator 2 to get ATmega128 (instead of 128A and 128P on AVR simulator1)
Some of the instructions in the 4.2 User guide are out of sync with 4.8; but since the software was known to be good I was able to sort it out.
Programed it with Kanda AVRISP over parallel port on an old STK300, if anyone is curious.
Questions:
The file “core/devices/atmega128/device.asm” says- "generated do not edit"
Can these changes be added to the regular code base?
“core/drivers/usart_0.asm” - Can the changes to be added to the code base without messing things up for other processors?
Or is the ATmega128(x) too obscure to merit attention?
Comment:
"core/words/store-i_nrww.asm" the underscores are already present;
Very helpful, completely solved a long standing problem.
Thanks!
>>>>>>>>>>>
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
|