Dingoonity.org

Dingoo Official Firmware => Development => Topic started by: Spiller on October 17, 2009, 08:41:54 am

Title: Lynx emulator
Post by: Spiller on October 17, 2009, 08:41:54 am
I have been working on porting a Lynx emulator to the native firmware. For this I took the flatmush astrolander sources and extended them to support C++ and the linux toolchain. I am planning on releasing both the SDK and the Lynx emulator sources in a few weeks.

I have a working prototype of the emulator since yesterday. Sound is still a challenge though. Anyone working with the flatmush sources able to provide some pointers on how to handle the sound? The entry.a lib exports some pcm_ functions but I have no clue how to use them.
Title: Re: Lynx emulator
Post by: alekmaul on October 17, 2009, 09:24:45 am
I made threading model to play sound for dingoo os native.
Don't use pcm_xxx functions, they are bad for dingoo os native.
Just take a look at that, it's a320_sound.c file :
Code: [Select]
#include <stdlib.h>
#include <string.h>
#include <stdint.h>

#include "../../lib/ucos2.h"

#include "a320_snd.h"

typedef void waveout_inst;

typedef struct {
unsigned int sample_rate;
unsigned short format;
unsigned char channel;
unsigned char volume;
} waveout_args;


waveout_inst *_audio_music = NULL;
waveout_args tempArgs = { A320SAMPLE_RATE, 16, 1, 20 };
  
#define  TASK_START_PRIO 5
#define  TASK_STK_SIZE   1024                      // Size of each task's stacks (# of WORDs)
#define  NO_TASKS        1                         // Number of identical tasks

OS_STK   TaskStk[NO_TASKS][TASK_STK_SIZE];          // Tasks stacks
OS_STK   TaskStartStk[TASK_STK_SIZE];
char     TaskData[NO_TASKS];                        // Parameters to pass to each task



static volatile int a320_sound_pausei;
static volatile int a320_audio_done;
static volatile int a320_sound_thread_exit;  // Flag to end wiz_sound_thread_play() thread
volatile int a320_curSound;

inline int a320_getCurSound()
{
  int curSnd=a320_curSound;  
  curSnd--; if (curSnd<0) curSnd+=16;
  return curSnd;
}

static signed short a320_sound_buf[SNDLENGTH];  // Sound buffer
signed short a320_sound_emu[SNDLENGTH];  // Sound buffer

void a320_sound_pause(int yes) { a320_sound_pausei=yes; }

void a320_new_sound_play(void *none) {
  signed short w;

  do {
    if (a320_sound_pausei == 0) {
      int k;
      unsigned char * bleh = (unsigned char *) a320_sound_buf;
      for (k = 0; k < SNDLENGTH; k++) {
        a320_sound_buf[k] = a320_sound_emu[k];
      }
      waveout_write(_audio_music, a320_sound_buf, SNDLENGTH);
      a320_audio_done=1;
}
    else
      OSTimeDly(1);
} while(a320_sound_thread_exit == 0); // Until the end of the sound thread
  
a320_sound_thread_exit=0;

  OSTaskDel(TASK_START_PRIO);
}

void a320_sound_thread_mute(void)
{
//memset(a320_sound_buf_tot,0,(SNDLENGTH*16*2));
}

void a320_sound_thread_stop(void)
{
  a320_sound_pausei = 1;
a320_sound_thread_exit=1;

a320_sound_thread_mute();
}

void a320_sound_wait(void)
{
while (!a320_audio_done)
OSTimeDly(4);
  a320_audio_done = 0;
}


void a320_sound_init(void) {
  a320_sound_thread_exit=0;
  a320_sound_pausei = 1;
  a320_curSound = 0;
  a320_audio_done=1;

  _audio_music = waveout_open(&tempArgs);

 a320_sound_thread_mute();

  OSTaskCreate(a320_new_sound_play, (void *) 0, (void *)&TaskStartStk[TASK_STK_SIZE - 1], TASK_START_PRIO);
}

void a320_sound_stop(void) {
  a320_sound_thread_stop();

  while (a320_sound_thread_exit);  // to avoid pb with waveout_close -> can hang ??

  waveout_close(_audio_music);
}

and that is a320sound.h file :
Code: [Select]
#ifndef __a320_sound_h__
#define __a320_sound_h__

#define A320SAMPLE_RATE 48000
#define SNDLENGTH 4096

extern signed short a320_sound_emu[SNDLENGTH];  // Sound buffer


extern inline int a320_getCurSound();

extern volatile int curSound;
extern void *a320_sound_bufs[16];

#endif
You put these files in your src/lib directory (or where you want), you start threading model in your main file with a320_sound_init(); and you stop sound with a320_sound_stop(); just before exiting your main function.

You fill your buffer in a320_sound_emu buffer , this is the buffer that is copied in threading function to another buffer.

Also , i modified ucos2.h to have correct threading function prototype :
Code: [Select]
typedef unsigned int OS_STK;
extern uint8_t OSTaskCreate (void (*task)(void *pd), void *pdata, OS_STK *ptos, uint8_t priority);

Hope it will help you.

edit:
Please use the code tags when pasting chunks of code, not quote tags, thanks :D mog
Title: Re: Lynx emulator
Post by: Spiller on October 17, 2009, 12:58:14 pm
Thanks!
Title: Re: Lynx emulator
Post by: capt_bugaloo on October 17, 2009, 05:06:44 pm
I have been working on porting a Lynx emulator to the native firmware.
Aw man - the Atari Lynx is one of my favorite consoles of all time.  I own one now with about 35 carts.
If you are able to port a working emulator, especially for native, you will be my hero!   ;D
Title: Re: Lynx emulator
Post by: Spiller on October 18, 2009, 06:33:17 pm
Still working on this. First sound implemented thanks to Alekmaul. I hope to fix the first beta in a couple of days.
Title: Re: Lynx emulator
Post by: alekmaul on October 18, 2009, 07:38:49 pm
If you need help for a menu or something else, just tell me, i can help you.
I have a lynx (first version and still alive ^^) and i LOVE this console !!!
Title: Re: Lynx emulator
Post by: Spiller on October 19, 2009, 08:58:44 am
Current state is working and playing many roms. Remaining problems:

- Sound is not 100%. Working on this.
- Dingoo is sometimes locked up when starting the emulator. No clue yet.
- Lynx virtual machine is sometimes locked up when starting a game. No clue yet.
- Load and save state functionality is there, but not accessible from the menu yet.
Title: Re: Lynx emulator
Post by: alekmaul on October 19, 2009, 09:09:53 am
If Dingoo locks, it's perhaps an alignment problem.
Try to use -Wcast-align in your CC options to see if something can be misaligned and can lock the console.
Title: Re: Lynx emulator
Post by: Goon8 on October 19, 2009, 09:18:32 am
OMG the Atari Lynx.. I almost completely forgot about this console! EDIT: I REALLY forgot how HUGE this thing was! 6 AA battery's!

http://www.gametrailers.com/user-movie/lynx-atari-system-commercial/48257 (http://www.gametrailers.com/user-movie/lynx-atari-system-commercial/48257)

Absolutely. freakin'. awesome! Looking forward to playing some Lynx titles!  ;D

Title: Re: Lynx emulator
Post by: Spiller on October 19, 2009, 09:27:58 am
Just been playing with the sound again. I'll explain the problem I'm trying to solve. The emulator uses two buffers, one where the Lynx writes its sound output (buffer1) and one in which (part of) the sound output is copied for the native system to be output (buffer2). To keep the two in sync there's a counter which counts the position where the Lynx is currently writing in buffer1 (bufferpos). When the sound thread comes along it copies the contents of buffer1 to buffer2 up until bufferpos. I'm not entirely sure but it looks like the original emulator always outputs the entire buffer2 to the sound device. It blocks the thread while writing.

I have above implemented for the Dingoo. The sound is recognizable, but quite bad still. I figured it doesn't make sense to output the complete buffer2 if only part of it was written to, so I'm trying to feed bufferpos to waveout_write. However when I do so there is no sound at all.

