flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Tyler 14 Nov 2010, 06:18
You don't. in and out is for other uses. You won't use them unless you get into OS/driver dev. You must use the interfaces provided, such as WinAPI and libc. You would use those APIs just as you would in C, but you have to add the functions you wish to use to an import list. vid has a good example of calling libc from asm, here.
|
|||
![]() |
|
ishkabible 15 Nov 2010, 01:38
ok ya OS/driver dev is beyond me at this point. so i could access my gpu this way? not that it is at my skill level to do any thing with it just wondering
|
|||
![]() |
|
ishkabible 15 Nov 2010, 02:33
i have a question that dose not pertain to this. i was using idiv and i devided -45 by 15 but the answer that came out was 286331150. what is causing this? any time i divide a negative number it acts like its unsigned.
|
|||
![]() |
|
Tyler 15 Nov 2010, 03:05
Quote: ok ya OS/driver dev is beyond me at this point. so i could access my gpu this way? not that it is at my skill level to do any thing with it just wondering Quote: i have a question that dose not pertain to this. i was using idiv and i devided -45 by 15 but the answer that came out was 286331150. what is causing this? any time i divide a negative number it acts like its unsigned. |
|||
![]() |
|
ishkabible 15 Nov 2010, 03:34
Quote:
that works but not the other way around whats the deal? edit: about the other thing. how come some one hasn't figured out this information. i mean it's our computers right? maybe there is no use for this sort of thing. i guess gpu's are meant to be for graphics and aren't much good much else. who knows the infmation? hardware manufacturers like ATI and Nvidia or software developers like OpenGL and DirectX? |
|||
![]() |
|
Tyler 15 Nov 2010, 03:56
Quote:
Quote:
|
|||
![]() |
|
ishkabible 15 Nov 2010, 04:10
so i how do i avoid this unsigned vs signed deal, i thought those kind of things weren't specified in assembly and that it was the instruction that dealt with this. i used idiv and idiv is sigend no?
here is my sample program that shows my problem. Code: format PE console entry main include 'INCLUDE\MACRO\import32.inc' include 'INCLUDE\MACRO\proc32.inc' section '.data' data readable writeable pausemsg db "pause>nul",0 saynum db "%i is the number",10,0 mynumber1 dd ? mynumber2 dd -45 mynumber3 dd 15 section '.code' code readable executable main: mov edx,0 mov eax,[mynumber2] mov ebx,[mynumber3] div ebx mov [mynumber1],eax push eax push saynum call [printf] add esp,8 push pausemsg call [system] add esp,4 ret section '.idata' import data readable library msvcrt,'msvcrt.dll' import msvcrt,\ printf,'printf',\ scanf,'scanf',\ system,'system',\ getchar,'getchar',\ realloc,'realloc',\ malloc,'malloc',\ free,'free',\ calloc,'calloc',\ exit,'exit' |
|||
![]() |
|
Tyler 15 Nov 2010, 05:37
I mean that it expects the first operand to be unsigned(ie the highest bit makes it bigger), instead of signed(ie the highest bit makes it negative). Although they aren't specified, they still make a big difference when interpreted differently. For example, take 45, and print it as "%u" to printf, then negate it, using neg, and print that as unsigned.
|
|||
![]() |
|
Alphonso 15 Nov 2010, 09:37
Code: mov eax,[mynumber2] cdq ;sign extend eax -> edx:eax mov ebx,[mynumber3] idiv ebx |
|||
![]() |
|
ishkabible 15 Nov 2010, 17:11
ok so so what dose cdq do exactly?
|
|||
![]() |
|
baldr 15 Nov 2010, 18:51
ishkabible,
Alphonso already wrote that: cdq sign-extends eax into edx, i.e. edx==-1 if eax<0, edx==0 otherwise. After this edx:eax contains 64-bit signed representation of the same number as 32-bit signed in eax. |
|||
![]() |
|
ishkabible 15 Nov 2010, 21:35
ok i get it uses eax joined with edx so that if edx is zero it would be like eax was unsigned because the highest order bit of edx:eax is 0 not 1. thanks guys
![]() |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.