;coded by jets@mail.ru DATA SEGMENT mas1 db "Hello,my DEAR friend!! How are YOU? Do you want to play a music?" mas2 db 64 dup(?) len dw $-mas2 mas3 db 64 dup(?) len2 dw $-mas3 bw1 dw 1111110011111111b ; bw2 dw 1111111111110001b ; bit bw3 dw 1111111100011111b ; string bw4 dw 1001111110111111b ; file1 db "out.txt",0 file2 db "out2.txt",0 FileHandle dw ? DATA ENDS STCK SEGMENT STACK db 256 DUP(?) STCK ENDS CODE SEGMENT 'code' ASSUME CS:CODE,DS:DATA strt: mov AX,DATA mov DS,AX mov ES,AX LEA SI,mas1 LEA DI,mas2 mov BX,bw1 CLD beg: LODSB SHL BX,1 ;move left on one bit JNC next ;if bit=0 -> next cmp AL,"a" JB next cmp AL,"z" JA next STOSB next: cmp SI,15 ;if(i==15) -> load next part of bit string JE load2 cmp SI,31 ;if(i==31) -> load next part of bit string JE load3 cmp SI,47 ;if(i==47) -> load next part of bit string JE load4 JMP noload load2: ;load 2nd part of bit string mov BX,bw2 jmp noload load3: ;load 3rd part of bit string mov BX,bw3 jmp noload load4: ;load 4th part of bit string mov BX,bw4 noload: cmp SI,64 ;if(i==64) -> exit from cycle JE ext JMP beg ext: LEA SI,mas1 ;cycle for 2nd result array LEA DI,mas3 add DI,63 beg2: CLD LODSB cmp AL,"," ;if prev=',' JNE next2 cmp AH,"a" ;and current>="a" JB next2 cmp AH,"z" ;and current<="z" JA next2 JMP ext2 ;then exit next2: STD STOSB mov AH,AL cmp SI,64 ;if(i=64) -> exit JE ext2 JMP beg2 ext2: mov ah,3ch ;writing to first file mov dx,offset file1 mov cx,0 int 21h mov FileHandle,ax mov ah,40h mov bx,FileHandle mov cx,len mov dx,offset mas2 int 21h mov ah,40h mov bx,FileHandle mov cx,0 int 21h mov ah,3eh mov bx,FileHandle int 21h mov ah,3ch ;writing to second file mov dx,offset file2 mov cx,0 int 21h mov FileHandle,ax mov ah,40h mov bx,FileHandle mov cx,len2 mov dx,offset mas3 int 21h mov ah,40h mov bx,FileHandle mov cx,0 int 21h mov ah,3eh mov bx,FileHandle int 21h mov AX,4C00h int 21h CODE ENDS END strt