SPASM Assembler

Confidential documents, images and information by Sony and miscellaneous hackers for the PlayStation 1
Post Reply
Interested PSXDEV User
Interested PSXDEV User
Posts: 8
Joined: September 30th, 2012, 4:47 am

SPASM Assembler

Post by T-Shirt » October 1st, 2012, 3:12 pm

I havent really seen any ASM stuff here yet but here is THE assembler
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

These are the pseudo-instructions it knows of:

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"


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

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


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:

include source_file
incbin binary_file
equ ( or "=" )

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

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
You do not have the required permissions to view the files attached to this post.

User avatar
Active PSXDEV User
Active PSXDEV User
Posts: 44
Joined: February 14th, 2012, 4:35 am

Re: spasm assembler

Post by Gemini » October 9th, 2012, 1:35 pm

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.

User avatar
Cybdyn Systems
Cybdyn Systems
Posts: 405
Joined: January 13th, 2012, 1:56 am
I am a: Embedded Developer (MCU & FPGA)
PlayStation Model: 5502
Location: Belarus (Minsk)

Re: spasm assembler

Post by cybdyn » October 9th, 2012, 4:53 pm

i used spasm for IPL

User avatar
Active PSXDEV User
Active PSXDEV User
Posts: 44
Joined: February 14th, 2012, 4:35 am

Re: spasm assembler

Post by Gemini » October 10th, 2012, 12:24 am

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.

Interested PSXDEV User
Interested PSXDEV User
Posts: 8
Joined: September 30th, 2012, 4:47 am

Re: spasm assembler

Post by T-Shirt » October 20th, 2012, 1:43 pm

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.

C Programming Expert
C Programming Expert
Posts: 126
Joined: October 6th, 2012, 12:53 am

Re: spasm assembler

Post by Xavi92 » October 25th, 2012, 7:41 am

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.

User avatar
C Programming Expert
C Programming Expert
Posts: 169
Joined: July 17th, 2013, 9:32 pm
I am a: Chocolate-fueled pug fetish robot.
Location: Scotland

Re: SPASM Assembler

Post by sicklebrick » October 5th, 2016, 11:05 am

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

User avatar
Curious PSXDEV User
Curious PSXDEV User
Posts: 19
Joined: August 7th, 2016, 11:40 pm
I am a: ROM hacker hobbyist
Want to Find: Interesting info about PS1

Re: SPASM Assembler

Post by Someone » September 30th, 2017, 1:19 pm

Here's nice modern alternative I found.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest