Talk about development tools here
Moderator: BigEvilCorporation
ob1
Very interested
Posts: 468 Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France
Post
by ob1 » Tue Jan 23, 2007 4:15 pm
Finally,
I have found out an assembler that let me use the syntax I love :
for constants, no .text, or other, ...
On SegaXtreme, Saturn Dev, go to
http://www.segaxtreme.net/content/satdev/Tools.html
then SN Systems ASSH & ASMSH.
Use ASMSH
By the way, can anyone explain to me where these 2 syntaxes come from ?
ob1
Very interested
Posts: 468 Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France
Post
by ob1 » Mon Mar 12, 2007 8:34 am
ASMSH adds a silly header and appends a byte to the binary. I've written this tool to fix it :
Code: Select all
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char * argv[]) {
if (argc!=3) {
printf("usage : asmshfix file_to_fix file_fixed");
exit(0);
}
FILE *input = fopen(argv[1], "rb");
if (input==NULL) {
printf("Le fichier %s n'existe pas.\n", input);
exit(1);
}
FILE *output = fopen(argv[2], "wb");
if (output==NULL) {
printf("Impossible de créer le fichier %s.\n", output);
exit(1);
}
int i; // Current byte read
int n=0; // Current position in file
int size=0; // Size of file;
while ((i=fgetc(input)) != EOF) size++;
fclose(input);
input = fopen(argv[1], "rb");
while ((i=fgetc(input)) != EOF) {
if (n>=15 && n<size-1) {
fputc(i, output);
}
n++;
}
fclose(input);
fclose(output);
return 0;
}
ob1
Very interested
Posts: 468 Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France
Post
by ob1 » Tue Nov 03, 2015 11:11 pm
I use the asmsh.exe to assemble my SH2 ASM files.
Unfortunately, the .align directive padds with "0000" (Illegal instruction) and does not allows you to specify the padding value (.align alignment, value).
So, I've written this macro :
Code: Select all
ALIGN_NOP macro
.arepeat *%4/2
NOP
.aendr
endm
Then, just call "ALIGN_NOP" as an instruction.
Following instructions will be aligned with NOPs.
ob1
Very interested
Posts: 468 Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France
Post
by ob1 » Mon Feb 15, 2021 6:39 am
ob1 wrote: Mon Mar 12, 2007 8:34 am
ASMSH adds a silly header and appends a byte to the binary. I've written this tool to fix it :
or you could, you know, use "/p"