-
Notifications
You must be signed in to change notification settings - Fork 1
/
asm.fiv
2575 lines (2562 loc) · 37.7 KB
/
asm.fiv
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
ASM[
!000001E2
\ FORTH 8088/8087 ASSEMBLER PHIL KOOPMAN JR. LAST UPDATE: 9/2/86
\
\ (C) COPYRIGHT 1986 BY PHIL KOOPMAN JR.
\ Modifed 2/5/87 by CLICK Software to run under Fifth 2.5
\
\ The contents of this file are released without restrictions.
\ Acknowledgement of its use would be appreciated.
: asm[
[compile] here-be-stuff \ Setup the package
[compile] [ \ Turn compiler off
reset \ Reset, ready assembler
; immediate
-*-
v
HEX
!00000013
: hex 16 base ! ;
-*-
>
XX@
!0000001B
( ADDR -> N )
: xx@ w@ ;
-*-
>
XX!
!0000001B
( N ADDR -> )
: xx! w! ;
-*-
>
XXC@
!0000001C
( ADDR -> B )
: xxc@ c@ ;
-*-
>
XXC!
!0000001C
( B ADDR -> )
: XXC! c! ;
-*-
>
XX+!
!00000033
( N ADDR -> )
: XX+! stack ab|bab w@ + swap w! ;
-*-
>
XXHERE
!00000013
: XXHERE here ;
-*-
>
XXALLOT
!00000022
: XXALLOT ( N -> )
allot
;
-*-
>
XXC,
!0000001C
: XXC, ( B -> )
c,
;
-*-
>
XX,
!0000001B
: XX, ( N -> )
w,
;
-*-
>
ERROR-CHECK
!000001B2
\ ERROR CHECKING ASSISTANCE -- COMPILE CALL TO RUN-TIME CHECK
\ #IN = max # stack parameters expected for input
\ #OUT = max # stack parameters expected for output
\ Comment out to remove
: ERROR-CHECK ( #IN #OUT -> )
compile check \ Compile a call to CHECK
OVER - 0 MAX 2 shl XXC, \ # Bytes stack growth for output
2 shl XXC, \ # Bytes needed on stack for input
; immediate
-*-
v
CHECK
!00000148
\ Check the stack for proper balance
\ Remove stack growth needed & desired from return address
: check
r> \ Get return address
dup c@@ drop \ Get stack growth needed
1+ dup c@@ drop \ Get bytes needed for input
1+ >r \ Push modified return address back, exit
;
-*-
^
>
STATUS-WORD
!00000052
( ASSEMBLER VARIABLES )
VARIABLE STATUS-WORD \ SOURCE & DEST OPERAND TYPES
-*-
>
SOURCE-REG
!0000002F
VARIABLE SOURCE-REG \ SOURCE REG NUMBER
-*-
>
DEST-REG
!0000002D
VARIABLE DEST-REG \ DEST REG NUMBER
-*-
>
SOURCE-VALUE
!0000003B
VARIABLE SOURCE-VALUE \ IMMEDIATE/DIRECT/OFFSET VALUE
-*-
>
DEST-VALUE
!0000003B
VARIABLE DEST-VALUE \ IMMEDIATE/DIRECT/OFFSET VALUE
-*-
>
AUX-VALUE
!00000034
VARIABLE AUX-VALUE \ USED FOR FAR ADDRESSES
-*-
>
LENGTH-WORD
!00000041
VARIABLE LENGTH-WORD \ FLAG BITS TO DETERMINE OPERAND TYPE
-*-
>
OLD-DEPTH
!00000035
VARIABLE OLD-DEPTH \ DATA STACK POINTER SAVE
-*-
>
ILLEGAL-OPS?
!00000038
( FLAG -> )
: ILLEGAL-OPS? ABORT" ILLEGAL OPERANDS" ;
-*-
>
ILLEGAL-OPS
!00000039
( -> ) ( FORCE ERROR )
: ILLEGAL-OPS 1 ILLEGAL-OPS? ;
-*-
>
UPDATE-FLAGS
!00000082
: UPDATE-FLAGS ( LENGTH-BITS STATUS-BITS -> )
STATUS-WORD W@ OR STATUS-WORD W!
LENGTH-WORD W@ OR LENGTH-WORD W! ;
-*-
>
PARAMS?
!00000079
: PARAMS? ( -> #PARAMS ) ( TRUE IF IMMED/DIR PARAM ON STACK )
DEPTH OLD-DEPTH w@ -
DUP 0< ILLEGAL-OPS? ;
-*-
>
DISP8,
!00000035
( JMPADDR -> )
: DISP8, XXHERE 1+ - XXC, ;
-*-
>
DISP16,
!00000032
( JMPADDR -> )
: DISP16, XXHERE 2+ - XX, ;
-*-
>
?W
!0000005E
hex
: ?W ( -> W=0/1 )
LENGTH-WORD w@ DUP 0FC AND ILLEGAL-OPS?
2 = 1 and ;
-*-
>
BYTESWAP
!0000009D
hex
: BYTESWAP [
1 1 ERROR-CHECK
8B C, 46 C, 00 C, \ AX , 0 [BP] MOV
86 C, E0 C, \ AH , AL XCHG
89 C, 46 C, 00 C, \ 0 [BP] , AX MOV
] ;
-*-
>
STATUS-LOW
!0000004F
HEX
: STATUS-LOW ( -> LOW.STATUS.BYTE.0->FF )
STATUS-WORD w@ 0FF AND ;
-*-
>
STATUS-HIGH
!00000058
hex
: STATUS-HIGH ( -> HIGH.STATUS.BYTE.0000->FF00 )
STATUS-WORD w@ 0FF00 AND ;
-*-
>
?D
!000001AD
( ?D ?REG )
HEX
: ?D ( -> D=0/1 ) ( 0=SOURCE IS REG/ 1= DEST IS REG )
STATUS-LOW 10 AND IF ( DEST IS SEG REG ) 1 ELSE
STATUS-HIGH 1000 AND IF ( SOURCE IS SEG REG ) 0 ELSE
STATUS-HIGH 0400 AND IF ( SOURCE IS IMMEDIATE ) 0 ELSE
STATUS-LOW 80 AND IF ( DEST IS REG ) 1 ELSE
STATUS-HIGH 8000 AND IF ( SOURCE IS REG ) 0 ELSE
1 endif endif endif endif endif ;
-*-
>
?REG
!0000004F
: ?REG ( -> REG-VALUE )
?D IF DEST-REG ELSE SOURCE-REG endif w@ ;
-*-
>
?FD
!000000AF
HEX
: ?FD ( -> D=0/1 ) ( 0=DEST IS ST[0] / 1= SOURCE IS ST[0] )
STATUS-LOW 08 AND IF DEST-REG w@ 0=
IF ( DEST IS ST[0] ) 0 ELSE 1 endif
ELSE 1 endif ;
-*-
>
?FREG
!00000079
: ?FREG ( -> REG# )
SOURCE-REG w@ 0= NOT DEST-REG w@ 0= NOT AND ILLEGAL-OPS?
SOURCE-REG w@ DEST-REG w@ OR ;
-*-
>
<?MOD-R/M>
!00000227
HEX
: <?MOD-R/M> ( STATUS-BYTE -> MODXXR/M )
DUP 80 AND IF ( REGISTER ) DROP 0C0
?D IF SOURCE-REG ELSE DEST-REG endif w@ OR
ELSE DUP 60 AND 20 =
IF ( DIRECT ) DROP 06
ELSE DUP 40 AND 0= ILLEGAL-OPS?
( INDIRECT ) ?D IF SOURCE-REG w@ SOURCE-VALUE w@
ELSE DEST-REG w@ DEST-VALUE w@ endif
stack abc|bca 20 AND
IF FF80 AND DUP 0= SWAP FF80 = OR
IF ( 8-BIT ) 40 OR ELSE ( 16-BIT ) 80 OR endif
ELSE DROP endif
endif endif ;
-*-
>
?MOD-R/M2
!0000007D
HEX
: ?MOD-R/M2 ( -> MODXXXR/M ) ( FOR 2 OPERAND CASE )
STATUS-WORD w@ ?D IF BYTESWAP endif 0FF AND <?MOD-R/M> ;
-*-
>
?MOD-R/M1
!0000007A
: ?MOD-R/M1 ( -> MODXXXR/M ) ( FOR 1 OPERAND CASE )
SOURCE-REG w@ DEST-REG w! STATUS-HIGH BYTESWAP <?MOD-R/M> ;
-*-
>
?MOD-R/M2-REG
!00000076
: ?MOD-R/M2-REG ( -> MODXXXR/M ) ( 2 OPERANDS, BUT USE REG )
DEST-REG w@ SOURCE-REG w! STATUS-LOW <?MOD-R/M> ;
-*-
>
?OFFSET,
!00000190
( ?OFFSET, DATA, )
HEX
: ?OFFSET, ( -> )
( COMMA'S OFFSET ONLY IF NEEDED IN ASSEMBLED FORMAT )
STATUS-WORD w@ 2020 AND DUP 2020 = ILLEGAL-OPS?
?DUP IF ( OFFSET INFORMATION APPLICABLE )
20 AND IF DEST-VALUE w@ ELSE SOURCE-VALUE w@ endif
STATUS-WORD w@ 4040 AND IF DUP FF80 AND DUP FF80 = SWAP 0=
OR IF XXC, ELSE XX, endif ELSE XX, endif endif ;
-*-
>
DATA,
!0000009F
hex
: DATA, ( N -> )
( COMMA 1 OR 2 BYTES ACCORDING TO W )
?W IF XX,
ELSE DUP FF00 AND ( TOO LONG? ) ILLEGAL-OPS?
XXC, endif ;
-*-
>
?Q
!000000C2
HEX
: ?Q ( -> 0/1 ) ( 0=TO ACCUM/1= FROM ACCUM )
STATUS-LOW 80 = DEST-REG w@ 0= AND
IF 0
ELSE STATUS-HIGH 8000 =
SOURCE-REG w@ 0= AND 0= ILLEGAL-OPS? 1 endif ;
-*-
>
?V
!000000CE
hex
: ?V ( -> 0=SHIFT COUNT 1/1=SHIFT COUNT CX )
STATUS-HIGH 8000 = SOURCE-REG w@ 1 = AND
IF 1
ELSE STATUS-HIGH 2000 = SOURCE-VALUE w@ 1 = AND
0= ILLEGAL-OPS? 0 endif ;
-*-
>
?MF
!000000F1
( ?MF ?DF )
HEX
: ?MF ( -> TYPE-OF-OPERANDS )
LENGTH-WORD w@ DUP 10 =
IF DROP 0
ELSE DUP 4 = IF DROP 1
ELSE DUP 20 = IF DROP 2
ELSE 2 = IF 3
ELSE ILLEGAL-OPS endif endif endif endif ;
-*-
>
?DF
!0000007A
: ?DF ( -> 0=DEST ST/1=DEST STi )
STATUS-WORD w@ 808 AND 0= ILLEGAL-OPS?
STATUS-WORD w@ 8 AND NOT ;
-*-
>
#
!00000058
( # GET-STACK-PARAMS )
( -> )
HEX : # STATUS-WORD w@ 400 OR STATUS-WORD w! ;
-*-
>
GET-STACK-PARAMS
!00000121
hex
: GET-STACK-PARAMS ( N? -> )
PARAMS?
IF SOURCE-VALUE w!
STATUS-WORD w@ 400 AND 0=
IF 2000 STATUS-WORD w@ OR STATUS-WORD w! endif endif
PARAMS?
IF AUX-VALUE w!
STATUS-WORD w@ 200 OR STATUS-WORD w! endif
PARAMS? ILLEGAL-OPS? ;
-*-
>
RESET
!000000E6
( RESET CHECK-LENGTH )
HEX
: RESET ( -> ) ( RESET ASSEMBLER AFTER EVERY WORD )
0 LENGTH-WORD w! 0 STATUS-WORD w!
0 SOURCE-VALUE w! 0 DEST-VALUE w!
0 SOURCE-REG w! 0 DEST-REG w! DEPTH OLD-DEPTH w! ;
-*-
>
LENGTH-DATA
!0000007F
CREATE LENGTH-DATA hex
1 w, 2 w, 4 w, 8 w, 10 w, 20 w, 40 w, 80 w,
100 w, 200 w, 400 w, 800 w, 2000 w, 5000 w,
-*-
>
CHECK-LENGTH
!000000B2
hex
: CHECK-LENGTH ( -> )
0
1C 0 DO I LENGTH-DATA + w@
LENGTH-WORD w@ AND 0= NOT negate + 2 +LOOP
1 = NOT ABORT" MISMATCHED OPERAND LENGTHS" ;
-*-
>
SREG
!000000D8
( SREG )
HEX
: SREG ( -> )
CREATE C, ( REG# ) w, ( STATUS ) w, ( LENGTH )
DOES> STATUS-WORD w@ 0DF00 AND ILLEGAL-OPS?
DUP C@ SOURCE-REG w!
DUP 3 + w@ SWAP 1+ w@ UPDATE-FLAGS ;
-*-
>
MODIFIER
!00000067
( MODIFIER )
HEX
: MODIFIER ( -> )
CREATE w, ( LENGTH )
DOES> w@ 0 UPDATE-FLAGS ;
-*-
>
INCR1
!00000035
: INCR1 ( NA NB -> NA+1 NB )
SWAP 1+ SWAP ;
-*-
>
INCR2
!00000035
: INCR2 ( NA NB -> NA+2 NB )
SWAP 2+ SWAP ;
-*-
>
TYPE1
!0000017D
( TYPE1 )
( ! xxxxxx D W ! MOD REG R/M ! DISP-LO ! DISP-HI ! )
HEX
: TYPE1 ( ADDR PREV-SUCCESS-FLAG -> ADDR+1 SUCCESS-FLAG )
?DUP 0= IF ( NO PREVIOUS SUCCESS )
STATUS-WORD w@ 01F1F AND IF 0
ELSE CHECK-LENGTH
DUP C@ ?W OR ?D 1 shl OR XXC,
?MOD-R/M2 ?REG 3 shl OR XXC,
?OFFSET,
1 endif endif
INCR1 ;
-*-
>
TYPE2
!000001A2
( TYPE2 )
( ! xxxxxx Q x ! MOD x SR R/M ! DISP-LO ! DISP-HI )
HEX
: TYPE2 ( ADDR PREV-SUCCESS-FLAG -> ADDR+2 SUCCESS-FLAG )
?DUP 0= IF ( NO PREVIOUS SUCCESS )
STATUS-WORD w@ DUP 1010 AND NOT
SWAP 0F0F AND OR IF 0
ELSE CHECK-LENGTH
DUP C@ ?D 1 shl OR XXC,
DUP 1+ C@ ?MOD-R/M2 ?REG 8 * OR OR XXC,
?OFFSET,
1 endif endif
INCR2 ;
-*-
>
TYPE3
!000001FF
( TYPE3 )
( ! xxxxxx S W ! MOD xxx R/M ! DISP-LO ! DISP-HI !
DATALO ! DATAHI if w=1 ! ) HEX
: TYPE3 ( ADDR PREV-SUCCESS-FLAG -> ADDR+2 SUCCESS-FLAG )
( NOTE: S BIT=1 NOT SUPPORTED; S FORCED TO 0 )
?DUP 0= IF ( NO PREVIOUS SUCCESS )
STATUS-WORD w@ DUP 400 AND NOT
SWAP 01F AND OR IF 0
ELSE CHECK-LENGTH
DUP C@ ?W OR XXC,
DUP 1+ C@ ?MOD-R/M2 OR XXC,
?OFFSET,
SOURCE-VALUE w@ DATA,
1 endif endif
INCR2 ;
-*-
>
TYPE4
!00000169
( TYPE4 )
( ! xxxxxxx W ! MOD xxx R/M ! DISP-LO ! DISP-HI ! )
HEX
: TYPE4 ( ADDR PREV-SUCCESS-FLAG -> ADDR+2 SUCCESS-FLAG )
?DUP 0= IF ( NO PREVIOUS SUCCESS )
STATUS-WORD w@ 01FFF AND
IF 0
ELSE CHECK-LENGTH
DUP C@ ?W OR XXC,
DUP 1+ C@ ?MOD-R/M1 OR XXC,
?OFFSET,
1 endif endif
INCR2 ;
-*-
>
TYPE5
!000001E8
( TYPE5 )
( ! xxxxxx V W ! MOD xxx R/M ! DISP-LO ! DISP-HI ! )
HEX
: TYPE5 ( ADDR PREV-SUCCESS-FLAG -> ADDR+2 SUCCESS-FLAG )
?DUP 0= IF ( NO PREVIOUS SUCCESS )
STATUS-WORD w@ DUP A000 AND NOT SWAP
01F AND OR IF 0
ELSE LENGTH-WORD w@ 3 = IF 2 LENGTH-WORD w! endif
DUP C@ ?V 1 shl OR ?W OR XXC,
DUP 1+ C@ ?MOD-R/M2-REG OR XXC,
( OFFSET ) STATUS-LOW 20 AND IF DEST-VALUE w@ XX, endif
1 endif endif
INCR2 ;
-*-
>
TYPE6
!00000162
( TYPE6 )
( ! xxxx W REG ! DATALO ! DATAHI if w=1 ! )
HEX
: TYPE6 ( ADDR PREV-SUCCESS-FLAG -> ADDR+1 SUCCESS-FLAG )
?DUP 0= IF ( NO PREVIOUS SUCCESS )
STATUS-WORD w@ 0480 = NOT
IF 0
ELSE CHECK-LENGTH
DUP C@ ?W 8 * OR DEST-REG w@ OR XXC,
SOURCE-VALUE w@ DATA,
1 endif endif
INCR1 ;
-*-
>
TYPE7
!00000190
( TYPE7 )
( ! xxxxxx Q W ! ADDR-LO ! ADDR-HI ! )
HEX
: TYPE7 ( ADDR PREV-SUCCESS-FLAG -> ADDR+1 SUCCESS-FLAG )
?DUP 0= IF ( NO PREVIOUS SUCCESS )
STATUS-WORD w@ DUP 8020 = SWAP
2080 = OR NOT IF 0
ELSE CHECK-LENGTH
DUP C@ ?Q 1 shl OR ?W OR XXC,
?Q IF DEST-VALUE w@ ELSE SOURCE-VALUE w@ endif XX,
1 endif endif
INCR1 ;
-*-
>
TYPE8
!0000019F
( TYPE8 )
( ! xxxxxxx W ! DATA-LO ! DATA-HI ! )
HEX
: TYPE8 ( ADDR PREV-SUCCESS-FLAG -> ADDR+1 SUCCESS-FLAG )
?DUP 0= IF ( NO PREVIOUS SUCCESS )
STATUS-WORD w@ 0480 = NOT
DEST-REG w@ OR SOURCE-REG w@ OR
IF 0
ELSE CHECK-LENGTH
( ENSURE DEST IS ACCUM ) ?Q DROP
DUP C@ ?W OR XXC,
SOURCE-VALUE w@ DATA,
1 endif endif
INCR1 ;
-*-
>
TYPE9
!0000012B
( TYPE9 )
( ! xxxxxxxx ! DATA-LO ! DATA-HI ! )
HEX
: TYPE9 ( ADDR PREV-SUCCESS-FLAG -> ADDR+1 SUCCESS-FLAG )
?DUP 0= IF ( NO PREVIOUS SUCCESS )
STATUS-WORD w@ 2000 = NOT
IF 0
ELSE
DUP C@ XXC,
SOURCE-VALUE w@ XX,
1 endif endif
INCR1 ;
-*-
>
TYPE10
!0000015F
( TYPE10 )
( ! xxxxxxxx ! xxxxxxxx ! DISP-LO ! DISP-HI ! )
HEX
: TYPE10 ( ADDR PREV-SUCCESS-FLAG -> ADDR+2 SUCCESS-FLAG )
?DUP 0= IF ( NO PREVIOUS SUCCESS )
STATUS-WORD w@ 2000 = NOT
IF 0
ELSE CHECK-LENGTH
DUP C@ XXC,
DUP 1+ C@ XXC,
SOURCE-VALUE w@ XX,
1 endif endif
INCR1 ;
-*-
>
TYPE11
!00000192
( TYPE11 )
( ! xxxxxxx W ! DATA-8 ! )
HEX
: TYPE11 ( ADDR PREV-SUCCESS-FLAG -> ADDR+1 SUCCESS-FLAG )
?DUP 0= IF ( NO PREVIOUS SUCCESS )
STATUS-WORD w@ DUP 8020 = OVER 2080 = OR
SWAP 2000 = OR NOT IF 0
ELSE
DUP C@ ?W OR XXC,
SOURCE-VALUE w@ DEST-VALUE w@ OR
DUP 0FF00 AND ILLEGAL-OPS? XXC,
1 endif endif
INCR1 ;
-*-
>
TYPE12
!0000017A
( TYPE12 )
( ! xxxxx REG ! )
HEX
: TYPE12 ( ADDR PREV-SUCCESS-FLAG -> ADDR+1 SUCCESS-FLAG )
?DUP 0= IF ( NO PREVIOUS SUCCESS )
STATUS-WORD w@ 7F7F AND
LENGTH-WORD w@ 2 = NOT OR
IF 0
ELSE CHECK-LENGTH
( ONLY AX ALLOWED FOR DEST ) DEST-REG w@ ILLEGAL-OPS?
DUP C@ SOURCE-REG w@ OR XXC,
1 endif endif
INCR1 ;
-*-
>
TYPE13
!00000127
( TYPE13 )
( ! xxx SR xxx ! )
HEX
: TYPE13 ( ADDR PREV-SUCCESS-FLAG -> ADDR+1 SUCCESS-FLAG )
?DUP 0= IF ( NO PREVIOUS SUCCESS )
STATUS-WORD w@ 1000 AND NOT
IF 0
ELSE CHECK-LENGTH
DUP C@ SOURCE-REG w@ 8 * OR XXC,
1 endif endif
INCR1 ;
-*-
>
TYPE14
!00000132
( TYPE14 )
( ! xxxxxxxx ! IP-INC-LO ! IP-INC-HI ! )
HEX
: TYPE14 ( ADDR PREV-SUCCESS-FLAG -> ADDR+1 SUCCESS-FLAG )
?DUP 0= IF ( NO PREVIOUS SUCCESS )
STATUS-WORD w@ 2000 = NOT
IF 0
ELSE
DUP C@ XXC,
SOURCE-VALUE w@ DISP16,
1 endif endif
INCR1 ;
-*-
>
TYPE15
!00000178
( TYPE15 )
( ! xxxxxxxx ! OFFSET-LO ! OFFSET-HI ! SEG-LO ! SEG-HI ! )
HEX
: TYPE15 ( ADDR PREV-SUCCESS-FLAG -> ADDR+1 SUCCESS-FLAG )
?DUP 0= IF ( NO PREVIOUS SUCCESS )
STATUS-WORD w@ 2200 = NOT
LENGTH-WORD w@ 4000 = NOT OR
IF 0
ELSE
DUP C@ XXC,
SOURCE-VALUE w@ XX, AUX-VALUE w@ XX,
1 endif endif
INCR1 ;
-*-
>
TYPE16
!00000143
( TYPE16 )
( ! xxxxxxxx ! IP-INC-LO ! )
HEX
: TYPE16 ( ADDR PREV-SUCCESS-FLAG -> ADDR+1 SUCCESS-FLAG )
?DUP 0= IF ( NO PREVIOUS SUCCESS )
STATUS-WORD w@ 2000 = NOT LENGTH-WORD w@ 2000 = NOT OR
IF 0
ELSE
DUP C@ XXC,
SOURCE-VALUE w@ DISP8,
1 endif endif
INCR1 ;
-*-
>
TYPE18
!000000E4
( TYPE18 )
( ! xxxxxxxx ! )
HEX
: TYPE18 ( ADDR PREV-SUCCESS-FLAG -> ADDR+1 SUCCESS-FLAG )
?DUP 0= IF ( NO PREVIOUS SUCCESS )
STATUS-WORD w@ IF 0 ELSE
DUP C@ XXC,
1 endif endif
INCR1 ;
-*-
>
TYPE19
!00000173
( TYPE19 )
( ! xxxxx MF x ! MOD xxx R/M ! DISP-LO ! DISP-HI ! )
HEX
: TYPE19 ( ADDR PREV-SUCCESS-FLAG -> ADDR+2 SUCCESS-FLAG )
?DUP 0= IF ( NO PREVIOUS SUCCESS )
STATUS-WORD w@ 01FFF AND
IF 0
ELSE CHECK-LENGTH
DUP C@ ?MF 1 shl OR XXC,
DUP 1+ C@ ?MOD-R/M1 OR XXC,
?OFFSET,
1 endif endif
INCR2 ;
-*-
>
TYPE21
!00000152
( TYPE21 )
( ! xxxxxxxx ! MOD xxx R/M ! DISP-LO ! DISP-HI ! )
HEX
: TYPE21 ( ADDR PREV-SUCCESS-FLAG -> ADDR+2 SUCCESS-FLAG )
?DUP 0= IF ( NO PREVIOUS SUCCESS )
STATUS-WORD w@ 01FFF AND
IF 0
ELSE
DUP C@ XXC,
DUP 1+ C@ ?MOD-R/M1 OR XXC,
?OFFSET,
1 endif endif
INCR2 ;
-*-
>
TYPE22
!00000132
( TYPE22 )
( ! xxxxxxxx ! xxxxx ST[i] ! )
HEX
: TYPE22 ( ADDR PREV-SUCCESS-FLAG -> ADDR+2 SUCCESS-FLAG )
?DUP 0= IF ( NO PREVIOUS SUCCESS )
STATUS-WORD w@ 0808 AND NOT
IF 0
ELSE
DUP C@ XXC,
DUP 1+ C@ ?FREG OR XXC,
1 endif endif
INCR2 ;
-*-
>
TYPE23
!00000108
( TYPE23 )
( ! xxxxxxxx ! xxxxxxxx ! )
HEX
: TYPE23 ( ADDR PREV-SUCCESS-FLAG -> ADDR+2 SUCCESS-FLAG )
?DUP 0= IF ( NO PREVIOUS SUCCESS )
STATUS-WORD w@ IF 0 ELSE
DUP C@ XXC,
DUP 1+ C@ XXC,
1 endif endif
INCR2 ;
-*-
>
TYPE24
!00000142
( TYPE24 )
( ! xxxxx D xx ! xxxxx ST[i] ! )
HEX
: TYPE24 ( ADDR PREV-SUCCESS-FLAG -> ADDR+2 SUCCESS-FLAG )
?DUP 0= IF ( NO PREVIOUS SUCCESS )
STATUS-WORD w@ 0808 AND NOT
IF 0
ELSE
DUP C@ ?FD 4 * OR XXC,
DUP 1+ C@ ?FREG OR XXC,
1 endif endif
INCR2 ;
-*-
>
TYPE25
!0000010F
( TYPE25 )
( ! xxxxxxx W ! ) ( used by IN/OUT )
HEX
: TYPE25 ( ADDR PREV-SUCCESS-FLAG -> ADDR+1 SUCCESS-FLAG )
?DUP 0= IF ( NO PREVIOUS SUCCESS )
STATUS-WORD w@ 8080 = NOT IF 0 ELSE
DUP C@ ?W OR XXC,
1 endif endif
INCR1 ;
-*-
>
GET-OPS
!00000051
( FACTORED WORDS FOR GROUPS )
: GET-OPS ( N -> )
0 DO C, LOOP ;
-*-
>
OP-FOUND?
!0000004F
: OP-FOUND? ( ADDR FOUND-FLAG -> )
0= ILLEGAL-OPS? DROP RESET ;
-*-
>
GROUP-SETUP
!0000003D
: GROUP-SETUP ( -> 0 )
>R GET-STACK-PARAMS R> 0 ;
-*-
>
GROUPA
!00000099
( GROUPA )
HEX
: GROUPA ( OP7 OP6 OP3 OP2 OP1 -> )
CREATE 7 GET-OPS
DOES> GROUP-SETUP TYPE1 TYPE2 TYPE6 TYPE3 TYPE7
OP-FOUND? ;
-*-
>
GROUPB
!0000008A
( GROUPB )
HEX
: GROUPB ( OP13 OP12 OP4 -> )
CREATE 4 GET-OPS
DOES> GROUP-SETUP TYPE12 TYPE13 TYPE4
OP-FOUND? ;
-*-
>
GROUPC
!000000A4
( GROUPC )
HEX
: GROUPC ( OP12 OP1 -> )
CREATE 2 GET-OPS
DOES> GROUP-SETUP DEST-REG w@ 0= IF TYPE12
ELSE INCR1 endif TYPE1 OP-FOUND? ;
-*-
>
GROUPD
!000000B7
( GROUPD )
HEX
: GROUPD ( OP12 OP11 -> )
CREATE 2 GET-OPS
DOES> GROUP-SETUP LENGTH-WORD w@ 3 =
IF 1 LENGTH-WORD w! endif TYPE11 TYPE25
OP-FOUND? ;
-*-
>
GROUPE
!00000083
( GROUPE )
HEX
: GROUPE ( OP18 -> ) ( CONSTANT OPCODES )
CREATE 1 GET-OPS
DOES> GROUP-SETUP TYPE18
OP-FOUND? ;
-*-
>
GROUPF
!000000A7
( GROUPF )
HEX
: GROUPF ( OP1 -> )
CREATE 1 GET-OPS
DOES> GROUP-SETUP XXHERE >R 1 LENGTH-WORD w! TYPE1
OP-FOUND? R@ XXC@ 0FD AND R> XXC! ;
-*-
>
GROUPG
!00000085
( GROUPG )
HEX
: GROUPG ( OP1 OP3 OP8 -> )
CREATE 4 GET-OPS
DOES> GROUP-SETUP TYPE8 TYPE1 TYPE3
OP-FOUND? ;
-*-
>
GROUPH
!000000C2
( GROUPH )
HEX
: GROUPH ( OP1 OP3 OP8 -> )
CREATE 4 GET-OPS
DOES> XXHERE >R GROUP-SETUP TYPE1
DUP IF R@ XXC@ 0FD AND R@ XXC! endif R> DROP
TYPE8 TYPE3 OP-FOUND? ;
-*-
>
GROUPJ
!00000079
( GROUPJ )
HEX
: GROUPJ ( OP4 OP12 -> )
CREATE 3 GET-OPS
DOES> GROUP-SETUP TYPE12 TYPE4
OP-FOUND? ;
-*-
>
GROUPK
!0000006B
( GROUPK )
HEX
: GROUPK ( OP4 -> )
CREATE 2 GET-OPS
DOES> GROUP-SETUP TYPE4
OP-FOUND? ;
-*-
>
GROUPL
!0000006C
( GROUPL )
HEX
: GROUPL ( OP10 -> )
CREATE 2 GET-OPS
DOES> GROUP-SETUP TYPE23
OP-FOUND? ;
-*-
>
GROUPM
!0000018A
( GROUPM )
HEX
: GROUPM ( OP4 OP15 OP4 OP16 OP14 -> )
CREATE 7 GET-OPS
DOES> LENGTH-WORD w@ F000 AND LENGTH-WORD w! GROUP-SETUP
( INTER-SEGMENT ) LENGTH-WORD w@ 5000 AND 5000 =
IF 4000 LENGTH-WORD w! TYPE4
ELSE INCR2 endif TYPE15
( INTRA-SEGMENT ) LENGTH-WORD w@ 1000 AND
IF TYPE4 ELSE INCR2 endif TYPE16 TYPE14
OP-FOUND? ;
-*-
>
GROUPN
!000000BA
( GROUPN )
HEX
: GROUPN ( OP18 OP8 -> )
CREATE 4 GET-OPS
DOES> GROUP-SETUP LENGTH-WORD w@ 4000 =
IF TYPE9 TYPE18 ELSE INCR2 endif TYPE9 TYPE18
OP-FOUND? ;
-*-
>
GROUPP
!00000073
( GROUPP )
HEX
: GROUPP ( OP16 -> )
CREATE 1 GET-OPS
DOES> SHORT GROUP-SETUP TYPE16
OP-FOUND? ;
-*-
>
GROUPQ
!000000DD
( GROUPQ )
HEX
: GROUPQ ( OP11 OP18 -> )
CREATE 2 GET-OPS
DOES> GROUP-SETUP STATUS-WORD w@ 2000 =
SOURCE-VALUE w@ 3 = AND
IF 0 STATUS-WORD w! TYPE18 ELSE INCR1 endif TYPE11
OP-FOUND? ;
-*-
>
GROUPR
!0000016A
( GROUPR )
HEX
: GROUPR ( OP22 OP19 OP21 OP21 OP21 -> )
CREATE 0A GET-OPS
DOES> 9B XXC, GROUP-SETUP LENGTH-WORD w@ 8 =
IF TYPE21 ELSE INCR2 endif
LENGTH-WORD w@ 40 =
IF TYPE21 ELSE INCR2 endif
LENGTH-WORD w@ 80 =
IF TYPE21 ELSE INCR2 endif
TYPE19 TYPE22
OP-FOUND? ;
-*-
>
GROUPS