Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

What the shit! ASM!

Name: Anonymous 2010-08-21 7:23

Hi /prog/

I have writen a program in ASM and for some odd reason this:
call dicks
movl %ecx, 1(%edx, %eax, 4)
does not work, but this code:
call dicks
movl %eax, %ebx
movl %ecx, 1(%edx, %ebx, 4)
does.

And no, there is no code that alters eax inbetween, its just 0, i examined that and it was not 0 before.
edx is correct too, i checked it.

I also get a FP exception when making a division and ecx is not 0.

I am currently reading 286 and 386 programmer manuals by the way.

What the fuck is going on here? Am i missing something?

Name: Anonymous 2010-08-21 7:34

I can see three problems:
1.Unportable ASM
2.ATT syntax
3.introducing a register dependency in ebx

Name: Anonymous 2010-08-21 8:40

>>2
3.introducing a register dependency in ebx
This guy doesn't know what the B means in EBX

>>1
Isn't it obvious? You can't use the accumulator as a base address

I can't remember the precise decoding of the MOD-R/M byte for >386, but for 8086 it only allows BX based

Name: Anonymous 2010-08-21 8:55

>>3
Isn't it obvious? You can't use the accumulator as a base address

I heard this the first time, i havnt seen any such note on sandpile.org nor siyobik.info.

Nor did as complain and i recieved no errors at runtime, that seems weird to me. Would anybody shed some light on this?

Name: Anonymous 2010-08-21 9:28

>>1
You are an idiot. Nobody can help you with ``it doesn't work'' and pseudocode that doesn't exhibit the problem.
Also ecx and FP exceptions have nothing to do with each other.

Name: Anonymous 2010-08-21 9:39

AT&T syntax

Please use Intel syntax for x86 assembly unless you are forced to use GAS for some reason.  I'm not sure why you would want to use GAS if you are just writing some random shit to fuck around with... use FASM or NASM or something.

Name: Anonymous 2010-08-21 9:47

I forgot a few newlines there.

I have writen a program in ASM and for some odd reason this:
call dicks
movl %ecx, 1(%edx, %eax, 4)

does not work, but this code:

call dicks
movl %eax, %ebx
movl %ecx, 1(%edx, %ebx, 4)

does.

>>5
I also forgot to say i use ecx as the divisor, their not supposed to but both, bash and GDB say i got a FP exception.

Thats not pseudocode bumbass.
>>4
I think you meant index, edx is the base.
On 386 you can use eax as index and base.
http://sandpile.org/ia32/opc_sib.htm

Name: Anonymous 2010-08-21 10:20

PIG DISGUSTING AT&T SYNTAX ;_;

Anyway, I recommend stepping through your code with a debugger. It'll make more sense what happens. I don't see how you can get a FPU exception. The only exception that makes sense for your 2 lines is an access violation/segmentation fault, depending on the values of edx/eax.

Name: Anonymous 2010-08-21 10:30

Pastebin your entire code.

Name: Anonymous 2010-08-21 11:22

>>8,6
Sorry about the AT&T syntax, i dont understand why its supposed to be ugly, a matter of preference i guess. I just used it becaus GAS uses it and im used to it.
I wanted to convert to intel syntax anyways.
>>8
I didnt try that yet. I just commented out div ecx and then it worked. I get a floating point exception from GDB and bash, with the division.

Name: Anonymous 2010-08-21 11:32

>>10
You can't be bothered to properly capitalise and punctuate a post. It is hardly a wonder that you don't mind the AT&T syntax.

Name: Anonymous 2010-08-21 12:31

>>3
Welcome to 1985. You may use any register as base and any register as offset.

Name: Anonymous 2010-08-21 12:35

>>12

esp too?

Name: Anonymous 2010-08-21 12:41

>>13
no

Name: Anonymous 2010-08-21 12:45

>>14

What about eip?

Name: Anonymous 2010-08-21 12:47

>>15
no

Name: Anonymous 2010-08-21 12:53

>>12
you mena index?

Name: Anonymous 2010-08-21 13:47

>>15
RIP.

Name: Anonymous 2010-08-21 14:15

>>18
but not eip!

Name: Anonymous 2010-08-21 19:43

Name: Anonymous 2011-02-27 8:31

Name: Anonymous 2011-02-27 8:31

:GJS1M 67dcbdbce4a0b67c4b48e86a6ae29205a95e4b83024a9d947213d1231800e8d9
:45 6bfa68333956ef206cf66311d24cdb35
:1282389834 1298813496

>>7
<-- check 'em dubz

Name: Anonymous 2013-01-18 23:14

/prog/ will be spammed continuously until further notice. we apologize for any inconvenience this may cause.

Don't change these.
Name: Email:
Entire Thread Thread List