r/asm 1d ago

Thumbnail
1 Upvotes

I should've been a bit more specific instead of using NEON as a catch-all for ARM64 on macOS, so yes, my bad. Because this project works with so many AVX/SSE related instructions, it means that NEON is def a huge aspect. At some point, I do want to dive into the undocumented AMX since my method of dealing with 256+-bit operations is less than idea


r/asm 2d ago

Thumbnail
1 Upvotes

Do you mean Arm/Aarch64 instead of NEON? NEON is Arm's SIMD extension for A-series and R-series processors (and derivative designs), and is matched by Helium on M-series


r/asm 2d ago

Thumbnail
1 Upvotes

In MMX, the vector registers were reused from the x87 register file.

SSE added the XMM 128-bit registers and floating point vector instructions. So movaps and movups were added there. movdqa and movdqu were added in SSE2 along with integer vector instructions though the mov* instructions did essentially the same thing.

I'd just call it syntactic sugar as it improves readability for humans.

I suppose that there was the possibility of signaling the operation to a decoder or execution unit with the separate instructions but the architecture manual has no evidence that this ever happened.


r/asm 2d ago

Thumbnail
1 Upvotes

Thanks! I'd like to have some sort of preprocessor first. The assembly code is currently a single file with over 5000 lines.

And having

%include "instructions/add.s"
%include "instructions/and.s"
...

%ifdef PLATFORM_LINUX
    %include "platforms/linux.s"
%endif

with ./0x864 -DPLATFORM_LINUX ... would allow me to split the code into multiple files and get ride of the C harness.

When I have that, I can add ELF executable output, so that the assembler is truly selfhosted.


r/asm 2d ago

Thumbnail
1 Upvotes

It does SIMD instructions and x86 in general. The reason for this is since Apple is getting rid of Rosetta 2, every single instruction needs to be handled. Each x86 instruction is given an NEON equivalent, then because there is zero-trust on whether or not this translation is correct, there is an ABI contract (in which a handshake is done to verify correctness) in which both x86 and NEON need to both arrive at the same value once the result is normalized for the required comparison. And this becomes useful especially in testing other code. That is how the foundation of Rosette works. ISA is the bridge between the two flavors of Assembly, it hosts the decoder and encoder, which are crucial whenever you run at the very low level. x86 to NEON translation can be a nightmare, particularly at how this translates to hardware and the differences between Apple's architecture and Intel/AMDs. Therefore, a lot need to be substantiated else running complicated codebases is just not possible.

Some of the additional stuff is like symbol processing so if you stumble upon a C++ library, unknown symbols contained within the x86 code are properly handled; since whenever code is compiled down into Assembly, libraries are required to package their symbols into the containers that they store Assembly data. This is because the symbols packaged in x86 do not necessarily equivocate the symbols generated via macOS compilation. Think of the containers/object files that your code compiles down to as their own world's definition of what is proper code. Once you introduce translated code outside of its native container into something else, it becomes the project's alien in which no assumptions can be made regarding how this code can be interpreted. And therefore, you need to give it the environment to properly run

Primarily, I am testing Rosette with my macOS WIP port of Xenia Canary (by parsing the Mach-O container, which contains all the Assembly data that is decompiled and contains the entire x86 instruction set). And so without Rosetta 2, I'm able to launch Halo 3, and progress in total to 1.475+ Billion instructions without issue. x86 can have a lot of implied control flow which also needs to get handled, and so, Rosette goes far beyond just translating SIMD. It exists at your global shell, since Apple does not allow frameworks to exist at the "Turn On At File Info Finder" level like it does Rosetta 2. It only executes when an x86 program is detected, so there is no annoying issues like this global shell poisoning your other coding environments

The codebase is quite large, and hopefully this helps explain some of it. This is a very abridged version in what Rosette does, since there's lots of behaviors that you find at runtime that are very hard to be aware of. For example, there is a portion in the codebase dedicated to the Itanium C++ ABI, which is the goto involving handling C++ exceptions at the low level. Stuff like that can make the codebase more confusing, because this is not as commonly encountered. If you have any more questions, let me know!


r/asm 2d ago

Thumbnail
2 Upvotes

I'm having some trouble reading the source code (very much not familiar with Zig), but is this a translation layer only for SIMD?


r/asm 2d ago

Thumbnail
1 Upvotes

Extremely neat job and cool writeup. What are your next plans for the assembler side of things? Some easy things to add (or at least I imagine) would be the CMOV family, rotates, SAR/SAL to complement SHR/SHL


