Linked by Thom Holwerda on Fri 5th Apr 2013 16:04 UTC
General Development "For years, PC programmers used x86 assembly to write performance-critical code. However, 32-bit PCs are being replaced with 64-bit ones, and the underlying assembly code has changed. This white paper is an introduction to x64 assembly. No prior knowledge of x86 code is needed, although it makes the transition easier."
Thread beginning with comment 557841
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE: 64-bit Asm Quiz
by transputer_guy on Sat 6th Apr 2013 13:34 UTC in reply to "64-bit Asm Quiz"
transputer_guy
Member since:
2005-07-08

That is not a 64b asm test, it is a test of Intel/AMD x86 knowledge. Having looked at it and the Intel article is enough to not want to bother with this level of detail. Your quiz includes lots of arcane stuff that seems to have little to do with general purpose 64b in general.

For me a 64b asm should look like a flat register space with all registers acting the same (except R0) and all named Ri. As i gets bigger, the opcode may get more prefixed to allow ever more registers. At some point the registers might even spill into memory stack space, from i==64 to some limit. This kind of opcode allows 3 ops, z<=x fn y, a pleasure to code, almost like C with 1 op statements.

Reply Parent Score: 3

RE[2]: 64-bit Asm Quiz
by TempleOS on Sat 6th Apr 2013 22:53 in reply to "RE: 64-bit Asm Quiz"
TempleOS Member since:
2013-04-03

You have a valid point, except the implementation is heavily influnced by arcane crap. You have to know this for writing a C compiler. ASM is a stupid thing to do, otherwise.

You have only have very limited access to 64-bit immediates. You have lots of instructions that take 32-bit immediates but you can only load a 64-bit immediate into a register.

One really important fact is that the upper 32-bits get set to zero on any 32-bit size instruction. This is your bread and butter.

You can only branch +/- 32 relative addressing. I put all code in the lowest 2 Gig.

Reply Parent Score: 0

RE[2]: 64-bit Asm Quiz
by dnebdal on Mon 8th Apr 2013 11:43 in reply to "RE: 64-bit Asm Quiz"
dnebdal Member since:
2008-08-27

At least the new registers on amd64 are named r8 → r15, which is marginally sane. Shame about the first half, of course.

Reply Parent Score: 1

RE[3]: 64-bit Asm Quiz
by Kochise on Mon 8th Apr 2013 14:42 in reply to "RE[2]: 64-bit Asm Quiz"
Kochise Member since:
2006-03-03

First half is for legacy reason, just like segmented memory lasted that long. Check for ARM or 68K assembly, you'll touch heaven...

Kochise

Reply Parent Score: 2

RE[3]: 64-bit Asm Quiz
by transputer_guy on Mon 8th Apr 2013 16:16 in reply to "RE[2]: 64-bit Asm Quiz"
transputer_guy Member since:
2005-07-08

Back when I spent some time on the x86 asm in 32b, I just used R0-7 as labels, never used them in their archaic 16/8 bit modes, so it wasn't that bad. If I did use the x64 asm, I would do the same again, no interest in the cruft.

But 16 registers or more is even better and the other ISAs had that decades ago, and even more so when you can have 3 operands per opcode, that just does the same work as 2 or more x86 opcodes.

Reply Parent Score: 2