Page 1 of 2

SPASM Assembler

Posted: October 1st, 2012, 3:12 pm
by T-Shirt
I havent really seen any ASM stuff here yet but here is THE assembler
spasm034.zip
From the Read Me in the zip file:



spASM version 0.2 by Silpheed of Hitmen

The first release of my Playstation assembler


This assembler still has far to go before it's complete, but I am releasing
it now as I think its at a fairly usable state.

Spasm recognises all machine instructions, and several pseudo-instructions
too.

These are the pseudo-instructions it knows of:
b
la
li
nop
move
subi
subiu
beqz
bnez
bal

Also you are allowed to use 'lw', 'sw', 'lb' etc.. with labels, instead of
the usual offset(register). Eg. the following are all ok:

"lw t0, temp"
"lb a1, 1234(gp)"
"sh zero, $34(a1)"
"sw a1, buffer+$100"
"sb a2, $80100000"

It also recognises the following pseudo-pseudo-instructions :)

- leaving out the destination register for an instruction
eg. these produce the same code:

"addi a0,a0,1" and "addi a0,1"
"xor s1,s1,t1" and "xor s1,t1"

etc...

- putting an immediate value as the last argument to an instruction
that expects a register instead.
eg.

"or a0,a1,1" becomes "ori a0,a1,1"
"add sp,4" becomes "addi sp,sp,4"

etc...

As you can see above, spasm recognises the register names like "zero", "a0",
"sp", "gp", "t9" etc. You can also use the numbered type by putting an 'r'
in front like this: "r01", "R9", "r31" etc.

The following directives are allowed:

org
include source_file
incbin binary_file
dcb
db
dh
dw
equ ( or "=" )
align

The 'org' directive must come before any code in your source file, and is
only allowed once. If no org is found, the assembler will default to
$80010000.

The 'dcb' directive is used for allocating blocks of multiple bytes with
the same value - use "dcb number_of_bytes, value_of_bytes".

The 'align' directive is used to align code or data to word or half-word
boundaries... 'align 4' to make sure what follows is at a word-aligned
address, 'align 2' for a half-word aligned address.

The 'db' directive is also allowed to contain text, so things like this
are allowed:

Message db 7,"Hello World!",$0d,$A,0