Do you know if waveout_write is blocking as well? Or does it return immediately? Can you think of any other way to keep the two buffers synchronized?
Title: Re: Lynx emulator
Post by: alekmaul on October 19, 2009, 09:59:46 am
Yes, waveout_write is blocking (it's the reason why we are using thread, to avoid blocking all the process).
I think the best thing is to fill the output buffer only when the frame is finished, to be sure that all is ok.

So, you have :
* A buffer (buffer1) to be fill during one frame
* A buffer (buffer2) in the thread where you fill it with buffer1

I think you should fill the buffers with the same number of bytes (for example 4096 or 2048), don't forget that you must use 44100 (or 48000) and 16 bits signed shorts.

I'm doing such thing in my emulators and you also have same thing in Gnuboy for dingoo os native.
Title: Re: Lynx emulator
Post by: Spiller on October 19, 2009, 04:30:29 pm
I finally got the sound to work! It appeared to be a simple sign problem. The two audio formats described in audio.h are:

Code: [Select]
/* Audio Sample Format */
#define AFMT_U8                 8
#define AFMT_S16_LE             16

It seems that both are signed however. Last thing to fix with the audio is the volume. It is way too low now. Tried both the volume parameter of waveout_open and waveout_set_volume...
Title: Re: Lynx emulator
Post by: capt_bugaloo on October 20, 2009, 03:41:49 am
Excellent!  I am really looking forward to this release...
Title: Re: Lynx emulator
Post by: alekmaul on October 20, 2009, 05:25:39 am
It seems that both are signed however. Last thing to fix with the audio is the volume. It is way too low now. Tried both the volume parameter of waveout_open and waveout_set_volume...
As i said in my previous post, use only 16 bits signed short values for sound.
About sound volume, just take a look at spoout, you have the soruce code and sample to change volume with X and Y :
Quote
        if (key_curr.status & CONTROL_BUTTON_X)  {
          if (!key_x_pressed) {
            sndLevel = sndLevel == 100 ? 0 : sndLevel + 10;
            waveout_set_volume(sndLevel>>1);         
            key_x_pressed = 1;
          }
        }
        else
          key_x_pressed  = 0;

        if (key_curr.status & CONTROL_BUTTON_Y)  {
          if (!key_y_pressed) {
            sndLevel = sndLevel == 0 ? 100 : sndLevel - 10;
            waveout_set_volume(sndLevel>>1);          
            key_y_pressed  = 1;
          }
        }
        else
          key_y_pressed  = 0;
I begin with sndLevel=40 (with values between 0 and 100) so we can go to 0..50 with volume, which is nice on dingoo
Title: Re: Lynx emulator
Post by: Spiller on October 20, 2009, 08:47:58 am
Thanks for the volume example. About the signed short thing: this emulator is using 22kHz 8 bit sound, which seems to be accepted fine by waveout_open and waveout_write but as said the volume is low. The waveout_set_volume example you gave me doesn't change this. I'll have a look to see if I can "upgrade" the sound system to 16 bit sound. :)
Title: Re: Lynx emulator
Post by: alekmaul on October 20, 2009, 09:00:52 am
Hum, i think you can try 44100hz instead of 22Khz.
To convert 8bits sounds to 16 bits, just take a look at gnuboy from joyrider, and you have the solution (it's in lib/sdl/sdl.c, in the threading function)  :
Quote
           
void a320_sound_thread_play(void *none)
{
    int teller = 0;
    int teller2 = 0;
    signed short w;
    do {
        if(a320_sound_paused == 0)
        {
            byte * bleh = (byte *) a320_sound_buffer;
            for (teller = 0; teller < SNDLEN>>1; teller++)
            {
                w = (uint16_t)((gb_sound_buffer[teller] - 128) << 8 );
                *bleh++ = w & 0xFF ;
                *bleh++ = w >> 8;
            }
        waveout_write(_audio_music, a320_sound_buffer, SNDLEN);
        audio_done = 1;
        }
        else
            OSTimeDly(1);
   } while(!a320_sound_thread_exit);
    a320_sound_thread_exit=0;
    OSTaskDel(TASK_START_PRIO);
}
In this code, gb_sound_buffer is the 8 bits buffer filled from the emu and a320_sound_buffer is the 16 bits signed buffer sent to wave_out
Title: Re: Lynx emulator
Post by: Spiller on October 20, 2009, 09:16:05 pm
First beta can be found here:

http://www.speedyshare.com/534817175.html

Place LynGOO.SIM together with lynxboot.img in your GAME folder and have fun with some LNX files!

This version still contains several glitches and load/save state is not implemented yet. You will have to google lynxboot.img as I'm not allowed to bundle it with the emulator.
Title: Re: Lynx emulator
Post by: Chris23235 on October 20, 2009, 10:33:14 pm
Hope you didn't mind I made a post in the release forum, tried Blue Lightning, runs great.

EDIT: I tried S.T.U.N. Runner, runs fantastic for a Beta, has slightly wrong colours sometimes and the screen flashes at the map screen. This game runs to slow on the original CPU Speed and to fast on 430 MHz. It would be great, if you cam implement a frame limiter.
Title: Re: Lynx emulator
Post by: remax on October 20, 2009, 11:21:48 pm
California Games runs great
Ninja Gaiden seems ok but i never played it
World Class Soccer is unplayable (there are big paquet of frame that are forgotten).
Title: Re: Lynx emulator
Post by: segakiki on October 21, 2009, 12:23:39 am
Its not working for me!
ive put the lyngoo.sim and the lynxboot.img file in the game folder and then created a lynx folder with all the unzipped .lnx files. nothing...
No File Found!
what am i doing wrong?
ive got firmware version 1.1
Title: Re: Lynx emulator
Post by: Harteex on October 21, 2009, 12:27:52 am
Its not working for me!
ive put the lyngoo.sim and the lynxboot.img file in the game folder and then created a lynx folder with all the unzipped .lnx files. nothing...
No File Found!
what am i doing wrong?
ive got firmware version 1.1

Force a file refresh by doing Update Jukebox at the bottom of the Music menu.
Title: Re: Lynx emulator
Post by: segakiki on October 21, 2009, 12:38:14 am
when i click on ok for update jukebox my dingoo just freezes and i have to hard reset!
it wasnt doing this before i put the lyngoo.sim file in.
Any help please?
Title: Re: Lynx emulator
Post by: Jolu42 on October 21, 2009, 12:59:37 am
Spiller, great job on the beta!! I was just playing Batman Returns whilst on the shitter. Very impressive.
Title: Re: Lynx emulator
Post by: capt_bugaloo on October 21, 2009, 03:14:03 am
Awesome!  I am running a black Dingoo with factory 1.11
I find the emulator works very well for most ROMs. 

- Blue Lightning, KLAX, and a few others I tried  ran well - I didn't notice any slow down other than some choppy title music in BL.
- STUN Runner has some messed up graphics.
- Ms. PacMan runs about 15% too fast!
- "Lynx Diagnostic cart" when you push buttons on the button test, a speaker beeps like it should but the button display doesn't light up.

How do you have the keys mapped?  A is A, but I think you have B mapped to X, Pause to Start..?  I'd like to be able to flip the screen like on a real Lynx (Pause + OPT2) and couldn't figure it out...

Awesome for a beta release!   ;D
Title: Re: Lynx emulator
Post by: segakiki on October 21, 2009, 03:38:48 am
Finally got it working! it was because of my 16gb sd card.
i just took it out of the dingoo and clicked update jukebox and it updated without freezing!
Emu works great for a first release.
Does anyone know how to adjust the volume?
Title: Re: Lynx emulator
Post by: trooper on October 21, 2009, 04:15:28 am
Finally got it working! it was because of my 16gb sd card.
i just took it out of the dingoo and clicked update jukebox and it updated without freezing!
Emu works great for a first release.
Does anyone know how to adjust the volume?

Left shoulder button = Volume down
Right shoulder button = Volume up

Oh, Btw Spiller, I hope you don`t mind, And i know this is still in beta, But i have posted this as news over at GP32x.com (http://www.gp32x.com/board/index.php?/topic/50076-lyngoo-first-beta-by-spiller-from-dingoonityorg/), And uploaded it to the Openhandheld File Archive (http://dl.openhandhelds.org/cgi-bin/dingoo.cgi?0,0,0,0,71,195).

Thanks Spiller, I`m having great fun with this. ;D

Trooper
Title: Re: Lynx emulator
Post by: alekmaul on October 21, 2009, 05:30:00 am
Nice work Spiller, all the games i've tried work !
THere are some glitches in sound but it' not so bad.
There are some pb in graphic line rendering (just take a look at shadow of the beast, the sky is not good).
Also, some games seem to be emulated too fast (ms pacman for example).
Continue ! nice work !!!
Title: Re: Lynx emulator
Post by: Spiller on October 21, 2009, 07:12:12 am
Thanks for all the replies! Good to see that there is interest in this. I have never owned a Lynx myself so sometimes it's hard to judge whether a game runs correctly or not.

This emulator is basicly a port of Handy. I was trying to run Handy on Windows for reference, but to my surprise it ran very slow and choppy on a 1400MHz Intel CPU. So I really have no good reference. Will take a couple of more days to fix some bugs.  :P
Title: Re: Lynx emulator
Post by: Spiller on October 21, 2009, 07:31:37 am
capt_bugaloo: Didn't know about those special key combinations. Thanks! The mappings are as follows:

A = A
B = B
OPT1 = X
OPT2 = Y
PAUSE = START

PAUSE+OPT1 seems to do a reset? PAUSE+OPT2 probably tries to do a rotate, but I haven't implemented support for it.
Title: Re: Lynx emulator
Post by: Spiller on October 21, 2009, 08:22:28 am
alekmaul: The main reason for graphical (and sound?) glitches is the lack of proper timing in the emulation speed. The only control I currently have is the number of cpu opcodes executed in one frame. Normally this number is set to 3000. When I set it to 800 for example the background in Shadow of the Beast stops flickering but it also looses the gradient. This is because the gradient is dependant on proper system timing. This will not be easy to fix, but I'll have a look.
Title: Re: Lynx emulator
Post by: SiENcE on October 21, 2009, 10:11:29 am
Could you use a better Scaler for this Emu? Or different Modes like nativ, scaled, scaled-enhanced...aso.

ScummVM has good scalers and opensource.
Title: Re: Lynx emulator
Post by: Kronus on October 21, 2009, 10:25:52 am
Thanks for this Spiller, you know my uncle had the original Lynx handheld along a with a GameBoy, and he was glad that the Dingoo can emulate the Lynx, because it was his fave handheld along with the GameBoy.

+1 for you.

 ;)
