You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
(5) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
(6) |
Mar
(41) |
Apr
(23) |
May
(11) |
Jun
(2) |
Jul
|
Aug
|
Sep
(9) |
Oct
(2) |
Nov
(1) |
Dec
(1) |
2008 |
Jan
(6) |
Feb
(1) |
Mar
(23) |
Apr
(18) |
May
(21) |
Jun
(13) |
Jul
(34) |
Aug
(5) |
Sep
(1) |
Oct
(4) |
Nov
|
Dec
(4) |
2009 |
Jan
|
Feb
(5) |
Mar
(5) |
Apr
(10) |
May
(1) |
Jun
(11) |
Jul
(1) |
Aug
|
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(13) |
2010 |
Jan
(10) |
Feb
(4) |
Mar
(28) |
Apr
(3) |
May
(38) |
Jun
(22) |
Jul
(92) |
Aug
(154) |
Sep
(218) |
Oct
(45) |
Nov
(20) |
Dec
(1) |
2011 |
Jan
(33) |
Feb
(15) |
Mar
(32) |
Apr
(33) |
May
(48) |
Jun
(35) |
Jul
(7) |
Aug
|
Sep
(11) |
Oct
(5) |
Nov
|
Dec
(7) |
2012 |
Jan
(56) |
Feb
(11) |
Mar
(6) |
Apr
|
May
(128) |
Jun
(59) |
Jul
(21) |
Aug
(16) |
Sep
(24) |
Oct
(39) |
Nov
(12) |
Dec
(12) |
2013 |
Jan
(14) |
Feb
(61) |
Mar
(97) |
Apr
(46) |
May
(13) |
Jun
(23) |
Jul
(12) |
Aug
(25) |
Sep
(9) |
Oct
(81) |
Nov
(73) |
Dec
(45) |
2014 |
Jan
(36) |
Feb
(57) |
Mar
(20) |
Apr
(41) |
May
(43) |
Jun
(11) |
Jul
(14) |
Aug
(32) |
Sep
(9) |
Oct
(27) |
Nov
(21) |
Dec
(6) |
2015 |
Jan
(14) |
Feb
(23) |
Mar
(1) |
Apr
(19) |
May
(40) |
Jun
(11) |
Jul
(1) |
Aug
(2) |
Sep
(14) |
Oct
(10) |
Nov
(9) |
Dec
(13) |
2016 |
Jan
(4) |
Feb
(3) |
Mar
(7) |
Apr
|
May
(4) |
Jun
(13) |
Jul
(8) |
Aug
(3) |
Sep
(4) |
Oct
(1) |
Nov
|
Dec
|
2017 |
Jan
(6) |
Feb
(1) |
Mar
(1) |
Apr
(7) |
May
(10) |
Jun
(5) |
Jul
(7) |
Aug
(9) |
Sep
|
Oct
(1) |
Nov
(5) |
Dec
|
2018 |
Jan
|
Feb
|
Mar
(5) |
Apr
|
May
|
Jun
(3) |
Jul
(6) |
Aug
|
Sep
(2) |
Oct
(54) |
Nov
(47) |
Dec
(53) |
2019 |
Jan
(23) |
Feb
(24) |
Mar
(19) |
Apr
(15) |
May
(5) |
Jun
(34) |
Jul
(9) |
Aug
(9) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
(7) |
Apr
(7) |
May
(5) |
Jun
(15) |
Jul
(22) |
Aug
(28) |
Sep
(13) |
Oct
(9) |
Nov
(17) |
Dec
(13) |
2021 |
Jan
(5) |
Feb
(1) |
Mar
(1) |
Apr
(9) |
May
(21) |
Jun
(9) |
Jul
|
Aug
(6) |
Sep
(16) |
Oct
|
Nov
(1) |
Dec
(6) |
2022 |
Jan
|
Feb
|
Mar
|
Apr
(7) |
May
(6) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(11) |
Sep
(21) |
Oct
(5) |
Nov
(1) |
Dec
(1) |
2024 |
Jan
(1) |
Feb
(4) |
Mar
|
Apr
(7) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2025 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
From: pito <pi...@vo...> - 2010-09-15 18:44:16
|
Hi, Leon, Marcin and co., if somebody needs the fast word "f/" in asm (f* still not ready) I recommend to use Marcin's one as mine is not amforth like one (I use an template for educational purposes - the same as the template of fuX I posted in the assembler discussion with a lot of stuff highly unoptimised). So it would be good to discuss the flib stuff - as Leon is doing one in forth, there are a lot of others in forth or asm. So the amforth people shall decide on the strategy and standards, if any. My point was to make a standard "template" where, when needed you may attach _any_ code you need into a new word (so: Word header-> i/o from stack stuff-> kind of regnames translator -> the .asm body from anywhere-> DO_NEXT). Pito. |
From: pito <pi...@vo...> - 2010-09-15 13:28:29
|
HI, thanks to Marcin, who had shown me again how the stack works, the f/ routine works within amforth as word f/. You may see the speed up (amforth 4.0, new f/ v1. in asm, @25Mhz): > : test_mul_forth timer-start 30000 0 do _pi _ln2 f* drop drop > loop > oktimer-stop 30000 s>f f/ fs. ." sec per mul-forth operation" ; ok > : test_div_asm timer-start 30000 0 do _pi _ln2 f/ drop drop loop oktimer-stop 30000 s>f f/ fs. ." sec per div-asm operation" ; ok > test_mul_forth 4.8192544E-3 sec per mul-forth operation ok > test_div_asm 6.6060271E-5 sec per div-asm operation ok > .s ok > _pi _ln2 f/ fs. 4.5323606 ok > The next step is f* (already waiting for debugging). Marcin did some improvements on the above asm f/ (e.g. he is not storing all regs used, some optimisation and inlineing) so his version of the f/ coud be faster by few usec. Pito. |
From: pito <pi...@vo...> - 2010-09-15 08:10:22
|
Marcin, thanks! Pito ----- PŮVODNÍ ZPRÁVA ----- Od: "Marcin Cieslak" <sa...@sa...> Komu: "Everything around amforth" <amf...@li...> Předmět: Re: [Amforth-devel] Word header in asm Datum: 15.9.2010 - 10:01:59 > On Wed, 15 Sep 2010, pito wrote: > > > Hi, > > is there any expalnation available on what these > > .dw $ff03 ; > > High byte: > $75 means the word is immediate word > $ff means the word is about to compiled normally > > Low byte: > $03 is a length of the word name in bytes that > follows > > See core/words/docreate.asm, > core/words/immediate.asm > how its modified, and > core/words/search-wordlist.asm > how it's used. > > > ff02 ff05 in the header of a ams word definition > > means? And if > > > important, how is the implication when writing > > words in asm? Thanks, > > > Pito > > //Marcin > > PS. I am working on the f/ you sent me yesterday. > > ------------------------------------------------------------------------------ > > Start uncovering the many advantages of virtual > appliances > and start using them to simplify application > deployment and > accelerate your shift to cloud computing. > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > Amforth-devel mailing list > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel |
From: Marcin C. <sa...@sa...> - 2010-09-15 08:02:09
|
On Wed, 15 Sep 2010, pito wrote: > Hi, > is there any expalnation available on what these > .dw $ff03 ; High byte: $75 means the word is immediate word $ff means the word is about to compiled normally Low byte: $03 is a length of the word name in bytes that follows See core/words/docreate.asm, core/words/immediate.asm how its modified, and core/words/search-wordlist.asm how it's used. > ff02 ff05 in the header of a ams word definition means? And if > important, how is the implication when writing words in asm? Thanks, > Pito //Marcin PS. I am working on the f/ you sent me yesterday. |
From: pito <pi...@vo...> - 2010-09-15 07:49:05
|
Hi, is there any expalnation available on what these .dw $ff03 ; ff02 ff05 in the header of a ams word definition means? And if important, how is the implication when writing words in asm? Thanks, Pito |
From: pito <pi...@vo...> - 2010-09-14 17:34:39
|
Hi Leon, I am preparing two words - f/ and f* in asm. The results from simulator are: f_mul 190cycles, 7.6us @25MHz f_div 735cycles, 29.4us @25MHz. You may add a few usec for an overhead. The mul and div routines works. The words has been compiled with amforth already, however I still have problem with passing from/to stack so I cannot get the right results on stack (could be other problem too), therefore I've asked Marcin to help a little bit, when possible. The routine is using 9 registers (except R24, R25, and YL YH), all the tempx regs and few stack positions. The words are only ~350 bytes big. Pito |
From: pito <pi...@vo...> - 2010-09-13 08:06:35
|
Leon, I am not sure if it is caused by fp library or f/ word, I'm prone a little bit to think it is an issue of amforth when loading large libraries in one run. Pito. > Interesting -- I'll look in to it. I've been > thinking about rewriting > f/ to use integer arithmetic -- hopefully that'll > make it faster. I > might do the rewrite and see if that solves the > problem. > -Leon |
From: Leon M. <leo...@gm...> - 2010-09-13 02:21:14
|
Interesting -- I'll look in to it. I've been thinking about rewriting f/ to use integer arithmetic -- hopefully that'll make it faster. I might do the rewrite and see if that solves the problem. -Leon On Sat, Sep 11, 2010 at 4:03 PM, pito <pi...@vo...> wrote: > Leon, > we've observed an interesting anomaly: when first time the float > library is uploaded to a fresh amforth install, the f/ is causing a > crash (e.g. when uploading floatconstants immediately after the > float lib - the first f/ causes a freeze). When the float library is > unmarked and uploaded again, it works afterwards. It has been > confirmed by other user as well. P. > > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > Amforth-devel mailing list > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel > |
From: pito <pi...@vo...> - 2010-09-11 21:03:57
|
Leon, we've observed an interesting anomaly: when first time the float library is uploaded to a fresh amforth install, the f/ is causing a crash (e.g. when uploading floatconstants immediately after the float lib - the first f/ causes a freeze). When the float library is unmarked and uploaded again, it works afterwards. It has been confirmed by other user as well. P. |
From: Matthias T. <mt...@we...> - 2010-09-11 18:23:11
|
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 |
From: pito <pi...@vo...> - 2010-09-11 16:12:35
|
Michael, thanks! I will rather start step by step, so no forth words called from within assembler now! As I can see the tosl and tosh and register setup are changing. I hope they are same for any processor type within a release. P. > worked with amforth3.6 > still good with 4.1? > Michael |
From: pito <pi...@vo...> - 2010-09-11 15:17:44
|
> 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 = RAMEND - 256 ; 80 start address of data stack, grows downward > Regarding you other email, regarding "here", "dp" > etc. DP and HERE are stored in EEPROM (in my case > EEPROM So when RAM is needed within fuX word and only there, I have to read HERE and DP and from that point to allocate RAM fro fuX. When leaving fuX, I do not need to write the new pointers to EEPROM, I just leave that as they are (as I do not need RAM anymore.. So the template for fictious word 'fuX' is now (based on my amforth .lst as the Registers are concerned): ; amforth 4.1 ; ..core\words\fuX.asm ; Function fuX( a b c -- m l k ) ; R( ? -- ? ) ; calculates a special function fuX ; it uses ALL registers except Y ; it calls subroutines placed within the word fuX ; does not use Y - points the data stack VE_FUX: .dw $ff03 ;? .db "fuX",0 .dw VE_HEAD .set VE_HEAD = VE_FUX XT_FUX: .dw PFA_FUX PFA_FUX: push R0 push R1 ; R2 you may use, restore to 0 ; R3 you may use, restore to 0 push R4 push R5 push R6 push R7 push R8 push R9 push R10 push R11 push R12 push R13 ; R14 you may use, no need to push/pop, = temp4 ; R15 you may use, no need to push/pop, = temp5 ; R16 you may use, no need to push/pop, = temp0 ; R17 you may use, no need to push/pop, = temp1 ; R18 you may use, no need to push/pop, = temp2 ; R19 you may use, no need to push/pop, = temp3 ; R20 you may use, no need to push/pop, = temp6 ; R21 you may use, no need to push/pop, = temp7 push R22 push R23 ; R24 do not push/pop, = tosl ; R25 do not push/pop, = tosh push R26 push R27 ; R28 do not use, = Y ; R29 do not use, = Y ; R30 you may use, no need to push/pop, = Z ; R31 you may use, no need to push/pop, = Z do_something ld R24, Y+ ld R25, Y+ ; takes c from stack do_something ld R24, Y+ ld R25, Y+ ; takes b from stack do_something ld R24, Y+ ld R25, Y+ ; takes a from stack do_something work_with_RAM_indirect_Using_Z work_with_RAM_indirect_Using_X call sub3 do_something jmp label1 do_something label1: do_something jmp label2 ; ijmp rjmp as well do_something call sub3 do_something jmp label3 label2: do_something call sub1 ; rcall icall as well call sub2 do_something label3: do_something call sub2 do_something st -Y, R25 st -Y, R24 ; puts m on stack do_something st -Y, R25 st -Y, R24 ; puts l on stack do_something st -Y, R24 st -Y, R25 ; puts k on stack pop R27 ; RESTORE REGISTERS IN REVERSE ORDER .... pop R4 ldi R3, 0 ldi R2, 0 pop R1 pop R0 jmp label_end ; jmp to the end of the word "fuX" sub1: do_something call sub3 ret sub2: do_something call sub1 ret sub3: do_something work_with_RAM_indirect_Using_Z work_with_RAM_indirect_Using_X ret label_end: jmp_ DO_NEXT ; this is the end of the word "fuX" |
From: Marcin C. <sa...@sa...> - 2010-09-11 12:01:27
|
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 stack > > ld R12, Y+ > ld R13, Y+ ; takes b from stack > > ld R14, Y+ > ld R15, Y+ ; takes a from stack This is wrong - TOS is in r26:r25 (tosh:tosl) *NOT* in RAM! > st -Y, R16 > st -Y, R17 ; puts m on stack > > st -Y, R18 > st -Y, R19 ; puts l on stack > > st -Y, R20 > st -Y, R21 ; puts k on stack Same as above - just leave TOS in r26:r25 and don't restore it via pop: > pop R31 ; worst case housekeeping > .... > pop R2 > pop R1 > pop R0 Don't restore tosl, tosh, Y (r24, r25, r28, r29) - since then your stack effects will be void (or just corrupted). No need to save temp0..temp5 (r14, r15, r16, r17, r18, r19, r20, r21). r30 and r31 (zl, zh) are used as a scratchapad register, so no need to save these too. r2 and r3 should be zero, so no need to save that 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) 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. Regarding you other email, regarding "here", "dp" etc. DP and HERE are stored in EEPROM (in my case EEPROM address $6 and $8, respectively), please see PFA_EFETCH how to read EEPROM from assembly or push them on the data stack before running your asm routing as parameters. --Marcin |
From: Matthias T. <mt...@we...> - 2010-09-11 11:52:32
|
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 of that newly defined word to its data field. That means, that whenever the XT of that word is called by the inner interpreter, the content of the data field is executed as machine code. Whatever that code may do, the final operation should be a jmp to DO_EXIT. Since the label DO_EXIT is only known at compile time of the initial hex file, the forth word "end-code" does exactly that: writes the machine instruction "jmp DO_EXIT". It is up to the developer to make sure that the forth vm can continue its work. Otherwise anything strange can happen... > > > I don't know - where does assembler use Z? > Lubos is using Z in his assembler source e.g. > code high ( pinmask portadr -- ) > \ dup c@ rot or swap c! \ replaced by assembler > ZL TOSL movw, \ tos->z > R16 Z ld, \ addr c@ R16/17 was used as tosl/tosh in earlier versions, now its slightly different. Probably no-one has noticed that yet. > > I am not sure whether the code is correct in > > assembler.frt - > > it uses "here" to indicated labels in the code, > > where > > it should probably use "dp" (dictionary pointer) - > > due to > > RAM (last position pointed to by "here", advanced > > by "allot") and dictionary > > in flash (managed by "dp", advanced by comma) are > > different thing > > in amforth. > M? see above, sounds like a regression. > > I was > > thinking > > about uploading .hex files or even ready-to-run > > object > Yes this is exactly what I am talking about.. Good luck. You do know that even C has some assumptions about its runtime environment? And portable assembler code is something I've never seen yet. AS a general hint: there are so many existing code samples that work well enough. Please read them first. Most of your questions can be answered by "read the source and do it that way". Matthias |
From: pito <pi...@vo...> - 2010-09-11 11:01:41
|
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 subroutines placed within the word fuX ; does not use Y - points the data stack VE_FUX: .dw $ff03 ;? .db "fuX",0 .dw VE_HEAD .set VE_HEAD = VE_FUX XT_FUX: .dw PFA_FUX PFA_FUX: push R0 ; worst case - store everything push R1 push R2 ..... push R31 ld R10, Y+ ld R11, Y+ ; takes c from stack ld R12, Y+ ld R13, Y+ ; takes b from stack ld R14, Y+ ld R15, Y+ ; takes a from stack do_something work_with_RAM_indirect_Using_Z work_with_RAM_indirect_Using_X call sub3 do_something jmp label1 do_something label1: do_something jmp label2 ; ijmp rjmp as well do_something call sub3 do_something jmp label3 label2: do_something call sub1 ; rcall icall as well call sub2 do_something label3: do_something call sub2 st -Y, R16 st -Y, R17 ; puts m on stack st -Y, R18 st -Y, R19 ; puts l on stack st -Y, R20 st -Y, R21 ; puts k on stack pop R31 ; worst case housekeeping .... pop R2 pop R1 pop R0 jmp label_end ; jmp to the end of the word "fuX" sub1: do_something call sub3 ret sub2: do_something call sub1 ret sub3: do_something work_with_RAM_indirect_Using_Z work_with_RAM_indirect_Using_X ret label_end: jmp_ DO_NEXT ; this is the end of the word "fuX" |
From: pito <pi...@vo...> - 2010-09-11 07:50:09
|
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_1PLUS: .dw $ff02 .db "1+" .dw VE_HEAD .set VE_HEAD = VE_1PLUS XT_1PLUS: .dw PFA_1PLUS PFA_1PLUS: > If you want to return only one cell ("y") you need > just to set the > TOS in tosh:tosl register pair. No need to use > savetos. tosh:tosl contains the value - you need to execute st -Y, rx to write it to ram, don'you? > 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? > I don't know - where does assembler use Z? Lubos is using Z in his assembler source e.g. code high ( pinmask portadr -- ) \ dup c@ rot or swap c! \ replaced by assembler ZL TOSL movw, \ tos->z R16 Z ld, \ addr c@ loadtos, \ delete portadr R16 TOSL or, \ or pinmask Z R16 st, \ c! loadtos, \ delete pinmask end-code > Please feel free to "allot" something and use > that. > There is also "pad" available as well. >From my assembler source, how? Or it shall be done before? > I am not sure whether the code is correct in > assembler.frt - > it uses "here" to indicated labels in the code, > where > it should probably use "dp" (dictionary pointer) - > due to > RAM (last position pointed to by "here", advanced > by "allot") and dictionary > in flash (managed by "dp", advanced by comma) are > different thing > in amforth. M? > Use "here" and "allot". >From asm sorce? > Of course you can use it. It's what "push" and > "pop" do. So when calling within an asm source properly I will not destroy Rstack, it means it will stay as before I executed my asm? > You do not need "rjmp DO_NEXT" (or most probably > "jmp DO_NEXT") > if using "end-code" word ($940c and DO_NEXT > address will be > compiled - see "end-code.asm"). I meant normal asm (L.asm=lubos's forth asm asm-normal asm) > I don't know what kind of portability you mean. When writing _any_ "words" (e.g. fuX) in asm. Portability means use ANS forth words only.. > I was > thinking > about uploading .hex files or even ready-to-run > object Yes this is exactly what I am talking about.. Pito |
From: Matthias T. <mt...@we...> - 2010-09-11 07:47:06
|
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 support in amforth is weak. It lakes some features one may urgently need. > 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? 1ms (if the interrupt occures at the beginning of the word 1ms.) I believe, that division is faster, but did not test it yet. Generally speaking: interrupts are handled by the inner interpreter. Any primitive word is atomar wrt to (forth-level) interrupts. > 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? The last registered code gets called. A problem arises, if interrupt x has fired and interrupt y comes before the x has been handled. In that case x will be completly unhandled (the curint variable is overwritten). Matthias |
From: Marcin C. <sa...@sa...> - 2010-09-10 22:03:57
|
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, it is > relocable. > 3. I will take a "template" from a word, I can see the header etc. (I don't understand this - what is your "header" etc.) > 4. the input and output is now clear to me, loadtos, savetos > indirect via Y. If you want to return only one cell ("y") you need just to set the TOS in tosh:tosl register pair. No need to use savetos. > 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. Yes, tempx are left for free use of FORTH words. That's what Matthias wrote before already. 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 "]"). So that means that all words (like "ld,", "st,") are executed immediately and they can produce compiled machine code entered into the dictionary only in the explicit way by using "," (comma) word. Practically means that all FORTH code in the assembler is executed immediately (think of it as they all were IMMEDIATE words) and the only thing you are left in your newly defined word is pure assembler code as defined by you. Luboš code is gone by the time you are executing a word. So it does not matter whether you use some registers when using code ... end-code or whether using direct assembly (like adding .asm file to your amforth). If you have some problems with "garbage" - please be more specific, it is possible that the error is somewhere else. > 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? I don't know - where does assembler use Z? See above - it probably does not matter at all. > Q: When using L.asm (Lubos') or normal asm - which regs shall be > pushed, popped? If you are only using tosh, tosl, tempX registers - none. Please be aware that push and pop goes to the machine stack which is FORTH return stack (therefore they are an equivalent of >r and r>). > 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? Please feel free to "allot" something and use that. There is also "pad" available as well. > 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. I don't understand this problem. I think you can define labels using the assembler.frt. (I didn't use them though). I am not sure whether the code is correct in assembler.frt - it uses "here" to indicated labels in the code, where it should probably use "dp" (dictionary pointer) - due to RAM (last position pointed to by "here", advanced by "allot") and dictionary in flash (managed by "dp", advanced by comma) are different thing in amforth. > Q: shall the interrupts be disabled when in fuX? I don't think so. > 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? Use "here" and "allot". > 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? No limits on length except size of your flash. > 8. forth's Return stack - my understanding is we cannot use it for > any assembler routine, can we? how? Of course you can use it. It's what "push" and "pop" do. See question above regarding push/pop. > 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. You do not need "rjmp DO_NEXT" (or most probably "jmp DO_NEXT") if using "end-code" word ($940c and DO_NEXT address will be compiled - see "end-code.asm"). > 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). I don't know what kind of portability you mean. Forth code is way more portable between different platforms than assembly code (with obvious limitations related to the low-level words). So writing words is assembler is not really the Forth way. The other thing you might mean is interoperability (not portability) as in "I want to write some code in C or assembly and attach it to my forth words". Sure you can. I was thinking about uploading .hex files or even ready-to-run object or ELF files that could be executed by the FORTH word. FORTH does not really limit you in this unless you need a bootloader-specific code. > Interrupts: No answers from me on that this time :-) --Marcin |
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. |
From: pito <pi...@vo...> - 2010-09-10 18:16:58
|
Matthias, thanks! I've tried to comment indirect access like ( n -- (tos-n) ) and that killed me for a while..P. > nested comments are not allowed. |
From: Matthias T. <mt...@we...> - 2010-09-10 18:08:02
|
Pito, > Hi, is this correct behaviour in respect to comment content? P. > > > : abcd1 ( n -- xx ) > .s ; > > > : abcd2 ( n -- (xx) ) <<<< nested comments are not allowed. I just tried your code with gforth (0.7.0) and it produces (other but) similiar strange output. The ( searches for the next ) and continues after that ) with the normal operation. In this case with the second ), which is seen as a number (for whatever reason, it should produce an error "word not found"...) Matthias |
From: Matthias T. <mt...@we...> - 2010-09-10 18:04:06
|
Hi 李雪愚, > I've got headache on debug the words on the board. I need a simulator for amforth. Thats sad. I know of no s(usable) imulator for the avr's. The Atmel Development studio has a built-in simulator, but I never managed to get amforth running there. It simply crashes. > Or how to compile the amForth to X86? amforth is not portable to x86 processors. You can find a large number for that target, e.g. gforth. > Where are the forth source of the core? Just download the amforth package from sourceforge and you will get the full sources. Just look at amforth.asm and follow the includes (there are many, but in a structured way). good luck Matthias |
From: pito <pi...@vo...> - 2010-09-10 17:50:49
|
adiw xl, 1 DO_NEXT: brts DO_INTERRUPT movw zl, XL ; READ IP readflashcell wl, wh adiw XL, 1 ; INC IP DO_EXECUTE: movw zl, wl readflashcell temp0,temp1 movw zl, temp0 ijmp <<<<<<<<<<<<<<<< HERE CALLS AVRStudio usoft DO_INTERRUPT: ; here we deal with interrupts the forth way lds temp0, intcur ldi zl, LOW(intvec) ldi zh, HIGH > however after few steps the AVR Studio crashed (it > shots down the > simulator) - always on first "ijmp" instruction > (atmega1284p). |
From: pito <pi...@vo...> - 2010-09-10 17:42:36
|
Hi, I can imagine the headache, indeed. The experts may answer the simulator Q.. I've put the stuff into AVR Studio 4.18 SP2 (build 700 and 692)and I've tried to run amforth in simulator. IT WORKS, however after few steps the AVR Studio crashed (it shots down the simulator) - always on first "ijmp" instruction (atmega1284p). The other way is to simulate in VMLAB (this supports the smaller atmels only). You cannot compile to x86 as the amforth is written in ATMEGA AVR assembler. P. > hi, all > > I've got headache on debug the words on the board. > I need a simulator for amforth. > Does anyone know how to solve it? Or how to > compile the amForth to X86? Where are the forth > source of the core? > > |
From: pito <pi...@vo...> - 2010-09-10 17:06:52
|
Hi, is this correct behaviour in respect to comment content? P. : abcd1 ( n -- xx ) .s ; : abcd2 ( n -- (xx) ) <<<< .s ; > 1234 abcd1 0 12846 1234 ok > > .s ok > 1234 abcd2 0 12844 0 <<<< additional 0 on stack 1 12846 1234 ok > |