; Sound-Sampling und Abspielen mit dem Portfolio ; (C) Juni 1995 by Klaus Peichl ; Anschluá am Druckerport. Draufsicht (female): ; \-------------------------------------------/ ; \ 13 12 11 10 9 8 7 6 5 4 3 2 1 / ; \ 25 24 23 22 21 20 19 18 17 16 15 14 / ; \------------------------------------/ ; Leitung Adresse (Portfolio) Bedeutung ; 2 8078h and 1 Bit 0 ; . ; . ; . ; 9 8078h and 80h Bit 7 ; Speicherung der Daten: ; Bei Record werden Werte vom Druckerport gelesen, und jeweils 2 davon ; als 16-Bit-Werte in einer Speicherzelle im Array PUFFER abgelegt. .Model tiny .Code ORG 100h Verz Macro nop nop nop nop nop endm Start: mov al,9bh ; Port auf Eingabe mov dx,807Bh out dx,al mov dx,80h ; Falls Parameter vorh.: File einlesen mov di,dx mov al,[di] ; L„nge der Parameterzeile cmp al,0 je Menue mov ah,0 add dx,ax inc dx mov di,dx mov byte ptr [di],0 ; Filename muá mit 0 beendet sein mov dx,82h ; Offset Filename mov ax,3d00h ; ™ffne File int 21h jnc File_ok mov dx,Offset FileErrStr mov ah,9 int 21h jmp Ende File_OK: mov bx,ax ;Handle Lies_File: mov cx,60000 ;Anzahl Zeichen mov dx,Offset Puffer mov ah,3fh int 21h mov [Anzahl],ax mov ah,3eh int 21h ; File schlieáen call Play jmp Ende Menue: mov ah,9 mov dx,Offset MenueStr int 21h call Ton Tastaturabfrage: mov ah,0 int 16h cmp al,13 je Start nicht_CR: cmp al,'r' jne nicht_r jmp Rec nicht_r: cmp al,'p' jne nicht_p call Play jmp Menue nicht_p: cmp al,'s' jne nicht_s jmp Save nicht_s: cmp al,'l' jne nicht_l jmp Load nicht_l: cmp al,'t' jne nicht_t jmp Testlauf nicht_t: cmp al,27 je Ende jmp Tastaturabfrage Ende: mov ah,4ch int 21h Rec: mov bx,0 mov dx,8078h RecSchleife: in al,dx and al,0c0h ; oberen 2 Bit verwenden mov Byte Ptr [Offset Puffer+bx],al ; als Bit 7,6 ablegen mov cx,16 V1: loop V1 in al,dx and al,0c0h mov cl,2 shr al,cl or Byte Ptr [Offset Puffer+bx],al ; Bit 5,4 speichern mov cx,15 V2: loop V2 in al,dx and al,0c0h mov cl,4 shr al,cl or Byte Ptr [Offset Puffer+bx],al ; Bit 3,2 speichern mov cx,13 V3: loop V3 in al,dx and al,0c0h mov cl,6 shr al,cl or Byte Ptr [Offset Puffer+bx],al ; Bit 1,0 speichern mov cx,7 V4: loop V4 inc bx cmp bx,Anzahl jne RecSchleife jmp Start Play: mov si,0 mov dx,8020h mov Byte Ptr bl,[Offset Puffer+si] PlaySchleife: mov al,bl ; Wert holen mov cl,6 shr al,cl ; obere 2 Bit mov ah,al ; Beginn UP Lautst„rke_al out dx,al ; Bit 7 in al muá 0 sein Laut1: Verz dec al jns Laut1 Laut1e: xor ah,03h ; Auszeit = 3-Einzeit mov al,128 out dx,al Leise1: Verz dec ah jns Leise1 Leise1e: ; Ende UP Lautst„rke_al inc si mov bh,bl ; alten Wert retten nop nop mov al,bl mov cl,4 shr al,cl ; Bit 5 und 4 and al,3 mov ah,al ; Beginn UP Lautst„rke_al out dx,al ; Bit 7 in al muá 0 sein Laut2: Verz dec al jns Laut2 Laut2e: xor ah,3 ; Auszeit = 3-Einzeit mov al,128 out dx,al Leise2: Verz dec ah jns Leise2 Leise2e: ; Ende UP Lautst„rke_al mov Byte Ptr bl,[Offset Puffer+si] mov al,bh ; alten Wert holen mov cl,2 shr al,cl ; Bit 3 und 2 and al,3 mov ah,al ; Beginn UP Lautst„rke_al out dx,al ; Bit 7 in al muá 0 sein Laut3: Verz dec al jns Laut3 Laut3e: xor ah,3 ; Auszeit = 3-Einzeit mov al,128 out dx,al Leise3: Verz dec ah jns Leise3 Leise3e: ; Ende UP Lautst„rke_al cmp si,Anzahl jg fertig mov al,bh ; alten Wert holen and al,3 ; Bit 1 und 0 mov ah,al ; Beginn UP Lautst„rke_al out dx,al ; Bit 7 in al muá 0 sein Laut4: Verz dec al jns Laut4 Laut4e: xor ah,3 ; Auszeit = 3-Einzeit mov al,128 out dx,al Leise4: Verz dec ah jns Leise4 Leise4e: ; Ende UP Lautst„rke_al jmp PlaySchleife fertig: ret Testlauf: mov dx,8078h in al,dx mov cl,6 shr al,cl and al,3 mov ah,al ; Beginn UP Lautst„rke_al mov dx,8020h out dx,al ; Bit 7 in al muá 0 sein Ein1: Verz dec al jns Ein1 Null0: xor ah,03h ; Auszeit = 3-Einzeit mov al,128 out dx,al mov dx,8078h Aus1: Verz dec ah jns Aus1 ; Ende UP Lautst„rke_al Null5: mov dx,8000 in al,dx cmp al,3fh jne Testlauf jmp Start Save: mov dx,Offset Dateiname mov ah,3ch ; Datei erstellen mov cx,0 ; normale Datei Int 21h mov bx,ax ; Dateihandle jnc file_ok2 mov ah,9 mov dx,Offset FileErrStr int 21h file_ok2: mov cx,Anzahl ; Anzahl zu schreibender Bytes mov dx,Offset Puffer mov ah,40h int 21h mov ah,3eh int 21h ; Datei schlieáen jmp Start Funktion_9: inc Byte Ptr [Dateiname+4] cmp Byte Ptr [Dateiname+4],'4' jne zeige_Namen mov Byte Ptr [Dateiname+4],'1' zeige_Namen: mov ah,9 mov dx,Offset NeuNameStr int 21h mov dx,Offset Dateiname int 21h jmp Start Load: mov dx,Offset Dateiname mov ax,3d00h ; Datei ”ffnen Int 21h jnc file_ok3 mov ah,9 mov dx,Offset FileErrStr int 21h jmp Start file_ok3: mov bx,ax ; Dateihandle mov ah,3fh ; lesen aus Datei mov dx,Offset Puffer mov cx,60000 int 21h mov Anzahl,ax mov ah,3eh ; Datei schlieáen int 21h jmp Menue Ton: mov dx,8020h ; Portadresse fr Lautsprecher mov cx,500 Impulsschleife: mov al,0 out dx,al mov al,10 EinSchleife: dec al jne EinSchleife mov al,128 out dx,al mov al,255 AusSchleife: dec al jne AusSchleife loop Impulsschleife ret Warte: push cx mov cx,60000 WSchleife: nop loop WSchleife pop cx ret MenueStr DB 10,13,'Sound-Sampler 2bit v 0.1b / Portfolio',10,13 DB 'ecord

lay oad ave ',10,13 DB 'est',10,13,'$' Dateiname DB 'sound.dat',0,,10,13,'$' NeuNameStr DB 'Neuer Dateiname ist: ','$' FileErrStr DB 'Dateizugriffsfehler!',10,13,'$' Anzahl DW 30000 Puffer DB 60000 Dup (?) END Start