ViBRA16 (SB16) updates to dos port

This commit is contained in:
pagefault
2001-04-23 21:56:12 +00:00
parent 42a129f91e
commit 55324bed20
2 changed files with 1653 additions and 1483 deletions

View File

@@ -546,6 +546,15 @@ NEWSYM AdjustFrequency
jne .nostereo8b
cmp byte[SBHDMA],0
jne .nostereo8b
; *****************************************
; *** ViBRA16X support by Peter Santing ***
; *****************************************
; before REALLY switching back to 8-bit sucky mono mode
; check that we're dealing with a ViBRA16X Creative Labs Card
cmp byte[vibracard], 1
je .nostereo8b
cmp dword[SoundQuality],2
jbe .nostereo8b
mov dword[SoundQuality],2
@@ -562,9 +571,16 @@ NEWSYM AdjustFrequency
mov ecx,[SoundQuality]
mov eax,dword [SBToSPCSpeeds+ecx*4]
; code for supporting vibra cards (coded by Peter Santing)
cmp byte [vibracard], 1
je .vibrafix
cmp byte [SBHDMA],0
je .not16bit
mov eax,dword [SBToSPCSpeeds2+ecx*4]
.vibrafix
mov eax,dword [SBToSPCSpeeds2+ecx*4]
.not16bit
cmp byte[RaisePitch],0
jne .nopitchmodify
@@ -1581,6 +1597,7 @@ NEWSYM SBDMA, db 1
NEWSYM SBDMAPage, db 83
NEWSYM SBHDMA, db 0
NEWSYM SBHDMAPage, db 0
NEWSYM vibracard, db 0
NEWSYM ResetSBDSP
mov dx,[SBPort]
@@ -4824,6 +4841,11 @@ NEWSYM handlersbseg
cmp byte[SBHDMA],0
jne near SBHandler16
; code added by peter santing
cmp byte[vibracard], 1
je near SBHandler16
push ebx
push ecx
push edx
@@ -5423,6 +5445,10 @@ NEWSYM initSB
; Set up SB
call ResetSBDSP
; code added by peter santing
cmp byte [vibracard], 1
je near .vibrafix2
cmp byte [SBHDMA],0
je .no16bit
cmp byte [SBHDMA],4
@@ -5549,6 +5575,98 @@ NEWSYM initSB
.Versionnum dw 0
; *****************************************
; **** alternate ViBRA16X SB init code **** by Peter Santing
; ***************************************** copied portions of original code
; and modified it.
.vibrafix2
; Set Time-Constant Data ( = 256 - (1000000/sampling rate) )
; 8000=131, 22050=210, 44100=233, 11025=165
; Setup DMA
; Select DMA channel
mov al,[SBDMA]
add al,4
mov dx,000Ah
out dx,al
; Clear DMA
mov al,00h
mov dx,000Ch
out dx,al
; Set autoinit/write (set as DAC)
mov al,58h
add al,[SBDMA]
mov dx,000Bh
out dx,al
; Send Offset Address
mov al,[memoryloc]
mov dl,[SBDMA]
shl dl,1
out dx,al
mov al,[memoryloc+1]
out dx,al
; Send length of entire block
mov ax,[BufferSizeW]
shl ax, 1
dec ax
inc dx
out dx,al
mov al,ah
out dx,al
; Send page # (address/65536)
mov al,[memoryloc+2]
mov dh, 0
mov dl,[SBDMAPage]
out dx,al
; turn on DMA
mov al,[SBDMA]
mov dx,000Ah
out dx,al
mov al,41h
call WriteDSP
push ecx
mov ecx,[SoundQuality]
mov al,byte [SBToSPCSpeeds2+ecx*4+1]
pop ecx
call WriteDSP
push ecx
mov ecx,[SoundQuality]
mov al,byte [SBToSPCSpeeds2+ecx*4]
pop ecx
call WriteDSP
; Prepare SB for the first block
; 16-bit auto-init, mono, unsigned
mov al,0B6h ; Sb 16 version (DSP 4)
call WriteDSP
cmp byte[StereoSound],1
jne ._Mono
._surround
mov al,30h ; stereo/signed
call WriteDSP
jmp ._AfterStereo
._Mono
mov al,10h ; mono/signed
call WriteDSP
._AfterStereo
; Send Length-1 to DSP port
mov ax,[BufferSizeB]
dec ax
call WriteDSP
mov al,ah
call WriteDSP
; Turn on speakers
mov al,0D1h
call WriteDSP
jmp .fixsurround
; ******* end of alternate SB init code for ViBRA ********
.init16bitlowhdma
; Set Time-Constant Data ( = 256 - (1000000/sampling rate) )
; 8000=131, 22050=210, 44100=233, 11025=165

View File

@@ -22,7 +22,7 @@ EXTSYM ConvertJoyMap,ConvertJoyMap1,ConvertJoyMap2,printhex,InitSPC
EXTSYM StartUp,PrintStr,WaitForKey,PrintChar,MMXCheck,ZFileSystemInit
EXTSYM SPCDisable,SystemInit,allocmem
EXTSYM xa
EXTSYM SBPort,SBInt,SBIrq,SBDMA,SBDMAPage,SBHDMAPage,getenv
EXTSYM SBPort,SBInt,SBIrq,SBDMA,SBDMAPage,SBHDMAPage,getenv,vibracard
EXTSYM ram7fa,wramdataa
EXTSYM malloc,free
EXTSYM StateBackup
@@ -128,6 +128,14 @@ NEWSYM mydebug, db '',13,10,0
NEWSYM outofmem, db 'You don',39,'t have enough memory to run this program!',13,10,0
%define ZVERSION '18 '
;%define ZBETA 0
; Line added by Peter Santing
NEWSYM vibradetect
db 'Creative ViBRA16X PnP card detected (support coded by Peter Santing)', 13, 10
db 'High-DMA is below dma #4', 13, 10
db 13,10, 'you have now full 16-bit stereo sound with the surround option!', 13, 10
db 13,10, 'Press any key to continue', 13, 10,0
NEWSYM welcome
@@ -625,9 +633,53 @@ NEWSYM getblaster
jne .dma3
mov byte[SBDMAPage],82h
.dma3
cmp byte[SBHDMA],4
jae .hdma
mov byte[SBHDMA],0
; ******************************************************
; **** this piece of code is added by Peter Santing ****
; **** it will enable ZSNES to use the full STEREO ****
; **** capability of the ViBRA16X line of creative ****
; **** instead of playing 8-bit MONOURAL sound ****
; ******************************************************
; cmp byte [SBHDMA], 0
; jne .vibradma0
; mov byte [SBDMAPage], 87h
; mov byte [vibracard], 1 ; set ViBRA16X mode
.vibradma0
cmp byte [SBHDMA], 1
jne .vibradma1
mov byte [SBDMAPage], 83h
mov byte [vibracard], 1 ; set ViBRA16X mode
.vibradma1
cmp byte [SBHDMA], 2
jne .vibradma2
mov byte [SBDMAPage], 81h
mov byte [vibracard], 1 ; set ViBRA16X mode
.vibradma2
cmp byte [SBHDMA], 3
jne .vibradma3
mov byte [SBDMAPage], 82h
mov byte [vibracard], 1 ; set ViBRA16X mode
.vibradma3
cmp byte [vibracard], 1
jne .vibrafix
push ax
mov al, [SBHDMA]
mov [SBDMA], al
pop ax
.vibrafix
cmp byte [SBHDMA],4
jae .hdma
; vibra implementation (make sure that zSNES doesn't go back
; to eight-bit-mode mono)
mov byte [SBHDMA],0
cmp byte[vibracard], 1
jne .hdma
push edx
mov edx, vibradetect
call PrintStr
call WaitForKey
pop edx
; ********** END OF ViBRA16X implementation code **********
.hdma
cmp byte[SBHDMA],4
jne .hdma4