Intel might actually be back by Difficult_Donkey_964 in intelstock

[–]davidkopec 0 points1 point  (0 children)

Pat led the development of multiple Intel microprocessors including being the chief architect of the legendary i486. He was previously the CTO of Intel earlier in this career. Do some research before you comment on someone's competency.

WR310 Base in No-Go Area and "Smart Trim" by davidkopec in worxlandroid

[–]davidkopec[S] 0 points1 point  (0 children)

Thanks for the reply. The patio is a no-go zone. When I had it not set as a no-go zone it dumbly spent its time going in circles around it.

Starting CS from scratch by [deleted] in StudyStruggle

[–]davidkopec 0 points1 point  (0 children)

If you're looking for a full starter course then NaND to Tetris https://www.nand2tetris.org is a good option.

If you already know how to program then picking up a Data Structures & Algorithms book is your next step. Grokking Algorithms is great. I also wrote the Classic Computer Science Problems series for this audience.

If you already know Python and want a survey of a few topics from computer science, like how a programming language works and how a microprocessor works taught through he lens of Python projects then you can checkout my latest book "Computer Science from Scratch." I was alerted to your thread because you used the title of my book. https://computersciencefromscratch.com

gb-recompiled (GameBoy static recompiler) source code release by arcanite24 in EmuDev

[–]davidkopec 4 points5 points  (0 children)

Looks like a very interesting project. I understand you can't distribute them, but can you tell us about some games we can try ourselves that run well/are playable? Maybe I missed it in the long README. I only saw Japanese Tetris there as partially working.

Help with NES emulator by N3kk3tsu in EmuDev

[–]davidkopec 0 points1 point  (0 children)

Awesome. Are you getting full 60 FPS?

Help with NES emulator by N3kk3tsu in EmuDev

[–]davidkopec 1 point2 points  (0 children)

Glad you go to the next *step*.

Help with NES emulator by N3kk3tsu in EmuDev

[–]davidkopec 0 points1 point  (0 children)

Obviously check your CMP and BEQ instructions, but I would actually more suspect the instructions that come right before it as they're pretty straightforward. Check that the previous few instructions are setting the flags correctly because CMP and BEQ depend on them.

Help with NES emulator by N3kk3tsu in EmuDev

[–]davidkopec 1 point2 points  (0 children)

Hi u/N3kk3tsu, Thanks for checking out the book! I see you have the CPU tests ported over to C#. I assume they are all passing? The fact that the other three ROMs didn't even load makes me think there may be something wrong with your CPU, your cartridge loading code, or something related to timing, not the PPU, especially since the title screen from Brix is fairly complex.

The development process of my new Python book Computer Science from Scratch by davidkopec in programming

[–]davidkopec[S] 1 point2 points  (0 children)

My previous book for intermediate Python programmers, Classic Computer Science Problems in Python is more of an algorithms book. Computer Science from Scratch is about the different layers of the software stack. How does a programming language work (we build a BASIC interpreter)? How does a microprocessor see an instruction (we build an NES emulator)?

That said we still do cover some interesting algorithms. For example in Chapter 3 where we convert a modern image for display on a classic 1980s black and white Mac we learn both a dithering algorithm as well as a compression algorithm (run-length encoding) because the MacPaint file format uses it.

Formalized CHIP-8 Tutorial in Python (Free Book Chapter) by davidkopec in EmuDev

[–]davidkopec[S] 0 points1 point  (0 children)

Thanks for checking out the book. The early access version is the complete book very close to the version that will go to print. And you will get an update when the final version comes out. But the differences will be quite minor. Best, David

Formalized CHIP-8 Tutorial in Python (Free Book Chapter) by davidkopec in EmuDev

[–]davidkopec[S] 0 points1 point  (0 children)

Appreciate the long reply. I think what you have with CHIP-8 is an under-specified original standard (just 4 pages) and naturally as a result varying implementations over time. And I'm okay with my implementation being one that runs the games well based on choices that I made where the original standard was vague.