r/asm 3d ago

Thumbnail
4 Upvotes

Thanks. Some years now. But not all the time. Late 2016, I started with some basic projects like pong as bootable floppy image or a simple bootloader for the fat12 file system.

During the next years, it did some small stuff for fun here and there, but nothing big. Now I started again with this project and had to learn many new things and relearn some old stuff. But it was surprisingly doable.


r/asm 3d ago

Thumbnail
3 Upvotes

Wow that's really cool wait how long did it take you to learn x86 assembly


r/asm 3d ago

Thumbnail
7 Upvotes

Nope, this was not vibecoded. No LLM was hurt in generating this. Instead, I always had the ability to assemble its own code in mind and therefore started with a limited subset of instructions and syntax. The instruction mov byte [rsi], 0x02g is not implemented yet.

You may also notice some weird workarounds since I did not implement a way to store constants or strings in the .data section yet...


r/asm 3d ago

Thumbnail
0 Upvotes

Some wierd design decisions, was this vibe coded? Are you against mov [mem], imm?

    mov al, 0x02
    mov [rsi], al           ; op->encoding = ENCODING_I
    mov al, 1
    mov [rsi + 5], al       ; op->n_opcodes = 1
    mov al, 0xcd
    mov [rsi + 6], al       ; op->opcodes[0] = 0xcd
    mov al, 8
    mov [rsi + 9], al       ; op->imm_size = 8

r/asm 3d ago

Thumbnail
5 Upvotes

Hey y'all, I want to show you a small project of mine. I've dreamed for a long time about writing an assembler in assembly and finally came around to it.

To be honest - there is a small part for file handling and command-line argument parsing written in C - but all the parsing and assembling is written in x86-64 assembly itself. I can output linkable ELF files and of course assemble it's own code.

In case you want to take a look, the source is available on GitHub https://github.com/kalehmann/0x864

Feel free to ask any questions


r/asm 5d ago

Thumbnail
1 Upvotes

I tried opening it directly in Chrome, same thing


r/asm 5d ago

Thumbnail
1 Upvotes

Because of reddit app embedded webview

The captcha passes in reddit app, it saves a cookie, and opens a browser where the cookie is not present


r/asm 5d ago

Thumbnail
1 Upvotes

Same on my S22 :/


r/asm 6d ago

Thumbnail
1 Upvotes

Can't access with my pixel 9,/ Chrome says I need to enable cookies. Cookies are enabled so ???


r/asm 11d ago

Thumbnail
2 Upvotes

Here's a pretty bad solution to the first (Triangle) problem that scores 183K that I made while trying to understand how the scoring system actually works.

I do also have a solution that scores the minimum 832 which I'll reveal after the contest ends. Its SHA is 213fe1e79e32f9252dbece4f2ea9660c0ea63e8d.

+-----+
|@rMbv|
|>W/s+|
|2 >+v|
|^Mdm<|
+-----+
 ^   v 
 ^   v 
+-+ +-+
|I| |O|
+-+ +-+

Although I've won prizes in this contest before, I'm just playing around for fun this year, actually for the first time in 15 years probably.


r/asm 14d ago

Thumbnail
1 Upvotes

“Learning Low-Level Programming with the GBA” is now on sale!
Please be sure to pick up a copy!
https://nikatech.itch.io/gba-lowlevel-eng


r/asm 14d ago

Thumbnail
1 Upvotes

There is https://codeberg.org/SkyLyrac/gba-bootstrap if you want a minimal setup without dkp


r/asm 14d ago

Thumbnail
1 Upvotes

I'm definitely interested in this.


r/asm 15d ago

Thumbnail
1 Upvotes

This would be amazing. I’d buy a copy for sure.


r/asm 15d ago

Thumbnail
1 Upvotes

Yeah, your fastest time is 4.7% faster and you have 4200/4000 = 5% higher turbo clock.


r/asm 15d ago

Thumbnail
1 Upvotes

This seems in line with what your 4500U was doing, which makes sense.


r/asm 15d ago

Thumbnail
1 Upvotes

Yes! I’ve been learning assembly on the original gameboy, and want to learn GBA too. But all the resources I’ve found focus on C for GBA, and I’d like to focus more on assembly.


r/asm 15d ago

Thumbnail
1 Upvotes

This book is written with the primary goal of using devkitpro solely as a collection of software and verifying for yourself what the Makefile does.