asmsh and shc

vbt

Staff member
Does someone have these two tools (asmsh and shc) ? I need them to compile/assemble some parts of SBL6. In fact I want to generate "strt1_g.o" and "strt2_g.o".

Or maybe how to assemble/compile those files with gasm and gcc
 

antime

Extra Hard Mid Boss
I believe those are the names of Hitachi's assembler and compiler. There's an old thread on the board from when TakaIsSilly tried to recompile SBL with GCC, maybe there's something there that can help you.
 

vbt

Staff member
Thanks but I found only that and I'm not good enough to solve my problem

Here is the code that give me some problems, there is also a C file but it crash at the link time because vars. are defined in this file :

Code:
	.SECTION P,CODE,ALIGN=4

	.IMPORT	__INIT

;

STACKPTR .EQU	H'060ffc00

;

	.EXPORT	START

START:

	MOV.L	STACKPTR_R,R0

	MOV.L	R0,R15

	MOV.L	AP_START_R,R0

	JMP	@R0

	NOP

;

	.ALIGN	4

AP_START_R:

	.DATA.L	__INIT

STACKPTR_R:

	.DATA.L	STACKPTR

;-----------------------------------------------------------------------

	.SECTION SEGA_D,DATA,ALIGN=4

	.SECTION SEGA_R,DATA,ALIGN=4

	.SECTION SEGA_B,DATA,ALIGN=4

	.SECTION SEGA_C,DATA,ALIGN=4

__SEGA_D_ROM	.DATA.L	(STARTOF D)	; section SEGA_D start address

__SEGA_D_BGN	.DATA.L	(STARTOF R)	; section SEGA_R start address

__SEGA_D_END	.DATA.L	(STARTOF R)+(SIZEOF R); section SEGA_R end address

;__SEGA_B_BGN	.DATA.L	(STARTOF B)	; section SEGA_B start address

;__SEGA_B_END	.DATA.L	(STARTOF B)+(SIZEOF B); section SEGA_B end address

__SEGA_B_BGN	.DATA.L	(STARTOF SEGA_B)

__SEGA_B_END	.DATA.L	(STARTOF SEGA_B)+(SIZEOF SEGA_B)

;

	.EXPORT	__SEGA_D_ROM

	.EXPORT	__SEGA_D_BGN

	.EXPORT	__SEGA_D_END

	.EXPORT	__SEGA_B_BGN

	.EXPORT	__SEGA_B_END

;-----------------------------------------------------------------------

	.SECTION D,DATA,ALIGN=4

	.SECTION R,DATA,ALIGN=4

	.SECTION B,DATA,ALIGN=4

	.SECTION C,DATA,ALIGN=4

__D_ROM	.DATA.L	(STARTOF D)	; section D start address

__D_BGN	.DATA.L	(STARTOF R)	; section R start address

__D_END	.DATA.L	(STARTOF R)+(SIZEOF R); section R end address

__B_BGN	.DATA.L	(STARTOF B)	; section B start address

__B_END	.DATA.L	(STARTOF B)+(SIZEOF B); section B end address

;

	.EXPORT	__D_ROM

	.EXPORT	__D_BGN

	.EXPORT	__D_END

	.EXPORT	__B_BGN

	.EXPORT	__B_END

;

	.END

;====== End of file ====================================================
 

RadSil

New Member
I was screwing around with rebuilding it a while back, but I lost interest and just used it prebuilt from the original archive... it worked fine with the newer gcc. I lost interest simply because I'm not good enough of a coder anyway to worry about optimization in a library still comprised of better code than I could probably write. Still, if you want to rebuild it, good luck. Most of the assembly code will rebuild with the syntax changes cited above in the forum link, but I never got a chance to see if my drop-in replacements actually worked properly.
 

vbt

Staff member
files compiled


just a like question, in OBJ section there was strt1_g.o and strt2_g.o ,now hey ae compiled but I noted that in the .lnk original file there is :

Code:
INPUT  ..\..\lib\strt1_h.obj

INPUT  ..\..\lib\strt2_h.obj

does it mean I have to compile those files ?
 

RadSil

New Member
I think the only way to tell for sure would be to link a program with the libraries that were built and see if you get linker errors. Though, most GCC objects don't end in *.obj, so maybe the "g" strt1_g.o and strt2_g.o is for GCC, and the "h" in strt1_h.obj and strt2_h.obj is for Hitachi (SHC)?

Pure speculation there. Try linking the libs as they compiled with a little program first, and report back if it fails
 

vbt

Staff member
I've linked the source code with those two objects with only few changes. (for instance replace of "ENDOF_B" by "__bend"). The prog. still work after adding thos objects but I have no idea on how to be sure their unctions are called, it tried to add a exit(0) without success. It seems that __INIT should be called before the main but it doesn't because i use a saturn.lnk which contains this :

SLSTART 0x06004000 :

{

___Start = .;

*(SLSTART)

}

and i use some calls of the SGL (slinitsystem, sltvon) with my own work area.o.

Does someone already make a prog without using SGL ? and how i can be sure the prog uses _INIT to boot instead of main ?
 

antime

Extra Hard Mid Boss
I believe that __INIT should be called in crt0 (the startup code), which then executes your main(). You'll have to include it in your linking stage manually if your makefile doesn't do it already (otherwise the compiler default one will be used).
 

vbt

Staff member
thanks for the help Antime
the entry point is redefined like this in the makefile and i never managed to make it working :

LDFLAGS = -T $(LOCATE_FILE) -e $(ENTRY_POINT) -nostartfiles

where ENTRY_POINT = START

and START = P,D,B(6010000) (found in lnk file)

when i try to compile with that I recieve errors and then i removed all of that to use std ldflags.
 

mrkotfw

Member
where would call _INIT? im making a MAKEFILE to fix this :/

/me doesnt know ASM
:puke: :huh :devil can you show me the MAKEFILE to compile strt1_g.o ?
 
Top