Title: Re: Lynx emulator
Post by: capt_bugaloo on October 21, 2009, 02:13:30 pm
I spent half an hour or so playing Shanghai (great game) last night.  It plays almost perfectly! 
Occasionally (like once every 3 or 4 mins) I see a split second of screen flickering - it's barely noticeable. 
And the music plays too fast, so I hit a button (OPT 2?) to turn the optional background music off.

I saw one comment that they found the emulator runs too slow, but my observation is that with Shanghai, Ms Pacman, and a couple of others it runs about 10-15% too fast!  It's really noticeable in the background music of these games.
Title: Re: Lynx emulator
Post by: Spiller on October 21, 2009, 04:20:26 pm
Although I have no actual experience with the Lynx, I think the emulator runs too fast too. As said, I will be looking into the timing but it may take a couple of days to find a solution.

About the scaler: the native resolution of the Lynx is 160x102. I'm simply doubling the number of pixels to 320x204 right now and I wonder why anyone would want something else. I don't think it's going to be prettier with a scaler.  ;)
Title: Re: Lynx emulator
Post by: Spiller on October 21, 2009, 04:35:31 pm
Second beta:

http://www.speedyshare.com/163829299.html

Includes load/save state functionality and the ability to change the volume and emulator timing from the menu. Should be fairly complete functionality wise. Next up is fixing the timing which will hopefully end the graphical and sound glitches.
Title: Re: Lynx emulator
Post by: alekmaul on October 21, 2009, 07:14:09 pm
Thanks a lot Spiller, will try this this evening (in French Time zone :P) ^^
Title: Re: Lynx emulator
Post by: Spiller on October 22, 2009, 07:14:31 am
We're in the same time zone. I'm from the Netherlands.  ;)
Title: Re: Lynx emulator
Post by: SiENcE on October 22, 2009, 09:45:51 am
About the scaler: the native resolution of the Lynx is 160x102. I'm simply doubling the number of pixels to 320x204 right now and I wonder why anyone would want something else. I don't think it's going to be prettier with a scaler.  ;)

Simply doubling the number of pixels is not very nice. Interpolating is far more nicier and i think the speed is high enough to try something :-)

For example sai2: https://sourceforge.net/apps/trac/scummvm/browser/scummvm/trunk/graphics/scaler/2xsai.cpp

or they have lots of others:
https://sourceforge.net/apps/trac/scummvm/browser/scummvm/trunk/graphics/scaler
Title: Re: Lynx emulator
Post by: Chris23235 on October 22, 2009, 11:43:47 am
About the scaler: the native resolution of the Lynx is 160x102. I'm simply doubling the number of pixels to 320x204 right now and I wonder why anyone would want something else. I don't think it's going to be prettier with a scaler.  ;)

Simply doubling the number of pixels is not very nice. Interpolating is far more nicier and i think the speed is high enough to try something :-)

For example sai2: https://sourceforge.net/apps/trac/scummvm/browser/scummvm/trunk/graphics/scaler/2xsai.cpp

or they have lots of others:
https://sourceforge.net/apps/trac/scummvm/browser/scummvm/trunk/graphics/scaler

Links don't work for me, require Password.

If you want to get closer to the look of the real Lynx, just leave every 2nd pixel blank, the LCD Pixels on the original Lynx where not very close to each other, I think this was a technical decision to achieve a larger display. I am not complelely sure if this was only between the lines of between each pixel in the line as well, I just discovered my old Lynx doesn't seem to work any more.
Title: Re: Lynx emulator
Post by: alekmaul on October 22, 2009, 12:04:20 pm
Here are the files attached
Title: Re: Lynx emulator
Post by: capt_bugaloo on October 22, 2009, 02:19:26 pm
Simply doubling the number of pixels is not very nice.
Everyone's a critic...

Hey spiller, I think the simple doubling of the screen looks just fine.  I agree with you that with just 36 extra rows of pixels to play with, there isn't a lot of room for improvement.  I think other issues such as speed or sound are much more important.
Title: Re: Lynx emulator
Post by: Spiller on October 22, 2009, 04:52:20 pm
Maybe I will look at the scaler at a later time, but the timing issues are more important now. Toki is my game of choice now for experimenting. It even includes a countdown in seconds which is clearly going too fast currently.  :)
Title: Re: Lynx emulator
Post by: SiENcE on October 23, 2009, 09:02:21 am
Oh maybe you need a sourceforge account, i forgot.

thanks to alekmaul for posting the sai scaler.

of couse timing is more important right now. it was only a suggestion, because i was playing around with this scalers for my pie port.
Title: Re: Lynx emulator
Post by: alekmaul on October 23, 2009, 09:25:21 am
You played with an anti aliasing scaler in PIE SiENcE, was it fast   ?

Spiller, i've tested a little your new version. It's not really easy to know with cycles are accurate ...
Execpt this pb, it works fine, i've tested Xenophobe, Rampage and they work fine.
Just one pb, i think there is a colour pb in Roadblasters, certainly a cycles pb too.
Title: Re: Lynx emulator
Post by: Dingtarted on October 23, 2009, 08:02:44 pm
When i exit game and try to load another dingoo freezes all firmwares whats wrong
Title: Re: Lynx emulator
Post by: Stevie A on October 23, 2009, 10:16:57 pm
Ninja Gaiden seems ok but i never played it

I used to own an Atari Lynx and Ninja Gaiden and can tell you it runs very accurately indeed!

