copying a string

  1. Include Irvine32.inc
  2. .data
  3.     total byte "Hi, copy array ", 0dh, 0ah, 0
  4.     result byte sizeof total dup(0)
  5. .code
  6.     main proc
  7.     mov esi, 0                      ; ESI = first index of array
  8.     mov ecx, sizeof total           ; length of total
  9.     L1:
  10.     mov al, total[esi]              ; mov index in total into al every time
  11.     mov result[esi], al             ; store it into result
  12.     inc esi                         ; mov to next index
  13.     Loop L1                         ; repeat until ecx == 0
  14.     mov edx, offset result          ; display result (after copying)
  15.     call writestring
  16.     exit
  17.     main endp
  18.     end main

P.159

留言

這個網誌中的熱門文章

Codeforces --- string task

Uva 674 ---- coin change

codeforces 271A --- beautiful year