Re: [Amforth-devel] HOW TO - Assembler in anmforth

2010-09-11 Thread Matthias Trute
Marcin, > on stack (use it or restore it to zero at exit). > > (Matthias: I noticed that techdoc says R22:R23 > are TOS and R24:R25 are W, in my case on ATmega328P > it's the other way around) Fixed, thank you. Matthias -

Re: [Amforth-devel] HOW TO - Assembler in anmforth

2010-09-11 Thread pito
> Please keep in mind that machine stack is not > indefinite (64 bytes only). So if your routine > is pushing something on stack and doing some > calls it can get tight. I've changed that to 256: .set rstackstart = RAMEND ; start address of return stack, grows downward .set stackstart = RAME

Re: [Amforth-devel] HOW TO - Assembler in anmforth

2010-09-11 Thread Marcin Cieslak
On Sat, 11 Sep 2010, pito wrote: > push R0 ; worst case - store everything > push R1 > push R2 > . > push R31 Please be careful NOT to restore r28, r29 (register Y - your data stack pointer) and r24, r25 - top of your stack. > > ld R10, Y+ > ld R11, Y+ ; takes c from

Re: [Amforth-devel] HOW TO - Assembler in anmforth

2010-09-11 Thread Matthias Trute
Hi, > > > First, from what I understand - Matthias please > > correct me if I am > > wrong - the "code" word creates a new word for you > > but > > it does not switch FORTH into the compilation mode > > (unlike ":" > > or "]"). > > > M? "code" creates the full dictionary header and sets the XT

Re: [Amforth-devel] HOW TO - Assembler in anmforth

2010-09-11 Thread pito
Matthias, Marcin - here is the template for function fuX. Is the construction ok? It will be assembled by normal asm. Pito. ; amforth 4.1 ; ..core\words\fuX.asm ; ( a b c -- m l k ) Function fuX ; R( ? -- ? ) ; calculates a special function fuX ; it uses ALL registers except Y ; it calls subrouti

Re: [Amforth-devel] HOW TO - Assembler in anmforth

2010-09-11 Thread pito
Marcin, thanks! > First, I am assuming that "Luboš assembler" is a > set of words > from the lib/assembler.frt file in the amforth > distribution. > Is this correct? Yes > (I don't understand this - what is your "header" > etc.) E.g.: ; ( n1 -- n2 ) Arithmetics ; R( -- ) ; optimized increment VE_1

Re: [Amforth-devel] HOW TO - Assembler in anmforth

2010-09-11 Thread Matthias Trute
Pito, I'll start here, the upper "half" will take more time. But make yourself clear, what do you want to achieve: add an assembly word to the initial hex file or implement it on a running system. The assemblers only look similiar, they are not inter-changeable. > Interrupts: The interrupt suppo

Re: [Amforth-devel] HOW TO - Assembler in anmforth

2010-09-10 Thread Marcin Cieslak
On Fri, 10 Sep 2010, pito wrote: First, I am assuming that "Luboš assembler" is a set of words from the lib/assembler.frt file in the amforth distribution. Is this correct? 1. I want to write a new word full in asm called fuX (a b c -- y ) 2 I want to use an existing "code" written in assembler

Re: [Amforth-devel] HOW TO - Assembler in anmforth

2010-09-10 Thread pito
Matthias, Marcin, thanks a lot for the infos - I've spent a time to work in order to write my first amforth routine ++_ - based on Lubos sources so I've got the first touch.. Basically my problem is not the assembler of any processor, but what are the limitation for a specific integration in the f

Re: [Amforth-devel] HOW TO - Assembler in anmforth

2010-09-09 Thread Marcin Cieslak
Two quick remarks: >> 2. how the data from data stack (or from return stack) are passed to >> assembler - data stack (all elements EXCEPT top of the stack) are kept close to the end of RAM (end of RAM - 128), growing down. - TOP of the stack is kept in register pair (tosh:tosl) >> 3. how the

Re: [Amforth-devel] HOW TO - Assembler in anmforth

2010-09-09 Thread Matthias Trute
him > 10. how the local .asm variables (used in asm rouitne shall be > handled (e.g. where in ram to place the local variables). If you use Lubos assembler, you can allocate RAM and use the address. The assembler is, after all, forth code which compiles machine code. When using the avrasm, there

Re: [Amforth-devel] HOW TO - Assembler in anmforth

2010-09-09 Thread Matthias Trute
Pito, > The example could be the timer int routine: > : tick_isr _one timer 2@ d+ timer 2! ; > which does "timer = timer + 1" where timer is double integer. I've > seen usart routines and Lubos' routines in asm, however generaly the > Q: > > 1. is there any recommended structure or frame for wri

Re: [Amforth-devel] HOW TO - Assembler in anmforth

2010-09-06 Thread pito
10. how the local .asm variables (used in asm rouitne shall be handled (e.g. where in ram to place the local variables). - PŮVODNÍ ZPRÁVA - Od: "pito" Komu: [email protected] Předmět: HOW TO - Assembler in anmforth Datum: 7.9.2010 - 8:42:46 > Hi Matthias and co., > I'd

[Amforth-devel] HOW TO - Assembler in anmforth

2010-09-06 Thread pito
Hi Matthias and co., I'd like to ask how to start working with assembler in amforth. This might be of general interest, therefore HOW TO. The example could be the timer int routine: : tick_isr _one timer 2@ d+ timer 2! ; which does "timer = timer + 1" where timer is double integer. I've seen usar