11 March 2016 - Forum Rules
Started by Jiggers, January 04, 2019, 05:36:47 AM
Quote from: Jiggers on October 30, 2020, 07:51:52 AMTerrible because its a bad idea, or because it would take me so long to do it?
Quote from: Jiggers on October 30, 2020, 07:51:52 AMColoring the numbers would be doable, though kind of annoying (maybe not as annoying as playing with the description strings more)... but its the comparing to old that I worry about. It would require... no, maybe I can simplify.
Quote from: Jiggers on October 30, 2020, 07:51:52 AMUpdate stats with To Be Unequipped item. Copy Damage, Accuracy, Critical, to tmp RAM. Do this in Bank E... don't want to touch the Update stats routine anymore.Update stats with To Be Equipped item.Compare Damage, Accuracy, Critical, to tmp RAM.Huh. Brain worky somehow. Yeah... I think... think I can do that? Weapon attribute bytes are $EB, $F3. Armor is $EE, $F6... oh no.
Quote from: Jiggers on October 30, 2020, 07:51:52 AMThe description box would need to be drawn first, but taller by 1 tile, so the equipment list can cover the top of the box. Otherwise, the box border will be green/pink as well for Damage and Defense. Is that acceptable?
Quote from: Jiggers on October 30, 2020, 07:51:52 AMFor removing, that's a plus for putting the To Be Unequipped item into the list. Slap a dot on there like so.Now press A on THAT one, it compares To Be Unequipped with To Be Equipped, matches, and then the < Equipment Bag # > window asks, "Remove? OPYes No" (I made a li'l glove.)That way its not popping up every time you press A...?
Quote from: Jiggers on October 30, 2020, 07:51:52 AMAhhh, writing posts while the other person edits, ain't it just the way.
Quote from: Jiggers on October 30, 2020, 07:51:52 AMI actually kinda dig that description-box-menu thing. You don't think that would mess with flow too much? Maybe its my FF14 experience kicking in again, but I just realized I've been striving to cut down the number of prompts as much as possible. The menus can be overwhelmingly ridiculous. When I'm in the Zone I don't want to be trifled with by Yesses and Nos. Except for the battle confirmation, which I need because I screw up the 4th character's turn so much.
Quote from: Jiggers on October 30, 2020, 07:51:52 AMOr would the menu be in the first Equip screen?
Quote from: Jiggers on October 30, 2020, 07:51:52 AMEquip - RemoveSkills - Get NekkedView Stats - Change Class Equip/Remove then puts the cursor where it is now, in the Right Hand/Left Hand/Bodyparts list... Skills, change the screen to your 4 skill slots. Get Nekked removes everything, updates screen...View Stats shows the screen without the cursor until you press a button again.Change Class... Well, that's a screen for another day, but would putting it here be okay?
Quote from: Jiggers on October 30, 2020, 07:51:52 AMSecondary Gold check--good idea! (I kind of thought it was already there...?)
Quote from: Jiggers on October 30, 2020, 07:51:52 AMBattle stuff--yeah, its still all kinds of bad there, sorry. I got them flashing again at least. I just updated sprite positioning and stone tile loading as well! Stat loading is weird, an Imp just ran away from my level 1 guys and my white mage keeps getting 3 hits in. I need to deep debug all that. I don't wanna...
@UpdateLoop: LDX mu_chan ; put current channel in X for indexing DEC ch_lenctr, X ; decrement the channel's len counter BNE @EnvStep ; if it's nonzero -- a note is still playing, so update the env pattern JSR Music_ChannelScore ; otherwise, the note is done (len expired), so do more score processing LDA ch_envpos, X ; put the env position in A (expected to be there in @UpdateVol) JMP @UpdateVol ; and jump ahead @EnvStep: ; if a note is still playing... update the env pattern LDA ch_envrate, X ; get the envelope rate CLC ADC ch_envrem, X ; add to it the remaining "fraction" STA ch_envrem, X ; and write that back as updated fraction CMP #8 ; check to see if fraction >= 8 (take another step) BCC @UpdateNext ; if not, no further work to be done for envelope. Skip ahead STA tmp ; otherwise (fraction >= 8), store fraction in tmp for later AND #7 ; isolate just the low bits (fraciton bits) STA ch_envrem, X ; and write those back as the channel's remaining fraction LDA tmp ; then get all the full value back from tmp LSR A ; right shift by 3 (removing fraction) LSR A LSR A CLC ADC ch_envpos, X ; and add that to the envelope position @UpdateVol: CMP #$20 ; check to see if the envelope position is >= $20 BCC :+ ; if it is... LDA #$1F ; ... cap it at $1F ($1F is maximum): STA ch_envpos, X ; write back as current env pos TAY ; then put in Y for indexing LDA ch_envptr, X ; copy the channel's env pointer to tmp STA tmp LDA ch_envptr+1, X STA tmp+1 LDA (tmp), Y ; then read the env byte to output STA ch_vol, X ; and record that as channel's output volume
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LUT for music envelope speeds [$B3B9 :: 0x373C9];;;; Values here are used as speeds for traversal through below envelope tables.;; Values are fixed point with 3 bits of fraction. IE: a speed of $0C would be ;; one and a half steps through the table every frame (3 steps every two frames);;;; Note that overflow when doing math with these values is not handled by the;; game, so none of these values should go above %11111000. That will ensure that;; the addition of the existing 'fraction' will never cause an overflow.lut_EnvSpeeds: .BYTE $80,$60,$40,$30,$20,$18,$10,$0C,$08,$06,$04,$03,$02,$01,$00,$00;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; LUTs for envelope patterns [$B3C9 :: 0x373D9];;;; These are 16 tables, each table consisting of 32 entries. These tables;; represent the envelope pattern that the channel is to take every note it plays.;; $0F is full volume, and $00 is silence. The speed at which the channel traverses;; these tables depends on their envelope rate, which is determined in part by;; the above lut (lut_EnvSpeeds). Once the channel reaches the end of the table, the;; last entry is sustained (infinitely repeated).;; Note that volume/envelope is only applicable to squares, as triangle has no volume;; control.lut_EnvPatterns: .BYTE $0F,$0F,$0E,$0E,$0D,$0D,$0C,$0C,$0B,$0B,$0A,$0A,$09,$09,$08,$08 ; pattern $E0 .BYTE $07,$07,$06,$06,$05,$05,$04,$04,$03,$03,$02,$02,$01,$01,$00,$00 ; gradual decay from F
ENV SPEED (ch_envrate) vv ENVELOPE DONE IN... VALUES PER FRAME 80 - 2 frames | 16 60 - 3 frames | 12 40 - 4 frames | 8 30 - 6 frames | 6 20 - 8 frames | 4 18 - 11 frames | 3 10 - 16 frames | 2 0C - 32 frames | 1, 2 FRAMES PER VALUE 08 - 32 frames | 1 06 - 52 frames | 2, 2, 1 04 - 64 frames (1 second+4 frames) | 2 03 - 83 frames | 3, 3, 2 02 - 128 frames (2 seconds+8 frames) | 4 01 - 256 frames (4 seconds+16 frames) | 8 00 - never moves |
@UpdateLoop: TAX ; LDX mu_chan ; put current channel in X for indexing DEC ch_notelength, X ; decrement the channel's len counter BNE @EnvStep ; if it's nonzero -- a note is still playing, so update the env pattern JSR Music_ChannelScore ; otherwise, the note is done (len expired), so do more score processing JMP @UpdateVol ; and jump ahead @EnvStep: ; if a note is still playing... update the env pattern ;; JIGS - this should save some cycles! CPX #CHAN_TRI BNE :+ JMP @UpdateNext ; Triangle channel does not use envelopes or volume control... : LDA ch_envelope_type, X BMI @XValuesPerFrame @XFramesPerValue: DEC ch_envelope_time, X ; decrease the frame-count timer before the next update BNE @UpdateNext ; no need to update volume yet then... so next channel! LDA ch_envelope_length, X AND #%00111111 ; remove legato/vibrato on bits STA ch_envelope_time, X ; get the length set earlier and save as the new timer LDA ch_envelope_position, X AND #%00111111 CMP #%00111111 ; see if the position is at max, and if so, leave it BCS @UpdateNext INC ch_envelope_position, X ; else, increase it by one BNE @UpdateVol @XValuesPerFrame: ; high bit is 0 LDA ch_envelope_position, X AND #%11000000 STA tmp ; backup these two bits LDA ch_envelope_position, X AND #%00111111 ; keep only the actual position bits CLC ADC ch_envelope_time, X ; add the distance per frame AND #%00111111 ; capping at #63 ORA tmp ; add back in the other bits STA ch_envelope_position, X ; and save @UpdateVol: LDA ch_envelope_position, X AND #%00111111 TAY ; then put in Y for indexing LDA ch_instrument, X ; instrument * Envelope pattern length AND #%00011111 LDX #ENVELOPE_LENGTH ; length of Envelope patterns (32) JSR MultiplyXA CLC ADC #<lut_EnvPatterns ; add the ROM address of the pattern table! STA tmp TXA ADC #>lut_EnvPatterns STA tmp+1 LDA (tmp), Y ; then read the env byte to output
@Resume: ;; First, update Square 1's regs to match output music data ;; The high bit of the output F-value is checked to see if the frequency has changed. ;; If there was no change, the frequency should not be written again because writing ;; to the last channel reg ($4003 for sq1) to change the freq resets the duty. If ;; this is done every frame, the sound would crackle something fierce. LDA CHAN_SQ1 + ch_freq+1 ; get high bit of output F-value BMI @Sq1_NoFreqChange ; if it's set, there's no change, so skip ahead ORA #$80 ; set high bit of freq to mark that it doesn't need to be updated STA CHAN_SQ1 + ch_freq+1 ; anymore AND #$07 ; JIGS - remove everything but frequency bits! STA $4003 ; output frequency LDA CHAN_SQ1 + ch_freq STA $4002 @Sq1_NoFreqChange: ; if the freq is not to be changed... LDA CHAN_SQ1 + ch_volume ; still update volume (same process as above) ORA #%00110000 STA $4000 LDA #%01111111 ; and disable sweep STA $4001 @Sq1_Done: ;; Now we update Sq2's regs. Since Sq2 is also used for some sound effects, we need ;; to skip this step if Sq2 is busy playing a sound effect. ;; ;; Square 1 is fixed to output 25% duty all the time (or 75% -- but that's audibly identical) ;; Square 2 on the other hand has no duty bits explicitly set, which means the envelope pattern ;; can also specify any duty cycle. If no duty bits are set in the envelope pattern, it ;; would be 12.5%. This is the case in the original game, as no duty bits in the envelope tables ;; are set. LDA sq2_sfx ; is sq2 currently playing sfx? BEQ @Sq2_Update ; if not, update it normally DEC sq2_sfx ; otherwise dec the sfx counter BNE @Sq2_Done ; if it's still not zero (still playing), skip sq2 updating completely ;LDA #$30 ;STA $4004 ; JIGS - set volume to 0 ;LDA #$80 ;STA CHAN_SQ2 + ch_freq+1 ;JMP @Sq2_FreqChange BEQ @Sq2_FreqChange ; otherwise, it's done, force an update to all sq2 regs (always branches) ; this ensures sq2 will resume playing music immediately, rather than ; waiting for the next note. @Sq2_Update: ; if not playing a sound effect... LDA CHAN_SQ2 + ch_freq+1 ; check high bit of F value BMI @Sq2_NoFreqChange ; if set... no freq change @Sq2_FreqChange: ORA #$80 ; then set high bit to mark that it doesn't need updating STA CHAN_SQ2 + ch_freq+1 ; and write it back AND #$07 ; remove high bit flag from F-value (not necessary) STA $4007 LDA CHAN_SQ2 + ch_freq ; output freq STA $4006 @Sq2_NoFreqChange: LDA CHAN_SQ2 + ch_volume ; get volume ORA #%00110000 ; disable length/decay. Don't set any duty bits (12.5% by default) STA $4004 ; output LDA #%01111111 STA $4005 ; disable sweep @Sq2_Done: ;; The same process one last time, but this time for the Triangle. ;; Triangle also has the high byte of the freq as $FF if it is to be silenced. ;; This is probably because the triangle has no volume control and thus can't be silenced ;; by just setting the volume to zero (even though that could work if coded that way -- but ;; whatever). LDA CHAN_TRI + ch_freq+1 ; Get high byte of freq BMI @Tri_HighBitSet ; if high bit of high byte set, skip ahead LDA #%10001111 ; otherwise, set linear counter to keep channel playing STA $4008 ; (keep it audible) LDA CHAN_TRI + ch_freq ; set the freq STA $400A LDA CHAN_TRI + ch_freq+1 STA $400B ORA #%10000000 STA CHAN_TRI + ch_freq+1 ; then set high bit to indicate freq doesn't need updating JMP @CheckHush @Tri_HighBitSet: ; if high bit was set CMP #$FF ; see if high byte = $FF BNE @CheckHush ; if not, do nothing LDA #%10000000 ; otherwise, silence the tri by setting the linear counter reload STA $4008 ; to zero. This will silence the tri on the next linear counter clock. @CheckHush: LDA MenuHush BNE @HushTri ; hush triangle if in menu LDA TriangleHush BPL @CheckUnhush ; skip hush triangle if high bit not set (song is not forcing half volume) @HushTri: JSR HushTriangle @CheckUnhush: LDA MenuHush BNE @Tri_Done ; skip unhushing if in menu LDA TriangleHush BMI @Tri_Done ; skip unhushing if high bit set JSR UnhushTriangle @Tri_Done: ;; JIGS - here we do MMC5 square stuff! LDA CHAN_SQ3 + ch_freq+1 ; get high bit of output F-value BMI @Sq3_NoFreqChange ; if it's set, there's no change, so skip ahead ORA #$80 ; set high bit of freq to mark that it doesn't need to be updated STA CHAN_SQ3 + ch_freq+1 ; anymore AND #$07 STA $5003 ; output frequency LDA CHAN_SQ3 + ch_freq STA $5002 @Sq3_NoFreqChange: ; if the freq is not to be changed... LDA CHAN_SQ3 + ch_volume ; get the output volume ORA #%00110000 ; set bits to disable length and decay, do not set duty STA $5000 ; output the volume/duty @Sq3_Done: LDA CHAN_SQ4 + ch_freq+1 ; get high bit of output F-value BMI @Sq4_NoFreqChange ; if it's set, there's no change, so skip ahead ORA #$80 ; set high bit of freq to mark that it doesn't need to be updated STA CHAN_SQ4 + ch_freq+1 ; anymore AND #$07 STA $5007 ; output frequency LDA CHAN_SQ4 + ch_freq STA $5006 @Sq4_NoFreqChange: ; if the freq is not to be changed... LDA CHAN_SQ4 + ch_volume ; get the output volume ORA #%00110000 ; set bits to disable length and decay, do not set duty STA $5004 ; output the volume/duty
LDA ch_envelope_position, X AND #%00111111 CMP #%00111111 ; see if the position is at max, and if so, leave it BCS @UpdateNext INC ch_envelope_position, X ; else, increase it by one BNE @UpdateVol
Page created in 0.066 seconds with 20 queries.