One of my first downloads for my brand new Dingoo and I'm thrilled!
Title: Re: Lynx emulator
Post by: Spiller on October 24, 2009, 07:38:52 am
I experience the freezes sometimes as well. The cause is still unknown. Alekmaul suggested some alignment problems, but I haven't been able to find such a thing yet.
Title: Re: Lynx emulator
Post by: alekmaul on October 26, 2009, 06:17:50 am
Spiller, could you help me with my Stella port (size pb and object creation hangs dingoo) here : http://boards.dingoonity.org/dingoo-emulation/atari-2600-anyone-working-on-it/msg1672/#new
Did you have same pb with your handy port (i remember that Handy was C++ coding, isn't it  ?
Title: Re: Lynx emulator
Post by: Spiller on October 26, 2009, 08:18:39 am
I have good and bad news. The good news is that I have added throttling and automatic frameskip functionalities. The emulator tries to stay as close to the original speed of the Lynx as possible now. The bad news is that the graphical and sound glitches are still there. I will try to put some more time in these glitches and will certainly release a new beta in a few days.
Title: Re: Lynx emulator
Post by: capt_bugaloo on October 26, 2009, 01:16:25 pm
Sounds great!
Title: Re: Lynx emulator
Post by: Spiller on October 27, 2009, 12:03:05 pm
I have found the reason for the graphical glitches. It's actually quite simple: I'm basing LynGOO on a port of Handy, not Handy itself. This port contains some hacks to speedup the emulator. That's where the glitches come from. So actually there is not much difference to the original port.

However... I have experienced that the compatibility was not so good as I thought. Several games (like Lemmings) even refuse to run on the last beta. I decided to backport some stuff from the original Handy into LynGOO and it has been with success. The graphical glitches in Shadow of the Beast are gone and Lemmings runs perfectly as well now. The main drawback being the loss of speed.

The upcoming beta will change a lot compared to the last one. I have switched from 320x240 to the Lynx native resolution of 160x102, so the menus are displayed in this resolution now as well. Applying a linear filter to the scaling is perfectly possible and working but way too slow to enable currently. To be honest the whole emulator has become a lot slower, but compatibility should be much, much better.
Title: Re: Lynx emulator
Post by: alekmaul on October 27, 2009, 12:09:35 pm
Nice to see that some pbs are fixed !
You can grab the scale engine from gnuboy or spoout, it's really fast and i don't think it will grab a fps to your emu.
Is the emulator really slow now ? how much fps ?
Title: Re: Lynx emulator
Post by: capt_bugaloo on October 27, 2009, 12:58:19 pm
Hmm...  I found the previous version was running about 15% too fast with most games.  A little slower is okay but I hope it's not too much slower...   ???
Title: Re: Lynx emulator
Post by: Spiller on October 27, 2009, 01:25:05 pm
It depends on the game how slow the emulator is. The previous beta's ran at between about 115% and 130% of the speed of a real Lynx. The version I have right now is running at 100% for most games, less than that for some games. Shadow of the beast is real crappy right now at about 85% of the speed and 6FPS (auto frameskip 10). Not continuously, but quite often.

About the FPS: the previous betas were running at about 20FPS because it contains a speed hack which copies the raw contents of the video memory only when something has changed. The current version runs at the proper 60FPS whenever possible, auto skipping frames when needed. The graphical glitches came from completely skipping the graphical subsystem and making a raw dump of the video memory.

About the scaling engine: I'm using the display code from flatmush right now. It has some linear scaling as well and really slows the emulator down a lot. I'll have a look at replacing it with some Gnuboy or Spout code.
Title: Re: Lynx emulator
Post by: Chris23235 on October 27, 2009, 07:43:31 pm
Maybe you can include an overclocking option, the original speed of the Dingoo can be greatly improved by clocking the CPU up to 430 MHz.
Title: Re: Lynx emulator
Post by: Spiller on October 28, 2009, 11:27:30 am
Good suggestion! I'll have some more time to work on this on Thursday and Friday, so expect a new beta this weekend.

Alekmaul: I have been looking for some good tv-out code, but could not find it. Do you have some suggestion where to look?
Title: Re: Lynx emulator
Post by: alekmaul on October 28, 2009, 12:58:07 pm
Alekmaul: I have been looking for some good tv-out code, but could not find it. Do you have some suggestion where to look?

Yes, take (Spoout source code  (http://www.portabledev.com/files/filedwnld.php?file=SpooutV2_source.zip)) and take a look at display.c and graphics.c in src/lib.
They use pointers to current frame buffer. It's the only thing to use to have tv out ok. Nothing else.
Title: Re: Lynx emulator
Post by: gromit77 on October 28, 2009, 10:27:45 pm
sorry put this in the wrong place, please ignore
Title: Re: Lynx emulator
Post by: Spiller on October 29, 2009, 07:17:20 pm
They use pointers to current frame buffer. It's the only thing to use to have tv out ok. Nothing else.

I think you are referring to g_pGameDecodeBuf, right? But how do I switch to TV out then? Do I have to intercept START + L? And what then? Sorry for bothering you with this, but I seem to be missing something here...

Also, what did you fix in the sound threading in Colecoo? Something that could benefit others as well?  ;)
Title: Re: Lynx emulator
Post by: alekmaul on October 30, 2009, 12:32:25 pm
About TV Out, it's on the Dingoo menu, i don't know how to switch with softawre function.
About sound threading, it was because ColeCoo used my first implementation of a320_sound, just take a look at spoout source code, you've got all the things regarding the new implementation.
Title: Re: Lynx emulator
Post by: Kalisiin on October 30, 2009, 12:39:50 pm
Maybe you can include an overclocking option, the original speed of the Dingoo can be greatly improved by clocking the CPU up to 430 MHz.
Slightly off topic, but, since you brought it up, how do you overclock the Dingoo?

You can alter the clock speed in MAME4ALL, but I do not know how you go about overclocking the Dingoo in general.
Title: Re: Lynx emulator
Post by: Chris23235 on October 30, 2009, 06:06:18 pm
Maybe you can include an overclocking option, the original speed of the Dingoo can be greatly improved by clocking the CPU up to 430 MHz.
Slightly off topic, but, since you brought it up, how do you overclock the Dingoo?

You can alter the clock speed in MAME4ALL, but I do not know how you go about overclocking the Dingoo in general.

My Dingoo runs without any problems at 430 MHz.
Title: Re: Lynx emulator
Post by: Kalisiin on October 30, 2009, 06:12:48 pm
Maybe you can include an overclocking option, the original speed of the Dingoo can be greatly improved by clocking the CPU up to 430 MHz.
Slightly off topic, but, since you brought it up, how do you overclock the Dingoo?

You can alter the clock speed in MAME4ALL, but I do not know how you go about overclocking the Dingoo in general.

My Dingoo runs without any problems at 430 MHz.

But mine is not clocked up to 430...unless it comes that way out of the box.  I don't know how to tell.
MAME4ALL program in Dingux lets you change the clock speed on individual games, up to 420.
Title: Re: Lynx emulator
Post by: Spiller on October 30, 2009, 08:27:07 pm
You can grab the scale engine from gnuboy or spoout, it's really fast and i don't think it will grab a fps to your emu.

These are simple nearest neighbor scalers, right? I was talking about applying a linear filter which can be found in the flatmush code, but that is way too slow right now.

Also I'm still confused by the tv out. I don't use it myself because I can't find the cable anymore.  :P Can anyone explain when and how the tv out can be enabled? Or could anyone confirm that the previous betas support tv out?
Title: Re: Lynx emulator
Post by: Harteex on October 30, 2009, 08:30:07 pm
If you do drawing like in GnuBoy or Astrolander or any game which builds upon them, then TV-out will work without any modification.

I will try your beta now, I will edit this post when I have tried it.

EDIT:
Yes it works fine on TV-out
Title: Re: Lynx emulator
Post by: Spiller on October 30, 2009, 09:11:53 pm
Thanks for confirming!
Title: Re: Lynx emulator
Post by: Chris23235 on October 30, 2009, 11:44:38 pm
Maybe you can include an overclocking option, the original speed of the Dingoo can be greatly improved by clocking the CPU up to 430 MHz.
Slightly off topic, but, since you brought it up, how do you overclock the Dingoo?

You can alter the clock speed in MAME4ALL, but I do not know how you go about overclocking the Dingoo in general.

My Dingoo runs without any problems at 430 MHz.

But mine is not clocked up to 430...unless it comes that way out of the box.  I don't know how to tell.
MAME4ALL program in Dingux lets you change the clock speed on individual games, up to 420.

You just have to try up to which frequencies your Dingoo runs fine.
Title: Re: Lynx emulator
Post by: alekmaul on October 31, 2009, 10:58:42 am
These are simple nearest neighbor scalers, right? I was talking about applying a linear filter which can be found in the flatmush code, but that is way too slow right now.
It's a really fast scaler, of course, with anti aliasing but nice with games ^^
Title: Re: Lynx emulator
Post by: Nickeng on October 31, 2009, 12:32:17 pm
I tried Robotron - was my fav game when i owned a lynx.

The right side of the box/coloured line screen swap does not generate right.

Title: Re: Lynx emulator
Post by: Spiller on November 01, 2009, 08:09:49 am
It's a really fast scaler, of course, with anti aliasing but nice with games ^^

It's using fixed pointer integer math which makes it so fast, the original flatmush one does so as well. Some people have been requesting the anti aliasing, but I don't see a way to do that currently. An anti aliasing scaler is so much slower than a simple nearest neighbor one.
Title: Re: Lynx emulator
Post by: Spiller on November 01, 2009, 08:23:31 am
Third and last beta:

http://www.speedyshare.com/188908494.html

This beta disables a render hack which was present in the Handy port I used as a base for LynGOO. This hack is responsible for almost all graphical glitches found with previous betas. The render hack may now be enabled from the menu for special cases. The sound has been improved a lot as well.

Please note that this beta may feel a lot slower than previous betas. This is mostly because previous versions were running at max speed (mostly somewhere between 115% and 130%). The new version tries to run at exactly 100% of the real Lynx speed. Auto frameskip has been added to help accomplish this with somewhat slower games. There is some debug display onscreen which tells the speed percentage, number of FPS and frameskip chosen. This display will be removed in the final version ofcourse.

This will be the last beta for this emulator. I plan on fixing the freezes which some people have encountered and then release the final version 1.0. I am not sure yet whether the 'render hack' option should stay in the menu. Therefore I'd really like some opinions on this new version compared to the previous one.
Title: Re: Lynx emulator
Post by: Chris23235 on November 01, 2009, 02:39:29 pm
Great improvement. Shadow of the Beast still has some minor graphical glitches, it's a short flash of the screen now and then and some moving in the colours of the horizon.
On the other side, S.T.U.N. Runner, one of the most hardware demanding games runs with 60 FPS at 430 MHz, so no problem with the speed I think.
The screen doesn't seem to fit 100% on the screen, the life bar in Shadow of the Beast is missing some lines.
But apart from these small things very good and stable as far as I see.
Title: Re: Lynx emulator
Post by: Spiller on November 01, 2009, 07:27:00 pm
Thanks for mentioning the missing scanline. I hadn't noticed.  :P
It was actually a problem in the scaler from astrolander. It's fixed now and will be in the next release.
Title: Re: Lynx emulator
Post by: Jolu42 on November 01, 2009, 08:45:55 pm
The improvements are noticeable! Ms. Pac-Man is no longer the Turbo Edition :) Great job, spiller!
Title: Re: Lynx emulator
Post by: Harteex on November 01, 2009, 08:53:21 pm
I have not tried that many games, but it seems to work fine :)

