Page 9 of 20
Posted: Wed Feb 14, 2007 12:29 pm
by Stef
TmEE co.(TM) wrote:Stef 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
Your code is really understandable, your coding style is exactly like mine


Posted: Thu Feb 15, 2007 8:49 am
by TmEE co.(TM)
Do you change bank for every sample ?
Posted: Thu Feb 15, 2007 9:44 am
by Stef
TmEE co.(TM) wrote:Do you change bank for every sample ?
Nope, i'm testing for sample address bit 15 change.
If changed then i set bank else i don't

Posted: Thu Feb 15, 2007 1:35 pm
by TmEE co.(TM)
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.
Posted: Thu Feb 15, 2007 2:18 pm
by Stef
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.
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...
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

Posted: Fri Feb 16, 2007 6:37 am
by TmEE co.(TM)
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
Posted: Fri Feb 16, 2007 8:47 am
by Stef
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
I know AS assembler is sometime taking shorter in mnemonic.
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)
Posted: Fri Feb 16, 2007 10:36 am
by TmEE co.(TM)
OK, now I see, I prefer to use faster stuff
Posted: Fri Feb 16, 2007 11:15 am
by Stef
TmEE co.(TM) wrote:OK, now I see, I prefer to use faster stuff
This code is used at init time, just to keep the sample address in DE register

By the way, you can freely modify the source for your needs. All improvements are welcome also

Posted: Fri Feb 16, 2007 5:04 pm
by TmEE co.(TM)
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 ?
Posted: Fri Feb 16, 2007 6:48 pm
by Stef
TmEE 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 ?
I think there is always way to improve it, not necessary on speed, but maybe on feature as loop playing :p
Using X and Y permit me to avoid a memory access so i gain some cycles here yeah

Posted: Fri Feb 16, 2007 10:55 pm
by Stef
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
Posted: Sat Feb 17, 2007 12:10 pm
by TmEE co.(TM)
I'll check it out ... on monday, I have dial up at home and downloading 1MB is pain but to talk about 13MB !
Posted: Sat Feb 17, 2007 4:09 pm
by Pascal
kick ass !!!

thanks !!! can i use the driver only in my game project ?
Posted: Sat Feb 17, 2007 6:34 pm
by Stef
Pascal wrote:kick ass !!!

thanks !!! can i use the driver only in my game project ?
You can use anything as you want of course

I put it in the mini devkit because it's common to have it here but you can use freely all part as you want (and then include some part of source in your project).