timerlo    equ       $bfd400
timerhi    equ       $bfd500
inter      equ       $bfdd00
control    equ       $bfde00
base1      equ       $BFE001
base2      equ       $BFD000
dra2       equ       base2+$000
drb1       equ       base1+$100
ddra2      equ       base2+$200
ddrb1      equ       base1+$300
           CMPI.L    #10,D0
           BNE       Abort
           JSR       _WERTE
           MOVE.L    #$7FC00,D7
           SUB.L     D6,D7
           SUB.L     D6,D7
           movea.l   D7,A0
           move.l    D6,d0
lop1:      clr.w     (a0)+         ; Speicher
           dbra      d0,lop1       ; loeschen
wa1:       andi.b    #64,$bfe001   ;auf Mausdruck
           bne.s     wa1           ;warten
           movea.l   4,a6          ; Supervisor-Modus
           lea.l     super,a5
           jmp       -30(a6)
super:     move.l    D7,buffer
           move.w    #$2700,SR          ; Interrupts sperren
           move.b    #%00000000,ddrb1   ; Parallel-Port
           move.b    ddra2,d0           ; initialisieren
           andi.b    #%11111010,d0
           ori.b     #%00000100,d0
           move.b    d0,ddra2
           move.b    D4,timerlo
           move.b    #0,timerhi
           move.b    #%01111110,inter
           move.b    #%10000001,inter
           move.b    #%10010101,control
           move.l    buffer,$dff0a0     ; Soundparameter
           move.w    #64,$dff0a8        ; setzen
           move.w    D2,$dff0a6
           move.w    D6,$dff0a4
           move.l    buffer,$dff0b0
           move.w    #64,$dff0b8
           move.w    D2,$dff0b6
           move.w    D6,$dff0b4
           move.w    #$8003,$dff096
           lea.l     block,a1           ; Farbdefinitionen
           move.w    #$0000,block
           move.w    #$0080,block+238
           move.w    #$0090,block+240
           move.w    #$00a0,block+242
           move.w    #$00b0,block+244
           move.w    #$00c0,block+246
           move.w    #$00d0,block+248
           move.w    #$00e0,block+250
           move.w    #$00f0,block+252
           move.w    #$0f00,block+254
           move.w    #$0f00,block+256
schleife:  movea.l   D7,a0
           move.l    D5,d3
schleife1: andi.b    #%00000001,inter
           beq.S     schleife1
           ori.b     #%00000100,dra2      ; Digitalisierung
           andi.b    #%11111011,dra2      ; starten
busy:      andi.b    #%00000001,dra2      ; Noch beschäftigt?
           beq.S     busy           ; Ja,warten
           clr.l     d1
           move.b    drb1,d1        ; Sounddaten holen
           eori.b    #128,d1        ; Umrechnung
           move.b    d1,(a0)+       ; Wert speichern
           asl.w     #1,d1          ; Farbe berechnen
           move.w    0(a1,d1),$DFF180
           subq.l    #1,d3
           bpl.S     schleife1
           andi.b    #64,$bfe001    ; Linke Maustaste...
           bne.S     schleife       ; ...nicht gedrÜckt
           movea.l   D7,a0
           move.l    D5,d3
w1:        move.w    #$0bb0,$dff180
           andi.b    #128,$bfe001
           beq.s     speichern
           andi.b    #64,$bfe001
           beq.s     w1
schleife2: move.w    #$00bb,$dff180
           andi.b    #%00000001,inter
           beq.S     schleife2
           ori.b     #%00000100,dra2      ; Digitalisierung
           andi.b    #%11111011,dra2      ; starten
busy2:     move.w    #$0b0b,$dff180
           andi.b    #%00000001,dra2      ; Noch beschäftigt?
           beq.S     busy2                ; Ja,warten
           clr.l     d1          
           move.b    drb1,d1              ; Sounddaten holen
           eori.b    #128,d1              ; Umrechnung
           cmpi.b    #0,d1
           beq.s     schleife2
           move.b    d1,(a0)+             ; Wert speichern
           asl.w     #1,d1                ; Farbe berechnen
           move.w    0(a1,d1),$DFF180
           subq.l    #1,d3
           bra       schleife1
speichern: move.w    #0,SR                ;Interrupts zulassen
           movea.l   4,a6
           movea.l   #DOS_Name,a1
           clr.l     d0
           jsr       -552(a6)
           movea.l   d0,a6
           tst.l     d0
           beq.s     Abort
           jsr       -60(a6)
           move.l    d0,d1
           beq.s     Abort
           move.l    D7,d2
           move.l    D5,d3
           jsr       -48(a6)
           clr.l     d0
Abort:     rts
_WERTE:    MOVE.B    (A0)+,D1   ;1.Zeichen in D1 lesen
           SUB.B     #48,D1     ;48 subtrahieren
           EXT.W     D1
           MULU      #100,D1    ;mit 100 multiplizieren
           MOVE.L    D1,D2      ;D1 nach D2 transportieren

           MOVE.B    (A0)+,D1   ;2.Zeichen in D1 lesen
           SUB.B     #48,D1     ;48 subtrahieren
           EXT.W     D1
           MULU      #10,D1     ;mit 10 multiplizieren
           ADD.L     D1,D2      ;D2=D2+D1

           MOVE.B    (A0)+,D1   ;3.Zeichen in D1 lesen
           SUB.B     #48,D1     ;48 subtrahieren
           EXT.W     D1
           EXT.L     D1
           ADD.L     D1,D2      ;D2=D2+D1

           MOVE.B    (A0)+,D1   ;FREIZEICHEN UEBERLESEN
           MOVE.L    D2,D4      ;D2=SPEED
           DIVU      #5,D4      ;D4=SPEED/5
; JETZT DEN WERT FÜR DIE LAENGE !!!
           MOVE.B    (A0)+,D1   ;1.ZEICHEN LESEN
           SUB.B     #48,D1
           EXT.W     D1
           MULU      #20000,D1  ;MAL 20000,IN WOERTEN
           MOVE.L    D1,D5      ;IN D5 SPEICHERN

           MOVE.B    (A0)+,D1   ;2.ZEICHEN LESEN
           SUB.B     #48,D1
           EXT.W     D1
           MULU      #2000,D1
           ADD.L     D1,D5      ;D5=D5+D1

           MOVE.B    (A0)+,D1   ;3.ZEICHEN LESEN
           SUB.B     #48,D1
           EXT.W     D1
           MULU      #200,D1
           ADD.L     D1,D5

           MOVE.B    (A0)+,D1   ;4.ZEICHEN LESEN
           SUB.B     #48,D1
           EXT.W     D1
           MULU      #20,D1
           ADD.L     D1,D5

           MOVE.B    (A0)+,D1   ;5.ZEICHEN LESEN
           SUB.B     #48,D1
           EXT.W     D1
           MULU      #2,D1
           ADD.L     D1,D5      ;LAENGE IN D5 !!

           MOVE.L    D5,D6
           DIVU      #2,D6      ;LAENGE/2 IN D6!!
           RTS

           DATA
buffer:    dc.l      0
block:     dcb.w     256,10
DOS_Name:  dc.b      'dos.library',0

