StoneHaos

max_8

May 8th, 2021 (edited)
337
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. include io.asm
  2.  
  3. sstack segment stack
  4.     db 128 dup(?)
  5. sstack ends
  6.  
  7. sdata segment
  8.     str1 db 16 dup(0)
  9.     len1 dw 0
  10.     str2 db 128 dup(0)
  11.     len2 dw 0
  12.     str3 db 256 dup(0)
  13.     strspec db 1bh, "[1;5;36;40m$"
  14.     strret db 1bh, "[0m$"
  15. sdata ends
  16.  
  17. scode segment
  18.     assume cs:scode, ds:sdata, ss:sstack
  19.  
  20. start:
  21.     mov ax,sdata
  22.     mov ds,ax
  23.     mov es,ax
  24.  
  25.     mov cx,0
  26.     mov bx,0
  27.  
  28.     while1:
  29.         inch al
  30.         mov dl,24h
  31.         cmp al,dl
  32.         je while1end
  33.         mov [str1+bx],al
  34.         inc cx
  35.         inc bx
  36.         jmp while1
  37.  
  38.     while1end:
  39.     mov len1,cx
  40.  
  41.     mov cx,0
  42.     mov bx,0
  43.  
  44.     while2:
  45.         inch al
  46.         mov dl,24h
  47.         cmp al,dl
  48.         je while2end
  49.         mov [str2+bx],al
  50.         inc cx
  51.         inc bx
  52.         jmp while2
  53.  
  54.     while2end:
  55.     mov len2,cx
  56.  
  57.     mov si,offset str1
  58.     mov di,offset str3
  59.     mov cx,len1
  60.     rep movsb
  61.  
  62.     mov si,offset str2
  63.     mov di,offset str3
  64.     add di,[len1]
  65.     mov cx,len2
  66.     rep movsb
  67.  
  68.     mov ax,len1
  69.     mov bx,len2
  70.     add bx,ax
  71.     mov al,24h
  72.     mov [str3+bx],al
  73.  
  74.     mov dx,offset strspec
  75.     outstr
  76.     mov dx,offset str3
  77.     outstr
  78.     mov dx,offset strret
  79.     outstr
  80.  
  81.     finish
  82. scode ends
  83. end start
RAW Paste Data Copied