Live data from Hacker News

Ask HN: Books to learn 6502 ASM and the Apple II

news.ycombinator.com

31–40 of 71 posts

Re: Ask HN: Books to learn 6502 ASM and the Apple II

#31
post #28
post #18

Earlier quoted context omitted.

Is Programming the 6502 enough to learn Assembly on the Apple II ? But it doesn't explain the memory and screen management, right ? So how can we learn that ?

For that you'll need Apple II documentation - though that's device-specific information. It's easy to find online, e.g. https://nicole.express/2024/phasing-in-and-out-of-existence.... , but there's lots more with various levels of info. This one, for example: https://www.kreativekorp.com/miscpages/a2info/memorymap.shtm... For actual 6502 programming you'll need a dedicated 6502 assembly programming book, for example…

Is the Apple II Reference Manual good for that ? Or anything specific to the Apple II, like "What's Where in the Apple" or "Understanding the Apple II" ?

Re: Ask HN: Books to learn 6502 ASM and the Apple II

#32
post #12

Earlier quoted context omitted.

Much easier to start with BASIC. After all, why not?

I respectfully disagree, BASIC/Java/Arduino hides too much about how the CPU works from users. Getting a 6502 kit from Ben Eater, and walking though how the CPU works will implicitly show how languages abstracted away whats actually happening. And more importantly, the skills necessary to understand how to write efficient programs. https://www.youtube.com/watch?v=LnzuMJLZRdU&list=PLowKtXNTBy... https://eater.net/6502…

I second this -- I just found the Ben Eater series a month or so ago and put together his computer clock over the holidays. It really helps you understand clock cycles, logic chips, etc, and is a good foundation for the 6502 kit you build later in the course. And learning Assembly before BASIC is the right learning path IMO, if only to understand how CPU registers work at the electron level.

Re: Ask HN: Books to learn 6502 ASM and the Apple II

#33
post #18
post #15

Earlier quoted context omitted.

Seconded. I bought the first edition of "Programming the 6502" way back in the neolithic, and I enjoyed it greatly. I even read parts of it again now and then these days too, just because I like it. I used to write assembly on, at first, the AIM-65, and later the Apple II.

Is Programming the 6502 enough to learn Assembly on the Apple II ? But it doesn't explain the memory and screen management, right ? So how can we learn that ?

Someone can correct me if I'm wrong, but I believe the screen memory of the Commodore machines (ViC-20, Commodore 64) were the most straight-forward. As opposed to the more janky Apple II memory map.

You could do a lot worse than picking up a new Commodore 64 Ultimate [1]. They're a more or less faithful remake of the Commodore 64 but have an HDMI port, SD card instead of disk drive, etc. You could learn BASIC, should be able move to assembly as well—a quick search pulled up a YouTube course on 6502 assembly for the Commodore [2].

(I realize I am not contributing "books"—but others have done well in this regard. I did want to share what I think is a pragmatic way to learn 6502.)

[1] https://www.commodore.net

[2] https://youtube.com/playlist?list=PLU1o_YShTPgoA7_nZ0PutqaPD...

Re: Ask HN: Books to learn 6502 ASM and the Apple II

#34
They screen memory layout on the Apple II was a clever hardware hack but makes programming the machine more difficult. I think you'd be better off using a "trainer", like a KIM-1 simulator [0] to get your feet wet. (The KIM-1 was made by MOS Technologies, manufacturers of the 6502, as a demonstration and prototyping platform for the CPU.)

If you can do simple exercises on a machine like that and get comfortable with simple operations (loops, memory addressing modes) I think you'd have a better time grokking something more feature-filled.

[0] http://retro.hansotten.nl/6502-sbc/kim-1-manuals-and-softwar...

Re: Ask HN: Books to learn 6502 ASM and the Apple II

#35
I recommend these two books for 6502 assembly:

https://archive.org/details/ataribooks-machine-language-for-...

and

https://archive.org/details/ataribooks-the-second-book-of-ma...

These two books will give you a good understanding of 6502 assembler - it is general but gives a good background and has a nice assembler with a full walk through of the code. I used these two books to learn 6502 on my Commodore 64 and they are highly recommended.

Re: Ask HN: Books to learn 6502 ASM and the Apple II

#36
post #4

I believe one of the "standard works" to learn 6502 back in the day was Programming the 6502 by Rodnay Zaks. It's out of print, but it was printed in a lot of copies so you should be able to find one second-hand.

Read it as a young teenager, can recommend.

Re: Ask HN: Books to learn 6502 ASM and the Apple II

#37
post #35

I recommend these two books for 6502 assembly: https://archive.org/details/ataribooks-machine-language-for-... and https://archive.org/details/ataribooks-the-second-book-of-ma... These two books will give you a good understanding of 6502 assembler - it is general but gives a good background and has a nice assembler with a full walk through of the code. I used these two books to learn 6502 on my Commodore 64 and they…

These are great books. I had them in paper, and they were great for understanding both how the 6502 worked, and metaphors for managing higher level constructs in ML.

Re: Ask HN: Books to learn 6502 ASM and the Apple II

#38
post #9

This is the book I used when I was writing serial drivers for Apple II ProDOS: https://archive.org/details/6502_Assembly_Language_Programmi... And I have a vague memory of this book: https://archive.org/details/aiimp/mode/2up Not sure what level you're at, but I can't remember if this is the text Jef Raskin wrote, but it's a decent backgrounder: https://archive.org/details/aiirm/mode/2up

I don't have any programming experience.

Definitely develop some capabilities to accomplish an elementary satisfying project in BASIC.

It's the language that was designed for you to learn about programming and a computer language at the same time.

Whether or not you actually "master" the language or just barely learn a few commands, before using a few commands to make a simple finished program. One approach would surely be a lot faster than the other ;)

After that then decide how much you learned about programming itself from the little project, then you can see how far that BASIC alone may be able to advance your programming abilities even after you may be very familiar with the language in detail, or not.

In that '80's generation of home computers with a 6502, most had built-in BASIC so a common progression for so many was to learn BASIC at the same time as learn programming, since nobody had ever had home computers before. This could be just fine for business applications. Assembly is not nearly as easy as BASIC to learn, but in some sense programming is programming.

Then for gaming BASIC was not nearly as fast as assembly but often BASIC performed just fine anyway for developing the logical game flow and making it a "fun" game at its core to begin with. The problem with BASIC was all the other little details like video, I/O, UI, HID, were all so dramatically slower because each BASIC command needed to be interpreted before it could be run on the hardware and that took a little extra time in between each command but it really added up when you have challenging hardware interfaces and not simply fundamental game logic (many times game logic can be so simple that it's never slow in any language).

For a plain BASIC game that is "complete" but is supposed to have quick action and low latency, the next step in the learning curve would then be to find out which part of the BASIC code is the main resource bottleneck when it comes to processing time, then replace that one function with an equivalent written in assembly. It was accepted that it was a lot more work then to introduce assembly to make the game do the same thing it was before, only quicker.

It may not be very clear looking back, but there were a number of good reference books and instructional approaches and so much of it was intertwined with "learn BASIC + programming at the same time" followed by "useful assembly language techniques" to speed up your programs.

As crowds moved along these lines together to a degree as they emerged, it might help to look at publication dates for the books of the time, and use what's found in the earlier texts to help you with later concepts.

Post reply on HN