-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path+Verif.s
5294 lines (5054 loc) · 107 KB
/
+Verif.s
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
; ______________________________________________________________________________
; ..............................................................................
; ...................................................................2222222....
; ................................................................22222222220...
; ...................................................222........222222.....222..
; ..............................................2202222222222..22000............
; ..................................22000.....20222222222200000200002...........
; .................................2002202...2222200222.220000000200000000022...
; ....................220002......22222200..2200002.......2200000...20000000000.
; ....................22222202....2220000022200000..........200002........200000
; .....200000.........2222200000222200220000000002..........200002........20000.
; .....00222202........2220022000000002200002000002........2000002000020000000..
; ....2222200000.......220002200000002.2000000000000222222000000..2000000002....
; ....220000200002......20000..200002..220000200000000000000002.......22........
; ...2220002.220000 2....220002...22.....200002..0000000000002...................
; ...220000..222000002...20000..........200000......2222........................
; ...000000000000000000..200000..........00002..................................
; ..220000000022020000002.200002.........22.......______________________________
; ..0000002........2000000220022.................|
; .200000............2002........................| GESTION SOURCE
; .200002........................................| CHARGEMENT / TEST / VERIF
; 220002.........................................|______________________________
; ______________________________________________________________________________
Reloc_Step equ 1024
TablA_Step equ 1024
Reloc_End equ $80
Reloc_Var equ $82
Reloc_Long equ $84
Reloc_NewBuffer equ $86
Reloc_Proc1 equ $88
Reloc_Proc2 equ $8A
Reloc_Proc3 equ $8C
Reloc_Proc4 equ $8E
Reloc_Debug equ $90
Reloc_Label equ $92
;_____________________________________________________________________________
;
; Test en mode direct
;_____________________________________________________________________________
;
VerDirect
Ver_Direct
tst.l VarBuf(a5) Buffer general deja reserve?
bne.s .PaVar
move.l #4*1024,d1
bsr ResVarBuf
.PaVar bsr ResDir Espace pour variables directes
tst.l VNmMini(a5) Buffer noms deja reserve?
bne.s .PaNom
move.l PI_VNmMax(a5),d1
bsr ResVNom
.PaNom tst.w Stack_Size(a5) Buffer des boucles deja reserve?
bne.s .PaSt
move.w #10,Stack_Size(a5)
.PaSt move.l Ed_BufT(a5),Prg_Test(a5) Adresse de test
move.l Prg_Test(a5),Prg_Run(a5) Adresse de run
clr.l Edt_Runned(a5) Securites!
clr.l Prg_Runned(a5)
move.w #1,Phase(a5) Parametres de test
move.w #1,DirFlag(a5)
bsr SsTest
bsr Free_VerTables Efface les tables
bsr Ver_Run Table de tokens
rts
;_____________________________________________________________________________
;
; Test du programme
;_____________________________________________________________________________
;
PTest:
movem.l a2-a4/a6/d2-d7,-(sp)
clr.b VerNot1.3(a5) Compatible, au depart...
; Recherche les includes / Met l'adresse du programme à runner...
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
move.l Prg_Source(a5),Prg_Run(a5) Par defaut
bsr Get_Includes
tst.l Prg_FullSource(a5) Faut-il changer?
beq.s .Skip
move.l Prg_FullSource(a5),Prg_Run(a5)
.Skip move.l Prg_Run(a5),Prg_Test(a5) A tester
; RAZ de toutes les variables
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
move.l #8*1024,d1
bsr ResVarBuf
move.l PI_VNmMax(a5),d1
bsr ResVNom
clr.w Phase(a5)
clr.w ErrRet(a5)
clr.w DirFlag(a5)
clr.w VarBufFlg(a5)
move.w #51,Stack_Size(a5)
clr.b Prg_Accessory(a5)
clr.b MathFlags(a5) Plus de double precision
clr.b Ver_SPConst(a5) Plus de flags
clr.b Ver_DPConst(a5)
clr.l VerNInst(a5)
; PHASE 1: exploration du programme principal
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ReVer clr.w VarLong(a5)
move.l DVNmBas(a5),a0
move.l a0,VNmHaut(a5)
clr.w -(a0)
move.l a0,VNmBas(a5)
bsr SsTest
bne.s .ReVer
move.l Ver_TablA(a5),d0
move.l d0,Ver_MainTablA(a5) Stocke la table
beq.s .Skop
addq.l #4,d0 Si table il y a
.Skop clr.l Ver_TablA(a5) Une nouvelle table
move.l VNmBas(a5),DVNmBas(a5) Variables
move.l VNmHaut(a5),DVNmHaut(a5)
move.w VarLong(a5),GloLong(a5)
; Exploration de la TablA a la recherche des procedures
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tst.l d0 Une table?
beq.s .Fini
.PLoop move.l d0,a0
cmp.b #1<<VF_Proc,Vta_Flag(a0) Une procedure?
beq.s .Test
move.l (a0),d0
bne.s .PLoop
bra.s .Fini
; Verification de la procedure
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.Test move.l (a0),-(sp) La suivante
move.l Vta_Prog(a0),Prg_Test(a5) Va explorer la procedure!
addq.w #1,Phase(a5) Une phase de plus
clr.w VarLong(a5)
move.l DVNmBas(a5),a0
move.l a0,VNmHaut(a5)
clr.w -(a0)
move.l a0,VNmBas(a5)
bsr Locale Toutes les variables >>> locales
bsr SsTest
move.l Prg_Test(a5),a0 Longueur variable procedure
move.w VarLong(a5),6(a0)
move.l (sp)+,d0
bne.s .PLoop
.Fini
; Libere l'espace pour les variables globales
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
move.l LabBas(a5),a1
clr.l -(a1)
move.w #-1,-(a1) * Marque la fin des variables
move.l a1,a0
sub.w GloLong(a5),a0
cmp.l HiChaine(a5),a0
bcs VerVNm
move.l a0,VarGlo(a5)
move.l a0,VarLoc(a5)
move.l a0,TabBas(a5)
move.l a1,d0 * Nettoie les variables globales
sub.l a0,d0
beq.s .Clr3
lsr.l #2,d0
bcc.s .Clr1
clr.w (a0)+
.Clr1 subq.w #1,d0
.Clr2 clr.l (a0)+
dbra d0,.Clr2
.Clr3
; Rend toutes les variables GLOBALES
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bsr Globale
; Libere les tables
; ~~~~~~~~~~~~~~~~~
bsr Free_VerTables
; Remet la table de tokenisation
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bsr Ver_Run
; Verification compatibilite sur le nombre de banques
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
clr.b VerCheck1.3(a5) Plus de check 1.3
move.l Cur_Banks(a5),a0
bra.s .Next
.Loop move.l d0,a0
cmp.l #16,8(a0) Numero de la banque
bhi.s .Non
.Next move.l (a0),d0
bne.s .Loop
beq.s .Oui
.Non move.b #1,VerNot1.3(a5) Flag, directement...
.Oui
; Termine!!!
; ~~~~~~~~~~
movem.l (sp)+,a2-a4/a6/d2-d7
rts
; Libere les tables de verification
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Free_VerTables
bsr Free_Reloc
bsr Free_TablA La courante
move.l Ver_MainTablA(a5),Ver_TablA(a5)
clr.l Ver_MainTablA(a5)
bsr Free_TablA La principale
rts
; Met le flag 1.3!
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SetNot1.3
move.b #1,VerNot1.3(a5)
tst.b VerCheck1.3(a5)
bne.s .Stop
rts
.Stop moveq #47,d0
bra VerErr
; Sous programme de verification
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SsTest: clr.l ErrRet(a5)
clr.w Passe(a5)
clr.w Ver_NBoucles(a5)
clr.w Ver_PBoucles(a5)
bsr Ver_Verif
bsr Reserve_Reloc
bsr Reserve_TablA
move.l Prg_Test(a5),a6
move.l a6,a3
tst.w DirFlag(a5)
bne.s VerD
tst.w Phase(a5)
bne.s VerDd
; Debut d'une ligne
; ~~~~~~~~~~~~~~~~~
VerD move.l a6,VDLigne(a5)
tst.w (a6)+
beq VerX
; Definition procedures / Data en debut de ligne
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VerDd: move.l a6,VerPos(a5)
move.w (a6)+,d0
beq.s VerD
bmi VerSynt
move.l AdTokens(a5),a0
move.b 0(a0,d0.w),d1
bpl.s VLoop1
addq.l #1,VerNInst(a5)
ext.w d1
asl.w #2,d1
jmp .Jmp(pc,d1.w)
bra VerSha FA-Global (Nouvelle maniere)
bra VerSha FB-Shared
bra VerDFn FC-Def Fn
bra VerData FD-Debut data
bra V1_EndProc FE-Fin procedure
bra V1_Procedure FF-Debut procedure
.Jmp
; Boucle de test dans une ligne
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VerLoop move.l a6,VerPos(a5) Position du test
move.w (a6)+,d0
beq VerD
bmi VerSynt
move.l AdTokens(a5),a0
move.b 0(a0,d0.w),d1
VLoop1 addq.l #1,VerNInst(a5) Un instruction de plus!
ext.w d1
asl.w #2,d1
jmp .Jmp(pc,d1.w) Branche à la fonction
; Table des sauts pour les instructions particulieres
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bra VerShal FA-Global (Nouvelle maniere)
bra VerShal FB-Shared
bra VerDaL FC-Def Fn
bra VerDaL FD-Debut data
bra VerPDb FE-Fin procedure
bra VerPDb FF-Debut procedure
.Jmp bra Ver_Normal 00-Instruction normale
bra VerSynt 01-Syntax error
bra VerRem 02-Rem
bra VerSBu 03-Set Buffer
bra VerDPre 04-Set Double Precision
bra VerSStack 05-Set Stack
bra VerVar 06-Variable
bra VerLab 07-Un label
bra VerPro 08-Un appel de procedure
bra VerDim 09-DIM
bra VerPr 0A-Print
bra VerDPr 0B-Print #
bra VerInp 0C-Input / Line Input
bra VerDInp 0D-Input #
bra VerInc 0E-Dec
bra V1_Proc 0F-Proc
IFNE Debug=2
bra V1_Debug 10- Debugging
ENDC
IFEQ Debug=2
bra Ver_Normal
ENDC
bra VerPal 11-Default Palette
bra VerPal 12-Palette
bra VerRead 13-Read
bra VerRest 14-Restore
bra VerChan 15-Channel
bra VerInc 16-Inc
bra VerAdd 17-Add
bra VerPo 18-Polyline/Gon
bra VerFld 19-Field
bra VerCall 1A-Call
bra VerMn 1B-Menu
bra VerMnD 1C-Menu Del
bra VerSmn 1D-Set Menu
bra VerMnK 1E-Menu Key
bra VerIMn 1F-Menu diverse
bra VerFade 20-Fade
bra VerSort 21-Sort
bra VerSwap 22-Swap
bra VerFol 23-Follow
bra VerSetA 24-Set Accessory
bra VerTrap 25-Trap
bra VerStruI 26-Struc
bra VerStruIS 27-Struc$
bra Ver_Extension 28-Token d'extension
bra Ver_NormalPro 29-Instruction AMOSPro
bra Ver_DejaTesteePro 2A-Instruction AMOSPro deja testee
bra Ver_VReservee 2B-Variable reservee
bra Ver_VReserveePro 2C-Variable reservee AMOSPro
bra Ver_DejaTestee 2D-Instruction normale deja testee
bra VerD 2E-LIBRE
bra VerD 2F-Fin de ligne
bra V1_For 30-For
bra V1_Next 31-Next
bra V1_Repeat 32-Repeat
bra V1_Until 33-Until
bra V1_While 34-While
bra V1_Wend 35-Wend
bra V1_Do 36-Do
bra V1_Loop 37-Loop
bra V1_Exit 38-Exit
bra V1_ExitI 39-Exit If
bra V1_If 3A-If
bra V1_Else 3B-Else
bra V1_ElseIf 3C-ElseIf
bra V1_EndI 3D-EndIf
bra V1_Goto 3E-Goto
bra V1_Gosub 3F-Gosub
bra V1_OnError 40-OnError
bra V1_OnBreak 41-OnBreak
bra V1_OnMenu 42-OnMenu
bra V1_On 43-On
bra V1_Resume 44-Resume
bra V1_ResLabel 45-ResLabel
bra V1_PopProc 46-PopProc
bra V1_Every 47-Every
bra VerPr 48-LPrint
bra VerInp 49-Line Input
bra VerDInp 4A-Line Input #
bra VerMid 4B-Mid3
bra VerMid 4C-Mid2
bra VerMid 4D-Left
bra VerMid 4E-Right
bra VerAdd 4F-Add
bra Ver_NormalPro 50-Dialogues
bra Ver_Normal 51-Dir
bra VerSynt 52-Then
bra Ver_Normal 53-Return
bra Ver_Normal 54-Pop
bra Ver_NormalPro 55-Procedure langage machine
bra Ver_Normal 56-Bset/Bchg/Ror///
bra VerSynt 57-APCmp Call
IFNE Debug=2
V1_Debug
move.b #Reloc_Debug,d0 Dans relocation
bsr New_Reloc
lea V2_Debug(pc),a0 Dans TablA
move.w #_TkDP,d0
moveq #0,d1
moveq #1<<VF_Debug,d2
bsr Init_TablA
bra VerDP
V2_Debug
jsr BugBug
rts
ENDC
; Une extension
; ~~~~~~~~~~~~~~~~~~~
Ver_Extension
bset #0,VarBufFlg(a5)
move.b (a6)+,d1 Numero de l'extension
ext.w d1
move.l a6,-(sp) Position du nombre de params
tst.b (a6)+
move.w (a6)+,d0 Token de l'extension
lsl.w #2,d1
lea AdTokens(a5),a0
tst.l 0(a0,d1.w) Extension definie?
beq VerExN
move.l 0(a0,d1.w),a0
clr.w -(sp) Flag librairie 2.0 ou ancienne
btst #LBF_20,LB_Flags(a0) Librarie 2.0?
beq.s .Skip
move.w #-1,(sp)
.Skip move.l a0,VerBase(a5) Base de la librairie
bsr Ver_OlDInst Debut de la definition
cmp.b #"I",d0 Une instruction
beq.s .Inst
cmp.b #"V",d0 Une variable reservee?
bne VerSynt
bsr VerVR
bra.s .Poke
.Inst bsr VerI Verification
.Poke tst.w (sp)+ Le flag
move.l (sp)+,a0 Poke le nombre de params...
beq.s .Old
move.b #-1,(a0) Nouvelle extension: pas de params!
bra VerDP
.Old move.b d0,(a0) Ancienne extension: des params...
bra VerDP
; Variable reservee
; ~~~~~~~~~~~~~~~~~~~~~~~
Ver_VReserveePro
bsr SetNot1.3 Si AMOSPro
Ver_VReservee
bset #0,VarBufFlg(a5)
move.l a0,VerBase(a5)
bsr Ver_DInst
bsr VerVR
bra VerDP
; Routine de verification VARIABLE RESERVEE en instruction
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VerVR: move.b (a0)+,d2
move.w d2,-(sp)
bsr VerF
move.w d0,-(sp)
move.l a6,VerPos(a5)
cmp.w #_TkEg,(a6)+
bne VerSynt
bsr Ver_Expression
move.w (sp)+,d0
move.w (sp)+,d1
cmp.b d1,d2
bne VerType
rts
; Instruction deja testee
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ver_DejaTesteePro
bsr SetNot1.3 Si AMOSPro
Ver_DejaTestee
bset #0,VarBufFlg(a5)
bsr Ver_DInst
bsr VerI_DejaTestee
bra VerDP
; Instruction normale
; ~~~~~~~~~~~~~~~~~~~~~~~~~
Ver_NormalPro
bsr SetNot1.3 Si AMOSPro
Ver_Normal
bset #0,VarBufFlg(a5)
move.l a0,VerBase(a5)
bsr Ver_DInst
bsr VerI
; Veut un deux points apres l'instruction
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VerDP: move.l a6,VerPos(a5)
move.w (a6)+,d0
beq VerD
cmp.w #_TkDP,d0
beq VerLoop
cmp.w #_TkElse,d0
bne VerSynt
subq.l #2,a6
bra VerLoop
; PASSE2: simple relecture du programme
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VerX: addq.w #1,Passe(a5)
move.b #Reloc_End,d0
bsr New_Reloc
; Boucle de relocation des variables / labels / appel procedures
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
move.l Ver_Reloc(a5),a4
move.l a4,Ver_CReloc(a5)
addq.l #4,a4
move.l Prg_Test(a5),a6
.RReloc moveq #0,d6
.Reloc add.w d6,a6
move.b (a4)+,d6
lsl.b #1,d6
bcc.s .Reloc
jsr .V2Jmp(pc,d6.w)
bra.s .RReloc
.V2Jmp bra V2_EndRel
bra V2_StoVar
bra V2_Long
bra V2_NTable
bra V2_CallProc1
bra V2_CallProc2
bra V2_CallProc3
bra V2_CallProc4
IFNE Debug=2
bra V2_Debug A
ENDC
IFEQ Debug=2
rts
nop
ENDC
; Find label
; ~~~~~~~~~~
move.l a6,VerPos(a5) C
subq.l #2,VerPos(a5)
bsr V2_FindLabel
beq VerUnd
rts
; Nouvelle table de relocation
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
V2_NTable
move.l Ver_CReloc(a5),a4
move.l (a4),a4
move.l a4,Ver_CReloc(a5)
addq.l #4,a4
rts
; Saut long dans relocation
; ~~~~~~~~~~~~~~~~~~~~~~~~~
V2_Long moveq #0,d6
move.b (a4)+,d6
lsl.w #8,d6
move.b (a4)+,d6
add.l d6,a6
rts
; Fin de la relocation
; ~~~~~~~~~~~~~~~~~~~~
V2_EndRel
addq.l #4,sp
; Boucle d'appel des traitement de boucle
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
move.l Ver_TablA(a5),d0
beq.s .TablX
addq.l #4,d0
.TablA move.l d0,a4
move.l Vta_Jump(a4),d0
beq.s .TablB
move.l d0,a1
move.l Vta_Prog(a4),a6
move.l a6,VerPos(a5)
subq.l #2,VerPos(a5)
move.l a4,a0
jsr (a1)
.TablB move.l (a4),d0
bne.s .TablA
.TablX
; Efface la relocation
; ~~~~~~~~~~~~~~~~~~~~~~~~~~
bsr Free_Reloc
; Fin des deux passes, erreur retardee?
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
move.l ErrRet(a5),d0
beq.s .Skip
move.l ErrRAd(a5),VerPos(a5)
bra VerErr
.Skip moveq #0,d0 Ne pas reboucler...
rts
******* MESSAGES D'ERREUR VERIFICATION
* Loops crossing / ERREUR RETARDEE
VerCrs: move.l a0,-(sp)
moveq #1,d0 Bad Structure
bsr ERetard
move.l (sp)+,a0
rts
ERetard:tst.l ErrRet(a5)
bne.s ERet1
move.l d0,ErrRet(a5)
move.l VerPos(a5),ErrRAd(a5)
ERet1: rts
* User function
VerNFn moveq #2,d0
bra VerEr
* Impossible to change buffer
VerNoB moveq #3,d0
bra VerEr
* Datas en debut de ligne
VerDaL: moveq #4,d0
bra VerEr
* Extension not present
VerExN: moveq #5,d0
bra VerEr
* Too many direct variables
VerVTo: moveq #6,d0
bra VerEr
* Illegal direct mode
VerIlD: moveq #7,d0
bra.s VerEr
* Buffer variable too small
VerVNm: moveq #8,d0
bra.s VerEr
* Goto dans une boucle
VerPaGo:moveq #9,d0
bra.s VerEr
* Structure too long
VerLong:moveq #10,d0
bra.s VerEr
* Shared
VerShp: moveq #11,d0
bra.s VerEr
VerAlG: moveq #12,d0
bra.s VerEr
VerPaG: moveq #13,d0
bra.s VerEr
VerNoPa:moveq #14,d0
bra.s VerEr
VerShal:moveq #15,d0
bra.s VerEr
* Procedures
VerPDb: moveq #16,d0
bra.s VerEr
VerPOp: moveq #17,d0
bra.s VerEr
VerPNo: moveq #18,d0
bra.s VerEr
VerPRTy:moveq #18,d0
bra.s VerEr
VerIlP: moveq #19,d0
bra.s VerEr
VerUndP:moveq #20,d0
bra.s VerEr
* Else without If
VerElI: moveq #21,d0
VerEr: bra VerErr
VerIfE: moveq #22,d0
bra VerErr
VerEIf: moveq #23,d0
bra VerErr
VerElE: moveq #24,d0
bra VerErr
VerNoT: moveq #25,d0
bra VerErr
* Not enough loop
VerNoL: moveq #26,d0
bra VerErr
* Do/Loop
VerDoL: moveq #27,d0
bra VerErr
VerLDo: moveq #28,d0
bra.s VerErr
* While/Wend
VerWWn: moveq #29,d0
bra.s VerErr
VerWnW: moveq #30,d0
bra.s VerErr
* Repeat/until
VerRUn: moveq #31,d0
bra.s VerErr
VerUnR: moveq #32,d0
bra.s VerErr
* For/Next
VerFoN: moveq #33,d0
bra.s VerErr
VerNFo: moveq #34,d0
bra.s VerErr
* Syntax
VerSynt:moveq #35,d0
bra.s VerErr
* Out of mem
VerOut: moveq #36,d0
bra.s VerErr
* Out of variable name space
VerNmO: moveq #37,d0
bra.s VerErr
* Non dimensionned
VerNDim moveq #38,d0
bra.s VerErr
* Already dimensionned
VerAlD: moveq #39,d0
bra.s VerErr
* Type mismatch
VerType moveq #40,d0
bra.s VerErr
* Label not defined
VerUnd: moveq #41,d0
bra.s VerErr
* Label defined twice
VerLb2: moveq #42,d0
; Traitement message d'erreur
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~
VerErr move.l d0,-(sp)
; Remet les tokens
; ~~~~~~~~~~~~~~~~
bsr Ver_Run
; Efface les buffers d'inclusion
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
move.l VerPos(a5),a0
bsr Includes_Adr
move.l a0,VerPos(a5)
bsr Includes_Clear
; Efface les equates
; ~~~~~~~~~~~~~~~~~~
jsr D_Close
; Efface les tables
; ~~~~~~~~~~~~~~~~~
bsr Free_VerTables
; Plus de check1.3
; ~~~~~~~~~~~~~~~~
clr.b VerCheck1.3(a5)
; Depile le programme
; ~~~~~~~~~~~~~~~~~~~
move.l Prg_JError(a5),a2
bsr Prg_Pull
; Branche à l'appelant
; ~~~~~~~~~~~~~~~~~~~~
move.l (sp)+,d0
neg.l d0 Message negatif= TEST
sub.l a0,a0 Trouver le message
jmp (a2) On branche
; REM
; ~~~~~~~~~
VerRem tst.w Direct(a5)
bne VerIlD
add.w (a6)+,a6
addq.l #2,a6
bra VerD
; Token appel procedure, change en variable
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VerPro tst.w Direct(a5)
bne VerIlD
; Variable en instruction
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VerVar bset #0,VarBufFlg(a5)
bsr V1_IVariable
bra VerDP
; Définition d'un label
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~
VerLab: tst.w Direct(a5)
bne VerIlD
bset #0,VarBufFlg(a5)
bsr V1_StockLabel
cmp.w #_TkData,(a6)
bne VerLoop
addq.l #2,a6
bra VerData
; SET DOUBLE PRECISION
; ~~~~~~~~~~~~~~~~~~~~~~~~~~
VerDPre bsr SetNot1.3
btst #0,VarBufFlg(a5)
bne.s VVErr
bset #1,VarBufFlg(a5)
bne.s VVErr
move.b #%10000011,MathFlags(a5)
bra VerDP
VVErr moveq #50,d0
bra VerErr
; SET STACK n
; ~~~~~~~~~~~~~~~~~
VerSStack
tst.w Direct(a5)
bne VerIlD
btst #0,VarBufFlg(a5)
bne.s VVErr
bset #3,VarBufFlg(a5)
bne.s VVErr
cmp.w #_TkEnt,(a6)+
bne VerSynt
move.l (a6)+,d1
cmp.w #10,d1
bcc.s .Ok
moveq #10,d1
.Ok addq.w #1,d1
move.w d1,Stack_Size(a5)
bra VerDP
; SET BUFFER n
; ~~~~~~~~~~~~~~~~~~
VerSBu tst.w Direct(a5)
bne VerIlD
btst #0,VarBufFlg(a5)
bne VerNoB
cmp.w #_TkEnt,(a6)+
bne VerSynt
move.l (a6)+,d1
mulu #1024,d1
cmp.l VarBufL(a5),d1
beq VerDP
; Change la taille / recommence
bset #2,VarBufFlg(a5)
bne VerNoB
bsr ResVarBuf
moveq #-1,d0
rts
; SET ACCESSORY
; ~~~~~~~~~~~~~~~~~~~
VerSetA bsr SetNot1.3
addq.b #1,Prg_Accessory(a5)
bra VerDP
; DIM
; ~~~~~~~~~
VerDim: bset #0,VarBufFlg(a5)
cmp.w #_TkVar,(a6)+ Veut une variable
bne VerSynt
and.b #%00001111,3(a6) RAZ du flag!
bsr VarA0
cmp.w #_TkPar1,(a0) TABLEAU?
bne VerSynt
bset #6,3(a6) Met le flag tableau!
move.b 3(a6),d3
bsr V1_StoVar
beq VerAlD
bsr VerTablo Verifie les params d'un tableau
move.b d0,4(a1) Stocke le nb de dimensions
cmp.w #_TkVir,(a6)+ Une autre variable?
beq VerDim
subq.l #2,a6
bra VerDP
; SORT
; ~~~~~~~~~~
VerSort bset #0,VarBufFlg(a5)
move.l a6,-(sp)
bsr VerGV
move.l (sp)+,a0
btst #6,5(a0)
bne VerDP
bra VerSynt
; SWAP
; ~~~~~~~~~~
VerSwap bset #0,VarBufFlg(a5)
bsr VerGV
move.w d2,-(sp)
cmp.w #_TkVir,(a6)+
bne VerSynt
bsr VerGV
cmp.w (sp)+,d2
beq VerDP
bne VerType
; DEF FN
; ~~~~~~~~~~~~
VerDFn bset #0,VarBufFlg(a5)
cmp.w #_TkVar,(a6)+
bne VerSynt
and.b #%00001111,3(a6) Change le flag
bset #3,3(a6)
bsr VarA0 Adresse
move.w d2,-(sp)
bsr V1_StoVar Stocke la variable
bsr VDfnR Recupere les parametres
cmp.w #_TkEg,(a6)+
bne VerSynt
bsr Ver_Expression Evalue l'expression
move.w (sp)+,d0 Verifie le type
cmp.b d0,d2
bne VerType
tst.w (a6) Seul sur la ligne
bne VerDaL
bra VerDP
; Routinette---> Prend les variables!
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VDfnR cmp.w #_TkPar1,(a6)
bne.s .Exit
addq.l #2,a6
.Loop bsr VerGV
cmp.w #_TkVir,(a6)+
beq.s .Loop
cmp.w #_TkPar2,-2(a6)
bne VerSynt
.Exit rts
; Verification PRINT/LPRINT
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VerDPr bsr Ver_ExpE
cmp.w #_TkVir,(a6)+
bne VerSynt
VerPr: bset #0,VarBufFlg(a5)
move.w (a6),d0
cmp.w #_TkDieze,d0
bne.s VerPr1
addq.l #2,a6
bsr Ver_Expression
cmp.b #"2",d2
beq VerType
cmp.w #_TkVir,(a6)
bne VerDP
addq.l #2,a6
VerPr1: bsr Finie
beq VerDP
move.l a6,VerPos(a5)
cmp.w #_TkUsing,(a6)
bne.s VerPr2
addq.l #2,a6
bsr Ver_ExpA
cmp.w #_TkPVir,(a6)+
bne VerSynt
VerPr2 bsr Ver_Expression
move.w (a6)+,d0
cmp.w #_TkVir,d0
beq.s VerPr1
cmp.w #_TkPVir,d0
beq.s VerPr1
subq.l #2,a6
bra VerDP
; Verification INPUT / LINE INPUT
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VerDInp bsr Ver_ExpE
cmp.w #_TkVir,(a6)+
bne VerSynt
bra.s VerIn1
VerInp: bset #0,VarBufFlg(a5)
cmp.w #_TkVar,(a6)
beq.s VerIn1
bsr Ver_Expression
cmp.b #"2",d2
bne VerType
cmp.w #_TkPVir,(a6)+
bne VerSynt
VerIn1: bsr VerGV
cmp.w #_TkVir,(a6)+
beq.s VerIn1
cmp.w #_TkPVir,-2(a6)
beq VerDP
subq.l #2,a6
bra VerDP
; Verification PALETTE / DEFAULT PALETTE
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VerFa1: addq.l #2,a6
VerPal: clr.w d0
VPal: bset #0,VarBufFlg(a5)
addq.w #1,d0
move.w d0,-(sp)
bsr Ver_ExpE
move.w (sp)+,d0
cmp.w #_TkVir,(a6)
bne VerDP
addq.l #2,a6
cmp.w #32,d0
bcs.s VPal
bra VerDP
; Verification FADE
; ~~~~~~~~~~~~~~~~~~~~~~~
VerFade bset #0,VarBufFlg(a5)
bsr Ver_ExpE
cmp.w #_TkVir,d0
beq.s VerFa1
cmp.w #_TkTo,d0
bne VerDP
addq.l #2,a6
bsr Ver_ExpE
cmp.w #_TkVir,(a6)
bne VerDP
addq.l #2,a6
bsr Ver_ExpE
bra VerDP
; Verification instructions MENU
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; Instruction MENU$(,,)=
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VerMn bsr VerTablo
cmp.w #MnNDim,d0
bcc VerSynt
cmp.w #_TkEg,(a6)+
bne VerSynt