8 ms·
Video Chess disassembled and commented
- eggy 3y agoI have Oscar's 'Programming Boot Sector Games' and I worked through it last summer. Great fun! And having programmed from 1978 on a Commodore PET 2001 in PET Basic and later on Vic-20 and Amigas in assembler and C, I learned a few new tricks from Oscar's book. Constraints hone your skills, so when you are buried in large frameworks and IDEs you can take some solace that not everything needs to be so complicated. It's also why I enjoy APL/J/BQN and April (APL Re-Imagined in Lisp).
- raldi 3y agoWhat is an “alone white king”?
- ttonkytonk 3y agoThis is off topic (I owned an Atari 2600, and loved Atari, but never owned Video Chess), but I've come up with a chess variant I call "Transposition Chess" (not to be confused with Transcendental Chess). The rules are the same with three major differences. I) Black has the option of transposing any two pieces on their back rank before play begins. If they do they must transpose the parallel pieces on their other side to make their setup symmetrical (unless they transpose the king and queen). White must adjust their setup to mirror Black's, and then play can commence. This creates 11 possible setups: 1)b>RNBQKBNR w>RNBQKBNR 2)b>RNBKQBNR w>RNBKQBNR 3)b>RBNQKNBR w>RBNQKNBR 4)b>BNRQKRNB w>BNRQKRNB 5)b>NRBQKBRN w>NRBQKBRN 6)b>RNQBBKNR w>RNQBBKNR 7)b>RNKBBQNR w>RNKBBQNR 8)b>RQBNNBKR w>RQBNNBKR 9)b>RKBNNBQR w>RKBNNBQR 10)b>QNBRRBNK w>QNBRRBNK 11)b>KNBRRBNQ w>KNBRRBNQ Castleling is only possible in the first five set-ups, and will always be with the piece that occupies the Rook's original square. II) Pieces can be demoted by moving them to an original pawn square (on one's own side of the board) and declaring a demotion. However, there must be at least one of their pawns captured that they can "exchange" it for. Note that the new pawn could deliver checkmate/stalemate. III) Pawns can only be promoted to pieces currently captured. If no pieces are currently captured, the pawn may not move to the promotion rank (as if a piece was blocking it). Note that it may still deliver checkmate/stalemate in this position, as normal. The thinking behind the first rule is to make book opening memorization less of an issue (without making things too complicated or unusual) as well as giving Black compensation for moving second. The thinking behind demotions is to make games that would normally be draws due to lack of material (or skill) winning. The thinking behind the last rule is to make over-the-board play easier (e.g. no confusion about whether a piece is a pawn or queen), though it also potentially makes "two for one" exchanges more attractive for the person capturing two pieces (I recently saw somewhere that there's some evidence that when the queen is exchanged for two rooks or the rook for two minor pieces, the person losing two pieces typically does better, though nominally they have less in material value).
- LanceH 3y agoNow get it hooked up to lichess and see where its rating ends up. I love the 2600 breakdowns and the hacks to get things working.
- kstrauser 3y agoI 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!
- jgrahamc 3y agoIf 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-p50.html https://blog.jgc.org/2022/11/primality-testing-on-commodore-...
- falcor84 3y ago> 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.
- jgrahamc 3y agoAnyone who wanted to push the limits of hardware at that time had to do tricks like this. There just wasn't any other choice. Sure, there were plenty of programmers back then who weren't capable. But it's not magic, it's careful thinking and hard work.
- ddingus 3y agoWell, 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.
- danmaz74 3y agoI 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.
- Drakim 3y agoI wonder if it "looks ahead" anything at all, or if it's just evaluating the current turn's piece trade potential. If it does look ahead, I wonder how many bytes per turn of lookahead is needed.
- flohofwoe 3y agoThink of the 128 bytes RAM to be only used for your dynamic gameplay state variables. C64 (and other home computer) games had to load all code and data into RAM, which usually accounts for most RAM usage. Game consoles like the Atari 2600 stored the code and static data in a ROM cartridge. For simple arcade-style games (like Pacman), 128 bytes of RAM is more then enough to manage the gameplay state. (still of course: a chess engine in 4 KByte ROM and 128 bytes RAM is pretty damn impressive)
- danmaz74 3y agoFitting a chess game state in 128 bytes is for sure doable; what is really impressive is being able to use the same memory not just for the current position, but also to compute the next moves in a decent way.
- haburka 3y agoImagine 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.
- samstave 3y ago[flagged]
- chrisbrandow 3y agoThe podcast advent of computing just had a deep dive into the intricacies and limitations of the Atari 2600. Having just listened to that episode, it makes this achievement even more impressive. https://overcast.fm/+Ri2NFzoG8 https://overcast.fm/+Ri2NFzoG8
- spogbiper 3y agoI highly recommend this podcast if you have any interest in our computing history
- syntex 3y agoYou can play this game here free80sarcade.com/atari2600_VideoChess.php
- _a_a_a_ 3y agoWell, there's also this https://en.wikipedia.org/wiki/1K_ZX_Chess https://en.wikipedia.org/wiki/1K_ZX_Chess 1K ZX Chess's code takes up only 672 bytes in memory,[2] but implements chess rules except for castling, promotion, and en passant, including a computer opponent.[3] It was the smallest implementation of chess on any computer at the time. 672 bytes RAM, No ROM. No promotion is a killer though
- wkjagt 3y agoOscar Toledo is awesome. I have his book Programming Boot Sector Games, and it's wonderful.
- deater 3y agodon't settle for chess on the Atari 2600 when you can be playing Myst on the Atari 2600: http://deater.net/weave/vmwprod/myst_vcs/ http://deater.net/weave/vmwprod/myst_vcs/ I'm trying to get it to the speed-runnable state before Mysterium next week, we'll see how that goes
- dws 3y agoMany 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.
- sitkack 3y agoI'd love to see a dev setup for using the PDP-11 and the Atari 2600 for doing gamedev. I did a quick search on youtube and the search engines and couldn't find anything.
- reaperducer 3y agoI'd love to see a dev setup for using the PDP-11 and the Atari 2600 for doing gamedev. I did a quick search on youtube and the search engines and couldn't find anything. The photographs I've seen aren't all that interesting. A VT-52 terminal and a hand-built cart wired into an RS-232 port, all on a long desk. Hopefully there are more exciting photographs out there that I haven't seen.
- rahen 3y agoHave a look at the PDF document here: https://forums.atariage.com/topic/259003-intellivision-development-back-in-the-day/ https://forums.atariage.com/topic/259003-intellivision-devel... Also check out the links provided at the end of the document. Besides the PDP-11, I'm glad to see the beloved PDP-10 was also used by game developers back in the days.
- sitkack 3y agoBe see, I mean a demo of what it is like to dev Atari 2600 games using a PDP-11. I mean there are PDP-11 emulators, we could setup a pure virtual Atari dev system.
- 3y ago
- nsxwolf 3y agoWhat's its ELO score? Edit: Really? Downvotes? Certainly it must have one. You could play someone on chess.com and find out?
- molticrystal 3y agoThis seems to have an estimate: https://chess.stackexchange.com/questions/24952/how-strong-is-each-level-of-atari-2600s-video-chess https://chess.stackexchange.com/questions/24952/how-strong-i... I was wondering the same thing. It is interesting to see the exact feature in past engines with limited resources that overcomes the threshold and moves an engine from the bottom to the higher ranks, and how historically what ideas were in place and which were culled that moved the engines in that direction.
- dbravender 3y agoI just finished training a neural network to play a trick taking card game and just the neural network is 4,250 times the size of the ROM for Video Chess and the executable including the UI is even bigger. True story: One time I was at a party and my parents introduced me to some friends of theirs and they said their son worked on graphics drivers. I said I couldn't handle low-level work like that. My parents glared at me and told me I was being rude. Once I figured out the disconnect I explained that low-level means closer to the CPU and it's much more complicated - not that it's less desirable work.
- cwaffles 3y agoSmallest chess engine in 288 bytes: https://leanchess.github.io/ https://leanchess.github.io/