; --------------------
; test_macros.asm
;
; @brief	Simple program for testing macros
; @author 	...
; @date		24.11.2014
; --------------------
%include "macros.inc" ; Include all text from file ./macros.inc
extern _printf

; void leetify(char* string); // turns a string 1337
globalfunc _leetify, string:dword
	prologue
	mov   eax, .string   ; EAX : char* string
	
	; while (*string)
	.while byte[eax] != 0
		mov	  cl, byte[eax]
		.if cl == 'e'
			mov	  byte[eax], '3'
		.elseif cl == 'l'
			mov   byte[eax], '1'	; 01
		.elseif cl == 'o'
			mov   byte[eax], '0'	; 00
		.endif
		inc		eax					; ++string
	.endwhile
	epilogue

globalfunc _main, argc:dword, argv:dword
	prologue

	asciiz string0, "Hello world!"
	invoke _leetify, string0    ; leetify("Hello world!");
	invoke _printf,  string0    ; printf("H3110 w0r1d!");
	
	; return 0;
	xor   eax, eax
	epilogue