Creating ASM routines

How do I take an asm routine written in plain text and convert it into object code that can be put into the game? I have devkitARM, but I am not sure what compile commands/options I should be using.

Set the tool correctly and write your .bat for the work. Read the UT.

Dang Gryz is getting serious.
The third coming is coming.


The third coming of what? Uber ASM Wizards? Who were the first two?

(I’m not super versed in the super ASM wizards lore, though I’d know most of the old people by lurking old threads on SF.)

I might be dead wrong, but I’m thinking Nintenlord and Zeld for the two wizards.

This is nice and all, but none of it answers the question

Me, use a script I had to edit that came with I think it was cam’s asm routines.

@echo off

SET startDir=C:\devkitPro\devkitARM\bin\

@rem Assemble into an elf
SET as="%startDir%arm-none-eabi-as.exe"
%as% -g -mcpu=arm7tdmi -mthumb-interwork %1 -o "%~n1.elf"

@rem Print symbol table
SET readelf="%startDir%arm-none-eabi-readelf.exe"
%readelf% -s "%~n1.elf" > "%~n1.symbols.log"

@rem Extract raw assembly binary (text section) from elf
SET objcopy="%startDir%arm-none-eabi-objcopy.exe"
%objcopy% -S "%~n1.elf" -O binary "%~n1.dmp"

echo y | del "%~n1.elf"

That’s a start, you may need to change the start directory and some of the called files. Drag your code onto it, then read the compiler errors because code is never right the first time.

1 Like

Interesting, I had no idea the Ultimate Tutorial added a chapter on asm hacking.

A similar script can be downloaded from the Ultimate Tutorial, but it’s not compatible with the newest version of devkitARM (the names of the executable files are different). The script you posted works with current devkitARM.

Yeah, this should make hacking easier. Before, I was manually constructing THUMB instructions by looking up the instruction definitions and writing down 0’s and 1’s on a piece of paper. It was awful.

Well, welcome to the wonderful world of automation! You lose some power by letting a program do it for you, but it saves time and energy this way. Plus, if you feel like you want to reeeeealy optimize something, you can always re-write opcodes manually.

I also did that at once.