Browse Source

move more variable from code segment to stack

ipatix 7 years ago
parent
commit
2e2fefdd04
1 changed files with 9 additions and 11 deletions
  1. 9
    11
      src/music/main_mixer.s

+ 9
- 11
src/music/main_mixer.s View File

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