Browse Source

sms, no nmi generation for start button on gg
sms, fix pause button (cz80 nmi)
sound, fix ym2612 arm assembly (ssg-eg)
Added DrZ80 back

root 2 years ago
parent
commit
21ab603d7e
4 changed files with 16 additions and 13 deletions
  1. 1 2
      Makefile
  2. 1 1
      pico/pico_int.h
  3. 2 1
      pico/sms.c
  4. 12 9
      pico/sound/ym2612_arm.S

+ 1 - 2
Makefile

@@ -60,8 +60,7 @@ endif
 use_libchdr ?= 1
 ifeq "$(ARCH)" "arm"
 use_cyclone ?= 1
-use_drz80 ?= 0
-use_cz80 ?= 1
+use_drz80 ?= 1
 use_sh2drc ?= 1
 use_svpdrc ?= 1
 

+ 1 - 1
pico/pico_int.h

@@ -180,7 +180,7 @@ extern struct DrZ80 drZ80;
 #define z80_run_nr(cycles) Cz80_Exec(&CZ80, cycles)
 #define z80_int()          Cz80_Set_IRQ(&CZ80, 0, HOLD_LINE)
 #define z80_int_assert(a)  Cz80_Set_IRQ(&CZ80, 0, (a) ? ASSERT_LINE : CLEAR_LINE)
-#define z80_nmi()          Cz80_Set_IRQ(&CZ80, IRQ_LINE_NMI, 0)
+#define z80_nmi()          Cz80_Set_IRQ(&CZ80, IRQ_LINE_NMI, ASSERT_LINE)
 
 #define z80_cyclesLeft     (CZ80.ICount - CZ80.ExtraCycles)
 #define z80_subCLeft(c)    CZ80.ICount -= c

+ 2 - 1
pico/sms.c

@@ -678,8 +678,9 @@ void PicoFrameMS(void)
   z80_resetCycles();
   PsndStartFrame();
 
+  // for SMS the pause button generates an NMI, for GG ths is not the case
   nmi = (PicoIn.pad[0] >> 7) & 1;
-  if (!Pico.ms.nmi_state && nmi)
+  if (!(Pico.m.hardware & 0x1) && !Pico.ms.nmi_state && nmi)
     z80_nmi();
   Pico.ms.nmi_state = nmi;
 

+ 12 - 9
pico/sound/ym2612_arm.S

@@ -166,7 +166,7 @@
     addpl   r0, r0, r2, asr #4
     cmp     r0, #0               @ if (volume <= MIN_ATT_INDEX)
     bgt     10f
-    ldr     r2, [r5,#0x1c]
+    ldr     r2, [r5,#0x1c]       @ sl
     mov     r0, #0
     cmp     r2, #0
     movne   r3, #EG_DEC
@@ -175,8 +175,7 @@
     b       10f
 
 1:  @ EG_REL
-    mov     r2, #0x200
-    cmp     r0, r2               @ if ( volume >= 0x200 )
+    cmp     r0, #0x200           @ if ( volume >= 0x200 )
     movge   r0, #1024
     subge   r0, #1
     movge   r3, #EG_OFF
@@ -236,7 +235,7 @@
     eorne   r0, r0, #0x400                @ ssgn ^= 4
     strneh  r0, [r5,#0x30]
     moveq   r0, #0
-    streq   r0, [r5,#0x0c]                @ phase = 0
+    streq   r0, [lr,#0x10]                @ phase = 0
 
     cmp     r2, #EG_ATT                   @ if ( state != EG_ATT )
     beq     9f
@@ -250,11 +249,11 @@
     cmp     r0, #32+62                    @ if ( ar+ksr >= 32+62 )
     movge   r3, #0
     strgeh  r3, [r5,#0x1a]                @ volume = MIN_ATT
-    bge     9f
+    bge     8f
 
     cmp     r3, #0
     movgt   r2, #EG_ATT
-    strb    r2, [r5,#0x17]                @ state
+8:  strb    r2, [r5,#0x17]                @ state
 9:
 .endm
 
@@ -277,8 +276,6 @@
     rsbge   r0, r0, #0x200                @ volume = (0x200-volume) & MAX_ATT
     lslge   r0, r0, #22
     lsrge   r0, r0, #22
-    ldrh    r0, [r5,#0x1a]                @ volume
-    ldrh    r3, [r5,#0x18]                @ tl
 
     add     r0, r0, r3                    @ volume += tl
     strh    r0, [r5,#0x34]                @ vol_out
@@ -731,18 +728,24 @@ crl_loop:
 
 ssg_loop:
     mov     r6, #4
+    bic     r4, r4, #0x10           @ ssg_update
 ssg_upd_loop:
+    @ use lr as a pointer to the slot phases stored in the context
     update_ssg_eg
 #if 0
     subs    r6, r6, #1
+    addne   lr, lr, #4
     addne   r5, r5, #SLOT_STRUCT_SIZE
 #else
+    add     lr, lr, #4*2
     add     r5, r5, #SLOT_STRUCT_SIZE*2
     update_ssg_eg
     subs    r6, r6, #2
+    subne   lr, lr, #4
     subne   r5, r5, #SLOT_STRUCT_SIZE
 #endif
     bne     ssg_upd_loop
+    sub     lr, lr, #4*3
     sub     r5, r5, #SLOT_STRUCT_SIZE*3
 
     subs    r7, r7, #1<<EG_SH
@@ -753,7 +756,7 @@ ssg_done:
     @ -- EG --
     add     r8, r8, r9
     cmp     r8, #EG_TIMER_OVERFLOW
-    bcc     volout_upd
+    blo     volout_upd
     ldr     r1, [lr, #0x3c]     @ eg_cnt
 eg_loop:
     sub     r8, r8, #EG_TIMER_OVERFLOW