11 March 2016 - Forum Rules
Started by redmagejoe, December 10, 2019, 03:09:14 AM
Quote from: redmagejoe on January 18, 2020, 04:29:02 PMI already NOPd them out in my gold fix IPS because nothing else seemed to point to that code. Is it fine for them to have been NOP'd? I didn't see any way that it could be used after all the branches basically got cut off from it, leaving those 7 bytes isolated. Let me know if I should revert those NOPs
Quote from: redmagejoe on January 18, 2020, 04:29:02 PMI'm currently mocking up a solution for spell experience/levels based on the example you provided here. Would you be so kind as to review it for errors?
0x0165CC|$05:$A5BC:B0 33 BCS $A5F1 ; if we hit the cap, don't increase level or experience----------------------------------------->>0x0165CE|$05:$A5BE:69 09 ADC #$09 ; base growth penalty
0x0165D7|$05:$A5C7:90 28 BCC $A5F1 ; not enough growth => no experience gain0x0165D9|$05:$A5C9:C8 INY ; offset for spell experience0x0165DA|$05:$A5CA:90 25 BCC $A5F1 ; if credit < penalty, no growth, otherwise grow by the remainder
Quote from: redmagejoe on January 18, 2020, 04:29:02 PMAlternatively, and my personal preference, we could ignore overflow protection here, call this part done, and focus on capping the counters $7CF3-$7CF6 and $7CF7-$7D36 to a number well below 255, say 200 ($C8). There's absolutely no benefit to having any of the counters that high since spells, skills, and stats can only increase by 1 per battle, and it is unnecessary to reach 200 to attain any of these increases.
0x0165C5|$05:$A5B5:B1 7E LDA ($7E),Y ; spell level0x0165C7|$05:$A5B7:AA TAX 0x0165C8|$05:$A5B8:E8 INX ; increase spell level0x0165C9|$05:$A5B9:20 6D A8 JSR $A86D ; cap X at 150x0165CC|$05:$A5BC:B0 33 BCS $A5F1 ; if we hit the cap, don't increase level or experience----------------------------------------->>0x0165CE|$05:$A5BE:69 0A ADC #$0A ; base growth penalty0x0165D0|$05:$A5C0:85 54 STA $54 ; total spell growth penalty (= spell level + 10)0x0165D2|$05:$A5C2:38 SEC 0x0165D3|$05:$A5C3:A5 53 LDA $53 ; total spell use credit0x0165D5|$05:$A5C5:E5 54 SBC $54 ; total spell growth penalty (= spell level + 10)0x0165D7|$05:$A5C7:C8 INY ; offset for spell experience0x0165D8|$05:$A5C8:90 25 BCC $A5F1 ; if credit < penalty, no growth, otherwise grow by the remainder0x0165DA|$05:$A5CA:18 CLC 0x0165DB|$05:$A5CB:71 7E ADC ($7E),Y ; spell experience0x0165DD|$05:$A5CD:C9 64 CMP #$64 0x0165DF|$05:$A5CF:90 1E BCC $A5EF ; if experience < 100, just update experience, otherwise increase lvl0x0165E1|$05:$A5D1:88 DEY ; offset for spell level^^^^^^^^^0x0165E2|$05:$A5D2:EA NOP0x0165E3|$05:$A5D3:8A TXA 0x0165E4|$05:$A5D4:91 7E STA ($7E),Y ; write the new spell level0x0165E6|$05:$A5D6:C8 INY ; offset for spell experience0x0165E7|$05:$A5D7:98 TYA 0x0165E8|$05:$A5D8:48 PHA ; save offset for spell experience0x0165E9|$05:$A5D9:A6 AD LDX $AD ; battle message index0x0165EB|$05:$A5DB:18 CLC 0x0165EC|$05:$A5DC:A5 00 LDA $00 ; counter for number of spell slots processed0x0165EE|$05:$A5DE:69 30 ADC #$30 ; spell IDs start at #$30 within character stat data0x0165F0|$05:$A5E0:A8 TAY ; offset for spell ID0x0165F1|$05:$A5E1:B1 7A LDA ($7A),Y ; spell ID0x0165F3|$05:$A5E3:38 SEC 0x0165F4|$05:$A5E4:E9 C0 SBC #$C0 0x0165F6|$05:$A5E6:9D BA 7F STA $7FBA,X ; start of list of string IDs battle messages0x0165F9|$05:$A5E9:E6 AD INC $AD ; battle message index0x0165FB|$05:$A5EB:68 PLA ; restore offset for spell experience0x0165FC|$05:$A5EC:A8 TAY 0x0165FD|$05:$A5ED:A9 00 LDA #$00 ; reset spell experience to 00x0165FF|$05:$A5EF:91 7E STA ($7E),Y ; write the new spell experience0x016601|$05:$A5F1:E6 44 INC $44 ; offset for current character's current spell slot use counter
0x03F005|$0F:$EFF5:F0 02 BEQ $EFF9 ; BNE $F000 would be better since then you could eliminate the following BCS0x03F007|$0F:$EFF7:B0 07 BCS $F000 ; cap party gold at 9,999,999; control flow target (from $EFF5)0x03F009|$0F:$EFF9:AD 1C 60 LDA $601C ; Party gold byte 00x03F00C|$0F:$EFFC:C9 80 CMP #$80 0x03F00E|$0F:$EFFE:90 0F BCC $F00F
Quote from: Leviathan Mist on January 19, 2020, 02:11:16 PMAre you planning to do anything about the ability to switch weapons mid-battle in order to level up different weapons? This is quite abusable if you start with shields and then switch to another weapon like swords after attacking a few times with the shields, as the game will apply all shield weapon exp to the swords at the end of battle.
; control flow target (from $ABBF, $ABE5, $AC5A)0x03AC95|$0E:$AC85:A9 42 LDA #$420x03AC97|$0E:$AC87:85 E0 STA $E00x03AC99|$0E:$AC89:A6 6E LDX $6E0x03AC9B|$0E:$AC8B:A5 80 LDA $800x03AC9D|$0E:$AC8D:0A ASL0x03AC9E|$0E:$AC8E:05 6E ORA $6E0x03ACA0|$0E:$AC90:A8 TAY0x03ACA1|$0E:$AC91:BD 0C 61 LDA $610C,X ; Character #1 Current MP low byte0x03ACA4|$0E:$AC94:18 CLC0x03ACA5|$0E:$AC95:F9 10 62 SBC $6210,Y ; Character #1 spell slot #1 level0x03ACA8|$0E:$AC98:9D 0C 61 STA $610C,X ; Character #1 Current MP low byte0x03ACAB|$0E:$AC9B:BD 0D 61 LDA $610D,X ; Character #1 Current MP high byte0x03ACAE|$0E:$AC9E:E9 00 SBC #$000x03ACB0|$0E:$ACA0:9D 0D 61 STA $610D,X ; Character #1 Current MP high byte0x03ACB3|$0E:$ACA3:B9 11 62 LDA $6211,Y ; Character #1 spell slot #1 experience0x03ACB6|$0E:$ACA6:18 CLC0x03ACB7|$0E:$ACA7:69 02 ADC #$020x03ACB9|$0E:$ACA9:C9 64 CMP #$640x03ACBB|$0E:$ACAB:B0 04 BCS $ACB10x03ACBD|$0E:$ACAD:99 11 62 STA $6211,Y ; Character #1 spell slot #1 experience0x03ACC0|$0E:$ACB0:60 RTS
; code -> free0x03FFDD|$0F:$FFCD:B9 10 62 LDA $6210,Y ; Character #1 spell slot #1 level0x03FFE0|$0F:$FFD0:C9 0E CMP #$0E0x03FFE2|$0F:$FFD2:AA TAX0x03FFE3|$0F:$FFD3:B0 03 BCS $FFD80x03FFE5|$0F:$FFD5:B9 11 62 LDA $6211,Y ; Character #1 spell slot #1 experience0x03FFE8|$0F:$FFD8:60 RTS
0x03ACB3|$0E:$ACA3:20 CD FF JSR $FFCD0x03ACB6|$0E:$ACA6:B0 09 BCS $ACB10x03ACB8|$0E:$ACA8:69 02 ADC #$02 0x03ACBA|$0E:$ACAA:C9 64 CMP #$64 0x03ACBC|$0E:$ACAC:B0 05 BCS $ACB30x03ACBE|$0E:$ACAE:99 11 62 STA $6211,Y ; Character #1 spell slot #1 experience0x03ACC1|$0E:$ACB1:60 RTS 0x03ACC1|$0E:$ACB1:EA NOP0x03ACC3|$0E:$ACB3:8A TXA0x03ACC4|$0E:$ACB4:18 CLC 0x03ACC5|$0E:$ACB5:69 01 ADC #$01 0x03ACC7|$0E:$ACB7:C9 10 CMP #$10 0x03ACC9|$0E:$ACB9:B0 08 BCS $ACC3 0x03ACCB|$0E:$ACBB:99 10 62 STA $6210,Y ; Character #1 spell slot #1 level0x03ACCE|$0E:$ACBE:A9 00 LDA #$00 0x03ACD0|$0E:$ACC0:99 11 62 STA $6211,Y ; Character #1 spell slot #1 experience0x03ACD3|$0E:$ACC3:60 RTS
Quote from: Cyneprepou4uk on January 19, 2020, 04:44:23 PMInstead of disabling weapon switching, you can add gained exp to the weapon you were using before it switches, and start counting exp for a new weapon from zero
Quote from: Jiggers on January 19, 2020, 08:32:04 PMThere's surely some unused RAM somewhere. FF2 does seem to make better use of it than FF1, so I'm not sure where... In FF1, a bunch of map stuff is reloaded after battle, but the battle part of the game never touches it, so it could be overwritten and nothing would change on the map when returning (actually I should double-check that a battle doesn't reset bats in dungeons...)In the code that backs up character stats before the battle begins, some of the player RAM might not be fully used. You could possibly save the starting weapon type there, then reference that at the end. If you start with a sword, switch to an axe... all the experience goes to the sword, still. Or would that just swap the issue? Start with a level 1 weapon, swap it in battle, and level it up faster by using the higher level weapon?
; level up Evasion0x01660B|$05:$A5FB:A9 7D LDA #$7D ; $7D37; Character #1 counter for times physically attacked by enemy0x01660D|$05:$A5FD:85 45 STA $45 0x01660F|$05:$A5FF:A9 37 LDA #$37 ; $7D37; Character #1 counter for times physically attacked by enemy0x016611|$05:$A601:85 44 STA $44 0x016613|$05:$A603:AD 37 AC LDA $AC37 ; base Evasion credit for being physically attacked0x016616|$05:$A606:85 46 STA $46 ; base credit amount for being attacked at all0x016618|$05:$A608:A0 30 LDY #$30 ; Skill offset for Evasion level0x01661A|$05:$A60A:84 47 STY $47 0x01661C|$05:$A60C:20 42 A8 JSR $A842 ; level up Evasion/Magic Resist if applicable; level up Magic Resist0x01661F|$05:$A60F:A9 7D LDA #$7D ; $7D3B; Character #1 counter for times magically attacked by enemy0x016621|$05:$A611:85 45 STA $45 0x016623|$05:$A613:A9 3B LDA #$3B ; $7D3B; Character #1 counter for times magically attacked by enemy0x016625|$05:$A615:85 44 STA $44 0x016627|$05:$A617:AD 38 AC LDA $AC38 ; base Magic Resist credit for being magically attacked0x01662A|$05:$A61A:85 46 STA $46 ; base credit amount for being attacked at all0x01662C|$05:$A61C:A0 32 LDY #$32 ; Skill offset for Magic Resist level0x01662E|$05:$A61E:84 47 STY $47 0x016630|$05:$A620:20 42 A8 JSR $A842 ; level up Evasion/Magic Resist if applicable
; level up Evasion/Magic Resist if applicable; control flow target (from $A60C, $A620)0x016852|$05:$A842:A4 9E LDY $9E ; Character index0x016854|$05:$A844:B1 44 LDA ($44),Y ; counter for times physically/magically attacked0x016856|$05:$A846:F0 24 BEQ $A86C ; no pain => no gain0x016858|$05:$A848:18 CLC 0x016859|$05:$A849:65 22 ADC $22 ; battle rank?0x01685B|$05:$A84B:65 46 ADC $46 ; base credit amount for being attacked at all0x01685D|$05:$A84D:A4 47 LDY $47 ; offset for Evasion/Magic Resist skill level, whichever one we're dealing with at the moment0x01685F|$05:$A84F:F1 7E SBC ($7E),Y ; Evasion/Magic Resist skill level0x016861|$05:$A851:E9 0A SBC #$0A ; your first 10 points don't count for anything0x016863|$05:$A853:90 17 BCC $A86C ; not enough pain => no gain0x016865|$05:$A855:C8 INY ; offset for Evasion/Magic Resist skill experience, whichever one we're dealing with at the moment0x016866|$05:$A856:71 7E ADC ($7E),Y ; Evasion/Magic Resist skill experience0x016868|$05:$A858:C9 64 CMP #$64 0x01686A|$05:$A85A:90 0E BCC $A86A ; if experience < 100, just update experience, otherwise increase level0x01686C|$05:$A85C:88 DEY ; offset for Evasion/Magic Resist skill level, whichever one we're dealing with at the moment0x01686D|$05:$A85D:B1 7E LDA ($7E),Y ; Evasion/Magic Resist skill level0x01686F|$05:$A85F:AA TAX 0x016870|$05:$A860:E8 INX ; level++0x016871|$05:$A861:20 6D A8 JSR $A86D ; cap X at 150x016874|$05:$A864:8A TXA 0x016875|$05:$A865:91 7E STA ($7E),Y ; save new Evasion/Magic Resist skill level0x016877|$05:$A867:C8 INY ; offset for Evasion/Magic Resist skill experience, whichever one we're dealing with at the moment0x016878|$05:$A868:A9 00 LDA #$00 ; reset experience to zero; control flow target (from $A85A)0x01687A|$05:$A86A:91 7E STA ($7E),Y ; save new Evasion/Magic Resist skill experience; control flow target (from $A846, $A853)0x01687C|$05:$A86C:60 RTS
; cap X at 15; control flow target (from $A5D0, $A861, $A97A)0x01687D|$05:$A86D:E0 10 CPX #$10 0x01687F|$05:$A86F:90 02 BCC $A873 0x016881|$05:$A871:A2 0F LDX #$0F ; control flow target (from $A86F)0x016883|$05:$A873:60 RTS
Replace each INC $7xxx,X with a JSR to separate routines, or same routine if some clever addressing can be worked out.0x031478|$0C:$9468:FE F3 7C INC $7CF3,X ; Character #1 physical attack counter0x031E68|$0C:$9E58:FE F7 7C INC $7CF7,X ; Character #1 spell slot #1 battle use counter0x031E75|$0C:$9E65:FE 3F 7D INC $7D3F,X ; Character #1 black magic use counter0x031E7A|$0C:$9E6A:FE 43 7D INC $7D43,X ; Character #1 white magic use counter0x03257B|$0C:$A56B:FE 37 7D INC $7D37,X ; Character #1 counter for times physically attacked by enemy0x03261D|$0C:$A60D:FE 3B 7D INC $7D3B,X ; Character #1 counter for times magically attacked by enemyBD F3 7C LDA $7CF3,X <<< this is the crux of whether we can use a single sub-routine or need 6C9 08 CMP #$C8 <<< cap counter at 200 so overflow won't happen in any scenarioB0 03 BCS +3FE F3 7C INC $7CF3,X <<< this too60 RTS
Quote from: redmagejoe on January 19, 2020, 08:41:11 PMis $7E merely acting as a pointer to the correct place?
QuoteAs I'm understanding more and more as I work with ASM and this game in particular, I find myself asking more pointed questions. It seems like this delay could be avoided altogether if instead of using indirect addressing in the STA ($7E),Y it used absolute addressing. Is there a reason, other than the extra byte needed, that we're not saving directly to the necessary values? Is there another step perhaps in "handing over" the value in $7E to its necessary memory location, or is $7E merely acting as a pointer to the correct place? What ramifications would there be in simply changing from indirect to absolute here? Would help if we actually knew what that absolute address was... Can't even tell from RAM mapping.
LDA CharacterNumber ; (0-3)ASL A ; double itTAXLDA CharacterPointerTable, X ; Gets $00, $40, $80, or $C0STA $7E ; becomes low byte of pointerLDA CharacterPointerTable+1, X ; gets $61STA $7F ; becomes high byte of pointer
Quote from: PresidentLeever on January 20, 2020, 07:30:20 PMFor improvements, would it be possible to group certain spells and weapons together to reduce grinding? This was done for Secret of Evermore for a reference. Another method could be to check a char's skill with a school of magic and make a new spell start at a higher level based on that. The other big thing would be the many trap rooms in dungeons, they suck.
Quote from: redmagejoe on January 19, 2020, 05:01:28 PMIt appears to work, though I wish I could figure out a way to squish it in.
org $3ACB3base $ACA3 LDA $6210,Y ; Character #1 spell slot #1 level CMP #$0F BCS done ; already at least level 16 => no change LDA $6211,Y ; Character #1 spell slot #1 experience ADC #$02 ; +2 spell experience; we know carry is clear CMP #$64 BCC up_exp ; new spell experience < 100 => just update spell experience LDA $6210,Y ; Character #1 spell slot #1 level ADC #$00 ; +1 spell level; we know carry is set STA $6210,Y ; Character #1 spell slot #1 level LDA #$00 ; reset spell experience to 0up_exp: STA $6211,Y ; Character #1 spell slot #1 experiencedone: RTS
Quote from: redmagejoe on January 19, 2020, 05:01:28 PM@abw I belive 0x03AB18 may be the start of the routine for swapping the positions of spells around in the menu, if you're still labeling.
Quote from: redmagejoe on January 19, 2020, 08:41:11 PMCurrent behavior is that the weapon you are wearing at the end of battle gets all the experience, regardless what you started with.
Quote from: redmagejoe on January 19, 2020, 08:41:11 PM@abw: Please see my previous post and this one and give your input. I know it's a lot to read, but I feel like I'm thriving with your support.
Quote from: Disch2 on January 20, 2020, 02:37:55 AMPS: Yes, this is Disch. Computer problems made my several years long "automatically sign me in" thing drop, I have no idea what my password is, and I can't reset it because I created the account like a decade ago and have no clue what email I used with it or even if I still have that email, so I had to make a new account
Quote from: redmagejoe on December 10, 2019, 03:09:14 AMThe middle two characters, Guy and Maria, are biased by the enemy targetting algorithm, taking significantly more enemy focus than Firion or Character #4. Investigate cause and improve RNG, which is likely the cause.
00:8100: A0 05 LDY #$05 ; loop counter00:8102: B9 88 88 LDA $8888,Y ; load base offset from table (put somewhere bytes 00 04 44 48 4C 50 and read them)00:8105: 18 CLC ; clear C for normal addition00:8106: 65 00 ADC $00 ; add player id for offset (don't know the actual address)00:8108: AA TAX ; put offset into X00:8109: BD F3 7C LDA $7CF3,X ; load value00:810C: C9 C8 CMP #$C8 ; compare to overflow00:810E: B0 03 BCS $8113 ; skip increasing00:8110: FE F3 7C INC $7CF3,X ; increase value00:8113: 88 DEY ; next check00:8114: 10 EC BPL $8102 ; repeat loop00:8116: 60 RTS ; if code is used as a subroutine
Page created in 0.339 seconds with 19 queries.