/[projet1]/users/dbug/tests/g0blinish_music/mymplayer.s
Defence Force logotype

Diff of /users/dbug/tests/g0blinish_music/mymplayer.s

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1240 by dbug, Sun Dec 7 13:22:23 2014 UTC revision 1241 by dbug, Sun Dec 7 14:04:38 2014 UTC
# Line 16  Line 16 
16  ;              416 bytes - Used zero page addressing for the write buffers  ;              416 bytes - Used zero page addressing for the write buffers
17  ;              413 bytes - Reordered some of the depacking code to avoid refetching data multiple time  ;              413 bytes - Reordered some of the depacking code to avoid refetching data multiple time
18  ;              403 bytes - Moved the current register handling inside the UnpackRegister routine itself  ;              403 bytes - Moved the current register handling inside the UnpackRegister routine itself
19    ;              400 bytes - Exploited the fact that the ReadBits function clears the carry on exit
20    
21  #define _PlayerBuffer           $5900           ; .dsb 256*14 (About 3.5 kilobytes)  #define _PlayerBuffer           $5900           ; .dsb 256*14 (About 3.5 kilobytes)
22  #define _MusicData                      $6700           ; Musics are loaded in $67B0, between the player buffer and the redefined character sets  #define _MusicData                      $6700           ; Musics are loaded in $67B0, between the player buffer and the redefined character sets
# Line 32  Line 33 
33    
34  _start_zero_page_data  _start_zero_page_data
35  ; ---------------------------------  ; ---------------------------------
36  _DecodedByte            .dsb 1          ; Byte being currently decoded from the MYM stream  _DecodedByte                    .dsb 1          ; Byte being currently decoded from the MYM stream
37  _DecodeBitCounter       .dsb 1          ; Number of bits we can read in the current byte  _DecodeBitCounter               .dsb 1          ; Number of bits we can read in the current byte
38  _DecodedResult          .dsb 1          ; What is returned by the 'read bits' function  _DecodedResult                  .dsb 1          ; What is returned by the 'read bits' function
39    
40  _CurrentAYRegister      .dsb 1          ; Contains the number of the register being decoded      _CurrentAYRegister              .dsb 1          ; Contains the number of the register being decoded    
41    
42  _ptr_register_buffer  _ptr_register_buffer
43  _ptr_register_buffer_low        .dsb 1          ; Points to the low byte of the decoded register buffer  _ptr_register_buffer_low        .dsb 1          ; Points to the low byte of the decoded register buffer
44  _ptr_register_buffer_high       .dsb 1          ; Points to the high byte of the decoded register buffer, increment to move to the next register          _ptr_register_buffer_high       .dsb 1          ; Points to the high byte of the decoded register buffer, increment to move to the next register        
45    
46  _MusicResetCounter      .dsb 2          ; Contains the number of rows to play before reseting  _MusicResetCounter              .dsb 2          ; Contains the number of rows to play before reseting
47    
48  _CurrentFrame           .dsb 1          ; From 0 to 255 and then cycles... the index of the frame to play this vbl  _CurrentFrame                   .dsb 1          ; From 0 to 255 and then cycles... the index of the frame to play this vbl
49    
50  _PlayerVbl                      .dsb 1  _PlayerVbl                              .dsb 1          ; Swapped between 0 and 128 to address the start of the register buffer for this frame
51    
52  _FrameLoadBalancer      .dsb 1          ; We depack a new frame every 9 VBLs, this way the 14 registers are evenly depacked over 128 frames  _FrameLoadBalancer              .dsb 1          ; We depack a new frame every 9 VBLs, this way the 14 registers are evenly depacked over 128 frames
53  temp_value                      .dsb 1      ; temp  temp_value                              .dsb 1      ; temp
54  _50hzFlipFlop                   .dsb 1  _50hzFlipFlop                   .dsb 1
55  _PlayerRegCurrentValue  .dsb 1          ; For depacking of data  _PlayerRegCurrentValue  .dsb 1          ; For depacking of data
56    
57  _PlayerRegValues        .dsb 14         ; 14 values, each containing the value of one of the PSG registers  _PlayerRegValues                .dsb 14         ; 14 values, each containing the value of one of the PSG registers
58  ; ---------------------------------  ; ---------------------------------
59  _end_zero_page_data  _end_zero_page_data
60    
# Line 350  ReadNewRegisterValue Line 351  ReadNewRegisterValue
351          ldx _CurrentAYRegister                          ; Read new register value (variable bit count)          ldx _CurrentAYRegister                          ; Read new register value (variable bit count)
352          lda _PlayerRegBits,x          lda _PlayerRegBits,x
353          jsr _ReadBits          jsr _ReadBits
354          jmp WriteSingleValue          bcc WriteSingleValue
355    
356  ; Repeat the previous value of the register  ; Repeat the previous value of the register
357  RepeatLastRegisterValue  RepeatLastRegisterValue
# Line 390  DecompressWithOffset Line 391  DecompressWithOffset
391          lda #7          lda #7
392          jsr _ReadBits                                            jsr _ReadBits                                  
393          ; Compute wrap around offset...          ; Compute wrap around offset...
         clc  
394          tya          tya
395          adc _DecodedResult                                      ; between 0 and 255          adc _DecodedResult                                      ; between 0 and 255
396          sec          eor #128
         sbc #128                                                        ; -128  
397          sta temp_value          sta temp_value
398                                    
399          ; Read count (7 bits)          ; Read count (7 bits)

Legend:
Removed from v.1240  
changed lines
  Added in v.1241

  ViewVC Help
Powered by ViewVC 1.1.26