In case you ever use overclocking or anything like that, it would be good to not do that on default, and be very clear with it.
Title: Re: Lynx emulator
Post by: goldenegg on November 02, 2009, 01:00:42 am
Pretty much every game I try works perfectly!  Is there any way to disable the FPS counter in the latest beta?
Title: Re: Lynx emulator
Post by: alekmaul on November 02, 2009, 07:45:36 am
Is there any way to disable the FPS counter in the latest beta?
As the author said, you can't in this last beta version (just read his last post) ...
Spiller, i tested lots of game without changing my Dingoo Speed. It's a little slow but really nice.
As lots of people said, the last scanline is missing.
Did you try the scaler in GnuBoy or Spoout or is it Flatmush scaler ?
Title: Re: Lynx emulator
Post by: Spiller on November 02, 2009, 08:00:33 am
The debug FPS stuff cannot be disabled for this beta. It will be gone in the final release. The missing scanline was a problem with the astrolander/Flatmush scaler. I have identified and fixed that already. As far as I could tell the Flatmush and Spoout scalers are almost the same, both using fixed point integer math.
Title: Re: Lynx emulator
Post by: ScottyPottie on November 02, 2009, 07:35:57 pm
Hey Spiller,

Thanks for the hard work. The latest beta is the best one yet. I am running into the problem that my Dingoo locks after exiting some games. In the earlier beta it locked after every game. Now just some. Is anyone else getting this?

I've got the official firmware version 1.1

Thanks

PS. I just doubled checked and after I exited Paperboy it exited to the list of roms and then locked and I needed to hit reset.
Title: Re: Lynx emulator
Post by: Spiller on November 02, 2009, 08:22:41 pm
Hi ScottyPottie. Thanks for the report. I am experiencing the freezes myself as well, but only after exiting tens of games. I am surprised to hear that the previous beta locked after every game. My main priority for a non-beta release is fixing these freezes.
Title: Re: Lynx emulator
Post by: ScottyPottie on November 02, 2009, 11:34:43 pm
Ok I played on the train home and here are the details:

