Remix.run Logo
Ask HN: Books to learn 6502 ASM and the Apple II
54 points by abkt 3 hours ago | 29 comments

I want to learn Assembly to make games on the Apple II. What are the old books to learn 6502 Assembly and the Apple II itself (memory, screen management) ? And is it absolutely necessary to learn BASIC before Assembly ?

neomantra 27 minutes ago | parent | next [-]

My running joke after showing off some amazing LLM-driven work is...

if you think this is impressive, I once opened a modal dialog on an Apple IIGS in 65C816 assembly

I don't think you need to learn BASIC, if you know concepts like conditionals and looping and indexing. It is interesting to compare the higher-level language of the time with its companion assembly. And you might find yourself writing BASIC programs to complement your assembly, if you stick to that platform.

<lore> A friend dropped me a BASIC program that ran and wrote text to the Apple IIGS border. He asked me to figure it out, because it wasn't obvious what was going on. OG hacker puzzle... it was a BASIC program that jumped to hidden assembly after the apparent end of the text file (hidden chars maybe, I forget) and the assembly was changing the border at appropriate rate to "draw" on it. Those were the days... trying to find some reference to this and am failing. </lore>

I certainly credit my stack-frame debugging capability to dealing with that stuff so long ago. Oddly enough, I didn't really find it helpful for computer architecture class. Just because you know registers exists and how to manipulate them, doesn't exactly map architecting modern hardware system. But being fluent in logic operations and bit-twiddling and indexing does help a lot.

WillAdams 12 minutes ago | parent | prev | next [-]

No, you don't need to learn BASIC before assembly, but many books of the time went that route, e.g.,

https://www.goodreads.com/en/book/show/5011686-apple-machine...

Here is an interesting article on porting a BASIC game for the Apple II to GW BASIC:

https://nanochess.org/akalabeth.html

and it includes a link to the documented source code for Akalabeth (also known as Ultima 0)

Somewhere, there's an article discussing the assembly-language like bit-blitting used to draw the high-res graphics in a timely fashion and the variable/memory management techniques needed to drive that which I'm sure a bit of searching will turn up (or one can derive it from the source).

jlmcgraw 19 minutes ago | parent | prev | next [-]

There is "Apple Machine Language for Beginners" by Richard Mansfield https://archive.org/details/Apple_Machine_Language_for_Begin...

I have fond memories from the late 1980s of trying to get the assembler contained within this book working, typing line after line of the MLX listing in. Unfortunately I never did finish it back then.

A week or so ago I got the urge to complete this project and I literally just finished getting the source in it to a point where it can be compiled online and then within an emulator: https://github.com/jlmcgraw/LADS_DOS33

ksherlock 2 hours ago | parent | prev | next [-]

For Apple-II specific info, consider

The Assembly Lines book -- https://archive.org/details/AssemblyLinesCompleteWagner

Understanding the Apple IIe -- https://archive.org/details/understandingapp0000sath

Understanding the Apple II -- https://archive.org/details/understanding_the_apple_ii

joezydeco 30 minutes ago | parent | next [-]

Sather's book is the most comprehensive I've ever read. He even discusses the split screen vblank trick.

Gracana 2 hours ago | parent | prev [-]

Assembly Lines is the one I came to recommend. Great book to sit down with and work your way through.

OhMeadhbh 3 hours ago | parent | prev | next [-]

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

abkt 2 hours ago | parent [-]

I don't have any programming experience.

le-mark an hour ago | parent [-]

Google can be very helpful for these types of queries:

https://www.google.com/search?q=apple+2+game+programming+tut...

Formulating questions is a valuable skill as is finding existing resources.

As some one from that era, it is truly amazing how much information there is online about all aspects of 8 bit computers

abkt an hour ago | parent [-]

I don't think online tutorials are a good ressources to learn programming. We just have to look at what juniors can do nowadays (they can't even write a simple program, and I'm from that generation). That's why I asked for books.

einr 2 hours ago | parent | prev | next [-]

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.

billygoat 2 hours ago | parent | prev | next [-]

Machine Language for Beginners, Charles Mansfield https://archive.org/details/ataribooks-machine-language-for-...

This book specifically targets beginners that are new to 6502 assembly. The examples cover all of the 1980s-era computers including the Apple II. It's free on archive.org and the introductory chapters are worth reading.

kenjackson 27 minutes ago | parent [-]

This is what I read as a middle schooler learning 6502 on a C64. Does a good covering the basics in a very conversational manner.

i_don_t_know 2 hours ago | parent | prev | next [-]

I'm seconding the recommendation to look at Rodnay Zack's books. For example, I really enjoyed Advanced 6502 Programming. It's a project-based tutorial for a custom 6502 machine. The design and schematics are in the book.

https://archive.org/details/Advanced_6502_Programming/mode/2...

Tor3 an hour ago | parent [-]

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.

abkt an hour ago | parent [-]

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 ?

Tor3 15 minutes ago | parent [-]

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 the aforementioned Rodney Zaks books.

justin66 an hour ago | parent | prev | next [-]

Learning BASIC isn't essential, but the thing is, you might as well just do it. It's not complicated, and you're not under any obligation to develop a big piece of software with it. Have fun!

aa-jv 3 hours ago | parent | prev | next [-]

Pretty much the best resource available:

https://6502.org/

Check the books section and find something that compels you.

Also, don't forget the HUGE number of resources for 6502 assembly programming that are available in the https://archive.org/ magazine and book sections:

https://archive.org/search?query=6502

Rodney Zaks' books are great - I like especially "6502 Games", which taught me a lot back in the day:

https://archive.org/download/6502g/6502Games.pdf

I'm also especially fond of the easy6502 emulator - its a very handy tool to have while studying 6502 techniques:

https://skilldrick.github.io/easy6502/

Its not absolutely necessary to learn BASIC before Assembly, but it will definitely help you understand the resources of the machine better if you can debug BASIC ROM code. My personal 6502 platform of choice, the Oric-1/Atmos machines, has a pretty great ROM disassembly available, from which a lot of great knowledge can be obtained - but it does of course first require an undersanding of BASIC.

In case you're curious, the Oric-1 ROM Disassembly:

https://library.defence-force.org/books/content/oric_advance...

(You can get an Oric emulator named Oricutron, or you can access a virtual Oric here: https://oric.games/ ..)

Good luck!

asdefghyk 2 hours ago | parent | prev | next [-]

The answer would depend on what programming experience you have? Do you have any assembly language experience ? with other targets? ie have you used an assembler ( and maybe linker ) before. Are you familiar with hex? bytes, bits etc , You will learn this and much more ...

Id look for a book that targets Assembly programming on a Apple 2, ie not a book on general 6502 programming.

   Such a book Id expect to discuss things like Apple 2 memory map , Apple 2 hardware and how they are used in assembler language. 
Hopefully the book would also provide guidance using a particular assembler ( hopefully still available)

I googled phrase Apple 2 assembly language programming for beginners?

and lots of very good looking links popped up.

You aim is a challenging task. Much to learn. Good luck. However entirely do able these days.

My background is electronics engineer, embedded programing on in assembler (some Motorola processors and others) and C for a few years before moving on to other things ....

The book Assembly Lines: The Complete Book available as a FREE PDF download from .... site https://ct6502.org/product/assembly-lines-the-complete-book/

INCLUDES All 33 of Roger Wagner’s Assembly Lines articles from Softalk magazine, plus appendices, in one complete volume.

abkt 2 hours ago | parent [-]

I have litteraly no programming experience, that's partly why I want to learn 6502 Assembly.

zabzonk 2 hours ago | parent [-]

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

Joel_Mckay 2 hours ago | parent [-]

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

Starting with a simple architecture is highly recommended. =3

zabzonk an hour ago | parent [-]

Starting with the 6502 is going to bring you up hard against its addressing modes. Better IMHO to learn about memory and how to access it using arrays in BASIC first.

Tor3 12 minutes ago | parent | next [-]

My opinion differs - learning how memory is accessed via assembly language will make it super easy to understand e.g. how C pointers actually work, something which can be surprisingly difficult for those who go directly to a high level (compared to assembly) language, but very easy if you come from machine code/assembly.

Joel_Mckay 43 minutes ago | parent | prev [-]

Depends on learning goals, as BASIC teaches people some really bad habits.

They say "one always ends up coding in whatever your first language was... regardless of what language you are using".

People could always bring up the BASIC software Rom at the end of the build if interest arises after learning how a simple computer works. =3

https://github.com/chelsea6502/BeebEater

eej71 an hour ago | parent | prev | next [-]

Two books for consideration.

Randy Hyde the creator of the Lisa assembler.

https://archive.org/details/A2_Hyde_6502_Asm_Lang/mode/1up

Ken Williams of Sierra OnLine fame.

https://vintageapple.org/apple_ii/pdf/Apple_II_Computer_Grap...

dmezzetti an hour ago | parent | prev | next [-]

Have you considered using something like claude code / opencode?

christkv 2 hours ago | parent | prev [-]

I remember looking at the way graphics work on the Apple II and it looked pretty crazy lol with how memory layout worked to generate pixels.