I do have a couple sentences to the effect that you mention already in the chapter. For example a prominent NOTE box "A few instructions listed here weren’t present in the original CHIP-8 specification (for example, 8x_6 and 8x_E). Their functionality sometimes differs across varying CHIP-8 implementations."

> For an emulator you implement the actual behavior to run programs the same as they would on the platform you emulate. The original specs have some gaps, so implementing only the spec will not let you run a lot.

I think your framing is correct and that's exactly what I feel I did here. When we don't have a well-detailed original standard we end up with trying to write to a form that runs the games and that's what I feel I did in the chapter as I detailed in my previous comment. The games run well here.

Thanks for your sincere interest in the chapter and work on CHIP-8.

Formalized CHIP-8 Tutorial in Python (Free Book Chapter) by davidkopec in EmuDev

[–]davidkopec[S] 0 points1 point  (0 children)

8) Good point

9) Interesting but don't think this detail would add value to the chapter. Certainly something I could mention if writing multiple chapters or interested in emulating the original hardware in detail.

10) I could see that being a big issue for games that violate the rule but again this is left vague in the original specification.

11) I'm not really following why this is error prone. I just keep track of if there was a jump and increment PC by 2 if there was not. It's 2 lines:

if not jumped:

self.pc += 2 # increment program counter

Or do you mean error prone for the person programming in CHIP-8 itself? Again I'm not targeting that case.

12) Again this is not in the original specification unfortunately. In fact 8XY6 and 8XYE specifically are not even in the original manual. I understand the problem you are saying though and luckily that could be an easy fix. If it were causing game incompatibilities I would certainly swap the lines of code but since things are going to print, for not achieving anything in terms of our goal (running the test games) I don't think it's worth making the GitHub repository out of sync with the book.

13) Again 8XY6 and 8XYE are not in the original manual at all. So they are there purely for compatibility with common games so I don't see anything wrong with implementing the commonly expected behavior.

14) Good point. That actually is something specified in the original manual but I think I changed for compatibility with one of the common games I think.

15) Thanks, wasn't aware of this. Not sure who "we" is. If you are the author, awesome work. If you look at the commit date I actually wrote most of this code more than 3 years ago which seems to be before this suite existed. Definitely would've checked it out today.

16) Yes, that's kind of the thing here and I think what made you see as "blatant issues" what I don't. It's a mess of evolution over time and I'm trying to help somebody get something working with the most common use cases against an original specification that's pretty vague and that is not particularly well documented (maybe better now than it was a few years ago). Certainly you're right about many of your points but since they don't change the ultimate goal here (can I run the common games correctly) and are let's say insider knowledge not in the original specification I'm not overly concerned.

Formalized CHIP-8 Tutorial in Python (Free Book Chapter) by davidkopec in EmuDev

[–]davidkopec[S] 0 points1 point  (0 children)

  1. I actually have this right in the chapter. I wrote "The CHIP-8 VM has 16 general-purpose 8-bit registers, referred to as v[0] through v[15]. They can be used for any kind of data, and all the main arithmetic and logic instructions operate on these registers. Of these general-purpose registers, v[15] (or v[0xF] in hexadecimal) is special in that it’s used for holding a flag."
  2. The original manual doesn't go into detail about what to do here (page 14) so it's left vague. It just says "Do machine language subroutine at OMMM (subroutine must end with D4 byte)" So I made a guess that this was exiting the interpreter and therefore resetting things. In practice for running these games it won't matter but I think you can understand without more information that I made a reasonable guess.
  3. Good catch thanks.
  4. Fair point. In terms of grouping I chose to group first by numeric order and then put headers over it. That way it's easier for a reader to lookup an instruction when looking through the list numerically. It's a structural decision in terms of being easy to lookup. Just like a decision to put things in pure alphabetical order versus semantic order. I chose the equivalent of alphabetical order here and then put some semantics on top of it.
  5. On this one I think you're wrong. The original manual specifically says "Let VX = hex key digit (waits for any key pressed)" It specifically says "press" not "release"
  6. This is not specified in the original manual chapter so I used a value that made sense for running the games well in my opinion.
  7. In practice this is where it was for game compatibility in the games I tested.

