Page 96 of 106 FirstFirst ... 46869495969798 ... LastLast
Results 951 to 960 of 1057

Thread: Chip 8

  1. #951
    EmuTalk Member
    Join Date
    May 2010
    Posts
    2
    Mentioned
    0 Post(s)
    Hi royboyjoytoy2,

    I fixed all the problems of the interpreter. You may want to look at chip8_pixels_draw() function in http://github.com/rcvalle/chip8/blob/master/chip8.c

    Best regards,


  2. #952
    EmuTalk Member io-grey's Avatar
    Join Date
    Jul 2010
    Posts
    1
    Mentioned
    0 Post(s)
    hi guys.
    got a few questions.

    -to which memory address do you load the game/rom data?

    -at which address is the first instruction?
    in cowgod's guide. it mentions 0x200 (most of the time) and 0x600 (sometimes for the ETI 660 computer). is there a way to determine the right address?

    greetings
    Last edited by io-grey; July 5th, 2010 at 17:41.

  3. #953
    EmuTalk Member
    Join Date
    Oct 2009
    Location
    Russia, Moscow
    Posts
    5
    Mentioned
    0 Post(s)

    Arrow

    Hi, all.

    Today i done my Delphi CHIP-8 emulator. I added SCHIP support, fixed annoying bug with keyboard, rewrite draw function and more...

    During testing, I wrote simple TEST program for (S)CHIP-8 emulators. This program contain 26 tests, including:
    FX65 instruction test
    Font 8x5 test
    BCD instruction test
    Math operation tests ADD,SUB,SHL,SHR,XOR (carry flag, borrow)
    HP48 flags test
    FX1E instruction (buffer overflow test)

    Full assembler source code included in archive.

    This is my Delphi emulator. All tests passed:


    And this David Winter CHIP8 emulator. Also all tests done:


    Some emulators from this topic:








    SCTEST

    Small programm for test (S)CHIP-8 emulators. If all test passed, you see
    "OK" on upper left corner, else programm print ERROR and error number.
    Written by Sergey Naydenov, e-mail: tronix286[dog]rambler.ru (c) 2010

    Errors:

    ERROR INI
    Emulator initialization failed. When program start, all registers
    must be set to null.

    ERROR BCD
    BCD instruction problems.

    ERROR 0
    Problems with Fx65 instruction. Can't load zeroes from memory to
    registers.

    ERROR 1
    System font 8x5 not found. In memory at offset 000h - zeroes.

    ERROR 2
    Addiction without overflow (254+1). VF register need to be set 0,
    but after operation he still 1

    ERROR 3
    After operation 254+1, register v0 need set to 255, but he does't.

    ERROR 4
    Addiction with overflow (255+1). VF register must be set to 1, but
    after operation he still 0

    ERROR 5
    Wrong result after addiction operation (255+1). Must be 0.

    ERROR 6
    After substraction 1-1 register VF must be 1, but he still 0.

    ERROR 7
    Wrong result after 1-1 operation. Result must be 0.

    ERROR 8
    Substract 0-1. VF register must be 0, but he still 1

    ERROR 9
    Wrong result after 0-1 operation. Register v0 must be 255.

    ERROR 10
    ... skip ...
    ..sorry, i don't have time for writing all descriptions. Please see
    source code SCTEST.C8..

    ERROR 23
    Can not restore HP48 flags (FX75/FX85 instructions).

    ERROR 24
    Check FX1E (I = I + VX) buffer overflow. If buffer overflow, register
    VF must be set to 1, otherwise 0. As a result, register VF not set to 1.
    This undocumented feature of the Chip-8 and used by Spacefight 2019!
    game.
    I can't attach file to this forum (i get "cant' copy/move file" error message).
    You can download this test by clicking on SCTEST_12.ZIP from here: http://rghost.ru/2304760
    Last edited by Tronix; August 9th, 2010 at 19:02.

  4. #954
    EmuTalk Member
    Join Date
    Oct 2009
    Location
    Russia, Moscow
    Posts
    5
    Mentioned
    0 Post(s)

    Question

    Hello guys!

    I apologize in advance for my English, because it's not my native language.

    Recently i had a crazy idea - write a Pascal-like compiler for CHIP8.
    So, i want to present you the alpha version of C8PASCAL My compiler (or translator, if you want) generate ASM listing, witch can be compiled using CHIPPER V2.11 by Christian Egeberg. Let me show you simple example program, written in C8PASCAL:

    Code:
    Program Example2;
    { C8PASCAL example - division without using DIV operator }
    
    Var
     q,x,y,a,b,counter : byte;
    
    Begin
          x := 20;               {First number}
          y := 4;                {Second number. As result we can get X DIV Y}
          q := 0;                {begin calculate}
          while x >= y do
                Begin
                      a := x shr 1;
                      b := y;
                      counter := 1;
                      while a >= b do
                            begin
                                  b := b shl 1;
                                  counter := counter shl 1;
                            end;
                      x := x - b;
                      q := q + counter;
                End;
          Debug(0,0,q);        {Print result X DIV Y}
    
          x := 20;      	   {First number}
          y := 4;              {Second number}
          Debug(0,10,x div y); {Print result using build-in DIV operator}
    end.
    Other examples in archive. This is screenshot of second example program - "calculate square root", written in C8PASCAL too:


    This example rendering Serpinski triangle:



    Code:
    CHIP8 Pascal (C8PASCAL)
    
    Version: 0.3 alpha - Very simple and slowly, becouse it is Alpha.
    
    Written by Sergey Naydenov (c) 2010
    e-mail: tronix286[dog]rambler.ru
    
    C8PASCAL translate Pascal source code into CHIP8 assembler listing,
    which can be compiled using CHIPPER V2.11 by Christian Egeberg.
    
    ===========================================
    1) RUN-TIME ERRORS. RANGE CHECKING. MEMORY.
    ===========================================
    C8PASCAL not support runtime range checking. It's mean, you need
    be very careful, when you operate with variables. Also, C8PASCAL do not
    overflow checking. Let's look at example:
       Var
         a,b,c : Byte;
         mas   : Array [0..7];  {8 bytes length array}
         d     : Byte;          {this variable comes immediately after the array}
       Begin
         A := 250;
         B := 6;
         C := A + B;   {here we get overflow. }
                       {As a result C contain 0; not 256}
         B := B - 6;   {B = B - 6 = 0}
         C := A div B; {Divide by zero. As a result - infinite loop or crash}
         a := Mas[20]; {range overflow. As result, in var "A" - random data}
         Mas[8] := 55; {range overflow. As result, in var "D" - 55}
    
    CHIP8 has 3584 bytes RAM memory (#FFFh - #200h = #E000h). For
    operating with variables C8PASCAL used own stack, located at the end of 
    the program. Typically, the stack must have 10-12 bytes free, but if 
    stack overflow, program crashed. Therefore it is desirable not to exceed 
    the program size of 3000-3200 bytes.
    
    ============
    2) VARIABLES
    ============
    C8PASCAL can operate with BYTE (unsigned integer 8-bit) type only. So, all
    variables must be defined as Byte. 
    Ex.: 
         Var
             i     : Byte;            {loop variable}
             a,b,c : Byte;            (* some variables *)
    
    ============
    3) CONSTANTS
    ============
    Constants are well used for sprites or initial values of variables. The 
    constants do not differ from the variables in terms of the main program.
    You can change them in the course of the your program. Constants section
    should be located before the variables section.
    Ex:
         Const
            Sprite : Array [0..3] = (
                                     #01100110,  {Sprite 8x4. Two vertical}
                                     #01100110,  {lines}
                                     #01100110,
                                     #01100110
                                    );
            FirstNumber  : Byte = 64;            {simple Byte constant}
            SecondNumber : Array [0..0] = ($40); {array with 1 element.}
                                                 {hex $40 = 64 dec}
         Begin
            Debug(10,10,FirstNumber);            {draw 064 at X=10, Y=10}
            FirstNumber := FirstNumber + SecondNumber[0];
                                                 {FirstNumber = 64+64=128}
            Debug(40,10,FirstNumber);            {draw 128 at X=40, Y=10)
            DrawSprite(10,20,4,^Sprite[0]);      {draw vert lines at X=10, Y=20}
         End.
    
    =========
    4) ARRAYS
    =========
    This C8PASCAL version support one-dimensional arrays only. Arrays allways
    starting with 0 (zero) to N. Each array element has Byte type. Maximum array
    size is 255 bytes. You don't needed writing "of Byte;" after array 
    defination. If you type something like that: "mas : array [0..7] of Byte;" 
    you get an error.
    Ex.:
         Var
             mas   : Array [0..7];    {first sprite. Array size = 8 bytes}
             temp  : Array [10..15];  {ignore first number 10 and set array to}
                                      {16 bytes long}
    
    In program you can operate arrays with help "[" and "]" token.
    Ex.:
         Mas[0] := 2;       {set first array element to 2}
         a := Mas[i-1];     {let variable "a" contain "i-1" array element}
         b := Mas[(a div 3)+15];
    Warning! No range checking there. If you define array as "mas : array [0..7];" 
    and then try to do "a := mas[127];" you get random data in "a".
    
    ==================================
    5) DIVISION AND MULTIPLY OPERATORS
    ==================================
    Originaly CHIP8 don't have division and multiplication commands. C8PASCAL
    software emulate this operation. Therefore, these operations very slowly.
    If you want to divide or multiply by a power of two, please use SHR and
    SHL operation.
    Ex.:
        a := a div b;                {division}
        a := a mod b;                {the remainer of division}
        a := c * b;                  {multiply}
    
    ================
    6) SHIFTING BITS
    ================
    In original CHIP8 SHR and SHL shifting bits by one. For compartable, C8PASCAL
    support shifting by any number and generate "SHL VX, VY" instruction for
    CHIPPER. As far as i know, all emulators ignore "VY" and shifting "VX" by one.
    So, if you need shifting more than one bits, you need do SHR/SHL operation
    more times.
    Ex.:
       a := a shr 1;                 {a = a div 2}
       a := a shl 1;                 {a = a * 2}
       a := a shr 4;                 {the same as "a shr 1". last argument (4) }
                                     {ignored by many emulators}
       a := (((a shr 1) shr 1) shr 1) shr 1; { a = a shr 4 }
    
    ==========
    7) LOGICAL
    ==========
    C8PASCAL support primitive logic only.
    Ex.:
       If a = b then                 {if a equal b}
       If a <> b then                {if a not equal b}
       If a > b then                 {if a greater then b}
       If a < b then                 {if a less then b}
       If a >= b then                {if a greter or equal b}
       If a <= b then                {if a less or equeal b}
       If (a mod 2) = 0 then         {if a odd then ...}
    
    ===========================
    8) PROCEDURES AND FUNCTIONS
    ===========================
    Not support functions (yet). Simple support for procedures, without
    parameters.
    Ex:
       Var
    	a : byte;
    
       Procedure InitVariable;    {initialize A variable}
       Begin
         a := 255;
       End;
    
       Begin                      {MAIN programm}
         InitVariable;            {Call InitVariable procedure}
         Debug(a);                {Print 255}
       End.
    
    ===========================
    9) SPECIAL CHIP8 PROCEDURES
    ===========================
    
    Procedure DrawSprite(X,Y, N : Byte; Sprite : Pointer);
    Draw sprite at X,Y position, N lines. N must be constant.
    Ex:
       Var
             i      : Byte;         {loop variable}
             OneDot : Byte;         {one dot mask. It's 8x1 sprite!}
             Fill   : Array [0..7]; {8x8 sprite}
       Begin
         OneDot := $80              {"1......." in binary. Its our one line sprite}
         For i := 0 to 7 do
            Fill[i] := #FF;         {fill 8x8 sprite. "11111111" in binary}
         DrawSprite(0,0,1,^OneDot); {draw 8x1 sprite (dot) in upper left corner}
         DrawSprite(30,20,8,^Fill[0]); {draw filled rectangle at X=30, Y=20}
       End.
    
    Procedure DrawChar(X,Y, FntSize, Number : Byte);
    Draw number symbol (from $0 to $F) at XY pos. If FntSize = 5 then draw 8x5
    sprite and if FntSize = 10 draw s-chip 16x10 (8x10 in chip8 mode) sprite.
    FntSize must be constant.
    Ex:
       Var
          Num : Byte;
       Begin
          Num := 2;
          DrawChar(10,10,5,Num);    {Draw "2" on the screen}
       End.
    
    Procedure Debug(X, Y, Num : Byte);
    Print decimal number at XY position.
    Ex:
        Var
          Num : Byte;
        Begin
          Num := 64 div 2;
          Debug(0,0,Num);           {Print 032 at upper left corner}
        End;
    
    Procedure Cls;
    Clear the screen.
    
    Procedure SetHigh;
    Set 128x64 SCHIP-8 mode.
    
    Procedure SetLow;
    Set 64x32 CHIP-8 mode.
    
    Procedure Scroll_Left;
    Scroll screen 4 pixels left.
    
    Procedure Scroll_Right;
    Scroll screen 4 pixels right.
    
    Procedure Scroll_Down(N : Byte);
    Scroll screen N lines down. N must be constant.
    
    Function Random(N : Byte);
    Get random number AND N.
    
    Procedure Delay(N: Byte);
    Set delay timer to N.
    
    In next versions: ByteToBCD, LoadFont, etc...
    
    ========
    10) TO DO
    ========
    
    Bug fixing, Input support, Local variables, Functions, Procedure and Functions 
    parameters, standart library functions, integer (signed) variable, 
    code optimization, and much more...
    If you want to join this project, please contact me by e-mail.
    
    ===========
    11) HISTORY
    ===========
      v0.1 alpha 07.08.2010
         +  First alpha reliase. Basic functions.
      v0.2 alpha 13.08.2010
         +  Added constants support;
         +  Added SetHigh, SetLow, Cls, Scroll_Left, Scroll_Right, 
            Scroll_Down(N:byte) system procedures;
         +  Added to examples Serpinski triangle drawing programm
         *  First optimization for generated code. If possible, use free 
            registers with stack operations;
         *  Fix token parser - when variable begins from the reserved words,
            compiler gave an error;
      v0.3 alpha
         +  Added Random(N) function, Delay(N) procedure;
         +  Added stars demo example.
         *  Fix bug with arrays pointer.
         *  Fix REPEAT-UNTIL bug.
    You can download C8PASCAL from here: http://rghost.ru/2341789 by clicking on C8PASCAL_03a.zip.
    Last edited by Tronix; August 14th, 2010 at 11:19.

  5. #955
    EmuTalk Member
    Join Date
    Sep 2010
    Posts
    4
    Mentioned
    0 Post(s)

    Hardware for Chip-8

    Hi,

    This is my first post here. It looks like some good chip-8 dudes have posted here so I'm going give my question a chance. I'm a C# programmer as a profession, but fiddles with hardware as a hobby. My last summer vacation project was a hardware chip-8 implemented in a single FPGA. I think it is one of the first of its kind so that's nice. It connects to a VGA-monitor for graphics and a Atari/Amiga-joystick for control.

    Things are starting to work out quite nice but I have a timing problem that seems very hard to fix. The games I have tried out this far is:

    BLITZ
    BLINKY
    SPACE INVADERS
    MISSILE
    TETRIS
    HIDDEN

    After reading up on timing I first locked the main frequency to approx. 400Hz (400 chip-8 instructions/second) and made the timer decrease every 1/60s. This works for some games but not all. Now I've embedded info for every game to get its own Hz(100-1000Hz) and also a divider to always lock the TimerRegister to approx. 60Hz regardless of main frequency. It still does not work well with for example HIDDEN.

    Have somebody seen the same problem with software emulators? Is there somebody who made a table of settings that work well for all/some chip-8 games? Also when trying out different emulators with the game HIDDEN I've seen different behaviors with keyboard control. Should the cursor move one square at a time or move several squares at a time without requiring neutral keyboard value(no key pressed) in between.

    Magnus

  6. #956
    EmuTalk Member
    Join Date
    Nov 2005
    Posts
    1
    Mentioned
    0 Post(s)
    Most Chip-8 games work well with about 14 instructions/timerupdate (840 instructions/second).
    The waitkey-instruction reset the key state before waiting so the cursor should move one square at a time.

    Tobiy

  7. #957
    EmuTalk Member
    Join Date
    Sep 2010
    Posts
    4
    Mentioned
    0 Post(s)
    Thanks for the tip Tobiy, that was one of the "bugs" still left in the chip-8 core! Because of the way the hardware is connected, I now wait for NO keypress and then wait for the specific keypress on the FX0A-instruction. Seem to work great. Regarding the timing I try 840 inst/sec and it looks and works quite OK with all games I tried this far with the above keyboardfix.

    Next up is sound output. Sound register and opcode-implementation already done but actual sound signal left to fix.

    Then I will try to add SuperChip opcodes and graphics!

    Some other glitches present is that BLITZ have two problems.

    1) The original BLITZ always draw the skyscrapers one pixel too long which end up showing at the top of the screen making the plane run directly into these pixels and get "Game Over" right away. I've read some other emulators writers having problems with this one and as I understand it is a bug the the original code, but thanks to the original implementation not having "Sprite y-wrapping" the extra pixels never showed. I now use a fixed version of the ROM instead. Any thoughts about this?

    2) Due to the fact that I'm using a static LFSR-register to implement the random instruction CXNN the skyline in BLITZ always start the same way. In my start sequence this means a skyscraper is drawn in the very left pixelrow (x=0). Is this normal? When the plane wraps around the X, the game automatically lower the plane 1 row in Y. This also mean that when trying to bomb the left-most skyscraper the plane now kills itself because the plane is lowered at the same time. How is this supposed to work? Anyone know anything, that would be great!

    Thanks!

  8. #958
    EmuTalk Member
    Join Date
    Sep 2010
    Posts
    4
    Mentioned
    0 Post(s)
    Yo, I don't know how many users that actually reads this long thread but I'll keep adding questions..

    Does anybody know about a really good and exact Chip-8 emulator implementation? As a step in building the first CHIP-chip-8 (that is the first implementation using logic gates), I though I would try out writing something in assembler myself. To be able to do this I needed a tool chain for Chip-8 assembler. I've chosen the original Chipper assembler and a great Chip-8 emulator written in JAVA and called JChip8BR.

    The chosen chip-8 program is a Monitor/HexMemEditor. Its already working as a HexViewer and just some details left before it can be used to Edit HexValues in memory. BUT, the only emulator I've got that actually can run it is my fixed JChip8BR. Anyone got another GOOD one I could try?

    Tronix, I tried your genius sctest program on the JChip8BR and found 3 bugs in the opcodes. After fixing those, the program shows "OK", so I think its probably quite OK now. Is the author listening? Great work you've done. I've fixed up some good updates for the emulator that I'm willing to Commit to GoogleHosting if I were to get membership in the project.
    Some updates:
    1) Done refactoring to seperate disassembly/execution of chip8-instructions. Switched the const int's in Instruction.java for a new enum eInstruction. This enum holds both the opcode-hexcode, the string and the bitmask used to identify it. It also holds the specific opcode-value. The num also includes a static method to convert from int to eInstruction.
    2) New generic/configurable methods to format chip8-addresses/values.
    3) Switched fonts from monospaced to fixed size which is much better when formatting source code output. Much better and more output in Memory window.
    4) Added a Restart/Reset button/method which does a cold boot (loads the last used file from disk again, resets all registers)
    5) Added command-line support for a single parameter consisting of a full path to a chip8-binary file. The emulator now initializes (but does not execute) directly when started.
    6) Fixed some misspellings in the source code.
    7) Added simple handling of Breakpoints, just double-click in the disassembly window to Toggle breakpoint.
    8) Now possible to change register values any time, for example when doing debugging/stepping, even the PC (program counter) can be changed.

  9. #959
    Living RCP Hungup
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    35
    Mentioned
    0 Post(s)
    Dusting off my account here (last post over 4 years ago, heh), here's the next person to have written a Chip-8 interpreter:




    - Written in C, using SDL, SDL_ttf and SDL_gfx
    - Appears to be compatible with every regular Chip-8 game I've thrown at it

    Download (Win32 binary): http://code.google.com/p/ozmav/downl...zunyan8_v1.rar

    Usage is simple; if the interpreter is started without any command line arguments, you get a file selection dialog (see screenshot 1) which allows you to open a Chip-8 program. In-game, you can press F11 to have a look at the remaining controls, while pressing F12 shows the about box and ESC exits the program. Here's hoping I didn't forget anything...

    I will probably be trying to build the program on Linux, as well as post the source code later
    cu xdaniel

    Kagami - Desktop:

    Kazari - Notebook:

  10. #960
    EmuTalk Member
    Join Date
    Jan 2009
    Posts
    8
    Mentioned
    0 Post(s)
    Hello,

    here is a little update of my old emu(Chiplol), it is now an upgraded version with a pseudo-3d rendering(change with Ctrl+2). I did it with two other people for a school project.

    We compiled it for PSP and managed to... play online between a PSP and a PC! So useless lol(but funny)! It worked with the help of a java server, which I don't have anymore unfortunately.

    It passes all tests in of SCTEST.
    It's programmed in C++(the emu core is totally portable) with Qt for gui, that's why the download is a little bit big(big dlls)
    Btw, it's all in french, sorry for this, I didn't translate it yet.
    Here is a screenshot:
    http://bayimg.com/FaPgMAACg

    And the download(windows, about 3MB):http://rghost.net/2740686

Page 96 of 106 FirstFirst ... 46869495969798 ... 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
  •