r/Assembly_language • • 18h ago

Project show-off Did my first Rainbow Hello World in pure x86 asm!

Post image
15 Upvotes

r/Assembly_language • • 8h ago

Question What if a computer used bf for it's assembly language

Thumbnail reddit.com
0 Upvotes

r/Assembly_language • • 1d ago

Countinuing from previous post:

6 Upvotes

If you hadnt heard i made a post on whether i should learn assembly, and im honestly gonna do it

Im coming from c# and im already learning some shit, its interesting to see how a computer works in the background but its unbelievably complicated, it would be nice to create a project in assembly like a OS or custom language which i only dream of in the process, (for that i shouldve probably learnt C but assembly is harder which is why i did this)

Heres some questions:

What is the optimal way for learning assembly?

What use cases did you use assembly for?

Was it worth it?


r/Assembly_language • • 1d ago

Solved! Can't call subroutine from a linked in object file in GBA assembly

3 Upvotes

Hello, I recently decided to start learning assembly by programming the game boy advance. Most of the information about programming the gba I've found are for C programming so I'm trying to learn assembly by translating them to assembly. I'm specifically following the tonc turorials, with a development environment I mostly copied from the gba-bootstrap repository.

I got the first example from the tonc tutorial running on mgba (a gba emulator), but I did it with a unity build. The tonc book strongly advises against this and instead recommends you assemble the files separately and link them together instead.

Right now my working code looks something like this (shortened for brevity):

// src/header.s
// copied almost verbetim from gba-bootstrap
    
    .section .gba_crt0, "ax"
    .global entrypoint
    .cpu arm7tdmi
    
    .arm
    
entrypoint:
    /*
     * gba header boilerplate
     * initialize the cpu and switch to thumb mode
     */
    bl  main

    // If main returns, reboot GBA using SoftReset
    swi  #0x00



// src/main.s

.include "src/header.s"

.section	.text
.global		main

main:
    /*
     * Draw colors on the screen
     */ 

    // while(1)
1:
    b    1b

    // unreachable
    bx   lr

Here's the Makefile in it's entirety because I suspect the problem is there:

NAME		:= main
GAME_TITLE	:= "GBA_TEMPLATE"
GAME_CODE	:= "00"

UNAME_S		:= $(shell uname -s)
MAKEFLAGS += --no-print-directory

PREFIX		:= arm-none-eabi-
AS		:= $(PREFIX)as
LD		:= $(PREFIX)ld
CC		:= $(PREFIX)gcc
CXX		:= $(PREFIX)g++
OBJDUMP		:= $(PREFIX)objdump
OBJCOPY		:= $(PREFIX)objcopy
MKDIR		:= mkdir
RM		:= rm -rf

ELF	:= $(NAME).elf
ROM	:= $(NAME).gba
MAP	:= $(NAME).map

GBAFIX	:= gbafix/gbafix

ASFLAGS		:= -x assembler-with-cpp \
		   -mthumb -mthumb-interwork \
		   -ffunction-sections -fdata-sections

LDFLAGS		:= -mthumb -mthumb-interwork \
		   -Wl,-Map,$(MAP) -Wl,--gc-sections \
		   -specs=nano.specs -T src/gba.ld \


SOURCEDIR	:= src
BUILDDIR	:= build

SOURCES		:= $(wildcard $(SOURCEDIR)/*.s $(SOURCEDIR)/**/*.s)
OBJS		:= $(patsubst $(SOURCEDIR)/%.s,$(BUILDDIR)/%.s.o,$(SOURCES)) 

$(BUILDDIR)/%.s.o : $(SOURCEDIR)/%.s
	@echo "	AS	$<"
	@$(MKDIR) -p $(BUILDDIR)
	@$(CC) $(ASFLAGS) -MMD -MP -c -g -o $@ $<


$(ROM) : $(ELF) $(GBAFIX)
	@$(OBJCOPY) -O binary $< $@
	@echo "	GBAFIX	$@"
	@$(GBAFIX) $@ -t$(GAME_TITLE) -c$(GAME_CODE)

