Annotation of doom/dspbase.gas, revision 1.1

1.1     ! root        1: _dspbase::
        !             2:  .dsp
        !             3:  .org $f1b000
        !             4: 
        !             5: 
        !             6: RISC_FLAGS     .equ    $f1a100
        !             7: MODMASK                        .equ    $f1a118
        !             8: DIVCONTROL             .equ    $f1a11c
        !             9: 
        !            10: ;MAIN_STACK            .equ    $f1d000
        !            11: MAIN_STACK     .equ    $f1ce00
        !            12: PERM_DATA              .equ    $f1ce00
        !            13: LOADPOINT              .equ    $f1b140
        !            14: 
        !            15: _soundbuffer   ==              $1f0000
        !            16: 
        !            17: R_DAC                  .equ    $f1a148 
        !            18: L_DAC                  .equ    $f1a14c
        !            19: 
        !            20: ;=============================================================================
        !            21: 
        !            22: S_LE   .ccdef  $14     ; PL
        !            23: U_LE   .ccdef  $04     ; CC
        !            24: S_GT    .ccdef $18     ; MI
        !            25: U_GT    .ccdef $08     ; CS
        !            26: 
        !            27: S_LT   .ccdef  $15             ; PL+NE
        !            28: U_LT   .ccdef  $05             ; CC+NE
        !            29: 
        !            30: FP                     .equr r14
        !            31: scratch        .equr r10
        !            32: scratch2       .equr r11
        !            33: RETURNVALUE .equr r29
        !            34: RETURNPOINT .equr r28
        !            35: MATH_A                 .equr r27
        !            36: MATH_B                 .equr r26
        !            37: MATH_C                 .equr r25
        !            38: MATH_RTS       .equr r24
        !            39: MATH_SIGN      .equr r23
        !            40: 
        !            41: ;==============================================================================
        !            42:        
        !            43:        nop
        !            44:        nop
        !            45:        nop
        !            46:        nop
        !            47:        nop
        !            48:        nop
        !            49:        nop
        !            50:        nop
        !            51:        
        !            52: ALT_RISC_FLAGS .equr   r13
        !            53: ALT_FLAGSTEMP  .equr   r14
        !            54: ALT_PCTEMP             .equr   r15
        !            55: ALT_SAMPLECOUNT_P      .equr   r16
        !            56: ALT_SCRATCH            .equr   r17
        !            57: ALT_LDAC               .equr   r18
        !            58: ALT_RDAC               .equr   r19
        !            59: ALT_STACKRESET .equr   r20
        !            60: ALT_SAMPLE_P   .equr   r21
        !            61: ALT_SAMPLE             .equr   r22
        !            62: ALT_SAMPLECOUNT        .equr   r23
        !            63: 
        !            64: ;----------------------
        !            65: ;
        !            66: ; int_1
        !            67: ;
        !            68: ; Sample output
        !            69: ; org $f1b010
        !            70: ;----------------------
        !            71: int_1:
        !            72:        load    (ALT_RISC_FLAGS),ALT_FLAGSTEMP  ; get current flags
        !            73: ; start load of sample from external memory
        !            74:        loadw   (ALT_SAMPLE_P),ALT_SAMPLE
        !            75:        addqmod #2,ALT_SAMPLE_P                         ; bump sample pos after getting flags
        !            76:        
        !            77: ; start interrupt cleanup
        !            78:        bclr    #3,ALT_FLAGSTEMP                        ; clear IMASK
        !            79:        bset    #10,ALT_FLAGSTEMP                       ; and interrupt 1 latch
        !            80:        addq    #1,ALT_SAMPLECOUNT                      ; bump fast timing counter
        !            81: 
        !            82:        load    (r31),ALT_PCTEMP                        ; get last instruction address
        !            83:        move    ALT_STACKRESET,r31                      ; reset stack to safe spot
        !            84:        addq    #2,ALT_PCTEMP                           ; point to next instruction to execute
        !            85:        store   ALT_SAMPLECOUNT,(ALT_SAMPLECOUNT_P)     ; store it to memory
        !            86:                
        !            87: ; play left and right samples through dacs
        !            88:        store   ALT_SAMPLE,(ALT_LDAC)
        !            89:        store   ALT_SAMPLE,(ALT_RDAC)
        !            90:        
        !            91: ; return from interrupt
        !            92:        jump    T,(ALT_PCTEMP)                                  ; return
        !            93:        store   ALT_FLAGSTEMP,(ALT_RISC_FLAGS)  ; restore flags
        !            94:        
        !            95:        .long
        !            96: 
        !            97: _samplecount::         .dc.l   0
        !            98: 
        !            99: _dspcodestart::                .dc.l   0
        !           100: _dspfinished::         .dc.l   $def6
        !           101: 
        !           102: _olddspcodestart::     .dc.l   0
        !           103: 
        !           104: _int_stack:                    .dc.l   0,0,0,0         ; give it some room to be flaky...
        !           105: 
        !           106: ;--------------------
        !           107: ;
        !           108: ; startup code
        !           109: ;
        !           110: ;--------------------
        !           111: _dspbase_init::
        !           112: ;
        !           113: ; set up bank 0 registers for interrupt usage
        !           114: ;
        !           115:        movei   #RISC_FLAGS,ALT_RISC_FLAGS
        !           116:        movei   #_samplecount,ALT_SAMPLECOUNT_P
        !           117:        movei   #L_DAC,ALT_LDAC
        !           118:        movei   #R_DAC,ALT_RDAC
        !           119:        movei   #_int_stack+8,ALT_STACKRESET    
        !           120:        movei   #_soundbuffer,ALT_SAMPLE_P
        !           121:        moveq   #0,ALT_SAMPLECOUNT
        !           122:        
        !           123:        movei   #MODMASK,scratch
        !           124:        movei   #$ffffe000,scratch2
        !           125:        store   scratch2,(scratch)              ; set up for 16k circular buffers
        !           126:        
        !           127:        move    ALT_STACKRESET,r31                              ; in register bank 0    
        !           128:        
        !           129:        movei   #(1<<5)+(1<<14),r0                      ; enable I2S interrupts and regpage 
        !           130:        store   r0,(ALT_RISC_FLAGS)
        !           131: 
        !           132:        nop                                                                     ; wait for the reg page to flip
        !           133:        nop
        !           134:        nop
        !           135:        nop
        !           136:                
        !           137: ;--------------------
        !           138: ;
        !           139: ; wait for a load command
        !           140: ;
        !           141: ;--------------------
        !           142: nothingwaiting:
        !           143: 
        !           144: waitcmd:
        !           145:        movei   #_dspcodestart,r2
        !           146:        load    (r2),r1
        !           147:        or              r1,r1
        !           148:        jr              EQ,nothingwaiting
        !           149:        nop
        !           150:                
        !           151: ;
        !           152: ; if still in memory, skip the load
        !           153: ;
        !           154:        movei   #_olddspcodestart,r3
        !           155:        load    (r3),r4
        !           156:        cmp             r1,r4
        !           157:        movei   #skipload,r5
        !           158:        jump    EQ,(r5)                 ; still in memory
        !           159:        store   r1,(r3)                 ; delay slot
        !           160: 
        !           161:        move    r1,r2
        !           162:        subq    #4,r2                   ; code size is just before start
        !           163:        load    (r2),r2
        !           164:        addq    #7,r2
        !           165:        shrq    #3,r2                   ; number of phrases to bopy
        !           166:        
        !           167:        movei   #LOADPOINT,r0   ; destination for code
        !           168:        move    r1,r3
        !           169:        move    r0,r4
        !           170:        addq    #4,r3
        !           171:        addq    #4,r4
        !           172: loadloop:
        !           173:        load    (r1),r5
        !           174:        load    (r3),r6
        !           175:        store   r5,(r0)
        !           176:        addqt   #8,r1
        !           177:        addqt   #8,r3
        !           178:        store   r6,(r4)
        !           179:        subq    #1,r2                   ; decrement count
        !           180:        addqt   #8,r4
        !           181:        jr              PL,loadloop
        !           182:        addqt   #8,r0
        !           183:        nop
        !           184:        
        !           185: ;      
        !           186: ; call it
        !           187: ;
        !           188: skipload:
        !           189:        movei   #LOADPOINT,r0
        !           190:        movei   #dspreturn,RETURNPOINT
        !           191:        movei   #MAIN_STACK,r14
        !           192:  
        !           193:        jump    T,(r0)
        !           194:        nop
        !           195: 
        !           196: dspreturn:
        !           197:        movei   #_dspcodestart,r2
        !           198:        moveq   #0,r0
        !           199:        store   r0,(r2)                         ; dspcodestart = 0
        !           200: 
        !           201:        movei   #_dspfinished,r2
        !           202:        movei   #$def6,r0
        !           203:        store   r0,(r2)                         ; dspcodestart = 0
        !           204: 
        !           205:        movei   #waitcmd,r0
        !           206:        jump    T,(r0)
        !           207:        nop
        !           208: 
        !           209: 
        !           210: 
        !           211: 
        !           212:        .phrase
        !           213:        .68000

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.