Author Topic: Having trouble rewriting a PC sprite routine.  (Read 1247 times)

Mauron

  • Guru of Reason Emeritus
  • Errare Explorer (+1500)
  • *
  • Posts: 1763
  • Nu-chan
    • View Profile
    • Maurtopia
Having trouble rewriting a PC sprite routine.
« on: March 03, 2009, 03:24:29 am »
I'm trying to add a condition that loads one of two sets of data based on a memory value, and the new routine is working inconsistently. It also screws up the number of cats in Crono's room, and freezes with an orange screen when you talk to one of those cats. I've attached the patch I have so far.

This is my new code, which applies to Frog and Lucca.

Code: [Select]
Disassembly:
$C0/E846 E2 20 SEP #$20 A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envMxdizC HC:1132 VC:049 00 FL:58
$C0/E848 5A PHY A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envMxdizC HC:1138 VC:049 00 FL:58
$C0/E849 DA PHX A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envMxdizC HC:1144 VC:049 00 FL:58
$C0/E84A A9 7F LDA #$7F A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envMxdizC HC:1150 VC:049 00 FL:58
$C0/E84C 48 PHA A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envMxdizC HC:1156 VC:049 00 FL:58
$C0/E84D AB PLB A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envMxdizC HC:1162 VC:049 00 FL:58
$C0/E84E E0 40 6B CPX #$6B40 A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envMxdizC HC:1168 VC:049 00 FL:58
$C0/E851 B0 08 BCS $08    [$E85B] A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envMxdizC HC:1174 VC:049 00 FL:58
$C0/E853 AF 80 28 7E LDA $7E2880[$7E:2880] A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envMxdizC HC:1180 VC:049 00 FL:58
$C0/E857 C9 01 CMP #$01 A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envMxdizC HC:1186 VC:049 00 FL:58
$C0/E859 B0 1E BCS $1E    [$E879] A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envMxdizC HC:1192 VC:049 00 FL:58
$C0/E85B C2 20 REP #$20 A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envMxdizC HC:1204 VC:049 00 FL:58
$C0/E85D A9 00 00 LDA #$0000 A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1210 VC:049 00 FL:58
$C0/E860 48 PHA A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1216 VC:049 00 FL:58
$C0/E861 BF 00 00 D3 LDA $D30000,x[$D3:6B40] A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1222 VC:049 00 FL:58
$C0/E865 99 00 00 STA $0000,y[$7F:3820] A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1228 VC:049 00 FL:58
$C0/E868 68 PLA A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1234 VC:049 00 FL:58
$C0/E869 1A INC A A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1240 VC:049 00 FL:58
$C0/E86A 1A INC A A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1246 VC:049 00 FL:58
$C0/E86B E8 INX A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1252 VC:049 00 FL:58
$C0/E86C E8 INX A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1258 VC:049 00 FL:58
$C0/E86D C8 INY A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1264 VC:049 00 FL:58
$C0/E86E C8 INY A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1270 VC:049 00 FL:58
$C0/E86F C9 20 00 CMP #$0020 A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1276 VC:049 00 FL:58
$C0/E872 90 EC BCC $EC    [$E860] A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1282 VC:049 00 FL:58
$C0/E874 80 17 BRA $17    [$E88D] A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1288 VC:049 00 FL:58
$C0/E876 A9 00 00 LDA #$0000 A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1294 VC:049 00 FL:58
$C0/E879 48 PHA A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1300 VC:049 00 FL:58
$C0/E87A BF 00 00 D3 LDA $D30000,x[$D3:6B40] A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1306 VC:049 00 FL:58
$C0/E87E 99 00 00 STA $0000,y[$7F:3820] A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1312 VC:049 00 FL:58
$C0/E881 68 PLA A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1318 VC:049 00 FL:58
$C0/E882 1A INC A A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1324 VC:049 00 FL:58
$C0/E883 1A INC A A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1330 VC:049 00 FL:58
$C0/E884 E8 INX A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1336 VC:049 00 FL:58
$C0/E885 E8 INX A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1342 VC:049 00 FL:58
$C0/E886 C8 INY A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1348 VC:049 00 FL:58
$C0/E887 C8 INY A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1354 VC:049 00 FL:58
$C0/E888 C9 20 00 CMP #$0020 A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1360 VC:049 00 FL:58
$C0/E88B 90 EC BCC $EC    [$E879] A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1366 VC:049 00 FL:58
$C0/E88D 7A PLY A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1372 VC:049 00 FL:58
$C0/E88E FA PLX A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1378 VC:049 00 FL:58
$C0/E88F AB PLB A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1384 VC:049 00 FL:58
$C0/E890 98 TYA A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1390 VC:049 00 FL:58
$C0/E891 18 CLC A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1396 VC:049 00 FL:58
$C0/E892 69 20 00 ADC #$0020 A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1402 VC:049 00 FL:58
$C0/E895 8D 81 21 STA $2181  [$7F:2181] A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1408 VC:049 00 FL:58
$C0/E898 A4 C5 LDY $C5    [$00:01C5] A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1414 VC:049 00 FL:58
$C0/E89A 60 RTS A:6B7F X:6B40 Y:3820 D:0100 DB:7F S:06F6 P:envmxdizC HC:1420 VC:049 00 FL:58

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: Having trouble rewriting a PC sprite routine.
« Reply #1 on: March 03, 2009, 02:54:29 pm »
What's the practical application of the new sprite routine Mauron? Would it be something like loading an entirely different sprite with associated animations and assembly based on the memory value? Like having the game engine load Lucca, but being able to switch to pulling data for Frog's sprites when it would otherwise load Lucca?