$(ELF) : $(OBJS) src/gba.ld
	@echo "	LD	$@"
	@$(CC) -o $@ $(BUILDDIR)/main.s.o $(LDFLAGS)
	@#$(CC) -o $@ $(OBJS) $(LDFLAGS)	#DOESN'T WORK

$(GBAFIX) : gbafix/gbafix.c
	@echo "	building GBAFIX"
	@cd gbafix && make

.PHONEY: clean dump

clean:
	@echo "	clean"
	@$(RM) $(ROM) $(ELF) $(MAP) $(BUILDDIR)
	@cd gbafix && make clean

dump: $(ELF)
	@$(OBJDUMP) -S $(ELF)

ifeq ($(UNAME_S), Darwin)

.PHONEY: run
run: $(ROM)
	@echo "	RUNNING	$(ROM)"
	@open -a "mgba" $(ROM)

endif

The linker script is copied verbatim from gba-bootstrap because I don't really understand linkers.

When I switch to linking together all the object files and don't include header in main I still get a main.gba file that runs in the emulator, but it doesn't run the code at my main label.

I don't know if I'm doing something wrong with assembly or if this is a game boy specific problem. What confuses me though is when I objdump my linked file I see the bl main call from the header file has the same address as where my main label ended up.

Any help at all with this would be appreciated! Thanks


r/Assembly_language • • 2d ago

why it's so hard to make cuda SASS assembler?

Thumbnail redplait.blogspot.com
3 Upvotes

r/Assembly_language • • 5d ago

Solved! Should i learn assembly?

73 Upvotes

Im learning assembly because of shits and giggles, i have no serious background and im a beginner.

Heres some questions:

  1. What am i getting myself into?
  2. Is it actually worth it? (I dont think ill use assembly much)

r/Assembly_language • • 5d ago

Question Why do Assembly programmers still put all labels at column 0, instead of nested blocks? Which is easier to manage

37 Upvotes

I know modern assemblers don't care whitespace and this comes down to redabality and the style.

In almost EVERY assembly code I've seen, the format is label at col 0 (every label) and the instructions are nested to the label. Local labels coming in? Still at col 0.

Like, compare these codes:

# size_t strlen(const char *str)
.global strlen
.type strlen, 
strlen:
    # %rdi: const char *str

    xorq        %rax, %rax
    movq        %rdi, %rsi

    1:
        cmpb        $0x00, (%rsi)
        je          2f

        incq        %rax
        incq        %rsi
        jmp         1b
    2:
        ret

And this

# size_t strlen(const char *str)
.global strlen
.type strlen, 

strlen:
# %rdi: const char *str

    xorq        %rax, %rax
    movq        %rdi, %rsi

1:
    cmpb        $0x00, (%rsi)
    je          2f

    incq        %rax
    incq        %rsi
    jmp         1b
2:
    ret

For me, the indented version seems waaaayyy better. Like, it's easy to manage.
However, still I am not advanced assembly programmer and hadn't coded large codebases in assembly, so... I am not sure which is better.

Which is ACTUALLY BETTER? All at 0 or INDENDED for loops and sub tasks for a label???


r/Assembly_language • • 5d ago

Intel versus AT&T syntax

4 Upvotes

Hi everyone! I am back two Assembly after three decades and I would appreciate some input. At the time, I programmed x86 using TASM in a DOS environment for finance (valuation of derivatives when that was a thing...). I never programmed in a windows environment nor in an ARM CPU. Now in my first attempt to catch up, I am reading a book called "Programming from the ground up" which I like very much but the syntax used is AT&T. I didn't even know there was such a thing...Bottomline: what should I take into account when deciding what syntax to use? I work with macOS, Windows and Linux. What I'm looking for is to be able to program in a "modern" assembly that works in contemporary x86 CPUs with Windows or linux and maybe later, learn ARM assembly. Any suggestion regarding the path I should take to is welcome. Thanks!


