Loading ...
Sorry, an error occurred while loading the content.

Additional CHIP-8 Instructions

Expand Messages
  • mattmik
    Hey everyone! I recently began writing some documentation (a tutorial of sorts) for the CHIP-8 language, and I plan on expanding it to cover extensions to
    Message 1 of 6 , Dec 6, 2011
    • 0 Attachment
      Hey everyone!

      I recently began writing some documentation (a tutorial of sorts) for the CHIP-8 language, and I plan on expanding it to cover extensions to CHIP-8, including CHIP-8I, CHIP-10, CHIP-8X, etc. I noticed, though, that much of the early documentation referencing CHIP-8 lacked a few of the instructions that are mentioned commonly on the internet. For example, the VIP Instruction Manual, Joseph Weisbecker's Byte article, and Harry Kleinberg's CHIP-8 article all lack instructions 8XY6, 8XY7, and 8XYE to perform bit shifts and a form of subtraction. Does anyone have any knowledge of when these instructions were implemented? Or were they always undocumented instructions in the CHIP-8 interpreter?

      Thanks!
      mattmik
    • Ray Sills
      HI Matt: OK! And, that s great news about you writing up a tutorial for CHIP-8. I seem to recall having once read (not sure where) something about those
      Message 2 of 6 , Dec 6, 2011
      • 0 Attachment
        HI Matt:

        OK! And, that's great news about you writing up a tutorial for
        CHIP-8. I seem to recall having once read (not sure where) something
        about those oddball CHIP-8 instructions. I guess it's a case of
        "yes.. those are valid instructions... (they don't crash the
        system).. and they do some consistent processes... which you might be
        able to make use of.. " etc. I think they were just undocumented
        instructions. Most likely because they were not often needed to make
        the various CHIP-8 apps do what the programmer needed.

        So, I suspect they were just leftover code that no one had a good use
        for at the time. Sometimes, people who were modifying CHIP-8 would
        create "new" instructions by replacing the CHIP-8 instruction of an
        unofficial or undocumented instruction with new code.

        73 de Ray

        On Dec 6, 2011, at 2:24 PM, mattmik wrote:

        >
        > Hey everyone!
        >
        > I recently began writing some documentation (a tutorial of sorts)
        > for the CHIP-8 language, and I plan on expanding it to cover
        > extensions to CHIP-8, including CHIP-8I, CHIP-10, CHIP-8X, etc. I
        > noticed, though, that much of the early documentation referencing
        > CHIP-8 lacked a few of the instructions that are mentioned commonly
        > on the internet. For example, the VIP Instruction Manual, Joseph
        > Weisbecker's Byte article, and Harry Kleinberg's CHIP-8 article all
        > lack instructions 8XY6, 8XY7, and 8XYE to perform bit shifts and a
        > form of subtraction. Does anyone have any knowledge of when these
        > instructions were implemented? Or were they always undocumented
        > instructions in the CHIP-8 interpreter?
        >
        > Thanks!
        > mattmik
      • Marcel
        Hi Matt, David (Winter) and myself looked into this a few months back. Reason why we investigated it was because it looked like the VIP Chip8 handled the 8XY6,
        Message 3 of 6 , Dec 7, 2011
        • 0 Attachment
          Hi Matt,

          David (Winter) and myself looked into this a few months back. Reason why we investigated it was because it looked like the VIP Chip8 handled the 8XY6, 7 and E instructions slightly different than some of the emulators out there. After some digging I think David found out that the original chip8 code actually stores the 1802 Fx instruction on the 'stack' and executes it directly. So 8XY1 actually executes the F1 (OR), 8XY2 the F2 (AND) instruction etc. My conclusion from this is that the 6, 7 and E variants executing F6, F7 and FE were always in the code just not documented.

          Also the 6 and E instructions have been documented incorrectly afterwards which now causes some Chip8 code not to run correctly on the VIP (or Emma). I believe the correct description is:
          8XY6, SHR Vx, Vy: Vx = Vy >> 1
          8XYE, SHR Vx, Vy: Vx = Vy >> 1
          It had been assumed as Vx = Vx >> 1 resulting in some code using 8x06 instructions expecing Vx to shift but on the VIP resulting in V0 to be shifted and result stored in Vx.

          I'm no Chip8 expert but David is and he actually corrected some of his and other software. The corrected SW is now included in the latest Emma 02 package. See changlog for the list of corrected software.

          Hope that helps,
          Cheers, Marcel.

          --- In rcacosmac@yahoogroups.com, "mattmik" <mikolaym@...> wrote:
          >
          > Hey everyone!
          >
          > I recently began writing some documentation (a tutorial of sorts) for the CHIP-8 language, and I plan on expanding it to cover extensions to CHIP-8, including CHIP-8I, CHIP-10, CHIP-8X, etc. I noticed, though, that much of the early documentation referencing CHIP-8 lacked a few of the instructions that are mentioned commonly on the internet. For example, the VIP Instruction Manual, Joseph Weisbecker's Byte article, and Harry Kleinberg's CHIP-8 article all lack instructions 8XY6, 8XY7, and 8XYE to perform bit shifts and a form of subtraction. Does anyone have any knowledge of when these instructions were implemented? Or were they always undocumented instructions in the CHIP-8 interpreter?
          >
          > Thanks!
          > mattmik
          >
        • mattmik
          Hey Marcel! Thanks for the response! That helped a bunch. After checking the CHIP-8 Exposed article in Volume 1, Issue II of VIPER, it seems that you are
          Message 4 of 6 , Dec 7, 2011
          • 0 Attachment
            Hey Marcel!

            Thanks for the response! That helped a bunch. After checking the CHIP-8 Exposed article in Volume 1, Issue II of VIPER, it seems that you are correct.

            I'd like to make this tutorial describe the original variant of CHIP-8 as accurately as possible. In my opinion, all CHIP-8 games should be programmed to run as they would on the VIP. This means that the 8XY6 and 8XYE instructions you mentioned should make use of the VY register, as they were originally intended.

            Thanks!
            mattmik

            --- In rcacosmac@yahoogroups.com, "Marcel" <marcel.v.tongeren@...> wrote:
            > David (Winter) and myself looked into this a few months back. Reason why we investigated it was because it looked like the VIP Chip8 handled the 8XY6, 7 and E instructions slightly different than some of the emulators out there. After some digging I think David found out that the original chip8 code actually stores the 1802 Fx instruction on the 'stack' and executes it directly. So 8XY1 actually executes the F1 (OR), 8XY2 the F2 (AND) instruction etc. My conclusion from this is that the 6, 7 and E variants executing F6, F7 and FE were always in the code just not documented.
            >
            > Also the 6 and E instructions have been documented incorrectly afterwards which now causes some Chip8 code not to run correctly on the VIP (or Emma). I believe the correct description is:
            > 8XY6, SHR Vx, Vy: Vx = Vy >> 1
            > 8XYE, SHR Vx, Vy: Vx = Vy >> 1
            > It had been assumed as Vx = Vx >> 1 resulting in some code using 8x06 instructions expecing Vx to shift but on the VIP resulting in V0 to be shifted and result stored in Vx.
          • David Winter
            Hi there, A quick answer concerning those 8XYN instructions (where X and Y are the registers and N the type of instruction). The original chip-8 interpreter
            Message 5 of 6 , Dec 7, 2011
            • 0 Attachment
              Hi there,

              A quick answer concerning those 8XYN instructions (where X and Y are the registers and N the type of instruction).
              The original chip-8 interpreter had a very clever design taking advantage of 1802 op-code generation from the N nibble.
              Once formed, the opcode was pushed to the stack and executed, thus directly running the instruction.

              Since the shift instructions were not originally documented and neither accurately described, it was assumed that
              only the VX register was shifted (i.e VX = VX >> 1 and VX = VX << 1). After checking the 1802 interpreter it was
              found that VX was the target register and VY was the source register, and that most (if not all) programs used
              0 for VY, causing any 1802 emulator to put the shift result into V0 instead of VY. Since all existing programs were
              designed assuming VX both as source and target, the obvious fix was to put the same value for X and Y.

              However, I don't know about the Chip-8I variant. I heard of the Chip-8X and Chip-10 but not this one.
              What does it feature ?


              David Winter


              To: rcacosmac@yahoogroups.com
              From: marcel.v.tongeren@...
              Date: Wed, 7 Dec 2011 17:39:02 +0000
              Subject: [rcacosmac] Re: Additional CHIP-8 Instructions

               
              Hi Matt,

              David (Winter) and myself looked into this a few months back. Reason why we investigated it was because it looked like the VIP Chip8 handled the 8XY6, 7 and E instructions slightly different than some of the emulators out there. After some digging I think David found out that the original chip8 code actually stores the 1802 Fx instruction on the 'stack' and executes it directly. So 8XY1 actually executes the F1 (OR), 8XY2 the F2 (AND) instruction etc. My conclusion from this is that the 6, 7 and E variants executing F6, F7 and FE were always in the code just not documented.

              Also the 6 and E instructions have been documented incorrectly afterwards which now causes some Chip8 code not to run correctly on the VIP (or Emma). I believe the correct description is:
              8XY6, SHR Vx, Vy: Vx = Vy >> 1
              8XYE, SHR Vx, Vy: Vx = Vy >> 1
              It had been assumed as Vx = Vx >> 1 resulting in some code using 8x06 instructions expecing Vx to shift but on the VIP resulting in V0 to be shifted and result stored in Vx.

              I'm no Chip8 expert but David is and he actually corrected some of his and other software. The corrected SW is now included in the latest Emma 02 package. See changlog for the list of corrected software.

              Hope that helps,
              Cheers, Marcel.

              --- In rcacosmac@yahoogroups.com, "mattmik" <mikolaym@...> wrote:
              >
              > Hey everyone!
              >
              > I recently began writing some documentation (a tutorial of sorts) for the CHIP-8 language, and I plan on expanding it to cover extensions to CHIP-8, including CHIP-8I, CHIP-10, CHIP-8X, etc. I noticed, though, that much of the early documentation referencing CHIP-8 lacked a few of the instructions that are mentioned commonly on the internet. For example, the VIP Instruction Manual, Joseph Weisbecker's Byte article, and Harry Kleinberg's CHIP-8 article all lack instructions 8XY6, 8XY7, and 8XYE to perform bit shifts and a form of subtraction. Does anyone have any knowledge of when these instructions were implemented? Or were they always undocumented instructions in the CHIP-8 interpreter?
              >
              > Thanks!
              > mattmik
              >


            • mattmik
              Hey Dave! Thanks for the comment concerning the 8XYN instructions. That clears up a lot. I plan on describing the proper use (with VY being shifted into VX) in
              Message 6 of 6 , Dec 7, 2011
              • 0 Attachment
                Hey Dave!

                Thanks for the comment concerning the 8XYN instructions. That clears up a lot. I plan on describing the proper use (with VY being shifted into VX) in my documentation.

                CHIP-8I was an extension to CHIP-8 described in Volume I, Issue 3 of VIPER. It allows simple I/O through a modified instruction set. I imagine it wouldn't be much use to anyone without an actual VIP, though.
                http://mattmik.com/files/viper/Volume1Issue03.pdf

                Thanks!
                mattmik

                --- In rcacosmac@yahoogroups.com, David Winter <d_winter@...> wrote:
                > However, I don't know about the Chip-8I variant. I heard of the Chip-8X and Chip-10 but not this one.
                > What does it feature ?
              Your message has been successfully submitted and would be delivered to recipients shortly.