aboutsummaryrefslogtreecommitdiff
path: root/src-z80
diff options
context:
space:
mode:
authorJavier Degirolmo2011-12-07 19:58:15 -0300
committerJavier Degirolmo2011-12-07 19:58:15 -0300
commit84ca3186406f65f65a18b18130dcecab2c78e2d3 (patch)
tree1419cf0a3e2d7baf235b1e3f5574e2be9177b7b7 /src-z80
parent4f1d28c46ba1b4d7e9b3a7ef81e4ec7820eb041f (diff)
Some updates... Trying to fix SFX restoring but still broken
Diffstat (limited to 'src-z80')
-rw-r--r--src-z80/core/bgm.z8014
-rw-r--r--src-z80/core/main.z802
-rw-r--r--src-z80/core/sfx.z805
-rw-r--r--src-z80/player/fm.z8033
-rw-r--r--src-z80/player/freq.z8010
5 files changed, 25 insertions, 39 deletions
diff --git a/src-z80/core/bgm.z80 b/src-z80/core/bgm.z80
index c1650f1..ebda240 100644
--- a/src-z80/core/bgm.z80
+++ b/src-z80/core/bgm.z80
@@ -41,8 +41,17 @@ PlayBGM:
ld hl, ProcessBGM ; Tell Echo to process BGM
ld (DoTick_BGM+1), hl
+
+ ld b, 8 ; Kill all FM channels explicitly
+.resetallfm:
+ ld a, b
+ and $04
+ rrca
+ ld iyl, a
+ ld a, b
+ call KillFM
+ djnz .resetallfm
- PollPCM
jp IdleLoop ; End of subroutine
;****************************************************************************
@@ -244,7 +253,8 @@ ClearBGM:
.resetfm:
PollPCM
- xor a ; Reset BGM volume
+ ;xor a ; Reset BGM volume
+ ld a, $7F
ld (de), a
dec e
diff --git a/src-z80/core/main.z80 b/src-z80/core/main.z80
index 9ac1aa4..bc63da9 100644
--- a/src-z80/core/main.z80
+++ b/src-z80/core/main.z80
@@ -90,7 +90,7 @@ EntryPoint:
ld (ix+1), $C9
ld (ix+0), $27
ld (ix+1), $3F
-
+
jp IdleLoop ; Go into idle loop
;****************************************************************************
diff --git a/src-z80/core/sfx.z80 b/src-z80/core/sfx.z80
index f32a8f0..6a553bb 100644
--- a/src-z80/core/sfx.z80
+++ b/src-z80/core/sfx.z80
@@ -284,13 +284,9 @@ ClearSFX:
ld l, a
push bc
- push de
- push hl
ld a, b
ld b, (hl)
call LoadFMDirect
- pop hl
- pop de
pop bc
PollPCM
@@ -298,6 +294,7 @@ ClearSFX:
ld a, b ; Restore BGM FM volume
add RAM_BGMFMVol&$FF
ld l, a
+ ld a, b
ld b, (hl)
call SetFMVolLoad
diff --git a/src-z80/player/fm.z80 b/src-z80/player/fm.z80
index fa86538..96c9f4c 100644
--- a/src-z80/player/fm.z80
+++ b/src-z80/player/fm.z80
@@ -489,7 +489,7 @@ LoadFMDirect:
;****************************************************************************
SetFMVolSFX:
- call SetFMVolEvent ; We're just a wrapper
+ call SetFMVolSFXEvent ; We're just a wrapper
jp ProcessSFXRun ; End of subroutine
SetFMVolBGM:
@@ -501,10 +501,7 @@ SetFMVolBGM:
push de
push bc
ld a, b
- ;ld de, RAM_BGMFMVol ; Store BGM volume
- ;add e
- ;ld e, a
- ld d, RAM_BGMFMVol>>8
+ ld d, RAM_BGMFMVol>>8 ; Store BGM volume
add RAM_BGMFMVol&$FF
ld e, a
PollPCM
@@ -544,28 +541,16 @@ SetFMVolBGM:
PollPCM
pop af
- ;call SetFMVolBGMEvent ; We're just a wrapper
call SetFMVolLoad ; We're just a wrapper
jp ProcessBGMRun ; End of subroutine
-SetFMVolEvent:
+SetFMVolSFXEvent:
push af
PollPCM
call GetParam ; Get new volume
PollPCM
pop af
-SetFMVolBGMEvent:
- ;push bc
- ;push de
- ;push hl
-
- ;ld hl, RAM_FMVolume ; Store new volume
- ;and $07
- ;add l
- ;ld l, a
- ;ld (hl), b
-
SetFMVolLoad:
push bc
push de
@@ -573,21 +558,15 @@ SetFMVolLoad:
and $07
- ;ex af, af'
- ;PollPCM
- ;ld a, l ; Get address of FM data
- ;add 8
- ;ld l, a
- ;ex af, af'
-
push af
ld h, RAM_FMData>>8 ; Get address of FM data
add RAM_FMData&$FF
ld l, a
+
+ ex af, af'
PollPCM
- pop af
+ ex af, af'
- push af
and $04 ; Determine which port to write
rrca
ld iyl, a
diff --git a/src-z80/player/freq.z80 b/src-z80/player/freq.z80
index a469c0b..d12ee2b 100644
--- a/src-z80/player/freq.z80
+++ b/src-z80/player/freq.z80
@@ -97,9 +97,9 @@ FMFreqTable:
;****************************************************************************
DummyFMInstr:
- db $7F ; $40..$4C
- db $1F ; $50..$5C
- db $1F ; $60..$6C
- db $1F ; $70..$7C
- db $0F ; $80..$8C
+ db $FF ; $40..$4C
+ db $FF ; $50..$5C
+ db $FF ; $60..$6C
+ db $FF ; $70..$7C
+ db $FF ; $80..$8C
db $00 ; $90..$9C