r/Assembly_language • • 5d ago

Assembly Aula 33Assembly x86_32 no Linux: Leitura de String, Buffer e Limpeza de Overflow (NASM)

Thumbnail youtube.com
1 Upvotes

Assembly x86_32 no Linux: Leitura de String, Buffer e Limpeza de Overflow (NASM)


r/Assembly_language • • 7d ago

Project show-off Forth interpreter for the ZX Spectrum

Post image
18 Upvotes

r/Assembly_language • • 10d ago

How can I start programming an ARM processor completely from scratch?

Thumbnail reddit.com
5 Upvotes

r/Assembly_language • • 10d ago

Should I learn

23 Upvotes

Hey guys, should I learn ASM? I have pretty decent skill in c and c++, im better at memory stuff then complex math, and I wrote a basic malloc using windows and linux ram allocator.


r/Assembly_language • • 10d ago

Sources for good assembly tutorials/begginers?

13 Upvotes

I am looking specifically for something like Geekforgeeks or Sololearning. Obviously for assembly it would be a more niche one but you get the idea. If its a book it would be okay too. Also can assembly be useful for cyber security/ red teaming since its attacking the base code of it all?


r/Assembly_language • • 10d ago

Nuevo en assembly

7 Upvotes

Estoy queriendo aprender assembly pero no se por donde empezar ni que deberia de hacer para practicarlo (que instalar o que pagina ir para aprenderlo), alguna recomendacion? Gracias


r/Assembly_language • • 10d ago

Que opciones laborales puedo tener si aprendo Assembly?

0 Upvotes

Lo que dice el título, busco una forma de ganarme la vida.


r/Assembly_language • • 10d ago

My first assembly program

2 Upvotes

// Multiplies R0 and R1 and stores the result in R2. // (R0, R1, R2 refer to RAM[0], RAM[1], and RAM[2], respectively.) // The algorithm is based on repetitive addition.

@R0 
D=M
@10
M=D  // counter

@R2
D=0
M=0

(START) @10 D=M @END D;JLE // end the loop if counter <= 0

// R1 + R2
@R1  
D=M
@R2
D=D+M
@R2
M=D // current result

@10
D=M
M=D-1

// jump back to the loop start for new iteration
@START
0;JMP

(END) @END 0;JMP


r/Assembly_language • • 11d ago

Help Can someone help with a program?

4 Upvotes

I’m not good at assembly but I want to learn it and have been trying to make a program with it. The program is just supposed to square a number (read user input, multiply the input with itself, and print the result).

I’m on Linux and have no idea how to fully accomplish this. My biggest struggle is figuring out how to multiply the user input and work it into a write syscall. Help would be appreciated.


r/Assembly_language • • 11d ago

Question Embarking on OS-development, any tips?

13 Upvotes

My goal is to go through the strenuous journey of creating an entire operating system within x86 assembly, no higher level of programming language; just assembly.

This started as a hobby when I learned C a year back and ended up branching off and learning more about how C compiled to assembly and I have been doing handwritten compilation attempts of C on paper. This has ranged from typical notebook activity to as far as writing down these sequences of programming on spare receipt paper at my job during dead times on a shift. From time to time as my knowledge is practiced or when it drifts out of practice, I may tend to write out the opcodes in hexadecimal then write it additionally in binary just to feel a little bit less bored.

I ended up watching a few YouTube videos for being able to form something greater with the little bit of assembly and computing knowledge I have, and learned how to make my first boot loader with netwide assembler and QEMU!

This took 2 hours of comprehensive learning to figure out and be able to understand how to write it without the video. Was fun, but definitely need to move to the kernel work.

I do not have an incredible amount of knowledge in assembly despite my description of what I do in my free time, and so I ask; where can I look to find more resources or "hidden-gems" of knowledge regarding OS development?

Thanks!


r/Assembly_language • • 13d ago

My first day on assembly

Post image
211 Upvotes

Im raw dogging assembly

No python or some beta shi

