Re: [Amforth] Assembler listing of some words

2018-12-21 Thread Jan Kromhout via Amforth-devel
Hello Erich,

This was helpfull

Cheers,

Jan





> Op 21 dec. 2018, om 17:15 heeft Erich Wälde  het 
> volgende geschreven:
> 
> Hello Jan,
> 
> Jan Kromhout via Amforth-devel writes:
> 
>> Hello,
>> 
>> I was looking into some words (.asm).
>> Can someone explain me why the content of the first data word is different.
>> PLUSSTORE => .dw $ff02
>> RSHIFT => .dw $ff06
>> PLUS => .dw $ff01
> 
> I'm sure this is explained somewhere, maybe in the technical guide. But
> I did not find it in 20 seconds, so here we go:
> 
> 
>> $ cat ./avr8/words/plusstore.asm
>> VE_PLUSSTORE:
>>.dw $ff02
>>.db "+!"
>>.dw VE_HEAD
>> ...
> 
> The first .dw entry is "some number", where the low part "02" is the length
> of the string to come. That string is "+!", 2 bytes.
> 
> The high part "ff" is a flags thing. "immediate" words are different:
> 
>> $ cat ./common/words/then.asm
>> ...
>> VE_THEN:
>>.dw $0004
>>.db "then"
>> ...
> 
> There might be other values, but I'm not sure.
> 
> This stuff is implementation dependant and may be all different in other
> Forth implementations.
> 
> 
> 
> Cheers,
> Erich
> 
> --
> May the Forth be with you ...
> 
> 
> ___
> Amforth-devel mailing list for http://amforth.sf.net/
> Amforth-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/amforth-devel



___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel


Re: [Amforth] Assembler listing of some words

2018-12-21 Thread Erich Wälde
Hello Jan,

Jan Kromhout via Amforth-devel writes:

> Hello,
>
> I was looking into some words (.asm).
> Can someone explain me why the content of the first data word is different.
> PLUSSTORE => .dw $ff02
> RSHIFT => .dw $ff06
> PLUS => .dw $ff01

I'm sure this is explained somewhere, maybe in the technical guide. But
I did not find it in 20 seconds, so here we go:


> $ cat ./avr8/words/plusstore.asm
> VE_PLUSSTORE:
> .dw $ff02
> .db "+!"
> .dw VE_HEAD
> ...

The first .dw entry is "some number", where the low part "02" is the length
of the string to come. That string is "+!", 2 bytes.

The high part "ff" is a flags thing. "immediate" words are different:

> $ cat ./common/words/then.asm
> ...
> VE_THEN:
> .dw $0004
> .db "then"
> ...

There might be other values, but I'm not sure.

This stuff is implementation dependant and may be all different in other
Forth implementations.



Cheers,
Erich

--
May the Forth be with you ...


___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel


[Amforth] Assembler listing of some words

2018-12-21 Thread Jan Kromhout via Amforth-devel
Hello,

I was looking into some words (.asm).
Can someone explain me why the content of the first data word is different.
PLUSSTORE => .dw $ff02
RSHIFT => .dw $ff06
PLUS => .dw $ff01

Cheers,

Jan


___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel


Re: [Amforth] get-recognizer & set-recognizer

2018-12-21 Thread Jan Kromhout via Amforth-devel
Hello Erich,

Thanks, I’m just binding in the assembler file. That is done for now.
Will give it a try this afternoon.

The last definition is

: place-rec ( xt -- )
  get-recognizer
  dup >r
  1-  n>r
  swap
  nr> drop r> 1+
  set-recognizer
;
But when I take a look in recognizer.frt the words are
"get-recognizers" and "set-recognizers". I think that these are the same as 
mention in “place-rec”.

The reason to use the FP package is to educate and entertaining.
Try to implement the BMP280 in forth, and would do that with FP.
Have trouble to do that in double math. (perhaps later on)

Cheers,

Jan


