fix incomplete midi reset

affects windows midi implemetation
This commit is contained in:
Eugene Lozovoy
2023-08-07 13:30:34 +03:00
parent db658f7c31
commit 0a31be83a2
2 changed files with 20 additions and 14 deletions

View File

@ -131,20 +131,24 @@ player_loop:
player_reset_chip:
ld a, #ff ; issue reset status
di : call uart_putc : ei ; ...
halt ; wait 20ms just for safety
ld ixl, #b0 ; set controller message for channels #0..#f
ld a, ixl ;
call uart_putc ; ...
ei : halt ; wait 20ms just for safety
ld l, #b0 ; send controller message for channels #0..#f
ld a, l ;
.loop:
di : call uart_putc : ei ;
ld a, 123 ; 123 = All notes off (this message stops all the notes that are currently playing)
di : call uart_putc : ei ;
xor a ; 0 = value
di : call uart_putc : ei ;
inc ixl ;
ld a, ixl ;
call uart_putc ; channel number
ld a, #78 : call uart_putc ; #78 = All Sound Off
xor a : call uart_putc ; 0 = value
ld a, l : call uart_putc ; channel number
ld a, #79 : call uart_putc ; #79 = Reset All Controllers
xor a : call uart_putc ; 0 = value
ld a, l : call uart_putc ; channel number
ld a, #7b : call uart_putc ; #7b = All Notes Off
xor a : call uart_putc ; 0 = value
inc l ;
ld a, l ;
cp #c0 ;
jp nz, .loop ;
jr nz, .loop ;
ret ;

View File

@ -57,6 +57,7 @@ uart_init:
; OUT - BC - garbage
; OUT - DE - garbage
uart_putc:
di ;
ld e, a ; Store the byte to send.
ld bc, #fffd ;
ld a, #0e ;
@ -115,7 +116,8 @@ uart_putc:
.E: ld e, 6 ; (7) Delay for 101 T-states (28.5us). Self modifying code! See uart_init.patch_for_cpu_*
1: dec e ; (4)
jr nz, 1b ; (12/7)
ret ; (10)
ei ;
ret ;
; IN - A - byte to put into tx buffer
@ -162,7 +164,7 @@ uart_flush_txbuf:
ld hl, uart_txbuf ;
.loop: ;
ld a, (hl) ;
di : call uart_putc : ei ;
call uart_putc ;
inc hl ;
dec ixl ;
jp nz, .loop ;