Im going to do it like our forefathers

Wish me luck or dont

I will succeed either way.

EDIT: I am suppriesd at the positive support and helpful messages from this community. And now i carey your spirits to succeed i wont let you guys and your expectations down. Most importantly I wont betray myself.


r/Assembly_language • • 12d ago

Help Looking for resources to learn Assembly Language from absolute zero (Books, YouTube tutorials, tools/emulators)

34 Upvotes

I'm interested in learning assembly language purely out of curiosity and for the love of understanding how computers actually work beneath the software layer.

I have some basic Python programming knowledge, but I don't know C, C++ (learnt bare basic CPP recently to read a book but I won't consider it), or any assembly. I'm not looking to rush into systems programming or make this a career requirement. I want to explore it as a long-term learning hobby, understand how CPUs execute instructions, how memory and registers work, and eventually get comfortable reading and writing assembly.

I'm using an Apple Silicon Mac (M4 Pro), so I'm particularly interested in learning ARM64/AArch64 assembly, although I'm open to understanding x86-64 as well if there's a good reason to learn it.

I'd appreciate recommendations in three categories:

1. YouTube tutorials / video courses

  • Good beginner-friendly video series that start from absolute zero.
  • Courses that explain registers, memory, stack, instructions, addressing modes, calling conventions, etc.
  • Ideally, tutorials that explain what's happening inside the processor rather than just teaching syntax.

2. Books

  • Beginner-friendly books that don't assume prior knowledge of C or assembly.
  • Books that progressively introduce computer architecture, machine code, and assembly programming.
  • More advanced books worth keeping for the long term.

3. Tools, emulators and development environments

  • What assemblers, debuggers, simulators or emulators should I install on macOS?
  • Are there safe ways to experiment with assembly without directly interacting with or modifying actual hardware?
  • Would QEMU, CPU simulators, or virtual machines be useful?
  • What tools would you recommend for inspecting registers, memory, and instruction execution step by step?

I'm particularly interested in experimenting in an isolated environment. I don't want to accidentally damage my Mac or mess with its operating system while learning.

One more thing: Would you recommend learning some C before starting assembly, or is it perfectly reasonable to learn assembly directly and pick up C concepts along the way?

I'm not looking for a shortcut. I want to understand the machine from the ground up.

Any recommendations, learning paths, books, channels or personal experiences would be greatly appreciated.

Thanks 🫡

UPDATE: Does anyone have a roadmap to this.

UPDATE 2: Other Posts & replies in this sub reg same which I find interesting. ay update with more links as I find them