- I have not installed linux
- Firmware 1.1 came installed
- All inlcuded emulators work fine (don't freeze).
- ColeCOO.SIM does not freeze I can play rom after rom

- LynGOO.SIM, DOOENGINE.SIM, and SmsGGOO.SIM => These all play games fine. They let me exit the game, and lock when I select the next game to play. I hit reset and can then play another game. I know you didn't work on the second 2, but maybe there is something in common.

- The Lynx games I played looked and played great.

- Below is the contents of my Game directory.

- If there is any testing I can do for you let me know.

- If you think my Dingoo has a problem let me know.



Directory of I:\game

09/21/2044  12:00 AM    <DIR>          .
09/21/2044  12:00 AM    <DIR>          ..
02/13/2007  02:41 AM         4,945,638 ????.zip
07/15/2009  07:16 PM    <DIR>          3D
10/13/2009  08:26 PM    <DIR>          Best
10/14/2009  09:55 AM    <DIR>          COL
09/23/2009  08:45 PM    <DIR>          CP1
09/23/2009  08:38 PM    <DIR>          CP2
06/30/2009  10:23 AM    <DIR>          CPS1
06/30/2009  10:23 AM    <DIR>          CPS2
07/15/2009  07:15 PM    <DIR>          GBA
09/24/2009  05:02 AM    <DIR>          GBC
11/02/2009  05:02 AM    <DIR>          GG
10/29/2009  08:25 AM    <DIR>          Lynx
10/29/2009  08:25 AM    <DIR>          MVS
09/22/2009  07:03 PM    <DIR>          NES
09/30/2009  08:18 PM    <DIR>          PCE
11/02/2009  05:06 AM    <DIR>          SMS
09/22/2009  07:03 PM    <DIR>          SNES
09/26/2009  10:40 AM    <DIR>          Test
05/04/2044  12:00 AM                32 COLECOO.CFG
10/27/2009  07:21 PM           264,112 ColeCOO.SIM
11/12/2008  03:29 PM         1,105,200 CPS1.SIM
11/12/2008  03:30 PM           667,040 CPS2.SIM
09/01/2009  08:59 PM           194,176 DOOENGINE.SIM
05/12/2009  08:45 PM               104 GBA.CFG
11/12/2008  04:30 PM         1,846,992 GBA.SIM
11/01/2009  09:41 AM           156,560 LynGOO.SIM
04/22/1997  11:07 AM               512 lynxboot.img
03/04/1980  12:00 AM               788 MD.CFG
11/14/2008  02:13 PM         1,615,760 md.SIM
11/15/2008  04:55 PM           920,576 MVS.SIM
09/26/2006  10:34 PM         1,395,412 neogeo.zip
11/12/2008  08:42 PM         1,156,608 NES.SIM
05/13/2044  12:00 AM               272 sfc.cfg
11/14/2008  09:14 PM         1,056,640 SFC.SIM
03/01/1980  12:00 AM                32 SMSGGOO.CFG
10/31/2009  10:23 AM           287,056 SmsGGOO.SIM
Title: Re: Lynx emulator
Post by: capt_bugaloo on November 03, 2009, 04:48:38 am
I was just playing with Beta 2 of LynGoo.  The sound and speed are vastly improved and I like it - except the screen scaling.  Is it possible to have the option of straight 2x scaling like you had with the first two betas..?
Yes, there was small strips of unused pixels, but the image looked great.  Now with the scaling, the display looks 'lumpy' and isn't scaled smoothly.  I vastly preferred the old way...
Title: Re: Lynx emulator
Post by: ScottyPottie on November 03, 2009, 11:03:24 am
Another Freeze symptom:

I can play a Lynx game, exit go play a 3D app, exit. Then go select another Lynx game and it freezes. Kinda seems like something is not cleared on exit.
Title: Re: Lynx emulator
Post by: Spiller on November 03, 2009, 02:36:30 pm
capt bugaloo: will take that into account for release 1.0

scottypottie: I am quite confident that's it's actually a problem of not cleaning up. May be memory related. Interesting to hear that both DOOENGINE and SmsGGOO exhibit the same behaviour. Obviously all these emulators have been based on the same reverse engineering efforts, so yes they share code. I tried to fix the freezes last night, but did not succeed. I will have another try as soon as time permits. It does not really help that it takes tens of game exits to reproduce on my Dingoo.  ;)
Title: Re: Lynx emulator
Post by: alekmaul on November 03, 2009, 03:35:18 pm
Just one question which is not off topic regarding the pb. Do you have a black screen before freeze with dooengine and smsggoo or not ?
Also, do you still have the pb with last version of smsggoo ?
I say that to know if the pb is in sdk file entry_point.c (which is used to call the main function) or not.
Also, as joyrider did in GnuBoy, i remove the static declaration to recognize file extension in launch.c, it's perhaps another point to see.
Title: Re: Lynx emulator
Post by: Spiller on November 03, 2009, 03:57:23 pm
I suspect the entry_point.c as well because it is ringing some alignment bells on my side. I also removed the static after some comments on the old forum.
Title: Re: Lynx emulator
Post by: kswildside on November 04, 2009, 09:43:16 pm
Akemaul and Spiller I have seen it freeze at a black screen.
The Game Startup screen

But most times it freezes in the game list you play one game and exit and then goto to play another from the list and it freezes up. hard reset is the only option.
This Happens with GooPlayer Also by hartex

List I have so far of emu's not working with the A320 with no paw print on the back or logo

SMSGoo
LynGoo
DOOEngine
Coleco I forget the proper emu name
Title: Re: Lynx emulator
Post by: Harteex on November 04, 2009, 11:03:32 pm
The crash in GooPlayer could very well be because of other reasons, I have experienced crashes in it myself.
But I'm investigating...
Title: Re: Lynx emulator
Post by: alekmaul on November 05, 2009, 05:34:35 am
List I have so far of emu's not working with the A320 with no paw print on the back or logo

SMSGoo
LynGoo
DOOEngine
Coleco I forget the proper emu name

You don't have any pb with GnuBoy ???
Title: Re: Lynx emulator
Post by: Spiller on November 05, 2009, 07:56:57 am
I have seen the following freezes with LynGOO:


So basically it freezes either when you start or exit the emulator. Sometimes you can browse for a few seconds before it freezes.

I haven't been playing with the other emulators lately, but by the reports of people I'd say all non-sdk stuff suffers of these freezes. The weird thing is that it affects some Dingoos more than others. Mine only freezes after playing tens on games, others report their Dingoo to freeze immediately after playing only one game.
Title: Re: Lynx emulator
Post by: Harteex on November 05, 2009, 08:44:35 am
I've never heard of any freezing issue with my SameGoo though. I can ask him to try it aswell.
Title: Re: Lynx emulator
Post by: Spiller on November 05, 2009, 08:48:20 am
Would be good to know if this issue is with SIM files only. I'll try to make an APP version of LynGOO just for testing if that freezes as well. If not the problem is highly likely to be in the file association part of entry_point.c.
Title: Re: Lynx emulator
Post by: alekmaul on November 05, 2009, 09:47:37 am
Yep, good try Spiller, i will do the same with SmsGGOO.
And we also have some others solutions :
- Try to use default s2dsdk without GameEngine class which is too slow during the function OneFrame(). And we perhaps missed something regarding the Init and Start of this Object
- Query "dingoo-digital-usa" to have source code of sd2sdk and try to know what is wrong in flatmush non sdk lib ^^
- Try another sdk like zaxxon's one : http://boards.dingoonity.org/index.php/topic,72.0.html
     or this one : http://www.dingoo-digital.com/forums/developers-corner/new-sdk
Title: Re: Lynx emulator
Post by: Spiller on November 05, 2009, 11:42:23 am
I'm on Linux so the s2sdk is a no go for me. I already tried the Zaxxon one, but it is a mini lib lacking all the stuff from entry.a. The 'new-sdk' thing is sort of similar to my dingkit but it didn't work for me because so much had been moved around without any explanation to how and why.

Anyway, I'll try the APP route and see what that yields. If we can get the sourcecode for the s2sdk that would be perfect ofcourse. I guess we could ask and see whether they say yes or no...?
Title: Re: Lynx emulator
Post by: rip on November 05, 2009, 01:03:50 pm
Hi,
in the first place, Thanks for yours work in ucos os. This lynx emulator is very promising, and Smsgoo is now almost reality.
About the freeze problem, maybe have information:

My english is bad, very bad. sorry, of absence of extended explication.
In resume, I think, this problem is a problem of "data in resident memory".
Now, in my dingoo are Smsgoo 2.0 resident in memory, because even though no Smsgoo in game directory and no in my dingoo, i can play sms files in Smsgoo 2.0.

To probe this, copy smsgoo 2.0 to GAME directory, power on dingoo. play a game. Power of dingoo. Delete Smsgoo Power on . And look the sms files (there are file associations) and play sms game.

The freeze proble happens after play a game in the known emulators + Gba games
To probe this. Play a game in gbc/gb/sms/lynx and after gba game= freeze.

For fix Smsgoo 2.0 in memory copy Smsgoo 3.0, play a game, power off dingoo and delete. And the associations disappear, but the frezze problem no.  (?something else in memory?)

I hope it helps.
Title: Re: Lynx emulator
Post by: alekmaul on November 05, 2009, 01:40:46 pm
Very strange that you can launch sms games without the emulator  ???  :o
The big difference between SmsGGOO v2 and v3 and the gcc toolchain (V3 for the old one and V4 for the last one).
Also, i remove (like others people) the static declaration for launch.c file associations, perhaps the pb of really in this file and the launch process ...
I will try to do an App version and not a SIM one.
Title: Re: Lynx emulator
Post by: Harteex on November 05, 2009, 02:40:39 pm
dingoo-digital-usa tried SameGoo aswell, which seems to work fine without crashes.
So maybe it is related to SIM files then.

Although I don't know the problem with GooPlayer yet.
Title: Re: Lynx emulator
Post by: kswildside on November 05, 2009, 04:43:27 pm
My bad same problem with GNUBoy also I will do a more detailed list and description of issues tonight.... Basically what works and what crashes etc and how and when ya know the whole troubleshooting drill. As for the SDK I will see if I can get the source no promises...
Title: Re: Lynx emulator
Post by: rip on November 05, 2009, 06:23:54 pm
Very strange that you can launch sms games without the emulator  ???  :o
Yes and no. I was looking for the SIM and the emulator wasn't in GAME directory but was in a subdirectory of Minisd ??  (I had to leave it at some point of the tests)
Once removed, no more file assocciations, no more emulator, but remains the freeze problem.

