/
forthExtend.txt
62 lines (48 loc) · 1.69 KB
/
forthExtend.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
\ *********************************************************************
\ EXTEND gForth dictionnary with words used in meta.txt *
\ Filename: forthExtend.txt *
\ Date: 10.04.2021 *
\ Updated: 10.04.2021 *
\ MCU: gForth *
\ Copyright: Marc PETREMANN *
\ Author: Marc PETREMANN *
\ *********************************************************************
\ In little-endian system, stores least-significant byte at smallest address
\ if true, for 16 bit word, addr = LSB, addr+1 = MSB
\ little-endian model by default, used by Intel processors
true value LITTLE-ENDIAN
\ invert byte of 16 bits word if not little-endian system
: byte-invert ( w -- w')
LITTLE-ENDIAN invert if
$100 /mod
swap $100 * +
then
;
: 2+ ( n -- n+2)
1+ 1+ ;
\ multi language support, only one language is "true"
false value ENGLISH immediate
true value FRENCH immediate
false value GERMAN immediate
\ condtionnal compilation
: ?\ ( fl -- )
0=
if
postpone \
then
; immediate
\ Example:
\ cr FRENCH ?\ ." Dernière adresse cible: "
\ ENGLISH ?\ ." Latest target adress: "
\ GERMAN ?\ ." Letzte TARGET Adresse: "
\ specific version for gForth
\ Strings extension
: string ( comp: -- <name> | exec: -- addr)
variable
;
\ example:
\ string TARGET$
\ s" KERNEL.COM" TARGET$ $!
\ TARGET$ $@ type
\ *** End of File ***********************
cr ." forthExtend.txt loaded" cr