5 ms·
Ask HN: Books to learn 6502 ASM and the Apple II
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 ?
- ThinkingGuy 8mo agoThis one worked for me: Apple II 6502 Assembly Language Tutor (1983) Richard E Haskell
- aa-jv 8mo agoPretty much the best resource available: https://6502.org/ 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/ https://archive.org/ magazine and book sections: https://archive.org/search?query=6502 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 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/ 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_advanced_user_guide_rom_disassembly.pdf 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/ https://oric.games/ ..) Good luck!
- i_don_t_know 8mo agoI'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/2up https://archive.org/details/Advanced_6502_Programming/mode/2...
- Tor3 8mo agoSeconded. 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 8mo agoIs 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 8mo agoFor 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.html 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.shtml 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.
- JKCalhoun 8mo agoSomeone 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 https://www.commodore.net [2] https://youtube.com/playlist?list=PLU1o_YShTPgoA7_nZ0PutqaPDsitA5RvV&si=maM-kNDXOnSpD5g_ https://youtube.com/playlist?list=PLU1o_YShTPgoA7_nZ0PutqaPD...
- OhMeadhbh 8mo agoThis is the book I used when I was writing serial drivers for Apple II ProDOS: https://archive.org/details/6502_Assembly_Language_Programming_by_Lance_Leventhal https://archive.org/details/6502_Assembly_Language_Programmi... And I have a vague memory of this book: https://archive.org/details/aiimp/mode/2up 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 https://archive.org/details/aiirm/mode/2up
- abkt 8mo agoI don't have any programming experience.
- le-mark 8mo agoGoogle can be very helpful for these types of queries: https://www.google.com/search?q=apple+2+game+programming+tutorial&ie=UTF-8&oe=UTF-8&hl=en-us&client=safari 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 8mo agoI 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.
- nippoo 8mo agoYou don't have any programming experience, and yet hold strong opinions on good resources to learn programming? There's some wonderful book recommendations in this thread, but I wouldn't underestimate how much great long-form content and tutorials there are on the Web these days (vs just learning by copying snippets off StackExchange)
- einr 8mo agoI 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.
- kurlberg 8mo agoRead it as a young teenager, can recommend.
- christkv 8mo agoI 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.
- asdefghyk 8mo agoThe 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/ 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 8mo agoI have litteraly no programming experience, that's partly why I want to learn 6502 Assembly.
- zabzonk 8mo agoMuch easier to start with BASIC. After all, why not?
- Joel_Mckay 8mo agoI 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=PLowKtXNTBypFbtuVMUVXNR0z1mu7dp7eH https://www.youtube.com/watch?v=LnzuMJLZRdU&list=PLowKtXNTBy... https://eater.net/6502 https://eater.net/6502 Starting with a simple architecture is highly recommended. =3
- ksherlock 8mo agoFor Apple-II specific info, consider The Assembly Lines book -- https://archive.org/details/AssemblyLinesCompleteWagner https://archive.org/details/AssemblyLinesCompleteWagner Understanding the Apple IIe -- https://archive.org/details/understandingapp0000sath https://archive.org/details/understandingapp0000sath Understanding the Apple II -- https://archive.org/details/understanding_the_apple_ii https://archive.org/details/understanding_the_apple_ii
- Gracana 8mo agoAssembly Lines is the one I came to recommend. Great book to sit down with and work your way through.
- joezydeco 8mo agoSather's book is the most comprehensive I've ever read. He even discusses the split screen vblank trick.
- not_clear 8mo agoAs mentioned in the link above, Assembly Lines is still in print as a paper book (maybe it's print on demand, but it's a hardcover). I just noticed that Understanding the Apple IIe also got a re-issue from Call-A.P.P.L.E. in 2024 (print edition from Lulu) - https://www.callapple.org/books-3/understanding-the-apple-iie/ https://www.callapple.org/books-3/understanding-the-apple-ii... .
- billygoat 8mo agoMachine Language for Beginners, Charles Mansfield https://archive.org/details/ataribooks-machine-language-for-beginners 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 8mo agoThis is what I read as a middle schooler learning 6502 on a C64. Does a good covering the basics in a very conversational manner.
- eej71 8mo agoTwo books for consideration. Randy Hyde the creator of the Lisa assembler. https://archive.org/details/A2_Hyde_6502_Asm_Lang/mode/1up 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_Graphics_1983.pdf https://vintageapple.org/apple_ii/pdf/Apple_II_Computer_Grap...
- dmezzetti 8mo agoHave you considered using something like claude code / opencode?
- justin66 8mo agoLearning 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!
- neomantra 8mo agoMy 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.
- jlmcgraw 8mo agoThere is "Apple Machine Language for Beginners" by Richard Mansfield https://archive.org/details/Apple_Machine_Language_for_Beginners_Richard_Mansfield/page/n1/mode/2up 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 https://github.com/jlmcgraw/LADS_DOS33
- WillAdams 8mo agoNo, 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-language 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 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).
- EvanAnderson 8mo agoThey 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-software/kim-1-simulator/ http://retro.hansotten.nl/6502-sbc/kim-1-manuals-and-softwar...
- wang_li 8mo agoIf you aren't doing hires graphics, you don't have to mess with the screen memory directly. You can just call the ROM routines which has the nice side effect of working with 40- or 80-columns automatically. If you are doing hires graphics you are going to use a lookup table regardless as doing the multiplication to get the base address of a particular scanline is far too slow. You can, one time, either make a table manually, which you can use forever, or you can write a short routine that counts from 0 to 191, stick 0 in X and the scanline number in A and JSR $F411. It'll leave the base address of the scanline in $36 and $37. Which you can stick in your table. As in other comments, if you are specifically interested in the Apple II line, the Assembly Lines books by Roger Wagner is fantastic. Also, if you can find it Sandy Mossberg's Disassembly Lines articles in Nibble magazine were great too. Start with Assembly Lines, then read the Disassembly Lines and you'll be quite expert.
- vparikh 8mo agoI recommend these two books for 6502 assembly: https://archive.org/details/ataribooks-machine-language-for-beginners/mode/2up https://archive.org/details/ataribooks-machine-language-for-... and https://archive.org/details/ataribooks-the-second-book-of-machine-language 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.
- mwexler 8mo agoThese 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.
- Smalltalker-80 8mo agoNext to a book on 6502 assembly, you can google "apple 2 original system manual" and download it. I contains ROM assembly source code and schematics.
- lakkal 8mo ago"reference manual" I think is what you mean. This is a link to a PDF pf the reference manual that includes the ROM disassembly: http://cini.classiccmp.org/pdf/Apple/Apple%20II%20Reference%20Manual%20-%20Woz.pdf http://cini.classiccmp.org/pdf/Apple/Apple%20II%20Reference%...
- andreybaskov 8mo agoOriginal Apple II manuals written by Chris Espinosa and Jef Raskin are a treat to read. Would highly recommend, just to get a sense of what it was like to get onboarded on Apple II back in the day. And then obviously Programming the 6502 by Rodnay Zaks.
- jacquesm 8mo agoLance Leventhal's CPU books are pretty comprehensive and make it easy to switch from one architecture to another. Learning BASIC is definitely not a requirement.
- dehrmann 8mo agoThere are a few distinct things here. Learning 6502 assembly is straightforward, and you'd be better learning about simple (not modern) assembly languages at a high level--opcodes, registers, noop, branch, jump, compare, accumulators, program counters, and clock cycles. From there, start writing 6502 in an emulator and seeing what happens. That's where you're going to learn, and the feedback will be a lot faster. Programming for an Apple II will be more about learning how to interact with devices through memory.
- rahimnathwani 8mo agoWhen you say 'start writing 6502 in an emulator', do you mean a couple emulator like py65, and not a system emulator like Elkulator?
- alnwlsn 8mo agoYou don't need to learn BASIC first but it might be helpful for bootstrapping at the beginning. Since it's included in the computer you can PEEK and POKE memory locations from BASIC and get a feel for how memory and machine code works without needing to understand the whole entire hardware, bootloading process, etc. first. In my opinion BASIC, with its line numbers and GOTO / GOSUB feels assembly-ish anyway - you'll be doing a lot of JMP / JSR to control program flow which is different to how modern high levels are normally written.
- runjake 8mo ago6502 Assembly Language Programming by Leventhal. This is how I learned. This book is great. I have the worn paper copy sitting 6 feet behind me as I type this. It's worth getting a paper copy if that is still possible. https://archive.org/details/6502-assembly-language-programming https://archive.org/details/6502-assembly-language-programmi...
- hybrid_study 8mo agoLove this. I had a copy 40 years ago.
- musicale 8mo agoLooks like a nice book, and it appears that he wrote books on other microprocessors (8080/8085, 8086, Z-80, Z8000, 6800, 6809, 68000... even SPARC apparently) as well. I'd like to find a full version of the 68000 book, which archive.org only seems to offer a preview of.
- ajross 8mo agoHonestly if you want to learn retro stuff for retro reasons... maybe consider using the retro materials? Here's the MOS programming manual for the original parts, it's what Woz would have used when hand-assembling Integer BASIC: https://archive.org/details/mos_microcomputers_programming_manual/page/n23/mode/2up https://archive.org/details/mos_microcomputers_programming_m... And it's really not so complicated! The chip is simple, so the docs are simple. There's more to read about the history to come later, but there's also something to be said for understanding it in the context its designers presented it.
- sloaken 8mo agoFor learning basic, the question is: do you already know how to program? Only reason I can think to learn basic is if you do not know any programming language. And even then there are better choices. Do they make an C compiler for the AppleII?
- waffletower 8mo agoI strongly recommend "What's Where in the Apple": https://archive.org/details/whatswhereinappl0000lueb https://archive.org/details/whatswhereinappl0000lueb I loved that book back in the day. Specific, directly addressable memory locations are mapped to system devices in a way that is quite foreign and Wild West when compared to modern computer architectures.
- rustyhancock 8mo agoIf you have absolutely no experience with assembly then I'd suggest starting very simple with a modern microcontroller. I have a special place in my heart for the original pic16f84a the modern equivalent is the pic16F1827. Which uses the same 35 core instructions. AVR8 is a close second.
- RiverCrochet 8mo ago> And is it absolutely necessary to learn BASIC before Assembly If you don't have experience programming, learning BASIC before Assembly will be super helpful before you learn 6502. If you only have experience programming in modern languages (Javascript, etc.), learning the Applesoft BASIC will also be super helpful before you learn 6502, as you'll learn how to get by without ... A) the following language conveniences: - function names (it's all line numbers), - variables with more than 2 letters, and B) the following modern concepts: - function calls (no stack other than for GOSUB, use subroutines with dedicated variables for passing parameters instead), - scoped variables (everything is global), - dynamic allocation (you have to DIM arrays with the max size upfront), - anything object-like like structs or classes (hack it with multi-dimensional arrays) - other fancy stuff like callbacks, promises, hashtables and any other data structure beyond arrays. and that will nicely prepare you for 6502 assembly (or any kind of assembly really). The advantage in 6502 assembly is you can implement most of B) yourself if you do need it.
- jsrcout 8mo agoThe Apple II Reference Manual includes assembly listings (with full comments!) for the Monitor ROM and Autostart ROM, the mini-assembler, floating point routines, and a very nice 16-bit "pseudo machine interpreter" called SWEET 16. Most of which was written by Steve Wozniak. Learned a lot from this book back in the day. Here's a link from archive.org. It's not the best scan, but you can easily find other copies. https://archive.org/details/applerefjan78/page/n69/mode/2up https://archive.org/details/applerefjan78/page/n69/mode/2up If you're feeling adventurous, you can find assembly listings for the AppleSoft BASIC language (though maybe only from third parties). It's pretty huge.
- 8bitsrule 8mo agoDon't overlook (if you can find them) books made for Commodore-64 assembly coders. (Same CPU.) While they won't contain II specifics, there were several that were very helpful with 6502 tricks.
- absynth 8mo agoTargeting 8-bit Apple, Computes gazette published a stack of magazines and books especially introductory. Rodney Zaks did a bunch as well. Personally I'd approach it using a raspi + python + pygame. Learn the fundamentals there then switch to apple.
- asdefghyk 8mo ago[Off TOpic somewhat] This post made me immediately recall, the hours I spent playing Apple Invaders, 1979 Pinball Construction Set, by Bill Bludge Chop Lifter, modeled on 1979–1981 Iran Hostage Crisis, Dan Gorlin, Brøderbund 1982 Castle Wolfenstein (1981) (Muse) by Silas Warner Red Alert (1981) Olaf Lubeck, Broderbund I still have some of these original games and the artwork in the shed..... All classic Apple games of very early 80s At the time, the programming was recognized as amazing, the sound and graphics. It was a marvel that it was achieved on such a low resource machine ....
- asdefghyk 8mo agoRE "....Books to learn 6502 ASM and the Apple II...." Suggest to look at some of the archives of old Apple Magazines from around the Apple I era , cira late 70s and early 80s. Some of them would have had assembly language programming columns. I recall one Named Softtalk , but there where many. There are other Sites than Archive.org. Some archive sites solely devoted to early apple computers like Apple 2
- sllabres 8mo agoI have seen the topic a bit late, but nevertheless: I have learned 6502 assembler (and assembler) in general with "6502 assembly language programming by Lance A. Leventhal" (1979) [1] and "Apple Machine Language by Don Inman & Kurt Inman" (1981) [2] For the 'internals' of the machine, I had "What's Where in the Apple: A Complete Guide to the Apple Computer by William F. Luebbert" (1985) amazon:[3] [1] https://archive.org/details/6502-assembly-language-programming https://archive.org/details/6502-assembly-language-programmi... [2] https://archive.org/details/a2-ml https://archive.org/details/a2-ml [3] https://www.amazon.de/Whats-Where-Apple-Complete-Computer/dp/0938222090 https://www.amazon.de/Whats-Where-Apple-Complete-Computer/dp...