TmEE co.(TM) wrote:Your code is really understandable, your coding style is exactly like mineStef wrote:Sorry i was really long, here's the link :
Z80 basic driver for sample play (source)
The code is commented here and there, hope you understand it
have fun![]()
how can i do music on megadrive?
Moderator: BigEvilCorporation
-
TmEE co.(TM)
- Very interested
- Posts: 2452
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
Do you change bank for every sample ?
Mida sa loed ? Nagunii aru ei saa 
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
-
TmEE co.(TM)
- Very interested
- Posts: 2452
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
No No, I meant in 2ch mixing.
Do you know any good doc on z80, I saw some things in your code which I thought cannot be done on z80 that way.
Do you know any good doc on z80, I saw some things in your code which I thought cannot be done on z80 that way.
Mida sa loed ? Nagunii aru ei saa 
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
-
Stef
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
In the 2ch mixing, of course i do it at each sample, you need to do it since your sample can be located in different bank...TmEE co.(TM) wrote:No No, I meant in 2ch mixing.
Do you know any good doc on z80, I saw some things in your code which I thought cannot be done on z80 that way.
I've a very nice Z80 document, i used it a lot to code my CZ80 core, specially to implement undocumented opcodes and flags.
I guess you're talking about the XH and YH use in my code ? i think i'm using an unofficial opcode but they are supported on all Z80 type CPU so no problems
Last edited by Stef on Fri Feb 16, 2007 8:38 am, edited 1 time in total.
-
TmEE co.(TM)
- Very interested
- Posts: 2452
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
I knew about XH, XL... but I saw LD DE, (ASDFGH) (<-reg maybe incorrect), I thought that you can only use A or HL (and X, Y) for memory stuff
Mida sa loed ? Nagunii aru ei saa 
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
-
Stef
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
I know AS assembler is sometime taking shorter in mnemonic.TmEE co.(TM) wrote:I knew about XH, XL... but I saw LD DE, (ASDFGH) (<-reg maybe incorrect), I thought that you can only use A or HL (and X, Y) for memory stuff
For instance it accept LD BC, DE even if that's not a valid mnemonic (internally it does LD B, D and LD C, E).
but about LD DE, (var)
actually this is a valid instruction (taking 20 cycles where LD HL, (var) takes only 16 cycles)
-
TmEE co.(TM)
- Very interested
- Posts: 2452
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
OK, now I see, I prefer to use faster stuff
Mida sa loed ? Nagunii aru ei saa 
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
-
TmEE co.(TM)
- Very interested
- Posts: 2452
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
I think I'm going to use some things, you know more advanced stuff than I. I looked at your code, and I think, I could not make it faster.
Is usage of X and Y slower than HL ?
Is usage of X and Y slower than HL ?
Mida sa loed ? Nagunii aru ei saa 
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
-
Stef
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
I think there is always way to improve it, not necessary on speed, but maybe on feature as loop playing :pTmEE co.(TM) wrote:I think I'm going to use some things, you know more advanced stuff than I. I looked at your code, and I think, I could not make it faster.
Is usage of X and Y slower than HL ?
Using X and Y permit me to avoid a memory access so i gain some cycles here yeah
-
Stef
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
I finally rewrote my 2 samples player z80 driver. I improved it : we can now stop a sample currently played :p Unfortunatly i definitly can't touch 16 Khz playback, i'm stuck at something close to ~14 Khz.
You can get it in the updated mini devkit :
http://www.spritesmind.net/_GenDev/foru ... c.php?t=14
You can get it in the updated mini devkit :
http://www.spritesmind.net/_GenDev/foru ... c.php?t=14
-
TmEE co.(TM)
- Very interested
- Posts: 2452
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
I'll check it out ... on monday, I have dial up at home and downloading 1MB is pain but to talk about 13MB !
Mida sa loed ? Nagunii aru ei saa 
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen