Omnimaga

Calculator Community => Casio Calculators => Topic started by: AngelFish on April 22, 2011, 03:19:58 am

Title: Prizm Assembler
Post by: AngelFish on April 22, 2011, 03:19:58 am
It's taken awhile, but we finally have a working assembler.  ;D

The Gnu Assembler, which has supported SuperH processors for some years has finally been compiled by Jonimus for Prizm use and was announced at the last HWCP. However, the syntax is a bit odd. After spending multiple hours playing around (read: me kicking my computer until it assembled correctly) with the assembler, we've finally managed to get it to properly assemble the binaries. Here are some examples of the syntax:

Code: [Select]
stc vbr,R1
mov.l bar,R2
mov.l bur,R3
bsr next
next: add R1,R2
mov.l R3,@-R2
sts pr,R4
.word 0x7408
.word 0xC301
nop
nop
nop
bar: .long 0x00000100
bur: .long 0x0000000B
nop
nop
nop
nop
/* comments*/

-----------------------
Assembled code:

0122
D205
D305
BFFF
321C
2236
042A
7408
C301
0009
0009
0009

0000 0100

0000 000B
0009
0009
0009
0009

Code: [Select]
stc.l sr,@-R15
mov #0x01,R9
mov #0x01,R10
add R8,R9
add R8,R10
mov #0x01,R13
Loop:
mov.l @R9+,R11
mov.l @R10+,R12
cmp/eq R11,R1
bt/s jump
add #0x29,r13
tst R13,R13
bt/s return
nop
bra jump
nop
jump:
nop
return:
nop
nop
/* Comment */

-------------
Assembled code:
4F03
E901
EA01
398C
3A8C
ED01
Loop:
6B96
6CA6
31B0
8D05
7D29
2DD8
8D03
0009
A000
0009
jump:
0009
return:
0009
0009


However, while it will assemble correctly under certain circumstances, it is extremely fussy about the quality of the code. As a general rule, if it throws a single error, no other portion of code will have assembled correctly. It's pretty much all or nothing. Also, the comments at the end are there because the assembler complains if they're not.

Happy hacking :)

sh3eb-elf-as.exe Assembler (http://jonimoose.net/calcstuff/prizm/)
Title: Re: Prizm Assembler
Post by: JonimusPrime on April 22, 2011, 04:16:46 am
You're welcome for that by the way. http://jonimoose.net/calcstuff/prizm/ has all the complete toolchain as well, along with some of my other prizm stuffs. Hopefully soon you won't need to manually edit g3a files and the toolchain will have everything to just spit one out for you.
Title: Re: Prizm Assembler
Post by: z80man on April 23, 2011, 02:14:52 am
Well it looks like my Super H assembler project isn't unneeded yet because the GNU version has a difficult syntax. I'm still trying to implement a very loose syntax with high level additions and such. But for the time this will work perfectly.
/me goes off to assemble his secret game

Title: Re: Prizm Assembler
Post by: TIfanx1999 on April 23, 2011, 08:08:39 am
Great work Jonimus! I'm very happy to hear that there is a working assembler for the Prizm available now. :)
Title: Re: Prizm Assembler
Post by: DJ Omnimaga on May 12, 2011, 05:42:40 pm
Great job!