Page 1 of 1

Sweet'n'Soft Waffles project.

Posted: Tue Jan 30, 2024 12:06 pm
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.

Re: Sweet'n'Soft Waffles project.

Posted: Wed Jan 31, 2024 7:45 pm
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.

Re: Sweet'n'Soft Waffles project.

Posted: Fri Feb 16, 2024 9:05 am
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?

Re: Sweet'n'Soft Waffles project.

Posted: Sat Feb 17, 2024 3:10 pm
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 :)

Re: Sweet'n'Soft Waffles project.

Posted: Sat Feb 17, 2024 3:18 pm
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.

Re: Sweet'n'Soft Waffles project.

Posted: Thu Mar 07, 2024 7:36 am
by Vasiliy Familiya
After I installed Assembler-ppc, what should I input to command prompt to build a source file using it?

Re: Sweet'n'Soft Waffles project.

Posted: Thu Mar 07, 2024 11:39 pm
by Bart
Never used it. I assumed if you're doing assembly programming that figuring out an app shouldn't be a problem.