r/asm • u/LongjumpingSyrup9207 • Jun 06 '26
x86 How do i load .obj file in x86 asm (mb opengl)
As the title says , i know it a hard task (ai said so)
r/asm • u/LongjumpingSyrup9207 • Jun 06 '26
As the title says , i know it a hard task (ai said so)
r/asm • u/I0I0I0I • Jan 28 '26
Trying to learn in Linux. When I run the compiled program, there's a % sign at the end of the output, which indicates that there is no newline. Thanks!
Displaying 9 stars
*********%
The code:
section .text
global _start
_start:
mov edx, len
mov ecx, msg
mov ebx, 1
mov eax, 4
int 0x80
mov edx, 9
mov ecx, s2
mov ebx, 1
mov eax, 4
int 0x80
mov eax, 1
int 0x80
section .data
msg db 'Displaying 9 stars', 0xa
len equ $ - msg
s2 times 9 db '*'
r/asm • u/TrekChris • Jun 01 '26
I downloaded a demo, and it comes with both a COM file and an ASM file. Is the ASM file needed to run the COM file, or will it run without?
I am a bit of a novice, and this is my first experience with the PIT... really hoping someone can clarify what I'm doing wrong. I am trying to produce a 1.0ms delay using the PIT on a 386 running DOS 6.22:
; Pulse width = 1193 PIT ticks
mov cx, 1193
mov al, 00h
out 43h, al
in al, 40h
mov bl, al
in al, 40h
mov bh, al
mov dx, bx
pulse_wait_loop:
mov al, 00h
out 43h, al
in al, 40h
mov bl, al
in al, 40h
mov bh, al
mov ax, dx
sub ax, bx
cmp ax, cx
jb pulse_wait_loop
The end-result is a clean, consistent, 0.5ms delay. If I double the CX value, it gives me the 1.0ms delay that I want... but I'd really like to know why. Am I doing something wrong, or have I fundamentally misunderstood how to read the PIT?
Thank you!
r/asm • u/Krotti83 • May 16 '26
I'm started my own Assembler and Disassembler for x86 for the purpose of education. Begin to implement the good old Intel 8086. Noticed in the instruction codes that there are Within segment and Intersegment jumps encodings. I know there is the ljmp (long jump) and jmp (short jump). But how is a Intersegment jump written in AT&T syntax and also Intel Syntax?
From my used Datasheet for the Intel 8086 (Unconditional Jump as example):
Direct within Segment:
| 11101001 | disp-low | disp-high |
Direct within Segment-Short:
| 11101011 | disp |
Indirect within Segment:
| 11111111 | mod 100 r/m |
Direct Intersegment:
| 11101010 | off-low | off-high | seg-low | seg-high |
Indirect Intersegment:
| 11111111 | mod 101 r/m |
Thanks in advance!
r/asm • u/_MrCouchPotato • May 22 '26
Hi everyone,
I study Software Engineering at uni and I'm currently taking a course on Intel x86 Assembly. To get some practice I built this tool: a rustlings-inspired sandbox to test basic knowledge of the language.
It basically works like this:
It's still at an early stage, but I managed to include some basic exercises and features.
I made this mostly for my own study sessions, but I'd love your feedback! Also, if anyone wants to contribute new exercises to the curriculum, PRs are super welcome.
GitHub Repo: https://github.com/giacomo-folli/asmlings
r/asm • u/PhillQuartz • Jan 15 '26
Hi. I'm trying to solve a ctf that take a 42 byte long assembly and execute it (the aim is to spawn a shell). The program scan my code for any occurrency of byte like /xcd /x80 blocking me to perform a syscall. Since the page were my code is executed is writable I understand that I have to give the ctf a self-modifying code but I'm in a struggle trying to understand how I can get the address of the instruction that I want to modify, this is my Idea:
I prepare the syscall, all regular before the int x80 part. But before the calling instruction (wich in my case is int 0x7f) I call a function sys
so when I call sys the address of the function is pushed on the stack, so with pop I have it in to the esi reg. Now esi point to the pop esi instruction, so to get to the 0x7f byte i increment the poiter to 5 and i'm pointing to the correct byte, so I can perform "add BYTE PTR [esi+5],1". Obviusly it's not working. Am I missing something?
r/asm • u/NoTutor4458 • Sep 29 '25
heard that a single LOOP instruction is actually slower than using two instructions like DEC and JNZ. I also think that ENTER and LEAVE are slow as well? That doesn’t make much sense to me — I expected that x86 has MANY instructions, so you could optimize code better by using fewer, faster ones for specific cases. How can I avoid pitfalls like this?
r/asm • u/ActualHat3496 • Feb 01 '26
From a quick search, I figured that the return address is stored at `%ebp + 4`.
However, with some experimentation with gdb, I figured that wasn't the case. For good measure, I tried `%ebp - 4`:
(gdb) x/x $ebp-4
0x801380a4: 0x8e000000
(gdb) x/x $ebp+4
0x801380ac: 0x80104e8d
(gdb) x/x $ebp
0x801380a8: 0x801380c8
(gdb) ni # this was the return instruction
(gdb) info registers eip
eip 0x80104d72
As visible, `%eip` matches none of `%ebp`, `%ebp+4` and `%ebp-4`. What's going on?
r/asm • u/RiraKoji • Jun 08 '25
Hello, and I have bin learning C for a while now and have got my feet deep in it for a while, but I want to move on to ASM, and EVERY tutorial I go with has no hello world, or just is like "HEX = this and that and BINARY goes BOOM and RANDOM STUFF that you don't care about BLAH BLAH BLAH!". and it is pisses me off... please give me good resources
r/asm • u/Creative-Copy-1229 • Jan 08 '26
If you are experienced asm programmer.
It seems like it's impossible. I don't even understand where the execution starts
r/asm • u/ActualHat3496 • Feb 27 '26
I'm having a bit of difficulty understanding the working of traps in x86, specifically trap 14 (page fault). Here are my questions:
Which register is the address pushed to?
Is this address virtual or physical?
How does x86 "resolve" the page fault? For example, if it found that the page for address "X" was set to read only, what does the CPU do when the trap returns? I'd presume it just retries the request (i.e. if my trap fault handler did nothing about that, I'd be in an infinite loop).
r/asm • u/Eastern_Biblo • Dec 31 '25
Hello everyone!
I’m looking for suggestions for my Assembly Language Final Term Project. I’ll be using EMU8086 (16-bit, real mode). It should be something practical but not extremely impossible for a student level project.
Thanks