flat assembler
Message board for the users of flat assembler.
Index
> Main > mov BX to EAX ~ the newbiest question Goto page Previous 1, 2, 3, 4, 5, 6 Next |
Author |
|
Borsuc 11 Jan 2010, 16:37
I compiled with "format PE" in FASM and the 'stackreserve' size is 4096. Are you sure it gives you 1MB even if it's specified less in the header?
|
|||
11 Jan 2010, 16:37 |
|
Borsuc 11 Jan 2010, 17:01
I used the code
Code: mov ebp, esp push eax @@: sub esp, 4096-4 push eax jmp @b _________________ Previously known as The_Grey_Beast |
|||
11 Jan 2010, 17:01 |
|
revolution 11 Jan 2010, 17:26
My XP SP2 box fails at 0x3D000
|
|||
11 Jan 2010, 17:26 |
|
LocoDelAssembly 11 Jan 2010, 18:12
Code: format pe gui 4.0 include 'win32ax.inc' ;stack 512*1024*1024 .code start: invoke SetUnhandledExceptionFilter, ExceptionHandler xor ecx, ecx mov ebx, esp .loop: inc ecx call .loop report: mov esp, ebx shl ecx, 2 sub esp, 256 mov ebx, esp cinvoke wsprintf, ebx, "Stack available at entry point: %u bytes.", ecx invoke MessageBox, 0, ebx, "Report", MB_ICONINFORMATION invoke ExitProcess, 0 ExceptionHandler: mov eax, [esp+4] mov eax, [eax+4] ; EXCEPTION_POINTERS.ContextRecord mov dword [eax+184], report ; CONTEXT.Eip mov eax, -1 ; EXCEPTION_CONTINUE_EXECUTION .exit: ret 4 .end start Stack available at entry point: 249800 bytes. (with default stack) Stack available at entry point: 536858568 bytes. (with stack line uncommented) WinXP SP3 [edit]This on a Win7 64-bit (using the same 32-bit executable): Stack available at entry point: 249744 bytes. (with default stack)[/edit] |
|||
11 Jan 2010, 18:12 |
|
Teehee 13 Jan 2010, 15:50
may seem weird... but i dunno how to do a simple 'if' like that:
Code: if ((x >= 10 && x <= 20) || (x >= 30 && x <= 40)) { ; ok } else { ; no } How it go in Asm? |
|||
13 Jan 2010, 15:50 |
|
revolution 13 Jan 2010, 15:55
Code: mov eax,[x] cmp eax,10 jb .no cmp eax,40 ja .no cmp eax,20 jbe .yes cmp eax,30 jb .no .yes: ;Woo-hoo jmp .next .no: ;Boo-hoo .next: |
|||
13 Jan 2010, 15:55 |
|
Teehee 13 Jan 2010, 15:59
but we do not use AND or OR instructions?
|
|||
13 Jan 2010, 15:59 |
|
revolution 13 Jan 2010, 16:03
You want logical AND and OR, not binary AND and OR.
But you could use things like SETcc, to avoid the jumps, and (x)OR/AND the results together, but that is slightly more advanced and uses extra registers. |
|||
13 Jan 2010, 16:03 |
|
LocoDelAssembly 13 Jan 2010, 16:08
If you need long-circuit version then you could use some ANDs and ORs:
Code: mov eax, [x] ; (x >= 10 && x <= 20) cmp eax, 10 setge dl cmp eax, 20 setle dh and dl, dh ; (x >= 30 && x <= 40) cmp eax, 30 setge cl cmp eax, 40 setle ch and cl, ch ; ((x >= 10 && x <= 20) || (x >= 30 && x <= 40)) or dl, cl jz .else .if: ; ... jmp .endif .else: ; ... .endif: |
|||
13 Jan 2010, 16:08 |
|
Teehee 13 Jan 2010, 16:15
*_*
some few questions: 1. 'setge CL' sets all CL 8bits to 1? 2. is jb = jl ? |
|||
13 Jan 2010, 16:15 |
|
revolution 13 Jan 2010, 16:17
Teehee wrote: *_* |
|||
13 Jan 2010, 16:17 |
|
Teehee 13 Jan 2010, 16:23
humpf.
|
|||
13 Jan 2010, 16:23 |
|
LocoDelAssembly 13 Jan 2010, 16:25
But I'll better do some clarifications:
1. No, only lower bit, the rest are cleared. 2. No. I've assumed signed integers, and revolution's example was with unsigned integers. |
|||
13 Jan 2010, 16:25 |
|
Borsuc 13 Jan 2010, 17:06
Teehee wrote: but we do not use AND or OR instructions? in other words, '&' is bitwise and instruction (acts on individual bits, not the whole number), and '&&' is logical and, which has to be done with comparisons and conditional logic. _________________ Previously known as The_Grey_Beast |
|||
13 Jan 2010, 17:06 |
|
Teehee 13 Jan 2010, 17:10
Borsuc wrote: Those are bitwise instructions, not logical. They are the equivalent of '&' and '|' in C, not '&&' and '||' Ohhhhhhhh... now i got it! Thanks! _________________ Sorry if bad english. |
|||
13 Jan 2010, 17:10 |
|
Teehee 31 Jan 2010, 19:15
Please confirm to me if to make a struct using no macro is:
Code: POINT:
.x dd ?
.y dd ? thanks in advance |
|||
31 Jan 2010, 19:15 |
|
Borsuc 31 Jan 2010, 19:21
yeah that's correct, but obviously an uninitialized struct.
|
|||
31 Jan 2010, 19:21 |
|
Teehee 01 Feb 2010, 16:59
A [win?] program always starts at 0x0041000 address?
I noticed that looking ollydbg. However, if i run 2 programs (in ollydbg), both start at 0x0041000 address. Can someone explain me that? _________________ Sorry if bad english. |
|||
01 Feb 2010, 16:59 |
|
Borsuc 01 Feb 2010, 17:59
It's called Virtual memory. Every process (program) has its own addressing space -- note that in "physical" RAM it's actually scattered all over... sort of like a fragmented file: in virtual offset, it is continuous, but on physical locations it can be scattered.
And the address is just the default one for the code section, you may be able to change it (I think)... doesn't really matter though. _________________ Previously known as The_Grey_Beast |
|||
01 Feb 2010, 17:59 |
|
Goto page Previous 1, 2, 3, 4, 5, 6 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.