c60 ; MIDI interrupt routine INCLUDE SCREEN.MAC ..286 CSEG SEGMENT ASSUME CS:CSEG,DS:CSEG ORG 100h start: jmp begin Org_Rutin dd ? irqmask_save db ? midi_avail db ? midibyte db ? reset_dsp PROC NEAR mov dx,226h mov al,1 out dx,al mov cx,0ffh del: loop del mov al,0 out dx,al mov dx,22eh poll: in al,dx ;Check for data available or al,al jns poll mov dx,22ah in al,dx ;Check for ready byte cmp al,0aah jnz poll ret reset_dsp ENDP ;--------------------------------------------------------------------------- MIDI_ISR PROC FAR ASSUME CS:CSEG,DS:CSEG push ds push ax push dx mov dx,cs mov ds,dx mov dx,22ah ;read MIDI byte in al,dx mov midibyte,al ;store byte value in variable mov byte ptr[midi_avail],1 mov dx,22eh ;acknowledge DSP request in al,dx mov al,20h ;Signal end of interrupt out 20h,al pop dx pop ax pop ds iret MIDI_ISR ENDP ;======================================================================= main PROC NEAR ASSUME CS:CSEG,DS:CSEG push cs ;DS m†ste peka p† r„tt segment pop ds ;d† vi skall ladda om vektorn mov al,0Dh ;Fetch INT 0Dh vector mov ah,35h int 21h mov word ptr[Org_Rutin],bx ;Org_Rutinens OFFSET h„mtas mov word ptr[Org_Rutin+2],es ;Segment sparas mov ah,25h ;Install MIDI ISR mov al,0Dh mov dx,offset MIDI_ISR int 21h in al,21h mov irqmask_save,al ;save old interrupt mask and al,0DFh ;mask off bit to enable IRQ 5 out 21h,al mov dx,22ch wd1: in al,dx or al,al js wd1 mov al,35h ;MIDI UART interrupt mode command out dx,al whily: cmp byte ptr[midi_avail],1 jnz key mov byte ptr[midi_avail],0 mov dx,22ch wd3: in al,dx or al,al js wd3 mov al,byte ptr[midibyte] ;Write MIDI byte to MIDI out port out dx,al key: mov ah,01h int 16h jz whily call reset_dsp ;stop MIDI UART mode ;------------------------- mov al,irqmask_save ;Restore interrupt mask out 21h,al ; (turn off IRQ 5) ;------------------------ push ds mov ah,25h ;Restore old INT 0Dh mov al,0Dh mov dx,word ptr[Org_Rutin] mov ds,word ptr[Org_Rutin+2] int 21h pop ds ret main ENDP ;========================================================================= begin: call reset_dsp call main mov ax,4c00h int 21h CSEG ENDS END start . 0