-
Notifications
You must be signed in to change notification settings - Fork 0
/
DisAsm.asm
1377 lines (1275 loc) · 28.3 KB
/
DisAsm.asm
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
.model small
JUMPS
.stack 100h
.data
include data.asm
.code
start:
mov ax, @data
mov ds, ax
mov si, 82h
;INPUT AND OUTPUT NAMES------------------------------------------
call QQSkip_Spaces
lea di, Input_Name ;i 'di' isikeliu pointeri nukreipta i failo pavadinimo bufferi
call QQReading_Name
inc si ;pasdidinu, kad praleisciau rasta tarpa
push si ;pasididines 'si', ji isidedu i steka
call QQSkip_Spaces
lea di, Output_Name ;i 'di' isikeliu pointeri nukreipta i failo pavadinimo bufferi
call QQReading_Name
;---------------------------------------------------------------
mov dx, offset Input_Name ;Atidarau intput'a
mov al, 0
mov ah, 3Dh
int 21h
mov Input_Handle, ax
mov ah, 3Ch ;Output'o sukurimas
mov cx, 0
mov dx, offset Output_Name
int 21h
mov dx, offset Output_Name ;Atidarau output'a
mov al, 1
mov ah, 3Dh
int 21h
mov Output_Handle, ax
jmp QQEncoding
;PRADZIOS FUNKCIJOS--------------------------------------------------------------
QQSkip_Spaces PROC near ;praleidzia useless space'us
QQSkip_Spaces_Loop:
cmp byte ptr es:[si], ' '
jne QQEND_Skip_Spaces
inc si
jmp QQSkip_Spaces_Loop
QQEND_Skip_Spaces:
ret
QQSkip_Spaces ENDP
QQReading_Name proc near
mov ax, word ptr es:[si] ;ziuriu ar nereikia pagalbos pranesimo, aka / ir ? ieskojimas
cmp ax, 3F2Fh
je QQHelp
mov al, es:[si] ;pradedu tikrininti SIMBOLI, nes reik zinot, ar tarpas, ar ne
cmp al, " " ;jeigu tarpas, tai reiskia bus daugiau failu nei vienas
je QQIs_END
cmp al, 13d ;enteris - paskutinis nuskaitytas simbolis
je QQIs_END
mov [di], al ;jei nei tarpas, nei enteris, i 'file' pradedu irasyti pavadinima
inc di
inc si
jmp QQReading_Name
QQIs_END:
ret
QQReading_Name endp
QQHelp: ;isvedu klaida
mov ah, 09h
mov dx, offset Is_Error
int 21h
jmp QQEND_Program
QQUnknown_I PROC near
mov ah, 40h
mov bx, Output_Handle
mov cx, 14h
mov dx, offset Output_Unknown
int 21h
mov ah, 40h
mov bx, Output_Handle
mov cx, 2
mov dx, offset Output_Enter
int 21h
ret
QQUnknown_I ENDP
QQWrite_Unknown:
call QQUnknown_I
QQEncoding:
call QQWrite_IP
QQNo_IP:
;===========================================================================
mov ah, 3Fh
mov bx, Input_Handle ;isirasau masininio kodo baita
mov cx, 1
mov dx, offset One_Byte ; ar turi nuo trecio bito prasideti nes cia buferis
int 21h
cmp Ax, 0h ;ziuriu kada pasiekiamas programos galas
je QQEND_Program
mov ax, 0 ; nusinulinu ax
mov O_i, 0
mov al, One_Byte
mov MC_W, ax ;i zodi isikeliu masinini koda
inc IP_a ;didinu IP
;------------------
mov bl, One_Byte
mov Disp_Buff[0], bl
mov IIII, 1
call QQ_Convert_IP
;------------------
QQWere_Unknown:
mov si, MC_W
cmp byte ptr Formats[si], 01h ;01 FORMATAS
jne QQ_02
jmp QQWrite_Unknown
QQ_02:
cmp byte ptr Formats[si], 02h ;02 FORMATAS zinoma istrukcija
jne QQ_07
jmp QQNext
QQ_07:
cmp byte ptr Formats[si], 07h ;07 FORMATAS
jne QQ_08
call QQFormat_07
jmp QQNext
QQ_08:
cmp byte ptr Formats[si], 08h ;08 FORMATAS
jne QQContinue
call QQFormat_08
jmp QQNext
;=========================================================
QQContinue:
mov si, 0
mov cx, 8
mov ax, MC_W
QQMC_Converting: ;komvertuoju masinini koda i dvejataine sistema
shl al, 1 ;nzn i kuria puse
mov byte ptr MC_Binary[si], 0
adc byte ptr MC_Binary[si], 0
inc si
loop QQMC_Converting
mov si, MC_W
;==================================================
cmp byte ptr Formats[si], 03h ;03 FORMATAS
jne QQ_04
call QQFormat_03
cmp MC_Binary[2], 1
je QQNo_IP ;bus prefixas todel soks i pradzia
mov bx, P_i
mov W, 1
call QQOutput_02 ;REGISTRAS
jmp QQNext
QQ_04:
cmp byte ptr Formats[si], 04h ;04 FORMATAS
ja QQ_05_06
mov al, byte ptr MC_Binary[7] ; priskiriu w indikatoriui reiksme
mov W, al
call QQFormat_04
jmp QQNext
QQ_05_06:
cmp byte ptr Formats[si], 06h ;05 ir 06 FORMATAS
ja QQXX_ALL_Skiped
call QQFormat_05_06
jmp QQNext
QQXX_ALL_Skiped:
cmp O_i, 0 ;soksiu jei buvo nustatyta komanda
jne QQNext
;======================================================================================
mov al, byte ptr MC_Binary[7] ; priskiriu w indikatoriui reiksme
mov W, al
mov al, byte ptr MC_Binary[6] ; priskiriu D S ir V indikatoriui reiksme
mov DsV, al
mov si, MC_W
cmp byte ptr Formats[si], 0Ch ;ieskau kuriai grupei priklauso
jb QQFirst_Class ;maziau uz 12
cmp byte ptr Formats[si], 10h ;maziau uz 16
jb QQSecond_Class
jmp QQThird_Class
;=======================================================================
QQFirst_Class:
mov si, MC_W
cmp byte ptr Formats[si], 9h ;09 FROMATAS
ja QQ_10
call QQFormat_09
jmp QQNext
QQ_10:
cmp byte ptr Formats[si], 0Ah ;10 FROMATAS
ja QQ_11
call QQFormat_10
jmp QQNext
QQ_11:
cmp byte ptr Formats[si], 0Bh ;11 FROMATAS
jne QQNext
call QQFormat_11
jmp QQNext ;poto tvarkyti reiks
;==============================================================================
QQSecond_Class:
mov si, MC_W
cmp byte ptr Formats[si], 0Dh ;13 FROMATAS
jne QQ_Others
mov ax, 1
mov Disp, ax
call QQReading_Displacement
jmp QQNext ;*
QQ_Others:
mov ax, 2
mov Disp, ax
call QQReading_Displacement
call QQHEX_Conversion
mov si, MC_W
cmp byte ptr Formats[si], 0Ch ;12 FROMATAS
jne QQ_14
call QQOutput_04 ;BETARPIS call QQFormat_12
jmp QQNext
QQ_14:
cmp byte ptr Formats[si], 0Eh ;14 FROMATAS
jne QQ_15
call QQFormat_14
jmp QQNext
QQ_15:
cmp byte ptr Formats[si], 0Fh ;15 FROMATAS
jne QQNext
call QQFormat_15
jmp QQNext ;poto tvarkyti reiks
;==============================================================================
QQThird_Class:
mov ah, 3Fh
mov bx, Input_Handle ;isirasau adresavimo baita
mov cx, 1
mov dx, offset One_Byte
int 21h
inc IP_a ;didinu IP
;------------------
mov bl, One_Byte
mov Disp_Buff[0], bl
mov IIII, 1
call QQ_Convert_IP
;------------------
mov cl, One_Byte
mov Potencial_MC, cl
call QQReading_Value
call QQDetermine_Property_i
mov ax, PR_i
mov RM_i, ax
call QQReading_Value
call QQDetermine_Property_i
mov ax, PR_i
mov R_i, ax
call QQReading_Value
call QQDetermine_Property_i
mov ax, PR_i
mov M_i, ax
mov si, MC_W
cmp byte ptr Formats[si], 10h ;16 FROMATAS
jne QQ_17
jmp QQWrite_Unknown
; call QQFormat_16 ;Coprocesorius nereikia
QQ_17:
cmp byte ptr Formats[si], 11h ;17 FROMATAS
jne QQ_18
call QQFormat_17
jmp QQNext
QQ_18:
cmp byte ptr Formats[si], 12h ;18 FROMATAS
jne QQ_19
call QQFormat_18
jmp QQNext
QQ_19:
cmp byte ptr Formats[si], 13h ;19 FROMATAS
jne QQ_20
call QQFormat_19
jmp QQNext
QQ_20:
cmp byte ptr Formats[si], 14h ;20 FROMATAS
jne QQ_21
;cmp M_i, 3
;je QQSomething_Wrong ; turi buti rm atmintis
call QQFormat_20
jmp QQNext
QQ_21:
cmp byte ptr Formats[si], 15h ;21 FROMATAS
jne QQ_22
cmp MC_W, 0ffh
jne QQ21_As_Normal
cmp R_i, 2
jb QQ21_To_22
cmp R_i, 6
je QQ21_To_22
;cmp R_i, 7
;je QQSomething_Wrong ; nera su reg 111
call QQFormat_21 ;SPECIAL
jmp QQNext
QQ21_As_Normal:
;cmp R_i, 0
;jne QQSomething_Wrong ; yra tik su reg 000
call QQFormat_21 ;SPECIAL
jmp QQNext
QQ21_To_22:
call QQFormat_22
jmp QQNext
QQ_22:
cmp byte ptr Formats[si], 16h ;22 FROMATAS
jne QQ_23
cmp MC_W, 0f6h
je QQ22_For_Convenience
cmp MC_W, 0f7h
je QQ22_For_Convenience
cmp R_i, 0
je QQ22_As_Normal ; yra tik su reg 001 ir 000
;cmp R_i, 1
;je QQ22_As_Normal
; jmp QQSomething_Wrong
QQ22_As_Normal:
call QQFormat_22 ;SPECIAL ; tas pats kaip 17
jmp QQNext
QQ22_For_Convenience:
;cmp R_i, 1
;je QQSomething_Wrong ;nera su reg 001
cmp R_i, 0
jne QQ22_As_Normal
call QQFormat_25
jmp QQNext
QQ_23:
cmp byte ptr Formats[si], 17h ;23 FROMATAS
jne QQ_24
;cmp R_i, 6
;je QQSomething_Wrong ; nera tik su reg 110
call QQFormat_23
jmp QQNext
QQ_24:
cmp byte ptr Formats[si], 18h ;24 FROMATAS
jne QQ_25
call QQFormat_24
jmp QQNext
QQ_25:
cmp byte ptr Formats[si], 19h ;25 FROMATAS
jne QQNext
;cmp R_i, 0
;je QQSomething_Wrong ; yra tik su reg 000
call QQFormat_25
jmp QQNext
QQSomething_Wrong:
call QQUnknown_I
mov ax, 0
mov al, Potencial_MC
mov MC_W, ax
jmp QQWere_Unknown
;==============================================================================
QQNext:
cmp MC_W, 00F3h
je QQTwo_Instructions
cmp MC_W, 00F2h
je QQTwo_Instructions
QQFrom_Two_Instructions:
mov ah, 40h
mov bx, Output_Handle
mov cx, IP_i
mov dx, offset IP_Buff
int 21h
mov ax, 18
sub ax, IP_i
mov IP_i, ax
mov ah, 40h
mov bx, Output_Handle
mov cx, IP_i
mov dx, offset Space_Buff
int 21h
call QQDetermine_Instruction
cmp MC_W, 00F3h
je QQTwo_Instructions2
cmp MC_W, 00F2h
je QQTwo_Instructions2
QQFrom_Two_Instructions2:
cmp O_i, 0
je QQOutput_Skiped
mov ah, 40h
mov bx, Output_Handle
mov cx, O_i
mov dx, offset Output_Line
int 21h
mov P_i, 0
QQOutput_Skiped:
mov ah, 40h
mov bx, Output_Handle
mov cx, 2
mov dx, offset Output_Enter
int 21h
jmp QQEncoding
QQEND_Program:
mov ah, 3Eh
mov bx, Input_Handle
int 21h
mov ah, 3Eh
mov bx, Output_Handle
int 21h
mov ah, 4Ch
int 21h
QQTwo_Instructions:
add IP_a, 1
mov ah, 3Fh ;failo skaitymo interuptas
mov bx, Input_Handle ;sis intas reikalauja atidaryto failo handle
mov cx, 1 ; nuskaitomas baitu kiekis po OPK
mov dx, offset Disp_Buff
int 21h
mov IIII, 1
call QQ_Convert_IP
jmp QQFrom_Two_Instructions
;-----------------------------------------
QQTwo_Instructions2:
mov ax, 0
mov al, Disp_Buff[0]
mov MC_W, ax
call QQDetermine_Instruction
jmp QQFrom_Two_Instructions2
;===============================================================
QQWrite_IP proc near
mov bx, IP_a
mov Disp_Buff[0], bh
mov Disp_Buff[1], bl
mov Disp, 2
call QQHEX_Conversion
mov OutL_Buff[4], ':'
mov OutL_Buff[5], 20h
mov ah, 40h
mov bx, Output_Handle
mov cx, 6
mov dx, offset OutL_Buff
int 21h
mov IP_i, 0
ret
QQWrite_IP endp
;-----------------------------------------------------
QQ_Convert_IP proc near
mov bx, IP_i
mov si, 0
mov cx, IIII
QIQConversion_Loop:
mov al, Disp_Buff[si] ; al'e baita padek pries kreipimasi i funkcija
and al, 0F0h ; vyresnysis pusbaitis
shr al, 4
call QQHalf_Byte_Conversion
mov ah, al
mov al, Disp_Buff[si]
and al, 0Fh ; jaunesnysis pusbaitis
call QQHalf_Byte_Conversion
mov IP_Buff[bx], ah
inc bx
mov IP_Buff[bx], al
inc bx
mov IP_Buff[bx], 20h
inc bx
inc si
loop QIQConversion_Loop
mov IP_i, bx
ret
QQ_Convert_IP endp
;------------------------------------------------
QQHalf_Byte_Conversion proc near
cmp al, 09
jle QQAdd_Zero
sub al, 10
add al, 'A'
jmp QQEnd_Conversion
QQAdd_Zero:
add al, '0'
QQEnd_Conversion:
ret
QQHalf_Byte_Conversion endp
;===============================================================
QQDetermine_Instruction proc near
mov si, MC_W
add si, MC_W
mov bx, word ptr Itable[si]
call QQSpecial_Instructions
QQInstruction:
mov si, 0
mov ax, offset IName[bx].I0
call QQWrite_Instruction
mov ax, offset IName[bx].I0+2
call QQWrite_Instruction
mov ax, offset IName[bx].I0+4
call QQWrite_Instruction
mov OutL_Buff[si], ' '
mov ah, 40h
mov bx, Output_Handle
mov cx, 7
mov dx, offset OutL_Buff
int 21h
ret
QQDetermine_Instruction endp
;-------------------------------------
QQWrite_Instruction proc near
mov OutL_Buff[si], ah
inc si
mov OutL_Buff[si], al
inc si
ret
QQWrite_Instruction endp
;--------------------------------------------
QQSpecial_Instructions proc near
mov dl, 6
cmp bx, 0FFFAh ; ADD OR ADC
jne QQNot_24_Special
mov ax, R_i
mov bx, 0
mul dl
mov bl, al
ret
QQNot_24_Special:
cmp bx, 0FFFBh ; MOVSB STOSB STOSW LODSB LODSW
jne QQNot_04_Special
mov al, 0
mov si, 0A4h
QQWhat_04:
cmp si, MC_W
je QQEND_What_04
inc al
inc si
jmp QQWhat_04
QQEND_What_04:
cmp al, 6
jb QQ_No_Need_SUB
sub al, 2
QQ_No_Need_SUB:
mov bx, 0
mul dl
mov bl, al
add bx, 522
ret
QQNot_04_Special:
cmp bx, 0FFFCh ; ROL RCL SHR
jne QQNot_23_Special
mov ax, R_i
cmp al, 7
jne QQNot_23_SUB
dec al
QQNot_23_SUB:
mov bx, 0
mul dl
mov bl, al
add bx, 480
ret
QQNot_23_Special:
cmp bx, 0FFFDh ; NOT NEG MUL DIV
jne QQNot_22_Special
mov ax, R_i
cmp al, 0
jne QQNot_22_TEST
mov bx, 402
ret
QQNot_22_TEST:
mov bx, 0
mul dl
mov bl, al
add bx, 432 ; ne 444 nes R_i prasideda nuo 2
ret
QQNot_22_Special:
cmp bx, 0FFFEh ;INC DEC CALL JMP
jne QQNot_21_Special
mov ax, R_i
cmp al, 3
jb QQNOT_22_DEC
dec al
cmp al, 4
jb QQNOT_22_DEC
dec al
QQNOT_22_DEC:
mov bx, 0
mul dl
mov bl, al
add bx, 408
ret
QQNot_21_Special:
ret
QQSpecial_Instructions endp
;===================================================================================
QQHEX_Conversion proc near
mov bx, 0
mov si, 0
mov cx, Disp
QQHEX_Conversion_Loop:
mov al, Disp_Buff[si] ; al'e baita padek pries kreipimasi i funkcija
and al, 0F0h
shr al, 4
call QQHalf_Byte_Conversion
mov ah, al
mov al, Disp_Buff[si]
and al, 0Fh
call QQHalf_Byte_Conversion
mov OutL_Buff[bx], ah
inc bx
mov OutL_Buff[bx], al
inc bx
inc si
loop QQHEX_Conversion_Loop
ret
QQHEX_Conversion endp
;===============================================================================================
QQReading_Displacement proc near
mov ax, Disp
add IP_a, ax
mov ah, 3Fh ;failo skaitymo interuptas
mov bx, Input_Handle ;sis intas reikalauja atidaryto failo handle
mov cx, Disp ; nuskaitomas baitu kiekis po OPK
mov dx, offset Disp_Buff
int 21h
;------------------
mov bx, Disp
mov IIII, bx
call QQ_Convert_IP
;------------------
cmp Disp, 2
jne QQRD_END
mov ah, Disp_Buff[0]
xchg ah, Disp_Buff[1]
mov Disp_Buff[0], ah
QQRD_END:
ret
QQReading_Displacement endp
;==========================================
QQEnter_Comma proc near
mov si, O_i
mov al, byte ptr E_Comma[0]
mov Output_Line[si], al
inc si
mov al, byte ptr E_Comma[1]
mov Output_Line[si], al
inc si
mov O_i, si
ret
QQEnter_Comma endp
;=====================================================
QQFormat_03 proc near ; PREFIXAS arba SEGMENTO REGISTRAS
mov bx, MC_W
shr bl, 3 ;SR laikomas 4 bite nuo galo
mov One_Byte, bl
call QQReading_Value
call QQDetermine_Property_i
mov ax, PR_i
cmp ax, 4
jb QQSkip_Sub
sub al, 4
QQSkip_Sub:
add ax, 8
mov P_i, ax
ret
QQFormat_03 endp
;==========================================================
QQFormat_04 proc near
cmp MC_W, 0ECh
jb QQ04_Just_Instruction
cmp MC_W, 0EDh
ja QQ04_Reverse
mov bx, 0 ;W nustato akumuliatoriu
call QQOutput_02 ;REGISTRAS
call QQEnter_Comma
mov W, 1
mov bx, 2 ; DX portastas
call QQOutput_02 ;REGISTRAS
ret
QQ04_Reverse:
mov cl, 1
xchg cl, W
mov bx, 2 ; DX portas
call QQOutput_02 ;REGISTRAS
call QQEnter_Comma
mov W, cl
mov bx, 0 ;W nustato akumuliatoriu
call QQOutput_02 ;REGISTRAS
QQ04_Just_Instruction:
ret
QQFormat_04 endp
;===================================================
QQFormat_05_06 proc near ;06 zodinis REGISTRAS ;----------
;05 w nustato registra ir BETARPIO baitus
mov ax, MC_W
mov One_Byte, al
call QQReading_Value
shr bl, 1
mov W, 0
adc W, 0 ;priskiriu W reiksme
clc
call QQDetermine_Property_i
mov ax, PR_i
mov R_i, ax
mov si, MC_W
cmp byte ptr Formats[si], 05h ;ziuriu kuris formatas
je QQ05_Format
mov W, 0001h ;nes bus zodinis
cmp MC_W, 90h ;ziuriu kuris formatas
jb QQ06_No_Prefix
mov bx, 0
call QQOutput_02 ; REGISTRAS
call QQEnter_Comma
QQ06_No_Prefix:
mov bx, R_i
call QQOutput_02 ; REGISTRAS
jmp QQEND_05_06
;NUSTATYTI KOMANDA
QQ05_Format:
mov bx, R_i
call QQOutput_02 ; REGISTRAS
call QQEnter_Comma
mov ax, 2
mov Disp, ax
cmp W, 1
je QQF05_As_Word
dec Disp
QQF05_As_Word:
call QQReading_Displacement
call QQHEX_Conversion
call QQOutput_04 ;BETARPIS
QQEND_05_06:
ret
QQFormat_05_06 endp
;====================================================================
QQFormat_07 proc near ;1 baitas neaisku ar ISPLESTAS [ATMINTIS]
mov ax, 1
mov Disp, ax
call QQReading_Displacement
call QQExpand_Byte ; cia zymems
call QQHEX_Conversion
call QQOutput_04 ;BETARPIS ;BUVO TIESIOGINE ATMINTIS
ret
QQFormat_07 endp
;==========================================================================
QQFormat_08 proc near ;1 baitas BETARPIS
mov ax, 1
mov Disp, ax
call QQReading_Displacement
call QQHEX_Conversion
call QQOutput_04 ;BETARPIS
ret
QQFormat_08 endp
;=====================================================================
QQFormat_09 PROC near ;09 1 baitas BETARPIS
mov ax, 1 ; priskiriu viena baita
mov Disp, ax
cmp MC_W, 0E5h
ja QQ09_Reverse
mov bx, 0
call QQOutput_02 ;Registras
call QQEnter_Comma
call QQReading_Displacement
call QQHEX_Conversion
call QQOutput_04 ;BETARPIS
ret
QQ09_Reverse:
call QQReading_Displacement
call QQHEX_Conversion
call QQOutput_04 ;BETARPIS
call QQEnter_Comma
mov bx, 0
call QQOutput_02 ;Registras
ret
QQFormat_09 ENDP
;=====================================================================
QQFormat_10 PROC near ;10 w nustato BERARPI
mov bx, 0
call QQOutput_02 ;Registras
call QQEnter_Comma
mov ax, 1 ; priskiriu viena baita
mov Disp, ax
cmp W, 0
je QQ10_Skip
inc Disp
QQ10_Skip:
call QQReading_Displacement
call QQHEX_Conversion
call QQOutput_04 ;BETARPIS
ret
QQFormat_10 ENDP
;==========================================================
QQFormat_11 PROC near ;2 baitai ATMINTIS
mov ax, 2
mov Disp, ax
call QQReading_Displacement
call QQHEX_Conversion
cmp Dsv, 1 ;Cia vis delto yra svardus 'D' bitas
je QQ11_Res_REG
mov bx, 0 ; nusinulinu bx
call QQOutput_02 ;REGISTRAS
call QQEnter_Comma
call QQText_By_W
call QQOutput_00 ;TIESIOGINE ATMINTIS
ret
QQ11_Res_REG:
call QQText_By_W
call QQOutput_00 ;TIESIOGINE ATMINTIS
call QQEnter_Comma
mov bx, 0 ; nusinulinu bx
call QQOutput_02 ;REGISTRAS
ret
QQFormat_11 ENDP
;=================================================
QQText_By_W PROC near
mov bx, 4
cmp W, 1
je QQIs_Word
mov bx, 13
QQIs_Word:
mov One_Byte, 9
call QQText_Cicle
ret
QQText_By_W ENDP
;==========================================================
QQFormat_14 PROC near ;isorinis itesioginis
mov ah, Disp_Buff[0]
mov al, Disp_Buff[1]
add ax, IP_a
mov Disp_Buff[0], ah
mov Disp_Buff[1], al
call QQHEX_Conversion
call QQOutput_04 ;Betarpis
ret
QQFormat_14 ENDP
;==========================================================
QQFormat_15 PROC near ; vidinis tiesioginis
mov al, Disp_Buff[0]
mov ah, Disp_Buff[1]
mov Disp_Buff[2], al
mov Disp_Buff[3], ah
call QQReading_Displacement
mov Disp, 4
call QQHEX_Conversion
mov Disp, 2
call QQOutput_04 ;betarpis
;------------------------------------------------------
mov si, O_i
mov bx, 4
mov al, ':'
mov Output_Line[si], al
inc si
mov al, '0'
mov Output_Line[si], al
inc si
mov cx, Disp ;dvigubai Disp TAIP
add cx, cx
QQ15OutByte_Loop:
mov al, OutL_Buff[bx]
mov Output_Line[si], al
inc si
inc bx
loop QQ15OutByte_Loop
mov al, 'h'
mov Output_Line[si], al
inc si
mov O_i, si
;---------------------------------------------
ret
QQFormat_15 ENDP
;===========================================================
QQFormat_17 PROC near
mov bx, R_i
call QQOutput_02 ;REGISTRAS
call QQEnter_Comma ;kablelis ir tarpas
cmp M_i, 3
je QQ17_Skip_Text
call QQText_By_W
QQ17_Skip_Text:
mov bx, RM_i
call QQOutput_03 ;REGISTRAS/[ATMINTIS]
ret
QQFormat_17 ENDP
;=============================================================
QQFormat_18 PROC near
cmp DsV, 0
je QQ18_Source_REG
mov bx, R_i
call QQOutput_02 ;REGISTRAS
call QQEnter_Comma ;kablelis ir tarpas
cmp M_i, 3
je QQ18_Skip_Text
call QQText_By_W
QQ18_Skip_Text:
mov bx, RM_i
call QQOutput_03 ;REGISTRAS/[ATMINTIS]
ret
QQ18_Source_REG:
cmp M_i, 3
je QQ18_Skip_Text2
call QQText_By_W
QQ18_Skip_Text2:
mov bx, RM_i
call QQOutput_03 ;REGISTRAS/[ATMINTIS]
call QQEnter_Comma ;kablelis ir tarpas
mov bx, R_i
call QQOutput_02 ;REGISTRAS
ret
QQFormat_18 ENDP
;===============================================================
QQFormat_19 PROC near
mov W, 1
mov ax, R_i
cmp ax, 4
jb QQ19Skip_Sub
sub al, 4
mov R_i, ax
QQ19Skip_Sub:
add R_i, 8
cmp DsV, 0
je QQ19Source_REG
mov bx, R_i
call QQOutput_02 ;REGISTRAS
call QQEnter_Comma ;kablelis ir tarpas
mov bx, 4
mov One_Byte, 9
call QQText_Cicle
mov bx, RM_i
call QQOutput_03 ;REGISTRAS/[ATMINTIS]
ret
QQ19Source_REG:
mov bx, 4
mov One_Byte, 9
call QQText_Cicle
mov bx, RM_i
call QQOutput_03 ;REGISTRAS/[ATMINTIS]
call QQEnter_Comma ;kablelis ir tarpas
mov bx, R_i
call QQOutput_02 ;REGISTRAS
ret
QQFormat_19 ENDP
;========================================================================
QQFormat_20 PROC near
mov W, 1
mov bx, R_i
call QQOutput_02 ;REGISTRAS
call QQEnter_Comma ;kablelis ir tarpas
cmp M_i, 3
je QQ20_Skip_Text
call QQText_By_W
QQ20_Skip_Text:
mov bx, RM_i
call QQOutput_03 ;REGISTRAS/[ATMINTIS]*************** turi buti tik atmintis
ret
QQFormat_20 ENDP
;===================================================
QQFormat_21 PROC near ;nera reg 1 ir reg 7
mov cx, 0