📄 mpc.inc
字号:
;------------------------------------------------;
; Constants
.equ NTRK = 36 ; Number of TOC entries
.equ NBBT = 65 ; Number of BBT entries
.equ MTMR = 40 ; Muting delayed release timer in unit of 2ms
.equ TRKGAP = 62 ; Track gap time in unit of 8ms
.equ VOLMAX = 0x31 ; Maximum volume value
.equ VOLMIN = 0x10 ; Minimum volume value
.equ VOLRATE = 32 ; Volume auto step period in unit of 8ms
.equ STPHLD = 87 ; Resume trigger time in unit of 8ms
;------------------------------------------------;
; Port definitions
; PORTA is assigned as SM data port
; PORTB bit definitions
.equ KEY0 = PB0 ; I: Key - input 0
.equ KEY1 = PB1 ; I: Key - input 1
;.equ = PB2 ; I: <VBAT>
;.equ = PB3 ; I: <VREF>
.equ KEY4 = PB4 ; I: Key - input 4
.equ MOSI = PB5 ; P: HOST - MOSI
.equ MISO = PB6 ; O: HOST - MISO
.equ SCK = PB7 ; P: HOST - SCK
; PORTC bit definitions
.equ MPDAT = PC0 ; O: DSP - Bit stream data
.equ MPCK = PC1 ; O: DSP - Bit stream clock
.equ CE = PC2 ; O: SM - CE#
.equ CLE = PC3 ; O: SM - CLE
.equ RE = PC4 ; O: SM - RE#
.equ ALE = PC5 ; O: SM - ALE
.equ BSY = PC6 ; P: SM - RDY/BSY#
.equ WE = PC7 ; O: SM - WE#
; PORTD bit definitions
.equ POWER = PD0 ; O: Power - Self-Holding
.equ LED = PD1 ; O: Power - LED
.equ VREF = PD2 ; I: Power - VREF/VBAT compare level (L=1.8, Z=2.0)
.equ WSEN = PD3 ; O: DSP - DSP Enable
.equ DRQ = PD4 ; I: DSP - Data Request
.equ IICC = PD5 ; O: IIC - Clock
.equ IICD = PD6 ; I: IIC - Data
;.equ = PD7 ; P: <NC>
;------------------------------------------------;
; Key commands (coded in port B inputs)
.equ K_PLAY = 0b10000
.equ K_STOP = 0b00010
.equ K_NEXT = 0b00011
.equ K_PREV = 0b10001
.equ K_VOLU = 0b00001
.equ K_VOLD = 0b10010
;------------------------------------------------;
; SmartMedia definitions
; SM commands
.equ C_RD0 = 0x00 ; Page read A
.equ C_RD2 = 0x50 ; Page read C
.equ C_WR = 0x80 ; Ready to write
.equ C_PRG = 0x10 ; Start to write page
.equ C_ERA1 = 0x60 ; Erase block (block#)
.equ C_ERA2 = 0xd0 ; Erase block (start)
.equ C_STA = 0x70 ; Read status
.equ C_ID = 0x90 ; Read ID
.equ C_RES = 0xff ; Device reset
; SM properties
.equ Sign8 = 0xe6 ; 8MB
.equ Pages8 = 16384 ;
.equ Blkp8 = 16 ; /
.equ Sign16 = 0x73 ; 16MB
.equ Pages16 = 32768 ;
.equ Blkp16 = 32 ; /
.equ Sign32 = 0x75 ; 32MB
.equ Pages32 = 65536 ;
.equ Blkp32 = 32 ; /
.equ Sign64 = 0x76 ; 64MB
.equ Pages64 = 131072;
.equ Blkp64 = 32 ; /
.equ Sign128 = 0x79 ; 128MB
.equ Pages128 = 262144;
.equ Blkp128 = 32 ; /
;------------------------------------------------;
; Register variables
; Playback and SM access
.def _SrgTmp = r7 ; SREG save register
.def _SrgTmp2= r8 ; /
.def _0 = r9 ; Zero register
.def _PageL = r10 ; Current page# and page counter
.def _PageM = r11 ; * keep this position and order
.def _PageH = r12 ;
.def _CntL = r13 ;
.def _CntM = r14 ;
.def _CntH = r15 ; /
.def _Loop = r20 : Loop counter
.def _PgPtL = r21 ; Page read counter
.def _PgPtH = r22 ; /
.def _LoopL = r21 ; 24bit loop counter
.def _LoopM = r20 ;
.def _LoopH = r22 ; /
.def _PbStat = r23 ; PlayBack stetus (b0:Pause, b1:Playing, b2:EOT)
.def _Err = r25 ; Error status
; 0: No error
; 1: Unknown SM
; 2: Unformat
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -