SHARE
TWEET

Untitled

a guest Apr 24th, 2018 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff -r 7497de643dd4 src/Player.asm
  2. --- a/src/Player.asm    Fri Feb 09 00:09:20 2018 +0100
  3. +++ b/src/Player.asm    Tue Apr 24 20:26:45 2018 +0000
  4. @@ -554,7 +554,7 @@
  5.     dw Player_Skip3               ; A7H
  6.     dw Player_Skip3               ; A8H
  7.     dw Player_Skip3               ; A9H
  8. -   dw Player_Skip3               ; AAH
  9. +   dw YM3812_instance.ProcessCommandDual         ; AAH
  10.     dw Player_Skip3               ; ABH
  11.     dw Player_Skip3               ; ACH
  12.     dw Player_Skip3               ; ADH
  13. diff -r 7497de643dd4 src/chips/YM3812.asm
  14. --- a/src/chips/YM3812.asm  Fri Feb 09 00:09:20 2018 +0100
  15. +++ b/src/chips/YM3812.asm  Tue Apr 24 20:26:45 2018 +0000
  16. @@ -11,6 +11,12 @@
  17.         jp System_Return
  18.     writeRegister: equ $ - 2
  19.         ENDP
  20. +
  21. +   ProcessCommandDual: PROC
  22. +       call Reader_ReadWord_IY
  23. +       jp System_Return
  24. +   writeRegister: equ $ - 2
  25. +       ENDP
  26.     ENDM
  27.  
  28.  ; ix = this
  29. @@ -24,12 +30,22 @@
  30.  ; ix = this
  31.  YM3812_Connect:
  32.     call Drivers_TryCreateMoonSound_IY
  33. -   ret nc
  34. +   jr nc, TryMoonSoundC0
  35.     call Chip_SetDriver
  36.     ld hl,MoonSound.SafeWriteRegister
  37.     add hl,de
  38.     ld (ix + YM3812.ProcessCommand.writeRegister),l
  39.     ld (ix + YM3812.ProcessCommand.writeRegister + 1),h
  40. +   call Chip_IsDualChip
  41. +   ret z
  42. +TryMoonSoundC0:
  43. +   call Drivers_TryCreateMoonSoundC0_IY
  44. +   ret nc
  45. +   call Chip_SetDriver2
  46. +   ld hl,MoonSoundC0.SafeWriteRegister
  47. +   add hl,de
  48. +   ld (ix + YM3812.ProcessCommandDual.writeRegister),l
  49. +   ld (ix + YM3812.ProcessCommandDual.writeRegister + 1),h
  50.     ret
  51.  
  52.  ;
  53. diff -r 7497de643dd4 src/drivers/Drivers.asm
  54. --- a/src/drivers/Drivers.asm   Fri Feb 09 00:09:20 2018 +0100
  55. +++ b/src/drivers/Drivers.asm   Tue Apr 24 20:26:45 2018 +0000
  56. @@ -9,6 +9,7 @@
  57.     INCLUDE "MSXMusic.asm"
  58.     INCLUDE "MSXAudio.asm"
  59.     INCLUDE "MoonSound.asm"
  60. +   INCLUDE "MoonSoundC0.asm"
  61.     INCLUDE "SCC.asm"
  62.     INCLUDE "SCCPlus.asm"
  63.     INCLUDE "Franky.asm"
  64. @@ -36,6 +37,8 @@
  65.         dw 0
  66.     moonSound:
  67.         dw 0
  68. +   moonSoundC0:
  69. +       dw 0
  70.     scc:
  71.         dw 0
  72.     sccPlus:
  73. @@ -96,6 +99,10 @@
  74.     call nz,MoonSound_Destruct
  75.     pop ix
  76.     push ix
  77. +   call Drivers_GetMoonSoundC0
  78. +   call nz,MoonSoundC0_Destruct
  79. +   pop ix
  80. +   push ix
  81.     call Drivers_GetSCC
  82.     call nz,SCC_Destruct
  83.     pop ix
  84. @@ -266,6 +273,28 @@
  85.     ret
  86.  
  87.  ; ix = this
  88. +; de <- MoonSound at C0 driver
  89. +; f <- c: succeeded
  90. +Drivers_TryCreateMoonSoundC0_IY:
  91. +   ld a,(iy + Drivers.moonSoundC0)
  92. +   or (iy + Drivers.moonSoundC0 + 1)
  93. +   ret nz
  94. +   call MoonSoundC0_Detect
  95. +   ret nc
  96. +   push ix
  97. +   ld ix,MoonSoundC0_instance
  98. +   call MoonSoundC0_Construct
  99. +   ld e,ixl
  100. +   ld d,ixh
  101. +   pop ix
  102. +   ld (iy + Drivers.moonSoundC0),e
  103. +   ld (iy + Drivers.moonSoundC0 + 1),d
  104. +   scf
  105. +   ret
  106. +
  107. +
  108. +
  109. +; ix = this
  110.  ; de <- SCC driver
  111.  ; f <- c: succeeded
  112.  Drivers_TryCreateSCC_IY:
  113. @@ -596,6 +625,19 @@
  114.     ret
  115.  
  116.  ; ix = this
  117. +; de <- MoonSound at C0 driver
  118. +; ix <- MoonSound at C0 driver
  119. +; f <- z: not set
  120. +Drivers_GetMoonSoundC0:
  121. +   ld e,(ix + Drivers.moonSoundC0)
  122. +   ld d,(ix + Drivers.moonSoundC0 + 1)
  123. +   ld ixl,e
  124. +   ld ixh,d
  125. +   ld a,e
  126. +   or d
  127. +   ret
  128. +
  129. +; ix = this
  130.  ; de <- SCC driver
  131.  ; ix <- SCC driver
  132.  ; f <- z: not set
  133. diff -r 7497de643dd4 src/drivers/MoonSound.asm
  134. --- a/src/drivers/MoonSound.asm Fri Feb 09 00:09:20 2018 +0100
  135. +++ b/src/drivers/MoonSound.asm Tue Apr 24 20:26:45 2018 +0000
  136. @@ -1,11 +1,14 @@
  137.  ;
  138.  ; MoonSound YMF278B OPL4
  139.  ;
  140. -MoonSound_STATUS: equ 0C4H
  141. -MoonSound_FM_ADDRESS: equ 0C4H
  142. -MoonSound_FM_DATA: equ 0C5H
  143. -MoonSound_FM2_ADDRESS: equ 0C6H
  144. -MoonSound_FM2_DATA: equ 0C7H
  145. +
  146. +MoonSound_BASE_PORT: equ 0C4H
  147. +
  148. +MoonSound_STATUS: equ 00H
  149. +MoonSound_FM_ADDRESS: equ 00H
  150. +MoonSound_FM_DATA: equ 01H
  151. +MoonSound_FM2_ADDRESS: equ 02H
  152. +MoonSound_FM2_DATA: equ 03H
  153.  MoonSound_WAVE_ADDRESS: equ 07EH
  154.  MoonSound_WAVE_DATA: equ 07FH
  155.  MoonSound_FM2_NEW: equ 05H
  156. @@ -16,7 +19,7 @@
  157.  MoonSound_WAVE_MEMORY_DATA: equ 06H
  158.  MoonSound_FREQUENCY: equ 33868800
  159.  
  160. -MoonSound: MACRO
  161. +MoonSound: MACRO ?moonsound_base_port
  162.     this:
  163.     super: Driver Driver_PrintInfoImpl
  164.     waveNumberMap:
  165. @@ -33,10 +36,10 @@
  166.     ; a = register
  167.     ; d = value
  168.     WriteRegister:
  169. -       out (MoonSound_FM_ADDRESS),a
  170. +       out (MoonSound_FM_ADDRESS + ?moonsound_base_port),a
  171.         nop     ; wait 56 cycles (5.9 bus cycles)
  172.         ld a,d
  173. -       out (MoonSound_FM_DATA),a
  174. +       out (MoonSound_FM_DATA + ?moonsound_base_port),a
  175.         ret
  176.     MaskControl:
  177.         cp 8H
  178. @@ -50,10 +53,10 @@
  179.     ; a = register
  180.     ; d = value
  181.     WriteRegister2:
  182. -       out (MoonSound_FM2_ADDRESS),a
  183. +       out (MoonSound_FM2_ADDRESS + ?moonsound_base_port),a
  184.         nop     ; wait 56 cycles (5.9 bus cycles)
  185.         ld a,d
  186. -       out (MoonSound_FM2_DATA),a
  187. +       out (MoonSound_FM2_DATA + ?moonsound_base_port),a
  188.         ret
  189.  
  190.     ; e = register
  191. @@ -505,7 +508,7 @@
  192.  
  193.  ; f <- c: Found
  194.  MoonSound_Detect:
  195. -   in a,(MoonSound_STATUS)
  196. +   in a,(MoonSound_STATUS + MoonSound_BASE_PORT)
  197.     and 11111101B  ; sometimes LD is set
  198.     sub 00H
  199.     and a
  200. @@ -519,6 +522,6 @@
  201.  
  202.     SECTION RAM
  203.  
  204. -MoonSound_instance: MoonSound
  205. +MoonSound_instance: MoonSound MoonSound_BASE_PORT
  206.  
  207.     ENDS
  208. diff -r 7497de643dd4 src/drivers/MoonSoundC0.asm
  209. --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
  210. +++ b/src/drivers/MoonSoundC0.asm   Tue Apr 24 20:26:45 2018 +0000
  211. @@ -0,0 +1,39 @@
  212. +;
  213. +; MoonSound YMF278B OPL4 in C0 I/O port base (configured DalSoRi R2)
  214. +;
  215. +
  216. +MoonSoundC0_BASE_PORT: equ 0C0H
  217. +
  218. +
  219. +MoonSoundC0: equ MoonSound
  220. +
  221. +; ix = this
  222. +MoonSoundC0_Destruct: equ MoonSound_Destruct
  223. +MoonSoundC0_SafeWriteRegister: equ MoonSound_SafeWriteRegister
  224. +
  225. +; ix = this
  226. +MoonSoundC0_Construct:
  227. +   call MoonSound_Construct
  228. +   ld bc, MoonSoundC0_name
  229. +   ld (ix + Driver.name),c
  230. +   ld (ix + Driver.name + 1),b
  231. +   ret
  232. +
  233. +; f <- c: Found
  234. +MoonSoundC0_Detect:
  235. +   in a,(MoonSound_STATUS + MoonSoundC0_BASE_PORT)
  236. +   and 11111101B  ; sometimes LD is set
  237. +   sub 00H
  238. +   and a
  239. +   ret nz
  240. +   scf
  241. +   ret
  242. +
  243. +MoonSoundC0_name:
  244. +   db "MoonSound (at C0H)",0
  245. +
  246. +   SECTION RAM
  247. +
  248. +MoonSoundC0_instance: MoonSound MoonSoundC0_BASE_PORT
  249. +
  250. +   ENDS
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top