SPASM Assembler

Confidential documents, images and information by Sony and miscellaneous hackers for the PlayStation 1
T-Shirt
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
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
You do not have the required permissions to view the files attached to this post.

User avatar
Gemini
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
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
Gemini
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.

T-Shirt
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.

Xavi92
C Programming Expert
C Programming Expert
Posts: 128
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
sickle
C Programming Expert
C Programming Expert
Posts: 229
Joined: July 17th, 2013, 9:32 pm
I am a: Chocolate-fueled pug fetish robot.
Location: Scotland

Re: SPASM Assembler

Post by sickle » 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
Someone
Curious PSXDEV User
Curious PSXDEV User
Posts: 20
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.
https://github.com/Kingcom/armips/

User avatar
MrBengali
Curious PSXDEV User
Curious PSXDEV User
Posts: 18
Joined: May 22nd, 2020, 4:08 am

Re: SPASM Assembler

Post by MrBengali » May 26th, 2020, 12:53 am

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!

User avatar
Shadow
Admin / PSXDEV
Admin / PSXDEV
Posts: 2393
Joined: December 31st, 2012, 5:37 pm
PlayStation Model: H2000/5502

Re: SPASM Assembler

Post by Shadow » May 26th, 2020, 5:03 am

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.
Development Console: SCPH-5502 with 8MB RAM, MM3 Modchip, PAL 60 Colour Modification (for NTSC), PSIO Switch Board, DB-9 breakout headers for both RGB and Serial output and an Xplorer with CAETLA 0.34.

PlayStation Development PC: Windows 98 SE, Pentium 3 at 400MHz, 128MB SDRAM, DTL-H2000, DTL-H2010, DTL-H201A, DTL-S2020 (with 4GB SCSI-2 HDD), 21" Sony G420, CD-R burner, 3.25" and 5.25" Floppy Diskette Drives, ZIP 100 Diskette Drive and an IBM Model M keyboard.

User avatar
MrBengali
Curious PSXDEV User
Curious PSXDEV User
Posts: 18
Joined: May 22nd, 2020, 4:08 am

Re: SPASM Assembler

Post by MrBengali » May 26th, 2020, 5:45 pm

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.

User avatar
MrBengali
Curious PSXDEV User
Curious PSXDEV User
Posts: 18
Joined: May 22nd, 2020, 4:08 am

Re: SPASM Assembler

Post by MrBengali » 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.

User avatar
Dedok179
Active PSXDEV User
Active PSXDEV User
Posts: 70
Joined: June 11th, 2015, 7:23 pm
I am a: Programmer, Developer.
PlayStation Model: SCPH-5502
Location: Tula,RU

Re: SPASM Assembler

Post by Dedok179 » June 6th, 2020, 2:50 am

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

User avatar
Dedok179
Active PSXDEV User
Active PSXDEV User
Posts: 70
Joined: June 11th, 2015, 7:23 pm
I am a: Programmer, Developer.
PlayStation Model: SCPH-5502
Location: Tula,RU

Re: SPASM Assembler

Post by Dedok179 » June 6th, 2020, 4:55 pm

NV-SPASM compiled
You do not have the required permissions to view the files attached to this post.

User avatar
Shadow
Admin / PSXDEV
Admin / PSXDEV
Posts: 2393
Joined: December 31st, 2012, 5:37 pm
PlayStation Model: H2000/5502

Re: SPASM Assembler

Post by Shadow » June 6th, 2020, 10:26 pm

MrBengali wrote:
June 5th, 2020, 8:13 pm
I am looking for a good desassambler
Ghidra with the Psy-Q signature plugin.
Development Console: SCPH-5502 with 8MB RAM, MM3 Modchip, PAL 60 Colour Modification (for NTSC), PSIO Switch Board, DB-9 breakout headers for both RGB and Serial output and an Xplorer with CAETLA 0.34.

PlayStation Development PC: Windows 98 SE, Pentium 3 at 400MHz, 128MB SDRAM, DTL-H2000, DTL-H2010, DTL-H201A, DTL-S2020 (with 4GB SCSI-2 HDD), 21" Sony G420, CD-R burner, 3.25" and 5.25" Floppy Diskette Drives, ZIP 100 Diskette Drive and an IBM Model M keyboard.

Secundo
Interested PSXDEV User
Interested PSXDEV User
Posts: 6
Joined: April 20th, 2020, 3:41 am

Re: SPASM Assembler

Post by Secundo » June 8th, 2020, 6:35 pm

I use this dissasembler slowR3KA(work on w10 64) which can export code dissasembled to txt

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

User avatar
MrBengali
Curious PSXDEV User
Curious PSXDEV User
Posts: 18
Joined: May 22nd, 2020, 4:08 am

Re: SPASM Assembler

Post by MrBengali » June 10th, 2020, 4:34 am

@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 :)

User avatar
Shadow
Admin / PSXDEV
Admin / PSXDEV
Posts: 2393
Joined: December 31st, 2012, 5:37 pm
PlayStation Model: H2000/5502

Re: SPASM Assembler

Post by Shadow » June 11th, 2020, 11:36 pm

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?
Development Console: SCPH-5502 with 8MB RAM, MM3 Modchip, PAL 60 Colour Modification (for NTSC), PSIO Switch Board, DB-9 breakout headers for both RGB and Serial output and an Xplorer with CAETLA 0.34.

PlayStation Development PC: Windows 98 SE, Pentium 3 at 400MHz, 128MB SDRAM, DTL-H2000, DTL-H2010, DTL-H201A, DTL-S2020 (with 4GB SCSI-2 HDD), 21" Sony G420, CD-R burner, 3.25" and 5.25" Floppy Diskette Drives, ZIP 100 Diskette Drive and an IBM Model M keyboard.

User avatar
MrBengali
Curious PSXDEV User
Curious PSXDEV User
Posts: 18
Joined: May 22nd, 2020, 4:08 am

Re: SPASM Assembler

Post by MrBengali » June 18th, 2020, 7:54 am

Hi Shadow,

Yes please, it would be great! Thanks!

User avatar
Shadow
Admin / PSXDEV
Admin / PSXDEV
Posts: 2393
Joined: December 31st, 2012, 5:37 pm
PlayStation Model: H2000/5502

Re: SPASM Assembler

Post by Shadow » June 22nd, 2020, 5:44 pm

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
You do not have the required permissions to view the files attached to this post.
Development Console: SCPH-5502 with 8MB RAM, MM3 Modchip, PAL 60 Colour Modification (for NTSC), PSIO Switch Board, DB-9 breakout headers for both RGB and Serial output and an Xplorer with CAETLA 0.34.

PlayStation Development PC: Windows 98 SE, Pentium 3 at 400MHz, 128MB SDRAM, DTL-H2000, DTL-H2010, DTL-H201A, DTL-S2020 (with 4GB SCSI-2 HDD), 21" Sony G420, CD-R burner, 3.25" and 5.25" Floppy Diskette Drives, ZIP 100 Diskette Drive and an IBM Model M keyboard.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest