Page 104 of 106 FirstFirst ... 45494102103104105106 LastLast
Results 1,031 to 1,040 of 1055

Thread: Chip 8

  1. #1031
    EmuTalk Member
    Join Date
    Aug 2016
    Posts
    25
    Mentioned
    0 Post(s)
    Sorry didnt see your other +2 one thing that has been bothering me is your implementation of 0x7000
    case 0x7000:
    V[x] = char((V[x] + kk) & 0xFF);
    //println("Add kk to V[x] : ", hex(V[x]));
    break;



    it should be V[x] += kk
    try that please (and roll back that awful suggestion xD)

  2. #1032
    EmuTalk Member
    Join Date
    Jun 2017
    Posts
    10
    Mentioned
    0 Post(s)
    I got the same result as before.



    - - - Updated - - -

    I should note that the least frequent sprite appears randomly.

    Sometimes there are 4 of them, sometimes 3, sometimes 2 and even none of them sometimes.

    But they always appear at the beginning of the MAZE (in the top-left corner)

  3. #1033
    EmuTalk Member
    Join Date
    Aug 2016
    Posts
    25
    Mentioned
    0 Post(s)
    As you embraced the HLE path (implementing only the opcodes for an specific game) and seeing that your other opcodes are correct. The only thing that remains is your randomizer.
    in your 0xC000 when you step one instruction at a time... what does your randomNumber variable looks like?

  4. #1034
    EmuTalk Member
    Join Date
    Jun 2017
    Posts
    10
    Mentioned
    0 Post(s)
    I also think the problem comes from my randomizer.

    The value of the variable randomNumber alternates between 0 and 1 regularly.

    It seems correct
    Last edited by Okabe; June 8th, 2017 at 23:00.

  5. #1035
    EmuTalk Member
    Join Date
    Aug 2016
    Posts
    25
    Mentioned
    0 Post(s)
    That doesn't seem right... your random number AFAIK should be between 0 and FF 0-255
    Set Vx = random byte AND kk.

    Description of the opcode
    The interpreter generates a random number from 0 to 255, which is then ANDed with the value kk. The results are stored in Vx
    on my end it looks like this for 0xC000


    Vx = (rand() % 255 & kk);
    out of sheer exaustion of other options hahha this should be your culprit

  6. #1036
    EmuTalk Member
    Join Date
    Jun 2017
    Posts
    10
    Mentioned
    0 Post(s)
    I'm sorry, I didn't explain well.

    The value of randomNumber is either 0 or 1 after it's been compare with kk.

    Before that, the value of randomNumber is between 0 and 255.

    I just checked it.

  7. #1037
    EmuTalk Member
    Join Date
    Aug 2016
    Posts
    25
    Mentioned
    0 Post(s)
    thats pretty weird... I've been through your code line by line and apart of type casting that i didn't do it seems good. Can you update your git so i can take a look at your updated efforts?
    btw at this point it would be wise to dump your registers and opcodes on a file to see if they are been called in the same order as other emulators

    Mine:

    a21e - Set I (0) = NNN (21e)
    c201 - Randomizer Code Vx = 0
    3201 - Skip if Vx(1) == NN(1) - True
    d014 - Drawing sprites
    7004 - Add Vx(0) += NN (4)
    3040 - Skip if Vx(4) == NN(40) - False
    1200 - Jump to Address - 1NNN(200)
    a2e1 - Set I (21e) = NNN(21e)
    c201 - Randomizer Code Vx = 1
    3201 - Skip if Vx(1) == NN(1) - True
    d014 - Drawing sprites

    That's mine maybe your randomizer will be different but, this is the order for 2 frames of mine

    I'm thinking maybe your vX variables are been overwriten at runtime so your Vx is always adding 0
    Last edited by ]-[ D X; June 8th, 2017 at 23:49.

  8. #1038
    EmuTalk Member
    Join Date
    Jun 2017
    Posts
    10
    Mentioned
    0 Post(s)
    The type casting comes from processing.

    I didn't update my git since I haven't made any progress so far.

    About the registers and opcodes, I compared them with other emulators (you can see all the println everywhere in my code)

    I was getting nervous since it's only the second program that I'm coding but you reassured me since you do seem to believe my reasoning is correct.

    This can't come from a subtlety of processing that we don't get ?

    I'm not a fan of processing, I feel like trying with c and SDL.

    What do you think ? Is it worth a try on something else that processing ?

    - - - Updated - - -

    I replied before seeing your updated post.

    I just checked the order of my opcodes, they're exactly like yours.

    I also checked the value of Vx, (I haven't thought about it at all) it alternates between 0 and 1 regularly.
    Last edited by Okabe; June 9th, 2017 at 00:08.

  9. #1039
    EmuTalk Member
    Join Date
    Aug 2016
    Posts
    25
    Mentioned
    0 Post(s)
    But you are getting output on a console window. Please verify you are getting different values for V[x] on your 0x7000 case
    get rid of those (char) casts and post your results please also on the

    case 0x7000:
    V[x] = char((V[x] + kk) & 0xFF);
    //println("Add kk to V[x] : ", hex(V[x]));
    break;

    //Already told you what bothered me with this one.. i hope you changed it to V[x] += V[x] + kk;

    case 0xC000:
    int randomNumber = int(random(255)) & kk;
    V[x] = char(randomNumber);
    println(randomNumber);
    //println(hex(kk));
    break;

    This one... I'm not familiar with random() used like that, maybe is your own function... and I don't know how it work but you strictly define it as int. try including <stdlib,h>
    and just using

    V[x] = (rand() % 255) & kk);
    let's see if that fix your issue

    It's remarkable this is only your second coding project keep it up.
    Last edited by ]-[ D X; June 9th, 2017 at 00:14.

  10. #1040
    EmuTalk Member
    Join Date
    Jun 2017
    Posts
    10
    Mentioned
    0 Post(s)
    I didn't know the console wasn't 100% reliable. Thank you for the info

    I've never heard about "dump" before, after a little research with the terms "dump java" on google I see "thread dump" and "heap dump" appearing a lot.

    Is that what you're talking about ?

    All the char cast are definitely a pain in the ass but the console of processing specificly told me to do so and won't "compile" if I don't.

    You are right about " V[x] += V[x] + kk;" I should have kept it, my bad :p

    The random() function comes from processing, I tried to include <stdlib,h> but the console give me the error "unexpected token: class"

    I really feel like my problem comes from my misunderstanding of processing.

    - - - Updated - - -

    Everytime I'm using bit shift or the & operator, it seems to come out as a int by default.

    For instance, if I try :

    char x = (opcode & 0x0F00) >> 8;

    the console says "Type mismatch, "int" doesn't match with "char"

    But I think I have to use "char" with registrers, memory and all of that since it's the only unsigned type in Java.

    Am I wrong ?
    Last edited by Okabe; June 9th, 2017 at 01:01.

Page 104 of 106 FirstFirst ... 45494102103104105106 LastLast

Similar Threads

  1. Nintendo DS specifications leaked
    By Gorxon in forum Gaming
    Replies: 37
    Last Post: June 25th, 2004, 22:16
  2. C&T 69000 video chip
    By Knuckles in forum TechTalk
    Replies: 4
    Last Post: June 16th, 2003, 00:43
  3. Rice's Daedalus 5.0.0 source code
    By Rice in forum 1964
    Replies: 19
    Last Post: June 15th, 2003, 09:39
  4. Replies: 18
    Last Post: December 7th, 2002, 10:59

Posting Permissions

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