> Op 21 dec. 2018, om 14:03 heeft Erich Wälde  het 
> volgende geschreven:
> 
> Hello Jan,
> 
> 
>> Found the missing words!!
> Cool.
> 
>> The package is now loading complete.
>> But it is not working.
>> When  input a float or a double the system is crashing.
> not cool.
>> 
>> Has someone some experience with this package?
> Not me. But see below.
> 
> 
>> I have read there is also a FP package in assembler, where could I
>> find that?
> There is another repository with "community contributed" files.
> On the amforth homepage
> http://amforth.sourceforge.net/ 
> 
> Click on "Community" (the first entry in the title area), this will
> point you to
> https://sourceforge.net/p/amforth/community/HEAD/tree/ 
> 
> 
> where you find a subdirectory  "floatingpoint"
> 
> This is old and possibly outdated material, so do not despair.
> 
> 
> ---
> 
> I would like to make you aware, that floating point calculations can
> often be replaced by "scaled integer" operations.
> 
> Examples:
> 
> 1. handle a Temperature in 1/10 or 1/100 degrees
> 
> Say a thermometer sensor is providing readings with 1/10 degree
> resolution. That means, a reading of 245 really means 24.5 C.
> Then there is no need to convert this to floating point, because you can
> create a function to "print" the value with 1 digit behind the decimal
> point.
> 
>>> ver
>> amforth 6.6 ATmega644P ok
>>> : .f1  <# # [char] . hold #s #> type ;
>> ok
>>> 245 s>d .f1
>> 24.5 ok
> 
> (I had to remember that <# ... #> formatting handles double values :-)
> 
> 
> 
> 2. to handle calculations in scaled integer, the programmer decides, how
> many bits of a given value are considered to be the fractional part. For
> a complex example look here:
> https://sourceforge.net/p/amforth/community/HEAD/tree/ewlib/sht75.fs 
> 
> 
> The word sht.H.raw>lin converts the sensor reading from its raw value to
> the "linear" value by applying a correction.
> 
> \ H_25 [%] = c1 + c2*Hraw + c3*Hraw^2
> \ 12bit:c1=-4 c2=0.0405  c3=-2.8e-6
> 
> I have scaled the calculation by 10^7 and thus eliminated the need to
> work with floating point.
> 
> 
> I'm not saying you must always use scaled integer. I'm just saying: if
> you don't know this technique, check it out, and maybe it fits your
> needs.
> 
> See
> Leo Brodie -- Starting Forth:
> http://home.iae.nl/users/mhx/sf.html 
> Chapter 7.
> 
> 
> 
> Cheers,
> Erich
> 
> 
> 
> 
>> 
>> Cheers,
>> 
>> Jan
>> 
>> 
>>> Op 21 dec. 2018, om 10:55 heeft Jan Kromhout  het 
>>> volgende geschreven:
>>> 
>>> Hello,
>>> 
>>> Try to load the Floating point package.
>>> How do, or find I the words get-recognizer and set-recognizer?
>>> 
>>> What is the meaning of the word "place-rec" and what is the input?
>>> 
>>> Thanks for any help.
>>> 
>>> Cheers
>>> 
>>> Jan
>>> 
>>> 
>>> |S|  930|: place-rec ( xt -- )
>>> |S|  931|  get-recognizer
>>> |E= ?? -13 14
>>>  /Users/jankromhout/Documents/amforth-6.7/tools
>>> Error: Error in line sent
>>> 
>>> 
>>> 
>>> : place-rec ( xt -- )
>>> get-recognizer
>>> dup >r
>>> 1-  n>r
>>> swap
>>> nr> drop r> 1+
>>> set-recognizer
>>> ;
>>> 
>>> ___
>>> Amforth-devel mailing list for http://amforth.sf.net/
>>> Amforth-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/amforth-devel
>> 
>> 
>> 
>> ___
>> Amforth-devel mailing list for http://amforth.sf.net/
>> Amforth-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/amforth-devel
> 
> 
> --
> May the Forth be with you ...
> 
> 
> ___
> Amforth-devel mailing list for http://amforth.sf.net/ 
> Amforth-devel@lists.sourceforge.net 
> 
> https://lists.sourceforge.net/lists/listinfo/amforth-devel 
> 

___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel


Re: [Amforth] get-recognizer & set-recognizer

2018-12-21 Thread Matthias Trute
Am Freitag, den 21.12.2018, 10:42 + schrieb Jan Kromhout:
> Hello,
> 
> Found the missing words!!
> The package is now loading complete.
> But it is not working.
> When  input a float or a double the system is crashing.

That's bad. Can you fix it?

> 
> Has someone some experience with this package?

I've never used it myself in real projects.

> 
> I have read there is also a FP package in assembler, where could I
> find that?

I vaguely remember that one user (Lubos Pekny?) long ago rewrote a few
words from the floating package in assembler to speed up things.
Maybe the mailing list archive will help here (link in sig).

Matthias



___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel


Re: [Amforth] get-recognizer & set-recognizer

2018-12-21 Thread Jan Kromhout
Hello,

Found the missing words!!
The package is now loading complete.
But it is not working.
When  input a float or a double the system is crashing.

Has someone some experience with this package?

I have read there is also a FP package in assembler, where could I find that?

Cheers,

Jan


> Op 21 dec. 2018, om 10:55 heeft Jan Kromhout  het 
> volgende geschreven:
> 
> Hello,
> 
> Try to load the Floating point package.
> How do, or find I the words get-recognizer and set-recognizer?
> 
> What is the meaning of the word "place-rec" and what is the input?
> 
> Thanks for any help.
> 
> Cheers
> 
> Jan
> 
> 
> |S|  930|: place-rec ( xt -- )
> |S|  931|  get-recognizer
> |E= ?? -13 14
>  /Users/jankromhout/Documents/amforth-6.7/tools
> Error: Error in line sent
> 
> 
> 
> : place-rec ( xt -- )
>  get-recognizer
>  dup >r
>  1-  n>r
>  swap
>  nr> drop r> 1+
>  set-recognizer
> ;
> 
> ___
> Amforth-devel mailing list for http://amforth.sf.net/
> Amforth-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/amforth-devel



___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel


[Amforth] get-recognizer & set-recognizer

2018-12-21 Thread Jan Kromhout
Hello,

Try to load the Floating point package.
How do, or find I the words get-recognizer and set-recognizer?

What is the meaning of the word "place-rec" and what is the input?

Thanks for any help.

Cheers

Jan


|S|  930|: place-rec ( xt -- )
|S|  931|  get-recognizer
|E= ?? -13 14
 /Users/jankromhout/Documents/amforth-6.7/tools
Error: Error in line sent



: place-rec ( xt -- )
  get-recognizer
  dup >r
  1-  n>r
  swap
  nr> drop r> 1+
  set-recognizer
;

___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel