Page 2 of 7 FirstFirst 1234 ... LastLast
Results 11 to 20 of 63
  1. #11
    EmuTalk Member albertwesker's Avatar
    Join Date
    Sep 2005
    Posts
    15
    Mentioned
    0 Post(s)
    thanks for the good explanations!
    but that leads me to another question.

    i think i've decided to just have all the registers seperate as unsigned chars and deal with them that way, but in the case of an instruction like INC BC how would that be addressed?



    since the z80 is little endian, how would i handle this? would i increment B or C or the combined value of the pair?

    for example if B=0xFF and C=0xFF then what would the outcome of that instruction be? and do i need to be concerned with handeling carries here?

    Code:
    /* INC ss */
    (B << 8 | C)+=1; //or
    (C << 8 | B)+=1; //or
    ...
    etc.
    i'm probably overcomplicating this...
    Last edited by albertwesker; November 22nd, 2005 at 21:01.

  2. #12
    Moderator Cyberman's Avatar
    Join Date
    Nov 2001
    Posts
    1,930
    Mentioned
    1 Post(s)
    Well I recomend doing this instead
    UINT16 Temp = (B << 8) | C;
    Temp++;
    B = Temp >> 8;
    C = Temp & 0xFF;
    this rids you of overflow detection in C
    You should do under/overflow detection in Temp though so perhaps it should be a UINT32. So Temp++ and it overflows 1 bit will be 65536 or 0x10000 All you need to do is see if it's > than 65536 and set the appropriate flags.

    Cyb
    Progress (n.):
    The process through which the Internet has evolved from smart people in front of dumb terminals to dumb people in front of smart terminals.
    -------------------------------------------------------------------
    Recursive (adj):
    see Recursive

  3. #13
    Emulator Developer ShizZy's Avatar
    Join Date
    Feb 2005
    Location
    RI, USA
    Posts
    758
    Mentioned
    0 Post(s)
    Cyb's way is better, but:

    if(C==0xff)
    {B+=1}
    C+=1;

    will work. OR you could save yourself a lot of agony and just do:

    union REGISTERS
    {
    struct{unsigned short AF,BC,DE,HL,SP,PC;};
    struct{unsigned char F,A,C,B,E,D,L,H,SPlo,SPhi,PClo,PChi;};
    } reg;

    Then just do reg.BC+=1; If you don't know what a union does, basically it allows you to redefine the same memory with different variable names/data types.


    Edit:
    so perhaps it should be a UINT32.
    Bad idea. Overflow protection isn't really an issue, you'd just end up over cluttering all your code. It's better just to handle data as the actual system would.
    Last edited by ShizZy; November 22nd, 2005 at 23:53.
    ~****Zy

    6Bit.net Emulation & Gaming | Forums
    Gekko GameCube Emulator

  4. #14
    EmuTalk Member TJA's Avatar
    Join Date
    Mar 2003
    Location
    Victoria, Australia
    Posts
    32
    Mentioned
    0 Post(s)
    I never thought of using a union maybe I will change my code to use one, as I have manually checked almost every opcode and although I have fixed a couple of bugs my phoenix emu still has the same errors, maybe if i change to using a union i might fix something i missed in my awakward register code. Anyways I'm going to do this then move on to gameboy emulation as I only did my phoenix emulator as a learning project ( displaying graphics).

    Cheers, TJA.

    EDIT: Think I could have found something, I implemented these the same.
    Can someone tell me the difference between the instructions:

    RLCA and RLA???

    EDIT2: implemented union and cleaned up cpu code which fixed some graphics errors in phoenix, but emulation still coming to halt/logo issues.
    Also now I can chose between compiling a z80 or gameboy cpu.
    Last edited by TJA; November 23rd, 2005 at 15:59.
    Visit my webpage for all the tips, tutorials, systems info, cpu instution set docs etc you will need for Emulation Programming, and General Programming.

    HowToEmulation

  5. #15
    Emulator Developer ShizZy's Avatar
    Join Date
    Feb 2005
    Location
    RI, USA
    Posts
    758
    Mentioned
    0 Post(s)
    RLCA - rotates A left one bit, placing bit 7 at bit 0 as well as in the Carry flag.
    RLA - rotates A left one bit, placing bit 7 into the Carry flag and the contents of the Carry flag into bit 0 of A.

    The difference is that RLCA places bit7 of register A into bit0 of register A, and RLA places the contents of the Carry Flag into bit0 of register A. (If that makes sense).

    In RLA make sure that you don't set bit7 to the carry flag first, and then put that into bit0 of A, because then you'd just be putting bit7 into bit0.

    Edit: Do you have any phoenix docs? Just for the hell of it I'd adapt my gameboy cpu.
    Last edited by ShizZy; November 23rd, 2005 at 17:43.
    ~****Zy

    6Bit.net Emulation & Gaming | Forums
    Gekko GameCube Emulator

  6. #16
    EmuTalk Member albertwesker's Avatar
    Join Date
    Sep 2005
    Posts
    15
    Mentioned
    0 Post(s)
    ****Zie, that's a great idea with the unions. i never thought of using them.
    and by the way, the op i mentioned before (INC ss) doesn't even take carries into consideration according to the docs, but its 8-bit equivelent (INC r) does... well, half carries anyway... so i was worried for nothing

    anyway, thanks for everyones input! this is starting off to be a fun project!
    Last edited by albertwesker; November 23rd, 2005 at 19:33.

  7. #17
    EmuTalk Member TJA's Avatar
    Join Date
    Mar 2003
    Location
    Victoria, Australia
    Posts
    32
    Mentioned
    0 Post(s)
    Thanks ****zie I fixed those instructions but still have the same problems, oh well. I've started on my gameboy emu just setting up basic structure, memory routines, etc.
    And yeah I have some info on phoenix its from the old arcade emulation how to document.
    Also I have a doc with the differences between the gameboy cpu, and z80 ( which I already posted in a thread a while back so you might already have it )

    TJA.

    There is also some info on sound in the aeht doc but I'm not to sure about sound emulation I think its DOS Specific stuff I can remember.
    Visit my webpage for all the tips, tutorials, systems info, cpu instution set docs etc you will need for Emulation Programming, and General Programming.

    HowToEmulation

  8. #18
    Emulator Developer ShizZy's Avatar
    Join Date
    Feb 2005
    Location
    RI, USA
    Posts
    758
    Mentioned
    0 Post(s)
    Thanks for the docs. The phoenix.txt is a little vague. I hope it's everything I need to adapt my z80 emulator. Is there anything else you used?

    Btw keep us updated on your Gameboy progress, nice to see other emulators moving foreward. Havn't had much time to work on mine latelly, dev slowed down a lot it's mostly just tweaking and hardcore bug fixing.

  9. #19
    EmuTalk Member TJA's Avatar
    Join Date
    Mar 2003
    Location
    Victoria, Australia
    Posts
    32
    Mentioned
    0 Post(s)
    Well I based most of my graphics information on the jabawape 0.8 source available from http://caesar.logiqx.com/php/emulator.php?id=jabawape I wasn't really sure about pallet information so I just used the source from that emulator from the pallet.h and removed >>2 not sure what it did, I think something with allegro. As for my gameboy emulator progress, I have been trying to build a GUI for my phoenix emulator so that I can build a debugger and trace down the bug in my cpu core before I move onto the gameboy emu.

    I have question though. I was building the emulator with portability in mind at first I thought about using GTK+ for the GUI but have found difficulty finding examples of it working with SDL especially on win32, so then I looked at wxWidgets but also wasn't sure about how well it worked with SDL too. Anyway I have moved on to create a Tcl/Tk based debugger for my emu which is fine for the moment, but I would like to latter add a GUI to my gameboy emu does anyone have any advice on building a GUI, with one of these toolkits, ****zie I see your gameboy emu uses SDL and has a GUI, I'm guessing you used Visual C++ as it seem to integrate well, not sure if you didn't use Visual studio though I would be keen to know how you did it. Anyway as for your next project I suggest the Sega Master System this is why I chose the gameboy ( so I could re-use the z80 core ) plus your emulating two systems at once the sega master system and the sega game gear. I don't know though its up too you, personally I have a soft spot for sega systems the first console I ever played was my uncles sega master system, I owned a game gear, my brother had a mega drive (genesis) and I later had a Saturn.

    Cheers, TJA.
    Visit my webpage for all the tips, tutorials, systems info, cpu instution set docs etc you will need for Emulation Programming, and General Programming.

    HowToEmulation

  10. #20
    Emulator Developer ShizZy's Avatar
    Join Date
    Feb 2005
    Location
    RI, USA
    Posts
    758
    Mentioned
    0 Post(s)
    Thanks for the tips on system choice. Actually, the public build of my emulator uses directx for graphics, and sdl for sound. In my latest private build, I instead use 100% sdl for everything. Why? Because I like it better, and it's more portable. For a GUI, I use something like the BGP emulator. Basically, it's an SDL window with titlebar and a logo, and when you right click the titlebar a popup menu comes up with all the options - ie you can open the debugger/gfx settings/etc. I really like it, and it uses minimal win32 making it very portable. Download BGP if you haven't already and see if you like it.
    ~****Zy

    6Bit.net Emulation & Gaming | Forums
    Gekko GameCube Emulator

Page 2 of 7 FirstFirst 1234 ... LastLast

Similar Threads

  1. Chanka Compatability List
    By Stezo2k in forum Chankast
    Replies: 923
    Last Post: March 4th, 2009, 21:17
  2. Sega Console Influence in Todays world!
    By SegaBOI in forum Chankast
    Replies: 9
    Last Post: October 15th, 2004, 21:21
  3. Sega Master System screenshots on nsx2 !
    By ShadowPrince in forum nSX2
    Replies: 11
    Last Post: February 10th, 2003, 00:08
  4. Interesting debate on existance of god, worth a read
    By sk8bloke22 in forum Talk of the Town
    Replies: 352
    Last Post: January 14th, 2002, 00:20

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •