MegaCore (z80/fm/psg emulator/debugger)

Talk about development tools here

Moderator: BigEvilCorporation

Post Reply
sigflup
Very interested
Posts: 111
Joined: Mon Sep 06, 2010 12:05 pm
Contact:

MegaCore (z80/fm/psg emulator/debugger)

Post by sigflup » Thu Feb 20, 2014 5:38 pm


sigflup
Very interested
Posts: 111
Joined: Mon Sep 06, 2010 12:05 pm
Contact:

Post by sigflup » Thu Feb 20, 2014 11:47 pm

... could use some pcm work

Mask of Destiny
Very interested
Posts: 615
Joined: Thu Nov 30, 2006 6:30 am

Post by Mask of Destiny » Fri Feb 21, 2014 1:56 am

I gave it a quick spin. Seems to work fine under WINE. My WIP sound driver doesn't seem to work in it though unless I'm misunderstanding how this works. It does seem to do something as I hear some quiet staticy noises, but nothing resembling the samples it's supposed to play. Unless that's what you mean by "could use some pcm work".

Seems like a neat tool though.

sigflup
Very interested
Posts: 111
Joined: Mon Sep 06, 2010 12:05 pm
Contact:

Post by sigflup » Fri Feb 21, 2014 2:11 am

just the PCM channel bandwidth is a bit lacking. Should sound pretty good otherwise.Should sound like in the youtube video. Hey!!! you're one unix!? Sweet!!! Let me prepair you the source... hold on. Should compile on debian with sdl sdl_image yacc lex dependencies

http://theadesilva.com/z80.tar.gz

I developed it on an openbsd box

just type make. That should produce the binary z80 if all goes well

Mask of Destiny
Very interested
Posts: 615
Joined: Thu Nov 30, 2006 6:30 am

Post by Mask of Destiny » Fri Feb 21, 2014 3:31 am

I was able to get it to build with some tweaks to the Makefile, but there are a bunch of warnings about casts between integers and pointers of different sizes. The produced binary runs, but crashes when a command is entered near the lines the warnings were complaining about.

I'm running Ubuntu on an x86-64 CPU here so presumably it's casting from an int to a pointer type. I'm not familiar enough with Yacc to suggest a fix though. It's possible that the problem is my local Yacc is actually Bison instead of Berkeley Yacc though the latter is available.

The warnings from lang.y are below:

Code: Select all

lang.y:313:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   value= (value_t *)$2;  
          ^
lang.y:331:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   value = (value_t *)$2;
           ^
lang.y:403:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   value = (value_t *)$2;
           ^
lang.y:414:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   value = (value_t *)$2;
           ^
lang.y:457:18: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
          value = (value_t *)$2;
                  ^
lang.y:475:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   value= (value_t *)$2;  
          ^
lang.y:476:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   value2=(value_t *)$3;
          ^
lang.y:505:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   value = (value_t *)$3;
           ^
lang.y:527:18: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
          value = (value_t *)$2; 
                  ^
lang.y:553:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   value = (value_t *)$2;
           ^
lang.y:596:38: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   $$ = (int)add_node(T, "vl:0", (void *)$1, 0);
                                      ^
lang.y:596:13: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   $$ = (int)add_node(T, "vl:0", (void *)$1, 0);
             ^
lang.y:599:45: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
          $$ = (int)add_node(T, "vl:1", (void *)$1, 1, $3);
                                             ^
lang.y:599:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
          $$ = (int)add_node(T, "vl:1", (void *)$1, 1, $3);
                    ^
lang.y: At top level:
lang.y:608:6: warning: conflicting types for ‘yyerror’ [enabled by default]
 void yyerror(const char *s) {
      ^
y.tab.c:2252:7: note: previous implicit declaration of ‘yyerror’ was here
       yyerror (YY_("syntax error"));

sigflup
Very interested
Posts: 111
Joined: Mon Sep 06, 2010 12:05 pm
Contact:

Post by sigflup » Fri Feb 21, 2014 4:18 am

hmm... I'm casting pointers as integers in my yacc grammar which went unnoticed. since I'm 32bit. yacc provides a union structure between nodes which I have to read up on. I'll have some time tomorrow afternoon to fix it. I'll message you when I'm done

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Fri Feb 21, 2014 7:14 am

Is there any way to let the driver run while script side loops and reads a memory location that signals "ready" ?
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

sigflup
Very interested
Posts: 111
Joined: Mon Sep 06, 2010 12:05 pm
Contact:

Post by sigflup » Sat Feb 22, 2014 5:23 am

Mask of Destiny> should compile clean now.

TmEE co.(TM)> I don't see a reason why not. Explain it to me a little more before I go about adding it. Like something that watches certain addresses and goes 'bing' when they change?

Maybe like a "watch" command. Example

watch 0x1003, 0x0033, 0x1004

that would watch for a change in those addresses

Mask of Destiny
Very interested
Posts: 615
Joined: Thu Nov 30, 2006 6:30 am

Post by Mask of Destiny » Sat Feb 22, 2014 8:25 am

Builds correctly now, though I still need to make two small changes to the Makefile. Those changes are to add -lm to LDFLAGS and to move ${LDFLAGS} after ${OBJS} in the rule that links the final executable.

The static problem with my driver persists in the native build, but I suppose that's not surprising. I'll have to fiddle with it a bit more to see if I can figure out what the problem is.

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Sat Feb 22, 2014 9:13 am

My sound engine works like so :

You load it in.
You run it.
Then you wait until it has signalled "ready"
Now you can poke in stuff like volume, music file location, instrument data and so on. Doing it before "ready" will result them being overwritten by defaults. That thing does thorough initialisation prior being to ready for use.

In my case something along the lines of "WAIT Address, ExpectedValue" would do the trick. There could be a 3rd parameter like timeout in maybe cycles or real time, and possible 4th parameter that puts out a string on the screen if there is a timeout.
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

sigflup
Very interested
Posts: 111
Joined: Mon Sep 06, 2010 12:05 pm
Contact:

Post by sigflup » Sat Feb 22, 2014 3:08 pm

Mask of Destiny> ok I changed the Makefile. I have no idea why your sound wouldn't be working.

TmEE co.(TM)> Ok I added that command. The timeout is in milliseconds

Oerg866
Very interested
Posts: 211
Joined: Sat Apr 19, 2008 10:58 am
Location: Frankfurt, Germany
Contact:

Post by Oerg866 » Wed Mar 12, 2014 7:29 pm

sigflup wrote:Mask of Destiny> ok I changed the Makefile. I have no idea why your sound wouldn't be working.

TmEE co.(TM)> Ok I added that command. The timeout is in milliseconds
Thats also how Echo works, it might work better with that command.

I recently formatted my box, maybe loading files works now :P

Post Reply