converting asmsh to gnu as

GO TO ADMIN PANEL > ADD-ONS AND INSTALL VERTIFORO SIDEBAR TO SEE FORUMS AND SIDEBAR

vbt

Staff member
Joined
Dec 16, 2001
Messages
5,198
Points
63
Age
42
i'm having some issues,
what would be the correct synthax
in original code :
move =$00f0,r0
in my code :
val1: .long 0x000000f0
mov.l val1,r0
in disassembled code :
! 10002: d0 05 mov.l 0x10018,r0 ! f0

assembler error :
maths.s:42: Error: negative offset
maths.s:42: Error: pcrel too far
just wondering if this is correct :
in original code :
cnop 0,4
jumptab
dc.l __ashiftrt_r0_0
dc.l __ashiftrt_r0_1
dc.l __ashiftrt_r0_2
dc.l __ashiftrt_r0_3
dc.l __ashiftrt_r0_4
in my code :
.align 4
jumptab:
.long __ashiftrt_r0_0
.long __ashiftrt_r0_1
.long __ashiftrt_r0_2
.long __ashiftrt_r0_3
.long __ashiftrt_r0_4
it references fonctions so is it correct to define longs for that ?
 

antime

Extra Hard Mid Boss
Joined
Jan 24, 2002
Messages
2,578
Points
48
Website
www.iki.fi
The move immediate instructions only support a positive offset, so the constant must be placed after the code that uses it. I don't know what the "cnop" directive is supposed to do, but otherwise it looks correct.
 
  • Like
Reactions: vbt

vbt

Staff member
Joined
Dec 16, 2001
Messages
5,198
Points
63
Age
42
The move immediate instructions only support a positive offset, so the constant must be placed after the code that uses it. I don't know what the "cnop" directive is supposed to do, but otherwise it looks correct.
thanks @antime it's assembled, it gives a new issue

saturn/maths.o: In function `jumptab':
(.text+0x100): undefined reference to `_ashiftrt_r0_0'
saturn/maths.o: In function `jumptab':
(.text+0x104): undefined reference to `_ashiftrt_r0_1'
saturn/maths.o: In function `jumptab':
(.text+0x108): undefined reference to `_ashiftrt_r0_2'
saturn/maths.o: In function `jumptab':
(.text+0x10c): undefined reference to `_ashiftrt_r0_3'
saturn/maths.o: In function `jumptab':
(.text+0x110): undefined reference to `_ashiftrt_r0_4'
saturn/maths.o: In function `jumptab':
(.text+0x114): undefined reference to `_ashiftrt_r0_5'
saturn/maths.o: In function `jumptab':
(.text+0x118): undefined reference to `_ashiftrt_r0_6'
saturn/maths.o: In function `jumptab':
(.text+0x11c): undefined reference to `_ashiftrt_r0_7'
collect2.exe: error: ld returned 1 exit status

i don't find these functions in gcc, maybe it was just in the old cygnus ?
the target of that asm lib was to improve speed of the original functions provided by the compiler for sh2.
 

antime

Extra Hard Mid Boss
Joined
Jan 24, 2002
Messages
2,578
Points
48
Website
www.iki.fi
There's a corresponding set of ___ashiftrt_r4_n functions in libgcc.a (both modern, and cygnus-2.7-96Q3). Renesas' toolchain uses a different ABI, so if your original assembly isn't for GCC you'll probably need to adapt it in places.
 

vbt

Staff member
Joined
Dec 16, 2001
Messages
5,198
Points
63
Age
42
well, thanks Antime, everything is assembled, i can't swear the replaced functions are really faster than modern gcc. I recompiled fba with these updates. here are the modified functions :

Address Names alphabetically
00000482 __ASHIFTRT_R4_0
0000047E __ASHIFTRT_R4_1
00000404 __ASHIFTRT_R4_10
000003F8 __ASHIFTRT_R4_11
000003EA __ASHIFTRT_R4_12
000003DC __ASHIFTRT_R4_13
000003CC __ASHIFTRT_R4_14
000003BC __ASHIFTRT_R4_15
000003B6 __ASHIFTRT_R4_16
000003AE __ASHIFTRT_R4_17
000003A4 __ASHIFTRT_R4_18
00000398 __ASHIFTRT_R4_19
0000047C __ASHIFTRT_R4_2
0000038C __ASHIFTRT_R4_20
0000037E __ASHIFTRT_R4_21
00000370 __ASHIFTRT_R4_22
00000360 __ASHIFTRT_R4_23
00000358 __ASHIFTRT_R4_24
0000034E __ASHIFTRT_R4_25
00000342 __ASHIFTRT_R4_26
00000334 __ASHIFTRT_R4_27
00000326 __ASHIFTRT_R4_28
00000316 __ASHIFTRT_R4_29
0000047A __ASHIFTRT_R4_3
00000306 __ASHIFTRT_R4_30
00000300 __ASHIFTRT_R4_31
00000300 __ASHIFTRT_R4_32
00000478 __ASHIFTRT_R4_4
00000476 __ASHIFTRT_R4_5
00000474 __ASHIFTRT_R4_6
00000472 __ASHIFTRT_R4_7
0000041A __ASHIFTRT_R4_8
00000410 __ASHIFTRT_R4_9
00000150 __ASHRSI3
00000000 __MULSI3
00000006 __SDIVSI3
00000028 __UDIVSI3

i will publish the version for gas, maybe there are still bugs (well, there are :) ), the asmsh version was bug free.
 
Top