I hope it helps.
Title: Re: Lynx emulator
Post by: kswildside on November 06, 2009, 03:06:35 am
I don't know if this will help at all but I got some information on the new lcd don't know if it's a driver or just the device information and commands but maybe it will help maybe it won't not sure but I'm at least trying to help the community with this one....

void Initial_ILI9331_Hydis28(void)
{
//  RESET=0;
//  Delayms(5);
//  RESET=1;
//  Delayms(10);

    WriteRegister(0xe7,0x1014);  // Set internal timing
    WriteRegister(0x01,0x0100);  // set SS and SM bit
    WriteRegister(0x02,0x0200);  // set 1 line inversion
    WriteRegister(0x03,0x1030);  // set GRAM write direction and BGR=1.

    WriteRegister(0x08,0x0202);  // set the back porch and front porch
    WriteRegister(0x09,0x0000);  // set non-display area refresh cycle ISC[3:0]
    WriteRegister(0x0A,0x0000);  // FMARK function
    WriteRegister(0x0C,0x0000);  // RGB interface setting
    WriteRegister(0x0D,0x0000);  // Frame marker Position
    WriteRegister(0x0F,0x0000);  // RGB interface polarity

//  Power On Sequence //
    WriteRegister(0x10,0x0000);  // SAP, BT[3:0], AP, DSTB, SLP, STB
    WriteRegister(0x11,0x0007);  // DC1[2:0], DC0[2:0], VC[2:0]
    WriteRegister(0x12,0x0000);  // VREG1OUT voltage
    WriteRegister(0x13,0x0000);  // VDV[4:0] for VCOM amplitude
    Delayms(100);

    WriteRegister(0x10,0x1690);  // SAP, BT[3:0], AP, DSTB, SLP, STB
    WriteRegister(0x11,0x0227);  // DC1[2:0], DC0[2:0], VC[2:0]
    Delayms(50);
    WriteRegister(0x12,0x000c);
    Delayms(50);
    WriteRegister(0x13,0x0800);   //0X1A
    WriteRegister(0x29,0x0011);
    WriteRegister(0x2b,0x000b);
    Delayms(50);
                         

//Adjust the Gamma curve//
    WriteRegister(0x30,0x0000);
    WriteRegister(0x31,0x0106);
    WriteRegister(0x32,0x0000);
    WriteRegister(0x35,0x0204);
    WriteRegister(0x36,0x160a);
    WriteRegister(0x37,0x0707);
    WriteRegister(0x38,0x0106);
    WriteRegister(0x39,0x0706);
    WriteRegister(0x3c,0x0402);
    WriteRegister(0x3d,0x0c0f);

//--------- set GRAM area -----------   
    WriteRegister(0x50,0x0000);  //Horizontal RAM Address Position start
    WriteRegister(0x51,0x00ef);  //Horizontal RAM Address Position end
    WriteRegister(0x52,0x0000);  //Vertical RAM Address Position start
    WriteRegister(0x53,0x013f);  //Vertical RAM Address Position end       
    WriteRegister(0x20,0x0000);  //Set horizontal address
    WriteRegister(0x21,0x0000);  //Set vertical address
 
    WriteRegister(0x60,0x2700);
    WriteRegister(0x61,0x0001);
    WriteRegister(0x6a,0x0000);
   
   // Partial display control //
    WriteRegister(0x80,0x0000);
    WriteRegister(0x81,0x0000);
    WriteRegister(0x82,0x0000);
    WriteRegister(0x83,0x0000);
    WriteRegister(0x84,0x0000);
    WriteRegister(0x85,0x0000);

// Panel control //
    WriteRegister(0x90,0x0010);
    WriteRegister(0x92,0x0600);

    WriteRegister(0x07,0x0133);  //display on
   
    // write display data
   // WriteRegister(0x20,0x0000);  //Set horizontal address
   // WriteRegister(0x21,0x0000);  //Set vertical address
   // WriteIndex(0x00,0x22);  //write data to GRAM
}



    void LCD_ExitSleep_ILI9331()
  {
    WriteRegister(0x10,0x0080);  //
    WriteRegister(0x11,0x0000);  //
    WriteRegister(0x12,0x0000);  //
    WriteRegister(0x13,0x0000);  //
    Delayms(200);
    WriteRegister(0x10,0x1690);  //
    WriteRegister(0x11,0x0227);  //
    Delayms(50);
    WriteRegister(0x12,0x000C);  //
    Delayms(50);
    WriteRegister(0x13,0x0800);  //
    WriteRegister(0x29,0x0011);  //
    Delayms(50);
    WriteRegister(0x07,0x0133);  //
 
 
  }

  void LCD_EnterSleep_ILI9331()
  {
    WriteRegister(0x07,0x0131);  //
    Delayms(10);
    WriteRegister(0x07,0x0130);  //
    Delayms(10);
    WriteRegister(0x07,0x0000);  // display off
   //power off sequence
    WriteRegister(0x10,0x0080);  //
    WriteRegister(0x11,0x0000);  //
    WriteRegister(0x12,0x0000);  //
    WriteRegister(0x13,0x0000);  //
    Delayms(200);
    WriteRegister(0x10,0x0082);  //
 
  }


Below is what I posted else where about issues and tests I have done.

Well here is a tested look at the new NON PAW Print Dingoo A320 I will first start with the Applications and the default
emulators the dingoo comes with and move on from there to Community made emulators.

1. Went into applications picked Mushroom Roulette played once exited and went to play again the A320 freezes in game list.
   Tried again same result so Mushroom Roulette does not work on the new non paw print A320.

2. Went into applications picked SameGoo played two levels and exited then went to again SameGoo loaded again with no problems
   and no freezing.

3. Went into applications picked a Dingoo Game Nose Breaker played two rounds and exited then went to again NoseBreaker
   loaded again with no problems and no freezing.

4. Went to GooPlayer picked a *.Ogg file played and went to select another program freezes. Also hard reset and went into
   GooPlayer again and exited freezes in the app/game list selection window.

After Playing all the Dingoo native emulators none of them locked up or froze on me.

although GBC.SIM did lock up several times but that is a 760 ported emulator...

Ok now on to the Community made emulators first up is drum roll please...

LynGOO.SIM

1. Loaded up Chopper.lnx played a round or two exited went to load it again froze in game list.
2. Lodead up Frogger.lnx played a round or two exited went to load it again froze in game list.

ColeCOO.SIM

1. Loaded up Wrongway.col played a round or two exited went into game again no problems works
2. Then loaded kevtris.col played a round or two exited went into game again no problems works

So ding ding one round that actually the emulator works and doesn't freeze up


GNUBOY.SIM

1. Loaded up a Gameboy game Adjustris.gb played a round or two exited went to load it again froze in game list.

2. Loaded up a Gameboy game boxing.gb Loaded up the Gameboy game

3. Loaded up a GameBoy Color Game CrazyZone.GBC played a round or two exited went to load it again froze in game list.

4. Loaded up a GameBoy Color Game Whackemon.gbc played a round or two exited went to load it again froze in game list.


SmsGGOO.SIM

1. Loaded up a SMS Game BlockHead.sms played a round or two exited went to load it again froze in game list.

2. Loaded up a SMS Game Robbyie.sms played a round or two exited went to load it again froze in game list.

3. Loaded up a Game Gear Tween.gg played a round or two exited went to load it again froze in game list.

4. Loaded up a Game Gear Columns played a round or two exited went to load it again froze in game list.

DOOENGINE.SIM

1. Loaded up a PCE Game Pacu.pce played a round or two exited went to load it again froze in game list.

2. Loaded up a PCE Game Centipide.pce played a round or two exited went to load it again froze in game list.

This concludes our broadcasting day of the dreaded dingoo a320 with no paw print and how it locks up and freezes and requires a
hard rest.
 
