Sweet'n'Soft Waffles project.

Technical discussion for those interested in Supermodel development and Model 3 reverse engineering. Prospective contributors welcome. Not for end-user support.
Forum rules
Keep it classy!
  • No ROM requests or links.
  • Do not ask to be a play tester.
  • Do not ask about release dates.
  • No drama!
Post Reply
Vasiliy Familiya
Posts: 3
Joined: Tue Jan 30, 2024 11:40 am

Sweet'n'Soft Waffles project.

Post by Vasiliy Familiya »

Today I decided to sketch an in-game software converter for Metal Savior tilegfx data on a PPC ASM.

Code: Select all

MajorBytes: .incbin "first-5.rom5"
MinorBytes: .incbin "first-6.rom6"

4bppPlanarTo8bppLinear:
	li	r1,MinorBytes
	li	r2,MajorBytes
	mulli	r3,r0,8 ; R0 is an ID of tile to load, R3=tile data offset (in bytes)
	andi	r7,r0,3
	cmpi	r7,1
	ble	($a,PC)
	addi	r3,r3,-$10
	b	(6,PC)
	addi	r3,r3,$10 ; in the each 4 tile group the order of following is {2,3,0,1}
	add	r1,r1,r3
	add	r2,r2,r3
	addi	r4,r1,$20000
	addi	r5,r2,$20000
	li	r6,$f1000000
	<...>
	<...>
	slwi	r[i]X1[/i],r[i]X1[/i],3 ; loading a highest bit for current pixel
	slwi	r[i]X2[/i],r[i]X2[/i],2 ; third
	slwi	r[i]X3[/i],r[i]X3[/i],1 ; second
	add	r[i]X[/i],r[i]X3[/i],r[i]X4[/i] ; and combining all the result with lowest
	add	r[i]X[/i],r[i]X[/i],r[i]X2[/i]
	add	r[i]X[/i],r[i]X[/i],r[i]X1[/i]
	stbu	r[i]X8[/i],1(r6)
	bdnz	(,PC)
Does PPC have a bitwise instructions similar to m68k's btst DX, DY? In the graphics format, used by this Korean pirate hardware, the bits following from left to right inside each byte, are accords the certain pixel inside a 8px-wide line of tile.
Bart
Site Admin
Posts: 87
Joined: Tue Nov 07, 2023 5:50 am

Re: Sweet'n'Soft Waffles project.

Post by Bart »

I don't think there is an exact equivalent. I think the easiest way is just to shift right and test the LSB. You can use srw to do this then and with 1. You have 4x the number of registers to work with vs. M68K, so this should be no problem.

I thought rlwinm. would be useful but its shift count is constant. You can also mtcrf to a condition code field and then branch on the specific bit you want but again, the bit to test is a literal.

Here is an instruction set guide.
Vasiliy Familiya
Posts: 3
Joined: Tue Jan 30, 2024 11:40 am

Re: Sweet'n'Soft Waffles project.

Post by Vasiliy Familiya »

Is there a "light" assembler utilities with PPC support, which can build ASM file directly, without of object files intermediation, unlike GCC assembler?
Bart
Site Admin
Posts: 87
Joined: Tue Nov 07, 2023 5:50 am

Re: Sweet'n'Soft Waffles project.

Post by Bart »

Not that I know of. Everyone seems to use gas (gcc) these days. It’s really not too much of a burden to go through a .o file. Just use a Makefile and forget about it :)
Bart
Site Admin
Posts: 87
Joined: Tue Nov 07, 2023 5:50 am

Re: Sweet'n'Soft Waffles project.

Post by Bart »

There is this on GitHub but it’s very barebones. Maybe you can find something better. My guess is that in the 90’s there were some alternatives and perhaps they can still be found.
Vasiliy Familiya
Posts: 3
Joined: Tue Jan 30, 2024 11:40 am

Re: Sweet'n'Soft Waffles project.

Post by Vasiliy Familiya »

After I installed Assembler-ppc, what should I input to command prompt to build a source file using it?
Bart
Site Admin
Posts: 87
Joined: Tue Nov 07, 2023 5:50 am

Re: Sweet'n'Soft Waffles project.

Post by Bart »

Never used it. I assumed if you're doing assembly programming that figuring out an app shouldn't be a problem.
Post Reply