Programming Arduino in C++11 -- ROM dumping

preview_player
Показать описание
In this tool-assisted education video I show how to program an Arduino Atmega2560 board in C++11 to dump a ROM chip, such as a 386sx BIOS or a Famicom cartridge ROM. I also make a ZMODEM sender and a LED blinker in this video.

Sorry about the bad dub / lipsync in the beginning. I recorded that part in a very noisy room, using a bad microphone (internal to the camera), and in another language, so I had to dub it over in postprocess -- which turned out to be considerably more difficult than I thought. Some year soon I might get a boom microphone for use in this kind of occasions.

Please feel free to post comments & ask any questions / clarifications in the video comments. I try to reply to everyone when applicable. Please exercise clarity, politeness and good grammar, if you expect those values in the replies.

In particular, the 27C512 diagram here is applicable. For the NES ROM, I changed the OE/Vpp pin into address bit 16 and the CE/PGM pin into address bit 17.

I bought my Arduino board (which is a clone actually) from DealExtreme:
Presently it costs only about 15 EUR including shipping.
The breadboard, the jumper wires and the resistors (for LED) are also from that shop. This pack includes all of those:
It also includes another Arduino board, but a smaller one (also clone) that does not have enough GPIO pins for ROM dumping, unless you use an external shifter microchip (such as 74LS595).
The three-color LED is:

The operating system where I run the compiler and uploaded the program is Debian GNU/Linux, and I installed "arduino-mk" (which automatically installs the dependent avr-libc, gcc-avr, binutils-avr and arduino-core packages).

The desktop environment shown in this video does not exist. It was created in postprocess to facilitate multi-file editing, which I have not previously used in my videos.

Рекомендации по теме
Комментарии
Автор

Dear Sir, you are doing great job ! Finally, someone who is not selfish to share knowledge to the world and to step ahead from "blinking LED" project . Many greetings from Bosnia and Herzegovina, Europe !

maxtvdoo
Автор

I've watched hours of your videos while doing homework (like right now) because the music and your voice is so pleasant to hear. This also provides much inspiration for programming, despite me not knowing anything that you do in these videos. I want to learn more because of these videos :).

pchips
Автор

who are these people who dislike the videos, this bisqwit guy is brilliant

okeowoaderemi
Автор

your videos make me feel happy, I like the sound of your voice when I am cleaning my room >.< ^_^ have a good day!

amrillorrac
Автор

Sorry to disappoint you, but the desktop environment shown in this video does not exist. (As also explained in the video description.) It is entirely generated by rendering in postprocess. This was my solution to multi-file editing, which has been a problem for me in the past in the programming videos -- and admittedly still is, which is one of the reasons my latest project is so delayed.
I will probably use the same solution in the next video, although perhaps with different graphics icons.

Bisqwit
Автор

Thank you for your question. There are two reasons why I did two loops in that part of the code rather than one.
The 1st reason is efficiency: These loops perform one-bit writes to I/O ports. Those ports are bound together in single bytes. Alternating the writes between two physical bytes in a single loop would involve 16 actual I/O writes rather than 2.
The 2nd reason is in video production: the code involved fewer characters to type, thanks to being able to copypaste the nearly identical line.

Bisqwit
Автор

Everytime i watch your videos i am feeling back in 90s. Love your work!

ddaniel
Автор

Thank you for the video. Watching this was marvelous, it was like art.

filehd
Автор

The EPROM reader code (i.e. the main program) is written in C++. It #includes Arduino.h and does not particularly abstract the Atmel interface. It does provide the abstraction for the Zmodem code, which is written in standard C++11 (no platform-specific includes). In other words, the main program _is_ the abstraction for the Zmodem code that deals with data transmission with the user.

Bisqwit
Автор

How do people manage with multithreading code? How do people manage with subroutines? How do people manage with recursion? And so on.
Coroutine is just another paradigm. A coroutine is just a regular routine that runs side by side with another code, alternating in turns.
It is like climbing a ladder. Left leg moves. Right leg moves. Left leg moves. Right leg moves.
Without coroutines, it would be: Left leg moves, falls back down. Right leg moves. Left leg moves, falls back down. Right leg moves.

Bisqwit
Автор

Thanks for writing. The song is from a SNES game called Live a Live. I converted it to AdLib. In another video I explain how that is done.
As for programming: Start from basics. Find a tutorial that teaches you how the following concepts work: If, While, For-loop, Variables, Functions, Switch-case, Arrays, Input, Output, Libraries. Study how to use them in some language, such as Python, Lua, PHP or C. Have ideas and try things. Start simple. Read code written by others, modify, and see effects.

Bisqwit
Автор

Certainly. In fact, I used this very same device to dump the ROM of a Famicom/NES cartridge. Atari 2600 cartridges are the same technology, except the ROMs are a lot smaller. Similarly for Sega Megadrive, where the difference is also in the size (larger than NES games).

Bisqwit
Автор

You made this chip come alive! Amazing skills. Now thats what I call hard coding. Keep it up!

anthonytonev
Автор

In other words, I would argue that it is perfectly discernible at more regular resolutions exactly because I used high resolutions in all intermediate processing steps, including the upload to YouTube.

Bisqwit
Автор

Now what you could do is use "port manipulation". Port manipulation is essentially setting 8 pins to the values *at once* . It takes much, *much* less time than collectWrite does.

If we wanted, we could have three ports. On an Arduino Mega (2560), that is not a problem since we have 50+ pins. We could use 1 port for the low byte of the address (set all as output in code), 1 port for the high byte of the address (also, set all pins as output) and 1 port for the actual data (set all pins as *input* ).

iProgramInCpp
Автор

Loved the LED bit at the end! Keep up the great work on the videos.

Zanneth
Автор

Thank you sir! I hope this is useful and entertaining to many people.

Bisqwit
Автор

That reminds me. I did not actually _make_ the "see also" links yet. Heh. Thanks for reminding!

Bisqwit
Автор

If I some day figure out a purpose to use it for. So far, I am yet to write my first Haskell program.

Bisqwit
Автор

It is. But I recorded the video in a noisy server room, which required dubbing, so I decided to speak in Finnish and dub it in English later. It did not end up looking good. You can see an undubbed narration in the 1000-subscriber special video.

Bisqwit