Live data from Hacker News

Video Chess disassembled and commented

nanochess.org

21–30 of 72 posts

Re: Video Chess disassembled and commented

#22
post #8
post #5

I started developing software as a kid on a Commodore 64, and I thought we were pretty clever if we were able to accomplish interesting things using only 32KB of RAM. But the idea that somebody was able to develop a full chess engine using only 128 Bytes of RAM boggles my mind.

Imagine how easy it would be to tell people “Hey sorry we can’t include that feature, there’s not enough RAM” and then you could just build what you wanted to, exactly.

[flagged]

Re: Video Chess disassembled and commented

#23

I think I’m pretty good at writing software, and then I see stuff like this, and the impostor syndrome kicks in hard. A fully working chess game in 4K of ROM, using each of the 128 bytes of RAM for several purposes? That’s some genius. Bravo to OP for the disassembly and explanation, too!

Keep in mind is these kind of things have a flat memory space between RAM and ROM. It's not like today where disk is some thing way over there that you need to buffer in RAM. All of your code and resources are in ROM which means they're just an address away. Your RAM is scratch space for dynamic values but you can pull everything else from ROM.

For instance your bitmaps for pieces/spaces are stored in ROM, the code called when a scanline is drawn goes and accessed the values in ROM (it's just a memory address) without needing it to ever living in RAM. The only part that needs to live in RAM is the board state that the drawing code uses to find the bitmaps to draw. There's no need to draw to an off-screen buffer in RAM that then needs to be drawn to the screen.

None of that is to say 128 bytes of RAM is somehow easy but the code and data in ROM can do a lot of heavy lifting without taking much RAM.

Re: Video Chess disassembled and commented

#24
post #5

I started developing software as a kid on a Commodore 64, and I thought we were pretty clever if we were able to accomplish interesting things using only 32KB of RAM. But the idea that somebody was able to develop a full chess engine using only 128 Bytes of RAM boggles my mind.

By the way: right now I'm working on a chess training project(1), and I'm thinking that a marketing cofounder could really help. If anybody is interested, my contact info is in my profile.

(1) https://chess.braimax.com

Re: Video Chess disassembled and commented

#27
post #7
post #4

Earlier quoted context omitted.

If you only had 4K of ROM and 128 bytes of RAM you’d find a way. That’s what we all did back then. This isn’t to diminish Atari’s achievement (this stuff was super hard and also super satisfying), it’s just to say that doing these kinds of tricks was what you did when you wanted to create something state of the art with few resources. Here’s a silly example: https://blog.jgc.org/2022/11/primality-testing-on-commodore…

> That's what we all did back then. I think you might be "suffering" from the Dunning-Kruger Effect. Even if I accept that "all" the coders at that time were able to do this, that would just mean that the pool of people who were capable coders then is vastly more skilled than the typical coder these days.

Well, for some perspective tricks of the kind being discussed here were frequently published in magazines found in the local grocery store! Getting an extra sprite on a horizontal line, or putting more colors on the screen, various math tricks, how to pack multiple flags into a byte, and many other discussions were common.

When others say, "we had to", they are in part, communicating how thinking was done. The lower level details were often published down to the bits in registers and doing even simple things took one into tricks land more often than we may realize today.

Now that said, the VCS (2600) is a difficult machine. But, it was not above an average programmer to be successful as much as it did demand one go through the careful steps and thinking as told today. In fact, just doing what the machine was designed for; namely, "Combat" required that thinking.

I think you may be getting hung up on scope and scale. What I mean is the field was not as broad in some ways, and most everyone was a lot closer to the hardware than we mostly are today too.

Kids were jumping onto micros and literally figuring it out with the info they could glean from one another, manuals shipped with the machines (maybe), magazines and the like were the basic communications happening daily. I was one of those kids and in my peer group it was expected to understand the hardware well enough to follow code.

So yeah, overall it was just different in ways that may well prove confusing today, depending on what any of us may have chosen as our start point.

Re: Video Chess disassembled and commented

#28

I think I’m pretty good at writing software, and then I see stuff like this, and the impostor syndrome kicks in hard. A fully working chess game in 4K of ROM, using each of the 128 bytes of RAM for several purposes? That’s some genius. Bravo to OP for the disassembly and explanation, too!

Keep in mind is these kind of things have a flat memory space between RAM and ROM. It's not like today where disk is some thing way over there that you need to buffer in RAM. All of your code and resources are in ROM which means they're just an address away. Your RAM is scratch space for dynamic values but you can pull everything else from ROM. For instance your bitmaps for pieces/spaces are stored in ROM, the code c…

> All of your code and resources are in ROM which means they're just an address away.

Only until you need more rom than address space available to the cartridge slot, and you need to add bank switching. Then you've got to keep track of what bank resources are in.

Re: Video Chess disassembled and commented

#29
Many years back (so details are fuzzy), a friend who worked at Atari in the early 80's told that the programmer who did the game part of the work had the basic chess algorithm working in a few months, spent the next year getting it to run in less than 128 bytes of RAM, and was then burnt out and left tech.

IIRC, the game devs used a PDP-11 for much of their work, so that had a bit more RAM to work with to get started.

Re: Video Chess disassembled and commented

#30
post #6

I think I’m pretty good at writing software, and then I see stuff like this, and the impostor syndrome kicks in hard. A fully working chess game in 4K of ROM, using each of the 128 bytes of RAM for several purposes? That’s some genius. Bravo to OP for the disassembly and explanation, too!

I've worked through all the 2600 programming books, including the authors. I've yet to start on anything of my own worth while. At one point I thought maybe I could start reverse engineering some games for some inspiration. Didn't get more than a few hours into it before I decided I'd just rather watch other people do great things with the 2600.

I've considered doing something in this vein, and my thought is don't try to learn two things at once. Game design and game implementation are two different things; better to clone a game for your first several implementations, IMHO. OTOH, I'm not motivated enough to do that, either. :D
Post reply on HN