[If your memory was WIPED, how would you re-learn x86 assembly?](https://www.reddit.com/r/Assembly_language/comments/1rlq6ux/if_your_memory_was_wiped_how_would_you_relearn/)

https://www.reddit.com/r/Assembly_language/comments/1rx5cyi/where_can_i_learn_x8664_assembly/

Try Jeff Duntemann's Assembly Language Step by Step.

I learned from Ray Seyfarth's book on Windows/Linux assembly. It's pretty good, but you'll need the install the ebe IDE if you want to get the most out of it

[For those starting to learn Assembly - step-by-step, how to create a flight simulator for DOS](https://www.reddit.com/r/Assembly_language/comments/1wxda05/for_those_starting_to_learn_assembly/)

https://www.reddit.com/r/Assembly_language/comments/sp50sx/hello_i_really_want_to_learn_asm_but_i_am_not/

https://www.nandgame.com/
____

MartinAncher

•2y ago

I recommend Usborne's children's book: Machine Code for Beginners, which teaches you 6502 and Z80 machine code. These are simple 8-bit CPUs used in most of the micro computers of the 80's.

This is how most people have learned machine code, when you understand the simple principles here, you can move on to your desired architecture.

Machine Code for Beginners
____

Kalex8876

•2y ago

https://learnxinyminutes.com/docs/mips/

https://uweb.engr.arizona.edu/~ece369/Resources/spim/QtSPIM_examples.pdf

____

https://github.com/mschwartz/assembly-tutorial

___

https://www.felixcloutier.com/x86/

____

[I'm looking for a high level overview as to how Object Oriented Programming is "implemented"](https://www.reddit.com/r/Assembly_language/comments/1x5f916/im_looking_for_a_high_level_overview_as_to_how/)

____________

GPT Suggested books resources

3. These are tools worth investigating eventually:

ToolPurpose
GNU Assembler (GAS)Assemble programs
LLDBInspect registers, memory and execution
QEMUEmulate different architectures
GhidraDisassemble and analyse binaries
Compiler ExplorerSee how C/C++ becomes assembly
RipesVisually understand CPU execution

B. Reverse engineering and binary analysis

OrderBookPurpose and when to study
6Practical Reverse EngineeringConnect assembly, debugging, operating systems and reverse-engineering workflows.
7Reverse Engineering for BeginnersFree online resource for assembly, compilers, calling conventions and program behaviour across architectures.
8Practical Binary AnalysisExecutable formats, binary instrumentation, analysis tools and program behaviour at the binary level.

C. Malware analysis and exploitation

OrderBookPurpose and when to study
9Practical Malware AnalysisMalware-analysis methods and practical investigation in an isolated lab. Some examples and tools are dated.
10The Shellcoder's HandbookAdvanced exploitation concepts. Study after memory, assembly and operating systems. Older techniques need comparison with modern mitigations.

r/Assembly_language • • 12d ago

I created an assembly language and then a playground

12 Upvotes

Having nothing better to do recently, I developed a simple assembly language and an online playground for it. If anyone fancies having a play, please do: https://www.compassion-in-business.co.uk/learning/assembler.php


r/Assembly_language • • 12d ago

Need some suggestions !

0 Upvotes

I consider myself as slightly above from beginner. I can read assembly instructions fairly. My main motive was to learn how executables run under the hood from the perspective of cybersecurity. I did some crackmes challenges. They were easy to solve upto where anti-debugging, control-flow flattening, opaque predicates, api hashing, and more upto 1-3 difficulty rated. I got to know about packers and virtual instructions. I learned how packers operate to minimize the .exe size. I built my toy packer also which just compresses and stores the main executable sections with custom name. Forget about UPX, AsPACK, MEW11, i am unable to unpack even my own packer. Is this skill issue or do someone really gets stuck in this section ? I need some guidance, the last time i unpacked was upx after watching some youtube video because i was supposed to put breakpoint to tail jump... Suggestions are kindly welcomed.


r/Assembly_language • • 13d ago

How to create Z80 ASM games for TI-83+ Part 2

Thumbnail youtu.be
27 Upvotes

r/Assembly_language • • 12d ago

Help C to ASM

1 Upvotes

Hello everyone!

I am currently working on a side project where a python script takes a C source file and converts it into ASMx86_64 (Intel syntax) and I am just trying to find resources for type conversions without making some kind of script where I automate generating a program and compiling it for ASM in GCC.

Does a list like this exist? And if so, are there separate ones for Windows and Linux? (As I think there’s a difference, not completely sure)

Thanks, have a good one frens


r/Assembly_language • • 13d ago

Introducing Tech Haven Studios – An independent software studio building operating systems and AI projects

0 Upvotes

Hi everyone!
I’d like to introduce Tech Haven Studios, an independent software development studio where I’m working on several technology projects.
Our current projects include:
HavenDOS
A 32-bit operating system developed in C and x86 Assembly. It’s one of our main development projects.
MorrowOS
A desktop operating system project focused on creating a different desktop computing experience.
HavenAI
An experimental AI development project.
I’m building these projects independently and documenting the development process along the way.
I’m interested in connecting with other developers, operating system enthusiasts and people interested in independent software development.
I’d appreciate honest feedback, technical discussions and potential collaboration.
Website: https://techhavenstudios.lovable.app
Thanks for checking out the project!
Posted by the developer behind Tech Haven Studios.