home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip: Special Sound & MIDI
/
Chip-Special_Sound-und-Midi-auf-dem-PC.bin
/
midiprog
/
tg33cc.asm
< prev
next >
Wrap
Assembly Source File
|
1993-06-13
|
38KB
|
1,675 lines
title TG33CC - Yamaha Tone Generator 33 Control Center
page 64,132
; KEYCODE - Tastaturcodes der Sondertasten
KEY_F1 equ 59
KEY_F2 equ 60
KEY_LEFT equ 75
KEY_RIGHT equ 77
KEY_UP equ 72
KEY_DOWN equ 80
CTRL_LEFT equ 115
CTRL_RIGHT equ 116
CTRL_UP equ 160
CTRL_DOWN equ 164
KEY_HOME equ 71
KEY_END equ 79
KEY_PGUP equ 73
KEY_PGDN equ 81
KEY_INSERT equ 82
KEY_DELETE equ 83
code segment 'code'
assume cs:code,ds:code,es:code
org 100h
start : jmp anfang
; -----
; Texte
ring_menu db 'Para|Common|Vector|Tone|Envelope|Multi|System|Midi|Remote',0
help_line db 'F1 Hilfe|F2 Programm beenden|F3 Element Select|F4 Element on/off',0
msg_copyright db 'YAMAHA Tone Generator Control Center'
db ' Copyright (c) Andreas Nieden 01/92 '
msg_notimpl db 'Dieses Feature ist leider noch nicht'
db ' i m p l e m e n t i e r t '
win_mpara db 20,6
db 'PrgChg Preset 1 & 2 '
db 'Voice Vektor-X '
db 'Voice Vektor-Y '
db 'Modulationsrad '
db 'Voice Volume '
db 'Voice Sustain '
win_mcommon db 20,14
db 'Effect '
db 'Effect Balance '
db 'Effect Level '
db 'Voice Name '
db 'Pitch Bend Range '
db 'After Touch Level '
db 'After Touch PM '
db 'After Touch AM '
db 'Modulation Wheel PM '
db 'Modulation Wheel AM '
db 'Pitch Bias '
db 'EG Delay Rate '
db 'EG Attack Rate '
db 'EG Release Rate '
win_mvector db 19,8
db 'Level Speed '
db 'Detune Speed '
db 'Level Time 1-50 '
db 'Level X-Axis 1-50 '
db 'Level Y-Axis 1-50 '
db 'Detune Time 1-50 '
db 'Detune X-Axis 1-50 '
db 'Detune Y-Axis 1-50 '
win_mtone db 24,14
db 'Wave Type '
db 'Fequency Shift '
db 'After Touch Sensitivity '
db 'Velocity Sensitivity '
db 'LFO Type '
db 'LFO Speed '
db 'LFO Delay '
db 'LFO Rate '
db 'LFO AM '
db 'LFO PM '
db 'Pan '
db 'Feed Back (FM only) '
db 'Tone Level (FM only) '
db 'Volume '
win_menvelope db 14,12
db 'Type '
db 'Level Scaling '
db 'Rate Scaling '
db 'Delay on/off '
db 'Attack Rate '
db 'Decay 1 Rate '
db 'Decay 2 Rate '
db 'Release Rate '
db 'Initial Level '
db 'Attack Level '
db 'Decay 1 Level '
db 'Decay 2 Level '
win_mmulti db 24,16
db 'Effect Type '
db 'Effect Balance '
db 'Group1 Effect Send Level'
db 'Group2 Effect Send Level'
db 'Group2 Output Select '
db 'Group1 Output Select '
db 'Multi Name '
db 'Assign Mode '
db 'Voice Switch '
db 'Send Group '
db 'Voice Memory '
db 'Voice Number '
db 'Volume '
db 'Detune '
db 'Note Shift '
db 'Pan '
win_msystem db 16,3
db 'Transpose '
db 'Master Tune '
db 'Controller Reset'
win_mmidi db 18,5
db 'Device Number '
db 'Exclusive on/off '
db 'Program Change '
db 'Voice Recv Channel'
db 'Vector Channel '
win_mremote db 13,19
db 'Vector '
db 'Cursor Left '
db 'Cursor Right '
db 'Yes (+1) '
db 'No (-1) '
db 'Voice '
db 'Multi '
db 'Edit/Compare '
db 'Store/Copy '
db 'Card '
db 'Internal '
db 'Preset '
db 'Bank Sel. 1-8'
db 'Prg Sel. 1-8'
db 'Demo '
db 'Utility '
db 'Page Up '
db 'Page Down '
db 'Effect Bypass'
; -----
; TG 33 Presetliste
ALIGN 4
tg33preset label byte
db 'SP*Pro33 SP*Matrx SC:Groov SC*Rude SL*Sync ME*Vecta SE*Mount SQ:MrSeq '
db 'SP*Echo SP*Gut SC*Airy SC*Bellz SL*VCO ME*NuAge SE*5.PM SQ:It '
db 'SP*BelSt SP*Omni SC*Solid SC*Pluck SL*Chic PC*Hit+ SE*FlyBy SQ*Id '
db 'SP*Full SP*Oiled SC*Sweep SC*Glass SL:Mini ME*Glace SE*Fear SQ*Wrapa '
db 'SP*Ice SP*Ace SC*Drops SC*Wood SL*Wisul ME*Astro SE:Wolvs SQ*TG809 '
db 'SP*Dandy SP*Quire SC*Euro SC*Wire SL*Blues ME*Vger SE*Hades SQ*Devol '
db 'SP*Arkle SP*Digit SC*Decay SC*Cave SL:Cosmo ME*Hitch SE*Neuro DR:Kit '
db 'SP*BrVec SP*Swell SC:Steel SC*Wispa SL*Super ME*Indus SE*Angel DR*EFX '
db 'EP*Arlad OR*Gospl BA*Slap BA:Fingr BR*Power BR:FrHrn ST*Arco CH*Modrn '
db 'EP:Piano OR*Rock BA*Atack BA*Frtls BR*Fanfr BR:Trmpt ST:Chmbr CH*Duwop '
db 'EP*Malet OR*Pipe BA*Seq BA:Wood BR*Class BR*Tromb ST*Full CH*Itopy '
db 'AP*ApStr OR*Perc BA*Trad PL*Foksy BR*Reeds WN*Sax ST:Pizza CH*Astiz '
db 'EP:DX6op KY*Squez BA:Pick PL*12Str BR*Chill WN:Pan ST*CelSt PC:Marim '
db 'EP*Pin KY*Hrpsi BA*Syn PL*Mute BR*Zeus WN:Oboe ST*Exel PC:Vibes '
db 'EP*NewDX KY*CelSt BA:Rezz PL*Nylon BR*Moot WN:Clart ST*Synth PC*Bells '
db 'EP*Fosta KY:Clavi BA*Unisn PL*Dist BR*Anlog WN:Flute ST*Eroid PC*Clang '
; -----
; TG 33 WaveForms
ALIGN 4
tg33awm label byte
db 'Piano E.Piano Clavi Cembalo Celesta P.organ E.organ1 E.organ2 '
db 'Reed Trumpet Mute Trp Trombone Flugel Fr.Horn BrasAtak SynBrass '
db 'Flute Clarinet Oboe Sax Gut Steel E.Gtr 1 E.Gtr 2 '
db 'Mute Gtr Sitar Pluck 1 Pluck 2 Wood B 1 Wood B 2 E.Bass 1 E.Bass 2 '
db 'E.Bass 3 E.Bass 4 Slap Fretless SynBass1 SynBass2 Strings Vn.Ens. '
db 'Cello Pizz. Syn Str Choir Itopia Ooo! Vibes Marimba '
db 'Bells Timpani Tom E. Tom Cuica Whistle Claps Hit '
db 'Harmonic Mix Sync Bell Mix Styroll DigiAtak Noise 1 Noise 2 '
db 'Oh Hit Water 1 Water 2 Stream Coin Crash Bottle Tear '
db 'Cracker Scratch Metal 1 Metal 2 Metal 3 Metal 4 Wood Bamboo '
db 'Slam Tp. Body Tb.Body HornBody Fl.Body Str.Body AirBlown Reverse1 '
db 'Reverse2 Reverse3 EP wv Organ wv M.tp wv Gtr wv Str wv1 Str wv2 '
db 'Pad wv Digital1 Digital2 Digital3 Digital4 Digital5 Saw 1 Saw 2 '
db 'Saw 3 Saw 4 Square 1 Square 2 Square 3 Square 4 Pulse 1 Pulse 2 '
db 'Pulse 3 Pulse 4 Pulse 5 Pulse 6 Tri Sin8 Sin 8+4 SEQ 1 '
db 'SEQ 2 SEQ 3 SEQ 4 SEQ 5 SEQ 6 SEQ 7 SEQ 8 Drum Set '
; ---------
; Variablen
ALIGN 4
win_addr dd 0 ; Adresse des Fensters
win_firstaddr dw 8 dup (0) ; Legt Adressen der Fenster ab
win_count dw 0 ; Zählt Windows
win_segment dw 0 ; Segment Bildschirmspeicher
menu_procs dw para,common,vector,tone,envelop,multi,system,midi,remote
procs_para dw prsetchg,notimpl,notimpl
dw notimpl,notimpl,notimpl
procs_common dw notimpl,notimpl,notimpl,notimpl,notimpl,notimpl,notimpl
dw notimpl,notimpl,notimpl,notimpl,notimpl,notimpl,notimpl
procs_vector dw notimpl,notimpl,notimpl,notimpl
dw notimpl,notimpl,notimpl,notimpl
procs_tone dw awsetchg,notimpl,notimpl,notimpl,notimpl,notimpl,notimpl
dw notimpl,notimpl,notimpl,notimpl,notimpl,notimpl,notimpl
procs_envelop dw notimpl,notimpl,notimpl,notimpl,notimpl,notimpl
dw notimpl,notimpl,notimpl,notimpl,notimpl,notimpl
procs_multi dw notimpl,notimpl,notimpl,notimpl,notimpl,notimpl,notimpl,notimpl
dw notimpl,notimpl,notimpl,notimpl,notimpl,notimpl,notimpl,notimpl
procs_system dw notimpl,notimpl,notimpl
procs_midi dw notimpl,notimpl,notimpl,notimpl,notimpl
procs_remote dw rem_val,rem_val,rem_val,rem_val,rem_val,rem_val,rem_val,rem_val,rem_val,rem_val
dw rem_val,rem_val,notimpl,notimpl,rem_val,rem_val,rem_val,rem_val,rem_val
menu_addr dw 16 dup (0) ; Menu - Bildschirmadressen
win_mcolor1 db 74h ; Menu Farbe 1. Buchstabe
win_mcolor2 db 70h ; Menu Farbe restl. Text
win_makt db 0fh ; Menu aktueller Punkt
win_bg db 17h ; Hintergrundfarbe
win_wcolor1 db 30h ; Farbe für Warntafel
win_wcolor2 db 4fh ; Farbe für Fehlertafel
menu_akt db 0 ; Aktueller Menupunkt
menu_count db 9 ; 9 Menupunkte
menu_flag db 0 ; Zeigt an, ob Cursor links oder rechts !
menu_letters db 'PCVTEMSMR',0
; -----
; taste - löscht den Tastaturpuffer und holt eine Tastenkombination nach AX
taste : mov ah,1
int 16h
jz tast100
mov ah,0
int 16h
jmp short taste
tast100: mov ah,0
int 16h
ret
; -----
; wtick - Wartet für einen Timertick ...
wtick : push ax
push bx
push cx
push dx
sti
xor ax,ax
int 1ah
mov bx,dx
wtick10: xor ax,ax
int 1ah
cmp dx,bx
jz wtick10
pop dx
pop cx
pop bx
pop ax
ret
; -------
; waitrcv - Wait For MPU Receive Ready
waitrcv: push ax
push dx
mov dx,0301h
waitr10: in al,dx
test al,40h
jnz waitr10
pop dx
pop ax
ret
; --------
; put_midi - Ausgabe eines MidiBytes
put_midi:push ax
push dx
call waitrcv
mov dx,0300h
pushf
cli
out dx,al
popf
pop dx
pop ax
ret
; -------
; put_cmd - Ausgabe eines MPU-Kommandos
put_cmd: push ax
push cx
push dx
call waitrcv
pushf
cli
mov dx,0301h
out dx,al
mov cx,4000h
put_c20: in al,dx
test al,80h
jz put_c30
loop put_c20
mov al,20h
out 20h,al
sti
mov ax,cs
mov ds,ax
jmp ende
put_c30: dec dx
in al,dx
inc dx
cmp al,0feh
jnz put_c20
put_c90: popf
pop dx
pop cx
pop ax
ret
; -------
; resetmpu - Reset MPU
resetmpu:push ax
push dx
call waitrcv
pushf
cli
mov dx,0301h
mov al,0ffh
out dx,al
call waitrcv
dec dx
in al,dx
popf
pop dx
pop ax
ret
; ---------
; send_ex - Send Exclusive Message
send_ex: call resetmpu
mov al,3fh
call put_cmd
send_e10:lodsb
call put_midi
cmp al,0f7h
jnz send_e10
call resetmpu
ret
; ------
; scrini
; Bildschirm initialisieren
scrini : push ds
push es
xor ax,ax
mov bx,0b800h
mov ds,ax
mov si,0463h
lodsw
cmp ax,03d4h
jz scrin10
mov bx,0b000h
mov word ptr cs:win_mcolor1,7070h
mov word ptr cs:win_makt,0707h
scrin10: mov cs:win_segment,bx
mov ax,cs
add ax,1000h
mov es,ax
mov ax,cs:win_segment
mov ds,ax
xor si,si
xor di,di
mov cx,2000
rep movsw
mov ax,0300h
xor bx,bx
int 10h
mov ax,cx
stosw
mov ax,dx
stosw
mov word ptr cs:win_addr,di
mov word ptr cs:win_addr+2,es
push ds
pop es
mov ax,0100h
xor bx,bx
mov cx,-1
int 10h
xor di,di
mov ax,cs
mov ds,ax
lea si,ring_menu
mov dl,2
lea bx,menu_addr
scrin12: mov cx,80
mov al,20h
mov ah,win_mcolor2
scrin20: stosw
stosw
sub cx,2
scrin30: lodsb
mov ah,win_mcolor1
mov [bx],di
add bx,2
stosw
dec cx
mov ah,win_mcolor2
scrin40: lodsb
or al,al
jz scrin60 ; 0 beendet Menuzeile
cmp al,'|' ; | führt zum nächsten Menupunkt
jnz scrin50
mov al,' '
jmp short scrin20
scrin50: stosw
dec cx
jmp short scrin40
scrin60: mov al,' '
mov ah,win_mcolor2
rep stosw
mov di,24*160
dec dl
jnz scrin12
mov di,160
mov ah,win_bg
mov al,213 ; ╒
stosw
mov al,205 ; ═
mov cx,78
rep stosw
mov al,184 ; ╕
stosw
mov cx,21
scrin70: mov al,179 ; │
stosw
mov al,' '
push cx
mov cx,78
rep stosw
pop cx
mov al,179
stosw
loop scrin70
mov al,212 ; ╘
stosw
mov al,205 ; ═
mov cx,78
rep stosw
mov al,190 ; ╛
stosw
mov ax,062ah
mov di,9*160+40
call openwin
lea si,msg_copyright
mov di,11*160 + 44
mov cx,36
scrin80: movsb
inc di
loop scrin80
mov di,12*160 + 44
mov cx,36
scrin90: movsb
inc di
loop scrin90
mov cx,90 ; 5 Sekunden warten !
scrin92: call wtick
mov ah,1
int 16h
jnz scrin94
loop scrin92
scrin94: call closewin
pop es
pop ds
ret
; -------
; notimpl - Noch nicht implementiert
notimpl: mov al,win_mcolor2
xchg al,win_wcolor1
mov win_mcolor2,al
mov ax,062ah
mov di,9*160+40
call openwin
push es
mov es,win_segment
lea si,msg_notimpl
mov di,11*160 + 44
mov cx,36
notim80: movsb
inc di
loop notim80
mov di,12*160 + 44
mov cx,36
notim90: movsb
inc di
loop notim90
mov cx,72 ; 4 Sekunden warten !
notim92: call wtick
mov ah,1
int 16h
jnz notim94
loop notim92
notim94: call closewin
mov al,win_mcolor2
xchg al,win_wcolor1
mov win_mcolor2,al
pop es
ret
; --------
; prsetchg
prset_akt dw 0
prset_data db 0b0h,0,0,0b0h,20h,22h,0c0h,0
prsetchg:mov ax,134ch ; 19 Zeilen 76 Spalten
mov di,3*160+4
call openwin
push es
mov es,win_segment
mov di,4*160+8
xor dx,dx
lea si,tg33preset
prset100:push di
mov cx,72
prset120:movsb
inc di
loop prset120
pop di
add di,160
inc dx
cmp dx,8
jnz prset140
push di
sub di,2
mov al,'─'
mov cx,74
prset130:stosb
inc di
loop prset130
pop di
add di,160
prset140:cmp dx,16
jb prset100
pop es
stc
call prset900
prset200:call taste
cmp al,27 ; ESC schließt das Fenster
jnz prset220
prset_ex:call closewin
ret
prset220:cmp al,13
jnz prset240
mov ax,prset_akt
mov cl,22h
test al,40h
jz prset230
mov cl,25h
prset230:mov byte ptr prset_data+5,cl
and al,3fh
cbw
mov cl,8
div cl
shl ah,1
shl ah,1
shl ah,1
add al,ah
mov byte ptr prset_data+7,al
call resetmpu
mov al,3fh
call put_cmd
mov cx,8
lea si,prset_data
prset232:lodsb
call put_midi
loop prset232
call resetmpu
jmp short prset200
prset240:or al,al
jnz prset200 ; Keine Sondertaste -> weiter
cmp ah,KEY_LEFT
jnz prset260
clc
call prset900
dec prset_akt
prset_st:and prset_akt,7fh
stc
call prset900
jmp short prset200
prset260:cmp ah,KEY_RIGHT
jnz prset280
clc
call prset900
inc prset_akt
jmp short prset_st
prset280:cmp ah,KEY_UP
jnz prset300
clc
call prset900
sub prset_akt,8
jmp short prset_st
prset300:cmp ah,KEY_DOWN
jnz prset320
clc
call prset900
add prset_akt,8
jmp short prset_st
prset320:cmp ah,CTRL_LEFT
jnz prset340
clc
call prset900
sub prset_akt,4
jmp prset_st
prset340:cmp ah,CTRL_RIGHT
jnz prset360
clc
call prset900
add prset_akt,4
jmp prset_st
prset360:cmp ah,KEY_HOME
jnz prset380
clc
call prset900
and prset_akt,0f8h
jmp prset_st
prset380:cmp ah,KEY_END
jnz prset400
clc
call prset900
or prset_akt,7
jmp prset_st
prset400:cmp ah,KEY_PGUP
jnz prset420
clc
call prset900
add prset_akt,64
jmp prset_st
prset420:cmp ah,KEY_PGDN
jnz prset440
clc
call prset900
sub prset_akt,64
jmp prset_st
prset440:jmp prset200
; ------
; Stellt aktuelles Instrument dar
prset900:push es
pushf
mov es,win_segment
mov di,4*160 + 8 ; Startadresse 1. Element in ES:DI
mov ax,prset_akt
cmp ax,64
jb prset920
add di,160
prset920:xor dx,dx
mov cx,8
div cx
push dx
mov dx,160
mul dx
add di,ax
pop ax
mov dx,18
mul dx
add di,ax ; Offset sollte jetzt feststehen
mov al,win_mcolor2 ; Normale Farbe
mov cx,8
popf
jnb prset940
mov al,win_makt
prset940:inc di
stosb
loop prset940
pop es
ret
; --------
; awsetchg
awset_akt dw 0
awset_data db 0b0h,0,0,0b0h,20h,22h,0c0h,0
awsetchg:mov ax,134ch ; 19 Zeilen 76 Spalten
mov di,3*160+4
call openwin
push es
mov es,win_segment
mov di,4*160+8
xor dx,dx
lea si,tg33awm
awset100:push di
mov cx,72
awset120:movsb
inc di
loop awset120
pop di
add di,160
inc dx
cmp dx,8
jnz awset140
push di
sub di,2
mov al,'─'
mov cx,74
awset130:stosb
inc di
loop awset130
pop di
add di,160
awset140:cmp dx,16
jb awset100
pop es
stc
call awset900
awset200:call taste
cmp al,27 ; ESC schließt das Fenster
jnz awset220
awset_ex:call closewin
ret
awset220:cmp al,13
jnz awset240
mov ax,awset_akt
mov cl,22h
test al,40h
jz awset230
mov cl,25h
awset230:mov byte ptr awset_data+5,cl
and al,3fh
cbw
mov cl,8
div cl
shl ah,1
shl ah,1
shl ah,1
add al,ah
mov byte ptr awset_data+7,al
call resetmpu
mov al,3fh
call put_cmd
mov cx,8
lea si,awset_data
awset232:lodsb
call put_midi
loop awset232
call resetmpu
jmp short awset200
awset240:or al,al
jnz awset200 ; Keine Sondertaste -> weiter
cmp ah,KEY_LEFT
jnz awset260
clc
call awset900
dec awset_akt
awset_st:and awset_akt,7fh
stc
call awset900
jmp short awset200
awset260:cmp ah,KEY_RIGHT
jnz awset280
clc
call awset900
inc awset_akt
jmp short awset_st
awset280:cmp ah,KEY_UP
jnz awset300
clc
call awset900
sub awset_akt,8
jmp short awset_st
awset300:cmp ah,KEY_DOWN
jnz awset320
clc
call awset900
add awset_akt,8
jmp short awset_st
awset320:cmp ah,CTRL_LEFT
jnz awset340
clc
call awset900
sub awset_akt,4
jmp awset_st
awset340:cmp ah,CTRL_RIGHT
jnz awset360
clc
call awset900
add awset_akt,4
jmp awset_st
awset360:cmp ah,KEY_HOME
jnz awset380
clc
call awset900
and awset_akt,0f8h
jmp awset_st
awset380:cmp ah,KEY_END
jnz awset400
clc
call awset900
or awset_akt,7
jmp awset_st
awset400:cmp ah,KEY_PGUP
jnz awset420
clc
call awset900
add awset_akt,64
jmp awset_st
awset420:cmp ah,KEY_PGDN
jnz awset440
clc
call awset900
sub awset_akt,64
jmp awset_st
awset440:jmp awset200
; ------
; Stellt aktuelles Instrument dar
awset900:push es
pushf
mov es,win_segment
mov di,4*160 + 8 ; Startadresse 1. Element in ES:DI
mov ax,awset_akt
cmp ax,64
jb awset920
add di,160
awset920:xor dx,dx
mov cx,8
div cx
push dx
mov dx,160
mul dx
add di,ax
pop ax
mov dx,18
mul dx
add di,ax ; Offset sollte jetzt feststehen
mov al,win_mcolor2 ; Normale Farbe
mov cx,8
popf
jnb awset940
mov al,win_makt
awset940:inc di
stosb
loop awset940
pop es
ret
; -------
; setmenu
setmenu: push es
mov es,win_segment
mov bl,menu_akt
mov bh,0
shl bx,1
mov di,menu_addr[bx]
mov ah,win_makt
or al,al
mov al,ah
jnz setm50
setm10 : cmp byte ptr es:[di],' '
jz setm_ex
inc di
stosb
jmp short setm10
setm50 : mov al,win_mcolor1
inc di
stosb
mov al,win_mcolor2
jmp short setm10
setm_ex: pop es
ret
; -------
; openwin
openwin: push bx
push cx
push si
push di
push ds
push es
mov bx,ax ; BX = Breite und Höhe
mov si,di ; SI = X-Y Koordinaten
push di ; X-Y Koordinate sichern
les di,win_addr
push bx
mov bx,win_count
shl bx,1
mov word ptr win_firstaddr[bx],di
pop bx
stosw ; Breite und Höhe sichern
mov ax,si
stosw ; Und X-Y Koordinaten
mov ds,win_segment
mov dl,bh
openw10: push si
mov cl,bl
mov ch,0
rep movsw
pop si
add si,160
dec dl
jnz openw10 ; Alten Bildschirminhalt sichern
mov word ptr cs:win_addr,di
inc cs:win_count
pop di
mov es,cs:win_segment
mov ah,cs:win_mcolor2
mov cl,bl ; Breite
sub cl,2
push di
mov al,218 ; ┌
stosw
mov al,196 ; ─
openw20: stosw
dec cl
jnz openw20
mov al,191 ; ┐
stosw
pop di
add di,160
sub bh,2
openw30: push di
mov al,179 ; │
stosw
mov cl,bl
sub cl,2
mov ch,0
mov al,' '
rep stosw
mov al,179 ; │
stosw
pop di
add di,160
dec bh
jnz openw30
mov cl,bl ; Breite
sub cl,2
mov al,192 ; └
stosw
mov al,196 ; ─
openw40: stosw
dec cl
jnz openw40
mov al,217 ; ┘
stosw
pop es
pop ds
pop di
pop si
pop cx
pop bx
ret
; -------
; closewin
closewin:push ax
push bx
push ds
push es
dec win_count
mov bx,cs:win_count
shl bx,1
mov si,win_firstaddr[bx]
mov word ptr win_addr,si
lds si,win_addr
mov es,cs:win_segment
lodsw
mov bx,ax ; Breite und Höhe nach BX
lodsw ; X-Y Koordinate
mov di,ax
closew10:push di
mov cl,bl
mov ch,0
rep movsw
pop di
add di,160
dec bh
jnz closew10
pop es
pop ds
pop bx
pop ax
ret
; ------
; putwin
putwin : push bx
push si
push di
push es
mov es,win_segment
lodsw
add di,162
putw10 : mov bl,al
push di
mov bh,win_mcolor1
mov es:[di+1],bh
putw20 : movsb
inc di
dec bl
jnz putw20
pop di
add di,160
dec ah
jnz putw10
pop es
pop di
pop si
pop bx
ret
; ------
; getwin - Eine Auswahl treffen aus einem Menufenster
; Adresse Windowtext in SI
; Bildschirmadresse in DI
; Zeiger auf Adressen aufzurufender Prozeduren in BX
; Ausgang bei Cursor LEFT,RIGHT und ESC mit Tastaturcode in AL
getwin_xy dw 0
getwin_akt db 0
getwin_cols db 0
getwin_rows db 0
getwin : call putwin
push es
mov es,win_segment
add di,162
mov getwin_xy,di
lodsw
mov word ptr getwin_cols,ax
mov getwin_akt,0
clc
call getw900 ; ersten Text invertiert malen
getw100: call taste
cmp al,27 ; ESC ?
jnz getw120
getw_ex: call closewin
pop es
ret
getw120: cmp al,13 ; CR ?
jnz getw140
push bx
mov al,getwin_akt
mov ah,0
push ax
shl ax,1
add bx,ax
pop ax
call [bx]
pop bx
jmp short getw100
getw140: or al,al
jnz getw100
mov al,ah ; Sondertaste nach AL
cmp al,KEY_LEFT ; Cursor links ??
jz getw_ex ; raus hier
cmp al,KEY_RIGHT ; Cursor rechts ??
jz getw_ex ; raus hier
cmp al,KEY_UP ; Cursor nach oben ??
jnz getw160
stc
call getw900
cmp getwin_akt,0 ; Bereits oben ?
jz getw150
dec getwin_akt
getw142: clc
call getw900
jmp short getw100
getw150: mov al,getwin_rows
dec al
mov getwin_akt,al
jmp short getw142
getw160: cmp al,KEY_DOWN ; Cursor nach unten ??
jnz getw180
stc
call getw900
mov al,getwin_akt
inc al
cmp al,getwin_rows
jb getw170
mov al,0
getw170: mov getwin_akt,al
jmp short getw142
getw180: cmp al,KEY_HOME
jnz getw200
stc
call getw900
mov getwin_akt,0
jmp short getw142
getw200: cmp al,KEY_END
jnz getw100
stc
call getw900
mov al,getwin_rows
dec al
mov getwin_akt,al
jmp short getw142
; -------
; getw900 - Aktuelle Zeile darstellen (invertiert = aktuell)
getw900: push bx
pushf
mov al,getwin_akt
mov ah,160
mul ah
add ax,getwin_xy
mov di,ax
mov cl,getwin_cols
mov ch,0
mov al,win_makt
popf
jnb getw920
getw910: mov al,win_mcolor1
inc di
stosb
mov al,win_mcolor2
mov bl,getwin_cols
dec cx
getw920: inc di
stosb
loop getw920
pop bx
ret
; ----
; para
para : lea si,win_mpara
lodsw
add al,2
add ah,2
mov bl,menu_akt
mov bh,0
shl bx,1
mov di,menu_addr[bx]
add di,160
call openwin
lea bx,procs_para
lea si,win_mpara
jmp getwin
; ----
; common
common : lea si,win_mcommon
lodsw
add al,2
add ah,2
mov bl,menu_akt
mov bh,0
shl bx,1
mov di,menu_addr[bx]
add di,160
call openwin
lea bx,procs_common
lea si,win_mcommon
jmp getwin
; ----
; vector
vector : lea si,win_mvector
lodsw
add al,2
add ah,2
mov bl,menu_akt
mov bh,0
shl bx,1
mov di,menu_addr[bx]
add di,160
call openwin
lea bx,procs_vector
lea si,win_mvector
jmp getwin
; ----
; tone
tone : lea si,win_mtone
lodsw
add al,2
add ah,2
mov bl,menu_akt
mov bh,0
shl bx,1
mov di,menu_addr[bx]
add di,160
call openwin
lea bx,procs_tone
lea si,win_mtone
jmp getwin
; ----
; envelop
envelop: lea si,win_menvelope
lodsw
add al,2
add ah,2
mov bl,menu_akt
mov bh,0
shl bx,1
mov di,menu_addr[bx]
add di,160
call openwin
lea bx,procs_envelop
lea si,win_menvelope
jmp getwin
; ----
; multi
multi : lea si,win_mmulti
lodsw
add al,2
add ah,2
mov bl,menu_akt
mov bh,0
shl bx,1
mov di,menu_addr[bx]
add di,160
call openwin
lea bx,procs_multi
lea si,win_mmulti
jmp getwin
; ----
; system
system : lea si,win_msystem
lodsw
add al,2
add ah,2
mov bl,menu_akt
mov bh,0
shl bx,1
mov di,menu_addr[bx]
add di,160
call openwin
lea bx,procs_system
lea si,win_msystem
jmp getwin
; ----
; midi
midi : lea si,win_mmidi
lodsw
add al,2
add ah,2
mov bl,menu_akt
mov bh,0
shl bx,1
mov di,menu_addr[bx]
add di,160
call openwin
lea bx,procs_midi
lea si,win_mmidi
jmp getwin
; ----
; remote
remote : lea si,win_mremote
lodsw
add al,2
add ah,2
mov bl,menu_akt
mov bh,0
shl bx,1
mov di,menu_addr[bx]
add di,160
call openwin
lea bx,procs_remote
lea si,win_mremote
jmp getwin
; -------
; rem_val - Remote Control Value
remote_exclusive db 0f0h,43h,10h,26h,7,0,0f7h
remote_ex_values db 0,2,3,4,5,6,7,8,9,10,11,12,13,21,29,30,33,34,37
rem_val: push bx
push si
push di
mov bx,ax
mov al,remote_ex_values[bx]
mov remote_exclusive + 5,al
lea si,remote_exclusive
call send_ex
pop di
pop si
pop bx
ret
; ----
; main
main : mov al,0
call setmenu
main100: mov menu_flag,0
call taste
or al,al
jz main200 ; Sondertaste !
cmp al,13 ; Wählt Fenster aus !
jnz main180
main120: mov bl,menu_akt
mov bh,0
shl bx,1
call menu_procs[bx]
mov menu_flag,0
cmp al,27
jz main180
mov menu_flag,1
cmp al,KEY_LEFT
jz main_le
cmp al,KEY_RIGHT
jz main_ri
main180: jmp short main100
; -----------
; Sondertaste
main200: cmp ah,KEY_F2 ; F2 beendet !
jnz main220
ret
main220: cmp ah,KEY_LEFT ; Cursor links
jnz main240
main_le: mov al,1
call setmenu
dec menu_akt
jns main230
mov al,menu_count
dec al
mov menu_akt,al
main230: mov al,0
call setmenu
cmp menu_flag,0
jnz main120
jmp main100
main240: cmp ah,KEY_RIGHT ; Cursor rechts
jnz main260
main_ri: mov al,1
call setmenu
mov al,menu_akt
inc al
cmp al,menu_count
jb main250
mov al,0
main250: mov menu_akt,al
jmp short main230
main260: cmp ah,KEY_DOWN
jnz main280
jmp main120
main280: jmp main100
; ------
; scrend
scrend : push ds
push es
mov ax,cs
add ax,1000h
mov ds,ax
xor si,si
mov es,cs:win_segment
xor di,di
mov cx,2000
rep movsw
lodsw
mov cx,ax
mov ah,1
xor bx,bx
int 10h
lodsw
mov dx,ax
mov ah,2
int 10h
pop es
pop ds
ret
; ------
; Anfang
anfang : cld
call scrini
call main
call scrend
ende : mov ah,4ch
int 21h
ALIGN 16
p_ende label byte
code ends
end start