ソースを参照

move more variable from code segment to stack

ipatix 7 年 前
コミット
2e2fefdd04
共有1 個のファイルを変更した9 個の追加11 個の削除を含む
  1. 9
    11
      src/music/main_mixer.s

+ 9
- 11
src/music/main_mixer.s ファイルの表示

@@ -262,8 +262,7 @@ C_setup_channel_state_loop:
262 262
     /*
263 263
      * this stroes the buffer length to a backup location
264 264
      */
265
-    ADR     R0, hq_buffer_length
266
-    STR     R4, [R0]
265
+    STR     R4, [SP, #ARG_FRAME_LENGTH]
267 266
     /* init channel loop */
268 267
     LDR     R4, [SP, #ARG_PCM_STRUCT]           @ R4 = main work area pointer
269 268
     LDR     R0, [R4, #VAR_DEF_PITCH_FAC]        @ R0 = samplingrate pitch factor
@@ -445,15 +444,13 @@ C_skip_sample_loop_setup:
445 444
     .align  2
446 445
 hq_buffer:
447 446
     .word   hq_buffer_ptr
448
-hq_buffer_length:     @ TODO: Replace with variable on stack
449
-    .word   0xFFFFFFFF
450 447
 
451 448
     .arm
452 449
     .align  2
453 450
 
454 451
 C_mixing_setup:
455 452
         /* frequency and mixing loading routine */
456
-        LDR     R8, hq_buffer_length
453
+        LDR     R8, [SP, #ARG_FRAME_LENGTH]
457 454
         ORRS    R11, R11, R10, LSL#16           @ R11 = 00LL00RR
458 455
         BEQ     C_mixing_epilogue               @ volume #0 --> branch and skip channel processing
459 456
         /* normal processing otherwise */
@@ -540,10 +537,10 @@ C_mixing_setup:
540 537
 
541 538
         /* Somehow is neccesary for some games not to break */
542 539
     .if DMA_FIX==1
543
-        MOV    R0, #0
544
-        MOV    R1, #0
545
-        MOV    R2, #0
546
-        STMIA R9, {R0, R1, R2}
540
+        MOV     R0, #0
541
+        MOV     R1, #0
542
+        MOV     R2, #0
543
+        STMIA   R9, {R0, R1, R2}
547 544
     .endif
548 545
 
549 546
 C_select_highspeed_codepath:
@@ -582,7 +579,8 @@ C_fast_mixing_creation_loop:
582 579
             ADDS    R5, R5, #0x40000000         @ do that for 4 blocks
583 580
             BCC     C_fast_mixing_creation_loop
584 581
 
585
-        LDR     R8, hq_buffer_length
582
+        LDR     R8, [SP]                        @ restore R8 with the frame length
583
+        LDR     R8, [R8, #(ARG_FRAME_LENGTH + 0x8 + 0xC)]
586 584
 
587 585
 C_skip_fast_mixing_creation:
588 586
         MOV     R2, #0xFF000000                 @ load the fine position overflow bitmask
@@ -881,7 +879,7 @@ C_main_mixer_return:
881 879
 C_downsampler:
882 880
     LDR     R4, =0xFFF80035
883 881
     LDR     R5, =0x0034FFF8
884
-    LDR     R8, hq_buffer_length
882
+    LDR     R8, [SP, #ARG_FRAME_LENGTH]
885 883
     LDR     R9, [SP, #ARG_BUFFER_POS]
886 884
     LDR     R10, hq_buffer
887 885
     MOV     R11, #0xFF000000