The text must be enclosed in quotes (either ' or " is allowed).

The 'equ' directive is only allowed to represent numeric values, not text.
This means thing like this are ok:

printf equ $3f

blah = start+$30

but not this:

newadd equ addiu


The 'include' and 'incbin' directives are used to include other files into
your source. Filenames should not have quotes around them. At the moment
there is a limit of 16 "include" files, but no limit on "incbin" files.
You can have "include" directives in already included source files too.

Numbers can be hex or decimal, use '$' to denote a hex number. Mathematical
expressions are allowed in most places, but only simple ones at the moment.
They can only be of the form "x op y" where 'op' is either +,-,&,|,<< or >>.

Symbols can be up to 32 characters long, and contain A-Z, a-z and '_'. They
can also have an optional ':' at the end. Symbol names are case sensitive,
instructions/directives and register names are not.

I think that's most of what needs to be said, please email me with any
bugs you find or suggestions for new features.

- Silpheed/HITMEN

Re: spasm assembler

Posted: October 9th, 2012, 1:35 pm
by Gemini
That's not "the" assembler. PSY-Q has way better tools for doing assembly, and so goes GCC MIPS. spasm could have been useful 16 years ago, but now it's just an ancient piece of software.

Re: spasm assembler

Posted: October 9th, 2012, 4:53 pm
by Yuri^Cybdyn
i used spasm for IPL

Re: spasm assembler

Posted: October 10th, 2012, 12:24 am
by Gemini
Doesn't mean it's part of a decent standard anymore. The program is so ancient it doesn't even properly run on XP most of the times and it's permanently dead on even more recent platforms.

Re: spasm assembler

Posted: October 20th, 2012, 1:43 pm
by T-Shirt
I will concede that is not the only assembler or the best one. It was what I could get a hold of back in the day. Couldn't find PSY-Q so spasm got me where I wanted so I could tinker. I never had problems with it in XP.
(If I had my way there would be a simple IDE with built in emulator, not quite arduino simple.)

Ancient software? As far as software goes sure. Don't forget the PS1 is a rather ancient platform altogether so any dev suite (except maybe GCC if it is kept up) will be old. Is there any reason to code PS1 except nostalgia? The PS1 is so old I gave mine away. And there is the whole why bother with PS1 when a RasPi is far more capable.

The stuff I post is mostly to make sure what i have had in the past isn't lost to some part of the community that might be interested. Not like I turn a profit from spasm downloads or something.

Re: spasm assembler

Posted: October 25th, 2012, 7:41 am
by Xavi92
I agree with T-Shirt: almost everything about the PS1 is outdated nowadays. Psy-Q isn't an exception either, remember that it was made with old Windows 9x systems in mind. I appreciate your post, BTW - even if writing code directly in ASM isn't handy at all, I think we should make as much information about this console as possible available if we don't want it to lose it forever.

Re: SPASM Assembler

Posted: October 5th, 2016, 11:05 am
by sickle
Myself and others still use it occasionally. It has a few cranky little bugs but one or two things were written in spasm and it's standalone and tiny in a way that gcc/psyq just isn't :p

Re: SPASM Assembler

Posted: September 30th, 2017, 1:19 pm
by Someone
Here's nice modern alternative I found.
https://github.com/Kingcom/armips/

Re: SPASM Assembler

Posted: May 26th, 2020, 12:53 am
by MrBengali
Hi dudes,

Is there a version of spasm running on windows 64 bits ? As most of the command line apps, I was using this one fails on my computer. Thanks for the help!

I have found a new version of Silpheed Spasm called nv-spasm (by tails92). It has the main advantage to be compatible with Silpheed Spasm:

https://github.com/ColdSauce/psxsdk/tre ... ools/spasm

Unfortunately, I am unable to compile the file nor to find the .exe, anyone can help here ?

Thanks!

Re: SPASM Assembler

Posted: May 26th, 2020, 5:03 am
by Shadow
Don't use SPASM. It's outdated and the opcodes it uses are different from the MIPS opcodes.
+1 for ARMIPS. It's also a good one to use.

Re: SPASM Assembler

Posted: May 26th, 2020, 5:45 pm
by MrBengali
Thanks Shadow. I have tried ARMIPS from Kingcom, unfortunately my old code does not compile properly with this one. I will nevertheless try to switch to ARMIPS.

Re: SPASM Assembler

Posted: June 5th, 2020, 8:13 pm
by MrBengali
Hello,

One more question not exactly related to spasm but to assembler. I am looking for a good desassambler (command line or not) which is flexible and light. I was used to run some disasm before (I cannot remember the name except maybe the one by Antiloop) but I guess there are many some better alternative nowdays. Concretely, I would like to get something able to ouput something like this (I don't care about the header) in an external file.

Code: Select all

Type of exe            : PS-X EXE
Adress of text segment : $80010000
Size of text segment   : $0009A000
Program counter (pc)   : $800121F8
Adress of stack        : $801FFFF0
Size of stack          : $00000000


Adress     Instruction
---------------------------------------------------
80010000 : AC9D0000      sw    sp,[a0]
80010004 : 3C1D1F80      lui   sp,$1F80 (sp=$1F800000)
80010008 : 37BD0400      ori   sp,sp,$400
8001000C : 03E00008      jr    [ra]
80010010 : 00000000      nop
80010014 : 8C9D0000      lw    sp,[a0]
80010018 : 03E00008      jr    [ra]
8001001C : 00000000      nop
If by chance you do remember what (dis)assembler was able to produce that I would be pleased if you could provide
me with its name :)

Thanks m8.

Re: SPASM Assembler

Posted: June 6th, 2020, 2:50 am
by Dedok179
MrBengali wrote: June 5th, 2020, 8:13 pm Hello,

One more question not exactly related to spasm but to assembler. I am looking for a good desassambler (command line or not) which is flexible and light. I was used to run some disasm before (I cannot remember the name except maybe the one by Antiloop) but I guess there are many some better alternative nowdays. Concretely, I would like to get something able to ouput something like this (I don't care about the header) in an external file.

Code: Select all

Type of exe            : PS-X EXE
Adress of text segment : $80010000
Size of text segment   : $0009A000
Program counter (pc)   : $800121F8
Adress of stack        : $801FFFF0
Size of stack          : $00000000


Adress     Instruction
---------------------------------------------------
80010000 : AC9D0000      sw    sp,[a0]
80010004 : 3C1D1F80      lui   sp,$1F80 (sp=$1F800000)
80010008 : 37BD0400      ori   sp,sp,$400
8001000C : 03E00008      jr    [ra]
80010010 : 00000000      nop
80010014 : 8C9D0000      lw    sp,[a0]
80010018 : 03E00008      jr    [ra]
8001001C : 00000000      nop
If by chance you do remember what (dis)assembler was able to produce that I would be pleased if you could provide
me with its name :)

Thanks m8.
Hello. Maybe this?

Re: SPASM Assembler

Posted: June 6th, 2020, 4:55 pm
by Dedok179
NV-SPASM compiled

Re: SPASM Assembler

Posted: June 6th, 2020, 10:26 pm
by Shadow
MrBengali wrote: June 5th, 2020, 8:13 pm I am looking for a good desassambler
Ghidra with the Psy-Q signature plugin.

Re: SPASM Assembler

Posted: June 8th, 2020, 6:35 pm
by Secundo
I use this dissasembler slowR3KA(work on w10 64) which can export code dissasembled to txt

http://www.romhacking.net/utilities/1533/

Re: SPASM Assembler

Posted: June 10th, 2020, 4:34 am
by MrBengali
@all

Thanks for your answers. I gonna have a look. In the meantime, the name of the tool I was talking about has come out the shadows. It was Disasm1.0 (R3000 Dissambler) by Ole krause-Sparmann. If ever, you put your hand on this one, I would be interested.

Ok gonna try the others :)

Re: SPASM Assembler

Posted: June 11th, 2020, 11:36 pm
by Shadow
MrBengali wrote: June 10th, 2020, 4:34 am It was Disasm1.0 (R3000 Dissambler) by Ole krause-Sparmann.
I think I have a copy of that. Did you want it?

Re: SPASM Assembler

Posted: June 18th, 2020, 7:54 am
by MrBengali
Hi Shadow,

Yes please, it would be great! Thanks!

Re: SPASM Assembler

Posted: June 22nd, 2020, 5:44 pm
by Shadow
Hmm, I couldn't find that one but I did find this instead.
PsDis Version 1.2
Ps Disassembler v1.2 - by Yasushi Mugita
Oh!MAGICOM
Image