[HN Gopher] Elite on the 6502: The original 6502 assembly source...
       ___________________________________________________________________
        
       Elite on the 6502: The original 6502 assembly source, heavily
       commented
        
       Author : CharlesW
       Score  : 145 points
       Date   : 2025-01-31 19:55 UTC (12 hours ago)
        
 (HTM) web link (elite.bbcelite.com)
 (TXT) w3m dump (elite.bbcelite.com)
        
       | cookiengineer wrote:
       | The map overview is so well done. The comments are so nice and
       | thoroughly explaining what is stored in which register and what's
       | being manipulated.
       | 
       | I wish all codebases were like this. This must have taken months
       | to document it.
       | 
       | [1]
       | https://elite.bbcelite.com/c64/articles/map_of_the_source_co...
       | 
       | [2]
       | https://elite.bbcelite.com/c64/main/subroutine/tactics_part_...
        
       | hinkley wrote:
       | If I were king of the forest, there would be a degree program in
       | Comparative Coding (comparative lit for code).
       | 
       | We don't treat this as a creative discipline and thus we don't
       | spend time looking at masters, how they were successful and the
       | ways they were just as human as anyone.
       | 
       | Someone would get paid for writing stuff like this, same as
       | people getting paid to write about Poe, Cummings, Hemingway,
       | Thoreau.
       | 
       | But I guess the problem is that the way we price teaching and
       | coding, the gap is far too wide between talking about and doing,
       | unless you do it as a side hustle/hobby.
        
         | atan2 wrote:
         | Some people _do_ teach this type of content and do a pretty
         | good job at it. DisplacedGamers on youtube is a great channel,
         | Gustavo Pezzi from pikuma.com is excellent, and there is also
         | Ben Eater also covering 6502 programming, just to name a few.
        
           | akoboldfrying wrote:
           | Having greatly enjoyed Ben Eater's content (especially the
           | build-your-own-VGA!), I'll definitely check those others out.
           | Thanks!
        
         | nradov wrote:
         | Should people get paid to write about Poe, Cummings, Hemingway,
         | Thoreau? The original works themselves are pretty accessible.
         | People can just read them and form their own interpretations.
         | I'm skeptical that I really gained anything from reading
         | literary criticism, at least it didn't make me appreciate the
         | original works more or make me a better writer. I understand
         | that there's a long tradition of scholarship in comparative
         | literature and I'm not trying to be anti-intellectual or
         | dismissive of an entire field of study, but maybe we should
         | examine our assumptions and consider whether we're getting a
         | good value from paying academics to do that work? Is it
         | possible that society would be better off if we paid them to do
         | something else, like maybe write new literature?
        
           | hinkley wrote:
           | My English Lit friend definitely was aware of a trap of
           | learning to pick apart literature before you can create your
           | own. And then fell into it anyway. I suppose it's like
           | medical students and the DSM, sometimes it just freaks you
           | out instead of informing.
           | 
           | It should probably be an MS class or a senior level class.
        
           | KerrAvon wrote:
           | I don't actually care one way or another about that
           | particular subject, but if you start making judgements about
           | academic fields of study are worthwhile to pay for on the
           | basis of value to society, you allow other people -- more
           | ignorant people, let's say -- with different concepts of
           | societal value to make somewhat unfortunate decisions. You
           | might end up without any new literature at all.
        
             | nradov wrote:
             | Very little literature is written by academics. People who
             | want to write new literature can just go ahead and do it.
             | 
             | In a world of limited time and resources we always make
             | judgements about which academic fields of study are
             | worthwhile. At some level it's a zero-sum game: time spent
             | on comparative literature is time not spent on philosophy
             | or history or creative writing. So, given that we have to
             | prioritize which people to pay and which courses to
             | require, how should we make those decisions?
        
         | wkat4242 wrote:
         | I was talking to a friend who works in development and he says
         | that they even frown on recursion now. They think it's too
         | complex and causes junior programmers to footgun.
         | 
         | It's a shame because recursive code is often the most clean,
         | elegant and fast for things like traversing trees.
        
           | hinkley wrote:
           | One of my peeves with JavaScript is that I feel the reduce()
           | function has its arguments in the wrong order and increases
           | cognitive load. Elixir's is "right". I've never been that
           | much of a fan of recursion myself. Iteration and list
           | comprehension for me.
        
       | fredoralive wrote:
       | The site also now has a disassembly of !Lander, which in
       | hindsight is an amazing demo (that begat Zarch / Virus) - super
       | smooth 3D in 1987 on a "micro". As a kid in the early '90s I
       | didn't appreciate it, it was that exploding spaceship thing you
       | could run on the computers at school. But in hindsight, wow that
       | ARM and VIDC could be amazing.
        
         | yzydserd wrote:
         | Thanks for the Lander pointer. Virus blew my mind when I first
         | saw it, those decades ago. Now to restrain myself from hours in
         | the source code.
        
       | dekhn wrote:
       | The game elite (on my apple iie) played a big role in me being
       | interested in 3d graphics (most importantly, hidden line
       | removal). I was really curious as a high school student how the
       | game achieved what it did, and it wasn't until later that I read
       | a few interviews with the authors (and later, the source code)
       | that I began to appreciate just how unprepared I was back then to
       | write a first-class game.
       | 
       | Beyond that it was a great game to play. I used to buy drugs on
       | poor agricultural planets, then sell them for massive profits on
       | rich industrial ones, then buy illegal weapons and sell them back
       | on the poor agricultural planets. Starfighting was quite good in
       | terms of frame rate and enemy AI. At some point, hundreds of
       | hours into the game, I was offered a unique mission to recover a
       | spacecraft...
        
       | kmoser wrote:
       | Related: https://news.ycombinator.com/item?id=42436783
        
       | mrlonglong wrote:
       | The Teletext variant is amazing
        
       | markus_zhang wrote:
       | I think Computer Architecture can be designed around legacy but
       | fun hardwares.
       | 
       | So instead of using some fantasy machines such as LC-3, students
       | can directly get into the world of 6502.
       | 
       | First semester: mostly concentrated on 6502 with a full 6502 CPU
       | emulator as the final project.
       | 
       | Second semester: concentrate on a real machine such as the NES.
       | Students need to learn to improve their emulators to program in
       | it (so, do you need a debugger? a decompiler?), as well as
       | hacking roms, burning roms, using carts to load the games into a
       | real NES, and programming new games for it. The game must run in
       | the emulator as well as a real NES.
       | 
       | Third semester for honour: upgrade to a 16/24/32-bit machine,
       | e.g. 80286, SNES, 68K, whatever, and get some serious project
       | done. Can use C if applicable. The project can even be a simple
       | OS or a BASIC interpreter to pave the way for advanced classes.
       | Or maybe a computer virus, anything that is fun and creative.
       | 
       | OS and compiler classes can also be designed around real hardware
       | and projects. e.g. Porting an early version of Linux to a once
       | popular architecture and add a few small functionalities; Write a
       | compiler for a LISP-like language for that architecture and OS.
       | 
       | You don't even need Data Structure and Algorithm and those BS
       | Java programming classes - they learn them on the way. And if
       | they miss anything they can pick them up on the job.
        
         | mrandish wrote:
         | I like your idea, though I'm probably biased because I learned
         | computers and computer programming starting with zero
         | experience, zero knowledge and nothing but a 4K, sub-1 Mhz
         | Radio Shack Color Computer. Unfortunately, in 1980 there were
         | virtually no real instructional materials available on
         | microcomputers. Learning consisted mostly of just trying
         | things, typing in listings from low-budget hobbyist 'zines and
         | comparing notes at user's group meetings.
         | 
         | One great advantage to your approach is that emulators are free
         | and some of them, like MAME, have extremely powerful debugging
         | and exploration tools built right in. Plus there's extensive
         | developer documentation, SDKs and instructional materials
         | available for many of the most popular platforms along with
         | lots of commented code disassemblies. Having an actual course
         | structured around curated sets of these materials would be
         | pretty amazing.
        
           | markus_zhang wrote:
           | Yep, and I know some instructors actually tried that (from
           | Carnegie-Mellon):
           | 
           | https://bobrost.com/nes/
           | 
           | I think it's a good idea to go further to work on more
           | difficult retro platforms. I know teachers like LC-3 because
           | it is simple, but I think they underestimate the devoted
           | students.
        
             | mrandish wrote:
             | > I think it's a good idea to go further to work on more
             | difficult retro platforms.
             | 
             | Agreed, although I'm not sure platforms like Genesis, Amiga
             | or NeoGeo would really be much more difficult for a
             | beginner following a framework than NES. However, their
             | increased performance, resolution and colors would be more
             | capable of creating inspiring output.
        
           | Mountain_Skies wrote:
           | There's a YouTube channel called CocoTown where he's building
           | a Moon Patrol clone for the Color Computer in assembly from
           | scratch. He's making good use of MAME and other modern tools.
           | Can't imagine how less pleasant it would have been creating
           | something like that using just EDTASM back in the day.
        
             | markus_zhang wrote:
             | That's really a nice project. I had a thought a few years
             | ago that if someone wants to be a game programmer, one idea
             | is to find a hero (e.g. Rebecca Heinemann or John Carmack)
             | and replicate some games they made, aka walk their roads on
             | retro platforms.
        
         | nateglims wrote:
         | I did an EE degree and the sophmore firmware course used an 8
         | bit PIC (or a motorola 6800 a few years before). About a third
         | of the semester was entirely in PIC assembly, then C, then
         | advanced stuff in C. I think your idea is pretty viable, and
         | sounds more fun than the comp arch class offered.
        
           | markus_zhang wrote:
           | Thanks. It's going to put a hell lot of work on the
           | professors so it's probably more suitable for some people
           | like Gustav (the pikuma guy).
        
         | selcuka wrote:
         | When I was in college, we took a hybrid approach. We used a
         | real CPU (6809), but instead of using a real computer (since
         | 6809-based computers were not as common as Z80 or 6502-based
         | ones), we used an educational kit designed and built by the
         | professor who taught the course. This kit could be programmed
         | via the serial console using the built-in debugger (or monitor,
         | as they were called back then).
        
         | astrange wrote:
         | 6502 would give them a dose of reality, but I think teaching
         | people by having them program an 8-bit CISC chip is cruel.
         | There's so many asymmetries that get in the way.
         | 
         | (Also, I don't think anyone actually likes NES games except for
         | nostalgia, but this might just be because square waves make my
         | ears hurt.)
        
       | leoc wrote:
       | The "Advanced User Guide" referred to several times in the
       | comments is _The Advanced User Guide for the BBC Micro_ by Bray,
       | Dickens and Holmes, 1983, ISBN 0 946827 00 1 .
       | https://stardot.org.uk/forums/viewtopic.php?f=42&t=17242
       | https://archive.org/details/bbc-micro-advanced-user-guide/ I
       | can't find a source for this now, but IIRC Bell and Braben
       | themselves used this when writing _Elite_. (I am not an expert.)
        
       | nejsjsjsbsb wrote:
       | Past discussions
       | https://news.ycombinator.com/from?site=bbcelite.com
        
       | vardump wrote:
       | Have to mention the new Commodore VIC-20 version of Elite:
       | https://www.youtube.com/watch?v=3J0xRcux1FI
        
       ___________________________________________________________________
       (page generated 2025-02-01 08:00 UTC)