Guidance
指路人
g.yi.org
software / rapidq / Examples / ASM / char replace / char_replace.rqasm

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
;'From: "Jacques Philippe" Sat, 25 Oct 2003 14:05:15 +0000
;'>
;'> to convert a file with ASCII-Codes from 0 - 255 in a
;'> file in which all ASCII-Codes lower than 32 or greater than 122
;'> changed to ASCII-Code 32.
;'>
;' This is the perfect job for ASSEMBLER in RQ

;For those who are interested, here is the RqAsm Code

; ==== RqAsm Code Start =================
function ReplaceChars ptrBinString lenBinString
;
   cmp dword ptrBinString, 0
   jz .errorptrbinstring
;
   cmp dword lenBinString, 0
   jz .errorlenbinstring
   push esi
   push ecx
;
   mov esi, ptrBinString
   mov ecx, lenBinString
.checknextchar:
   mov al, [esi]
   cmp al, 31
   jbe .not_32_122
   cmp al, 122
   ja .not_32_122
   jmp .checklastchar
.not_32_122:
   mov byte [esi], 32
.checklastchar:
   inc esi
   dec ecx
   jnz .checknextchar
   mov eax, 0          ; function returns 0 : finished ok
   jmp .finished
;
.errorptrbinstring:
   mov eax, 1          ; function returns 1 : ERROR_ptrBinString (=0)
   jmp .finished
;
.errorlenbinstring:
   mov eax, 2          ; function returns 1 : ERROR_lenBinString (=0)
.finished
   pop ecx
   pop esi
End Function
; ==== RqAsm Code End =======================
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2024-4-26  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2003-10-26 14:57:38