RosettaCodeData/Task/Call-a-foreign-language-fun.../PureBasic/call-a-foreign-language-fun...

40 lines
699 B
Plaintext

; Call_a_foreign_language_function.fasm -> Call_a_foreign_language_function.obj
; the assembler code...
; format COFF or
; format COFF64 classic (DJGPP) variants of COFF file
; format MS COFF or
; format MS COFF64 Microsoft's variants of COFF file
format MS COFF
include "Win32A.Inc"
section ".text" executable readable code
proc strucase stdcall str:dword
xor eax,eax
mov ebx,[str]
strucase_loop:
mov al,byte[ebx]
cmp al,0
jz strucase_is_null_byte
cmp al,'a'
jb strucase_skip
cmp al,'z'
ja strucase_skip
and al,11011111b
strucase_skip:
; mov byte[ebx],al
xchg al,byte[ebx]
inc ebx
jmp strucase_loop
strucase_is_null_byte:
xor eax,eax
mov eax,[str]
ret
endp
public strucase as "_strucase@4"