-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisasm.asm
More file actions
2620 lines (2357 loc) · 46.9 KB
/
disasm.asm
File metadata and controls
2620 lines (2357 loc) · 46.9 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
.model small
ASSUME CS:kodas, DS:duomenys, SS:stekas
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
stekas segment word 'STACK'
dw 400h dup (00) ; stack -> 2Kb
stekas ends
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
duomenys segment para public 'DATA'
instructions_1:
; Immediate to register
db 10110000b
dw offset immediateToReg
db 10110001b
dw offset immediateToReg
db 10110010b
dw offset immediateToReg
db 10110011b
dw offset immediateToReg
db 10110100b
dw offset immediateToReg
db 10110101b
dw offset immediateToReg
db 10110110b
dw offset immediateToReg
db 10110111b
dw offset immediateToReg
db 10111000b
dw offset immediateToReg
db 10111001b
dw offset immediateToReg
db 10111010b
dw offset immediateToReg
db 10111011b
dw offset immediateToReg
db 10111100b
dw offset immediateToReg
db 10111101b
dw offset immediateToReg
db 10111110b
dw offset immediateToReg
db 10111111b
dw offset immediateToReg
; Register/Memory to/from Register
db 10001000b
dw offset regMemToFromReg
db 10001001b
dw offset regMemToFromReg
db 10001010b
dw offset regMemToFromReg
db 10001011b
dw offset regMemToFromReg
;Immediate to Register/Memory
db 11000111b
dw offset immediateToRegMem
db 11000110b
dw offset immediateToRegMem
;Accumulator <- memory
db 10100001b
dw offset memoryToAcc
db 10100000b
dw offset memoryToAcc
; Memory <- accumulator
db 10100010b
dw offset accToMemory
db 10100011b
dw offset accToMemory
; REgister/Memory to Segment Register
db 10001110b
dw offset regMemToSeg
db 10001100b
dw offset segToRegMem
; PUSH: push register/memory
db 11111111b
dw offset pushMemReg
; PUSH: push register
db 01010000b
dw offset pushReg
db 01010001b
dw offset pushReg
db 01010010b
dw offset pushReg
db 01010011b
dw offset pushReg
db 01010100b
dw offset pushReg
db 01010101b
dw offset pushReg
db 01010110b
dw offset pushReg
db 01010111b
dw offset pushReg
; PUSH: push segment reg
db 00000110b
dw offset pushSeg
db 00001110b
dw offset pushSeg
db 00010110b
dw offset pushSeg
db 00011110b
dw offset pushSeg
; POP: pop registry/memory
db 10001111b
dw offset popRegMem
; POP: pop register
db 01011000b
dw offset popReg
db 01011001b
dw offset popReg
db 01011010b
dw offset popReg
db 01011011b
dw offset popReg
db 01011100b
dw offset popReg
db 01011101b
dw offset popReg
db 01011110b
dw offset popReg
db 01011111b
dw offset popReg
; POP: pop segment reg
db 00000111b
dw offset popSeg
db 00001111b
dw offset popSeg
db 00010111b
dw offset popSeg
db 00011111b
dw offset popSeg
; INC: reg / mem
db 11111111b
dw offset incRegMem
db 11111110b
dw offset incRegMem
; INC: reg
db 01000000b
dw offset incReg
db 01000001b
dw offset incReg
db 01000010b
dw offset incReg
db 01000011b
dw offset incReg
db 01000100b
dw offset incReg
db 01000101b
dw offset incReg
db 01000110b
dw offset incReg
db 01000111b
dw offset incReg
; SUB: Reg / memory & register to either
db 00101000b
dw offset subRegMem
db 00101001b
dw offset subRegMem
db 00101010b
dw offset subRegMem
db 00101011b
dw offset subRegMem
;XCHG: acc with reg
db 10010000b
dw offset xchange
db 10010001b
dw offset xchange
db 10010010b
dw offset xchange
db 10010011b
dw offset xchange
db 10010100b
dw offset xchange
db 10010101b
dw offset xchange
db 10010110b
dw offset xchange
db 10010110b
dw offset xchange
db 10010111b
dw offset xchange
;IN: ax or al
db 11100100b
dw offset inputFrom
db 11100101b
dw offset inputFrom
;OUT:
db 11100111b
dw offset outputTo
db 11100110b
dw offset outputTo
;ADD:
db 00000000b
dw offset addregMemWithreg
db 00000001b
dw offset addregMemWithreg
db 00000010b
dw offset addregMemWithreg
db 00000011b
dw offset addregMemWithreg
;ADC:
db 00010000b
dw offset addwithCarry
db 00010001b
dw offset addwithCarry
db 00010010b
dw offset addwithCarry
db 00010011b
dw offset addwithCarry
; SBB:
db 00011000b
dw offset addwithBorrow
db 00011001b
dw offset addwithBorrow
db 00011010b
dw offset addwithBorrow
db 00011011b
dw offset addwithBorrow
;DEC reg:
db 01001000b
dw offset decrement
db 01001001b
dw offset decrement
db 01001010b
dw offset decrement
db 01001011b
dw offset decrement
db 01001100b
dw offset decrement
db 01001101b
dw offset decrement
db 01001110b
dw offset decrement
db 01001111b
dw offset decrement
;CMP
db 00111000b
dw offset compare
db 00111001b
dw offset compare
db 00111010b
dw offset compare
db 00111011b
dw offset compare
;JMP ; NEBAIGTAS
db 11101001b
dw offset jmpP
;AND
db 00100000b
dw offset andRegMemReg
db 00100001b
dw offset andRegMemReg
db 00100010b
dw offset andRegMemReg
db 00100011b
dw offset andRegMemReg
;TEST
db 10101000b
dw offset testImmToAcc
db 10101001b
dw offset testImmToAcc
;OR
db 00001000b
dw offset orRegMemAndReg
db 00001001b
dw offset orRegMemAndReg
db 00001010b
dw offset orRegMemAndReg
db 00001011b
dw offset orRegMemAndReg
;XOR
db 00110000b
dw offset xorRegMemAndReg
db 00110001b
dw offset xorRegMemAndReg
db 00110010b
dw offset xorRegMemAndReg
db 00110011b
dw offset xorRegMemAndReg
;ONE BYTE INSTRUCTIONS
db 00111111b
dw offset aasPrint
db 00101111b
dw offset dasPrint
db 10011000b
dw offset cbwPrint
db 10011001b
dw offset cwdPrint
db 11111000b
dw offset clcP
db 11110101b
dw offset cmcP
db 11111001b
dw offset stcP
db 11111100b
dw offset cldP
db 11111101b
dw offset stdP
db 11111010b
dw offset cliP
db 11111011b
dw offset stiP
db 11110100b
dw offset hltP
db 10011011b
dw offset waitP
db 11110000b
dw offset lockP
db 11010111b
dw offset xlatP
db 10011111b
dw offset lahfP
db 10011110b
dw offset sahfP
db 10011100b
dw offset pushfP
db 10011101b
dw offset popfP
db 11001100b
dw offset int3P
db 11001110b
dw offset intoP
db 11001111b
dw offset iretP
db 11000011b
dw offset retP
;REP
db 11110011b
dw offset repeatInst
db 11110010b
dw offset repeatInst
;MOVSB/W
db 10100101b
dw offset movswP
db 10100100b
dw offset movsbP
;CMPSB/W
db 10100111b
dw offset cmpswP
db 10100110b
dw offset cmpsbP
;SCASB/W
db 10101111b
dw offset scaswP
db 10101110b
dw offset scasbP
;LODSB/W
db 10101101b
dw offset lodswP
db 10101100b
dw offset lodsbP
;STOSW/B
db 10101011b
dw offset stoswP
db 10101010b
dw offset stosbP
;LEA
db 10001101b
dw offset loadEaToReg
;LDS
db 11000101b
dw offset loadPointerToDS
;LES
db 11000100b
dw offset loadPointerToES
;AAM
db 11010100b
dw offset aamP
;AAD
db 11010101b
dw offset aadP
f_read_error:
db 00
com_line_count:
db 00
com_line_arg:
db 100h dup (00)
file:
dw 0FFFh
output_line:
db ''
scaned:
db 00, 00, '$'
instruction_error:
db 'No such instruction$'
klaidosPranesimas:
db 'Error reading argument$'
error_on_file_open:
db 'Error on file open$'
error_on_file_read:
db 'Error trying read file$'
new_line:
db 0Dh, 0Ah, '$'
low_adr:
db 00
high_adr:
db 00
byte_count:
dw 0000
;-----------------------------------------------------
w_int:
db 00
d_int:
db 00
mod_int:
db 00
reg_int:
db 00
rm_int:
db 00
v_int:
db 00
mov_str:
db 'mov $'
word_str:
db 'word ptr$'
byte_str:
db 'byte ptr$'
cl_str:
db 'cl$'
push_str:
db 'push $'
pop_str:
db 'pop $'
inc_str:
db 'inc $'
sub_str:
db 'sub $'
xchg_str:
db 'xchg $'
acc_str:
db 'ax$'
in_str:
db 'in $'
out_str:
db 'out $'
add_str:
db 'add $'
adc_str:
db 'adc $'
ssb_str:
db 'sbb $'
dec_str:
db 'dec $'
cmp_str:
db 'cmp $'
jmp_str:
db 'jmp $'
and_str:
db 'and $'
or_str:
db 'or $'
xor_str:
db 'xor $'
test_str:
db 'test $'
aas_str:
db 'aas$'
das_str:
db 'das$'
cbw_str:
db 'cbw$'
cwd_str:
db 'cwd$'
clc_str:
db 'clc$'
cmc_str:
db 'cmc$'
stc_str:
db 'stc$'
cld_str:
db 'cld$'
std_str:
db 'std$'
cli_str:
db 'cli$'
sti_str:
db 'sti$'
hlt_str:
db 'hlt$'
wait_str:
db 'wait$'
lock_str:
db 'lock$'
xlat_str:
db 'xlat$'
lahf_str:
db 'lahf$'
sahf_str:
db 'sahf$'
pushf_str:
db 'pushf$'
popf_str:
db 'popf$'
int_str:
db 'int 3$'
into_str:
db 'into$'
iret_str:
db 'iret$'
ret_str:
db 'ret$'
rep_str:
db 'rep$'
movsw_str:
db 'movsw$'
movsb_str:
db 'movsb$'
cmpsw_str:
db 'cmpsw$'
cmpsb_str:
db 'cmpsb$'
scasw_str:
db 'scasw$'
scasb_str:
db 'scasb$'
lodsw_str:
db 'lodsw$'
lodsb_str:
db 'lodsb$'
stosw_str:
db 'stosw$'
stosb_str:
db 'stosb$'
lea_str:
db 'lea $'
les_str:
db 'les $'
lds_str:
db 'lds $'
aam_str:
db 'aam$'
aad_str:
db 'aad$'
mul_str:
db 'mul $'
imul_str:
db 'imul $'
div_str:
db 'div $'
idiv_str:
db 'idiv $'
not_str:
db 'not $'
shl_str:
db 'shl $'
shr_str:
db 'shr $'
sar_str:
db 'sar $'
rol_str:
db 'rol $'
ror_str:
db 'ror $'
rcl_str:
db 'rcl $'
rcr_str:
db 'rcr $'
jz_str:
db 'jz $'
jl_str:
db 'jl $'
jle_str:
db 'jle $'
jb_str:
db 'jb $'
jbe_str:
db 'jbe $'
jpe_str:
db 'jpe $'
jo_str:
db 'jo $'
js_str:
db 'js $'
jnz_str:
db 'jnz $'
jge_str:
db 'jge $'
jg_str:
db 'jg $'
jae_str:
db 'jae $'
ja_str:
db 'ja $'
jpo_str:
db 'jpo $'
jno_str:
db 'jno $'
jns_str:
db 'jns $'
;---------------------Registers-----------------------
seg_reg:
db 'es$'
db 'cs$'
db 'ss$'
db 'ds$'
mod11_w0_reg:
db 'al$'
db 'cl$'
db 'dl$'
db 'bl$'
db 'ah$'
db 'ch$'
db 'dh$'
db 'bh$'
mod11_w1_reg:
db 'ax$'
db 'cx$'
db 'dx$'
db 'bx$'
db 'sp$'
db 'bp$'
db 'si$'
db 'di$'
effectiveAddressCalculationRegisters:
db '[bx+si$' ;0
db '[bx+di$' ;7
db '[bp+si$' ;14
db '[bp+di$' ;21
db '[si $' ;28
db '[di $' ;35
db '[bp $' ;42
db '[bx $' ;49
duomenys ends
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
find_shift macro bit_mask, var, shift_right
; Finds w or d bit with shift
push ax
push si
push dx
push bx
and al, bit_mask ; applying bit mask
shr al, shift_right ; applyign shift
mov byte ptr[var], al ; saving needed bit in chosen variable
pop bx
pop dx
pop si
pop ax ; return bits to ax
endm
find_noshift macro bit_mask, var
; Finds w or d bit with no shift
push ax
push si
push dx
push bx
and al, bit_mask ; applying bit mask
mov byte ptr[var], al ; saving needed bit in chosen variable
pop bx
pop dx
pop si
pop ax
endm
print_sym macro char
; Prints one symbol
push ax
push dx
mov ah, 2
mov dl, char
int 21h
pop dx
pop ax
endm
writeln macro string
; prints full line
push ax
push dx
mov ah, 09
mov dx, offset string
int 21h
mov ah, 09
mov dx, offset new_line
int 21h
pop dx
pop ax
endm
write macro string
; prints new line without new lyne symbol '\n'
push ax
push dx
mov ah, 09
mov dx, offset string
int 21h
pop dx
pop ax
endm
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
LOCALS @@
kodas segment para public 'CODE'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
addByte proc near
push ax
xor ax, ax
mov al, 01
add word ptr[byte_count], ax
pop ax
ret
addByte endp
subByte proc near
push ax
xor ax, ax
mov al, 01
sub word ptr[byte_count], ax
mov byte ptr[low_adr], al
mov al, ah
pop ax
ret
subByte endp
read_arg proc near
; function reads next string in cmd line and searches for the file in directory
; if file is not in the directory CF = 1
push bx
push di
push si
push ax
xor bx, bx
xor si, si
xor di, di
mov bl, es:byte ptr[80h]
mov byte ptr com_line_count, bl
mov si, 0081h
mov di, offset com_line_arg
push cx
mov cx, bx
mov ah, 00
cmp cx, 0000
jne @@pagalVisus
stc
jmp @@end
@@pagalVisus:
mov al, byte ptr es:[si]
cmp al, ' '
je @@next
cmp al, 0Dh
je @@next
cmp al, 0Ah
je @@next
mov byte ptr [di], al
mov ah, 01 ; ah = 1 if there was something else than space
inc di
jmp @@next_step
@@next:
cmp ah, 01 ; checks if there was any non space symbols
je @@exit
@@next_step:
inc si
loop @@pagalVisus
@@exit:
cmp ah, 01 ; checks if there was any non space symbols
je @@attach_com
stc ; if error
jmp @@end
@@attach_com:
mov byte ptr [di], '.'
mov byte ptr [di+1], 'C'
mov byte ptr [di+2], 'O'
mov byte ptr [di+3], 'M'
clc ; if no error
@@end:
pop cx
pop ax
pop si
pop di
pop dx
ret
read_arg endp
f_open proc near ; opens a file
push ax
push dx
mov ah, 3Dh
mov al, 00h
int 21h
jc @@eof
mov word ptr file, ax
@@eof:
pop dx
pop ax
ret
f_open endp
; FIXME: not accurate op address
add_op_mem proc near
push ax
xor ax, ax
mov ax, 100d
add ax, word ptr[byte_count]
mov byte ptr[low_adr], al
mov al, ah
call bin_to_hex
mov word ptr[si], ax
write output_line
mov al, byte ptr[low_adr]
call bin_to_hex
mov word ptr[si], ax
write output_line
print_sym ':'
print_sym ' '
pop ax
ret
add_op_mem endp
f_read proc near ; 1. reads bytes from specified file
; 2. calls function from table for specific op code
push ax
push dx ; buffer
push bx ; file descriptor
push cx
push si
mov si, dx
@@repeat:
mov cx, 01
mov ah, 3Fh
int 21h
jc @@exit_on_error_1
cmp ax, 00
je @@exit_on_error_1
mov al, byte ptr [si] ; al <- getting element from buffer DS:DX, si - iterator (liet. ateina nuskaitytas elementas)
call add_op_mem
call addByte
mov cx, 00FFh
mov bp, 00h
cmp al, 11110111b
jne @@next_1
push ax
mov byte ptr[w_int], 1b
call f_read_next
find_shift 00111000b, reg_int, 3
cmp byte ptr[reg_int], 100b
jne @@n1
call mulP
pop ax
mov word ptr [si], ax
jmp @@repeat
@@n1:
cmp byte ptr[reg_int], 101b
jne @@n2
call imulP
pop ax
mov word ptr [si], ax
jmp @@repeat
@@n2:
cmp byte ptr[reg_int], 110b
jne @@n3
call divP
pop ax
mov word ptr [si], ax
jmp @@repeat
@@n3:
cmp byte ptr[reg_int], 111b
jne @@n4
call idivP
pop ax
mov word ptr [si], ax
jmp @@repeat
@@n4:
jmp @@skip_1
@@exit_on_error_1:
jmp @@exit_on_error_2
@@skip_1:
cmp byte ptr[reg_int], 010b
jne @@n5
call notP
pop ax
mov word ptr [si], ax
jmp @@repeat
@@n5:
dec si
pop ax
call subByte
@@next_1:
cmp al, 11110110b
jne @@next_2
push ax
mov byte ptr[w_int], 0b
call f_read_next
find_shift 00111000b, reg_int, 3
cmp byte ptr[reg_int], 100b
jne @@n6
call mulP
pop ax
mov word ptr [si], ax
jmp @@repeat
@@n6:
cmp byte ptr[reg_int], 101b
jne @@n7
call imulP
pop ax
mov word ptr [si], ax
jmp @@repeat
@@n7:
cmp byte ptr[reg_int], 110b
jne @@n8
call divP
pop ax
mov word ptr [si], ax
jmp @@repeat
@@n8:
cmp byte ptr[reg_int], 111b
jne @@n9
call idivP
pop ax
mov word ptr [si], ax
jmp @@repeat
@@n9:
cmp byte ptr[reg_int], 010b
jne @@n10
call notP
pop ax
mov word ptr [si], ax
jmp @@repeat
@@n10:
dec si
pop ax
call subByte
@@next_2:
jmp @@skip_2
@@exit_on_error_2:
jmp @@exit_on_error_3
@@skip_2:
push ax
and al, 11111100b
cmp al, 11010000b
jne @@next_3
pop ax
find_shift 00000010b, v_int, 1
find_noshift 00000001b, w_int
call f_read_next
find_shift 00111000b, reg_int, 3
cmp byte ptr[reg_int], 100b
jne @@n11
call shlP
mov word ptr [si], ax
jmp @@repeat
@@n11:
cmp byte ptr[reg_int], 101b
jne @@n12
call shrP
mov word ptr [si], ax
jmp @@repeat
@@n12:
cmp byte ptr[reg_int], 111b
jne @@n13
call sarP
mov word ptr [si], ax
jmp @@repeat
@@n13:
cmp byte ptr[reg_int], 000b
jne @@n14
call rolP
mov word ptr [si], ax
jmp @@repeat
@@n14: