home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 3
/
FREEWARE.BIN
/
towns_os
/
ssp
/
ssp_on.asm
< prev
next >
Wrap
Assembly Source File
|
1980-01-02
|
8KB
|
361 lines
;************************************************************************
;* *
;* Super Sound Player for FM TOWNS *
;* *
;* Switch ON program *
;* *
;* by HONESEN since 1990/10/20 *
;* 1990/10/21 ver0.0 *
;* 1990/10/27 ver1.0 *
;* 1990/10/28 ver1.1 for Oh!FM *
;* 1990/11/11 ver1.2 *
;* 1990/11/12 ver1.2a *
;* *
;* 1990/11/23 ver2.0 T-OS L30 *
;* 1990/12/10 ver2.1 *
;* *
;************************************************************************
.386p
assume cs:_code,ds:_code
;========================================
; constant definition
;========================================
SND_BIOS_ent_o equ 80H
SND_BIOS_ent_x equ 14000H
tone_work equ 14008H
xprog_ent equ 14100H
tone_data equ 14080H
_code segment para public use32 'code'
;========================================
; main routine
;========================================
main proc near
; ----- Set T-BIOS selecter
mov ax,0118H
mov es,ax ; set selecter
; ----- Transfer extended program
mov ebx,offset xprog ; sorce address
mov edx,xprog_ent ; destination address
mov ecx,offset xprog_e-offset xprog ; size
main0: mov al,[ebx]
mov es:[edx],al
inc ebx
inc edx
loop main0
; ----- Check SSP OFF
mov eax,es:[SND_BIOS_ent_o]
cmp eax,xprog_ent
jz main1
; ----- Patch up SND_BIOS jump table
mov es:[SND_BIOS_ent_x],eax
mov eax,xprog_ent
mov es:[SND_BIOS_ent_o],eax
mov ax,0110H
mov es:[SND_BIOS_ent_x+4],ax
; ----- Exit back to DOS.
main1: mov ax,04C00H
int 21H
main endp
;========================================
; T-BIOS extended program
;========================================
xprog proc far
call pword ptr cs:[SND_BIOS_ent_x]
pushfd
cmp ah,1 ; KEY ON ?
jnz xprog0
push 09DD9H ; Push FM color
push 02EE2H ; Push PCM color
call interval ; Write interval indicator
lea esp,[esp+8]
jmp xprog_ret
xprog0: cmp ah,2 ; KEY OFF ?
jnz xprog1
mov dl,127 ; Set volume 0
push 0 ; indicator color is black
push 0
call interval ; Erase interval indicator
lea esp,[esp+8] ; ^^^^^ Write black
jmp xprog_ret
xprog1: cmp ah,4 ; TONE CHANGE ?
jnz xprog2
call tone ; Write tone name
jmp xprog_ret
xprog2: cmp ah,3 ; PAN CHANGE ?
jnz xprog_ret
call pan ; write pan indicator
xprog_ret: popfd
ret
;---------------------------------------
; interval indicator
;---------------------------------------
interval proc near
pushad
push es
push fs
mov ax,118H ; Set selecter
mov es,ax
mov ax,1CH
mov fs,ax
; ----- If color=black (KEY OFF) then dh=interval when key on
; else save interval
movzx ebx,bl
cmp dword ptr ss:[esp+44],0
jz interval2
mov es:[ebx+tone_work],dh
jmp interval3
interval2: mov dh,es:[ebx+tone_work]
; ----- indicator position --> edx
interval3: call getadr ; Get VRAM address
jc interval_r
push ecx
movzx ecx,ch
lea edx,[edx+(60-4)*512+60][ecx*2]
pop ecx
; ----- indicator length --> ecx (length=volume/16+5)
movzx ecx,cl
and ecx,ecx
jz interval_r
shr ecx,4
add ecx,5
; ----- indicator color --> ax
mov ax,ss:[esp+48]
cmp bl,6
jb interval1
mov ax,ss:[esp+44]
; ----- Write indicator
interval1: sub edx,512
mov fs:[edx],ax
loop interval1
; ----- End
interval_r: pop fs
pop es
popad
ret
interval endp
;---------------------------------------
; tone name
;---------------------------------------
tone proc near
pushad
push ds
push es
push fs
mov ax,118H ; Set selecter
mov es,ax
mov ax,1CH
mov fs,ax
; ----- get tone neme --> tone_data (Use SND_BIOS)
mov ah,6
mov cx,118H
mov ds,cx
mov esi,tone_data
call pword ptr cs:[SND_BIOS_ent_x]
and al,al
jnz tone_r
; ----- tone name position --> edx
call getadr
jc tone_r
lea edx,[edx+(40+2)*512+8]
; ----- tone name color --> bh
mov bh,0DH
cmp bl,6
jb tone1
mov bh,0EH
; ----- Print tone name
tone1: mov ecx,8
tone2: mov bl,ds:[esi]
cmp bl,20H
jae tone3
mov bl,20H
tone3: call putchr ; Print one character
add edx,4-512*16
inc esi
loop tone2
; ----- End
tone_r: pop fs
pop es
pop ds
popad
ret
tone endp
;---------------------------------------
; pan indicator
;---------------------------------------
pan proc near
pushad
push es
push fs
mov ax,118H ; Set selecter
mov es,ax
mov ax,1CH
mov fs,ax
; ----- indicator position --> edx
push edx
call getadr
pop ecx ; cl = pan
jc pan3
lea edx,[edx+(40+2)*512+44]
sub cl,64
js pan2
jz pan1
; ----- right indicator ON
call era_pan
call era_pan
mov ebx,offset r_pan-offset xprog+xprog_ent
call ind_pan
jmp pan3
; ----- Center indicator ON
pan1: call era_pan
mov ebx,offset c_pan-offset xprog+xprog_ent
call ind_pan
call era_pan
jmp pan3
; ----- Left indicator ON
pan2: mov ebx,offset l_pan-offset xprog+xprog_ent
call ind_pan
call era_pan
call era_pan
; ----- End
pan3: pop fs
pop es
popad
ret
pan endp
; ----- indicator pattern table
r_pan dd 00000003H,00000033H,00000333H,00003333H
dd 00033BB3H,0033BBB3H,033BBBB3H,33BBBBB3H
dd 033BBBB3H,0033BBB3H,00033BB3H,00003333H
dd 00000333H,00000033H,00000003H,00000000H
c_pan dd 00000000H,00000000H,00333300H,03333330H
dd 333BB333H,33BBBB33H,33BBBB33H,33BBBB33H
dd 33BBBB33H,33BBBB33H,333BB333H,03333330H
dd 00333300H,00000000H,00000000H,00000000H
l_pan dd 30000000H,33000000H,33300000H,33330000H
dd 3BB33000H,3BBB3300H,3BBBB330H,3BBBBB33H
dd 3BBBB330H,3BBB3300H,3BB33000H,33330000H
dd 33300000H,33000000H,30000000H,00000000H
;---------------------------------------
; put one character in bl (use 8x8 FONT)
;---------------------------------------
putchr proc near
push ds
push esi
push ecx
push ebx
push edx
mov ax,0
mov dx,0808H
call pword ptr cs:[0A0H] ;get FONT address (FONT_BIOS)
pop edx
pop ebx
mov ecx,8
putchr0: mov bl,ds:[esi]
push ecx
mov eax,0
mov ecx,8
putchr1: shl eax,4
shr bl,1
jnc putchr2
or al,bh
putchr2: loop putchr1
mov fs:[edx],eax
mov fs:[edx+512],eax
add edx,1024
pop ecx
inc esi
loop putchr0
pop ecx
pop esi
pop ds
ret
putchr endp
;---------------------------------------
; indicate pan
;---------------------------------------
ind_pan proc near
mov ecx,16
ind_pan1: mov eax,es:[ebx]
mov fs:[edx],eax
add ebx,4
add edx,512
loop ind_pan1
sub edx,512*16-4
ret
ind_pan endp
;---------------------------------------
; erase pan
;---------------------------------------
era_pan proc near
mov ecx,16
mov eax,0
era_pan1: mov fs:[edx],eax
add edx,512
loop era_pan1
sub edx,512*16-4
ret
era_pan endp
;---------------------------------------
; get VRAM address
;---------------------------------------
getadr proc near
cmp bl,64 ;bl <- ch no.
jb getadr0
sub bl,64-6
getadr0: cmp bl,14
jae getadr_er
and dh,7FH
mov cx,dx
movzx ebx,bl
mov ax,512*20
mov bh,0
mul bx
shl edx,16
mov dx,ax
and al,al
ret
getadr_er: stc
ret
getadr endp
xprog_e: nop
; <<<<< Version >>>>>
db 'SSP_ON ver2.1 1990/12/10 HONESEN'
xprog endp
_code ends
_stack segment byte stack use32 'stack'
db 8192 dup (?)
_stack ends
end main