From: pito <pi...@vo...> - 2010-09-10 21:12:51
|
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 forth. Imagine following case (an example only): 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, it is relocable. 3. I will take a "template" from a word, I can see the header etc. 4. the input and output is now clear to me, loadtos, savetos indirect via Y. Q: which registers (Rx) can I freely use without ANY limitation in my fuX? I can see the register used in .lst of course, however I need a proven list which really can be used. Q: there are registers named tempx - again - which can be used? There is a difference when using those tempx in Lubos' assmbler vs. usage in normal asm - Lubos' asm is based on forth words, which may use internally some registers, this was what I saw - some registers combinations did garbage. Q: which registers can we use in Lubos' asm, which in normal asm (again - we can see the .lst allocation, but pls confirm. Q: Lubos is using Z registers frequently - is it allowed (both in L asm or normal asm)? We need some indirect addressing so is Z fully free to use? Q: When using L.asm (Lubos') or normal asm - which regs shall be pushed, popped? Q: When RAM space is required in the asm code - can you give us some RAM ragion where we may do what we really want? Q: It is understood we cannot use calls inside fuX, only jumps. L.asm needs a kind of table for jumps, normal asm does not I guess. Q: shall the interrupts be disabled when in fuX? Q: accessing vars - can we define a specific place in RAM where we can place the local asm variables and which will not be interfered by forth? 6. the fuX will read the data from data stack, it will process it (about 500 lines of assembler) and at the end it writes results to data stack. Q: Can we create such long word? Any restriction on the lenght of a word? 8. forth's Return stack - my understanding is we cannot use it for any assembler routine, can we? how? 9. so now I have an asm word fuX - with header (copied from other words and adjusted accordingly), body (~500lines asm) and it will end with "rjmp DO_NEXT". I will include this fuX.asm into dictionary and compile together with amforth. This is the basic Idea. I DO UNDERSTAND THIS WAY OF WORKING WITH AMFORTH IS NOT THE PREFFERED ONE FROM PRINCIPLE (PORTABILITY), but I still cope with an idea to be able to "link" _ANY_ asm code into an amforth word (input output via dstack). Interrupts: 1. it is understood you handle intrpts forth's way - the generic-isr.asm is an interface to forth only, which sets Tflag and translates vector to forth. What is the worst case latency? 2. how to work with several interrupts enabled (priority handling in forth?), e.g. as we register ['] tick_isr TIMER2_OVFAddr int!, what happens when I register for example 15 interrupts sources that way? Pito. |