From 2902fc7a532edff250460bfbd8e7a31eedaa980b Mon Sep 17 00:00:00 2001 From: Javier Degirolmo Date: Sun, 29 Apr 2012 15:57:47 -0300 Subject: FM loader code optimized (Oerg's work), also some FM-related bugfixes around --- src-z80/player/fm.z80 | 106 +++++++------------------------------------------- 1 file changed, 13 insertions(+), 93 deletions(-) (limited to 'src-z80/player/fm.z80') diff --git a/src-z80/player/fm.z80 b/src-z80/player/fm.z80 index 4c0b565..ddfef66 100644 --- a/src-z80/player/fm.z80 +++ b/src-z80/player/fm.z80 @@ -367,110 +367,30 @@ LoadFMDirect: ex af, af' sub $B0-$30 - - ex af, af' ; Write registers $30-$3C - PollPCM - ex af, af' - - ld (iy+0), a - ld b, (hl) - nop - ld (iy+1), b - add 4 - inc l - nop + ld b, 7*4 ; Load operator registers into the YM2612 +.loadfmloop: ld (iy+0), a - ld b, (hl) - nop - ld (iy+1), b - add 4 - inc l - nop - - ld (iy+0), a - ld b, (hl) - nop - ld (iy+1), b + ld c, (hl) + ld (iy+1), c add 4 inc l - nop + djnz .loadfmloop - ld (iy+0), a - ld b, (hl) - nop - ld (iy+1), b - add 4 - inc l - nop - - ld b, 4 ; Write registers $40-$4C -.reg40: - ld c, a - push af PollPCM - ld (iy+0), c + ld a, l ; Store operator TLs (needed to set the + sub 24 ; volume properly when it changes) + ld l, a + ld b, 4 +.loadfmsavetl: ld a, (hl) ld (de), a - ld (iy+1), a ld a, e add 8 ld e, a - - pop af - add 4 - inc l - djnz .reg40 - - ld b, 20/4 ; Write registers $50-$5C -.reg50: - ex af, af' - PollPCM - ex af, af' - - ld (iy+0), a - ld c, (hl) - nop - ld (iy+1), c - add 4 - inc l - nop - - ld (iy+0), a - ld c, (hl) - nop - ld (iy+1), c - add 4 - inc l - nop - - ld (iy+0), a - ld c, (hl) - nop - ld (iy+1), c - add 4 - inc l - nop - - ld (iy+0), a - ld c, (hl) - nop - ld (iy+1), c - add 4 - inc l - - djnz .reg50 - - PollPCM - - ex de, hl - ld a, l - sub 8*6 - ld l, a - ld b, (hl) - add 8 - ld l, a + inc l + djnz .loadfmsavetl PollPCM @@ -553,7 +473,7 @@ SetFMVolLoad: push de push hl - and $07 + and $07 ; Get channel ID push af ld h, RAM_FMData>>8 ; Get address of FM data -- cgit v1.2.3