Title: Re: Lynx emulator
Post by: alekmaul on November 06, 2009, 07:41:11 am
Thanks for your great test digoo-digital-usa, that's help a lot.
Just for clarification, you're using last version of each homebrew emulator and you're using firmware V1.1 ?
Title: Re: Lynx emulator
Post by: kswildside on November 06, 2009, 02:27:35 pm
I used Team-Dingo 1.03-TD3 version of the firmware on it and The New 1.20 and also 1.1. I should have stated it was duplicate results with all three firmwares and the fact I tried it with all three 2 FW and the one CFW. I used the latest emu on the test and then also went back one version with each emu and redid the test always the same results no matter what. I have no clue why ColeCOO.SIM works and none of the other emu's don't work. It's all weird the only difference I have seen comparing the old paw printed dingoo to the new non paw print dingoo is they have chaned from a 4GB NAND to a 2 X 2 NAND chip everything else seems to be the same chips and ident#'s
Title: Re: Lynx emulator
Post by: ctrl_shift_esc on November 06, 2009, 04:21:35 pm
I used Team-Dingo 1.03-TD3 version of the firmware on it and The New 1.20 and also 1.1. I should have stated it was duplicate results with all three firmwares and the fact I tried it with all three 2 FW and the one CFW. I used the latest emu on the test and then also went back one version with each emu and redid the test always the same results no matter what. I have no clue why ColeCOO.SIM works and none of the other emu's don't work. It's all weird the only difference I have seen comparing the old paw printed dingoo to the new non paw print dingoo is they have chaned from a 4GB NAND to a 2 X 2 NAND chip everything else seems to be the same chips and ident#'s
Inquire the center-lower part and a bit to the right. Some transistors (amirite?) are added.
Title: Re: Lynx emulator
Post by: Spiller on November 06, 2009, 07:43:53 pm
I have been able to partly solve the freezes with LynGOO. All previous betas have been leaking memory. The cause for these memory leaks is the fact that destructors and deletes are not being called at program exit. I don't think this will solve all freezes but at least I can start the emulator over and over again on my Dingoo now. Previously it would freeze on about the 20th game played.

Can someone check if the same applies to malloc and free? If so you'd have to check very carefully whether all memory is being freed or not.
Title: Re: Lynx emulator
Post by: Harteex on November 06, 2009, 09:25:38 pm
Yea, if you don't use free, malloced memory will still be in use.
Title: Re: Lynx emulator
Post by: Spiller on November 07, 2009, 07:07:49 am
So there is no memory reclaiming going on at all in the native OS. I am tempted to write wrappers around malloc and free and handle reclaiming of any non-freed memory in entry_point.c. I might add such a feature to dingkit to avoid memory leaks.
Title: Re: Lynx emulator
Post by: Goon8 on November 07, 2009, 08:07:08 am
+1 This is all good news!
Title: Re: Lynx emulator
Post by: Kalisiin on November 07, 2009, 08:44:07 am
So there is no memory reclaiming going on at all in the native OS. I am tempted to write wrappers around malloc and free and handle reclaiming of any non-freed memory in entry_point.c. I might add such a feature to dingkit to avoid memory leaks.

Wow...didn't know you had a keyboard that could type Greek!!
Does this mean a new, improved version of LYNGOO is on the horizon?

For the benefit of morons like me...can you try to explain, a bit...in more general terms...what this means, and what you are talking about doing?  I truly do wish to learn.
Title: Re: Lynx emulator
Post by: ctrl_shift_esc on November 07, 2009, 08:49:23 am
i am sorry going offtopic, i just wanted to emphasize how important for us, users, are your industries.
i became absolutely charmed by lynx recently. those scanlines and bright colors... you know.
i am so thankful to you guys trying to solve all the issues. keep it up, please!

upd. i also found a surprising amount of worthy games (like Warbirds or that tube-racing arcade)
Title: Re: Lynx emulator
Post by: QBert on November 07, 2009, 07:28:43 pm
upd. i also found a surprising amount of worthy games (like Warbirds or that tube-racing arcade)

The Lynx did indeed have some great games, some very graphically impressive for the time (Blue Lightning leaps to mind).

Title: Re: Lynx emulator
Post by: capt_bugaloo on November 07, 2009, 08:02:00 pm
I have been a big fan of the Atari Lynx for many years.  It has some superb arcade conversions: Klax, Ms. Pacman, Paperboy, Joust, Robotron, etc.  It also has some good puzzlers like Shanghai or Chip's Challenge.  There are also some decent shooters.  About the only genre it is really lacking is RPGs, and I think that's part of why it was never a big success.
Title: Re: Lynx emulator
Post by: QBert on November 07, 2009, 08:42:18 pm
About the only genre it is really lacking is RPGs, and I think that's part of why it was never a big success.

Perhaps, but the biggest factor of all has to be the piss-poor battery life. This is a problem common to all of the colour portables of the era. I know this well, as I own a TurboExpress. :)

Title: Re: Lynx emulator
Post by: Spiller on November 08, 2009, 10:35:51 am
I expect to release LynGOO v1.0 in a few days. It will solve the freezing due to memory allocation problems (we'll have to see if that's the reason of all freezes). It will also disable the auto frameskipping as it turned out to worsen the performance instead of improve it. I'm still looking for ways to get Shadow of the Beast to run at 100%, but I don't think I'll manage for v1.0. Handy has its roots in Windows, so it's not that much aimed at performance. The performance of v1.0 will certainly be better than last beta.
Title: Re: Lynx emulator
Post by: Kalisiin on November 08, 2009, 11:53:16 am
I expect to release LynGOO v1.0 in a few days. It will solve the freezing due to memory allocation problems (we'll have to see if that's the reason of all freezes). It will also disable the auto frameskipping as it turned out to worsen the performance instead of improve it. I'm still looking for ways to get Shadow of the Beast to run at 100%, but I don't think I'll manage for v1.0. Handy has its roots in Windows, so it's not that much aimed at performance. The performance of v1.0 will certainly be better than last beta.


that will be nice, because Roadblasters, one of my all-time faves...always freezes at the end of the first track.
Title: Re: Lynx emulator
Post by: kswildside on November 08, 2009, 08:23:49 pm
That total rocks does anyone know if JoyRider is working on a fix for GNUBoy
Title: Re: Lynx emulator
Post by: Spiller on November 10, 2009, 08:17:00 am
I will be posting my malloc/free memory reclaiming to a seperate thread soon. I hope it will benefit other developers and emulators.
Title: Re: Lynx emulator
Post by: Kalisiin on November 10, 2009, 08:24:18 am
I will be posting my malloc/free memory reclaiming to a seperate thread soon. I hope it will benefit other developers and emulators.

Is this something which will work, regardless of what application or emu you are using?
Title: Re: Lynx emulator
Post by: Spiller on November 10, 2009, 10:53:23 am
Is this something which will work, regardless of what application or emu you are using?

No, it needs to be implemented in every appication which likes to get rid of memory leak. But first, let us see if this actually fixes the freezes experienced by some people, most notably dingoo-digital-usa. We'll know as soon as I release LynGOO v1.0.
Title: Re: Lynx emulator
Post by: Spiller on November 11, 2009, 09:48:09 pm
LynGOO v1.0 has been released! Get it from the releases section.
Title: Re: Lynx emulator
Post by: ScottyPottie on November 12, 2009, 12:01:48 am
Excellent. No freezes!!!! And mine froze every time after just one game.

Can we request that alekmaul upadte DOOENGINE.SIM and SmsGGOO.SIM use the same memory management to stop them from freezing?

Thanks so much for the great work.

Title: Re: Lynx emulator
Post by: Harteex on November 12, 2009, 12:22:15 am
Excellent. No freezes!!!! And mine froze every time after just one game.

Can we request that alekmaul upadte DOOENGINE.SIM and SmsGGOO.SIM use the same memory management to stop them from freezing?

Thanks so much for the great work.



For SmsGGOO, look here (http://boards.dingoonity.org/dingoonity-news/smsggoo-updated-to-3-1/).