z80 timing accuracy and M1 cycle (Emulation MSX Fora)MSX Resource Center MSXdev 2008 - MSX1 development bonanza!           
            
English Nederlands Español Português Russian         
 Nieuws
   Voorpagina
  Nieuws archief
  Nieuws onderwerpen

 Informatie
   MSX Fora
  Artikelen
  Recensies
  Beursverslagen
  Fotoreportages
  Beurzen en meetings
  Enquêtes
  Links
  Zoek

 Software
   Downloads
  Webshop

 MRC
   Wie we zijn
  Kom bij ons team
  Doneren
  Policies
  Contact met het MRC
  Link naar Ons
  Statistieken

 Zoek
 
  

  

 Login
 

Gebruikersnaam

Wachtwoord




Ben je nog niet lid? Klik hier en word MSX vriend!


 Statistieken
 

Er zijn 118 gasten en 1 MSX vriend online

Je bent een anonieme bezoeker.
 

MSX Fora


MSX Fora

Emulation - z80 timing accuracy and M1 cycle

Ga naar pagina ( Vorige pagina 1 | 2 )
Schrijver

z80 timing accuracy and M1 cycle

msd
msx professional
Berichten: 607
Geplaatst: 24 December 2005, 17:41   
I think they should take 5.. and not 8
ARTRAG
msx master
Berichten: 1591
Geplaatst: 24 December 2005, 18:44   
@m9710797
thanks !! I corrected the error in my code, the sound is sligtly better
but the improvement isn't very big.
The problems could be simply in the freqency errors that are in my player itself.

If you have a true HW MSX and you want to try how the player works,
send me an email and I'll send you back the apo.com, the asm file and the data
computed with the new timings. In this way you can hear the differences of
an execution of apo.com on the emulator and on the true HW and tell me if the
errors are due to my alghiritm or to the opemmsx timings.
My email is in my profile.



ARTRAG
msx master
Berichten: 1591
Geplaatst: 28 December 2005, 17:40   
Hi people, I am again facing the debug of a cycle accurate PCM player,
have a look at this code (compile with sjasm plus)
;------------------
     MACRO  PsgW reg,value
            ld a,reg    ; select AY channel A volume register ; 7+1
            out (#A0),a                                       ; 11+1
            ld  a,value                                       ; 7+1
            out (#A1),a ; and write back to the AY            ; 11+1
            ENDM                                 ; total 36+4 = 40T
;------------------


        MACRO Wait28 
            .4 nop          ; 5*4 = 20
            cp 0            ; 8    
            ENDM            ; total 28
            
        MACRO Wait68 
            .2 ex (sp),hl   ; 20*2 =40
            Wait28
            ENDM            ; total 68


;------------------

        MACRO next  reg
            ld  a,(hl)  ; 8
            .4 rrca     ; 4*5
            and 15      ; 8
            ld  reg,a   ; 5
            ld  a,(hl)  ; 8
            and 15      ; 8
            exx         ; 5
            ld  reg,a   ; 5
            exx         ; 5
            inc hl      ; 7
            ENDM            ; tot = 79

;------------------

        OUTPUT wavplay.com
       
        ORG 100h

START:
        di
        PsgW 0,255
        PsgW 1,255
        PsgW 2,255
        PsgW 3,255
        PsgW 4,255
        PsgW 5,255
        PsgW 6,255
        PsgW 7,10111111B


;-------------------------------------
; IN   HL - Sample Start address
;      HL'- Sample length
;-------------------------------------

        ld  hl, SAMPLE
        ld  bc,#0101
        ld  de,bc
        exx
        ld  hl, FINISH-SAMPLE+1
        ld  c,#A1           
        

.LOOP:      
        exx             ; 5
        dec b           ; 5
        jp nz,waitA     ; 11 
        next  b         ; 79
1       dec d           ; 5
        jp nz,waitB     ; 11 
        next  d         ; 79
2       dec e           ; 5
        jp nz,waitC     ; 11 
        next  e         ; 79
3       exx             ; 5
        
        ld  a,8         ; 8
        out (#a0),a     ; 12
        inc a           ; 5
        out (c),b       ; 14
        out (#a0),a     ; 12
        inc a           ; 5
        out (c),d       ; 14
        out (#a0),a     ; 12
        out (c),e       ; 14
            
        Wait28 
        
        dec hl          ; 7
        ld  a,h         ; 5
        or  l           ; 5
        jp  nz,.LOOP    ; 11
                        ; tot  = 447T
        ret

waitA   Wait68          ; 68
        jp   1B         ; 11
                        ; tot = 79

waitB   Wait68          ; 68
        jp   2B         ; 11
                        ; tot = 79
                        
waitC   Wait68          ; 68
        jp   3B         ; 11
                        ; tot = 79


;       b7b6b5b4|b3b2b1b0
;       NumTick |LevVolum


SAMPLE:
        include "C:\MATLAB6p5\work\out.txt"

FINISH:

ARTRAG
msx master
Berichten: 1591
Geplaatst: 28 December 2005, 17:44   
1) are my cycle computation correct?

The data are supposed to be stored in LRE where the high nibble is the counter
and the low nibble is the PSG channel volume.

2) is anyone able to get a faster/better coding that can fit with the 8Khz play requirements?

note that AFAI understand 8KHz => 447 Tcycles
ARTRAG
msx master
Berichten: 1591
Geplaatst: 28 December 2005, 19:16   
Sorry read LRE as RLE
 
Ga naar pagina ( Vorige pagina 1 | 2 )
 







(c) 1994 - 2008 Stichting MSX Resource Center. MSX is een trademark van MSX Licensing Corporation.