-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbld.fiv
More file actions
3816 lines (3365 loc) · 89.3 KB
/
bld.fiv
File metadata and controls
3816 lines (3365 loc) · 89.3 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
BUILD
!0000002E
\ Build a helpfile. Version 4
create build
-*-
v
CROSS
!0000030C
\ ( -> addr-to-save-length addr-of-text-start )
\ CROSS creates a cross reference to another entry in the help file.
: cross
create \ Create the module
66666666 , \ Give it a tag.
here h# FFFF0000 and , \ Save local Module Address *
0 , \ Save room for length of entry. *
32 word dup c@ 0= \ Insist that a name follows.
abort" Cross reference lacks the name specification"
dup c@ -2 do \ Save the name away.
count c,
loop drop
0 , 0 ,
does>
-1 abort" Executing a cross reference does not make sense!"
;
\ * -- Note: These items star'ed (*) above are not really necessary
\ for a cross reference, but are done to be uniform with
\ actual entries.
-*-
>
|
!000001B3
: |
obvious \ Does the easy stuff
addmenu addnames \ Builds a menu followed by a list of names.
here swap - \ Compute length of entry.
swap ! \ Patch up length of entry.
\ cliff's bogusness
does>
pooh!
['] help comp \ Force HELP to re-read the offset table, since
; \ we may have just replaced the old help file.
-*-
v
GET-NAME
!000001BE
\ ( module -> addr ) Takes the module address, checks for validity, and
\ returns the address of the token's name.
: get-name
>body \ Get the data area.
dup @ dup 77777777 = not \ Check the tag; if not a help file entry,
swap 66666666 = not and \ or cross reference, then bad module.
abort" Invalid child found! " \ Blow if bad
12 + \ Increment to the name.
;
-*-
>
OBVIOUS
!0000036C
\ ( -> addr-to-save-length addr-of-text-start )
\ Obvious creates the module, saves a tag, saves local executable addr,
\ allocates 4 bytes (and returns this addr) for saving the length of the
\ the entry, then saves the text (without the trailing null).
: obvious
create \ Create the module
77777777 , \ Give it a tag.
here h# FFFF0000 and , \ Save local Module Address
here 0 , \ Save room for length of entry.
32 word dup c@ -2 do count c, loop drop \ Save the name away.
here \ Address of beginning of text.
>in @ \ Get the text pointer
begin dup c@@ ?dup while c, 1+ repeat \ Save the text.
>in ! \ Save pointer to end of text.
;
-*-
>
ADDMENU
!00000405
\ ( -> 8b ) addmenu builds a menu (if the module has any children).
\ It returns a count of the number of items within the menu.
: addmenu
0 here h# FFFF0000 and child \ child count zero, get first child.
dup 0= if , , 0 exit endif \ No children, compile two nulls.
begin ?dup while \ While not null, do
over 4 mod 0= if \ Skip to 1st col if needed.
13 c, 10 c, 4 0 do 32 c, loop \ Add crlf and indention.
endif
over 65 + c, ` ) c, 32 c, \ Add the letter.
swap 1+ swap \ Increment count of children.
dup get-name dup c@ 13 > \ Check length restrictions
abort" Name too long" \ and die if too long!
dup count 0 do count c, loop drop \ Compile in the name.
c@ 15 swap - 0 do 32 c, loop \ Add spaces to next goto next column.
next \ Goto next child
repeat \ When done, leave item count on stk.
;
-*-
>
ADDNAMES
!0000036A
\ ( 8b -> ) addnames takes a count of the items in the menu and compiles
\ a list of counted names. (This list is null terminated)
: addnames
?dup 0= if exit endif \ No children, then we are done!
10 c, 13 c, 10 c, 13 c, \ Add crlf
" Enter a letter for further help, or space to return. "
count -1 do count c, loop drop \ Compile in friendly message and null.
, \ Save item count left on stk above.
here h# FFFF0000 and child \ Get the child.
begin dup while
dup get-name \ Get the child's name
dup c@ -2 do count c, loop drop \ Compile in the name
next \ Goto next child
repeat drop \ Drop child address.
0 , 0 , \ End the list with a double null
;
-*-
>
POOH!
!0000055E
\ ( parameter-address -> )
\ Takes the parameter address, builds the help file.
\ This module does all the work associcated with writing everything out.
: pooh!
0 ncnt ! \ Set the count of entries to zero.
0 nlen ! \ Set length of the names list.
" fifth.hlp" 1+ 32 createfile \ Open file, possibly destroying old file.
if h ! else \ Save file handle if everything ok.
1 abort" Open File Error" \ Abort if everything not ok.
endif
" " 4 h @ write err? \ Write four bytes out for size of name list.
" " 4 h @ write err? \ Write four bytes out for count of entries.
dup 8 + wn \ Write out this man's name and length.
dup 4 + @ child wns \ Get exec addr of 1st child & write'em out.
woffs \ Write out the file offsets.
4 + @ dup wt child wts \ Write out this man's text, & all his child's.
0 1 h @ seek drop \ Get current file position (used to reach EOF)
0 0 h @ seek err? \ Move to file beginning
nlen 4 h @ write err? \ Write out byte cnt of names.
ncnt 4 h @ write err? \ Write out cnt of entries in help file.
0 h @ seek err? \ Move back to end of file (EOF)
h @ close if else drop endif \ Close the new help file
;
-*-
v
H
!00000054
\ Handle. Holds the file handle for the help file under construction.
variable h
-*-
>
NLEN
!00000066
\ Name LENgth. Holds a count of the sum length of all the names in the help
\ file.
variable nlen
-*-
>
NCNT
!00000048
\ Name CouNT. Count of all the names in the help file.
variable ncnt
-*-
>
ERR?
!000000E1
\ ( 32b1 flag -> )
\ Checks for errors during file accesses (reads or writes).
\ flag = true, no error, drop 32b1; otherwise abort and die!
: err?
if drop else -1 abort" File Access Error (on read or write)." endif
;
-*-
>
NAMES
!00000072
\ Contains the file offsets to each entry in the help file.
\ Limit of 2K entries.
create names 2048 4 * allot
-*-
>
WN
!000001C4
\ ( addr -> ) This is the address of the total length of the entry (4 bytes)
\ followed by the module name. WN saves the offset into TABLE and writes out a
\ single name.
: wn
dup @ names ncnt @ 4 * + ! \ Save the length of this entry.
1 ncnt +! \ Increment the count of total entries.
4 + dup c@ 2 + dup nlen +! \ Get name length and add to total length.
h @ write err? \ Write out the name
;
-*-
>
WNS
!00000222
\ ( execution-addr -> )
\ Writes out the name of the module with execution-addr, its children's and its
\ brother's as well.
: wns
?dup 0= if exit endif \ Check to see if null; if so, go away!
dup >body @ 66666666 = if \ If this is a cross reference,
next wns exit \ then ignore it.
endif
dup >body 8 + wn \ Write out this man's name
dup child wns \ Write out this man's children's names.
next wns \ Write out this man's brother's names.
;
-*-
>
WOFFS
!000002C5
\ ( -> ) Write OFFsetS. Each offset corresponds to an entry in the names
\ list. We touch up the offsets to be relative to the beginning of the file.
\ nlen ncnt
: woffs \ Bias=(4 bytes + 4 bytes + len(names) + ncnt*4 )
nlen @ 8 + ncnt @ 4 * + \ Keep a bias on the top of stack.
ncnt @ 4 * names + names do \ DO's index is a pointer into names.
i @ over i ! + \ Add bias, THEN add length to bias.
4 +loop \ Increment to next entry.
drop \ When all's said and done, drop bias.
names ncnt @ 4 * h @ write err? \ Write out the offsets.
;
-*-
>
WT
!0000012F
\ ( execution-addr -> ) Write out the given module's text.
: wt
>body \ Goto the data area.
dup 12 + c@ 14 + over + \ Compute the start of the text.
swap 8 + @ \ Get the length of the entry.
h @ write err? \ Write it out.
;
-*-
>
WTS
!00000237
\ ( execution-addr -> ) Write TextS (text plural).
\ Writes out the text of the module with execution-addr, its children's and its
\ brother's as well.
: wts
?dup 0= if exit endif \ Check to see if null; if so, go away!
dup >body @ 66666666 = if \ If this is a cross reference,
next wts exit \ ignore it.
endif
dup wt \ Write out this man's text
dup child wts \ Write out this man's children's text.
next wts \ Write out this man's brother's text.
;
-*-
^
^
>
BUILD-HELP-FILE
!00000585
\ After making changes to BUILD-HELP-FILE and its children, remember to
\ save your work! (Do your saves in the dictionary editor with BUILD as
\ the local module (the module in the top left of your screen)).
\
\ To build a new help file, enter the dictionary editor and use the arrow
\ keys to make this module, BUILD-HELP-FILE, the local module (the module
\ whose name is displayed in the top left hand corner of the screen).
\ Then press 'G' for go. This will build a help file reflecting any changes
\ you have made to BUILD-HELP-FILE and its children.
| build-help-file
GEN-HELP
General Help 1-20-89
The HELP module provides an easy to use quick reference on primitives in
the system. HELP can be called from the interactive mode by typing HELP
followed by the module's name for which help is sought.
Apropos HELP is available from within the text editor by placing the
cursor on or before a module and pressing the F2 key. This screen may be
displayed from within the text editor by placing the cursor past the last
module in the text.
If F2 is pressed on a User defined module, the dictionary editor is called
with the User defined module as the local module. When you leave the
dictionary editor, you will return to the text editor. (Be warned! An
error before you return will cause the loss of the editing session.)
-*-
v
NOTATION
!0000041D
| notation
NOTATION
Fifth is a powerful, truly functional language. As such, the most important
documentation is that of the inputs and outputs of each function. We suggest
the following notation be used on the first line of each module; this
notation is also used through out the help facility.
( 32b1 32b2 -> 32b3 ) MOD returns the remainder 32b3 of 32b1 divided by 32b2.
The inputs expected on the stack are given prior to the arrow, and the
outputs are given after the arrow. Each input is described by a type and
a number (to make it unique). The description of MOD given above says
that MOD expects two 32 bit integers. These two 32 bit integers are replaced
by a third 32 bit integer. This third integer is defined as the remainder
left over when the first integer is divided by the second integer.
We use the following types through out the help facility:
8b - an 8 bit integer addr - a valid Fifth address
16b - a 16 bit integer flag - a 32 bit integer, value 0 or -1
32b - a 32 bit integer
-*-
v
FNOTATION
!0000001C
cross fnotation F_NOTATION
-*-
^
>
ARITHMETIC
!00000177
| arithmetic
arithmetic
Fifth supports 32-bit integer arithmetic, i.e. Fifth has a 32 bit stack.
The floating point operators use their own stack and rely on the math
coprocessor, and thus will not work on some systems. (If your system lacks
the math coprocessor, you will get a Math Coprocessor Missing error when you
attempt to use a floating point operator.)
-*-
v
INTEGERS
!000000ED
| integers
INTEGERS
Integers in Fifth are usually 32 bits in length. This gives a effective
range of -2147483648 to 2147483647. Each element on Fifth's stack is 32 bits
in length. Fifth provides the following integer operators.
-*-
v
+
!0000003F
| +
+
(32b1 32b2 -> 32b3) Add 32b1 to 32b2 yielding 32b3.
-*-
>
-
!00000046
| -
-
(32b1 32b2 -> 32b3) Subtract 32b2 from 32b1 yielding 32b3.
-*-
>
*
!00000051
| *
*
(32b1 32b2 -> 32b3) Signed multiply of 32b1 times 32b2 yielding 32b3.
-*-
>
/
!00000092
| /
/
(32b1 32b2 -> 32b3) Divide 32b1 by 32b2, leaving quotient 32b3. A numerical
overflow will occur if 32b2 is zero or 32b3 out of range.
-*-
>
1+
!0000003A
| 1+
1+
(32b1 -> 32b2) Increment 32b1 yielding 32b2.
-*-
>
1-
!0000003A
| 1-
1-
(32b1 -> 32b2) Decrement 32b1 yielding 32b2.
-*-
>
2+
!00000039
| 2+
2+
(32b1 -> 32b2) Add 2 to 32b1 yielding 32b2.
-*-
>
2-
!00000040
| 2-
2-
(32b1 -> 32b2) Subtract 2 from 32b1 yielding 32b2.
-*-
>
2/
!0000004D
| 2/
2/
(32b1 -> 32b2) Arithmetically shift 32b1 right 1 yielding 32b2.
-*-
>
/MOD
!000000CE
| /MOD
/MOD
(32b1 32b2 -> 32b3 32b4) Divide 32b1 by 32b2, leaving quotient 32b4 and
remainder 32b3. 32b3 has same sign as 32b2. A numerical overflow will
occur if 32b2 is zero or 32b4 out of range.
-*-
>
ABS
!0000004C
| ABS
ABS
(32b -> u32b) Signed 32b is replaced by it's absolute value.
-*-
>
MAX
!0000005B
| MAX
MAX
(32b1 32b2 -> 32b3) Leave the larger of 32b1 and 32b2 on the stack as 32b3.
-*-
>
MIN
!0000005B
| MIN
MIN
(32b1 32b2 -> 32b3) Leave the lesser of 32b1 and 32b2 on the stack as 32b3.
-*-
>
MOD
!000000A7
| MOD
MOD
(32b1 32b2 -> 32b3) Divide 32b1 by 32b2 yielding remainder 32b3. 32b3 has
same sign as 32b2, forces an error if 32b2 is zero or quotient out of range.
-*-
>
NEGATE
!00000049
| NEGATE
NEGATE
(32b1 -> 32b2) Two's complement 32b1 yielding 32b2.
-*-
>
SHL
!0000007D
| SHL
SHL
(32b1 32b2 -> 32b3) 32b1 is shifted left 32b2 places, zeros are shifted in on
the right. The result is 32b3.
-*-
>
SHR
!0000007D
| SHR
SHR
(32b1 32b2 -> 32b3) 32b1 is shifted right 32b2 places, zeros are shifted in
on the left. The result is 32b3.
-*-
>
CSHR
!0000009B
| CSHR
CSHR
(32b1 32b2 -> 32b3) 32b1 is shifted right 32b2 bits. Bits shifted out on
the right are shifted back in on the left. 32b3 is the result.
-*-
>
CSHL
!00000092
| CSHl
CSHL
(32b1 32b2 -> 32b3) 32b1 is shifted left 32b2 bits. Bits shifted off the left
are shifted in on the right. The result is 32b3.
-*-
^
>
FLOAT
!0000031A
| float
<FLOAT>
Fifth provides floating point using the 8087 math coprocessor family. If you
do not have a math coprocessor, Fifth's floating point routines will not work
on your machine. To use the floating point routines, you must use the
package called <FLOAT>. See the help on PACKAGE.
Fifth uses 80 bit floating point arithmetic internally, but current I/O is
limited to 32 bit accuracy. This gives six digits accuracy, with an exponent
range of roughly +/- 10 to the 36. All floating point operations work with
the separate floating point stack. This stack is limited to roughly 100
10-byte floating point numbers.
When using inline assembly with the 8087, you can treat the 8087 as having a
very large stack - underflow and overflow errors are handled by Fifth.
-*-
v
FNOTATION
!000001E7
| fnotation
F_NOTATION
When the parameters of a floating point primitive are displayed, the integer
stack parameters will be shown as usual, with a separate display for the
floating point numbers. For example:
(f1 f2 -> f3) Adds two floating point numbers.
implies that the operation does not effect the integer stack, while
(addr -> )
(f1 -> ) Stores a floating point value (10 bytes) at the address.
implies that both stacks are effected.
-*-
>
FOPERATORS
!00000056
| foperators
FOPERATORS
These are the basic floating point arithmetic operators:
-*-
v
F+
!0000003D
| F+
F+
(f1 f2 -> f3 ) Adds two floating point numbers.
-*-
>
F-
!00000042
| F-
F-
(f1 f2 -> f3 ) Subtracts two floating point numbers.
-*-
>
F*
!00000043
| F*
F*
(f1 f2 -> f3 ) Multiplies two floating point numbers.
-*-
>
F/
!00000040
| F/
F/
(f1 f2 -> f3 ) Divides two floating point numbers.
-*-
>
F<
!00000094
| F<
F<
(f1 f2 -> )
( -> flag ) Compares two floating point numbers. If f1 is less than f2, flag
is true (-1), otherwise flag is false (0).
-*-
>
F>
!00000097
| F>
F>
(f1 f2 -> )
( -> flag ) Compares two floating point numbers. If f1 is greater than f2,
flag is true (-1), otherwise flag is false (0).
-*-
>
FSQRT
!0000003D
| FSQRT
FSQRT
(f1 -> f2) Returns the square root of f1.
-*-
>
FEXP
!00000045
| FEXP
FEXP
(f1 -> f2) Returns e^X on floating point number f1.
-*-
>
FLOG
!0000003B
| FLOG
FLOG
(f1 -> f2) Returns the natural log of f1.
-*-
>
FSIN
!00000046
| FSIN
FSIN
(f1 -> f2) Returns the SINE of angle f1, in degrees.
-*-
>
FCOS
!00000048
| FCOS
FCOS
(f1 -> f2) Returns the COSINE of angle f1, in degrees.
-*-
>
FATAN
!00000048
| FATAN
FATAN
(f1 -> f2) Returns the arctangent of f1, in degrees.
-*-
>
P->R
!00000068
| P->R
P->R
(theta radius -> x y) Converts polar coordinates to rectangular.
Theta is in degrees.
-*-
>
FTRANSFORM
!000001EF
| FTRANSFORM
FTRANSFORM
(addr -> )
(f1 f2 f3 -> f1' f2' f3')
Performs a 3x3 matrix transformation. Addr points to 9 floating point values
which define the matrix. For example:
create ident
1. f, 0. f, 0. f,
0. f, 1. f, 0. f,
0. f, 0. f, 1. f,
creates an identity matrix. Then
: x 1. 2. 3. ident ftransform f. f. f. ;
transforms 1, 2 and 3 with the identity matrix (no change) and prints them.
FTRANSFORM is useful for fast 3-D graphics.
-*-
^
>
FSTACK_OP
!00000056
| fstack_op
FSTACK_OP
These stack operators manipulate the floating point stack:
-*-
v
FSWAP
!00000048
| FSWAP
FSWAP
(f1 f2 -> f2 f1) Top two stack elements are swapped.
-*-
>
FOVER
!00000055
| FOVER
FOVER
(f1 f2 -> f1 f2 f1) Stack is modified according to stack diagram.
-*-
>
FDUP
!00000043
| FDUP
FDUP
(f1 -> f1 f1) Duplicate the top-of-stack element.
-*-
>
FDROP
!0000004E
| FDROP
FDROP
(f1 -> ) A floating point value is dropped from the stack.
-*-
>
FSTACK_
!0000030A
| fstack_
FSTACK (32b1 32b2 ... -> ... )
fstack AB|ABAB (f1 f2 -> f1 f2 f1 f2)
fstack ABC|CAB (f1 f2 f3 -> f3 f1 f2)
fstack ABCDE|EE (f1 f2 f3 f4 f5 -> f5 f5)
Let me explain the last example. A is deepest, E is on on the top of the
stack on the `before' side of |. On the after side, E is the only thing
left; ABCD were all thrown away, and E is DUPed, giving two copies of E.
FSTACK can simplify understanding of complicated stack manipulations.
However, for simple operations it is quite a bit slower, e.g. use FDUP
instead of FSTACK A|AA.
FSTACK is limited to no more than 26 elements on the before side, no limit on
the after side. It is not case sensitive, but the letters on the before side
must be in order "ABC..." .
-*-
^
>
FCONSTANT
!000000AA
| FCONSTANT
FCONSTANT
(f1 -> ) Next module in the input stream is compiled into the dictionary.
Later execution of this name leaves f1 on the floating point stack.
-*-
>
FVARIABLE
!00000078
| FVARIABLE
FVARIABLE
( -> ) The next module in the input stream is CREATE'd, and 10 bytes reserved
for it's use.
-*-
>
F!
!00000058
| f!
F!
(addr -> )
(f1 -> ) Store floating point value (10 bytes) at the address.
-*-
>
F@
!00000057
| f@
F@
(addr -> )
( -> f1) The floating point value at the address is fetched.
-*-
>
F,
!000001B1
| F,
F,
(f1 -> ) Floating point comma
adds 10 bytes to the local module (the module currently under
compilation) and initializes the 10 bytes to the value f1. For example, a
variable PI could be defined and initialized to 4.5 by the code:
create PI 3.14 f,
The following code would print a the value of PI.
PI f@ f.
The value of PI could be changed to 3.1417 by the code
3.1417 PI f!
-*-
>
FLITERAL
!00000076
| FLITERAL
FLITERAL
(f1 -> ) Causes the top-of-stack value to be compiled just as if it where an
inline number.
-*-
>
PACKAGE
!00000017
cross package PACKAGE
-*-
^
>
F.
!00000038
| F.
F.
(f1 -> ) Prints the floating point number.
-*-
>
F->EM
!000000F0
| F->EM
F->EM
( -> 32b1 32b2)
(f1 -> ) Converts the floating point f1 to exponent 32b1 and mantissa 32b2.
Mantissa is adjusted by RADIX to the 6th power, to allow six #'s to be used
on it within a formatted string command sequence.
-*-
>
A->F
!0000012C
| a->f
A->F
(addr1 -> addr2 f1)
The string whose length byte is pointed to by address #1 is converted to f1.
Address #2 points to the first non-convertible character. f1 is a 32bit
floating point value on the integer stack, use S->F to move it to the
floating point stack for further work.
-*-
>
F->I
!00000089
| F->I
F->I
(f1 -> )
( -> 32b2) Converts floating point to integer, numerical overflow if
f1 cannot be represented as an integer.
-*-
>
I->F
!00000049
| I->F
I->F
( -> f1)
(32b1 -> ) Convert integer to floating point.
-*-
>
F->S
!000000F5
| F->S
F->S
(f1 -> )
( -> s1) Move floating point number to the integer stack, where it is
treated as a 32 bit real number. Such numbers can be dealt with the normal
stack operators like DUP, and !, but .S will not print them properly.
-*-
>
S->F
!00000059
| S->F
S->F
( -> f1)
(s1 -> ) Move 32 bit real number to the floating point stack.
-*-
>
S+
!00000067
| S+
S+
(s1 s2 -> s3 ) Adds two 32 bit real numbers, which are kept on the normal
integer stack.
-*-
>
S-
!0000006C
| S-
S-
(s1 s2 -> s3 ) Subtracts two 32 bit real numbers, which are kept on the
normal integer stack.
-*-
>
S*
!0000006D
| S*
S*
(s1 s2 -> s3 ) Multiplies two 32 bit real numbers, which are kept on the
normal integer stack.
-*-
>
S/
!0000006A
| S/
S/
(s1 s2 -> s3 ) Divides two 32 bit real numbers, which are kept on the normal
integer stack.
-*-
^
>
COMPARISON
!00000204
| comparison
COMPARISON
Flags in Fifth are integers where 0 is false and -1 is true. Logical
operations can be done using AND, OR, NOT, and XOR with flags that are
strictly true (-1) or strictly false (0), even though AND, OR, NOT, and XOR
are bitwise operators. (This is because -1 has all bits set, and 0 has all
bits clear; bitwise operators operate on all bits identically.)
Many primitives that take a flag as an input (such as IF) will consider any
non zero flag to be true, and 0 to be false.
-*-
v
<
!0000007B
| <
<
(32b1 32b2 -> flag) The flag returned is true (-1) if 32b1 is less than
32b2, otherwise the flag is false (0).
-*-
>
<=
!000000BA
| <=
<=
(32b1 32b2 -> flag) A true flag (-1) replaces 32b1 and 32b2 on the stack
if 32b1 is less than or equal to 32b2, otherwise 32b1 and 32b2 is replaced
with a false flag (0).
-*-
>
=
!000000AB
| =
=
(32b1 32b2 -> flag) A true flag (-1) replaces 32b1 and 32b2 on the stack
if 32b1 is equal to 32b2, otherwise 32b1 and 32b2 is replaced with a false
flag (0).
-*-
>
>=
!000000BD
| >=
>=
(32b1 32b2 -> flag) A true flag (-1) replaces 32b1 and 32b2 on the stack
if 32b1 is greater than or equal to 32b2, otherwise 32b1 and 32b2 is
replaced with a false flag (0).
-*-
>
>
!0000008E
| >
>
(32b1 32b2 -> flag) Compares 32b1 with 32b2; if 32b1 is greater than 32b2,
the flag is true (-1) otherwise the flag is false (0).
-*-
>
0>
!00000088
| 0>
0>
(32b -> flag) Replace 32b with a true flag (-1) if 32b is greater than zero,
otherwise replace 32b with a false flag (0).
-*-
>
0=
!00000084
| 0=
0=
(32b -> flag) Replace 32b with a true flag (-1) if 32b is equal to zero,
otherwise replace 32b with a false flag (0).
-*-
>
0<