Mauron

  • Guru of Reason Emeritus
  • Errare Explorer (+1500)
  • *
  • Posts: 1763
  • Nu-chan
    • View Profile
    • Maurtopia
Re: Having trouble rewriting a PC sprite routine.
« Reply #2 on: March 03, 2009, 05:40:43 pm »
What's the practical application of the new sprite routine Mauron? Would it be something like loading an entirely different sprite with associated animations and assembly based on the memory value? Like having the game engine load Lucca, but being able to switch to pulling data for Frog's sprites when it would otherwise load Lucca?

That's almost exactly what it's doing. It checks the value of the part of the sprite being loaded, and if it's in Frog's range, then checks the memory value. If the memory value is 1, it loads graphics from a different bank. Right now I have it set to Ayla's for testing, but that could be changed to part of an expanded ROM with fresh graphics (I was thinking human Glenn, if this works). I still have to rewrite the sprite assembly and palette loading routines.

Lucca is affected because her sprites are located in the same area of the ROM as Frog's, and thus are loaded by the same routine.

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: Having trouble rewriting a PC sprite routine.
« Reply #3 on: March 03, 2009, 05:47:42 pm »
Holy cow, that is awesome!! Technically speaking, I guess you could up the character limit in a single ROM to 14 characters if you get this working, but techs and weapons would have to be shared between the characters loaded from different banks. A Frog-to-Glenn scenario (or a Glenn-to-Frog scenario...) would probably be a natural hack springing from this.

Mauron

  • Guru of Reason Emeritus
  • Errare Explorer (+1500)
  • *
  • Posts: 1763
  • Nu-chan
    • View Profile
    • Maurtopia
Re: Having trouble rewriting a PC sprite routine.
« Reply #4 on: March 03, 2009, 06:12:33 pm »
While it would be possible to get to 14, it wouldn't work be as smooth as just a Frog-to-Glenn thing, partly because with just him I could easily add a couple more changes to load a second set of tech pointers, so Slurp and Slurp Cut would be replaced with something more appropriate.

Edit: I think the modified sprite assembly routine is working. It's creating a garbled mess, but that would be normal if the sprite assembly doesn't match correctly.
« Last Edit: March 04, 2009, 02:58:22 pm by Mauron »