; 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 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] ; Lnge 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 schlieen 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 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 RecSchleife: mov dx,8078h in al,dx and al,0F0h ; erst oberes Nibble mov Byte Ptr [Offset Puffer+bx],al ; speichern mov cl,4 shr al,cl mov cx,26 Verz1: loop Verz1 mov dx,8078h in al,dx mov cl,4 shr al,cl and al,0Fh ; dann unteres Nibble or Byte Ptr [Offset Puffer+bx],al mov cx,26 Verz2: loop Verz2 inc bx cmp bx,Anzahl jne RecSchleife jmp Start Play: mov bx,0 mov dx,8020h mov cl,4 PlaySchleife: mov Byte Ptr al,[Offset Puffer+bx] mov ch,al ; Wert retten in ch shr al,cl ; oberes Nibble mov ah,al ; Beginn UP Lautstrke_al out dx,al ; Bit 7 in al mu 0 sein cmp ah,0 je Null1 Ein3: nop dec al jne Ein3 Null1: xor ah,0fh ; Auszeit = 15-Einzeit mov al,128 out dx,al cmp ah,0 je Null2 Aus3: nop dec ah jne Aus3 ; Ende UP Lautstrke_al Null2: mov al,ch and al,0Fh ; dann unteres Nibble mov ah,al out dx,al ; Bit 7 in al mu 0 sein cmp al,0 je Null3 Ein4: nop dec al jne Ein4 Null3: xor ah,0fh ; Auszeit = 15-Einzeit mov al,128 out dx,al cmp ah,0 je Null4 Aus4: nop dec ah jne Aus4 ; Ende UP Lautstrke_al Null4: inc bx cmp bx,Anzahl jne PlaySchleife ret Testlauf: mov dx,8078h in al,dx mov cl,4 shr al,cl mov ah,al ; Beginn UP Lautstrke_al mov dx,8020h out dx,al ; Bit 7 in al mu 0 sein cmp ah,0 je Null0 Ein1: nop dec al jne Ein1 Null0: xor ah,0fh ; Auszeit = 15-Einzeit mov al,128 out dx,al cmp ah,0 je Null5 mov dx,8078h Aus1: nop dec ah jne Aus1 ; Ende UP Lautstrke_al Null5: mov ah,1 Int 16h ; Tastaturpuffer prfen jz 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 schlieen 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,Anzahl int 21h mov ah,3eh ; Datei schlieen int 21h ret 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 4bit v0.1 / 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