flat assembler
Message board for the users of flat assembler.
Index
> Windows > Where is the error? |
Author |
|
LocoDelAssembly 08 Oct 2011, 05:00
With "je rpar" you are telling the processor to execute the string rpar which will obviously crash (or at least it won't do what you might expect).
Do it like this instead: Code: include 'win32ax.inc' Macro unidad3 dato { local ..odd, ..exit mov ax, dato test ax, 1 jnz ..odd push rpar jmp ..exit ..odd: push rimpar ..exit: } .data ej dw 30H rpar db ' result par ',0 rimpar db ' es impar ',0 titulo db 'Compilador Ensamblador FASM Programa unidad3',0 .code start: push 0 push titulo unidad3 [ej] push 0 call [MessageBoxA] push 0 call [ExitProcess] .end start |
|||
08 Oct 2011, 05:00 |
|
crow78 09 Oct 2011, 02:09
Thank you very much, I had done differently but according to 16-bit era, so you can imagine, and the same procedures but would look like?
|
|||
09 Oct 2011, 02:09 |
|
typedef 09 Oct 2011, 02:40
Or
Code: proc IsEven, num push ebp mov ebp,esp xor eax,eax bt dword[num],00 jc _even inc eax _even: mov esp,ebp pop ebp ret endp |
|||
09 Oct 2011, 02:40 |
|
crow78 11 Oct 2011, 20:59
include 'win32ax.inc'
;Macro unidad3 dato ;{ ;local ..odd, ..exit ;mov ax, dato ;test ax, 1 ;jnz ..odd ;push rpar ;jmp ..exit ;..odd: ;push rimpar ;..exit: ;} .data ej dw 30H rpar db ' result par ',0 rimpar db ' es impar ',0 titulo db 'Compilador Ensamblador FASM Programa unidad3',0 .code start: call IsEven,ej push 0 push titulo ;unidad3 [ej] push 0 call [MessageBoxA] push 0 call [ExitProcess] .end start proc IsEven, num push ebp mov ebp,esp xor eax,eax bt dword[num],00 jc _even inc eax _even: mov esp,ebp pop ebp ret endp |
|||
11 Oct 2011, 20:59 |
|
LocoDelAssembly 12 Oct 2011, 04:36
Read this: http://flatassembler.net/docs.php?article=win32#1.3
typedef's code is both unoptimal and incorrect (the instructions dealing with EBP shouldn't be there since proc itself do that already and doing it again screws up parameter referencing). Maybe he realized you wanted homework to be solved effortlessly, MAYBE. I'll move this thread to Windows forum as I think it has little to do with macros so far. |
|||
12 Oct 2011, 04:36 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.