flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Madis731 31 May 2010, 13:52
I think there's a part in the manual where they differentiate GPR and MMX/XMM registers. GPRs are named rax, rbx, ... rbp. MMX registers are mm0..mm7, XMM registers are xmm0..xmm15.
You can access GPR-s through "regular" instructions (mov, add, imul, xor). You can access MMX/XMM registers through special instructions (starting with P - packed integer instructions; ending with PS/PD - packed float/double instructions). There are exceptions of course, but that's what manuals are for. pxor rax is ILLEGAL! pxor mm0,mm0 or pxor xmm0,xmm0 are okay. xor rax,rax is okay (although in 64-bit world xor eax,eax does the same thing) |
|||
![]() |
|
baldr 31 May 2010, 15:29
john_s,
The best source of information about CPUs are their manufacturers' sites: Intel, AMD. AMD64 APM vol. 1 rev. 3.15 p. 26 wrote: 3.1.2 64-Bit-Mode Registers |
|||
![]() |
|
john_s 31 May 2010, 15:34
Madis731 wrote: xor rax,rax is okay (although in 64-bit world xor eax,eax does the same thing) xor rax, rax error: illegal instruction. could there be something wrong with my fasm168? |
|||
![]() |
|
baldr 31 May 2010, 15:36
john_s,
Probably you've forgot use64 directive. xor rax, rax has no encoding in non-64-bit modes. |
|||
![]() |
|
revolution 31 May 2010, 15:42
john_s: Make sure you are running a 64bit OS. You can't run 64bit programs on a 32bit OS.
|
|||
![]() |
|
john_s 31 May 2010, 15:44
Nope - use64 is there.
As a test, I tried removing just about everything else, and it compiled. I then removed the .data and .code directives, which seemed to be necessary from other examples I've seen, and it seems to be running better. Thanks for the help so far - I'll let y'all know how it goes ![]() |
|||
![]() |
|
john_s 31 May 2010, 15:54
revolution wrote: john_s: Make sure you are running a 64bit OS. You can't run 64bit programs on a 32bit OS. I wondered about that. Nothing I've read actually comes out and says it as bluntly as you have. If the registers and instructions are there, why won't it run? I don't plan on calling the operating system at all. And anyway, shouldn't I be able to compile 64-bit code on a 32-bit OS? Even if it won't actually run? |
|||
![]() |
|
revolution 31 May 2010, 16:56
john_s: You can compile the 64bit program with fasm on a 32bit system. But you can't run the 64bit program there. You will need another machine to run it with a 64bit OS.
It is not a matter of calling the OS, your program runs under the OS whether you call it or not. 64bit requires the CPU to run in a 64bit mode, you can't just run 64bit code any time. You have to set the CPU mode to 64bit and run everything as 64bit, including the OS. |
|||
![]() |
|
Tyler 31 May 2010, 21:02
Or you could try a VM. I use 32bit xp in vmware under 64bit Linux. I wonder, does vmware emulate all the 32bit code, or do some black magic with compatibility mode?
Quote:
You should probably use C. No offence, but you'd have to have a lot of experience before you could write better code than any good compiler, neither I, nor most people can. |
|||
![]() |
|
john_s 31 May 2010, 22:15
Tyler wrote: Or you could try a VM. I use 32bit xp in vmware under 64bit Linux. I wonder, does vmware emulate all the 32bit code, or do some black magic with compatibility mode? You could well be right. But the algorithm I'm trying to implement is very simple - using assembler I can keep the whole thing as register-to-register instructions. As far as I'm aware, all high-level languages tend to write values to and from memory, slowing things down by a few orders of magnitude. If I can't get more speed than C then I might as well give up - I'm trying to improve on an existing C implementation. |
|||
![]() |
|
Fanael 02 Jun 2010, 16:52
john_s wrote: As far as I'm aware, all high-level languages tend to write values to and from memory, slowing things down by a few orders of magnitude. |
|||
![]() |
|
Tyler 02 Jun 2010, 17:30
You can use the register directive to "suggest" that the compiler use a register for the variable. http://www.itee.uq.edu.au/~comp2303/Leslie_C_ref/C/CONCEPT/storage_class.html#register
|
|||
![]() |
|
Fanael 03 Jun 2010, 10:56
Tyler wrote: You can use the register directive to "suggest" that the compiler use a register for the variable. |
|||
![]() |
|
revolution 03 Jun 2010, 11:05
Fanael wrote: Good compilers are ignoring that hint, actually. |
|||
![]() |
|
mindcooler 03 Jun 2010, 13:43
This is why I did away with HLAs :P
_________________ This is a block of text that can be added to posts you make. |
|||
![]() |
|
Tyler 03 Jun 2010, 20:50
mindcooler wrote:
You mean "HLLs"? Either way, almost every popular language has it's use. I'd hate to do anything big in assembly. If I was Tomasz, I'd have went insane years ago, 74.3 kb(Linux Version 1.69.14) of assembled code in assembly would take me 10 life times. Not that I'm saying it's bad, Fasm is the best assembler IMO, it's just that it must have taken a lot of patience. |
|||
![]() |
|
mindcooler 03 Jun 2010, 20:56
Yes, I meant HLLs, after all, FASM is an HLA
![]() I managed to reach a whopping 6kb on my first real project in pure assembly. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.