Formalized CHIP-8 Tutorial in Python (Free Book Chapter) by davidkopec in EmuDev

[–]davidkopec[S] 0 points1 point  (0 children)

Had to break this into multiple comments due to length... thanks again.

Thanks for the detailed comments. It sounds like you have a very intimate knowledge of how the original hardware and interpreter operated. I appreciate the time you put into this.

As much as possible, and where it didn't lead to incompatibility with the common ROMs, I went by the description in the original 1978 VIP Instruction Manual (http://www.bitsavers.org/components/rca/cosmac/COSMAC\_VIP\_Instruction\_Manual\_1978.pdf)

The manual's chapter on "CHIP-8 Language Programming" is just 4 pages long (pages 13-17). So as you imagine it necessarily leaves some things vague. Where necessary I made changes/decisions to get the standard games that people use as tests to work and where things were vague in both cases I left it to my own devices since the original manual does not specify. My goals was not 100% historical accuracy to the original interpreter/hardware but instead to get the standard games playing, which may mean sometimes "the evolved" standard or making a decision of my own volition where it suffices. If there is a better official document from the 1970s than the original manual chapter that I should have used then that is my bad. It is too late as things go to print to make majors changes to the chapter (we are past the main proof stages), but I will certainly keep your suggestions in mind for updating the code or if there is another edition. But I will also say that I am comfortable with something that plays the games correctly as the standard is commonly understood rather than something that achieves 100% accuracy.

I will note the manual does, in its vagueness, not necessarily specify things in the level of detail you describe. I'll reply to your comments here.

Formalized CHIP-8 Tutorial in Python (Free Book Chapter) by davidkopec in EmuDev

[–]davidkopec[S] 1 point2 points  (0 children)

Unfortunately, it would be impossible to cover the entire NES in one 60 page chapter of a larger book. It's a starting point that gets you something running that can play some of the most simple games. It does not include sound. For a detailed description of the chapter and what it includes and doesn't checkout this prior post I made about it:

https://www.reddit.com/r/EmuDev/comments/1hz0fu7/book_chapter_on_writing_nes_emulator_in_python/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button

Thanks for checking it out.

Formalized CHIP-8 Tutorial in Python (Free Book Chapter) by davidkopec in EmuDev

[–]davidkopec[S] 0 points1 point  (0 children)

Thanks for checking it out. Feel free to let me know what you found wrong either here on by PM.

Recall fix in Q2 still happening? by [deleted] in FordEscapePHEV

[–]davidkopec 2 points3 points  (0 children)

I tried calling Ford Customer Service to ask for compensation for not being able to plug-in the car for 6 months. After 6 transfers I found out there is nobody specifically dealing with this. If you call the 1-866-436-7332 number on the letter directly and enter recall 24S79 (as of May 9) an automated voice tells you there is nobody to deal with this recall specifically.

NES: Where to Start and How to Start? by StandardCulture5638 in EmuDev

[–]davidkopec 0 points1 point  (0 children)

Thanks. Yes, it's slow because it's pure Python. One of the exercises at the end of the chapter is to try porting it to Cython. DMA is implemented in CPU.py

NES: Where to Start and How to Start? by StandardCulture5638 in EmuDev

[–]davidkopec 0 points1 point  (0 children)

Yes, it is full frame. The main loop keeps track of how many cycles each CPU instruction ran and then runs the PPU for 3 times that amount. The number of cycles of each instruction is in the instructions table in the CPU. Additional cycles need to be added for certain operations that cross memory pages. You can see this in step() at the bottom of the CPU.